Skip to content

Formerly KrillinAI, VideoTranslation and Dubbing Tool for 120+ Languages. Open-source AI workspace for creators, powered by Codex. Video downloader, video translation, create videos, images, audios, and edits with Agents in one place. For your Social Media like YouTube, TikTok, Instagram, etc.

fix(creator): decouple runtime components and stabilize stickman workflows

Leggett303e8f8eacde
diff --git a/apps/daemon/package.json b/apps/daemon/package.json
index cc8c7cfa..303c9a8c 100644
--- a/apps/daemon/package.json
+++ b/apps/daemon/package.json
@@ -28,7 +28,6 @@
"@opencreator/protocol": "workspace:*",
"@opencreator/skill-market": "workspace:*",
"@opencreator/writing-templates": "workspace:*",
- "@remotion/renderer": "4.0.473",
"better-sqlite3": "^12.11.1",
"cheerio": "1.1.2",
"cron-parser": "^5.6.1",
@@ -47,6 +46,7 @@
},
"devDependencies": {
"@remotion/bundler": "4.0.473",
+ "@remotion/renderer": "4.0.473",
"@types/better-sqlite3": "^7.6.13",
"@types/cross-spawn": "^6.0.6",
"@types/pdf-parse": "1.1.5",
diff --git a/apps/daemon/src/api/routes.creator-runtime.ts b/apps/daemon/src/api/routes.creator-runtime.ts
index afc074af..16820260 100644
--- a/apps/daemon/src/api/routes.creator-runtime.ts
+++ b/apps/daemon/src/api/routes.creator-runtime.ts
@@ -5,19 +5,21 @@ import { YtDlpUpdateError } from '../creator/yt-dlp/update-manager.js';
import { apiError } from './errors.js';
import type { CreatorServicesConfig } from '@opencreator/protocol';
import type { createKrillinDependencyLoader } from '../creator/krillin/dependency-loader.js';
+import type { RemotionComponentManager } from '../creator/stickman/remotion-component.js';
const componentDownloadSchema = z.object({
- componentId: z.enum(['whisperkit', 'whisper.cpp', 'faster-whisper']).optional()
+ componentId: z.enum(['whisperkit', 'whisper.cpp', 'faster-whisper', 'remotion']).optional()
}).optional();
export async function registerCreatorRuntimeRoutes(
server: FastifyInstance,
ytDlp: YtDlpUpdateManager | undefined,
- local?: { loader: ReturnType<typeof createKrillinDependencyLoader>; readConfig(): Promise<CreatorServicesConfig> }
+ local?: { loader: ReturnType<typeof createKrillinDependencyLoader>; readConfig(): Promise<CreatorServicesConfig>; remotion?: RemotionComponentManager }
): Promise<void> {
server.addHook('preClose', () => {
ytDlp?.close();
local?.loader.close();
+ local?.remotion?.close();
});
server.get('/creator/yt-dlp/status', async (_request, reply) => {
@@ -46,13 +48,24 @@ export async function registerCreatorRuntimeRoutes(
server.get('/creator/components/status', async (_request, reply) => {
if (local === undefined) return reply.code(503).send(apiError('creator_components_unavailable', 'Local components are unavailable'));
- return local.loader.status(await local.readConfig());
+ const status = await local.loader.status(await local.readConfig());
+ if (local.remotion) status.components.push(await local.remotion.status());
+ return status;
});
server.post('/creator/components/download', async (request, reply) => {
if (local === undefined) return reply.code(503).send(apiError('creator_components_unavailable', 'Local components are unavailable'));
try {
const body = componentDownloadSchema.parse(request.body);
- return await local.loader.download(await local.readConfig(), body?.componentId);
+ const config = await local.readConfig();
+ if (body?.componentId === 'remotion') {
+ if (!local.remotion) throw new Error('Remotion components are unavailable');
+ await local.remotion.download();
+ } else {
+ await local.loader.download(config, body?.componentId);
+ }
+ const status = await local.loader.status(config);
+ if (local.remotion) status.components.push(await local.remotion.status());
+ return status;
} catch (error) {
return reply.code(400).send(apiError('creator_component_download_unavailable', error instanceof Error ? error.message : 'Component download unavailable'));
}
diff --git a/apps/daemon/src/api/server.ts b/apps/daemon/src/api/server.ts
index 0c4d99bc..e869bf54 100644
--- a/apps/daemon/src/api/server.ts
+++ b/apps/daemon/src/api/server.ts
@@ -85,6 +85,7 @@ import { createStickmanVisualAssetRegistry } from '../creator/stickman/visual-as
import { createStickmanValidationExecutor } from '../creator/stickman/validation-executor.js';
import { createStickmanTimelineExecutor } from '../creator/stickman/timeline-executor.js';
import { createStickmanRemotionExecutor } from '../creator/stickman/remotion-executor.js';
+import { createRemotionComponentManager } from '../creator/stickman/remotion-component.js';
import { createStickmanMediaValidationExecutor } from '../creator/stickman/media-validation-executor.js';
import { createStickmanDeliveryExecutor } from '../creator/stickman/delivery-executor.js';
import { CreatorProviderRequestLedger } from '../creator/provider-requests.js';
@@ -672,15 +673,25 @@ export async function buildServer(input: BuildServerInput) {
configStore: creatorServicesConfigStore,
codexNative: codexImageRuntime
});
- const developmentStickmanRuntimeRoot = resolve(
+ const packagedRemotionReleasePath = resolve(
dirname(fileURLToPath(import.meta.url)),
- '../../../desktop/.pack/stickman-runtime'
+ '../../runtime/remotion-component.json'
);
const stickmanRuntimeRoot = process.env.OPENCREATOR_STICKMAN_RUNTIME_ROOT
- ?? (existsSync(developmentStickmanRuntimeRoot)
- ? developmentStickmanRuntimeRoot
- : join(dataDir, 'creator-runtime', 'stickman'));
- const packagedStickmanCatalog = join(stickmanRuntimeRoot, 'visual-assets', 'catalog.json');
+ ?? join(dataDir, 'creator-runtime', 'stickman');
+ const developmentRemotionReleasePath = resolve(dirname(fileURLToPath(import.meta.url)), '../../../desktop/.pack/components/remotion-component.json');
+ const remotionReleasePath = process.env.OPENCREATOR_REMOTION_COMPONENT_MANIFEST
+ ?? (existsSync(packagedRemotionReleasePath) ? packagedRemotionReleasePath : developmentRemotionReleasePath);
+ const remotionComponent = createRemotionComponentManager({
+ root: stickmanRuntimeRoot,
+ releasePath: remotionReleasePath,
+ archivePath: process.env.OPENCREATOR_REMOTION_COMPONENT_ARCHIVE,
+ developmentArchiveRoot: !existsSync(packagedRemotionReleasePath) && process.env.OPENCREATOR_RUNTIME_CHANNEL === 'development' ? dirname(remotionReleasePath) : undefined,
+ readProxy: async () => (await creatorServicesConfigStore.read()).proxy.trim()
+ });
+ const packagedStickmanAssetsRoot = process.env.OPENCREATOR_STICKMAN_ASSETS_ROOT
+ ?? resolve(dirname(fileURLToPath(import.meta.url)), '../../runtime/stickman-assets');
+ const packagedStickmanCatalog = join(packagedStickmanAssetsRoot, 'visual-assets', 'catalog.json');
const developmentStickmanCatalog = resolve(
dirname(fileURLToPath(import.meta.url)),
'../../../../resources/stickman/visual-assets/catalog.json'
@@ -691,7 +702,7 @@ export async function buildServer(input: BuildServerInput) {
);
const stickmanVisualAssetOptions = existsSync(packagedStickmanCatalog)
? {
- root: stickmanRuntimeRoot,
+ root: packagedStickmanAssetsRoot,
catalogPath: packagedStickmanCatalog
}
: existsSync(developmentStickmanCatalog)
@@ -850,7 +861,8 @@ export async function buildServer(input: BuildServerInput) {
}));
creatorExecutors.push(createStickmanRemotionExecutor({
ffprobePath: creatorFfprobePath,
- runtimeRoot: stickmanRuntimeRoot
+ runtimeRoot: stickmanRuntimeRoot,
+ ensureRuntime: stage => remotionComponent.ensure(stage)
}));
if (creatorFfmpegPath) {
creatorExecutors.push(createStickmanMediaValidationExecutor({
@@ -915,6 +927,7 @@ export async function buildServer(input: BuildServerInput) {
ffmpegPath: creatorFfmpegPath,
ffprobePath: creatorFfprobePath,
stickmanRuntimeRoot,
+ remotionComponent,
...(getYtDlpRuntime === undefined ? {} : { getYtDlpRuntime }),
runtimeVerificationCachePath: krillinVerificationCachePath,
ensureRuntimeReady: () => ensureKrillinRuntimeReady(),
@@ -1426,6 +1439,7 @@ export async function buildServer(input: BuildServerInput) {
await registerSmartDubbingRoutes(server, smartDubbingService);
await registerCreatorRuntimeRoutes(server, creatorYtDlpUpdateManager, {
loader: krillinDependencyLoader,
+ remotion: remotionComponent,
readConfig: () => creatorServicesConfigStore.read()
});
await registerImageGenerationRoutes(server, imageGenerationService);
diff --git a/apps/daemon/src/creator/krillin/local-components.ts b/apps/daemon/src/creator/krillin/local-components.ts
index 57710d08..b4f19044 100644
--- a/apps/daemon/src/creator/krillin/local-components.ts
+++ b/apps/daemon/src/creator/krillin/local-components.ts
@@ -6,7 +6,7 @@ type Operation = { controller: AbortController; promise: Promise<void>; listener
export function manageLocalComponents(input: {
loader: KrillinDependencyLoader;
- inspect(): Promise<Omit<CreatorRuntimeComponentsResponse, 'selectedProvider' | 'selectedModel'>>;
+ inspect(): Promise<Omit<CreatorRuntimeComponentsResponse, 'selectedProvider' | 'selectedModel' | 'components'> & { components: CreatorLocalComponent[] }>;
}) {
const operations = new Map<string, Operation>();
const states = new Map<string, Partial<CreatorLocalComponent>>();
diff --git a/apps/daemon/src/creator/preflight.ts b/apps/daemon/src/creator/preflight.ts
index 8aa1ceeb..28c46333 100644
--- a/apps/daemon/src/creator/preflight.ts
+++ b/apps/daemon/src/creator/preflight.ts
@@ -21,6 +21,7 @@ import {
import { creatorResultSnapshotForVersion } from './result-snapshots.js';
import { resolveCreatorStageInputs } from './stage-runner.js';
import { readStickmanRemotionRuntime } from './stickman/remotion-runtime.js';
+import type { RemotionComponentManager } from './stickman/remotion-component.js';
import { validateBilibiliSource } from './templates/video-translation-actions.js';
import type { VideoMetadataService } from '../video-metadata/service.js';
@@ -61,6 +62,7 @@ export function createCreatorPreflight(input: {
ffmpegPath?: string;
ffprobePath?: string;
stickmanRuntimeRoot?: string;
+ remotionComponent?: Pick<RemotionComponentManager, 'status'>;
getYtDlpRuntime?(): YtDlpRuntime | undefined;
runtimeVerificationCachePath?: string;
ensureRuntimeReady?(): Promise<void>;
@@ -218,16 +220,25 @@ export function createCreatorPreflight(input: {
}
if (stage.executor === 'stickman-remotion') {
try {
- if (input.stickmanRuntimeRoot === undefined) throw new Error('stickman_runtime_unavailable');
- readStickmanRemotionRuntime(input.stickmanRuntimeRoot);
- add('ready', { id: 'stickman-runtime', title: 'Stickman 渲染运行时', message: 'Remotion 运行资源校验通过。', executionMode: 'local' });
+ if (input.remotionComponent) {
+ const component = await input.remotionComponent.status();
+ if (!component.available) throw new Error(component.error ?? 'remotion_component_unavailable');
+ add(component.state === 'ready' ? 'ready' : 'warning', {
+ id: 'stickman-runtime', title: 'Remotion 渲染组件',
+ message: component.state === 'ready' ? 'Remotion 渲染组件已就绪。' : '执行渲染时将按需准备 Remotion 组件,完成后自动继续。', executionMode: 'local'
+ });
+ } else {
+ if (input.stickmanRuntimeRoot === undefined) throw new Error('stickman_runtime_unavailable');
+ readStickmanRemotionRuntime(input.stickmanRuntimeRoot);
+ add('ready', { id: 'stickman-runtime', title: 'Stickman 渲染运行时', message: 'Remotion 运行资源校验通过。', executionMode: 'local' });
+ }
} catch (error) {
add('blocked', {
id: 'stickman-runtime',
title: 'Stickman 渲染运行时不可用',
message: error instanceof Error ? error.message : 'Remotion 运行资源校验失败。',
executionMode: 'local'
- }, { label: '打开运行组件设置', deepLink: '#/settings?tab=local-components' });
+ }, { label: '打开运行组件设置', deepLink: '#/settings?tab=local-components&component=remotion' });
}
}
}
diff --git a/apps/daemon/src/creator/stickman/content-executor.ts b/apps/daemon/src/creator/stickman/content-executor.ts
index ced10517..09d20b1f 100644
--- a/apps/daemon/src/creator/stickman/content-executor.ts
+++ b/apps/daemon/src/creator/stickman/content-executor.ts
@@ -513,9 +513,11 @@ async function storyboard(stage: CreatorExecutorInput, complete: CompleteJson) {
}
failures = finalized.failures;
stage.reportProgress({
- phase: 'planning',
+ phase: attempt < 2 ? 'planning' : 'failed',
percent: 40 + attempt * 25,
- message: `分镜第 ${attempt + 1} 次生成未通过语义契约,正在整稿重生成`,
+ message: attempt < 2
+ ? `分镜第 ${attempt + 1} 次生成未通过语义契约,正在整稿重生成`
+ : '分镜连续 3 次生成未通过校验,已停止,请重试',
completed: 0,
failed: 1,
total: 1
@@ -564,7 +566,8 @@ function storyboardPrompt(input: {
? ''
: `\n上一份完整分镜:${JSON.stringify(input.draftToRepair)}\n校验失败原因:${JSON.stringify(input.validationFailures)}\n请重新生成整份分镜。`;
return `你负责把已经审核并完成真实配音的旁白转换成语义分镜,只返回严格 JSON,不要 Markdown。
-每个 sourceSegmentId 必须且只能出现一次,并保持输入顺序。每个旁白单元生成一张图,严格采用提供的真实起止时间,不得合并或拆分时间。
+每个 sourceSegmentId 必须且只能出现一次,并保持输入顺序。每个旁白单元生成一张图,不得合并或拆分旁白单元。
+真实起止时间仅供理解节奏,由系统根据配音统一绑定。输出只允许示例中的字段,禁止返回 startSeconds、endSeconds、durationSeconds,不得生成或修改时间。
visualDescription 是真正用于生图的画面描述:只写当前画面中的主体关系、动作、环境和可见物,不写旁白原文,不写角色长相,不写绘画风格,不要求任何文字、数字、字幕、标题、标签、Logo、界面或分屏。
semanticAnchor 概括画面必须传达的唯一含义;compositionAndAction 描述主体位置、视线、动作方向和空间关系;keyObjects 只列支撑含义的必要物体;continuityReason 说明与前后镜头如何连续,没有要求时返回空字符串。
motion 必须由构图和叙事意图选择:静态说明用 static,聚焦主体用 push-in,揭示全局用 zoom-out,只有存在明确横向关注移动时才使用 pan-left 或 pan-right。motionReason 必须说明选择原因,不能按序号轮换。
@@ -1018,16 +1021,24 @@ function normalizeGeneratedJson(stageId: string, value: unknown): unknown {
if (stageId === 'storyboard') {
const root = remapGeneratedKeys(value, { '分镜': 'shots', '镜头': 'shots' });
if (isJsonRecord(root) && Array.isArray(root.shots)) {
- root.shots = root.shots.map(shot => remapGeneratedKeys(shot, {
- '来源段落': 'sourceSegmentId',
- '语义锚点': 'semanticAnchor',
- '画面描述': 'visualDescription',
- '构图与动作': 'compositionAndAction',
- '关键物体': 'keyObjects',
- '连续性说明': 'continuityReason',
- '运镜': 'motion',
- '运镜理由': 'motionReason'
- }));
+ root.shots = root.shots.map(shot => {
+ const normalizedShot = remapGeneratedKeys(shot, {
+ '来源段落': 'sourceSegmentId',
+ '语义锚点': 'semanticAnchor',
+ '画面描述': 'visualDescription',
+ '构图与动作': 'compositionAndAction',
+ '关键物体': 'keyObjects',
+ '连续性说明': 'continuityReason',
+ '运镜': 'motion',
+ '运镜理由': 'motionReason'
+ });
+ if (isJsonRecord(normalizedShot)) {
+ for (const field of ['startSeconds', 'endSeconds', 'durationSeconds']) {
+ delete normalizedShot[field];
+ }
+ }
+ return normalizedShot;
+ });
}
return root;
}
diff --git a/apps/daemon/src/creator/stickman/remotion-component.ts b/apps/daemon/src/creator/stickman/remotion-component.ts
new file mode 100644
index 00000000..8292b491
--- /dev/null
+++ b/apps/daemon/src/creator/stickman/remotion-component.ts
@@ -0,0 +1,214 @@
+import { createHash, randomUUID } from 'node:crypto';
+import { readFile, mkdir, rename, rm, stat } from 'node:fs/promises';
+import { join, resolve } from 'node:path';
+import { z } from 'zod';
+import type { CreatorJson, CreatorRuntimeComponent } from '@opencreator/protocol';
+import { configuredOrDownloadedFile } from '../krillin/dependency-loader.js';
+import { spawnCreatorProcess } from '../process-tree.js';
+import { readStickmanRemotionRuntime, type StickmanRemotionRuntime } from './remotion-runtime.js';
+
+export const remotionComponentReleaseSchema = z.object({
+ version: z.literal(1),
+ id: z.literal('remotion'),
+ componentVersion: z.string().min(1),
+ remotionVersion: z.string().min(1),
+ chromiumVersion: z.string().min(1),
+ platform: z.enum(['darwin', 'win32', 'linux']),
+ arch: z.enum(['arm64', 'x64']),
+ archiveUrl: z.string().url(),
+ archiveSha256: z.string().regex(/^[a-f0-9]{64}$/),
+ manifestSha256: z.string().regex(/^[a-f0-9]{64}$/),
+ bytes: z.number().int().positive(),
+ fileName: z.string().regex(/^Remotion-[a-zA-Z0-9._-]+\.tar\.gz$/)
+}).strict();
+
+export type RemotionComponentRelease = z.infer<typeof remotionComponentReleaseSchema>;
+type Progress = Record<string, CreatorJson>;
+
+export function createRemotionComponentManager(input: {
+ root: string;
+ releasePath: string;
+ archivePath?: string;
+ developmentArchiveRoot?: string;
+ readProxy(): Promise<string>;
+}) {
+ let release: RemotionComponentRelease | undefined;
+ let releaseError: string | undefined;
+ let prepared: StickmanRemotionRuntime | undefined;
+ let installedAt: string | null = null;
+ let pending: Promise<StickmanRemotionRuntime> | undefined;
+ let controller: AbortController | undefined;
+ let closed = false;
+ let progress: Progress = {};
+ let state: CreatorRuntimeComponent['state'] = 'not_installed';
+ let error: string | null = null;
+ const listeners = new Set<(progress: Progress) => void>();
+
+ async function readRelease(force = false) {
+ if (release && !force) return release;
+ try {
+ const value = remotionComponentReleaseSchema.parse(JSON.parse(await readFile(input.releasePath, 'utf8')));
+ if (value.platform !== process.platform || value.arch !== process.arch) throw new Error('remotion_component_wrong_platform');
+ release = value;
+ releaseError = undefined;
+ return value;
+ } catch (cause) {
+ releaseError = cause instanceof Error ? cause.message : String(cause);
+ throw cause;
+ }
+ }
+
+ function publish(next: Progress) {
+ progress = next;
+ for (const listener of listeners) listener(next);
+ }
+
+ async function verifyRuntime(root: string, value: RemotionComponentRelease) {
+ const manifestPath = join(root, 'manifest.json');
+ const manifestContents = await readFile(manifestPath);
+ if (createHash('sha256').update(manifestContents).digest('hex') !== value.manifestSha256) throw new Error('remotion_component_manifest_hash_mismatch');
+ const runtime = readStickmanRemotionRuntime(root, true);
+ const manifest = JSON.parse(manifestContents.toString()) as { remotionVersion: string; chromiumVersion: string; rendererEntry?: string; resources: Array<{ path: string; kind: string }> };
+ if (!runtime.rendererEntry || !manifest.resources.some(resource => resource.path === manifest.rendererEntry && resource.kind === 'renderer') || manifest.remotionVersion !== value.remotionVersion || manifest.chromiumVersion !== value.chromiumVersion) throw new Error('remotion_component_version_mismatch');
+ return runtime;
+ }
+
+ async function inspectInstalled(value: RemotionComponentRelease) {
+ const root = join(input.root, value.manifestSha256);
+ const runtime = await verifyRuntime(root, value);
+ const manifestPath = join(root, 'manifest.json');
+ installedAt = (await stat(manifestPath)).mtime.toISOString();
+ prepared = runtime;
+ return runtime;
+ }
+
+ async function install(): Promise<StickmanRemotionRuntime> {
+ const value = await readRelease(true);
+ try { return await inspectInstalled(value); } catch { prepared = undefined; }
+ const signal = controller!.signal;
+ const staging = join(input.root, `.install-${randomUUID()}`);
+ await mkdir(staging, { recursive: true, mode: 0o700 });
+ try {
+ const archive = await configuredOrDownloadedFile({
+ configured: input.archivePath ?? (input.developmentArchiveRoot ? join(input.developmentArchiveRoot, value.fileName) : undefined), name: 'Remotion rendering component',
+ url: value.archiveUrl, sha256: value.archiveSha256, path: join(staging, value.fileName),
+ proxy: await input.readProxy(), signal,
+ onProgress(update) {
+ state = update.state;
+ const percent = update.totalBytes ? Math.min(100, (update.downloadedBytes ?? 0) / update.totalBytes * 100) : null;
+ publish({ phase: 'preparing_dependencies', percent: percent === null ? 1 : percent * 0.05,
+ message: '正在准备 Remotion 渲染组件,完成后将自动继续渲染。',
+ dependency: 'remotion', dependencyItem: update.item, dependencyPercent: percent,
+ downloadedBytes: update.downloadedBytes ?? 0, totalBytes: update.totalBytes ?? value.bytes,
+ bytesPerSecond: update.bytesPerSecond ?? null, remainingSeconds: update.remainingSeconds ?? null });
+ }
+ });
+ if ((await stat(archive)).size !== value.bytes) throw new Error('remotion_component_archive_size_mismatch');
+ state = 'extracting';
+ publish({ phase: 'preparing_dependencies', percent: 4, message: '正在安装并校验 Remotion 渲染组件。', dependency: 'remotion' });
+ const listing = await runTar(['-tvzf', archive], staging, signal);
+ if (listing.split('\n').filter(Boolean).some(line => !/^[-d]/.test(line) || / -> | link to /.test(line))) throw new Error('remotion_component_archive_links_not_allowed');
+ const names = await runTar(['-tzf', archive], staging, signal);
+ for (const name of names.split('\n').filter(Boolean)) {
+ const normalized = name.replaceAll('\\', '/');
+ if (normalized.startsWith('/') || /^[a-z]:/i.test(normalized) || normalized.split('/').includes('..')) throw new Error('remotion_component_archive_path_escape');
+ }
+ const extracted = join(staging, 'runtime');
+ await mkdir(extracted);
+ await runTar(['-xzf', archive, '-C', extracted], staging, signal);
+ await verifyRuntime(extracted, value);
+ if (signal.aborted) throw new Error('remotion_component_install_canceled');
+ const target = join(input.root, value.manifestSha256);
+ const backup = `${target}.invalid-${randomUUID()}`;
+ const hadTarget = await stat(target).then(() => true, () => false);
+ if (hadTarget) await rename(target, backup);
+ try { await rename(extracted, target); } catch (cause) {
+ if (hadTarget) await rename(backup, target);
+ throw cause;
+ }
+ await rm(backup, { recursive: true, force: true });
+ return await inspectInstalled(value);
+ } finally {
+ await rm(staging, { recursive: true, force: true });
+ }
+ }
+
+ function start() {
+ if (closed) throw new Error('remotion_component_manager_closed');
+ if (!pending) {
+ controller = new AbortController();
+ state = 'verifying';
+ error = null;
+ publish({ phase: 'preparing_dependencies', percent: 1, dependency: 'remotion', message: '正在检查 Remotion 渲染组件,缺失时将按需下载。' });
+ pending = install().then(runtime => {
+ state = 'ready';
+ publish({ phase: 'dependencies_ready', percent: 5, dependency: 'remotion', message: 'Remotion 渲染组件已就绪,正在开始渲染。' });
+ return runtime;
+ }).catch(cause => {
+ state = 'failed';
+ error = cause instanceof Error ? cause.message : String(cause);
+ throw cause;
+ }).finally(() => { pending = undefined; });
+ }
+ return pending;
+ }
+
+ return {
+ async status(): Promise<CreatorRuntimeComponent> {
+ try {
+ const value = await readRelease();
+ if (!pending && !prepared && state !== 'failed') {
+ try { await inspectInstalled(value); state = 'ready'; } catch { state = 'not_installed'; }
+ }
+ } catch { state = 'unsupported'; }
+ return {
+ id: 'remotion', name: 'Remotion', available: release !== undefined,
+ version: prepared ? release?.remotionVersion ?? null : null,
+ supportedVersion: release?.remotionVersion ?? null, installedAt, path: resolve(input.root),
+ source: 'OpenCreator release · SHA-256 verified', models: [], model: null,
+ state, item: typeof progress.dependencyItem === 'string' ? progress.dependencyItem : null,
+ downloadedBytes: numeric(progress.downloadedBytes) ?? 0, totalBytes: numeric(progress.totalBytes),
+ percent: state === 'ready' ? 100 : numeric(progress.dependencyPercent),
+ bytesPerSecond: numeric(progress.bytesPerSecond), remainingSeconds: numeric(progress.remainingSeconds),
+ error: error ?? releaseError ?? null
+ };
+ },
+ async download() {
+ await readRelease(true);
+ prepared = undefined;
+ void start().catch(() => {});
+ return this.status();
+ },
+ async ensure(request: { signal: AbortSignal; reportProgress(progress: Progress): void }): Promise<StickmanRemotionRuntime> {
+ if (request.signal.aborted) throw canceled();
+ const operation = start();
+ listeners.add(request.reportProgress);
+ request.reportProgress(progress);
+ try {
+ return await new Promise((resolvePromise, reject) => {
+ const abort = () => reject(canceled());
+ request.signal.addEventListener('abort', abort, { once: true });
+ operation.then(resolvePromise, reject).finally(() => request.signal.removeEventListener('abort', abort));
+ });
+ } finally { listeners.delete(request.reportProgress); }
+ },
+ close() { closed = true; controller?.abort(); }
+ };
+}
+
+export type RemotionComponentManager = ReturnType<typeof createRemotionComponentManager>;
+
+function canceled() { return Object.assign(new Error('Creator stage was canceled'), { code: 'creator_stage_canceled' }); }
+function numeric(value: CreatorJson | undefined) { return typeof value === 'number' && Number.isFinite(value) ? value : null; }
+
+async function runTar(args: string[], cwd: string, signal: AbortSignal): Promise<string> {
+ return new Promise((resolvePromise, reject) => {
+ const child = spawnCreatorProcess('tar', args, { cwd, stdio: ['ignore', 'pipe', 'pipe'] }, signal);
+ let stdout = '';
+ let stderr = '';
+ child.stdout!.on('data', chunk => { stdout += String(chunk); });
+ child.stderr!.on('data', chunk => { stderr += String(chunk); });
+ child.once('error', reject);
+ child.once('exit', code => code === 0 ? resolvePromise(stdout) : reject(new Error(stderr || 'remotion_component_extraction_failed')));
+ });
+}
diff --git a/apps/daemon/src/creator/stickman/remotion-executor.ts b/apps/daemon/src/creator/stickman/remotion-executor.ts
index 41c5a823..e3f20cd4 100644
--- a/apps/daemon/src/creator/stickman/remotion-executor.ts
+++ b/apps/daemon/src/creator/stickman/remotion-executor.ts
@@ -22,6 +22,7 @@ export function createStickmanRemotionExecutor(input: {
runtimeRoot: string;
workerEntrypoint?: string;
runtime?: StickmanRemotionRuntime;
+ ensureRuntime?(stage: Parameters<CreatorExecutor['run']>[0]): Promise<StickmanRemotionRuntime>;
validateVideo?: ValidateVideo;
}): CreatorExecutor {
const validateVideo = input.validateVideo ?? validateMediaFile;
@@ -39,7 +40,9 @@ export function createStickmanRemotionExecutor(input: {
};
const ratio = readStickmanRatio(timelineValue.ratio);
const canvas = stickmanCanvasForRatio(ratio);
- const runtime = input.runtime ?? readStickmanRemotionRuntime(input.runtimeRoot);
+ const runtime = input.runtime ?? (input.ensureRuntime
+ ? await input.ensureRuntime(stage)
+ : readStickmanRemotionRuntime(input.runtimeRoot));
const outputPath = join(
stage.workdir,
ratio === '9:16' ? 'portrait-clean.mp4' : 'landscape-clean.mp4'
@@ -51,6 +54,7 @@ export function createStickmanRemotionExecutor(input: {
outputPath,
bundlePath: runtime.bundlePath,
browserExecutable: runtime.browserExecutable,
+ rendererEntry: runtime.rendererEntry,
workdir: stage.workdir,
jobRoot: dirname(stage.workdir),
runtimeRoot: runtime.root
@@ -58,6 +62,7 @@ export function createStickmanRemotionExecutor(input: {
const workerEntrypoint = input.workerEntrypoint
?? resolveDefaultWorkerEntrypoint();
try {
+ stage.reportProgress({ phase: 'rendering', percent: 5, message: '正在渲染火柴人动画。' });
await runWorker(workerEntrypoint, requestPath, resultPath, stage.signal);
const result = JSON.parse(await readFile(resultPath, 'utf8')) as {
ok?: boolean;
@@ -150,15 +155,20 @@ function runWorker(
'stickman_remotion_worker_failed',
error.message
)));
- worker.once('exit', code => {
+ worker.once('exit', async code => {
if (settled) return;
settled = true;
cleanup();
if (code === 0) resolve();
- else reject(new CreatorExecutorError(
- 'stickman_remotion_worker_failed',
- stderr.slice(-2_000) || `Remotion worker exited with code ${code}`
- ));
+ else {
+ const result = await readFile(resultPath, 'utf8')
+ .then(contents => JSON.parse(contents) as { ok?: boolean; error?: string })
+ .catch(() => null);
+ reject(new CreatorExecutorError(
+ result?.ok === false ? 'stickman_remotion_failed' : 'stickman_remotion_worker_failed',
+ result?.error || stderr.slice(-2_000) || `Remotion worker exited with code ${code}`
+ ));
+ }
});
});
}
diff --git a/apps/daemon/src/creator/stickman/remotion-runtime.ts b/apps/daemon/src/creator/stickman/remotion-runtime.ts
index 5d07afc3..5310be6b 100644
--- a/apps/daemon/src/creator/stickman/remotion-runtime.ts
+++ b/apps/daemon/src/creator/stickman/remotion-runtime.ts
@@ -1,4 +1,5 @@
-import { existsSync, readFileSync, statSync } from 'node:fs';
+import { createHash } from 'node:crypto';
+import { existsSync, lstatSync, readFileSync, readdirSync, statSync } from 'node:fs';
import { isAbsolute, relative, resolve, sep } from 'node:path';
import { z } from 'zod';
@@ -6,13 +7,14 @@ const runtimeManifestSchema = z.object({
version: z.literal(1),
platform: z.string().min(1),
arch: z.string().min(1),
- remotionVersion: z.literal('4.0.473'),
+ remotionVersion: z.string().min(1),
chromiumVersion: z.string().min(1),
bundlePath: z.string().min(1),
browserExecutable: z.string().min(1),
+ rendererEntry: z.string().min(1).optional(),
resources: z.array(z.object({
path: z.string().min(1),
- kind: z.enum(['bundle', 'browser', 'font', 'character', 'brand', 'audio', 'visual-asset']),
+ kind: z.enum(['bundle', 'browser', 'renderer', 'font', 'character', 'brand', 'audio', 'visual-asset']),
sha256: z.string().regex(/^[a-f0-9]{64}$/i),
bytes: z.number().int().nonnegative(),
version: z.string().min(1),
@@ -25,9 +27,10 @@ export type StickmanRemotionRuntime = {
root: string;
bundlePath: string;
browserExecutable: string;
+ rendererEntry?: string;
};
-export function readStickmanRemotionRuntime(rootPath: string): StickmanRemotionRuntime {
+export function readStickmanRemotionRuntime(rootPath: string, verifyHashes = false): StickmanRemotionRuntime {
const root = resolve(rootPath);
const manifest = runtimeManifestSchema.parse(JSON.parse(
readFileSync(resolveInside(root, 'manifest.json'), 'utf8')
@@ -40,11 +43,31 @@ export function readStickmanRemotionRuntime(rootPath: string): StickmanRemotionR
if (!existsSync(path) || !statSync(path).isFile()) {
throw new Error(`stickman_runtime_resource_missing: ${resource.path}`);
}
+ if (verifyHashes && (lstatSync(path).isSymbolicLink()
+ || statSync(path).size !== resource.bytes
+ || createHash('sha256').update(readFileSync(path)).digest('hex') !== resource.sha256)) {
+ throw new Error(`stickman_runtime_resource_invalid: ${resource.path}`);
+ }
+ }
+ if (verifyHashes) {
+ const expected = new Set(['manifest.json', ...manifest.resources.map(resource => resource.path)]);
+ const visit = (directory: string) => {
+ for (const entry of readdirSync(directory, { withFileTypes: true })) {
+ const path = resolve(directory, entry.name);
+ if (entry.isDirectory()) visit(path);
+ else if (!entry.isFile() || !expected.delete(relative(root, path).split(sep).join('/'))) {
+ throw new Error(`stickman_runtime_unexpected_resource: ${entry.name}`);
+ }
+ }
+ };
+ visit(root);
+ if (expected.size !== 0) throw new Error('stickman_runtime_incomplete');
}
return {
root,
bundlePath: resolveInside(root, manifest.bundlePath),
- browserExecutable: resolveInside(root, manifest.browserExecutable)
+ browserExecutable: resolveInside(root, manifest.browserExecutable),
+ ...(manifest.rendererEntry ? { rendererEntry: resolveInside(root, manifest.rendererEntry) } : {})
};
}
diff --git a/apps/daemon/src/creator/stickman/remotion-worker.ts b/apps/daemon/src/creator/stickman/remotion-worker.ts
index 310b32bc..8afa581c 100644
--- a/apps/daemon/src/creator/stickman/remotion-worker.ts
+++ b/apps/daemon/src/creator/stickman/remotion-worker.ts
@@ -2,6 +2,7 @@ import { createReadStream, existsSync, statSync } from 'node:fs';
import { readFile, writeFile } from 'node:fs/promises';
import { createServer, type IncomingMessage, type ServerResponse } from 'node:http';
import { extname, isAbsolute, relative, resolve } from 'node:path';
+import { pathToFileURL } from 'node:url';
type WorkerRequest = {
timelinePath: string;
@@ -11,6 +12,7 @@ type WorkerRequest = {
workdir: string;
jobRoot: string;
runtimeRoot: string;
+ rendererEntry?: string;
};
async function main(): Promise<void> {
@@ -28,6 +30,7 @@ async function main(): Promise<void> {
assertInside(workdir, resultPath, 'result');
assertInside(runtimeRoot, request.bundlePath, 'bundle');
assertInside(runtimeRoot, request.browserExecutable, 'browser');
+ if (request.rendererEntry) assertInside(runtimeRoot, request.rendererEntry, 'renderer');
if (!existsSync(resolve(request.bundlePath)) || !statSync(resolve(request.bundlePath)).isDirectory()) {
throw new Error('stickman_worker_bundle_missing');
}
@@ -58,7 +61,7 @@ async function main(): Promise<void> {
audioPath: `${assetServer.url}/media/${index}/audio${extname(shot.audioPath!)}`
}))
};
- const renderer = await import('@remotion/renderer');
+ const renderer = await import(request.rendererEntry ? pathToFileURL(request.rendererEntry).href : '@remotion/renderer') as typeof import('@remotion/renderer');
const composition = await renderer.selectComposition({
serveUrl: assetServer.url,
id: timeline.ratio === '9:16' ? 'StickmanPortrait' : 'StickmanLandscape',
diff --git a/apps/daemon/test/unit/creator-preflight.test.ts b/apps/daemon/test/unit/creator-preflight.test.ts
index a1f00d3f..fca24527 100644
--- a/apps/daemon/test/unit/creator-preflight.test.ts
+++ b/apps/daemon/test/unit/creator-preflight.test.ts
@@ -20,6 +20,21 @@ afterEach(async () => {
});
describe('creator preflight', () => {
+ it('allows rendering to prepare an installable Remotion component without downloading during preflight', async () => {
+ root = await mkdtemp(join(tmpdir(), 'creator-preflight-remotion-'));
+ const status = vi.fn(async () => ({ id: 'remotion' as const, name: 'Remotion', available: true, version: null, supportedVersion: '4.0.473', installedAt: null, path: root, source: 'release', models: [], model: null, state: 'not_installed' as const, item: null, downloadedBytes: 0, totalBytes: null, percent: null, bytesPerSecond: null, remainingSeconds: null, error: null }));
+ const stage = createStickmanVideoTemplate().stages.find(candidate => candidate.id === 'render-clean')!;
+ const result = await createCreatorPreflight({
+ configStore: { read: async () => createDefaultCreatorServicesConfig() },
+ readCapabilities: () => createKrillinCreatorServicesCapabilities('darwin', 'arm64'),
+ resourceRoot: root, jobsRoot: join(root, 'jobs'), ffprobePath: '/fixture/ffprobe',
+ executorIds: ['stickman-remotion'], remotionComponent: { status }
+ }).check(fakeJob('stickman-video', {}), stage);
+ expect(status).toHaveBeenCalledOnce();
+ expect(result.blocked.map(item => item.id)).not.toContain('stickman-runtime');
+ expect(result.warning).toContainEqual(expect.objectContaining({ id: 'stickman-runtime', message: expect.stringContaining('按需准备') }));
+ });
+
it('prepares preview from the saved Bilibili source without translation or Whisper credentials', async () => {
root = await mkdtemp(join(tmpdir(), 'creator-preflight-'));
const config = createDefaultCreatorServicesConfig();
diff --git a/apps/daemon/test/unit/creator-remotion-component.test.ts b/apps/daemon/test/unit/creator-remotion-component.test.ts
new file mode 100644
index 00000000..5d05da75
--- /dev/null
+++ b/apps/daemon/test/unit/creator-remotion-component.test.ts
@@ -0,0 +1,148 @@
+import { createHash } from 'node:crypto';
+import { execFileSync } from 'node:child_process';
+import { chmod, mkdir, mkdtemp, readFile, rm, symlink, writeFile } from 'node:fs/promises';
+import { createServer, type Server } from 'node:http';
+import { tmpdir } from 'node:os';
+import { join } from 'node:path';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { createRemotionComponentManager, type RemotionComponentManager } from '../../src/creator/stickman/remotion-component.js';
+
+const roots: string[] = [];
+const managers: RemotionComponentManager[] = [];
+const servers: Server[] = [];
+afterEach(async () => {
+ for (const manager of managers.splice(0)) manager.close();
+ for (const server of servers.splice(0)) await new Promise<void>(resolve => server.close(() => resolve()));
+ for (const root of roots.splice(0)) await rm(root, { recursive: true, force: true });
+});
+
+const hash = (contents: Buffer | string) => createHash('sha256').update(contents).digest('hex');
+
+async function fixture(options: { network?: boolean; link?: boolean; wrongPlatform?: boolean } = {}) {
+ const root = await mkdtemp(join(tmpdir(), 'remotion-component-'));
+ roots.push(root);
+ const source = join(root, 'source');
+ await mkdir(join(source, 'bundle'), { recursive: true });
+ const files = [
+ { path: 'bundle/index.html', kind: 'bundle', contents: '<html></html>' },
+ { path: 'browser', kind: 'browser', contents: '#!/bin/sh\necho Chromium\n' },
+ { path: 'renderer.js', kind: 'renderer', contents: 'exports.renderMedia = () => {};\n' }
+ ];
+ for (const file of files) await writeFile(join(source, file.path), file.contents);
+ await chmod(join(source, 'browser'), 0o755);
+ if (options.link) await symlink(join(root, 'outside'), join(source, 'escape'));
+ const manifest = { version: 1, platform: process.platform, arch: process.arch,
+ remotionVersion: '4.0.473', chromiumVersion: '149.0.7790.0', bundlePath: 'bundle', browserExecutable: 'browser', rendererEntry: 'renderer.js',
+ resources: files.map(file => ({ path: file.path, kind: file.kind, sha256: hash(file.contents), bytes: Buffer.byteLength(file.contents), version: '1', platform: process.platform, arch: process.arch })) };
+ await writeFile(join(source, 'manifest.json'), JSON.stringify(manifest));
+ const archive = join(root, `Remotion-1.0.0-${process.platform}-${process.arch}.tar.gz`);
+ execFileSync('tar', ['-czf', archive, '-C', source, '.'], { env: { ...process.env, COPYFILE_DISABLE: '1' } });
+ let requests = 0;
+ let archiveUrl = 'https://example.test/remotion.tar.gz';
+ if (options.network) {
+ const contents = await readFile(archive);
+ const server = createServer((_request, response) => {
+ requests += 1;
+ response.writeHead(200, { 'Content-Length': contents.length });
+ response.write(contents.subarray(0, Math.floor(contents.length / 2)));
+ setTimeout(() => response.end(contents.subarray(Math.floor(contents.length / 2))), 100);
+ });
+ servers.push(server);
+ await new Promise<void>(resolve => server.listen(0, '127.0.0.1', resolve));
+ const address = server.address();
+ if (!address || typeof address === 'string') throw new Error('Expected server address');
+ archiveUrl = `http://127.0.0.1:${address.port}/component`;
+ }
+ const releasePath = join(root, 'release.json');
+ const release = { version: 1, id: 'remotion', componentVersion: '1.0.0', remotionVersion: manifest.remotionVersion,
+ chromiumVersion: manifest.chromiumVersion, platform: options.wrongPlatform ? 'invalid' : process.platform, arch: process.arch,
+ archiveUrl, archiveSha256: hash(await readFile(archive)), manifestSha256: hash(await readFile(join(source, 'manifest.json'))),
+ bytes: (await readFile(archive)).length, fileName: archive.split('/').at(-1) };
+ await writeFile(releasePath, JSON.stringify(release));
+ const cache = join(root, 'cache');
+ const manager = createRemotionComponentManager({ root: cache, releasePath, archivePath: options.network ? undefined : archive, readProxy: async () => '' });
+ managers.push(manager);
+ return { root, source, archive, releasePath, release, cache, manager, requests: () => requests };
+}
+
+describe('managed Remotion component', () => {
+ it('does not install or download while reading component status', async () => {
+ const test = await fixture({ network: true });
+ expect(await test.manager.status()).toMatchObject({ id: 'remotion', available: true, state: 'not_installed', version: null, model: null, models: [] });
+ expect(test.requests()).toBe(0);
+ await expect(readFile(join(test.cache, test.release.manifestSha256, 'manifest.json'))).rejects.toThrow();
+ });
+
+ it('shares manual downloads and render tasks, preserves progress, and reuses verified resources', async () => {
+ const test = await fixture({ network: true });
+ const listener = vi.fn();
+ await test.manager.download();
+ const runtime = await test.manager.ensure({ signal: new AbortController().signal, reportProgress: listener });
+ expect(test.requests()).toBe(1);
+ expect(runtime.rendererEntry).toBe(join(runtime.root, 'renderer.js'));
+ expect(await test.manager.status()).toMatchObject({ state: 'ready', version: '4.0.473', percent: 100 });
+ expect(listener).toHaveBeenCalledWith(expect.objectContaining({ phase: 'preparing_dependencies' }));
+ expect(listener).toHaveBeenCalledWith(expect.objectContaining({ phase: 'dependencies_ready' }));
+ await test.manager.download();
+ await test.manager.ensure({ signal: new AbortController().signal, reportProgress() {} });
+ expect(test.requests()).toBe(1);
+ });
+
+ it('fails a corrupted archive and supports retry without losing existing work', async () => {
+ const test = await fixture();
+ const original = await readFile(test.archive);
+ await writeFile(test.archive, 'corrupted');
+ await expect(test.manager.ensure({ signal: new AbortController().signal, reportProgress() {} })).rejects.toThrow('SHA-256 mismatch');
+ expect(await test.manager.status()).toMatchObject({ state: 'failed' });
+ await writeFile(test.archive, original);
+ const runtime = await test.manager.ensure({ signal: new AbortController().signal, reportProgress() {} });
+ expect(await readFile(join(runtime.root, 'bundle', 'index.html'), 'utf8')).toBe('<html></html>');
+ });
+
+ it('checks installed file hashes and repairs corrupted resources', async () => {
+ const test = await fixture();
+ const runtime = await test.manager.ensure({ signal: new AbortController().signal, reportProgress() {} });
+ await writeFile(runtime.rendererEntry!, 'modified');
+ await test.manager.download();
+ await test.manager.ensure({ signal: new AbortController().signal, reportProgress() {} });
+ expect(await readFile(runtime.rendererEntry!, 'utf8')).toBe('exports.renderMedia = () => {};\n');
+ });
+
+ it('rejects symbolic links before extracting downloaded code', async () => {
+ const test = await fixture({ link: true });
+ await expect(test.manager.ensure({ signal: new AbortController().signal, reportProgress() {} })).rejects.toThrow('archive_links_not_allowed');
+ await expect(readFile(join(test.root, 'outside'))).rejects.toThrow();
+ });
+
+ it('rejects unavailable or mismatched release descriptors without downloading', async () => {
+ const test = await fixture({ network: true, wrongPlatform: true });
+ expect(await test.manager.status()).toMatchObject({ available: false, state: 'unsupported' });
+ expect(test.requests()).toBe(0);
+ await expect(test.manager.download()).rejects.toThrow();
+ });
+
+ it('canceling a render subscriber does not cancel the shared installation', async () => {
+ const test = await fixture({ network: true });
+ const canceled = new AbortController();
+ const first = test.manager.ensure({ signal: canceled.signal, reportProgress() {} });
+ const second = test.manager.ensure({ signal: new AbortController().signal, reportProgress() {} });
+ canceled.abort();
+ await expect(first).rejects.toMatchObject({ code: 'creator_stage_canceled' });
+ await second;
+ expect(test.requests()).toBe(1);
+ expect(await test.manager.status()).toMatchObject({ state: 'ready' });
+ });
+
+ it('keeps prior component versions intact while installing a compatible new version', async () => {
+ const test = await fixture();
+ const old = await test.manager.ensure({ signal: new AbortController().signal, reportProgress() {} });
+ await writeFile(join(test.source, 'manifest.json'), `${await readFile(join(test.source, 'manifest.json'), 'utf8')}\n`);
+ execFileSync('tar', ['-czf', test.archive, '-C', test.source, '.'], { env: { ...process.env, COPYFILE_DISABLE: '1' } });
+ const updatedRelease = { ...test.release, manifestSha256: hash(await readFile(join(test.source, 'manifest.json'))), archiveSha256: hash(await readFile(test.archive)), bytes: (await readFile(test.archive)).length };
+ await writeFile(test.releasePath, JSON.stringify(updatedRelease));
+ await test.manager.download();
+ const runtime = await test.manager.ensure({ signal: new AbortController().signal, reportProgress() {} });
+ expect(runtime.root).not.toBe(old.root);
+ expect(await readFile(join(old.root, 'manifest.json'), 'utf8')).not.toMatch(/\n$/);
+ });
+});
diff --git a/apps/daemon/test/unit/creator-runtime-routes.test.ts b/apps/daemon/test/unit/creator-runtime-routes.test.ts
index 7a5fc298..0f34843d 100644
--- a/apps/daemon/test/unit/creator-runtime-routes.test.ts
+++ b/apps/daemon/test/unit/creator-runtime-routes.test.ts
@@ -1,5 +1,5 @@
import Fastify, { type FastifyInstance } from 'fastify';
-import { createDefaultCreatorServicesConfig, type CreatorYtDlpStatus } from '@opencreator/protocol';
+import { createDefaultCreatorServicesConfig, type CreatorRuntimeComponent, type CreatorYtDlpStatus } from '@opencreator/protocol';
import { createKrillinDependencyLoader } from '../../src/creator/krillin/dependency-loader.js';
import { afterEach, describe, expect, it, vi } from 'vitest';
import { registerCreatorRuntimeRoutes } from '../../src/api/routes.creator-runtime.js';
@@ -16,6 +16,25 @@ afterEach(async () => {
});
describe('creator yt-dlp runtime routes', () => {
+ it('includes and downloads Remotion through the shared component API without changing transcription', async () => {
+ const config = createDefaultCreatorServicesConfig();
+ const component: CreatorRuntimeComponent = { id: 'remotion', name: 'Remotion', available: true, version: null, supportedVersion: '4.0.473', installedAt: null, path: '/runtime/remotion', source: 'verified release', models: [], model: null, state: 'not_installed', item: null, downloadedBytes: 0, totalBytes: null, percent: null, bytesPerSecond: null, remainingSeconds: null, error: null };
+ const remotion = { status: vi.fn(async () => component), download: vi.fn(async () => component), ensure: vi.fn(), close: vi.fn() };
+ const loader = createKrillinDependencyLoader({ root: '/tmp/opencreator-remotion-api', platform: 'darwin', arch: 'arm64', whisperKitInstaller: { isInstalled: async () => false, install: vi.fn() } });
+ const download = vi.spyOn(loader, 'download');
+ server = Fastify();
+ await registerCreatorRuntimeRoutes(server, undefined, { loader, readConfig: async () => config, remotion });
+ const before = await server.inject({ method: 'GET', url: '/creator/components/status' });
+ expect(before.json().components).toContainEqual(component);
+ expect(remotion.download).not.toHaveBeenCalled();
+ const response = await server.inject({ method: 'POST', url: '/creator/components/download', payload: { componentId: 'remotion' } });
+ expect(response.statusCode).toBe(200);
+ expect(response.json().selectedProvider).toBe('openai');
+ expect(remotion.download).toHaveBeenCalledOnce();
+ expect(download).not.toHaveBeenCalled();
+ expect(config.transcription.provider).toBe('openai');
+ });
+
it('downloads the requested component without changing the saved cloud provider', async () => {
const config = createDefaultCreatorServicesConfig();
config.transcription.provider = 'openai';
diff --git a/apps/daemon/test/unit/creator-stickman-remotion.test.ts b/apps/daemon/test/unit/creator-stickman-remotion.test.ts
index 1f644c7e..664d28f2 100644
--- a/apps/daemon/test/unit/creator-stickman-remotion.test.ts
+++ b/apps/daemon/test/unit/creator-stickman-remotion.test.ts
@@ -75,6 +75,28 @@ describe('stickman Remotion worker isolation', () => {
expect(existsSync(join(tempDir, 'landscape-clean.mp4'))).toBe(true);
});
+ it('preserves structured component rendering errors instead of stderr warnings', async () => {
+ tempDir = mkdtempSync(join(tmpdir(), 'creator-stickman-remotion-error-'));
+ const timelinePath = join(tempDir, 'timeline.json');
+ writeFileSync(timelinePath, JSON.stringify({ fps: 30, totalFrames: 30, shots: [] }));
+ const errorWorker = join(tempDir, 'error-worker.mjs');
+ writeFileSync(errorWorker, [
+ "import { writeFileSync } from 'node:fs';",
+ "process.stderr.write('environment warning');",
+ "writeFileSync(process.argv[3], JSON.stringify({ ok: false, error: 'renderer dependency missing' }));",
+ 'process.exitCode = 1;'
+ ].join('\n'));
+ const executor = createStickmanRemotionExecutor({
+ ffprobePath: 'unused', runtimeRoot: tempDir, workerEntrypoint: errorWorker,
+ runtime: { root: tempDir, bundlePath: join(tempDir, 'bundle'), browserExecutable: join(tempDir, 'browser') }
+ });
+ await expect(executor.run({
+ stageRun: { id: 'stage-error', stageId: 'render-clean' }, job: { id: 'job-error' },
+ inputArtifacts: [{ id: 'timeline-1', kind: 'timeline_manifest', status: 'completed', path: timelinePath }],
+ workdir: tempDir, reportProgress() {}, signal: new AbortController().signal
+ } as never)).rejects.toMatchObject({ code: 'stickman_remotion_failed', message: 'renderer dependency missing' });
+ });
+
it('isolates worker crashes and cancellation without leaving a clean video', async () => {
tempDir = mkdtempSync(join(tmpdir(), 'creator-stickman-remotion-'));
const timelinePath = join(tempDir, 'timeline.json');
diff --git a/apps/daemon/test/unit/creator-stickman-workflow.test.ts b/apps/daemon/test/unit/creator-stickman-workflow.test.ts
index 709ee4ba..afbcc2f1 100644
--- a/apps/daemon/test/unit/creator-stickman-workflow.test.ts
+++ b/apps/daemon/test/unit/creator-stickman-workflow.test.ts
@@ -530,6 +530,121 @@ describe('stickman video workflow', () => {
}
});
+ it('ignores model-supplied storyboard timing and binds every shot to measured audio', async () => {
+ const context = setup({
+ segmentCount: 3,
+ narrationUnits: 40,
+ narrationDurationSeconds: 5.6,
+ completionOverride: request => request.stageId === 'storyboard' ? {
+ shots: generatedStoryboard(3).shots.map(shot => ({
+ ...shot,
+ startSeconds: 999,
+ endSeconds: -1,
+ durationSeconds: 'incorrect model timing'
+ }))
+ } : undefined
+ });
+ const { db, service, runner, workflow, completionRequests } = context;
+ try {
+ const { jobId, stageRunId } = await queueStoryboard(context);
+ const completed = await runner.runStageRun(stageRunId);
+ expect(completed).toMatchObject({ stageId: 'storyboard', status: 'succeeded' });
+ await workflow.handleStageChanged(completed);
+
+ const shotSpec = readArtifact(service.getJob(jobId)!, 'shot_spec') as {
+ shots: Array<{ startSeconds: number; endSeconds: number; durationSeconds: number }>;
+ };
+ const timing = readArtifact(service.getJob(jobId)!, 'audio_timing') as {
+ segments: Array<{ startSeconds: number; endSeconds: number; durationSeconds: number }>;
+ };
+ expect(shotSpec.shots).toHaveLength(3);
+ for (const [index, shot] of shotSpec.shots.entries()) {
+ const measured = timing.segments[index]!;
+ expect(shot).toMatchObject({
+ startSeconds: measured.startSeconds,
+ endSeconds: measured.endSeconds,
+ durationSeconds: measured.durationSeconds
+ });
+ }
+ const requests = completionRequests.filter(request => request.stageId === 'storyboard');
+ expect(requests).toHaveLength(1);
+ expect(requests[0]!.prompt).toContain('禁止返回 startSeconds、endSeconds、durationSeconds');
+ } finally {
+ await runner.close();
+ db.close();
+ }
+ });
+
+ it.each(['unknown field', 'missing semantic anchor', 'visible text'])(
+ 'stops invalid storyboard retries for %s and resumes without regenerating narration',
+ async invalidCase => {
+ let repaired = false;
+ const context = setup({
+ segmentCount: 3,
+ narrationUnits: 40,
+ completionOverride(request) {
+ if (request.stageId !== 'storyboard' || repaired) return undefined;
+ const draft = generatedStoryboard(3);
+ return {
+ shots: draft.shots.map(shot => {
+ if (invalidCase === 'unknown field') return { ...shot, unexpectedField: true };
+ if (invalidCase === 'visible text') {
+ return { ...shot, visualDescription: '画面中显示标题文字“核心概念”' };
+ }
+ return { ...shot, semanticAnchor: undefined };
+ })
+ };
+ }
+ });
+ const { db, service, dispatcher, runner, workflow, completionRequests } = context;
+ try {
+ const { jobId, stageRunId } = await queueStoryboard(context);
+ const failed = await runner.runStageRun(stageRunId);
+ expect(failed).toMatchObject({
+ status: 'failed',
+ errorCode: 'creator_storyboard_validation_failed',
+ progress: { phase: 'failed', completed: 0, failed: 1 }
+ });
+ expect(failed.progress.message).toContain('已停止');
+ expect(failed.progress.message).not.toContain('正在整稿重生成');
+ expect(completionRequests.filter(request => request.stageId === 'storyboard')).toHaveLength(3);
+ await workflow.handleStageChanged(failed);
+ const failedJob = service.getJob(jobId)!;
+ expect(failedJob.artifacts.some(artifact => artifact.kind === 'shot_spec')).toBe(false);
+ expect(failedJob.stages.some(stage => stage.stageId === 'images')).toBe(false);
+ const audioArtifactIds = failedJob.artifacts.filter(artifact => (
+ artifact.kind === 'narration_audio' || artifact.kind === 'audio_timing'
+ )).map(artifact => artifact.id);
+ const scriptRequestCount = completionRequests.filter(request => request.stageId === 'script').length;
+
+ repaired = true;
+ dispatcher.dispatch(jobId, {
+ action: 'retry-stage',
+ expectedRevision: failedJob.revision,
+ idempotencyKey: `retry-storyboard-${jobId}`,
+ input: { stageId: 'storyboard' }
+ }, 'user');
+ await workflow.handleAction(service.getJob(jobId)!, 'retry-stage');
+ const pendingRetry = service.getJob(jobId)!.stages.find(stage => (
+ stage.stageId === 'storyboard' && stage.status === 'queued'
+ ))!;
+ const completed = await runner.runStageRun(pendingRetry.id);
+ expect(completed.status).toBe('succeeded');
+ await workflow.handleStageChanged(completed);
+ const resumedJob = service.getJob(jobId)!;
+ expect(resumedJob.artifacts.filter(artifact => audioArtifactIds.includes(artifact.id)))
+ .toHaveLength(audioArtifactIds.length);
+ expect(resumedJob.stages.filter(stage => stage.stageId === 'narration')).toHaveLength(3);
+ expect(completionRequests.filter(request => request.stageId === 'script')).toHaveLength(scriptRequestCount);
+ expect(resumedJob.artifacts.some(artifact => artifact.kind === 'shot_spec' && artifact.status === 'completed'))
+ .toBe(true);
+ } finally {
+ await runner.close();
+ db.close();
+ }
+ }
+ );
+
it('uses the selected reference image as the sole character authority in image prompts', async () => {
const context = setup();
const { db, repository, service, runner } = context;
@@ -880,6 +995,54 @@ async function runContentPipeline(input: {
}
}
+async function queueStoryboard(context: ReturnType<typeof setup>) {
+ const { service, runner, workflow } = context;
+ const job = service.createJob({
+ projectId: 'p1',
+ templateId: 'stickman-video',
+ state: {
+ sourceType: 'text',
+ sourceText: '这是一段完整来源内容。',
+ targetDurationSeconds: 10,
+ targetLanguage: 'zh-CN',
+ ttsProvider: 'openai',
+ ttsModel: 'gpt-4o-mini-tts',
+ voiceCode: 'alloy'
+ }
+ });
+ await runContentPipeline({ ...context, jobId: job.id });
+ const reviewJob = service.getJob(job.id)!;
+ const script = reviewJob.artifacts.find(artifact => (
+ artifact.kind === 'script_manifest' && artifact.status === 'completed'
+ ))!;
+ const approved = service.applyAction(job.id, {
+ actor: 'user',
+ action: 'approve-script',
+ expectedRevision: reviewJob.revision,
+ input: { artifactId: script.id, revision: reviewJob.revision }
+ });
+ await workflow.handleAction(approved.job, 'approve-script');
+ for (const expectedStage of ['narration', 'narration', 'narration', 'audio-timing']) {
+ const pending = service.getJob(job.id)!.stages.find(stage => stage.status === 'queued')!;
+ expect(pending.stageId).toBe(expectedStage);
+ const completed = await runner.runStageRun(pending.id);
+ expect(completed.status).toBe('succeeded');
+ await workflow.handleStageChanged(completed);
+ }
+ const audioReadyJob = service.getJob(job.id)!;
+ const timing = audioReadyJob.artifacts.find(artifact => artifact.kind === 'audio_timing')!;
+ const continued = service.applyAction(job.id, {
+ actor: 'user',
+ action: 'continue-after-audio',
+ expectedRevision: audioReadyJob.revision,
+ input: { artifactId: timing.id, revision: audioReadyJob.revision }
+ });
+ await workflow.handleAction(continued.job, 'continue-after-audio');
+ const storyboard = service.getJob(job.id)!.stages.find(stage => stage.status === 'queued')!;
+ expect(storyboard.stageId).toBe('storyboard');
+ return { jobId: job.id, stageRunId: storyboard.id };
+}
+
function readArtifact(job: NonNullable<ReturnType<ReturnType<typeof createCreatorService>['getJob']>>, kind: string): unknown {
const artifact = [...job.artifacts].reverse().find(item => (
item.kind === kind && item.status === 'completed'
diff --git a/apps/desktop/e2e/creator-packaged-app.spec.ts b/apps/desktop/e2e/creator-packaged-app.spec.ts
index 872f87b5..bbdc4296 100644
--- a/apps/desktop/e2e/creator-packaged-app.spec.ts
+++ b/apps/desktop/e2e/creator-packaged-app.spec.ts
@@ -1,6 +1,8 @@
import { execFileSync, spawnSync } from 'node:child_process';
+import { createServer } from 'node:http';
import {
chmodSync,
+ createReadStream,
cpSync,
copyFileSync,
existsSync,
@@ -14,7 +16,7 @@ import {
} from 'node:fs';
import { tmpdir } from 'node:os';
import { basename, delimiter, dirname, join, resolve } from 'node:path';
-import { fileURLToPath } from 'node:url';
+import { fileURLToPath, pathToFileURL } from 'node:url';
import { expect, test, type Page } from '@playwright/test';
import { packagedExecutable } from './package-artifact.js';
import {
@@ -37,6 +39,103 @@ const OVERSIZED_WAVE_PCM_BYTES = 10 * 1024 * 1024 + 4096;
const OVERSIZED_WAVE_FILE_BYTES = OVERSIZED_WAVE_PCM_BYTES + 44;
test.describe.configure({ mode: 'serial' });
+test('Remotion 组件不随 App 内嵌,首次渲染按需下载后自动继续,更新不重复下载', async () => {
+ test.setTimeout(180_000);
+ const release = JSON.parse(readFileSync(join(desktopDir, '.pack', 'components', 'remotion-component.json'), 'utf8'));
+ const archivePath = join(desktopDir, '.pack', 'components', release.fileName);
+ const metadataRoot = mkdtempSync(join(tmpdir(), 'remotion-release-e2e-'));
+ let downloads = 0;
+ const server = createServer((_request, response) => {
+ downloads += 1;
+ response.writeHead(200, { 'Content-Length': statSync(archivePath).size });
+ createReadStream(archivePath).pipe(response);
+ });
+ await new Promise<void>(resolvePromise => server.listen(0, '127.0.0.1', resolvePromise));
+ const address = server.address();
+ if (!address || typeof address === 'string') throw new Error('Expected component HTTP server');
+ const descriptorPath = join(metadataRoot, 'component.json');
+ writeFileSync(descriptorPath, JSON.stringify({ ...release, archiveUrl: `http://127.0.0.1:${address.port}/${release.fileName}` }));
+ let fixture: Awaited<ReturnType<typeof launchCreatorDesktop>> | undefined;
+ try {
+ fixture = await launchCreatorDesktop(undefined, { OPENCREATOR_REMOTION_COMPONENT_MANIFEST: descriptorPath, OPENCREATOR_REMOTION_COMPONENT_ARCHIVE: '' });
+ await waitForWorkspace(fixture.app.page);
+ expect(existsSync(packagedStickmanRuntimeRoot())).toBe(false);
+ const before = await runtimeRequest<{ components: Array<{ id: string; state: string }> }>(fixture.app.page, 'GET', '/creator/components/status');
+ expect(before.body.components.find(component => component.id === 'remotion')?.state).toBe('not_installed');
+ const catalog = await runtimeRequest<{ assets: unknown[] }>(fixture.app.page, 'GET', '/creator/visual-assets?templateId=stickman-video');
+ expect(catalog.status).toBe(200);
+ expect(catalog.body.assets.length).toBeGreaterThan(0);
+ expect(downloads).toBe(0);
+ await fixture.app.page.evaluate(() => { window.location.hash = '#/settings?tab=local-components&component=remotion'; });
+ const card = fixture.app.page.locator('#component-remotion');
+ await expect(card.getByRole('heading', { name: 'Remotion' })).toBeVisible();
+ await expect(card.getByRole('button', { name: '下载组件' })).toBeVisible();
+
+ const projectRoot = join(fixture.root, 'render-project');
+ mkdirSync(projectRoot, { recursive: true });
+ const project = await runtimeRequest<{ project: { id: string } }>(fixture.app.page, 'POST', '/projects', { cwd: projectRoot, name: 'Remotion E2E', sandbox: 'workspace-write' });
+ const created = await runtimeRequest<{ job: { id: string; revision: number } }>(fixture.app.page, 'POST', '/creator/jobs', { projectId: project.body.project.id, templateId: 'stickman-video', state: { sourceMode: 'text', sourceText: 'Render component fixture', ratio: '16:9' } });
+ expect(created.status).toBe(201);
+ const jobId = created.body.job.id;
+ const dataDir = join(fixture.root, '.opencreator', 'data');
+ const workRoot = join(fixture.root, '.opencreator', 'creator', 'jobs', jobId, 'fixtures');
+ mkdirSync(workRoot, { recursive: true });
+ const imagePath = join(workRoot, 'image.png');
+ const audioPath = join(workRoot, 'audio.wav');
+ const ffmpeg = join(packagedRuntimeRoot(), 'bin', process.platform === 'win32' ? 'ffmpeg.exe' : 'ffmpeg');
+ execFileSync(ffmpeg, ['-y', '-f', 'lavfi', '-i', 'color=c=white:s=1280x720', '-frames:v', '1', imagePath], { stdio: 'ignore', windowsHide: true });
+ execFileSync(ffmpeg, ['-y', '-f', 'lavfi', '-i', 'sine=frequency=440:duration=1', audioPath], { stdio: 'ignore', windowsHide: true });
+ const timelinePath = join(workRoot, 'timeline.json');
+ writeFileSync(timelinePath, JSON.stringify({ ratio: '16:9', fps: 30, width: 1280, height: 720, totalFrames: 30,
+ shots: [{ shotId: 'shot-1', startFrame: 0, endFrame: 30, imageArtifactId: 'image-1', audioArtifactId: 'audio-1', imagePath, audioPath, motion: 'static', imageSha256: '1'.repeat(64), audioSha256: '2'.repeat(64) }],
+ captions: [{ segmentId: 'segment-1', startFrame: 0, endFrame: 30, text: 'Remotion component' }] }));
+ const databaseModule = pathToFileURL(resolve(desktopDir, '../daemon/src/storage/database.ts')).href;
+ const repositoryModule = pathToFileURL(resolve(desktopDir, '../daemon/src/creator/repository.ts')).href;
+ execFileSync(process.execPath, ['--import', 'tsx', '--input-type=module', '-e', `
+ const { openRuntimeDatabase } = await import(${JSON.stringify(databaseModule)});
+ const { createCreatorRepository } = await import(${JSON.stringify(repositoryModule)});
+ const db = openRuntimeDatabase(${JSON.stringify(join(dataDir, 'app.sqlite'))});
+ const repository = createCreatorRepository(db);
+ const job = repository.getJob(${JSON.stringify(jobId)});
+ const script = repository.insertArtifact({ jobId: job.id, kind: 'script_manifest', status: 'completed', path: null, sourceArtifactIds: [], metadata: {} });
+ repository.insertArtifact({ jobId: job.id, kind: 'shot_spec', status: 'completed', path: null, sourceArtifactIds: [], metadata: {} });
+ repository.insertArtifact({ jobId: job.id, kind: 'timeline_manifest', status: 'completed', path: ${JSON.stringify(timelinePath)}, sourceArtifactIds: [], metadata: {} });
+ repository.createStageRun({ jobId: job.id, stageId: 'timeline', executor: 'stickman-timeline', status: 'succeeded' });
+ repository.updateJob({ id: job.id, status: job.status, revision: job.revision + 1, state: { ...job.state, workflowTarget: 'delivery_ready', approvedScriptArtifactId: script.id } });
+ db.close();
+ `], { cwd: rootDirForFixture(), stdio: 'pipe', windowsHide: true });
+ const current = await runtimeRequest<{ job: { revision: number } }>(fixture.app.page, 'GET', `/creator/jobs/${jobId}`);
+ const started = await runtimeRequest<{ error?: unknown }>(fixture.app.page, 'POST', `/creator/jobs/${jobId}/actions`, { action: 'run-stage', expectedRevision: current.body.job.revision, input: { stageId: 'render-clean' } });
+ expect(started.status, JSON.stringify(started.body)).toBe(200);
+ await expect.poll(async () => {
+ const response = await runtimeRequest<{ job: { stages: Array<{ stageId: string; status: string; error?: unknown }> } }>(fixture.app.page, 'GET', `/creator/jobs/${jobId}`);
+ const stage = response.body.job.stages.find(candidate => candidate.stageId === 'render-clean');
+ if (stage?.status === 'failed') throw new Error(JSON.stringify(stage));
+ return stage?.status;
+ }, { timeout: 120_000 }).toBe('succeeded');
+ expect(downloads).toBe(1);
+ const result = await runtimeRequest<{ job: { artifacts: Array<{ kind: string; path: string; metadata: { hasVideo?: boolean; hasAudio?: boolean } }> } }>(fixture.app.page, 'GET', `/creator/jobs/${jobId}`);
+ const video = result.body.job.artifacts.find(artifact => artifact.kind === 'clean_video');
+ expect(video).toBeDefined();
+ expect(existsSync(video!.path)).toBe(true);
+ const ffprobe = join(packagedRuntimeRoot(), 'bin', process.platform === 'win32' ? 'ffprobe.exe' : 'ffprobe');
+ const media = JSON.parse(execFileSync(ffprobe, ['-v', 'error', '-show_streams', '-of', 'json', video!.path], { encoding: 'utf8', windowsHide: true }));
+ expect(media.streams.map((stream: { codec_type: string }) => stream.codec_type)).toEqual(expect.arrayContaining(['video', 'audio']));
+ await expect(card.locator('.settings-primary-button')).toHaveCount(0);
+ await card.getByRole('button', { name: '检查更新' }).click();
+ await expect(card.locator('.settings-primary-button')).toHaveCount(0);
+ expect(downloads).toBe(1);
+ } finally {
+ if (fixture) await closePackagedApp(fixture.app).catch(() => undefined);
+ server.closeAllConnections();
+ await new Promise<void>(resolvePromise => server.close(() => resolvePromise()));
+ if (fixture) rmSync(fixture.root, { recursive: true, force: true });
+ rmSync(metadataRoot, { recursive: true, force: true });
+ }
+});
+
+function rootDirForFixture(): string { return resolve(desktopDir, '../..'); }
+
test('打包 App 的 YouTube 视频嵌入请求带有有效 HTTP 来源标识', async () => {
const fixture = await launchCreatorDesktop({ width: 1180, height: 850 });
try {
@@ -564,44 +663,12 @@ test('@package-smoke 实际 Desktop 包创建并重启恢复 Creator Job,且
'SKILL.md',
'manifest.json'
]);
- const stickmanRuntimeRoot = packagedStickmanRuntimeRoot();
- const stickmanRuntimeManifest = JSON.parse(
- readFileSync(join(stickmanRuntimeRoot, 'manifest.json'), 'utf8')
- ) as {
- platform: string;
- arch: string;
- remotionVersion: string;
- chromiumVersion: string;
- browserExecutable: string;
- resources: Array<{ path: string; kind: string; platform: string; arch: string }>;
- };
- expect(stickmanRuntimeManifest).toMatchObject({
- platform: process.platform,
- arch: process.arch,
- remotionVersion: '4.0.473',
- browserExecutable: executableResource('browser/chrome-headless-shell')
- });
- expect(stickmanRuntimeManifest.chromiumVersion).toMatch(/^\d+\.\d+\.\d+\.\d+$/);
- expect(stickmanRuntimeManifest.resources).toEqual(expect.arrayContaining([
- expect.objectContaining({
- path: stickmanRuntimeManifest.browserExecutable,
- kind: 'browser',
- platform: process.platform,
- arch: process.arch
- }),
- expect.objectContaining({
- path: 'fonts/NotoSansSC-Bold.woff2',
- kind: 'font',
- platform: process.platform,
- arch: process.arch
- }),
- expect.objectContaining({
- path: 'visual-assets/catalog.json',
- kind: 'visual-asset',
- platform: process.platform,
- arch: process.arch
- })
- ]));
+ expect(existsSync(packagedStickmanRuntimeRoot())).toBe(false);
+ const resourcesRoot = dirname(packagedStickmanRuntimeRoot());
+ const component = JSON.parse(readFileSync(join(resourcesRoot, 'daemon', 'runtime', 'remotion-component.json'), 'utf8'));
+ expect(component).toMatchObject({ id: 'remotion', platform: process.platform, arch: process.arch, remotionVersion: '4.0.473' });
+ expect(component.archiveSha256).toMatch(/^[a-f0-9]{64}$/);
+ expect(existsSync(join(resourcesRoot, 'daemon', 'runtime', 'stickman-assets', 'visual-assets', 'catalog.json'))).toBe(true);
const projectDir = join(fixture.root, 'creator-workspace');
mkdirSync(projectDir, { recursive: true });
@@ -1547,7 +1614,7 @@ function hasWhisperKitDependency(root: string): boolean {
));
}
-async function launchCreatorDesktop(windowBounds?: { width: number; height: number }): Promise<{
+async function launchCreatorDesktop(windowBounds?: { width: number; height: number }, overrides: NodeJS.ProcessEnv = {}): Promise<{
app: PackagedApp;
root: string;
ytDlpBin: string;
@@ -1581,7 +1648,8 @@ async function launchCreatorDesktop(windowBounds?: { width: number; height: numb
OPENCREATOR_E2E_FAKE_CODEX_MODE: 'success',
OPENCREATOR_E2E_NODE_BINARY: process.execPath,
OPENCREATOR_E2E_FAKE_CODEX_SCRIPT: fakeCodexScript,
- OPENCREATOR_E2E_FAKE_YT_DLP_SCRIPT: fakeYtDlpScript
+ OPENCREATOR_E2E_FAKE_YT_DLP_SCRIPT: fakeYtDlpScript,
+ ...overrides
},
timeoutMs: 45_000
});
diff --git a/apps/desktop/electron-builder.yml b/apps/desktop/electron-builder.yml
index 34ffcb12..1218d7d5 100644
--- a/apps/desktop/electron-builder.yml
+++ b/apps/desktop/electron-builder.yml
@@ -51,8 +51,10 @@ extraResources:
to: creator-runtime
- from: .pack/codex-runtime
to: codex-runtime
- - from: .pack/stickman-runtime
- to: stickman-runtime
+ - from: .pack/stickman-assets
+ to: daemon/runtime/stickman-assets
+ - from: .pack/components/remotion-component.json
+ to: daemon/runtime/remotion-component.json
- from: ../web/dist
to: web
- from: resources
diff --git a/apps/desktop/packaging/daemon-runtime/package.json b/apps/desktop/packaging/daemon-runtime/package.json
index 2ad7fffd..f72964eb 100644
--- a/apps/desktop/packaging/daemon-runtime/package.json
+++ b/apps/desktop/packaging/daemon-runtime/package.json
@@ -7,7 +7,6 @@
"@fastify/cors": "11.2.0",
"@iarna/toml": "2.2.5",
"@modelcontextprotocol/sdk": "1.29.0",
- "@remotion/renderer": "4.0.473",
"better-sqlite3": "12.11.1",
"cheerio": "1.1.2",
"cron-parser": "5.6.1",
diff --git a/apps/desktop/packaging/daemon-runtime/pnpm-lock.yaml b/apps/desktop/packaging/daemon-runtime/pnpm-lock.yaml
index bdeeb0e9..15596302 100644
--- a/apps/desktop/packaging/daemon-runtime/pnpm-lock.yaml
+++ b/apps/desktop/packaging/daemon-runtime/pnpm-lock.yaml
@@ -20,9 +20,6 @@ importers:
'@modelcontextprotocol/sdk':
specifier: 1.29.0
version: 1.29.0([email protected])
- '@remotion/renderer':
- specifier: 4.0.473
better-sqlite3:
specifier: 12.11.1
version: 12.11.1
@@ -139,89 +136,105 @@ packages:
resolution: {integrity: sha512-0DaL0A6Xu6sQSQFwe4iVCrKWU2cCTItnRsYsCdxAMm9NF6twAA9BKnoqy4hqz4+azQ0JHuA26qiUKsf1XJ/v5A==}
cpu: [arm64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-3rbU4vqXXc3hY/OiXdl52xZvT0F1yEngWfvqudtPJg/KkyiaQw2DRsFrNzpmLvfavbwOq3qXn36GP8obHRULQA==}
cpu: [arm]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-cdn1OvUBwsXhbC0zSzJnNzf5MZ/mTrobawDvNXBTxe8VtqKAm0sRuEY2Evzovb/w9JMk4TvRxqt1mekSuJz64w==}
cpu: [ppc64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-HjPVx7yKz+0lqdhDlTw1tt90wamBoxhiXpvl1XZpJLiHH4RCJ5yDTqH+VlYPv2fwFs89JFw4c1IexYOcQUi4IQ==}
cpu: [riscv64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-neWLh+3yCNThxnfy3c4BbVBeGgt9aftno+XbT56iK28RgeDs3UOFWviLWlUu0bArYVYJaFDK+RRohbicUNCm8Q==}
cpu: [s390x]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-4vKmvAst9nrowcqquKFAyZJUDolUaIp8uRiN0mWFguJ1IplC9/pitXtlnnlU4aa/eJw3J7i67V+pwUL+wZGdsA==}
cpu: [x64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-Y9kQaLMuNoB0bPYOOdcZMaseNrFpPodIWWMrx+CZyydf2xn68j9WYc6sWWRrDwNkzCQjKYfc68L7jKjGlHMibw==}
cpu: [arm64]
os: [linux]
+ libc: [musl]
resolution: {integrity: sha512-fj8Mv0HHfD1Rr+4I68+3agJynxDWtBFgicTbSOb9Bke6pIwzGcJ+RX/yHjmiEGFMCavY/dxvem7MyNaJF+wDiw==}
cpu: [x64]
os: [linux]
+ libc: [musl]
resolution: {integrity: sha512-De4jpEnAU8Hd5oT0j1G3uL4ZvTuipVMn7YC6vPaJhy6/7EwEae0SVAoBrUMYQbkLGDm85taVWwuPc1a44LTzCQ==}
engines: {node: '>=20.9.0'}
cpu: [arm64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-7OAS8gI0EReKGVN2HssHlM6umJgxF5VI3xN0p9FA91p/YO+ou5hiNghLdZ5BEHztwaaK5+bLKRf8x/o2L2nk9A==}
engines: {node: '>=20.9.0'}
cpu: [arm]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-2oYZJeIl4kCcMGk4ouZVjnkCtFrpQFlNEtJ6GbxzhHQchwH0NH/qEb9ykmOl29dqwMq+JhFdZn+1ak2FKhI9fQ==}
engines: {node: '>=20.9.0'}
cpu: [ppc64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-cPbNChoRURAWdebDIHSenxRpgEdy7JkPydSnUxRm9VvKD7m0/xVaR/8Fzlu81pk5nHEvHH87UZUA7cTtwnbJSA==}
engines: {node: '>=20.9.0'}
cpu: [riscv64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-RY0JFY8Fd6RonCBtHz+DvadaPkXDSI1AUn6yWL9TipqkZ1vY8w8evqdgyDFnkm4/K1ve1TvZiaePP5oSd4+WVQ==}
engines: {node: '>=20.9.0'}
cpu: [s390x]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-9qvvEAuk8k89TfWUoX2htWjbAMX8p+NxCppjpcg5k6xMsjhBQPTsoIh36h9Qde4WRuGpJeYnOjdosDn/cnv+OA==}
engines: {node: '>=20.9.0'}
cpu: [x64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-KB5jxpfWQTr0nc3xdHtWChdbifHrBGsd2SM62Eyxrl8afikm+f5qGBU75SJIZBT/S1MC8XyacdlXBMSWq6OURA==}
engines: {node: '>=20.9.0'}
cpu: [arm64]
os: [linux]
+ libc: [musl]
resolution: {integrity: sha512-f+eZJZIQNEEd26RPSW+76chwOf1XtA2Y/O+5ocVyLliHkeih3e+jhLVBdNTd2rS3IbNXK8+ug93Vf5ZXtF5Lxg==}
engines: {node: '>=20.9.0'}
cpu: [x64]
os: [linux]
+ libc: [musl]
resolution: {integrity: sha512-zQnl4Kwp7Q6NHsENtU2T/00Zi+w3AQNwz3+UaTyVBy2FpXrzXzGjndpK61onhZjRtRpQXxCTeqw19bVyXOh7jA==}
@@ -271,53 +284,6 @@ packages:
'@pinojs/[email protected]':
resolution: {integrity: sha512-k2ENnmBugE/rzQfEcdWHcCY+/FM3VLzH9cYEsbdsoqrvzAKRhUZeRNhAZvB8OitQJ1TBed3yqWtdjzS6wJKBwg==}
- '@remotion/[email protected]':
- resolution: {integrity: sha512-cSKS6VPKpLlEs+W0TSgXbxzdHDFxj+ft1jeP/MhedtL3rcSDyjir8RTI8bqDgrcEF4km3Rcg0CxrGbYTKgUVVQ==}
- cpu: [arm64]
- os: [darwin]
-
- '@remotion/[email protected]':
- resolution: {integrity: sha512-Sf0IHz/zXroP4UGZ0NkyVn0ICiOMeUj07i8nRoz0A95d4TDR3YKVThY4U16ElsaLSbHk3pMcobCxx1tscvtZYQ==}
- cpu: [x64]
- os: [darwin]
-
- '@remotion/[email protected]':
- resolution: {integrity: sha512-HeV247O9dwhSfXFYoA7Dd0zPmyn2grbrIhaYs2MJZxO6IHmEUk0gm9/drWyjDHy4e2WCg98uSlcycNOmWtG5ng==}
- cpu: [arm64]
- os: [linux]
-
- '@remotion/[email protected]':
- resolution: {integrity: sha512-7EGy2MtQch3yLzwxvWncz/3rmXOWQkWigCDL37I90aHhlf8JgrMZXo8dUtIoD0LP/zHWtFNBcJmgg9Ej+bHshA==}
- cpu: [arm64]
- os: [linux]
-
- '@remotion/[email protected]':
- resolution: {integrity: sha512-X5Gzod9Q8sTtzjc+hIYKw6PMaB3tY0ADx68j2z+Zm8nJanmkzLZEDyZvlMexmE4nkb7IdOkHzYGm9NpynbMH2A==}
- cpu: [x64]
- os: [linux]
-
- '@remotion/[email protected]':
- resolution: {integrity: sha512-REyhvrjGYfFTxGaaRDP31zANM744JI7pKXCgTqXHZBCe8mCZjxZCxmwt9pNL2lJsQ+qLr9zai488Bbj/PUuB6g==}
- cpu: [x64]
- os: [linux]
-
- '@remotion/[email protected]':
- resolution: {integrity: sha512-J69HIENHpH1m8I85kTe111viqB5AGgKJdTCSKp4mGBxM95IL4nydzrYxVd91BvWjanQfVVq1C3voaF8YLwkT7A==}
- cpu: [x64]
- os: [win32]
-
- '@remotion/[email protected]':
- resolution: {integrity: sha512-BBw6SuEWuUD/lYXbLKEC0TTUzW7aLsO0X72pG38W1dOUyfU2KZYYfWGZkd+ermZTWWJ8cW+mevIwloUGk7FRaQ==}
-
- '@remotion/[email protected]':
- resolution: {integrity: sha512-WOOmT38O3ax78oDIE75FnsDi8eUMBKOdnqiXU3NeArNoA/xQZv7yDUgV3e1SxFaCHS7IbWHIATXUfVgS8TIXBA==}
- peerDependencies:
- react: '>=16.8.0'
- react-dom: '>=16.8.0'
-
- '@remotion/[email protected]':
- resolution: {integrity: sha512-JRXgqnzHbcaZU+LH3VK9KRNBHd7rhNnf34C3uUeFYFChRQhnmHWTSo7p/SDUhCpVh+hIHsS52xJz9JPwwy5gUw==}
-
resolution: {integrity: sha512-5lSsMOTXURePglDfvuAQUqkGek9Hg2kksOYay2m0+XR++b2NWYL/4sWyuvVBIs8oKnJaxkdi9whaL/sqN13afw==}
@@ -558,10 +524,6 @@ packages:
resolution: {integrity: sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==}
engines: {node: '>=18.0.0'}
- resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==}
- engines: {node: '>=10'}
-
resolution: {integrity: sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==}
engines: {node: '>=6'}
@@ -645,10 +607,6 @@ packages:
resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==}
engines: {node: '>= 0.4'}
- resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==}
- engines: {node: '>=10'}
-
resolution: {integrity: sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==}
@@ -679,10 +637,6 @@ packages:
resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==}
engines: {node: '>= 14'}
- resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==}
- engines: {node: '>=10.17.0'}
-
resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==}
engines: {node: '>=0.10.0'}
@@ -715,10 +669,6 @@ packages:
resolution: {integrity: sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==}
- resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==}
- engines: {node: '>=8'}
-
resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
@@ -740,9 +690,6 @@ packages:
resolution: {integrity: sha512-MHp03UImeVhB7XZtjd0E4n6+3xr5Dq/9xI/5FptGk5FrbDR3zagPa2DS6U8ks/3HjbKWG9Q1M2ufOzxV2qLYSQ==}
- resolution: {integrity: sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==}
-
resolution: {integrity: sha512-vtEhXh/gNjI9Yg1u4jX/0YVPMvxzHuGgCm6tC5kZyb08yjGWGnqAjGJvcXbqQR2P3MyMEFnRbpcdFS6PBcLqew==}
engines: {node: '>=12'}
@@ -764,9 +711,6 @@ packages:
resolution: {integrity: sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==}
engines: {node: '>=18'}
- resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==}
-
resolution: {integrity: sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==}
engines: {node: '>= 0.6'}
@@ -775,10 +719,6 @@ packages:
resolution: {integrity: sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==}
engines: {node: '>=18'}
- resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==}
- engines: {node: '>=6'}
-
resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==}
engines: {node: '>=10'}
@@ -811,10 +751,6 @@ packages:
resolution: {integrity: sha512-DRI60hzo2oKN1ma0ckc6nQWlHU69RH6xN0sjQTjMpChPfTYvKZdcQFfdYK2RWbJcKyUizSIy/l8OTGxMAM1QDw==}
- resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==}
- engines: {node: '>=8'}
-
resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==}
@@ -837,10 +773,6 @@ packages:
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
- resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==}
- engines: {node: '>=6'}
-
resolution: {integrity: sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA==}
@@ -910,10 +842,6 @@ packages:
resolution: {integrity: sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==}
- resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
- engines: {node: '>=6'}
-
resolution: {integrity: sha512-h6fhOIaRrID2CbEY2fqs+7t+UXZo+MLAnU5gRIq85uFtdiUPCdsApMlHhXogKVM4HM2DVbIjGNTTYH2OcmP1vA==}
engines: {node: '>=0.6'}
@@ -933,15 +861,6 @@ packages:
resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==}
hasBin: true
- resolution: {integrity: sha512-JDk8dgif51OjFoDE70+OT9ICyYr+69HlmihNwp1+Nsfbna3t5sIiCa9ZJktDmQ4/1b/rn26hIAR2uYXDMr5r0Q==}
- peerDependencies:
- react: ^19.3.0
-
- resolution: {integrity: sha512-E8LUcbtBWt20bbl2YoHfx4ZDBdxVTfOKtCZn9cDSJ4l6/nuoApcpIBcj47t2wZoVX8g2ZHuMHbiShgCR1T5Sog==}
- engines: {node: '>=0.10.0'}
-
resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==}
engines: {node: '>= 6'}
@@ -953,12 +872,6 @@ packages:
resolution: {integrity: sha512-P4nbQYQfePJxRSmY+v/KINxVucm4NF3p3s7pJveMTtom52FR4YGltUQLB8idDXwDDWW+eYrWDFbuzUnjoWHF7g==}
- resolution: {integrity: sha512-Li2u4cVxlbxWgxQPn5oBpUlmNKYFpLUmpE9OHMP7QurvOMfvVK1tcC7utxVEwYFZf18tXwqIPBwmuFvdzMu+YA==}
- peerDependencies:
- react: '>=16.8.0'
- react-dom: '>=16.8.0'
-
resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==}
engines: {node: '>=0.10.0'}
@@ -995,9 +908,6 @@ packages:
resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}
- resolution: {integrity: sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==}
-
resolution: {integrity: sha512-l4KnYfEyqYJxDwlNVyRfO2E4NTHfMKAWdUuA8J0yve2Dz/E/PdBepY03RvyJpssIpRFwJoCD55wA+mEDs6ByWA==}
@@ -1053,9 +963,6 @@ packages:
resolution: {integrity: sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==}
engines: {node: '>= 0.4'}
- resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==}
-
resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==}
@@ -1065,11 +972,6 @@ packages:
resolution: {integrity: sha512-w6AxtubXa2wTXAUsZMMWERrsIRAdrK0Sc+FUytWvYAhBJLyuI4llrMIC1DtlNSdI99EI86KZum2MMq3EAZlF9Q==}
- resolution: {integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==}
- engines: {node: '>= 8'}
- deprecated: The work that was done in this beta branch won't be included in future versions
-
resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==}
engines: {node: '>= 10.x'}
@@ -1081,10 +983,6 @@ packages:
resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==}
- resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==}
- engines: {node: '>=6'}
-
resolution: {integrity: sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==}
engines: {node: '>=0.10.0'}
@@ -1115,9 +1013,6 @@ packages:
resolution: {integrity: sha512-TvAJjbHZlYmI323+srtqHQFyJsoWy6mI09ppkuj9+iRsqsVKG9fvTcOP7FHF2UCb0QSYtjEavffrKzdd0XgClg==}
engines: {node: '>=20'}
- resolution: {integrity: sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==}
-
resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
@@ -1149,9 +1044,6 @@ packages:
resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==}
engines: {node: '>= 0.8'}
- resolution: {integrity: sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==}
-
resolution: {integrity: sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==}
engines: {node: '>=18'}
@@ -1161,9 +1053,6 @@ packages:
resolution: {integrity: sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==}
engines: {node: '>=18'}
- resolution: {integrity: sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==}
-
resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==}
engines: {node: '>= 8'}
@@ -1172,18 +1061,6 @@ packages:
resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
- resolution: {integrity: sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==}
- engines: {node: '>=10.0.0'}
- peerDependencies:
- bufferutil: ^4.0.1
- utf-8-validate: '>=5.0.2'
- peerDependenciesMeta:
- bufferutil:
- optional: true
- utf-8-validate:
- optional: true
-
resolution: {integrity: sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA==}
engines: {node: '>= 14.6'}
@@ -1376,53 +1253,6 @@ snapshots:
'@pinojs/[email protected]': {}
- '@remotion/[email protected]':
- optional: true
-
- '@remotion/[email protected]':
- optional: true
-
- '@remotion/[email protected]':
- optional: true
-
- '@remotion/[email protected]':
- optional: true
-
- '@remotion/[email protected]':
- optional: true
-
- '@remotion/[email protected]':
- optional: true
-
- '@remotion/[email protected]':
- optional: true
-
- '@remotion/[email protected]': {}
-
- dependencies:
- '@remotion/licensing': 4.0.473
- '@remotion/streaming': 4.0.473
- execa: 5.1.1
- react: 19.3.0
- react-dom: 19.3.0([email protected])
- source-map: 0.8.0-beta.0
- ws: 8.21.0
- optionalDependencies:
- '@remotion/compositor-darwin-arm64': 4.0.473
- '@remotion/compositor-darwin-x64': 4.0.473
- '@remotion/compositor-linux-arm64-gnu': 4.0.473
- '@remotion/compositor-linux-arm64-musl': 4.0.473
- '@remotion/compositor-linux-x64-gnu': 4.0.473
- '@remotion/compositor-linux-x64-musl': 4.0.473
- '@remotion/compositor-win32-x64-msvc': 4.0.473
- transitivePeerDependencies:
- - bufferutil
- - utf-8-validate
-
- '@remotion/[email protected]': {}
-
dependencies:
tslib: 2.8.1
@@ -1657,18 +1487,6 @@ snapshots:
dependencies:
eventsource-parser: 3.1.1
- dependencies:
- cross-spawn: 7.0.6
- get-stream: 6.0.1
- human-signals: 2.1.0
- is-stream: 2.0.1
- merge-stream: 2.0.0
- npm-run-path: 4.0.1
- onetime: 5.1.2
- signal-exit: 3.0.7
- strip-final-newline: 2.0.0
-
@@ -1825,8 +1643,6 @@ snapshots:
dunder-proto: 1.0.1
es-object-atoms: 1.1.2
-
@@ -1861,8 +1677,6 @@ snapshots:
transitivePeerDependencies:
- supports-color
-
dependencies:
safer-buffer: 2.1.2
@@ -1885,8 +1699,6 @@ snapshots:
-
@@ -1910,8 +1722,6 @@ snapshots:
base64-js: 0.0.8
unicode-trie: 2.0.0
-
@@ -1922,16 +1732,12 @@ snapshots:
-
dependencies:
mime-db: 1.54.0
-
@@ -1954,10 +1760,6 @@ snapshots:
- dependencies:
- path-key: 3.1.1
-
dependencies:
boolbase: 1.0.0
@@ -1976,10 +1778,6 @@ snapshots:
dependencies:
wrappy: 1.0.2
- dependencies:
- mimic-fn: 2.1.0
-
@@ -2074,8 +1872,6 @@ snapshots:
end-of-stream: 1.4.5
once: 1.4.0
-
dependencies:
es-define-property: 1.0.1
@@ -2099,13 +1895,6 @@ snapshots:
minimist: 1.2.8
strip-json-comments: 2.0.1
- dependencies:
- react: 19.3.0
- scheduler: 0.28.0
-
-
dependencies:
inherits: 2.0.4
@@ -2116,11 +1905,6 @@ snapshots:
- dependencies:
- react: 19.3.0
- react-dom: 19.3.0([email protected])
-
@@ -2151,8 +1935,6 @@ snapshots:
-
@@ -2252,8 +2034,6 @@ snapshots:
side-channel-map: 1.0.1
side-channel-weakmap: 1.0.2
-
@@ -2266,10 +2046,6 @@ snapshots:
dependencies:
atomic-sleep: 1.0.0
- dependencies:
- whatwg-url: 7.1.0
-
@@ -2278,8 +2054,6 @@ snapshots:
dependencies:
safe-buffer: 5.2.1
-
@@ -2309,10 +2083,6 @@ snapshots:
- dependencies:
- punycode: 2.3.1
-
@@ -2343,28 +2113,18 @@ snapshots:
-
dependencies:
iconv-lite: 0.6.3
- dependencies:
- lodash.sortby: 4.7.0
- tr46: 1.0.1
- webidl-conversions: 4.0.2
-
dependencies:
isexe: 2.0.0
-
diff --git a/apps/desktop/scripts/package-release.mjs b/apps/desktop/scripts/package-release.mjs
index 60dd3176..211d45d8 100644
--- a/apps/desktop/scripts/package-release.mjs
+++ b/apps/desktop/scripts/package-release.mjs
@@ -106,13 +106,6 @@ await runStage('准备 Creator Runtime', process.execPath, [
env,
timeoutMs: 25 * 60_000
});
-await runStage('准备 Stickman Runtime', process.execPath, [
- resolve(scriptDir, 'prepare-stickman-runtime.mjs')
-], {
- cwd: rootDir,
- env,
- timeoutMs: 25 * 60_000
-});
await runStage('准备 Codex Runtime', process.execPath, [
resolve(scriptDir, 'prepare-codex-runtime.mjs')
], {
@@ -134,6 +127,16 @@ const {
?? process.env.APPLE_TEAM_ID
});
const packageStartedAt = Date.now();
+await runStage('构建独立 Remotion 组件与轻量角色资源', process.execPath, [
+ resolve(scriptDir, 'prepare-stickman-runtime.mjs')
+], { cwd: rootDir, env: builderEnv, timeoutMs: 25 * 60_000 });
+if (macSigning.mode === 'developer-id' && mode === 'release') {
+ const componentNotaryArchive = resolve(desktopDir, '.pack', 'remotion-notarization.zip');
+ try {
+ await runStage('准备 Remotion 组件公证', 'ditto', ['-c', '-k', '--keepParent', resolve(desktopDir, '.pack', 'stickman-runtime'), componentNotaryArchive], { cwd: rootDir, env: builderEnv });
+ await submitAndWaitForNotarization(componentNotaryArchive, notarizationArgs);
+ } finally { rmSync(componentNotaryArchive, { force: true }); }
+}
await runStage(
mode === 'dir' ? '生成可运行目录' : '生成桌面安装包',
'electron-builder',
@@ -147,6 +150,8 @@ await runStage(
const packageRoot = findFreshPackageRoot(candidates);
const artifacts = findFreshArtifacts(packageStartedAt, mode, platform);
+const remotionComponent = JSON.parse(readFileSync(resolve(desktopDir, '.pack', 'components', 'remotion-component.json'), 'utf8'));
+const componentArchive = resolve(desktopDir, '.pack', 'components', remotionComponent.fileName);
if (macSigning.mode === 'developer-id' && mode === 'release') {
await finalizeMacReleaseArtifacts(
artifacts.filter(path => path.endsWith('.dmg')),
@@ -241,6 +246,7 @@ const manifest = {
stickmanRuntimeManifestSha256,
remotionVersion: stickmanRuntimeManifest.remotionVersion,
chromiumVersion: stickmanRuntimeManifest.chromiumVersion,
+ remotionComponent,
creatorPresetCatalogHash: creatorPresetManifest.catalogHash,
creatorPresetAssetSetHash: creatorPresetManifest.assetSetHash,
creatorPresetResourceCount: creatorPresetManifest.files.length,
@@ -265,7 +271,7 @@ const manifest = {
ytDlpPythonVersion: creatorRuntimeManifest.ytDlp?.pythonVersion,
macSigningMode: macSigning.mode,
appleTeamId: macSigning.teamId ?? null,
- artifacts: artifacts.map(path => ({
+ artifacts: [...artifacts, componentArchive].map(path => ({
path,
relativePath: relative(rootDir, path),
bytes: statSync(path).size,
diff --git a/apps/desktop/scripts/prepare-stickman-runtime.mjs b/apps/desktop/scripts/prepare-stickman-runtime.mjs
index 98034858..c4b9ca9f 100644
--- a/apps/desktop/scripts/prepare-stickman-runtime.mjs
+++ b/apps/desktop/scripts/prepare-stickman-runtime.mjs
@@ -6,6 +6,7 @@ import {
existsSync,
mkdirSync,
readdirSync,
+ readFileSync,
rmSync,
statSync,
writeFileSync
@@ -19,6 +20,8 @@ import {
hashFile,
verifyStickmanRuntime
} from './stickman-runtime-contract.mjs';
+import { copyRemotionDependencies, createRemotionComponentArtifact } from './remotion-component-artifact.mjs';
+import { signRemotionComponent } from './sign-creator-runtime-after-pack.mjs';
const scriptDir = dirname(fileURLToPath(import.meta.url));
const desktopDir = resolve(scriptDir, '..');
@@ -37,8 +40,9 @@ const outputRoot = resolve(
const bundleRoot = join(outputRoot, 'bundle');
const browserRoot = join(outputRoot, 'browser');
const fontRoot = join(outputRoot, 'fonts');
-const characterRoot = join(outputRoot, 'characters');
-const visualAssetRoot = join(outputRoot, 'visual-assets');
+const assetsRoot = join(desktopDir, '.pack', 'stickman-assets');
+const characterRoot = join(assetsRoot, 'characters');
+const visualAssetRoot = join(assetsRoot, 'visual-assets');
const remotionVersion = '4.0.473';
const chromiumVersion = '149.0.7790.0';
const requireFromDaemon = createRequire(join(rootDir, 'apps', 'daemon', 'package.json'));
@@ -47,6 +51,8 @@ const yauzl = requireFromDaemon('yauzl');
rmSync(outputRoot, { recursive: true, force: true });
mkdirSync(outputRoot, { recursive: true });
+rmSync(assetsRoot, { recursive: true, force: true });
+mkdirSync(assetsRoot, { recursive: true });
await bundle({
entryPoint: join(rootDir, 'packages', 'stickman-remotion', 'src', 'index.ts'),
outDir: bundleRoot,
@@ -93,11 +99,12 @@ cpSync(
);
const resources = [];
+const rendererEntry = copyRemotionDependencies(outputRoot, requireFromDaemon);
addDirectory(bundleRoot, 'bundle', remotionVersion);
addDirectory(browserRoot, 'browser', chromiumVersion);
addDirectory(fontRoot, 'font', '@fontsource/[email protected]');
-addDirectory(characterRoot, 'character', 'opencreator-dashboard@1');
-addDirectory(visualAssetRoot, 'visual-asset', 'stickman-visual-assets@1');
+addDirectory(join(outputRoot, 'node_modules'), 'renderer', remotionVersion);
+resources.push({ path: 'package.json', kind: 'renderer', version: remotionVersion, sha256: hashFile(join(outputRoot, 'package.json')), bytes: statSync(join(outputRoot, 'package.json')).size, platform: targetPlatform, arch: targetArch });
resources.sort((left, right) => left.path.localeCompare(right.path));
const manifest = {
version: 1,
@@ -105,17 +112,22 @@ const manifest = {
arch: targetArch,
remotionVersion,
chromiumVersion,
+ rendererEntry,
bundlePath: normalizeRelative(relative(outputRoot, bundleRoot)),
browserExecutable: normalizeRelative(relative(outputRoot, packagedBrowserExecutable)),
resources
};
writeFileSync(join(outputRoot, 'manifest.json'), `${JSON.stringify(manifest, null, 2)}\n`);
+await signRemotionComponent(outputRoot);
verifyStickmanRuntime(outputRoot, targetPlatform, targetArch);
+const appVersion = JSON.parse(readFileSync(join(desktopDir, 'package.json'), 'utf8')).version;
+const component = createRemotionComponentArtifact({ runtimeRoot: outputRoot, outputRoot: join(desktopDir, '.pack', 'components'), version: appVersion, platform: targetPlatform, arch: targetArch });
console.log(JSON.stringify({
ok: true,
outputRoot,
resources: resources.length,
- browserVersion
+ browserVersion,
+ component
}));
function addDirectory(root, kind, version) {
diff --git a/apps/desktop/scripts/release-assets.mjs b/apps/desktop/scripts/release-assets.mjs
index 7bbe3fc0..26326bef 100644
--- a/apps/desktop/scripts/release-assets.mjs
+++ b/apps/desktop/scripts/release-assets.mjs
@@ -58,6 +58,7 @@ function sha256(path) {
export function stageReleaseAssets({ manifest, version, assetsDir }) {
const names = releaseAssetNames(version, manifest.platform, manifest.arch);
+ if (manifest.remotionComponent) names.push(remotionReleaseAssetName(version, manifest.platform, manifest.arch));
const selected = names.map(name => {
const matches = manifest.artifacts.filter(artifact => basename(artifact.path) === name);
if (matches.length !== 1) throw new Error(`Expected one verified release asset: ${name}`);
@@ -81,6 +82,12 @@ export function stageReleaseAssets({ manifest, version, assetsDir }) {
return [...names, 'SHA256SUMS.txt'];
}
+export function remotionReleaseAssetName(version, platform, arch) {
+ assertVersion(version);
+ if (![...releasePlatforms, { platform: 'linux', arch: 'x64' }].some(target => target.platform === platform && target.arch === arch)) throw new Error(`Unsupported Remotion release platform: ${platform}-${arch}`);
+ return `Remotion-${version}-${platform}-${arch}.tar.gz`;
+}
+
function writeChecksums(directory, names) {
const lines = [...names].sort().map(name => `${sha256(join(directory, name))} ${name}`);
writeFileSync(join(directory, 'SHA256SUMS.txt'), `${lines.join('\n')}\n`);
@@ -93,7 +100,8 @@ export function finalizeReleaseAssets({ directory, version, repository, highligh
const krillinAssets = krillinReleasePlatforms.flatMap(
({ platform, arch }) => krillinReleaseAssetNames(version, platform, arch)
);
- const expected = [...desktopAssets, ...krillinAssets];
+ const remotionAssets = releasePlatforms.map(({ platform, arch }) => remotionReleaseAssetName(version, platform, arch));
+ const expected = [...desktopAssets, ...krillinAssets, ...remotionAssets];
const actual = readdirSync(directory, { withFileTypes: true });
for (const entry of actual) {
if (!entry.isFile() || (!expected.includes(entry.name) && entry.name !== 'SHA256SUMS.txt')) {
@@ -143,6 +151,10 @@ export function renderReleaseNotes({ version, repository, highlights = '' }) {
'| --- | --- |',
...krillinRows(1),
'',
+ '## Optional Rendering Components',
+ '',
+ 'Remotion rendering components are downloaded on demand by OpenCreator. They are not included in the Desktop installer.',
+ '',
`[SHA-256 Checksums](${downloadRoot}/SHA256SUMS.txt)`,
'',
'The macOS installers are signed and notarized. The Windows installer is currently not Authenticode-signed; verify its SHA-256 checksum before installation.',
diff --git a/apps/desktop/scripts/remotion-component-artifact.mjs b/apps/desktop/scripts/remotion-component-artifact.mjs
new file mode 100644
index 00000000..6deb858f
--- /dev/null
+++ b/apps/desktop/scripts/remotion-component-artifact.mjs
@@ -0,0 +1,77 @@
+import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs';
+import { createRequire } from 'node:module';
+import { dirname, join, resolve } from 'node:path';
+import { execFileSync } from 'node:child_process';
+import { hashFile, verifyStickmanRuntime } from './stickman-runtime-contract.mjs';
+
+export function copyRemotionDependencies(runtimeRoot, requireFromDaemon) {
+ const installed = new Map();
+ function copyPackage(name, parentRequire, optional = false) {
+ let packagePath;
+ try {
+ packagePath = parentRequire.resolve(`${name}/package.json`);
+ } catch {
+ try {
+ let current = dirname(parentRequire.resolve(name));
+ while (current !== dirname(current)) {
+ const candidate = join(current, 'package.json');
+ if (existsSync(candidate) && JSON.parse(readFileSync(candidate, 'utf8')).name === name) {
+ packagePath = candidate;
+ break;
+ }
+ current = dirname(current);
+ }
+ } catch { if (optional) return; }
+ }
+ if (!packagePath) {
+ if (optional) return;
+ throw new Error(`Remotion production dependency is missing: ${name}`);
+ }
+ const pkg = JSON.parse(readFileSync(packagePath, 'utf8'));
+ if (installed.has(name)) {
+ if (installed.get(name) !== pkg.version) throw new Error(`Remotion production dependency version conflict: ${name}`);
+ return;
+ }
+ installed.set(name, pkg.version);
+ const source = dirname(packagePath);
+ const target = join(runtimeRoot, 'node_modules', name);
+ mkdirSync(dirname(target), { recursive: true });
+ cpSync(source, target, { recursive: true, dereference: true, filter: path => {
+ if (path === source) return true;
+ const relative = path.slice(source.length + 1).replaceAll('\\', '/');
+ return !relative.split('/').some(segment => ['node_modules', 'test', 'tests', '__tests__', '.bin'].includes(segment))
+ && !/\.(?:map|d\.ts)$/.test(relative);
+ } });
+ const packageRequire = createRequire(packagePath);
+ for (const dependency of Object.keys(pkg.dependencies ?? {})) copyPackage(dependency, packageRequire);
+ for (const dependency of Object.keys(pkg.optionalDependencies ?? {})) copyPackage(dependency, packageRequire, true);
+ for (const dependency of Object.keys(pkg.peerDependencies ?? {})) {
+ if (!dependency.startsWith('@types/')) copyPackage(dependency, packageRequire, pkg.peerDependenciesMeta?.[dependency]?.optional === true);
+ }
+ }
+ copyPackage('@remotion/renderer', requireFromDaemon);
+ writeFileSync(join(runtimeRoot, 'package.json'), `${JSON.stringify({ private: true, type: 'commonjs' }, null, 2)}\n`);
+ const rendererPackage = join(runtimeRoot, 'node_modules', '@remotion', 'renderer', 'package.json');
+ return createRequire(rendererPackage).resolve('@remotion/renderer').slice(resolve(runtimeRoot).length + 1).replaceAll('\\', '/');
+}
+
+export function createRemotionComponentArtifact({ runtimeRoot, outputRoot, version, platform, arch }) {
+ if (!/^\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?$/.test(version)) throw new Error('Invalid Remotion component App version');
+ const manifest = verifyStickmanRuntime(runtimeRoot, platform, arch);
+ if (!manifest.rendererEntry) throw new Error('Remotion component does not include its Renderer');
+ mkdirSync(outputRoot, { recursive: true });
+ const fileName = `Remotion-${version}-${platform}-${arch}.tar.gz`;
+ const archive = join(outputRoot, fileName);
+ rmSync(archive, { force: true });
+ execFileSync('tar', ['-czf', archive, '-C', runtimeRoot, '.'], { timeout: 5 * 60_000, windowsHide: true, env: { ...process.env, COPYFILE_DISABLE: '1' } });
+ const descriptor = {
+ version: 1, id: 'remotion', componentVersion: version,
+ remotionVersion: manifest.remotionVersion, chromiumVersion: manifest.chromiumVersion,
+ platform, arch, fileName,
+ archiveUrl: `https://github.com/krillinai/OpenCreator/releases/download/v${version}/${fileName}`,
+ archiveSha256: hashFile(archive), manifestSha256: hashFile(join(runtimeRoot, 'manifest.json')),
+ bytes: statSync(archive).size
+ };
+ writeFileSync(join(outputRoot, 'remotion-component.json'), `${JSON.stringify(descriptor, null, 2)}\n`);
+ return descriptor;
+}
diff --git a/apps/desktop/scripts/sign-creator-runtime-after-pack.mjs b/apps/desktop/scripts/sign-creator-runtime-after-pack.mjs
index c6f5efa1..21f75172 100644
--- a/apps/desktop/scripts/sign-creator-runtime-after-pack.mjs
+++ b/apps/desktop/scripts/sign-creator-runtime-after-pack.mjs
@@ -32,7 +32,17 @@ export async function afterPack(context) {
if (process.env.OPENCREATOR_SIGN_CREATOR_RUNTIME !== '1') return;
await signDaemonRuntimeBundle(context);
await signCreatorRuntimeBundle(context);
- await signStickmanRuntimeBundle(context);
+}
+
+export async function signRemotionComponent(runtimeRoot, env = process.env) {
+ if (env.OPENCREATOR_SIGN_CREATOR_RUNTIME !== '1') return;
+ if (process.platform !== 'darwin') throw new Error('Remotion Developer ID signing requires macOS');
+ const identity = env.OPENCREATOR_REMOTION_SIGNING_IDENTITY?.trim()
+ || findSigningIdentity(env.OPENCREATOR_APPLE_TEAM_ID, env.APPLE_KEYCHAIN ?? null);
+ const binaries = findMachOBinaries(runtimeRoot);
+ if (binaries.length === 0) throw new Error('Remotion component has no native binaries');
+ for (const path of binaries) signMachOBinary(path, identity, env.APPLE_KEYCHAIN ?? null);
+ updateManifestHashes(runtimeRoot, binaries);
}
export async function signDaemonRuntimeBundle(context, options = {}) {
diff --git a/apps/desktop/scripts/stickman-runtime-contract.mjs b/apps/desktop/scripts/stickman-runtime-contract.mjs
index e2b91156..5583fe5d 100644
--- a/apps/desktop/scripts/stickman-runtime-contract.mjs
+++ b/apps/desktop/scripts/stickman-runtime-contract.mjs
@@ -55,7 +55,7 @@ export function verifyStickmanRuntime(rootPath, platform, arch) {
for (const resource of manifest.resources) {
if (
typeof resource?.path !== 'string'
- || !['bundle', 'browser', 'font', 'character', 'visual-asset'].includes(resource.kind)
+ || !['bundle', 'browser', 'renderer', 'font', 'character', 'visual-asset'].includes(resource.kind)
|| !/^[a-f0-9]{64}$/i.test(resource.sha256 ?? '')
|| !Number.isSafeInteger(resource.bytes)
|| resource.bytes < 0
@@ -106,16 +106,19 @@ export function verifyStickmanRuntime(rootPath, platform, arch) {
throw new Error(`Stickman Runtime font is missing: ${path}`);
}
}
- for (const path of requiredCharacters) {
+ for (const path of manifest.rendererEntry ? [] : requiredCharacters) {
if (!manifest.resources.some(resource => resource.kind === 'character' && resource.path === path)) {
throw new Error(`Stickman Runtime character is missing: ${path}`);
}
}
- for (const path of requiredVisualAssets) {
+ for (const path of manifest.rendererEntry ? [] : requiredVisualAssets) {
if (!manifest.resources.some(resource => resource.kind === 'visual-asset' && resource.path === path)) {
throw new Error(`Stickman Runtime visual asset is missing: ${path}`);
}
}
+ if (manifest.rendererEntry && !manifest.resources.some(resource => resource.kind === 'renderer' && resource.path === manifest.rendererEntry)) {
+ throw new Error('Remotion Renderer entry is not bound to its component manifest');
+ }
return manifest;
}
diff --git a/apps/desktop/scripts/verify-package.mjs b/apps/desktop/scripts/verify-package.mjs
index 76943f3e..b1bd9dce 100644
--- a/apps/desktop/scripts/verify-package.mjs
+++ b/apps/desktop/scripts/verify-package.mjs
@@ -33,7 +33,6 @@ import { verifyCodexRuntime } from './codex-runtime-contract.mjs';
import {
hashDirectory as hashStickmanDirectory,
hashFile as hashStickmanFile,
- findFirstDifferentPath as findFirstDifferentStickmanPath,
verifyStickmanRuntime
} from './stickman-runtime-contract.mjs';
import {
@@ -123,7 +122,7 @@ assertSize('app.asar', appAsar, 80 * 1024 * 1024);
assertSize('Daemon resources', daemonDir, 250 * 1024 * 1024);
assertSize('Creator Runtime', creatorRuntimeDir, 384 * 1024 * 1024);
assertSize('Codex Runtime', codexRuntimeDir, 450 * 1024 * 1024);
-assertSize('Stickman Runtime', stickmanRuntimeDir, 384 * 1024 * 1024);
+assertSize('Stickman assets', join(daemonDir, 'runtime', 'stickman-assets'), 16 * 1024 * 1024);
assertSize('Desktop package', packageRoot, 1600 * 1024 * 1024);
await assertFuseConfiguration();
verifyMacPackageMetadata();
@@ -626,40 +625,35 @@ function assertCodexRuntime() {
}
function assertStickmanRuntime() {
- const runtime = verifyStickmanRuntime(stickmanRuntimeDir, targetPlatform, targetArch);
const sourceManifest = verifyStickmanRuntime(
sourceStickmanRuntimeDir,
targetPlatform,
targetArch
);
const source = hashStickmanDirectory(sourceStickmanRuntimeDir);
- const packaged = hashStickmanDirectory(stickmanRuntimeDir);
- const firstDifferentPath = findFirstDifferentStickmanPath(source.files, packaged.files);
- if (firstDifferentPath !== undefined) {
- throw new Error(`Packaged Stickman Runtime file list differs from source at: ${firstDifferentPath}`);
- }
- const signedMacPackage = requiresDeveloperIdSignature();
- if (!signedMacPackage && source.hash !== packaged.hash) {
- throw new Error('Packaged Stickman Runtime contents differ from .pack/stickman-runtime');
- }
- if (
- runtime.remotionVersion !== sourceManifest.remotionVersion
- || runtime.chromiumVersion !== sourceManifest.chromiumVersion
- ) {
- throw new Error('Packaged Stickman Runtime versions differ from the source manifest');
- }
+ if (existsSync(stickmanRuntimeDir) || existsSync(join(daemonDir, 'node_modules', '@remotion')) || existsSync(join(daemonDir, 'node_modules', 'remotion'))) throw new Error('Optional Remotion rendering resources must not be embedded in the App');
+ const descriptorPath = join(desktopDir, '.pack', 'components', 'remotion-component.json');
+ const packagedDescriptorPath = join(daemonDir, 'runtime', 'remotion-component.json');
+ if (hashStickmanFile(descriptorPath) !== hashStickmanFile(packagedDescriptorPath)) throw new Error('Packaged Remotion component descriptor differs from this build');
+ const descriptor = JSON.parse(readFileSync(descriptorPath, 'utf8'));
+ if (JSON.stringify(manifest.remotionComponent) !== JSON.stringify(descriptor)) throw new Error('Desktop build manifest is not bound to the Remotion component');
+ const archivePath = join(desktopDir, '.pack', 'components', descriptor.fileName);
+ if (hashStickmanFile(archivePath) !== descriptor.archiveSha256 || statSync(archivePath).size !== descriptor.bytes || hashStickmanFile(join(sourceStickmanRuntimeDir, 'manifest.json')) !== descriptor.manifestSha256) throw new Error('Remotion component archive failed its release checksum');
+ const sourceAssets = hashStickmanDirectory(join(desktopDir, '.pack', 'stickman-assets'));
+ const packagedAssets = hashStickmanDirectory(join(daemonDir, 'runtime', 'stickman-assets'));
+ if (sourceAssets.hash !== packagedAssets.hash || sourceAssets.fileCount !== packagedAssets.fileCount) throw new Error('Packaged Stickman assets differ from this build');
if (typeof manifest.packageRoot !== 'string') return;
verifyStickmanBuildBinding(
manifest,
source,
- runtime,
+ sourceManifest,
hashStickmanFile(join(sourceStickmanRuntimeDir, 'manifest.json'))
);
}
function assertNoUnexpectedPythonRuntime() {
const marker = findPythonRuntimeMarker(
- [daemonDir, stickmanRuntimeDir],
+ [daemonDir],
normalizedAsarEntries()
);
if (marker !== undefined) {
@@ -922,7 +916,7 @@ function verifyDeveloperIdSignature() {
function verifyEmbeddedRuntimeSignatures() {
const embeddedBinaries = [];
- for (const root of [daemonDir, creatorRuntimeDir, stickmanRuntimeDir]) {
+ for (const root of [daemonDir, creatorRuntimeDir, sourceStickmanRuntimeDir]) {
walk(root, path => {
if (isMachOBinary(path)) embeddedBinaries.push(path);
});
diff --git a/apps/desktop/src/main/main.ts b/apps/desktop/src/main/main.ts
index 58375512..99fb58b4 100644
--- a/apps/desktop/src/main/main.ts
+++ b/apps/desktop/src/main/main.ts
@@ -138,9 +138,7 @@ async function launchDesktop(): Promise<void> {
? join(appRoot, '.pack', 'codex-runtime')
: join(process.resourcesPath, 'codex-runtime'));
const stickmanRuntimeRoot = process.env.OPENCREATOR_STICKMAN_RUNTIME_ROOT
- ?? (development
- ? join(appRoot, '.pack', 'stickman-runtime')
- : join(process.resourcesPath, 'stickman-runtime'));
+ ?? join(dataDir, 'creator-runtime', 'stickman');
logger.info('OpenCreator Desktop starting', {
development,
diff --git a/apps/desktop/test/release-assets.test.mjs b/apps/desktop/test/release-assets.test.mjs
index 8235b1cb..86b98970 100644
--- a/apps/desktop/test/release-assets.test.mjs
+++ b/apps/desktop/test/release-assets.test.mjs
@@ -8,6 +8,7 @@ import {
finalizeReleaseAssets,
krillinReleaseAssetNames,
releaseAssetNames,
+ remotionReleaseAssetName,
stageReleaseAssets
} from '../scripts/release-assets.mjs';
@@ -87,6 +88,10 @@ describe('Desktop release assets', () => {
for (const [platform, arch] of [['darwin', 'x64'], ['win32', 'x64']]) {
for (const name of releaseAssetNames(version, platform, arch)) writeFileSync(join(data.directory, name), name);
}
+ for (const [platform, arch] of [['darwin', 'arm64'], ['darwin', 'x64'], ['win32', 'x64']]) {
+ const name = remotionReleaseAssetName(version, platform, arch);
+ writeFileSync(join(data.directory, name), name);
+ }
for (const [platform, arch] of [
['darwin', 'arm64'],
['darwin', 'x64'],
@@ -104,8 +109,8 @@ describe('Desktop release assets', () => {
repository: 'krillinai/OpenCreator',
highlights: '## What\'s New\n\n- Added Creator workflows.'
});
- expect(readdirSync(data.directory)).toHaveLength(21);
- expect(readFileSync(join(data.directory, 'SHA256SUMS.txt'), 'utf8').trim().split('\n')).toHaveLength(20);
+ expect(readdirSync(data.directory)).toHaveLength(24);
+ expect(readFileSync(join(data.directory, 'SHA256SUMS.txt'), 'utf8').trim().split('\n')).toHaveLength(23);
expect(notes).toContain('https://github.com/krillinai/OpenCreator/releases/download/v3.0.0/OpenCreator-3.0.0-win-x64.exe');
expect(notes).toContain('KrillinAI-Server-3.0.0-linux-x64.tar.gz');
expect(notes).toContain('KrillinAI-CLI-3.0.0-mac-arm64.tar.gz');
@@ -141,6 +146,10 @@ describe('Desktop release assets', () => {
it('runs the release finalizer through the same CLI used by the promotion workflow', () => {
const data = fixture();
+ for (const [platform, arch] of [['darwin', 'arm64'], ['darwin', 'x64'], ['win32', 'x64']]) {
+ const name = remotionReleaseAssetName(version, platform, arch);
+ writeFileSync(join(data.directory, name), name);
+ }
for (const [platform, arch] of [['darwin', 'x64'], ['win32', 'x64']]) {
for (const name of releaseAssetNames(version, platform, arch)) {
writeFileSync(join(data.directory, name), name);
@@ -167,7 +176,7 @@ describe('Desktop release assets', () => {
], { encoding: 'utf8' });
expect(result.status, result.stderr).toBe(0);
- expect(result.stdout).toContain(`Verified 21 public release assets for v${version}`);
+ expect(result.stdout).toContain(`Verified 24 public release assets for v${version}`);
expect(readFileSync(notesPath, 'utf8')).toContain(`# OpenCreator v${version}`);
rmSync(notesPath);
});
diff --git a/apps/desktop/test/stickman-runtime-package.test.mjs b/apps/desktop/test/stickman-runtime-package.test.mjs
index d04a355c..f9e3efae 100644
--- a/apps/desktop/test/stickman-runtime-package.test.mjs
+++ b/apps/desktop/test/stickman-runtime-package.test.mjs
@@ -78,7 +78,7 @@ describe('Stickman Runtime package contract', () => {
)).toThrow(/exact Stickman Runtime/);
});
- it('keeps signed macOS package verification distinct from source hashes', () => {
+ it('verifies signatures and exact external component bindings without embedding Remotion', () => {
const source = readFileSync(
new URL('../scripts/verify-package.mjs', import.meta.url),
'utf8'
@@ -87,9 +87,11 @@ describe('Stickman Runtime package contract', () => {
expect(source).toContain("OPENCREATOR_REQUIRE_DEVELOPER_ID === '1'");
expect(source).toContain("manifest.macSigningMode === 'developer-id'");
expect(source).toContain('requiresDeveloperIdSignature()');
- expect(source).toContain('!signedMacPackage && source.hash !== packaged.hash');
+ expect(source).toContain('Optional Remotion rendering resources must not be embedded in the App');
+ expect(source).toContain('descriptor.archiveSha256');
+ expect(source).toContain('descriptor.manifestSha256');
expect(source).toContain(
- '[daemonDir, creatorRuntimeDir, stickmanRuntimeDir]'
+ '[daemonDir, creatorRuntimeDir, sourceStickmanRuntimeDir]'
);
});
});
diff --git a/apps/web/e2e/stickman-web-desktop-parity.spec.ts b/apps/web/e2e/stickman-web-desktop-parity.spec.ts
index d5da34e3..685793bf 100644
--- a/apps/web/e2e/stickman-web-desktop-parity.spec.ts
+++ b/apps/web/e2e/stickman-web-desktop-parity.spec.ts
@@ -114,6 +114,54 @@ test('Creator 设置页组件间距和下拉箭头在 Browser/Desktop 下保持
}
});
+test('自定义时长在 Browser/Desktop 下支持逐位输入并保持自定义模式', async ({ browser, runtime }, testInfo) => {
+ test.skip(testInfo.project.name !== 'chromium-desktop', '内部覆盖桌面和移动内容视口');
+ for (const viewport of viewports) {
+ for (const platform of ['browser', 'desktop'] as const) {
+ const fakeDaemon = new FakeStickmanDaemon(runtime.projectId);
+ const context = await browser.newContext({ viewport, locale: 'zh-CN' });
+ const page = await context.newPage();
+ await fakeDaemon.attach(page);
+ await page.route('**/.opencreator/runtime/creator/components/status', route => route.fulfill({
+ json: { platform: 'darwin', arch: 'arm64', selectedProvider: 'openai', selectedModel: null, components: [] }
+ }));
+ await installPlatformEnvironment(page, platform);
+ try {
+ await runtime.openApp(page, { currentProjectId: fakeDaemon.projectId });
+ await page.goto(`${runtime.origin}/#/workbench?tool=stickman-video&jobId=${fakeDaemon.jobId}`);
+ await page.locator('.stickman-steps button').first().click();
+ const duration = page.getByRole('combobox', { name: '目标时长' });
+ await duration.selectOption('custom');
+ const customDuration = page.getByRole('spinbutton', { name: '自定义时长(秒)' });
+ await expect(customDuration).toHaveValue('90');
+ await expect.poll(() => fakeDaemon.snapshot().state.targetDurationSeconds).toBe(90);
+ await customDuration.fill('');
+ await expect(customDuration).toHaveValue('');
+ await customDuration.pressSequentially('125', { delay: 30 });
+ await expect(customDuration).toHaveValue('125');
+ await expect.poll(() => fakeDaemon.snapshot().state.targetDurationSeconds).toBe(125);
+ for (const draft of ['', '9', '601']) {
+ await customDuration.fill(draft);
+ await expect(customDuration).toHaveValue(draft);
+ expect(fakeDaemon.snapshot().state.targetDurationSeconds).toBe(125);
+ await customDuration.press('Tab');
+ await expect(customDuration).toHaveValue('125');
+ }
+ await customDuration.fill('60');
+ await expect(customDuration).toHaveValue('60');
+ await expect(duration).toHaveValue('custom');
+ await expect.poll(() => fakeDaemon.snapshot().state.targetDurationSeconds).toBe(60);
+ await duration.selectOption('300');
+ await expect(customDuration).toHaveCount(0);
+ await expect.poll(() => fakeDaemon.snapshot().state.targetDurationSeconds).toBe(300);
+ expect(fakeDaemon.unknownRequestPaths()).toEqual([]);
+ } finally {
+ await context.close();
+ }
+ }
+ }
+});
+
test('最小桌面宽度下 Browser/Desktop 协作输入区在缩放和滚动后保持贴底', async ({
browser,
runtime
diff --git a/apps/web/e2e/video-translation-components.spec.ts b/apps/web/e2e/video-translation-components.spec.ts
index 3ff3aee4..ed052a96 100644
--- a/apps/web/e2e/video-translation-components.spec.ts
+++ b/apps/web/e2e/video-translation-components.spec.ts
@@ -34,12 +34,12 @@ test('本地转录提示可跳转下载、显示真实进度并返回原视频
Object.assign(status.components[0]!, { state: 'ready', version: '1.1.0', percent: 100 });
status.components[0]!.models[0]!.installed = true;
const component = page.locator('#component-whisperkit');
- const checkStatus = component.getByRole('button', { name: '检查状态' });
+ const checkStatus = component.getByRole('button', { name: '检查更新' });
await expect(checkStatus).toBeVisible();
await expect(component.locator('.settings-primary-button')).toHaveCount(0);
await expect(component.getByText('/runtime/dependencies')).toBeHidden();
await checkStatus.click();
- await expect(component.getByText('检查完成,本地组件已就绪。')).toBeVisible();
+ await expect(component.getByText('检查完成,当前组件无需更新。')).toBeVisible();
expect(downloadRequests).toBe(1);
await component.getByText('组件详情', { exact: true }).click();
await expect(component.getByText('/runtime/dependencies')).toBeVisible();
diff --git a/apps/web/e2e/web-desktop-parity.spec.ts b/apps/web/e2e/web-desktop-parity.spec.ts
index 0cd3fe95..ad077611 100644
--- a/apps/web/e2e/web-desktop-parity.spec.ts
+++ b/apps/web/e2e/web-desktop-parity.spec.ts
@@ -1,4 +1,4 @@
-import type { CreatorServicesCapabilitiesResponse, CreatorYtDlpStatusResponse } from '@opencreator/protocol';
+import type { CreatorRuntimeComponentsResponse, CreatorServicesCapabilitiesResponse, CreatorYtDlpStatusResponse } from '@opencreator/protocol';
import { test, expect } from './fixtures/runtime.js';
test('OSS 地域配置在 Browser/Desktop 下保存并重新加载一致', async ({ browser, runtime }, testInfo) => {
@@ -1839,6 +1839,7 @@ test('第三方组件设置在 Browser/Desktop Bridge 下保持相同状态、
text: string;
boxes: Record<string, { x: number; y: number; width: number; height: number }>;
requests: string[];
+ downloads: unknown[];
}> = [];
for (const platform of ['browser', 'desktop'] as const) {
@@ -1851,14 +1852,31 @@ test('第三方组件设置在 Browser/Desktop Bridge 下保持相同状态、
const page = await context.newPage();
if (platform === 'desktop') await installDesktopBridge(page);
const requests: string[] = [];
+ const downloads: unknown[] = [];
+ const components: CreatorRuntimeComponentsResponse = {
+ platform: 'darwin', arch: 'arm64', selectedProvider: 'bailian', selectedModel: null,
+ components: [{
+ id: 'remotion', name: 'Remotion', available: true, version: null, supportedVersion: '4.0.473',
+ installedAt: null, path: '/runtime/stickman', source: 'OpenCreator release · SHA-256 verified',
+ models: [], model: null, state: 'not_installed', item: null, downloadedBytes: 0,
+ totalBytes: null, percent: null, bytesPerSecond: null, remainingSeconds: null, error: null
+ }]
+ };
page.on('request', request => {
const url = new URL(request.url());
- if (!url.pathname.includes('/creator/yt-dlp/')) return;
+ if (!url.pathname.includes('/creator/yt-dlp/') && !url.pathname.includes('/creator/components/')) return;
requests.push(
`${request.method()} ${url.pathname.replace('/.opencreator/runtime', '')}`
);
});
- await page.route('**/.opencreator/runtime/creator/yt-dlp/status', route => route.fulfill({
+ await page.route('**/.opencreator/runtime/creator/components/status', route => route.fulfill({ json: components }));
+ await page.route('**/.opencreator/runtime/creator/components/download', route => {
+ downloads.push(route.request().postDataJSON());
+ components.components[0]!.state = 'ready';
+ components.components[0]!.version = components.components[0]!.supportedVersion;
+ return route.fulfill({ json: components });
+ });
+ await page.route('**/.opencreator/runtime/creator/yt-dlp/{status,check}', route => route.fulfill({
json: {
ytDlp: {
channel: 'nightly',
@@ -1882,10 +1900,31 @@ test('第三方组件设置在 Browser/Desktop Bridge 下保持相同状态、
const settings = page
.getByRole('region', { name: 'OpenCreator 工作区' })
.getByRole('main');
- const component = settings.locator('.runtime-component-item');
+ const component = settings.locator('.runtime-component-item').filter({ has: page.getByRole('heading', { name: 'yt-dlp nightly' }) });
+ const remotion = settings.locator('#component-remotion');
await expect(settings.getByRole('heading', { name: '第三方组件' })).toBeVisible();
await expect(component.getByRole('heading', { name: 'yt-dlp nightly' })).toBeVisible();
await expect(component).toContainText('用于解析和下载 YouTube、Bilibili 等公开视频资源。');
+ await expect(component).not.toContainText('正在检查');
+ await expect(remotion.getByRole('heading', { name: 'Remotion' })).toBeVisible();
+ await expect(remotion).not.toContainText('当前使用');
+ await expect(remotion.getByRole('link', { name: '调整转录设置' })).toHaveCount(0);
+ expect(downloads).toEqual([]);
+ await remotion.getByRole('button', { name: '下载组件' }).click();
+ await expect(remotion.getByRole('status')).toHaveText('已就绪');
+ await expect(remotion.locator('.settings-primary-button')).toHaveCount(0);
+ await remotion.getByRole('button', { name: '检查更新' }).click();
+ await expect(remotion.locator('.settings-primary-button')).toHaveCount(0);
+ expect(downloads).toEqual([{ componentId: 'remotion' }]);
+ components.components[0]!.supportedVersion = '4.0.474';
+ await remotion.getByRole('button', { name: '检查更新' }).click();
+ await expect(remotion.getByRole('button', { name: '更新到 4.0.474' })).toBeEnabled();
+ expect(downloads).toEqual([{ componentId: 'remotion' }]);
+ await remotion.getByRole('button', { name: '更新到 4.0.474' }).click();
+ await expect(remotion.locator('.settings-primary-button')).toHaveCount(0);
+ expect(downloads).toEqual([{ componentId: 'remotion' }, { componentId: 'remotion' }]);
+ expect(components.selectedProvider).toBe('bailian');
+ expect(components.selectedModel).toBeNull();
const boxes: Record<
string,
@@ -1893,6 +1932,8 @@ test('第三方组件设置在 Browser/Desktop Bridge 下保持相同状态、
> = {};
for (const [name, locator] of [
['settings', settings],
+ ['remotion', remotion],
+ ['remotion-check', remotion.getByRole('button', { name: '检查更新' })],
['component', component],
['check-button', component.getByRole('button', { name: '检查更新' })]
] as const) {
@@ -1908,7 +1949,8 @@ test('第三方组件设置在 Browser/Desktop Bridge 下保持相同状态、
results.push({
text: normalizeParityText(await settings.innerText()),
boxes,
- requests
+ requests,
+ downloads
});
} finally {
await context.close();
@@ -1917,9 +1959,12 @@ test('第三方组件设置在 Browser/Desktop Bridge 下保持相同状态、
expect(results[1]!.text).toBe(results[0]!.text);
expect(results[1]!.boxes).toEqual(results[0]!.boxes);
+ expect(results[1]!.downloads).toEqual(results[0]!.downloads);
expect(normalizeParityRequests(results[1]!.requests))
.toEqual(normalizeParityRequests(results[0]!.requests));
expect(results[0]!.requests).toContain('GET /creator/yt-dlp/status');
+ expect(results[0]!.requests).toContain('GET /creator/components/status');
+ expect(results[0]!.requests).toContain('POST /creator/components/download');
});
test('工作台模块新建 Creator Job,刷新和最近项目精确恢复历史且不启动普通 Codex Run', async ({ page, runtime }) => {
diff --git a/apps/web/package.json b/apps/web/package.json
index d60c2630..f564585a 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -4,7 +4,7 @@
"private": true,
"type": "module",
"scripts": {
- "predev": "pnpm --filter @opencreator/desktop prepare:creator-runtime && pnpm --filter @opencreator/desktop prepare:stickman-runtime && pnpm --filter @opencreator/desktop prepare:codex-runtime && pnpm --filter @opencreator/protocol build && pnpm --filter @opencreator/skill-market build && pnpm --filter @opencreator/writing-templates build",
+ "predev": "pnpm --filter @opencreator/desktop prepare:creator-runtime && pnpm --filter @opencreator/desktop prepare:codex-runtime && pnpm --filter @opencreator/protocol build && pnpm --filter @opencreator/skill-market build && pnpm --filter @opencreator/writing-templates build",
"dev": "vite --host 127.0.0.1",
"prebuild": "pnpm --filter @opencreator/protocol build && pnpm --filter @opencreator/skill-market build && pnpm --filter @opencreator/writing-templates build",
"build": "tsc -p tsconfig.json && vite build",
diff --git a/apps/web/src/app/routes.test.ts b/apps/web/src/app/routes.test.ts
index 5937a4e9..117f549e 100644
--- a/apps/web/src/app/routes.test.ts
+++ b/apps/web/src/app/routes.test.ts
@@ -2,6 +2,10 @@ import { describe, expect, it } from 'vitest';
import { formatRoute, parseRoute } from './routes.js';
describe('app routes', () => {
+ it('round-trips a Remotion component settings target', () => {
+ const route = { view: 'settings' as const, tab: 'local-components' as const, component: 'remotion' as const };
+ expect(parseRoute(formatRoute(route))).toEqual(route);
+ });
it('round-trips a component download target and a safe video-translation return route', () => {
const route = { view: 'settings' as const, tab: 'local-components' as const, component: 'whisperkit' as const, from: 'video-translation' as const, returnPath: '#/workbench?tool=video-translation&jobId=job_1' };
expect(parseRoute(formatRoute(route))).toEqual(route);
diff --git a/apps/web/src/app/routes.ts b/apps/web/src/app/routes.ts
index 983538d7..fb5c19ac 100644
--- a/apps/web/src/app/routes.ts
+++ b/apps/web/src/app/routes.ts
@@ -27,7 +27,7 @@ export type AppRoute =
view: 'settings';
tab?: SettingsRouteTab;
section?: AiServicesSection;
- component?: 'whisperkit' | 'whisper.cpp' | 'faster-whisper';
+ component?: 'whisperkit' | 'whisper.cpp' | 'faster-whisper' | 'remotion';
from?: 'video-translation';
returnPath?: string;
}
@@ -103,7 +103,7 @@ export function parseRoute(hash: string): AppRoute {
? { tab: 'ai-services' as const }
: {}),
...(section === undefined ? {} : { section }),
- ...(component === 'whisperkit' || component === 'whisper.cpp' || component === 'faster-whisper' ? { component } : {}),
+ ...(component === 'whisperkit' || component === 'whisper.cpp' || component === 'faster-whisper' || component === 'remotion' ? { component } : {}),
...(params.get('from') === 'video-translation' ? { from: 'video-translation' as const } : {}),
...(returnPath && /^#\/(?:workbench|dashboard)(?:\?|$)/.test(returnPath) && returnPath.length < 2000 ? { returnPath } : {})
};
diff --git a/apps/web/src/app/use-runtime-dependencies.ts b/apps/web/src/app/use-runtime-dependencies.ts
index 03c7158e..74fe911c 100644
--- a/apps/web/src/app/use-runtime-dependencies.ts
+++ b/apps/web/src/app/use-runtime-dependencies.ts
@@ -1,4 +1,4 @@
-import type { CreatorLocalComponent, CreatorRuntimeComponentsResponse, CreatorYtDlpStatus, OpenCreatorIssue } from '@opencreator/protocol';
+import type { CreatorRuntimeComponent, CreatorRuntimeComponentsResponse, CreatorYtDlpStatus, OpenCreatorIssue } from '@opencreator/protocol';
import { useCallback, useEffect, useRef, useState } from 'react';
import { usePageIssueState } from '../features/issues/page-issue-state.js';
import type { RuntimeDependencyService } from '../services/runtime-dependency-service.js';
@@ -13,7 +13,7 @@ export type RuntimeDependenciesController = {
componentsStatus?: CreatorRuntimeComponentsResponse;
componentError?: string;
refreshComponents?(): Promise<void>;
- downloadComponents?(componentId?: CreatorLocalComponent['id']): Promise<void>;
+ downloadComponents?(componentId?: CreatorRuntimeComponent['id']): Promise<void>;
ytDlpStatus?: CreatorYtDlpStatus;
phase: RuntimeDependencyPhase;
/** @deprecated Runtime failures are exposed through issues. */
@@ -60,7 +60,7 @@ export function useRuntimeDependencies(input: {
return () => { stopped = true; clearTimeout(timer); };
}, [input.connected, refreshComponents, componentDownloadActive]);
- const downloadComponents = useCallback(async (componentId?: CreatorLocalComponent['id']) => {
+ const downloadComponents = useCallback(async (componentId?: CreatorRuntimeComponent['id']) => {
if (!input.connected || !input.service?.downloadComponents) return;
try {
const status = await input.service.downloadComponents(componentId);
diff --git a/apps/web/src/features/dashboard/LocalTranscriptionNotice.tsx b/apps/web/src/features/dashboard/LocalTranscriptionNotice.tsx
index 3daaef37..72b561e8 100644
--- a/apps/web/src/features/dashboard/LocalTranscriptionNotice.tsx
+++ b/apps/web/src/features/dashboard/LocalTranscriptionNotice.tsx
@@ -1,7 +1,7 @@
import { useEffect } from 'react';
import type { RuntimeDependenciesController } from '../../app/use-runtime-dependencies.js';
import { useLocalizedCopy } from '../../i18n/useLocalizedCopy.js';
-import { componentProgressText } from '../settings/LocalTranscriptionComponents.js';
+import { componentProgressText } from '../settings/RuntimeManagedComponents.js';
import { OriginalErrorDetails } from '../issues/OriginalErrorDetails.js';
export function LocalTranscriptionNotice({ controller, platformCaptions, importedSubtitle, beforeNavigate }: {
diff --git a/apps/web/src/features/dashboard/StickmanVideoWorkspace.test.tsx b/apps/web/src/features/dashboard/StickmanVideoWorkspace.test.tsx
index 5058f5de..de02e4b9 100644
--- a/apps/web/src/features/dashboard/StickmanVideoWorkspace.test.tsx
+++ b/apps/web/src/features/dashboard/StickmanVideoWorkspace.test.tsx
@@ -1,14 +1,15 @@
import { act, fireEvent, render, screen, waitFor, within } from '@testing-library/react';
-import type { ComponentProps } from 'react';
+import type { ComponentProps, ReactNode } from 'react';
import {
createDefaultCreatorServicesConfig,
+ readCreatorResultSnapshots,
type CreatorArtifact,
type CreatorJob,
type CreatorStageRun
} from '@opencreator/protocol';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { LanguageProvider } from '../../i18n/LanguageProvider.js';
-import { CreatorSessionProvider } from './creator-session-store.js';
+import { CreatorSessionProvider, useCreatorSession } from './creator-session-store.js';
import StickmanVideoWorkspace from './StickmanVideoWorkspace.js';
beforeEach(() => {
@@ -82,10 +83,66 @@ describe('StickmanVideoWorkspace', () => {
fireEvent.change(duration, { target: { value: 'custom' } });
const custom = screen.getByRole('spinbutton', { name: '自定义时长(秒)' });
expect(custom).toHaveValue(90);
+ fireEvent.change(custom, { target: { value: '' } });
+ expect(custom).toHaveValue(null);
+ fireEvent.change(custom, { target: { value: '1' } });
+ expect(custom).toHaveValue(1);
+ fireEvent.change(custom, { target: { value: '12' } });
+ expect(custom).toHaveValue(12);
fireEvent.change(custom, { target: { value: '125' } });
expect(custom).toHaveValue(125);
});
+ it.each([30, 60, 300, 600])('keeps custom input visible when the typed duration matches the %s-second preset', durationSeconds => {
+ renderWorkspace(job());
+ const duration = screen.getByRole('combobox', { name: '目标时长' });
+ fireEvent.change(duration, { target: { value: 'custom' } });
+ const custom = screen.getByRole('spinbutton', { name: '自定义时长(秒)' });
+ fireEvent.change(custom, { target: { value: String(durationSeconds) } });
+ fireEvent.blur(custom);
+ expect(duration).toHaveValue('custom');
+ expect(custom).toHaveValue(durationSeconds);
+ expect(custom).toBeInTheDocument();
+ fireEvent.change(duration, { target: { value: '300' } });
+ expect(duration).toHaveValue('300');
+ expect(screen.queryByRole('spinbutton', { name: '自定义时长(秒)' })).not.toBeInTheDocument();
+ });
+
+ it.each(['', '9', '601'])('allows the temporary draft "%s" and restores the last valid duration on blur', draft => {
+ renderWorkspace(job({ state: { targetDurationSeconds: 125 } }));
+ const custom = screen.getByRole('spinbutton', { name: '自定义时长(秒)' });
+ fireEvent.change(custom, { target: { value: draft } });
+ expect(custom).toHaveValue(draft === '' ? null : Number(draft));
+ fireEvent.blur(custom);
+ expect(custom).toHaveValue(125);
+ expect(screen.getByRole('combobox', { name: '目标时长' })).toHaveValue('custom');
+ });
+
+ it('persists a manually typed duration as a number without saving incomplete input', async () => {
+ let persisted = job();
+ const applyAction = vi.fn(async (_jobId: string, request: Record<string, unknown>) => {
+ const input = request.input as { patch?: Record<string, number> };
+ persisted = { ...persisted, revision: persisted.revision + 1, state: { ...persisted.state, ...input.patch } };
+ return {
+ job: persisted,
+ receipt: { actor: 'user' as const, action: String(request.action), summary: '', affectedArtifacts: [], newRevision: persisted.revision, createdAt: persisted.updatedAt }
+ };
+ });
+ renderWorkspace(persisted, new Map(), applyAction);
+ fireEvent.change(screen.getByRole('combobox', { name: '目标时长' }), { target: { value: 'custom' } });
+ const custom = screen.getByRole('spinbutton', { name: '自定义时长(秒)' });
+ for (const value of ['', '1', '12', '125']) fireEvent.change(custom, { target: { value } });
+ await waitFor(() => expect(persisted.state.targetDurationSeconds).toBe(125));
+ expect(custom).toHaveValue(125);
+ const durationPatches = applyAction.mock.calls.flatMap(([, request]) => {
+ const input = request.input as { patch?: Record<string, unknown> };
+ return input.patch?.targetDurationSeconds === undefined ? [] : [input.patch.targetDurationSeconds];
+ });
+ expect(durationPatches).toContain(125);
+ expect(durationPatches).not.toContain(1);
+ expect(durationPatches).not.toContain('');
+ });
+
it('inherits the shared TTS configuration and persists the selected voice fields', async () => {
const initialJob = job();
const applyAction = vi.fn(async (_jobId: string, request: Record<string, unknown>) => ({
@@ -560,6 +617,61 @@ describe('StickmanVideoWorkspace', () => {
expect(screen.getByRole('button', { name: '下一步' })).toBeDisabled();
});
+ it('stops the storyboard spinner on failure and retries only the storyboard', async () => {
+ const persisted = audioReadyJob();
+ const failedStage = {
+ ...stage('storyboard', 'failed'),
+ errorCode: 'creator_storyboard_validation_failed',
+ errorMessage: '分镜在 3 次整稿生成后仍未通过校验:画面描述缺少语义锚点'
+ };
+ const failedJob: CreatorJob = {
+ ...persisted.job,
+ status: 'failed',
+ stages: [...persisted.job.stages, failedStage],
+ state: { ...persisted.job.state, workflowTarget: 'visuals_ready', currentStage: 'storyboard' }
+ };
+ const retryJob: CreatorJob = {
+ ...failedJob,
+ status: 'running',
+ revision: failedJob.revision + 1,
+ stages: [...failedJob.stages, { ...stage('storyboard', 'queued'), id: 'storyboard-retry' }]
+ };
+ const applyAction = vi.fn(async (_jobId: string, request: Record<string, unknown>) => ({
+ job: retryJob,
+ receipt: {
+ actor: 'user' as const,
+ action: String(request.action),
+ summary: String(request.action),
+ affectedArtifacts: [],
+ newRevision: retryJob.revision,
+ createdAt: retryJob.updatedAt
+ }
+ }));
+ const { container } = renderWorkspace(failedJob, persisted.contents, applyAction);
+
+ expect(await screen.findByRole('heading', { name: '分镜与画面' })).toBeInTheDocument();
+ const placeholder = container.querySelector('.stickman-storyboard-placeholder') as HTMLElement;
+ expect(placeholder).toHaveAttribute('aria-busy', 'false');
+ expect(placeholder).toHaveAttribute('data-state', 'failed');
+ expect(within(placeholder).getByRole('alert')).toHaveTextContent(failedStage.errorMessage);
+ expect(placeholder.querySelector('.creator-collaboration-spin')).toBeNull();
+ expect(placeholder.querySelector('.stickman-storyboard-loading-row')).toBeNull();
+ expect(screen.getByRole('button', { name: '下一步' })).toBeDisabled();
+ fireEvent.click(screen.getByRole('button', { name: '重试分镜' }));
+
+ await waitFor(() => expect(applyAction).toHaveBeenCalledWith(
+ failedJob.id,
+ expect.objectContaining({ action: 'retry-stage', input: { stageId: 'storyboard' } })
+ ));
+ expect(applyAction).toHaveBeenCalledTimes(1);
+ await waitFor(() => expect(placeholder).toHaveAttribute('aria-busy', 'true'));
+ expect(placeholder).toHaveAttribute('data-state', 'loading');
+ expect(within(placeholder).queryByRole('alert')).not.toBeInTheDocument();
+ expect(within(placeholder).queryByRole('button', { name: '重试分镜' })).not.toBeInTheDocument();
+ expect(placeholder.querySelector('.creator-collaboration-spin')).not.toBeNull();
+ expect(await within(placeholder).findByText('正在规划 1 个镜头的画面描述')).toBeInTheDocument();
+ });
+
it('retries only audio timing after a measurement failure without discarding narration', async () => {
const persisted = audioReadyJob();
const failedTiming = stage('audio-timing', 'failed');
@@ -629,6 +741,144 @@ describe('StickmanVideoWorkspace', () => {
expect(screen.queryByRole('button', { name: '完成' })).not.toBeInTheDocument();
});
+ it('preserves the video and playback position when task snapshots and session callbacks change', async () => {
+ const persisted = completedJob();
+ const openArtifact = vi.fn(async (_jobId: string, artifactId: string) => {
+ const content = persisted.contents.get(artifactId);
+ return content === undefined
+ ? new Response(new Blob(['video']))
+ : new Response(JSON.stringify(content), { headers: { 'Content-Type': 'application/json' } });
+ });
+ const view = renderWorkspace(persisted.job, persisted.contents, undefined, null, {
+ openArtifact,
+ children: <PreviewRefreshControl />
+ });
+ const video = await screen.findByLabelText<HTMLVideoElement>('火柴人动画预览');
+ const source = video.src;
+ video.currentTime = 2;
+
+ for (let update = 0; update < 3; update += 1) {
+ fireEvent.click(screen.getByRole('button', { name: '刷新任务' }));
+ view.rerenderWorkspace();
+ await act(async () => undefined);
+ expect(screen.getByLabelText('火柴人动画预览')).toBe(video);
+ expect(video.src).toBe(source);
+ expect(video.currentTime).toBe(2);
+ }
+
+ for (const artifactId of ['script', 'audio-timing', 'shots', 'manifest', 'clean']) {
+ expect(openArtifact.mock.calls.filter(([, openedId]) => openedId === artifactId)).toHaveLength(1);
+ }
+ expect(URL.createObjectURL).toHaveBeenCalledTimes(1);
+ expect(URL.revokeObjectURL).not.toHaveBeenCalled();
+ view.unmount();
+ expect(URL.revokeObjectURL).toHaveBeenCalledExactlyOnceWith(source);
+ });
+
+ it('preserves narration playback when session callbacks change', async () => {
+ const persisted = audioReadyJob();
+ const openArtifact = vi.fn(async (_jobId: string, artifactId: string) => (
+ new Response(persisted.contents.has(artifactId)
+ ? JSON.stringify(persisted.contents.get(artifactId))
+ : new Blob(['narration']))
+ ));
+ const view = renderWorkspace(persisted.job, persisted.contents, undefined, null, { openArtifact });
+ await waitFor(() => expect(view.container.querySelector('.stickman-audio-control audio'))
+ .toHaveAttribute('src', 'blob:stickman-artifact'));
+ const audio = view.container.querySelector<HTMLAudioElement>('.stickman-audio-control audio')!;
+ audio.currentTime = 1;
+
+ view.rerenderWorkspace();
+ await act(async () => undefined);
+
+ expect(view.container.querySelector('.stickman-audio-control audio')).toBe(audio);
+ expect(audio.currentTime).toBe(1);
+ expect(openArtifact.mock.calls.filter(([, artifactId]) => artifactId === 'narration-01')).toHaveLength(1);
+ expect(URL.revokeObjectURL).not.toHaveBeenCalled();
+ });
+
+ it('uses the latest artifact transport only when the selected video version changes', async () => {
+ const persisted = versionedDeliveryJob();
+ const initialTransport = vi.fn(async (_jobId: string, artifactId: string) => (
+ new Response(persisted.contents.has(artifactId)
+ ? JSON.stringify(persisted.contents.get(artifactId))
+ : new Blob(['initial video']))
+ ));
+ const latestTransport = vi.fn(async () => new Response(new Blob(['latest video'])));
+ let objectUrlCount = 0;
+ vi.mocked(URL.createObjectURL).mockImplementation(() => `blob:stickman-version-${++objectUrlCount}`);
+ const view = renderWorkspace(persisted.job, persisted.contents, persisted.applyAction, null, {
+ openArtifact: initialTransport
+ });
+ const video = await screen.findByLabelText<HTMLVideoElement>('火柴人动画预览');
+ const source = video.src;
+
+ view.rerenderWorkspace({ openArtifact: latestTransport });
+ await act(async () => undefined);
+ expect(latestTransport).not.toHaveBeenCalled();
+ expect(screen.getByLabelText('火柴人动画预览')).toBe(video);
+ expect(URL.revokeObjectURL).not.toHaveBeenCalled();
+
+ fireEvent.click(screen.getByRole('button', { name: '项目 V2' }));
+ fireEvent.click(screen.getByRole('menuitem', { name: /项目 V1/ }));
+ await waitFor(() => expect(latestTransport).toHaveBeenCalledWith(persisted.job.id, 'clean'));
+ await waitFor(() => expect(screen.getByLabelText('火柴人动画预览')).not.toHaveAttribute('src', source));
+ expect(latestTransport).toHaveBeenCalledTimes(1);
+ expect(URL.revokeObjectURL).toHaveBeenCalledExactlyOnceWith(source);
+ });
+
+ it('discards and releases a preview that completes after selecting another video version', async () => {
+ const persisted = versionedDeliveryJob();
+ let resolvePreview!: (response: Response) => void;
+ const pendingPreview = new Promise<Response>(resolve => { resolvePreview = resolve; });
+ const openArtifact = vi.fn(async (_jobId: string, artifactId: string) => (
+ artifactId === 'clean-v2'
+ ? pendingPreview
+ : new Response(persisted.contents.has(artifactId)
+ ? JSON.stringify(persisted.contents.get(artifactId))
+ : new Blob(['current video']))
+ ));
+ let objectUrlCount = 0;
+ vi.mocked(URL.createObjectURL).mockImplementation(() => `blob:stickman-version-${++objectUrlCount}`);
+ const view = renderWorkspace(persisted.job, persisted.contents, persisted.applyAction, null, { openArtifact });
+ await waitFor(() => expect(openArtifact).toHaveBeenCalledWith(persisted.job.id, 'clean-v2'));
+ fireEvent.click(screen.getByRole('button', { name: '项目 V2' }));
+ fireEvent.click(screen.getByRole('menuitem', { name: /项目 V1/ }));
+ const video = await screen.findByLabelText<HTMLVideoElement>('火柴人动画预览');
+ const source = video.src;
+
+ await act(async () => { resolvePreview(new Response(new Blob(['outdated video']))); });
+
+ expect(screen.getByLabelText('火柴人动画预览')).toBe(video);
+ expect(video.src).toBe(source);
+ const outdatedSource = vi.mocked(URL.createObjectURL).mock.results.at(-1)!.value;
+ expect(URL.revokeObjectURL).toHaveBeenCalledExactlyOnceWith(outdatedSource);
+ view.unmount();
+ expect(URL.revokeObjectURL).toHaveBeenCalledWith(source);
+ expect(URL.revokeObjectURL).toHaveBeenCalledTimes(2);
+ });
+
+ it('releases a pending video preview after the workspace is unmounted', async () => {
+ const persisted = completedJob();
+ let resolvePreview!: (response: Response) => void;
+ const pendingPreview = new Promise<Response>(resolve => { resolvePreview = resolve; });
+ const openArtifact = vi.fn(async (_jobId: string, artifactId: string) => (
+ artifactId === 'clean'
+ ? pendingPreview
+ : new Response(JSON.stringify(persisted.contents.get(artifactId)))
+ ));
+ const view = renderWorkspace(persisted.job, persisted.contents, undefined, null, { openArtifact });
+ await waitFor(() => expect(openArtifact).toHaveBeenCalledWith(persisted.job.id, 'clean'));
+ view.unmount();
+
+ await act(async () => { resolvePreview(new Response(new Blob(['video']))); });
+
+ expect(URL.createObjectURL).toHaveBeenCalledTimes(1);
+ expect(URL.revokeObjectURL).toHaveBeenCalledExactlyOnceWith(
+ vi.mocked(URL.createObjectURL).mock.results[0]!.value
+ );
+ });
+
it('scrolls only storyboard content and keeps back and next actions visible', async () => {
const persisted = completedJob({ withSnapshot: false });
const applyAction = vi.fn(async (_jobId: string, request: Record<string, unknown>) => ({
@@ -947,21 +1197,27 @@ function renderWorkspace(
createdAt: initialJob.updatedAt
}
})),
- creatorServicesService: ComponentProps<typeof StickmanVideoWorkspace>['creatorServicesService'] = null
+ creatorServicesService: ComponentProps<typeof StickmanVideoWorkspace>['creatorServicesService'] = null,
+ options: {
+ openArtifact?: (jobId: string, artifactId: string) => Promise<Response>;
+ children?: ReactNode;
+ } = {}
) {
- return render(
+ const defaultOpenArtifact = vi.fn(async (_jobId: string, artifactId: string) => {
+ const value = contents.get(artifactId);
+ return value === undefined
+ ? new Response(new Blob(['media'], { type: 'application/octet-stream' }))
+ : new Response(JSON.stringify(value), { headers: { 'Content-Type': 'application/json' } });
+ });
+ const workspace = (previewOptions: typeof options) => (
<LanguageProvider initialPreference="zh-CN">
<CreatorSessionProvider
initialJob={initialJob}
+ onPreJobFailure={() => undefined}
service={{
applyAction,
runAgentTurn: vi.fn(),
- openArtifact: vi.fn(async (_jobId: string, artifactId: string) => {
- const value = contents.get(artifactId);
- return value === undefined
- ? new Response(new Blob(['media'], { type: 'application/octet-stream' }))
- : new Response(JSON.stringify(value), { headers: { 'Content-Type': 'application/json' } });
- })
+ openArtifact: previewOptions.openArtifact ?? defaultOpenArtifact
} as never}
>
<StickmanVideoWorkspace
@@ -972,9 +1228,60 @@ function renderWorkspace(
} as never}
onBack={vi.fn()}
/>
+ {previewOptions.children}
</CreatorSessionProvider>
</LanguageProvider>
);
+ const view = render(workspace(options));
+ let previewOptions = options;
+ return {
+ ...view,
+ rerenderWorkspace(patch: typeof options = {}) {
+ previewOptions = { ...previewOptions, ...patch };
+ view.rerender(workspace(previewOptions));
+ }
+ };
+}
+
+function PreviewRefreshControl() {
+ const session = useCreatorSession();
+ return <button type="button" onClick={() => session.applyRemoteSnapshot({
+ ...session.job,
+ revision: session.job.revision + 1,
+ artifacts: session.job.artifacts.map(artifact => ({ ...artifact })),
+ state: { ...session.state }
+ })}>刷新任务</button>;
+}
+
+function versionedDeliveryJob() {
+ const persisted = completedJob();
+ const original = readCreatorResultSnapshots(persisted.job.state.resultSnapshots)[0]!;
+ const video = { ...artifact('clean-v2', 'clean_video'), version: 2 };
+ const currentJob: CreatorJob = {
+ ...persisted.job,
+ artifacts: [...persisted.job.artifacts, video],
+ state: {
+ ...persisted.job.state,
+ resultVersion: 2,
+ resultSnapshots: [original, {
+ ...original,
+ version: 2,
+ artifactRefs: { ...original.artifactRefs, clean_video: [video.id] }
+ }]
+ }
+ };
+ const applyAction = vi.fn(async (_jobId: string, request: Record<string, unknown>) => ({
+ job: { ...currentJob, state: { ...currentJob.state, resultVersion: (request.input as { version: number }).version } },
+ receipt: {
+ actor: 'user' as const,
+ action: String(request.action),
+ summary: String(request.action),
+ affectedArtifacts: [],
+ newRevision: currentJob.revision,
+ createdAt: currentJob.updatedAt
+ }
+ }));
+ return { ...persisted, job: currentJob, applyAction };
}
function configuredTtsService() {
diff --git a/apps/web/src/features/dashboard/StickmanVideoWorkspace.tsx b/apps/web/src/features/dashboard/StickmanVideoWorkspace.tsx
index f4d1fd0c..9729d178 100644
--- a/apps/web/src/features/dashboard/StickmanVideoWorkspace.tsx
+++ b/apps/web/src/features/dashboard/StickmanVideoWorkspace.tsx
@@ -859,6 +859,7 @@ export default function StickmanVideoWorkspace(props: {
onSave={saveShot}
onRegenerate={shotId => void regenerateShot(shotId)}
onGenerateMissing={() => void generateMissingShots()}
+ onRetry={() => void apply('retry-stage', { stageId: 'storyboard' })}
onBack={() => setActiveStep(2)}
onNext={() => void continueFromVisuals()}
/>
@@ -924,6 +925,20 @@ function SourceAndCharacterStep(props: {
onStart(): void;
onContinue(): void;
}) {
+ const [durationInput, setDurationInput] = useState({
+ value: props.targetDurationSeconds,
+ preset: targetDurationPreset(props.targetDurationSeconds),
+ draft: String(props.targetDurationSeconds)
+ });
+
+ useEffect(() => {
+ setDurationInput(previous => previous.value === props.targetDurationSeconds ? previous : {
+ value: props.targetDurationSeconds,
+ preset: targetDurationPreset(props.targetDurationSeconds),
+ draft: String(props.targetDurationSeconds)
+ });
+ }, [props.targetDurationSeconds]);
+
return (
<div className="creator-tool-panel stickman-story-panel">
<header className="creator-tool-panel-heading"><span><Sparkles size={18} /></span><div><h2>{props.l('来源与角色', 'Source and character')}</h2><p>{props.l('选择创作来源与固定角色。', 'Choose a source and a fixed character.')}</p></div></header>
@@ -964,12 +979,13 @@ function SourceAndCharacterStep(props: {
<div className="stickman-duration-control">
<NativeSelect
aria-labelledby="stickman-target-duration-label"
- value={targetDurationPreset(props.targetDurationSeconds)}
- onChange={event => props.onPatch({
- targetDurationSeconds: event.target.value === 'custom'
- ? 90
- : Number(event.target.value)
- })}
+ value={durationInput.preset}
+ onChange={event => {
+ const preset = event.target.value;
+ const value = preset === 'custom' ? 90 : Number(preset);
+ setDurationInput({ value, preset, draft: String(value) });
+ props.onPatch({ targetDurationSeconds: value });
+ }}
>
<option value="30">{props.l('30 秒', '30 seconds')}</option>
<option value="60">{props.l('1 分钟', '1 minute')}</option>
@@ -977,20 +993,24 @@ function SourceAndCharacterStep(props: {
<option value="600">{props.l('10 分钟', '10 minutes')}</option>
<option value="custom">{props.l('自定义', 'Custom')}</option>
</NativeSelect>
- {targetDurationPreset(props.targetDurationSeconds) === 'custom' ? (
+ {durationInput.preset === 'custom' ? (
<span className="stickman-custom-duration">
<input
type="number"
min={10}
max={600}
- value={props.targetDurationSeconds}
+ value={durationInput.draft}
aria-label={props.l('自定义时长(秒)', 'Custom duration in seconds')}
onChange={event => {
- const value = Number(event.target.value);
- if (Number.isFinite(value) && value >= 10 && value <= 600) {
+ const draft = event.target.value;
+ const value = Number(draft);
+ const valid = draft !== '' && Number.isFinite(value) && value >= 10 && value <= 600;
+ setDurationInput({ value: valid ? value : props.targetDurationSeconds, preset: 'custom', draft });
+ if (valid) {
props.onPatch({ targetDurationSeconds: value });
}
}}
+ onBlur={() => setDurationInput(previous => ({ ...previous, draft: String(props.targetDurationSeconds) }))}
/>
<small>{props.l('秒', 'sec')}</small>
</span>
@@ -1639,6 +1659,7 @@ function StoryboardStep(props: {
onSave(shotId: string, visualDescription: string, motion: string): Promise<void>;
onRegenerate(shotId: string): void;
onGenerateMissing(): void;
+ onRetry(): void;
onBack(): void;
onNext(): void;
}) {
@@ -1646,9 +1667,12 @@ function StoryboardStep(props: {
return (
<div className="stickman-storyboard-step">
<StoryboardPlaceholderPanel
+ stage={latestStage(props.jobStages, 'storyboard')}
script={props.script}
timing={props.timing}
+ busy={props.busy}
l={props.l}
+ onRetry={props.onRetry}
/>
<WizardActions
canContinue={false}
@@ -1858,10 +1882,14 @@ function StoryboardShotRow(props: {
}
function StoryboardPlaceholderPanel(props: {
+ stage?: CreatorStageRun;
script?: ScriptManifest;
timing?: AudioTiming;
+ busy: boolean;
l: ReturnType<typeof useLocalizedCopy>;
+ onRetry(): void;
}) {
+ const failed = props.stage?.status === 'failed';
const timingBySegment = new Map(
props.timing?.segments.map(segment => [segment.segmentId, segment]) ?? []
);
@@ -1882,14 +1910,17 @@ function StoryboardPlaceholderPanel(props: {
return (
<div
className="creator-tool-panel stickman-storyboard-review stickman-storyboard-placeholder"
- aria-busy="true"
+ data-state={failed ? 'failed' : 'loading'}
+ aria-busy={!failed}
>
<header className="creator-tool-panel-heading">
<span><ImageIcon size={18} /></span>
<div>
<h2>{props.l('分镜与画面', 'Storyboard and visuals')}</h2>
<p role="status">
- {segments.length > 0
+ {failed
+ ? props.l('分镜生成失败,图片生成尚未开始', 'Storyboard generation failed. Image generation has not started.')
+ : segments.length > 0
? props.l(
`正在规划 ${segments.length} 个镜头的画面描述`,
`Planning visual descriptions for ${segments.length} shots`
@@ -1897,53 +1928,70 @@ function StoryboardPlaceholderPanel(props: {
: props.l('正在读取旁白并规划分镜', 'Reading narration and planning the storyboard')}
</p>
</div>
- <LoaderCircle className="creator-collaboration-spin" size={17} aria-hidden="true" />
+ {!failed ? <LoaderCircle className="creator-collaboration-spin" size={17} aria-hidden="true" /> : null}
</header>
- <div className="stickman-storyboard-editor">
- {rows.map((row, index) => (
- <article
- className="stickman-storyboard-row stickman-storyboard-loading-row"
- data-status="planning"
- key={row.id}
+ {failed ? (
+ <div className="stickman-storyboard-editor">
+ <p className="creator-tool-notice" role="alert">
+ {props.stage?.errorMessage ?? props.l('分镜生成未完成,请重试。', 'Storyboard generation did not complete. Try again.')}
+ </p>
+ <button
+ className="video-translation-secondary-action"
+ type="button"
+ disabled={props.busy}
+ onClick={props.onRetry}
>
- <div className="stickman-storyboard-meta">
- <strong>{String(index + 1).padStart(2, '0')}</strong>
- <small>
- {row.durationSeconds === undefined ? '--' : formatSeconds(row.durationSeconds)}
- </small>
- </div>
- <div className="stickman-storyboard-media">
- <div className="stickman-storyboard-image stickman-storyboard-placeholder-image">
- <div className="stickman-storyboard-placeholder-image-status">
- <LoaderCircle className="creator-collaboration-spin" size={17} aria-hidden="true" />
- <small>{props.l('准备画面', 'Preparing visual')}</small>
- </div>
- </div>
- </div>
- <div className="stickman-storyboard-copy">
- <strong>{props.l('画面描述', 'Visual description')}</strong>
- <div
- className="stickman-storyboard-description-skeleton"
- aria-label={props.l('正在生成画面描述', 'Generating visual description')}
- >
- <i />
- <i className="is-medium" />
+ <RefreshCw size={15} aria-hidden="true" />
+ {props.l('重试分镜', 'Retry storyboard')}
+ </button>
+ </div>
+ ) : (
+ <div className="stickman-storyboard-editor">
+ {rows.map((row, index) => (
+ <article
+ className="stickman-storyboard-row stickman-storyboard-loading-row"
+ data-status="planning"
+ key={row.id}
+ >
+ <div className="stickman-storyboard-meta">
+ <strong>{String(index + 1).padStart(2, '0')}</strong>
+ <small>
+ {row.durationSeconds === undefined ? '--' : formatSeconds(row.durationSeconds)}
+ </small>
</div>
- {row.narration !== '' ? (
- <div className="stickman-storyboard-narration">
- <span>{props.l('旁白', 'Narration')}</span>
- <p>{row.narration}</p>
+ <div className="stickman-storyboard-media">
+ <div className="stickman-storyboard-image stickman-storyboard-placeholder-image">
+ <div className="stickman-storyboard-placeholder-image-status">
+ <LoaderCircle className="creator-collaboration-spin" size={17} aria-hidden="true" />
+ <small>{props.l('准备画面', 'Preparing visual')}</small>
+ </div>
</div>
- ) : (
- <div className="stickman-storyboard-narration-skeleton" aria-hidden="true">
+ </div>
+ <div className="stickman-storyboard-copy">
+ <strong>{props.l('画面描述', 'Visual description')}</strong>
+ <div
+ className="stickman-storyboard-description-skeleton"
+ aria-label={props.l('正在生成画面描述', 'Generating visual description')}
+ >
<i />
- <i className="is-short" />
+ <i className="is-medium" />
</div>
- )}
- </div>
- </article>
- ))}
- </div>
+ {row.narration !== '' ? (
+ <div className="stickman-storyboard-narration">
+ <span>{props.l('旁白', 'Narration')}</span>
+ <p>{row.narration}</p>
+ </div>
+ ) : (
+ <div className="stickman-storyboard-narration-skeleton" aria-hidden="true">
+ <i />
+ <i className="is-short" />
+ </div>
+ )}
+ </div>
+ </article>
+ ))}
+ </div>
+ )}
</div>
);
}
@@ -2167,7 +2215,7 @@ function ResultStep(props: {
<div className="stickman-delivery-content">
<section className="stickman-delivery-preview" aria-label={props.l('成片预览', 'Video preview')}>
{props.videoUrl
- ? <video controls preload="metadata" src={props.videoUrl} />
+ ? <video controls preload="metadata" aria-label={props.l('火柴人动画预览', 'Stickman video preview')} src={props.videoUrl} />
: <div><FileVideo size={28} /><span>{props.l('成片暂时无法预览', 'The video preview is unavailable.')}</span></div>}
</section>
<section className="stickman-delivery-files">
@@ -2215,16 +2263,19 @@ function PendingPanel(props: { icon: typeof FileText; label: string }) {
function useArtifactJson<T>(artifactId?: string): T | undefined {
const session = useCreatorSession();
- const [loaded, setLoaded] = useState<{ artifactId: string; value: T }>();
+ const sessionRef = useRef(session);
+ sessionRef.current = session;
+ const jobId = session.job.id;
+ const [loaded, setLoaded] = useState<{ jobId: string; artifactId: string; value: T }>();
useEffect(() => {
let canceled = false;
if (artifactId === undefined) return () => { canceled = true; };
- void session.openArtifactJson<T>(artifactId).then(next => {
- if (!canceled) setLoaded({ artifactId, value: next });
+ void sessionRef.current.openArtifactJson<T>(artifactId).then(next => {
+ if (!canceled) setLoaded({ jobId, artifactId, value: next });
}).catch(() => undefined);
return () => { canceled = true; };
- }, [artifactId, session.openArtifactJson]);
- return loaded !== undefined && loaded.artifactId === artifactId
+ }, [artifactId, jobId]);
+ return loaded !== undefined && loaded.jobId === jobId && loaded.artifactId === artifactId
? loaded.value
: undefined;
}
@@ -2267,24 +2318,32 @@ function readScriptManifest(value: unknown): ScriptManifest | undefined {
function useArtifactUrl(artifactId?: string): string {
const session = useCreatorSession();
- const [url, setUrl] = useState('');
+ const sessionRef = useRef(session);
+ sessionRef.current = session;
+ const jobId = session.job.id;
+ const [loaded, setLoaded] = useState<{ jobId: string; artifactId: string; url: string }>();
useEffect(() => {
let objectUrl = '';
let canceled = false;
- setUrl('');
if (artifactId === undefined) return () => { canceled = true; };
void createCreatorArtifactObjectUrl(
- session,
+ sessionRef.current,
artifactId,
'stickman.load-artifact-preview',
'创作产物预览加载失败,请稍后重试。'
).then(url => {
+ if (canceled) {
+ URL.revokeObjectURL(url);
+ return;
+ }
objectUrl = url;
- if (!canceled) setUrl(objectUrl);
+ setLoaded({ jobId, artifactId, url: objectUrl });
}).catch(() => undefined);
return () => { canceled = true; if (objectUrl) URL.revokeObjectURL(objectUrl); };
- }, [artifactId, session.openArtifact]);
- return url;
+ }, [artifactId, jobId]);
+ return loaded !== undefined && loaded.jobId === jobId && loaded.artifactId === artifactId
+ ? loaded.url
+ : '';
}
function latestCompleted(artifacts: CreatorArtifact[], kind: string): CreatorArtifact | undefined {
diff --git a/apps/web/src/features/dashboard/creator-panel-adapters.test.ts b/apps/web/src/features/dashboard/creator-panel-adapters.test.ts
index b106843f..7ff69f0d 100644
--- a/apps/web/src/features/dashboard/creator-panel-adapters.test.ts
+++ b/apps/web/src/features/dashboard/creator-panel-adapters.test.ts
@@ -12,6 +12,16 @@ import {
const zh: CreatorPanelLocalize = value => value;
const en: CreatorPanelLocalize = (_zh, value) => value;
+describe('Remotion preparation progress', () => {
+ it('uses the shared stickman adapter without exposing transcription or internal dependency fields', () => {
+ const running = { ...stage('render', 'render-clean', 'running', null, 'render-clean'), stageId: 'render-clean', progress: { phase: 'preparing_dependencies', percent: 3, message: 'internal', dependencyItem: 'private archive' } };
+ const progress = stickmanVideoPanelAdapter.readStageProgress(running, en);
+ expect(progress).toMatchObject({ phase: 'preparing_dependencies', percent: 3 });
+ expect(stickmanVideoPanelAdapter.runningProgressText?.(running, progress, en)).toBe('Preparing Remotion rendering components');
+ expect(stickmanVideoPanelAdapter.phaseLabel('dependencies_ready', zh)).toBe('渲染组件已就绪');
+ });
+});
+
describe('video generation progress', () => {
it.each(['zh-CN', 'en-US', 'sv-SE'] as const)('explains unknown progress and retries in %s', language => {
const localize = createLocalizedCopy(language);
diff --git a/apps/web/src/features/dashboard/creator-panel-adapters.ts b/apps/web/src/features/dashboard/creator-panel-adapters.ts
index 4ed96e95..834d4dba 100644
--- a/apps/web/src/features/dashboard/creator-panel-adapters.ts
+++ b/apps/web/src/features/dashboard/creator-panel-adapters.ts
@@ -484,6 +484,8 @@ export const stickmanVideoPanelAdapter: CreatorPanelAdapter = {
measuring: l('测量真实音频时长', 'Measuring real audio timing'),
validating_media: l('检查视频轨、音频轨与抽帧', 'Checking video, audio, and sampled frames'),
rendering: l('渲染视频', 'Rendering video'),
+ preparing_dependencies: l('准备 Remotion 渲染组件', 'Preparing Remotion rendering components'),
+ dependencies_ready: l('渲染组件已就绪', 'Rendering components are ready'),
packaging: l('整理成片与字幕', 'Packaging video and subtitles'),
failed: l('阶段执行失败', 'Stage failed'),
completed: l('阶段已完成', 'Stage completed')
@@ -543,6 +545,9 @@ export const stickmanVideoPanelAdapter: CreatorPanelAdapter = {
return representative === undefined ? [] : [representative];
},
runningProgressText(stage, progress, l) {
+ if (stage.stageId === 'render-clean' && (progress.phase === 'preparing_dependencies' || progress.phase === 'dependencies_ready')) {
+ return stickmanVideoPanelAdapter.phaseLabel(progress.phase, l);
+ }
if (stage.stageId === 'script' && progress.phase !== null) {
return stickmanVideoPanelAdapter.phaseLabel(progress.phase, l);
}
diff --git a/apps/web/src/features/dashboard/dashboard.css b/apps/web/src/features/dashboard/dashboard.css
index 6a549a01..c0372a0d 100644
--- a/apps/web/src/features/dashboard/dashboard.css
+++ b/apps/web/src/features/dashboard/dashboard.css
@@ -8256,6 +8256,15 @@
color: var(--accent);
}
+.stickman-storyboard-placeholder[data-state="failed"] .stickman-storyboard-editor {
+ align-content: start;
+ gap: 12px;
+}
+
+.stickman-storyboard-placeholder[data-state="failed"] .video-translation-secondary-action {
+ justify-self: start;
+}
+
.stickman-storyboard-loading-row {
pointer-events: none;
}
diff --git a/apps/web/src/features/settings/LocalTranscriptionComponents.test.tsx b/apps/web/src/features/settings/LocalTranscriptionComponents.test.tsx
index 75b4b7d3..36908920 100644
--- a/apps/web/src/features/settings/LocalTranscriptionComponents.test.tsx
+++ b/apps/web/src/features/settings/LocalTranscriptionComponents.test.tsx
@@ -4,7 +4,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
import { LanguageProvider } from '../../i18n/LanguageProvider.js';
import { languagePreferenceStorageKey } from '../../i18n/language.js';
import type { RuntimeDependenciesController } from '../../app/use-runtime-dependencies.js';
-import { LocalTranscriptionComponents } from './LocalTranscriptionComponents.js';
+import { RuntimeManagedComponents as LocalTranscriptionComponents } from './RuntimeManagedComponents.js';
import { LocalTranscriptionNotice } from '../dashboard/LocalTranscriptionNotice.js';
import { LanguageSwitchControls } from '../../test/LanguageSwitchControls.js';
import { createLocalizedCopy } from '../../i18n/localized-copy.js';
@@ -24,7 +24,35 @@ function controllerFixture(patch: Partial<CreatorLocalComponent> = {}, provider
return controller;
}
+const managedComponents = [
+ { id: 'whisperkit', name: 'WhisperKit', version: '1.1.0', previousVersion: '1.0.0' },
+ { id: 'remotion', name: 'Remotion', version: '4.0.473', previousVersion: '4.0.472' }
+] as const;
+
describe('local transcription component management', () => {
+ it('offers independent Remotion installation without transcription model fields', async () => {
+ const controller = controllerFixture({}, 'openai');
+ controller.componentsStatus!.components = [{ ...componentFixture(), id: 'remotion', name: 'Remotion', model: null, models: [], supportedVersion: '4.0.473' }];
+ render(<LanguageProvider><LocalTranscriptionComponents controller={controller} componentId="remotion" /></LanguageProvider>);
+ expect(screen.getByRole('heading', { name: 'Remotion' })).toBeVisible();
+ expect(screen.getByText(/仅在执行渲染时按需下载/)).toBeVisible();
+ expect(screen.queryByText('当前模型')).not.toBeInTheDocument();
+ expect(screen.queryByRole('link', { name: '调整转录设置' })).not.toBeInTheDocument();
+ fireEvent.click(screen.getByRole('button', { name: '下载组件' }));
+ expect(controller.downloadComponents).toHaveBeenCalledWith('remotion');
+ await waitFor(() => expect(screen.getByRole('button', { name: '下载组件' })).toBeEnabled());
+ });
+
+ it('keeps Remotion progress visible and does not describe it as transcription', () => {
+ const controller = controllerFixture({}, 'openai');
+ controller.componentsStatus!.components = [{ ...componentFixture({ state: 'downloading', percent: 50, downloadedBytes: 1024 ** 2, totalBytes: 2 * 1024 ** 2 }), id: 'remotion', name: 'Remotion', model: null, models: [] }];
+ render(<LanguageProvider><LocalTranscriptionComponents controller={controller} /></LanguageProvider>);
+ expect(screen.getByText('正在下载 Remotion 渲染组件')).toBeVisible();
+ expect(screen.getByRole('progressbar')).toHaveAttribute('value', '50');
+ expect(screen.queryByText(/当前尚未开始转录/)).not.toBeInTheDocument();
+ expect(controller.downloadComponents).not.toHaveBeenCalled();
+ });
+
it.each(['downloading', 'verifying', 'extracting'] as const)('switches %s progress copy without restarting component preparation', state => {
const rawMessage = '后台原文:正在校验转录模型';
const controller = controllerFixture({ state, percent: 50, downloadedBytes: 1024 ** 3, totalBytes: 2 * 1024 ** 3, message: rawMessage });
@@ -79,39 +107,62 @@ describe('local transcription component management', () => {
await waitFor(() => expect(screen.getByRole('button', { name: '下载组件' })).not.toBeDisabled());
});
- it('keeps status checks read-only and offers an independent update for a ready component', async () => {
+ it.each(managedComponents)('hides updates for current $name and keeps checks read-only', async component => {
const controller = controllerFixture({ state: 'ready', version: '1.1.0' });
+ controller.componentsStatus!.components = [{ ...componentFixture({ state: 'ready' }), id: component.id, name: component.name, version: component.version, supportedVersion: component.version }];
render(<LanguageProvider><LocalTranscriptionComponents controller={controller} /></LanguageProvider>);
expect(controller.refreshComponents).toHaveBeenCalledOnce();
- const button = screen.getByRole('button', { name: '检查状态' });
+ const button = screen.getByRole('button', { name: '检查更新' });
expect(button).toHaveClass('settings-secondary-button');
expect(button.closest('.runtime-component-actions')).not.toBeNull();
- expect(screen.getByRole('button', { name: '检查并更新' })).toBeEnabled();
+ expect(screen.getByRole('status')).toHaveTextContent('已就绪');
+ expect(screen.queryByRole('button', { name: /更新到|已是受支持版本|下载组件/ })).not.toBeInTheDocument();
+ expect(controller.downloadComponents).not.toHaveBeenCalled();
fireEvent.click(button);
- await waitFor(() => expect(screen.getByText('检查完成,本地组件已就绪。')).toBeVisible());
+ await waitFor(() => expect(screen.getByText('检查完成,当前组件无需更新。')).toBeVisible());
+ expect(screen.queryByRole('button', { name: /更新到|已是受支持版本|下载组件/ })).not.toBeInTheDocument();
expect(controller.refreshComponents).toHaveBeenCalledTimes(2);
expect(controller.downloadComponents).not.toHaveBeenCalled();
});
- it('checks and updates a ready component without selecting it for transcription', async () => {
- const controller = controllerFixture({ state: 'ready', version: '1.1.0' }, 'openai');
- render(<LanguageProvider><LocalTranscriptionComponents controller={controller} /></LanguageProvider>);
+ it.each(managedComponents)('updates outdated $name without selecting it for transcription, then hides updates', async component => {
+ const controller = controllerFixture({}, 'openai');
+ controller.componentsStatus!.components = [{ ...componentFixture({ state: 'ready' }), id: component.id, name: component.name, version: component.previousVersion, supportedVersion: component.version }];
+ const { rerender } = render(<LanguageProvider><LocalTranscriptionComponents controller={controller} /></LanguageProvider>);
- expect(screen.getByText(/已通过校验的引擎和模型不会重复下载/)).toBeVisible();
- fireEvent.click(screen.getByRole('button', { name: '检查并更新' }));
+ expect(screen.getByRole('status')).toHaveTextContent('有可用更新');
+ const update = screen.getByRole('button', { name: `更新到 ${component.version}` });
+ expect(update).toBeEnabled();
+ fireEvent.click(screen.getByRole('button', { name: '检查更新' }));
+ await waitFor(() => expect(screen.getByText(`检查完成,可更新到受支持版本 ${component.version}。`)).toBeVisible());
+ expect(controller.downloadComponents).not.toHaveBeenCalled();
+ fireEvent.click(update);
- expect(controller.downloadComponents).toHaveBeenCalledWith('whisperkit');
+ expect(controller.downloadComponents).toHaveBeenCalledWith(component.id);
expect(controller.componentsStatus?.selectedProvider).toBe('openai');
- await waitFor(() => expect(screen.getByRole('button', { name: '检查并更新' })).not.toBeDisabled());
+ await waitFor(() => expect(update).toBeEnabled());
+ controller.componentsStatus = { ...controller.componentsStatus!, components: controller.componentsStatus!.components.map(installed => ({ ...installed, version: installed.supportedVersion })) };
+ rerender(<LanguageProvider><LocalTranscriptionComponents controller={controller} /></LanguageProvider>);
+ expect(screen.queryByRole('button', { name: /更新到|已是受支持版本|下载组件/ })).not.toBeInTheDocument();
+ expect(controller.downloadComponents).toHaveBeenCalledOnce();
+ });
+
+ it('does not offer an update when the supported version is unknown', () => {
+ const controller = controllerFixture({ state: 'ready', version: '1.1.0', supportedVersion: null });
+ render(<LanguageProvider><LocalTranscriptionComponents controller={controller} /></LanguageProvider>);
+ expect(screen.getByRole('status')).toHaveTextContent('已就绪');
+ expect(screen.queryByRole('button', { name: '已就绪' })).not.toBeInTheDocument();
+ expect(screen.queryByRole('button', { name: /更新到/ })).not.toBeInTheDocument();
+ expect(controller.downloadComponents).not.toHaveBeenCalled();
});
it('keeps checks read-only even when components are missing', async () => {
const controller = controllerFixture();
render(<LanguageProvider><LocalTranscriptionComponents controller={controller} /></LanguageProvider>);
- fireEvent.click(screen.getByRole('button', { name: '检查状态' }));
+ fireEvent.click(screen.getByRole('button', { name: '检查更新' }));
await waitFor(() => expect(screen.getByText('组件状态已刷新,尚未开始下载。')).toBeVisible());
expect(controller.downloadComponents).not.toHaveBeenCalled();
@@ -124,12 +175,12 @@ describe('local transcription component management', () => {
render(<LanguageProvider><LocalTranscriptionComponents controller={controller} /></LanguageProvider>);
vi.mocked(controller.refreshComponents!).mockImplementationOnce(() => new Promise(resolve => { finish = resolve; }));
- fireEvent.click(screen.getByRole('button', { name: '检查状态' }));
+ fireEvent.click(screen.getByRole('button', { name: '检查更新' }));
expect(screen.getByRole('button', { name: '正在检查' })).toBeDisabled();
expect(screen.getByRole('button', { name: '下载组件' })).toBeDisabled();
await act(async () => { finish(); });
- expect(screen.getByRole('button', { name: '检查状态' })).not.toBeDisabled();
+ expect(screen.getByRole('button', { name: '检查更新' })).not.toBeDisabled();
});
it('shows a failed status check without claiming success or starting a download', async () => {
@@ -137,12 +188,12 @@ describe('local transcription component management', () => {
render(<LanguageProvider><LanguageSwitchControls /><LocalTranscriptionComponents controller={controller} /></LanguageProvider>);
vi.mocked(controller.refreshComponents!).mockRejectedValueOnce(new Error('status unavailable'));
- fireEvent.click(screen.getByRole('button', { name: '检查状态' }));
+ fireEvent.click(screen.getByRole('button', { name: '检查更新' }));
await waitFor(() => expect(screen.getByRole('alert')).toHaveTextContent('status unavailable'));
- expect(screen.queryByText('检查完成,本地组件已就绪。')).not.toBeInTheDocument();
+ expect(screen.queryByText('检查完成,当前组件无需更新。')).not.toBeInTheDocument();
expect(controller.downloadComponents).not.toHaveBeenCalled();
- expect(screen.getByRole('button', { name: '检查状态' })).not.toBeDisabled();
+ expect(screen.getByRole('button', { name: '检查更新' })).not.toBeDisabled();
expect(screen.getByText('status unavailable')).not.toBeVisible();
fireEvent.click(screen.getByRole('button', { name: 'en-US' }));
expect(screen.getByText('Component status check failed. Check the service connection and retry.')).toBeVisible();
diff --git a/apps/web/src/features/settings/RuntimeComponentsSettingsView.tsx b/apps/web/src/features/settings/RuntimeComponentsSettingsView.tsx
index 11a2455e..b8ac4b1a 100644
--- a/apps/web/src/features/settings/RuntimeComponentsSettingsView.tsx
+++ b/apps/web/src/features/settings/RuntimeComponentsSettingsView.tsx
@@ -9,7 +9,7 @@ import type { RuntimeDependenciesController } from '../../app/use-runtime-depend
import { IssueList } from '../issues/IssuePresenter.js';
import { useAppLanguage } from '../../i18n/LanguageProvider.js';
import { useEffect, useRef, useState } from 'react';
-import { LocalTranscriptionComponents } from './LocalTranscriptionComponents.js';
+import { RuntimeManagedComponents } from './RuntimeManagedComponents.js';
type LiveCheckState = 'pending' | 'checking' | 'ready' | 'failed';
@@ -64,7 +64,7 @@ export function RuntimeComponentsSettingsView(props: {
return (
<section className="settings-section settings-management" aria-labelledby="runtime-components-title">
<SettingsHeader />
- <LocalTranscriptionComponents controller={props.controller} componentId={props.componentId} onReturn={props.onReturn} />
+ <RuntimeManagedComponents controller={props.controller} componentId={props.componentId} onReturn={props.onReturn} />
{!hasIssue ? (
<div className="settings-state">
<LoaderCircle className="settings-spin" size={17} aria-hidden="true" />
@@ -102,7 +102,7 @@ export function RuntimeComponentsSettingsView(props: {
return (
<section className="settings-section settings-management" aria-labelledby="runtime-components-title">
<SettingsHeader />
- <LocalTranscriptionComponents controller={props.controller} componentId={props.componentId} onReturn={props.onReturn} />
+ <RuntimeManagedComponents controller={props.controller} componentId={props.componentId} onReturn={props.onReturn} />
<article className="runtime-component-item">
<div className="runtime-component-heading">
<div>
diff --git a/apps/web/src/features/settings/LocalTranscriptionComponents.tsx b/apps/web/src/features/settings/RuntimeManagedComponents.tsx
similarity index 52%
rename from apps/web/src/features/settings/LocalTranscriptionComponents.tsx
rename to apps/web/src/features/settings/RuntimeManagedComponents.tsx
index 1f3af0e2..cef20e97 100644
--- a/apps/web/src/features/settings/LocalTranscriptionComponents.tsx
+++ b/apps/web/src/features/settings/RuntimeManagedComponents.tsx
@@ -1,4 +1,4 @@
-import type { CreatorLocalComponent } from '@opencreator/protocol';
+import type { CreatorRuntimeComponent } from '@opencreator/protocol';
import { ChevronDown, Download, LoaderCircle, RefreshCw } from 'lucide-react';
import { useEffect, useRef, useState } from 'react';
import type { RuntimeDependenciesController } from '../../app/use-runtime-dependencies.js';
@@ -8,12 +8,12 @@ import { OriginalErrorDetails } from '../issues/OriginalErrorDetails.js';
import { localComponentPreparationMessage } from './local-component-copy.js';
import './local-transcription.css';
-export function componentProgressText(component: Pick<CreatorLocalComponent, 'downloadedBytes' | 'totalBytes' | 'bytesPerSecond' | 'remainingSeconds'>): string {
+export function componentProgressText(component: Pick<CreatorRuntimeComponent, 'downloadedBytes' | 'totalBytes' | 'bytesPerSecond' | 'remainingSeconds'>): string {
const size = (bytes: number) => bytes >= 1024 ** 3 ? `${(bytes / 1024 ** 3).toFixed(2)} GiB` : `${(bytes / 1024 ** 2).toFixed(1)} MiB`;
return `${size(component.downloadedBytes)}${component.totalBytes === null ? '' : ` / ${size(component.totalBytes)}`}${component.bytesPerSecond ? ` · ${size(component.bytesPerSecond)}/s` : ''}${component.remainingSeconds === null ? '' : ` · ~${Math.ceil(component.remainingSeconds / 60)} min`}`;
}
-export function LocalTranscriptionComponents({ controller, componentId, onReturn }: {
+export function RuntimeManagedComponents({ controller, componentId, onReturn }: {
controller: RuntimeDependenciesController;
componentId?: string;
onReturn?(): void;
@@ -50,41 +50,45 @@ export function LocalTranscriptionComponents({ controller, componentId, onReturn
return <div className="local-transcription-components">
{onReturn ? <button type="button" className="settings-secondary-button" onClick={onReturn}>{localize('返回视频翻译', 'Return to video translation')}</button> : null}
- {controller.componentError ? <div role="alert"><p>{localize('无法读取本地转录组件状态,请检查服务连接后重试。', 'Cannot read local transcription component status. Check the service connection and retry.', 'Det går inte att läsa status för lokala transkriptionskomponenter. Kontrollera anslutningen till tjänsten och försök igen.')} <button type="button" onClick={() => void controller.refreshComponents?.()}>{localize('重试', 'Retry')}</button></p><OriginalErrorDetails detail={controller.componentError} /></div> : null}
+ {controller.componentError ? <div role="alert"><p>{localize('无法读取第三方组件状态,请检查服务连接后重试。', 'Cannot read third-party component status. Check the service connection and retry.', 'Det går inte att läsa status för tredjepartskomponenter. Kontrollera anslutningen till tjänsten och försök igen.')} <button type="button" onClick={() => void controller.refreshComponents?.()}>{localize('重试', 'Retry')}</button></p><OriginalErrorDetails detail={controller.componentError} /></div> : null}
{actionError ? <div role="alert"><p>{actionError.kind === 'check'
? localize('组件状态检查失败,请检查服务连接后重试。', 'Component status check failed. Check the service connection and retry.', 'Kontrollen av komponentstatus misslyckades. Kontrollera anslutningen till tjänsten och försök igen.')
: localize('无法启动组件下载,请检查服务连接后重试。', 'Could not start the component download. Check the service connection and retry.', 'Det gick inte att starta komponentnedladdningen. Kontrollera anslutningen till tjänsten och försök igen.')}</p><OriginalErrorDetails detail={actionError.detail} /></div> : null}
- {!status && !controller.componentError && controller.refreshComponents ? <p role="status">{localize('正在检查本地转录组件', 'Checking local transcription components')}</p> : null}
- {status?.components.filter(component => component.available).map(component => {
+ {!status && !controller.componentError && controller.refreshComponents ? <p role="status">{localize('正在检查第三方组件', 'Checking third-party components')}</p> : null}
+ {status?.components.filter(component => component.available || component.id === 'remotion').map(component => {
+ const rendering = component.id === 'remotion';
const selected = component.id === status.selectedProvider;
const busy = ['downloading', 'verifying', 'extracting'].includes(component.state);
const checking = action?.componentId === component.id && action.kind === 'check';
const startingDownload = action?.componentId === component.id && action.kind === 'download';
- const canDownload = downloadComponents !== undefined;
+ const canDownload = component.available && downloadComponents !== undefined;
+ const updateAvailable = component.version !== null && component.supportedVersion !== null && component.version !== component.supportedVersion;
+ const current = component.state === 'ready' && !updateAvailable;
+ const updateLabel = localize(`更新到 ${component.supportedVersion}`, `Update to ${component.supportedVersion}`, `Uppdatera till ${component.supportedVersion}`);
const requiredResources = [
- component.version === null ? localize('转录引擎', 'transcription engine') : undefined,
- component.models.find(model => model.id === component.model)?.installed !== true
+ component.version === null || updateAvailable ? rendering ? localize('渲染引擎、浏览器和模板资源', 'rendering engine, browser, and template resources') : localize('转录引擎', 'transcription engine') : undefined,
+ !rendering && component.models.find(model => model.id === component.model)?.installed !== true
? `${component.model ?? ''} ${localize('模型', 'model')}`.trim() : undefined
].filter(Boolean).join(localize('、', ', '));
const labels = {
not_installed: localize('尚未安装', 'Not installed'), partial: localize('模型尚未就绪', 'Model not ready'),
downloading: localize('正在下载', 'Downloading'), verifying: localize('正在校验', 'Verifying'), extracting: localize('正在解压安装', 'Extracting'),
- ready: localize('已就绪', 'Ready'), failed: localize('下载失败', 'Download failed'), unsupported: localize('当前平台不支持受控安装', 'Managed installation unavailable on this platform')
+ ready: localize('已就绪', 'Ready'), failed: localize('下载失败', 'Download failed'), unsupported: rendering ? localize('暂无兼容组件包', 'Compatible component package unavailable') : localize('当前平台不支持受控安装', 'Managed installation unavailable on this platform')
};
return <article key={component.id} id={`component-${component.id}`} className="runtime-component-item local-component-item" data-highlight={component.id === componentId || undefined}>
<div className="runtime-component-heading">
<div>
<div className="runtime-component-title">
<h2>{component.name}</h2>
- <span role="status" data-status={component.state === 'ready' ? 'current' : component.state === 'failed' ? 'update' : 'checking'}>{labels[component.state]}</span>
+ <span role="status" data-status={updateAvailable || component.state === 'failed' ? 'update' : component.state === 'ready' ? 'current' : 'checking'}>{updateAvailable && !busy ? localize('有可用更新', 'Update available', 'Uppdatering tillgänglig') : labels[component.state]}</span>
{selected ? <span>{localize('当前使用', 'Selected')}</span> : null}
</div>
- <p>{localize('用于本地语音转录,仅在实际需要转录时使用。', 'Used for local speech transcription only when transcription is needed.')}</p>
+ <p>{rendering ? localize('用于火柴人动画本地渲染,仅在执行渲染时按需下载,也可提前安装。不影响脚本、角色预览和图片生成。', 'Used for local stickman animation rendering. Downloads only when rendering is requested, or can be installed in advance. Scripts, character previews, and image generation remain available.') : localize('用于本地语音转录,仅在实际需要转录时使用。', 'Used for local speech transcription only when transcription is needed.')}</p>
</div>
</div>
<dl className="runtime-component-details">
<div><dt>{localize('已安装引擎版本', 'Installed engine version')}</dt><dd>{component.version ?? localize('未安装', 'Not installed')}</dd></div>
- <div><dt>{localize('当前模型', 'Current model')}</dt><dd>{component.model ?? '—'}</dd></div>
+ {rendering ? <div><dt>{localize('受支持版本', 'Supported version')}</dt><dd>{component.supportedVersion ?? '—'}</dd></div> : <div><dt>{localize('当前模型', 'Current model')}</dt><dd>{component.model ?? '—'}</dd></div>}
</dl>
<details className="local-component-details">
<summary><ChevronDown size={15} aria-hidden="true" />{localize('组件详情', 'Component details')}</summary>
@@ -94,35 +98,38 @@ export function LocalTranscriptionComponents({ controller, componentId, onReturn
<div><dt>{localize('安装位置', 'Install location')}</dt><dd>{component.path}</dd></div>
<div><dt>{localize('资源来源与校验', 'Source and verification')}</dt><dd>{component.source}</dd></div>
<div><dt>{localize('安装时间', 'Installed at')}</dt><dd>{component.installedAt ? new Date(component.installedAt).toLocaleString(language) : '—'}</dd></div>
- <div><dt>{localize('模型列表', 'Models')}</dt><dd><ul className="local-component-models">{component.models.map(model => <li key={model.id}>{model.id} · {model.installed ? localize('已安装并通过检查', 'Installed and checked') : localize('未安装', 'Not installed')}{model.bytes === null ? '' : ` · ${(model.bytes / 1024 ** 3).toFixed(2)} GiB`}</li>)}</ul></dd></div>
+ {!rendering ? <div><dt>{localize('模型列表', 'Models')}</dt><dd><ul className="local-component-models">{component.models.map(model => <li key={model.id}>{model.id} · {model.installed ? localize('已安装并通过检查', 'Installed and checked') : localize('未安装', 'Not installed')}{model.bytes === null ? '' : ` · ${(model.bytes / 1024 ** 3).toFixed(2)} GiB`}</li>)}</ul></dd></div> : null}
</dl>
</details>
{busy ? <div className="local-component-progress" role="status">
<strong>{component.item ?? (component.state === 'verifying' ? localize('正在检查本地组件', 'Checking local components') : localize('正在连接下载服务器', 'Connecting to download server'))}</strong>
- <p>{localComponentPreparationMessage(component.state, localize)}</p>
+ <p>{rendering ? component.state === 'downloading' ? localize('正在下载 Remotion 渲染组件', 'Downloading Remotion rendering components') : localize('正在校验或安装 Remotion 渲染资源', 'Verifying or installing Remotion rendering resources') : localComponentPreparationMessage(component.state, localize)}</p>
{component.state === 'downloading' ? <>
<progress max={100} value={component.percent ?? undefined} aria-label={localize('组件下载进度', 'Component download progress')} />
<span>{component.percent === null ? '' : `${Math.floor(component.percent)}% · `}{componentProgressText(component)}</span>
</> : null}
- <p>{localize('模型文件较大,可能需要较长时间。当前尚未开始转录;准备完成后将自动继续,无需重新开始任务。', 'Models are large and may take time to prepare. Transcription has not started yet; the task continues automatically after preparation.')}</p>
+ <p>{rendering ? localize('正在准备渲染组件;准备完成后任务会自动继续,无需重新生成脚本或图片。', 'Preparing rendering components. The task continues automatically; scripts and images do not need to be regenerated.') : localize('模型文件较大,可能需要较长时间。当前尚未开始转录;准备完成后将自动继续,无需重新开始任务。', 'Models are large and may take time to prepare. Transcription has not started yet; the task continues automatically after preparation.')}</p>
</div> : null}
- {component.error ? <div role="alert"><p>{localize('本地转录组件准备失败。已有字幕不受影响,可检查诊断信息后重试下载。', 'Local transcription preparation failed. Existing subtitles are unchanged; check the diagnostics and retry the download.', 'Förberedelsen av lokal transkription misslyckades. Befintliga undertexter är oförändrade; kontrollera diagnostiken och försök ladda ned igen.')}</p><OriginalErrorDetails detail={component.error} /></div> : null}
- {checkedComponentId === component.id && !controller.componentError && !actionError && !busy ? <p className="local-component-check-notice" role="status">{component.state === 'ready' ? localize('检查完成,本地组件已就绪。', 'Check complete. Local components are ready.') : localize('组件状态已刷新,尚未开始下载。', 'Component status refreshed. No downloads have started.')}</p> : null}
+ {component.error ? <div role="alert"><p>{rendering ? localize('渲染组件尚未就绪,已有脚本和图片不受影响。请检查诊断信息后重试。', 'Rendering components are not ready. Existing scripts and images are unchanged. Check the diagnostics and retry.') : localize('本地转录组件准备失败。已有字幕不受影响,可检查诊断信息后重试下载。', 'Local transcription preparation failed. Existing subtitles are unchanged; check the diagnostics and retry the download.', 'Förberedelsen av lokal transkription misslyckades. Befintliga undertexter är oförändrade; kontrollera diagnostiken och försök ladda ned igen.')}</p><OriginalErrorDetails detail={component.error} /></div> : null}
+ {checkedComponentId === component.id && !controller.componentError && !actionError && !busy ? <p className="local-component-check-notice" role="status">{updateAvailable
+ ? localize(`检查完成,可更新到受支持版本 ${component.supportedVersion}。`, `Check complete. You can update to the supported version ${component.supportedVersion}.`, `Kontrollen är klar. Du kan uppdatera till den version som stöds: ${component.supportedVersion}.`)
+ : current ? localize('检查完成,当前组件无需更新。', 'Check complete. No component update is needed.', 'Kontrollen är klar. Ingen komponentuppdatering behövs.')
+ : localize('组件状态已刷新,尚未开始下载。', 'Component status refreshed. No downloads have started.')}</p> : null}
{!busy && canDownload ? <p>{component.state === 'ready'
- ? localize('将检查并按需更新至受支持版本,已通过校验的引擎和模型不会重复下载。', 'Checks and updates to the supported version as needed. Verified engines and models will not be downloaded again.')
+ ? updateAvailable ? localize(`可更新到受支持版本 ${component.supportedVersion},点击更新后开始下载。`, `The supported version ${component.supportedVersion} is available. Click update to start downloading.`, `Den version som stöds, ${component.supportedVersion}, är tillgänglig. Klicka på uppdatera för att börja ladda ned.`) : localize('当前组件无需更新;检查更新不会重新下载组件。', 'No component update is needed. Checking for updates will not download components again.', 'Ingen komponentuppdatering behövs. Att söka efter uppdateringar laddar inte ned komponenter igen.')
: <>{localize('将准备所需资源:', 'Resources to prepare: ')}{requiredResources || localize('当前转录引擎和模型', 'the current transcription engine and model')}{localize('。', '.')}</>}</p> : null}
{!busy ? <footer className="runtime-component-footer">
<div className="runtime-component-actions">
{refreshComponents ? <button type="button" className="settings-secondary-button" disabled={action !== undefined} onClick={() => void performAction(component.id, 'check', refreshComponents)}>
{checking ? <LoaderCircle className="settings-spin" size={15} aria-hidden="true" /> : <RefreshCw size={15} aria-hidden="true" />}
- {checking ? localize('正在检查', 'Checking') : localize('检查状态', 'Check status')}
+ {checking ? localize('正在检查', 'Checking') : localize('检查更新', 'Check for updates', 'Sök efter uppdateringar')}
</button> : null}
- {downloadComponents ? <button type="button" className="settings-primary-button" disabled={action !== undefined} onClick={() => void performAction(component.id, 'download', () => downloadComponents(component.id))}>
+ {canDownload && !current && downloadComponents ? <button type="button" className="settings-primary-button" disabled={action !== undefined} onClick={() => void performAction(component.id, 'download', () => downloadComponents(component.id))}>
{startingDownload ? <LoaderCircle className="settings-spin" size={15} aria-hidden="true" /> : <Download size={15} aria-hidden="true" />}
- {startingDownload ? localize('正在准备', 'Preparing') : component.state === 'ready' ? localize('检查并更新', 'Check and update') : component.state === 'failed' ? localize('重试下载', 'Retry download') : component.state === 'partial' ? localize('补齐组件', 'Complete installation') : localize('下载组件', 'Download components')}
+ {startingDownload ? localize('正在准备', 'Preparing') : component.state === 'failed' ? localize('重试下载', 'Retry download') : updateAvailable ? updateLabel : component.state === 'partial' ? localize('补齐组件', 'Complete installation') : localize('下载组件', 'Download components')}
</button> : null}
</div>
- {!selected ? <a href="#/settings?tab=ai-services&section=transcription">{localize('调整转录设置', 'Change transcription settings')}</a> : null}
+ {!selected && !rendering ? <a href="#/settings?tab=ai-services&section=transcription">{localize('调整转录设置', 'Change transcription settings')}</a> : null}
</footer> : null}
</article>;
})}
diff --git a/apps/web/src/services/runtime-dependency-service.test.ts b/apps/web/src/services/runtime-dependency-service.test.ts
index 33322816..641da3b8 100644
--- a/apps/web/src/services/runtime-dependency-service.test.ts
+++ b/apps/web/src/services/runtime-dependency-service.test.ts
@@ -9,10 +9,12 @@ describe('runtime dependency service', () => {
await service.downloadComponents('whisperkit');
await service.downloadComponents('whisper.cpp');
await service.downloadComponents();
+ await service.downloadComponents('remotion');
expect(client.post).toHaveBeenNthCalledWith(1, '/creator/components/download', { componentId: 'whisperkit' });
expect(client.post).toHaveBeenNthCalledWith(2, '/creator/components/download', { componentId: 'whisper.cpp' });
expect(client.post).toHaveBeenNthCalledWith(3, '/creator/components/download', undefined);
+ expect(client.post).toHaveBeenNthCalledWith(4, '/creator/components/download', { componentId: 'remotion' });
});
it('uses the shared Runtime dependency endpoints', async () => {
diff --git a/apps/web/src/services/runtime-dependency-service.ts b/apps/web/src/services/runtime-dependency-service.ts
index eb5745b4..19648bcc 100644
--- a/apps/web/src/services/runtime-dependency-service.ts
+++ b/apps/web/src/services/runtime-dependency-service.ts
@@ -1,4 +1,4 @@
-import type { CreatorLocalComponent, CreatorRuntimeComponentsResponse, CreatorYtDlpStatusResponse } from '@opencreator/protocol';
+import type { CreatorRuntimeComponent, CreatorRuntimeComponentsResponse, CreatorYtDlpStatusResponse } from '@opencreator/protocol';
type ClientLike = {
get(path: string): Promise<unknown>;
@@ -10,7 +10,7 @@ export function createRuntimeDependencyService(client: ClientLike) {
getComponentsStatus(): Promise<CreatorRuntimeComponentsResponse> {
return client.get('/creator/components/status') as Promise<CreatorRuntimeComponentsResponse>;
},
- downloadComponents(componentId?: CreatorLocalComponent['id']): Promise<CreatorRuntimeComponentsResponse> {
+ downloadComponents(componentId?: CreatorRuntimeComponent['id']): Promise<CreatorRuntimeComponentsResponse> {
return client.post('/creator/components/download', componentId === undefined ? undefined : { componentId }) as Promise<CreatorRuntimeComponentsResponse>;
},
getYtDlpStatus(): Promise<CreatorYtDlpStatusResponse> {
diff --git a/docs/development/remotion-components.md b/docs/development/remotion-components.md
new file mode 100644
index 00000000..10fd01e9
--- /dev/null
+++ b/docs/development/remotion-components.md
@@ -0,0 +1,41 @@
+# Remotion 按需渲染组件
+
+Remotion 由共享 Daemon 管理。Web 和 Desktop 使用同一组 `/creator/components/status` 和 `/creator/components/download` API;下载请求指定 `componentId: "remotion"`,不会修改语音识别或模板设置。
+
+启动应用、查看角色、编辑脚本和生成图片不触发下载。渲染阶段预检在存在兼容组件描述时允许进入准备阶段;执行器等待安装、校验完成后继续当前任务。手动下载和多个任务共用同一次安装,取消某个任务不取消其他订阅者的安装。
+
+## 资源边界
+
+- App 保留模板逻辑、通用协作面板和 `daemon/runtime/stickman-assets` 中的角色、风格目录与预览。
+- 独立组件包含 Chrome Headless Shell、预编译渲染 Bundle、字体、Renderer 生产依赖和当前平台的原生 compositor。
+- `@remotion/renderer`、Bundler 仅作为开发依赖,不进入 App 的 Daemon 生产依赖。
+- Worker 从经过校验的组件目录加载 Renderer,不在用户机器上运行 npm、pnpm 或编译器。
+
+## 构建与发布
+
+`pnpm --filter @opencreator/desktop prepare:stickman-runtime` 为当前平台构建:
+
+- `.pack/stickman-runtime`:完整的独立渲染组件。
+- `.pack/stickman-assets`:App 保留的轻量角色资源。
+- `.pack/components/Remotion-VERSION-PLATFORM-ARCH.tar.gz`:下载产物。
+- `.pack/components/remotion-component.json`:包含版本、平台、下载 URL、压缩包大小与 SHA-256、内部 manifest SHA-256 的兼容性描述。
+
+Desktop 打包只嵌入兼容性描述和轻量资源。构建清单绑定完整组件及其描述;校验门禁拒绝 App 内残留的浏览器和 Remotion 生产依赖,并比较本次 Web 构建与 App 内 Web 的完整文件列表和哈希。
+
+正式 Release 必须将独立组件压缩包与安装器一起上传同一个版本的 GitHub Release;发布附件整理与校验流程包含 macOS arm64、macOS x64、Windows x64 的组件产物。未上传对应组件时,安装器的远端下载不能成功,不得仅发布安装器。
+
+macOS Developer ID 打包先独立签名组件中的所有 Mach-O,再生成资源哈希和下载压缩包。正式 Release 对组件执行独立公证。使用仅由 Electron Builder 临时导入的签名证书时,需要为组件准备可用的签名 keychain,或设置 `OPENCREATOR_REMOTION_SIGNING_IDENTITY`;无法独立签名时发布必须失败。
+
+## 安装与更新
+
+组件安装在用户数据目录 `creator-runtime/stickman/MANIFEST_SHA256`,不写 App 资源目录。下载验证压缩包 SHA-256 和大小,拒绝路径穿越、符号链接及硬链接,验证内部 manifest 和全部资源哈希后才启用。新版本使用新目录,保留正在使用的旧版本;已通过校验的同版本资源不重复下载。
+
+更新只安装当前 App 描述中锁定的兼容版本,不直接追踪 Remotion 最新版本。Renderer、Bundle 和原生库必须配套更新。
+
+设置页将“检查更新”和“更新到受支持版本”分开:检查只刷新状态,不开始下载;已就绪且版本一致时不显示更新按钮,只展示组件状态;版本不一致时才显示更新入口。尚未安装、缺少资源和准备失败仍分别提供下载、补齐和重试入口。
+
+开发环境可以显式指定 `OPENCREATOR_REMOTION_COMPONENT_MANIFEST`、`OPENCREATOR_REMOTION_COMPONENT_ARCHIVE` 和 `OPENCREATOR_STICKMAN_ASSETS_ROOT`。Vite 管理的开发 Daemon 优先使用本机构建的组件包,但不自动构建或安装它。正式 App 不自动回退到开发机依赖。
+
+## 验证范围
+
+改动属于 P2:执行组件下载/并发/取消/校验/重试测试、渲染与预检测试、共享设置页和 Panel Adapter 测试、相关包类型检查,以及真实 Desktop 打包、资源校验和 packaged App 下载后渲染测试。不同平台的原生包及正式签名、公证需要在对应发布环境分别验证。
diff --git a/packages/protocol/src/creator.ts b/packages/protocol/src/creator.ts
index d2909a89..e498015f 100644
--- a/packages/protocol/src/creator.ts
+++ b/packages/protocol/src/creator.ts
@@ -379,8 +379,8 @@ export type CreatorYtDlpStatusResponse = {
ytDlp: CreatorYtDlpStatus;
};
-export type CreatorLocalComponent = {
- id: 'whisperkit' | 'whisper.cpp' | 'faster-whisper';
+export type CreatorRuntimeComponent = {
+ id: 'whisperkit' | 'whisper.cpp' | 'faster-whisper' | 'remotion';
name: string;
available: boolean;
version: string | null;
@@ -401,12 +401,16 @@ export type CreatorLocalComponent = {
message?: string;
};
+export type CreatorLocalComponent = Omit<CreatorRuntimeComponent, 'id'> & {
+ id: Exclude<CreatorRuntimeComponent['id'], 'remotion'>;
+};
+
export type CreatorRuntimeComponentsResponse = {
platform: string;
arch: string;
selectedProvider: string;
selectedModel: string | null;
- components: CreatorLocalComponent[];
+ components: CreatorRuntimeComponent[];
};
export type CreatorSelection = {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 4387dff2..4c4658d9 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -63,9 +63,6 @@ importers:
'@opencreator/writing-templates':
specifier: workspace:*
version: link:../../packages/writing-templates
- '@remotion/renderer':
- specifier: 4.0.473
better-sqlite3:
specifier: ^12.11.1
version: 12.11.1
@@ -115,6 +112,9 @@ importers:
'@remotion/bundler':
specifier: 4.0.473
+ '@remotion/renderer':
+ specifier: 4.0.473
'@types/better-sqlite3':
specifier: ^7.6.13
version: 7.6.13
@@ -1078,89 +1078,105 @@ packages:
resolution: {integrity: sha512-0DaL0A6Xu6sQSQFwe4iVCrKWU2cCTItnRsYsCdxAMm9NF6twAA9BKnoqy4hqz4+azQ0JHuA26qiUKsf1XJ/v5A==}
cpu: [arm64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-3rbU4vqXXc3hY/OiXdl52xZvT0F1yEngWfvqudtPJg/KkyiaQw2DRsFrNzpmLvfavbwOq3qXn36GP8obHRULQA==}
cpu: [arm]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-cdn1OvUBwsXhbC0zSzJnNzf5MZ/mTrobawDvNXBTxe8VtqKAm0sRuEY2Evzovb/w9JMk4TvRxqt1mekSuJz64w==}
cpu: [ppc64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-HjPVx7yKz+0lqdhDlTw1tt90wamBoxhiXpvl1XZpJLiHH4RCJ5yDTqH+VlYPv2fwFs89JFw4c1IexYOcQUi4IQ==}
cpu: [riscv64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-neWLh+3yCNThxnfy3c4BbVBeGgt9aftno+XbT56iK28RgeDs3UOFWviLWlUu0bArYVYJaFDK+RRohbicUNCm8Q==}
cpu: [s390x]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-4vKmvAst9nrowcqquKFAyZJUDolUaIp8uRiN0mWFguJ1IplC9/pitXtlnnlU4aa/eJw3J7i67V+pwUL+wZGdsA==}
cpu: [x64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-Y9kQaLMuNoB0bPYOOdcZMaseNrFpPodIWWMrx+CZyydf2xn68j9WYc6sWWRrDwNkzCQjKYfc68L7jKjGlHMibw==}
cpu: [arm64]
os: [linux]
+ libc: [musl]
resolution: {integrity: sha512-fj8Mv0HHfD1Rr+4I68+3agJynxDWtBFgicTbSOb9Bke6pIwzGcJ+RX/yHjmiEGFMCavY/dxvem7MyNaJF+wDiw==}
cpu: [x64]
os: [linux]
+ libc: [musl]
resolution: {integrity: sha512-De4jpEnAU8Hd5oT0j1G3uL4ZvTuipVMn7YC6vPaJhy6/7EwEae0SVAoBrUMYQbkLGDm85taVWwuPc1a44LTzCQ==}
engines: {node: '>=20.9.0'}
cpu: [arm64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-7OAS8gI0EReKGVN2HssHlM6umJgxF5VI3xN0p9FA91p/YO+ou5hiNghLdZ5BEHztwaaK5+bLKRf8x/o2L2nk9A==}
engines: {node: '>=20.9.0'}
cpu: [arm]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-2oYZJeIl4kCcMGk4ouZVjnkCtFrpQFlNEtJ6GbxzhHQchwH0NH/qEb9ykmOl29dqwMq+JhFdZn+1ak2FKhI9fQ==}
engines: {node: '>=20.9.0'}
cpu: [ppc64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-cPbNChoRURAWdebDIHSenxRpgEdy7JkPydSnUxRm9VvKD7m0/xVaR/8Fzlu81pk5nHEvHH87UZUA7cTtwnbJSA==}
engines: {node: '>=20.9.0'}
cpu: [riscv64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-RY0JFY8Fd6RonCBtHz+DvadaPkXDSI1AUn6yWL9TipqkZ1vY8w8evqdgyDFnkm4/K1ve1TvZiaePP5oSd4+WVQ==}
engines: {node: '>=20.9.0'}
cpu: [s390x]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-9qvvEAuk8k89TfWUoX2htWjbAMX8p+NxCppjpcg5k6xMsjhBQPTsoIh36h9Qde4WRuGpJeYnOjdosDn/cnv+OA==}
engines: {node: '>=20.9.0'}
cpu: [x64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-KB5jxpfWQTr0nc3xdHtWChdbifHrBGsd2SM62Eyxrl8afikm+f5qGBU75SJIZBT/S1MC8XyacdlXBMSWq6OURA==}
engines: {node: '>=20.9.0'}
cpu: [arm64]
os: [linux]
+ libc: [musl]
resolution: {integrity: sha512-f+eZJZIQNEEd26RPSW+76chwOf1XtA2Y/O+5ocVyLliHkeih3e+jhLVBdNTd2rS3IbNXK8+ug93Vf5ZXtF5Lxg==}
engines: {node: '>=20.9.0'}
cpu: [x64]
os: [linux]
+ libc: [musl]
resolution: {integrity: sha512-zQnl4Kwp7Q6NHsENtU2T/00Zi+w3AQNwz3+UaTyVBy2FpXrzXzGjndpK61onhZjRtRpQXxCTeqw19bVyXOh7jA==}
@@ -1361,21 +1377,25 @@ packages:
resolution: {integrity: sha512-HeV247O9dwhSfXFYoA7Dd0zPmyn2grbrIhaYs2MJZxO6IHmEUk0gm9/drWyjDHy4e2WCg98uSlcycNOmWtG5ng==}
cpu: [arm64]
os: [linux]
+ libc: [glibc]
'@remotion/[email protected]':
resolution: {integrity: sha512-7EGy2MtQch3yLzwxvWncz/3rmXOWQkWigCDL37I90aHhlf8JgrMZXo8dUtIoD0LP/zHWtFNBcJmgg9Ej+bHshA==}
cpu: [arm64]
os: [linux]
+ libc: [musl]
'@remotion/[email protected]':
resolution: {integrity: sha512-X5Gzod9Q8sTtzjc+hIYKw6PMaB3tY0ADx68j2z+Zm8nJanmkzLZEDyZvlMexmE4nkb7IdOkHzYGm9NpynbMH2A==}
cpu: [x64]
os: [linux]
+ libc: [glibc]
'@remotion/[email protected]':
resolution: {integrity: sha512-REyhvrjGYfFTxGaaRDP31zANM744JI7pKXCgTqXHZBCe8mCZjxZCxmwt9pNL2lJsQ+qLr9zai488Bbj/PUuB6g==}
cpu: [x64]
os: [linux]
+ libc: [musl]
'@remotion/[email protected]':
resolution: {integrity: sha512-J69HIENHpH1m8I85kTe111viqB5AGgKJdTCSKp4mGBxM95IL4nydzrYxVd91BvWjanQfVVq1C3voaF8YLwkT7A==}
@@ -1469,66 +1489,79 @@ packages:
resolution: {integrity: sha512-n1GJHPOvpIfhi3TmrCeh6S6URt9BFCt0KQE3qvexyGCTAKpR4Lg+eWvNZEqu7epxwus/8ElT3hacYEucm49SZg==}
cpu: [arm]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-JqgflS8wEB+UXV/vS1RpRbifGBeN4D5lz8D8oOFbFZw4vedvdOgCFAjfBmIMdW3yL10XpQQ0Ambepw6MXrhOnA==}
cpu: [arm]
os: [linux]
+ libc: [musl]
'@rollup/[email protected]':
resolution: {integrity: sha512-wnFJkogWvN4jm/hQRF2UBaeUmk20j5+DmHvoyWii2b8HJDyvz1MF2OU/6ynXt2KR63rbZLWkFpoytpdc/yBuSA==}
cpu: [arm64]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-HVu2bp0zhvJ8xHEV9+UUs7S90VadmBSY3LcIMvozbPo4AuMGDWlz3ymHLHZPX4hR67TKTt8Qp5PJ5RBg/i+RMQ==}
cpu: [arm64]
os: [linux]
+ libc: [musl]
'@rollup/[email protected]':
resolution: {integrity: sha512-mQqqAV8QaoSgr9I2fKDLY2BAVvmKjWoGiu/cSYQonsLvtqwEn1E4QYfnCOcp5zoEqNhsDYin1s6jx/VJmrxlZg==}
cpu: [loong64]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-IxKLoxCQ2IWi6bT2akyDUBGsOImDKB+sPp4EsTmwFQ/fMwpCKm8uLSSgP/Kx/QYUgKis6SEZ5/Nlhup0DIA0PQ==}
cpu: [loong64]
os: [linux]
+ libc: [musl]
'@rollup/[email protected]':
resolution: {integrity: sha512-Mk5ha2RQSgyFfmYYLkBpPnUk8D8FriBxesO1u9O75X0mHgXL1UQcH5Itl2lurWL2tj0RxV9b9tJgipac0hRY9A==}
cpu: [ppc64]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-CjvEnqJL/0/TQ3TXX3OPIJ/kmBellrWd4heXUmHeJlTnmwjKpSJzoehLaL6Xk0ZnMHBu9dZuFADNOrtjF4v+2w==}
cpu: [ppc64]
os: [linux]
+ libc: [musl]
'@rollup/[email protected]':
resolution: {integrity: sha512-1SiZbzwdkaDURsew/tSOrooKiYy7EQGT6m8ufavAi9NEyQb/6VuIxFXAL1fqa4iZe3g4NbNk4P7J32z2tw5Mgg==}
cpu: [riscv64]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-nQts12zJ3NQRoE6uYljOH89v7szzLDvG2JD/vsX+vGXU8w/At1GowTZ5/7qeFQ8m7L55rpR8Okugnuo5bgjy2Q==}
cpu: [riscv64]
os: [linux]
+ libc: [musl]
'@rollup/[email protected]':
resolution: {integrity: sha512-E9/ll019jhPIJgpzfZoIkBGhcz+kKNgVWYRY0zr9srBdPPFVpvOKW8VaJKUbeK+eZXyQF9ltME+Kk6affeaPgg==}
cpu: [s390x]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-5BqxR/pshjey51iliyzTD5Xi3EN0aLmQ2lZ3lvefVV9c82BvrLo2/6OT55iifpWBufs6kdwWbuOKS841DrmK9A==}
cpu: [x64]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-uNN83XxQrRAh/w0/pmAfibcwyb6YWt4gP+dpnQKPVJshAloQ785ii8CT8ZCIxkGg9opVsvAlGhFitSm6D1Jjpg==}
cpu: [x64]
os: [linux]
+ libc: [musl]
'@rollup/[email protected]':
resolution: {integrity: sha512-srjEIxSH3LRnJN6THczDHWQplqEMFiAJrTab0msUryh9kwNpkICf3Ea6q6MN/2cZwRFUNx5w+h6Hpi4QuHS6Zg==}
@@ -1574,21 +1607,25 @@ packages:
resolution: {integrity: sha512-eQfcsaxhFrv5FmtaA7+O1F9/2yFDNIoPZzV/ZvqvFz5bBXVc4FAm/1fVpBg8Po/kX1h0chBc7Xkpry3cabFW8w==}
cpu: [arm64]
os: [linux]
+ libc: [glibc]
'@rspack/[email protected]':
resolution: {integrity: sha512-DfQXKiyPIl7i1yECHy4eAkSmlUzzsSAbOjgMuKn7pudsWf483jg0UUYutNgXSlBjc/QSUp7906Cg8oty9OfwPA==}
cpu: [arm64]
os: [linux]
+ libc: [musl]
'@rspack/[email protected]':
resolution: {integrity: sha512-NdA+2X3lk2GGrMMnTGyYTzM3pn+zNjaqXqlgKmFBXvjfZqzSsKq3pdD1KHZCd5QHN+Fwvoszj0JFsquEVhE1og==}
cpu: [x64]
os: [linux]
+ libc: [glibc]
'@rspack/[email protected]':
resolution: {integrity: sha512-rEy6MHKob02t/77YNgr6dREyJ0e0tv1X6Xsg8Z5E7rPXead06zefUbfazj4RELYySWnM38ovZyJAkPx/gOn3VA==}
cpu: [x64]
os: [linux]
+ libc: [musl]
'@rspack/[email protected]':
resolution: {integrity: sha512-YupOrz0daSG+YBbCIgpDgzfMM38YpChv+afZpaxx5Ml7xPeAZIIdgWmLHnQ2rts73N2M1NspAiBwV00Xx0N4Vg==}
@@ -2687,7 +2724,7 @@ packages:
resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==}
- deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting [email protected]
+ deprecated: Glob versions prior to v9 are no longer supported
resolution: {integrity: sha512-PT6XReJ+D07JvGoxQMkT6qji/jVNfX/h364XHZOWeRzy64sSFr+xJ5OX7LI3b4MPQzdL4H8Y8M0xzPpsVMwA8Q==}