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.
TypeScript agent-skillscodex-clideskop-appdubbingimage-generationlocalizationskillsttsvideo-editingvideo-generationvideo-transcriptionvideo-translation
fix(creator): refine video translation and desktop experience
米饭二两bcfc7195c8d1
diff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.ymlindex fea465ee..a9f0bdf5 100644--- a/.github/workflows/desktop-release.yml+++ b/.github/workflows/desktop-release.yml@@ -124,6 +124,11 @@ jobs:exit 1fi- uses: actions/checkout@v4+ - name: Select Xcode for macOS icon appearances+ if: matrix.platform == 'darwin'+ uses: maxim-lobanov/setup-xcode@v1+ with:+ xcode-version: latest-stable- uses: pnpm/action-setup@v4- uses: actions/setup-node@v4with:diff --git a/apps/desktop/e2e/creator-packaged-app.spec.ts b/apps/desktop/e2e/creator-packaged-app.spec.tsindex 285026df..e392a245 100644--- a/apps/desktop/e2e/creator-packaged-app.spec.ts+++ b/apps/desktop/e2e/creator-packaged-app.spec.ts@@ -37,6 +37,37 @@ 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('打包 App 的 YouTube 视频嵌入请求带有有效 HTTP 来源标识', async () => {+ const fixture = await launchCreatorDesktop({ width: 1180, height: 850 });+ try {+ await waitForWorkspace(fixture.app.page);+ const cdp = await fixture.app.page.context().newCDPSession(fixture.app.page);+ await cdp.send('Network.enable');+ const embedRequests = new Set<string>();+ let referer = '';+ cdp.on('Network.requestWillBeSent', event => {+ if (event.request.url.startsWith('https://www.youtube-nocookie.com/embed/')) {+ embedRequests.add(event.requestId);+ }+ });+ cdp.on('Network.requestWillBeSentExtraInfo', event => {+ if (embedRequests.has(event.requestId)) {+ referer = String(event.headers.Referer ?? event.headers.referer ?? '');+ }+ });+ await fixture.app.page.evaluate(() => {+ const frame = document.createElement('iframe');+ frame.title = 'YouTube embed verification';+ frame.src = 'https://www.youtube-nocookie.com/embed/M7lc1UVf-VE';+ document.body.append(frame);+ });+ await expect.poll(() => referer).toBe('https://github.com/krillinai/OpenCreator/');+ } finally {+ await closePackagedApp(fixture.app).catch(() => undefined);+ rmSync(fixture.root, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });+ }+});+test('工作台与滚动中的项目页保持相同内容边界', async () => {const fixture = await launchCreatorDesktop({ width: 1273, height: 985 });try {@@ -352,6 +383,35 @@ test('打包 App 在最小窗口宽度下保持 Creator 对话输入区贴底',}, created.body.job.id);await expect(fixture.app.page.getByRole('heading', { name: '火柴人动画' })).toBeVisible();await expect(fixture.app.page.getByRole('textbox', { name: '告诉 Agent 你的要求' })).toBeVisible();+ const preflightLayout = await fixture.app.page.evaluate(() => {+ const panel = document.querySelector('.creator-collaboration-panel')!;+ const list = panel.querySelector('.creator-collaboration-messages')!;+ const preflight = document.createElement('section');+ preflight.className = 'creator-collaboration-preflight';+ preflight.textContent = '启动前体检已通过,可以启动阶段。';+ panel.insertBefore(preflight, list);+ const gap = Math.round(list.getBoundingClientRect().top - preflight.getBoundingClientRect().bottom);+ const entryOffset = Math.round(list.firstElementChild!.getBoundingClientRect().top - list.getBoundingClientRect().top);+ preflight.remove();+ const message = document.createElement('article');+ message.className = 'creator-collaboration-message';+ message.dataset.role = 'user';+ const bubble = document.createElement('div');+ bubble.className = 'creator-collaboration-bubble';+ bubble.textContent = '测试消息';+ message.append(bubble);+ list.append(message);+ const outerBackground = getComputedStyle(message).backgroundColor;+ const outerPadding = getComputedStyle(message).padding;+ const bubbleBorder = getComputedStyle(bubble).borderStyle;+ message.remove();+ return { gap, entryOffset, outerBackground, outerPadding, bubbleBorder };+ });+ expect(preflightLayout.gap).toBeLessThanOrEqual(1);+ expect(preflightLayout.entryOffset).toBeLessThanOrEqual(24);+ expect(preflightLayout.outerBackground).toBe('rgba(0, 0, 0, 0)');+ expect(preflightLayout.outerPadding).toBe('0px');+ expect(preflightLayout.bubbleBorder).toBe('solid');await fixture.app.page.locator('.stickman-step-scroll').evaluate(element => {element.scrollTop = element.scrollHeight;});diff --git a/apps/desktop/electron-builder.yml b/apps/desktop/electron-builder.ymlindex 25d867bc..d0c556c6 100644--- a/apps/desktop/electron-builder.yml+++ b/apps/desktop/electron-builder.yml@@ -70,6 +70,7 @@ afterSign: ./scripts/notarize-after-sign.mjsmac:category: public.app-category.developer-toolsextendInfo:+ CFBundleIconName: OpenCreatorCFBundleDevelopmentRegion: zh_CNCFBundleLocalizations:- zh_CNdiff --git a/apps/desktop/package.json b/apps/desktop/package.jsonindex 6500d7f9..09a91967 100644--- a/apps/desktop/package.json+++ b/apps/desktop/package.json@@ -47,6 +47,7 @@"esbuild": "^0.25.0","fontkit": "2.0.4","node-gyp": "13.0.2",+ "sharp": "0.35.4","typescript": "^5.7.3","vite": "^6.0.7","vitest": "^3.2.7"diff --git a/apps/desktop/resources/OpenCreator.icon/icon.json b/apps/desktop/resources/OpenCreator.icon/icon.jsonnew file mode 100644index 00000000..fa414687--- /dev/null+++ b/apps/desktop/resources/OpenCreator.icon/icon.json@@ -0,0 +1,21 @@+{+ "fill-specializations": [+ { "value": { "solid": "srgb:1.00000,1.00000,1.00000,1.00000" } },+ { "appearance": "dark", "value": { "solid": "srgb:1.00000,1.00000,1.00000,1.00000" } }+ ],+ "groups": [+ {+ "layers": [+ {+ "name": "OpenCreator",+ "image-name": "mark.png",+ "glass": false+ }+ ],+ "shadow": { "kind": "neutral", "opacity": 0 },+ "specular": false,+ "translucency": { "enabled": false, "value": 0 }+ }+ ],+ "supported-platforms": { "squares": ["macOS"] }+}diff --git a/apps/desktop/scripts/mac-app-icon.mjs b/apps/desktop/scripts/mac-app-icon.mjsnew file mode 100644index 00000000..a828f156--- /dev/null+++ b/apps/desktop/scripts/mac-app-icon.mjs@@ -0,0 +1,129 @@+import { execFileSync } from 'node:child_process';+import { copyFileSync, existsSync, mkdirSync, mkdtempSync, rmSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join } from 'node:path';+import sharp from 'sharp';++export function assertMacAppIconRenditions(entries) {+ const images = [];+ for (const appearance of ['NSAppearanceNameAqua', 'NSAppearanceNameDarkAqua']) {+ const stack = entries.find(entry => (+ entry.AssetType === 'IconImageStack'+ && entry.Name === 'OpenCreator'+ && entry.Appearance === appearance+ ));+ const group = entries.find(entry => (+ entry.AssetType === 'IconGroup'+ && entry.Name === 'OpenCreator/Group'+ && entry.Appearance === appearance+ ));+ const background = stack?.Layers?.find(layer => layer.AssetType === 'Color');+ const image = group?.Layers?.find(layer => layer.AssetType === 'Image');+ if (background?.['Color components']?.length !== 4+ || background['Color components'].some(component => component !== 1)+ || !image?.SHA1Digest) {+ throw new Error(`macOS app icon is missing the white backing and image for ${appearance}.`);+ }+ images.push(image.SHA1Digest);+ }+ if (images[0] !== images[1]) {+ throw new Error('macOS light and dark app icons must use the same image.');+ }+}++export function verifyMacAppIconCatalog(path, options = {}) {+ const run = options.execFileSync ?? execFileSync;+ const entries = JSON.parse(run('xcrun', ['assetutil', '--info', path], {+ encoding: 'utf8', timeout: 30_000+ }));+ assertMacAppIconRenditions(entries);+}++export async function prepareMacAppIcon(context, options = {}) {+ if (context.electronPlatformName !== 'darwin') return;++ const run = options.execFileSync ?? execFileSync;+ const version = run('xcrun', [+ 'actool', '--version', '--output-format', 'human-readable-text'+ ], { encoding: 'utf8', timeout: 30_000 });+ const majorVersion = Number(version.match(/short-bundle-version:\s*(\d+)/)?.[1]);+ if (!Number.isInteger(majorVersion) || majorVersion < 26) {+ throw new Error('macOS app icon appearances require Xcode 26 or newer (actool >= 26).');+ }++ const iconName = 'OpenCreator';+ const resources = join(context.packager.projectDir, 'resources');+ const appResources = join(+ context.appOutDir,+ `${context.packager.appInfo.productFilename}.app`,+ 'Contents', 'Resources'+ );+ const temporary = mkdtempSync(join(tmpdir(), 'opencreator-app-icon-'));+ try {+ const source = join(temporary, `${iconName}.icon`);+ const output = join(temporary, 'compiled');+ mkdirSync(join(source, 'Assets'), { recursive: true });+ mkdirSync(output);+ copyFileSync(join(resources, `${iconName}.icon`, 'icon.json'), join(source, 'icon.json'));+ await createMacAppIconMark(+ join(resources, 'icon.png'), join(source, 'Assets', 'mark.png')+ );+ run('xcrun', [+ 'actool', source,+ '--compile', output,+ '--output-format', 'human-readable-text',+ '--output-partial-info-plist', join(output, 'icon-info.plist'),+ '--app-icon', iconName,+ '--include-all-app-icons',+ '--enable-on-demand-resources', 'NO',+ '--target-device', 'mac',+ '--minimum-deployment-target', '12.0',+ '--platform', 'macosx'+ ], { encoding: 'utf8', timeout: 120_000 });+ const catalog = join(output, 'Assets.car');+ if (!existsSync(catalog)) {+ throw new Error('actool did not generate the macOS app icon catalog.');+ }+ verifyMacAppIconCatalog(catalog, { execFileSync: run });+ mkdirSync(appResources, { recursive: true });+ copyFileSync(catalog, join(appResources, 'Assets.car'));+ } finally {+ rmSync(temporary, { recursive: true, force: true });+ }+}++export async function createMacAppIconMark(source, destination) {+ const { data, info } = await sharp(source).ensureAlpha().raw().toBuffer({ resolveWithObject: true });+ let left = info.width;+ let top = info.height;+ let right = -1;+ let bottom = -1;+ for (let y = 0; y < info.height; y++) {+ for (let x = 0; x < info.width; x++) {+ const index = (y * info.width + x) * 4;+ const alpha = data[index + 3];+ if (alpha > 0) {+ left = Math.min(left, x);+ top = Math.min(top, y);+ right = Math.max(right, x);+ bottom = Math.max(bottom, y);+ }+ const darkness = 255 - (data[index] + data[index + 1] + data[index + 2]) / 3;+ data[index] = 0;+ data[index + 1] = 0;+ data[index + 2] = 0;+ data[index + 3] = Math.round(alpha * darkness / 255);+ }+ }+ if (right < left || bottom < top) {+ throw new Error('macOS app icon source PNG is empty.');+ }+ const size = Math.max(right - left + 1, bottom - top + 1);+ const cropLeft = Math.max(0, Math.round((left + right - size + 1) / 2));+ const cropTop = Math.max(0, Math.round((top + bottom - size + 1) / 2));+ await sharp(data, { raw: { width: info.width, height: info.height, channels: 4 } })+ .extract({ left: cropLeft, top: cropTop, width: size, height: size })+ .resize(1024, 1024)+ .png()+ .toFile(destination);+}diff --git a/apps/desktop/scripts/sign-creator-runtime-after-pack.mjs b/apps/desktop/scripts/sign-creator-runtime-after-pack.mjsindex c22ee568..c6f5efa1 100644--- a/apps/desktop/scripts/sign-creator-runtime-after-pack.mjs+++ b/apps/desktop/scripts/sign-creator-runtime-after-pack.mjs@@ -14,6 +14,7 @@ import { spawnSync } from 'node:child_process';import { verifyCreatorRuntime } from './creator-runtime-contract.mjs';import { verifyStickmanRuntime } from './stickman-runtime-contract.mjs';import { findDeveloperIdIdentity } from './mac-signing.mjs';+import { prepareMacAppIcon } from './mac-app-icon.mjs';const machOMagicValues = new Set(['feedface',@@ -27,6 +28,7 @@ const machOMagicValues = new Set([]);export async function afterPack(context) {+ await prepareMacAppIcon(context);if (process.env.OPENCREATOR_SIGN_CREATOR_RUNTIME !== '1') return;await signDaemonRuntimeBundle(context);await signCreatorRuntimeBundle(context);diff --git a/apps/desktop/scripts/verify-package.mjs b/apps/desktop/scripts/verify-package.mjsindex 86768a92..a7718311 100644--- a/apps/desktop/scripts/verify-package.mjs+++ b/apps/desktop/scripts/verify-package.mjs@@ -40,6 +40,7 @@ import {findPythonRuntimeMarker,verifyStickmanBuildBinding} from './package-content-contract.mjs';+import { verifyMacAppIconCatalog } from './mac-app-icon.mjs';const scriptDir = dirname(fileURLToPath(import.meta.url));const desktopDir = resolve(scriptDir, '..');@@ -229,8 +230,18 @@ function assertBrandingContents() {throw new Error('Packaged Desktop bootstrap branding is missing OpenCreator');}- if (process.platform === 'darwin') {+ if (targetPlatform === 'darwin') {assertExists(join(resourcesDir, 'icon.icns'));+ const catalog = join(resourcesDir, 'Assets.car');+ assertExists(catalog);+ verifyMacAppIconCatalog(catalog);+ const iconName = spawnSync('plutil', [+ '-extract', 'CFBundleIconName', 'raw', '-o', '-',+ join(packageRoot, 'Contents', 'Info.plist')+ ], { encoding: 'utf8' });+ if (iconName.status !== 0 || iconName.stdout.trim() !== 'OpenCreator') {+ throw new Error('Packaged macOS app does not reference the icon appearance catalog.');+ }}}diff --git a/apps/desktop/src/main/window-manager.ts b/apps/desktop/src/main/window-manager.tsindex d8da8ff8..fc53d1bf 100644--- a/apps/desktop/src/main/window-manager.ts+++ b/apps/desktop/src/main/window-manager.ts@@ -110,6 +110,15 @@ export class WindowManager {this.startupMetrics.windowCreatedAt ??= Date.now();this.window = window;if (settings.window?.maximized === true) window.maximize();+ window.webContents.session.webRequest.onBeforeSendHeaders(+ { urls: ['https://www.youtube-nocookie.com/embed/*'] },+ (details, callback) => {+ callback({ requestHeaders: details.webContentsId === window.webContents.id+ && window.webContents.getURL().startsWith('opencreator-app://app/')+ ? youtubeEmbedRequestHeaders(details)+ : details.requestHeaders });+ }+ );window.webContents.setWindowOpenHandler(({ url }) => {if (isAllowedExternalUrl(url)) void shell.openExternal(url);return { action: 'deny' };@@ -312,6 +321,19 @@ export class WindowManager {}}+export function youtubeEmbedRequestHeaders(details: {+ url: string;+ resourceType: string;+ requestHeaders: Record<string, string>;+}): Record<string, string> {+ if (details.resourceType !== 'subFrame'+ || !/^https:\/\/www\.youtube-nocookie\.com\/embed\/[^/?#]+(?:[?#]|$)/.test(details.url)) {+ return details.requestHeaders;+ }+ // A custom-scheme document cannot supply the HTTP Referer required by YouTube embeds (error 153).+ return { ...details.requestHeaders, Referer: 'https://github.com/krillinai/OpenCreator/' };+}+export function applyWindowAction(window: Pick<BrowserWindow, 'close' | 'minimize' | 'isMaximized' | 'maximize' | 'unmaximize'>,action: DesktopWindowActiondiff --git a/apps/desktop/test/mac-app-icon.test.mjs b/apps/desktop/test/mac-app-icon.test.mjsnew file mode 100644index 00000000..d123444d--- /dev/null+++ b/apps/desktop/test/mac-app-icon.test.mjs@@ -0,0 +1,137 @@+import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join } from 'node:path';+import { afterEach, describe, expect, it, vi } from 'vitest';+import sharp from 'sharp';+import {+ assertMacAppIconRenditions,+ createMacAppIconMark,+ prepareMacAppIcon+} from '../scripts/mac-app-icon.mjs';++const temporaryDirectories = [];+afterEach(() => {+ for (const directory of temporaryDirectories.splice(0)) {+ rmSync(directory, { recursive: true, force: true });+ }+});++describe('macOS app icon appearances', () => {+ it('preserves the PNG white background and black mark in both appearances', () => {+ const icon = JSON.parse(readFileSync(+ new URL('../resources/OpenCreator.icon/icon.json', import.meta.url), 'utf8'+ ));+ expect(icon['fill-specializations']).toEqual([+ { value: { solid: 'srgb:1.00000,1.00000,1.00000,1.00000' } },+ { appearance: 'dark', value: { solid: 'srgb:1.00000,1.00000,1.00000,1.00000' } }+ ]);+ expect(icon.groups[0].layers[0]['image-name']).toBe('mark.png');+ const config = readFileSync(new URL('../electron-builder.yml', import.meta.url), 'utf8');+ expect(config).toContain('CFBundleIconName: OpenCreator');+ expect(config).toContain('icon: resources/icon.png');+ });++ it('extracts the original black mark without the PNG white rounded background', async () => {+ const output = mkdtempSync(join(tmpdir(), 'opencreator-mark-test-'));+ temporaryDirectories.push(output);+ const destination = join(output, 'mark.png');+ await createMacAppIconMark(new URL('../resources/icon.png', import.meta.url).pathname, destination);+ const { data, info } = await sharp(destination).ensureAlpha().raw().toBuffer({ resolveWithObject: true });+ expect([info.width, info.height]).toEqual([1024, 1024]);+ expect(data[3]).toBe(0);+ let opaque = 0;+ let nonBlack = 0;+ for (let index = 0; index < data.length; index += 4) {+ if (data[index] !== 0 || data[index + 1] !== 0 || data[index + 2] !== 0) nonBlack++;+ if (data[index + 3] > 200) opaque++;+ }+ expect(nonBlack).toBe(0);+ expect(opaque).toBeGreaterThan(80_000);+ });++ it('does not invoke macOS tools on other platforms', async () => {+ const run = vi.fn();+ for (const platform of ['win32', 'linux']) {+ await prepareMacAppIcon({ electronPlatformName: platform }, { execFileSync: run });+ }+ expect(run).not.toHaveBeenCalled();+ });++ it.each(['16.4', 'unknown'])('requires a supported actool version (%s)', async version => {+ await expect(prepareMacAppIcon(+ { electronPlatformName: 'darwin' },+ { execFileSync: () => `short-bundle-version: ${version}` }+ )).rejects.toThrow(/Xcode 26 or newer/);+ });++ it('derives from the source PNG and verifies the catalog before installing it', async () => {+ const context = createContext();+ let source;+ const run = vi.fn((_command, args) => {+ if (args.includes('--version')) return 'short-bundle-version: 27.0';+ if (args[0] === 'assetutil') return JSON.stringify(catalogEntries());+ source = args[1];+ expect(existsSync(join(source, 'Assets', 'mark.png'))).toBe(true);+ writeFileSync(join(args[args.indexOf('--compile') + 1], 'Assets.car'), 'icon-catalog');+ return '';+ });++ await prepareMacAppIcon(context, { execFileSync: run });+ expect(readFileSync(join(resources(context), 'Assets.car'), 'utf8')).toBe('icon-catalog');+ expect(run.mock.calls[1][1]).toContain('12.0');+ expect(existsSync(source)).toBe(false);+ });++ it('rejects incomplete or different appearances', () => {+ const entries = catalogEntries();+ expect(() => assertMacAppIconRenditions(entries)).not.toThrow();+ expect(() => assertMacAppIconRenditions(entries.filter(+ entry => entry.Appearance !== 'NSAppearanceNameDarkAqua'+ ))).toThrow(/white backing/);+ entries[2].Layers[0]['Color components'] = [0.1, 0.1, 0.1, 1];+ expect(() => assertMacAppIconRenditions(entries)).toThrow(/white backing/);+ entries[2].Layers[0]['Color components'] = [1, 1, 1, 1];+ entries[3].Layers[0].SHA1Digest = 'different';+ expect(() => assertMacAppIconRenditions(entries)).toThrow(/same image/);+ });++ it('does not install an absent catalog', async () => {+ const context = createContext();+ await expect(prepareMacAppIcon(context, {+ execFileSync: (_command, args) => (+ args.includes('--version') ? 'short-bundle-version: 27.0' : ''+ )+ })).rejects.toThrow(/did not generate/);+ expect(existsSync(join(resources(context), 'Assets.car'))).toBe(false);+ });+});++function createContext() {+ const appOutDir = mkdtempSync(join(tmpdir(), 'opencreator-icon-test-'));+ temporaryDirectories.push(appOutDir);+ return {+ electronPlatformName: 'darwin',+ appOutDir,+ packager: {+ projectDir: new URL('..', import.meta.url).pathname,+ appInfo: { productFilename: 'OpenCreator' }+ }+ };+}++function resources(context) {+ return join(context.appOutDir, 'OpenCreator.app', 'Contents', 'Resources');+}++function catalogEntries() {+ return ['NSAppearanceNameAqua', 'NSAppearanceNameDarkAqua'].flatMap(appearance => [+ {+ AssetType: 'IconImageStack', Name: 'OpenCreator', Appearance: appearance,+ Layers: [{ AssetType: 'Color', 'Color components': [1, 1, 1, 1] }]+ },+ {+ AssetType: 'IconGroup', Name: 'OpenCreator/Group', Appearance: appearance,+ Layers: [{ AssetType: 'Image', SHA1Digest: 'same-image' }]+ }+ ]);+}diff --git a/apps/desktop/test/window-manager.test.ts b/apps/desktop/test/window-manager.test.tsindex 9f7dfd75..8536c090 100644--- a/apps/desktop/test/window-manager.test.ts+++ b/apps/desktop/test/window-manager.test.ts@@ -3,7 +3,8 @@ import {applyWindowAction,DebouncedWindowStateWriter,nativeWindowBackgroundColor,- nativeWindowChromeOptions+ nativeWindowChromeOptions,+ youtubeEmbedRequestHeaders} from '../src/main/window-manager.js';describe('Window state debounce', () => {@@ -25,6 +26,23 @@ describe('Window state debounce', () => {});describe('Native window chrome', () => {+ it('identifies only YouTube embed navigations from the desktop app', () => {+ const requestHeaders = { Accept: 'text/html' };+ expect(youtubeEmbedRequestHeaders({+ url: 'https://www.youtube-nocookie.com/embed/M7lc1UVf-VE',+ resourceType: 'subFrame',+ requestHeaders+ })).toEqual({ ...requestHeaders, Referer: 'https://github.com/krillinai/OpenCreator/' });+ for (const [url, resourceType] of [+ ['https://www.youtube-nocookie.com/embed/M7lc1UVf-VE', 'mainFrame'],+ ['https://www.youtube-nocookie.com/youtubei/v1/player', 'xhr'],+ ['https://example.com/embed/M7lc1UVf-VE', 'subFrame']+ ]) {+ expect(youtubeEmbedRequestHeaders({ url: url!, resourceType: resourceType!, requestHeaders }))+ .toBe(requestHeaders);+ }+ });+it('keeps close behavior and toggles native minimize and zoom actions', () => {const window = {close: vi.fn(),diff --git a/apps/web/e2e/web-desktop-parity.spec.ts b/apps/web/e2e/web-desktop-parity.spec.tsindex 62cb35f4..c5200f84 100644--- a/apps/web/e2e/web-desktop-parity.spec.ts+++ b/apps/web/e2e/web-desktop-parity.spec.ts@@ -6,6 +6,7 @@ test('Agent 面板在 Browser/Desktop Bridge 下均不显示产物版本详情',const created = await runtime.api<{ job: { id: string } }>('POST', '/creator/jobs', {projectId: runtime.projectId, templateId: 'image-generation', state: { prompt: 'Agent 面板验收', currentStep: 1, furthestStep: 1 }});+ const layouts = [];for (const platform of ['browser', 'desktop'] as const) {const context = await browser.newContext({ viewport: { width: 1440, height: 900 }, deviceScaleFactor: 1, reducedMotion: 'reduce' });const page = await context.newPage();@@ -15,8 +16,24 @@ test('Agent 面板在 Browser/Desktop Bridge 下均不显示产物版本详情',await page.goto(`${runtime.origin}/#/workbench?tool=image-generation&jobId=${created.job.id}`);await expect(page.getByText('当前任务', { exact: true })).toBeVisible();await expect(page.getByText('产物版本与来源', { exact: true })).toHaveCount(0);+ const layout = await page.evaluate(() => {+ const panel = document.querySelector('.creator-collaboration-panel')!;+ const list = panel.querySelector('.creator-collaboration-messages')!;+ const preflight = document.createElement('section');+ preflight.className = 'creator-collaboration-preflight';+ preflight.textContent = '启动前体检已通过,可以启动阶段。';+ panel.insertBefore(preflight, list);+ const gap = Math.round(list.getBoundingClientRect().top - preflight.getBoundingClientRect().bottom);+ const entryOffset = Math.round(list.firstElementChild!.getBoundingClientRect().top - list.getBoundingClientRect().top);+ preflight.remove();+ return { gap, entryOffset };+ });+ expect(layout.gap).toBeLessThanOrEqual(1);+ expect(layout.entryOffset).toBeLessThanOrEqual(24);+ layouts.push(layout);} finally { await context.close(); }}+ expect(layouts[1]).toEqual(layouts[0]);});test('本地字幕导入在 Browser/Desktop Bridge 下保持相同命令和界面', async ({ browser, runtime }, testInfo) => {diff --git a/apps/web/src/features/dashboard/CoverGeneratorWorkspace.test.tsx b/apps/web/src/features/dashboard/CoverGeneratorWorkspace.test.tsxindex 8e11f207..63ac89a3 100644--- a/apps/web/src/features/dashboard/CoverGeneratorWorkspace.test.tsx+++ b/apps/web/src/features/dashboard/CoverGeneratorWorkspace.test.tsx@@ -381,6 +381,12 @@ describe('CoverGeneratorWorkspace', () => {expect(screen.getAllByText(/已完成 1\/2/).length).toBeGreaterThanOrEqual(2);expect(screen.getAllByRole('button', { name: '终止任务' }).length).toBeGreaterThanOrEqual(1);+ const iconButtons = screen.getAllByRole('button', { name: '终止任务' })+ .filter(button => button.querySelector('.lucide-square'));+ expect(iconButtons.length).toBeGreaterThan(0);+ for (const button of iconButtons) {+ expect(button.querySelector('.lucide-square')).toHaveAttribute('fill', 'currentColor');+ }});it('shows the same normalized YouTube workflow progress in both panels', () => {diff --git a/apps/web/src/features/dashboard/CoverGeneratorWorkspace.tsx b/apps/web/src/features/dashboard/CoverGeneratorWorkspace.tsxindex 48607119..ac5f2529 100644--- a/apps/web/src/features/dashboard/CoverGeneratorWorkspace.tsx+++ b/apps/web/src/features/dashboard/CoverGeneratorWorkspace.tsx@@ -9,7 +9,6 @@ import {} from '@opencreator/protocol';import {Check,- CircleStop,Download,ImagePlus,Images,@@ -18,6 +17,7 @@ import {RotateCcw,Settings2,Sparkles,+ Square,UploadCloud,X} from 'lucide-react';@@ -1142,7 +1142,7 @@ export default function CoverGeneratorWorkspace(props: {) : null}{currentStep === 2 && generating ? (<button className="video-translation-primary-action" data-intent="danger" type="button" disabled={taskControlPending !== undefined} onClick={() => void cancelTask()}>- <CircleStop size={16} />+ <Square size={16} fill="currentColor" aria-hidden="true" />{taskControlPending === 'canceling' ? l('正在终止...', 'Stopping...') : l('终止任务', 'Stop task')}</button>) : null}diff --git a/apps/web/src/features/dashboard/CreatorCollaborationPanel.test.tsx b/apps/web/src/features/dashboard/CreatorCollaborationPanel.test.tsxindex fb3ff729..4481e636 100644--- a/apps/web/src/features/dashboard/CreatorCollaborationPanel.test.tsx+++ b/apps/web/src/features/dashboard/CreatorCollaborationPanel.test.tsx@@ -1,6 +1,6 @@import type { CreatorJob } from '@opencreator/protocol';import { useEffect } from 'react';-import { render, screen, waitFor } from '@testing-library/react';+import { fireEvent, render, screen, waitFor } from '@testing-library/react';import { describe, expect, it, vi } from 'vitest';import { LanguageProvider } from '../../i18n/LanguageProvider.js';import CreatorCollaborationPanel from './CreatorCollaborationPanel.js';@@ -24,6 +24,30 @@ function PreflightHarness(props: { stageId: string }) {return null;}+function TimelineUpdateHarness() {+ const session = useCreatorSession();+ return (+ <button type="button" onClick={() => {+ const nextRevision = session.job.revision + 1;+ session.applyRemoteSnapshot({+ ...session.job,+ revision: nextRevision,+ updatedAt: `2026-09-07T08:00:0${nextRevision}.000Z`,+ activities: [...session.job.activities, {+ id: `new_activity_${nextRevision}`,+ jobId: session.job.id,+ revision: nextRevision,+ actor: 'user',+ action: 'update-settings:draft',+ summary: '更新创作设置',+ details: { objectId: 'prompt' },+ createdAt: `2026-09-07T08:00:0${nextRevision}.000Z`+ }]+ });+ }}>Update timeline</button>+ );+}+describe('Short video script panel', () => {it('语义化并合并短视频脚本设置动态,同时显示标准 Stage 状态和真实进度', () => {render(@@ -58,6 +82,41 @@ describe('Short video script panel', () => {});describe('CreatorCollaborationPanel', () => {+ it('keeps entries in top-down order and follows new activity only while reading the latest entries', () => {+ render(+ <LanguageProvider initialPreference="zh-CN">+ <CreatorSessionProvider+ initialJob={videoGenerationJob()}+ service={{ applyAction: vi.fn(), runAgentTurn: vi.fn() } as never}+ >+ <CreatorCollaborationPanel+ adapter={videoGenerationPanelAdapter}+ stepLabel="生成视频"+ contextSummary="Veo"+ />+ <TimelineUpdateHarness />+ </CreatorSessionProvider>+ </LanguageProvider>+ );+ const log = screen.getByRole('log', { name: '协作时间线' });+ expect(log.firstElementChild).toHaveClass('creator-collaboration-activity');+ expect(log.lastElementChild).toHaveClass('creator-collaboration-stage');+ Object.defineProperties(log, {+ clientHeight: { configurable: true, value: 100 },+ scrollHeight: { configurable: true, value: 500 }+ });++ log.scrollTop = 0;+ fireEvent.scroll(log);+ fireEvent.click(screen.getByRole('button', { name: 'Update timeline' }));+ expect(log.scrollTop).toBe(0);++ log.scrollTop = 400;+ fireEvent.scroll(log);+ fireEvent.click(screen.getByRole('button', { name: 'Update timeline' }));+ expect(log.scrollTop).toBe(500);+ });+it.each([{module: 'image-generation' as const,@@ -643,7 +702,8 @@ describe('CreatorCollaborationPanel', () => {expect(screen.getByText('20%')).toBeInTheDocument();expect(screen.getByRole('progressbar', { name: '生成配音进度' })).toHaveAttribute('aria-valuenow', '20');- expect(screen.getByRole('button', { name: '终止生成配音' })).toBeInTheDocument();+ expect(screen.getByRole('button', { name: '终止生成配音' }).querySelector('.lucide-square'))+ .toHaveAttribute('fill', 'currentColor');expect(container.querySelectorAll('.creator-collaboration-stage')).toHaveLength(1);});diff --git a/apps/web/src/features/dashboard/CreatorCollaborationPanel.tsx b/apps/web/src/features/dashboard/CreatorCollaborationPanel.tsxindex 391b5149..c98b8688 100644--- a/apps/web/src/features/dashboard/CreatorCollaborationPanel.tsx+++ b/apps/web/src/features/dashboard/CreatorCollaborationPanel.tsx@@ -9,15 +9,15 @@ import type {import {CheckCircle2,CircleDot,- CircleStop,LoaderCircle,MessageSquareText,Play,ServerOff,Sparkles,+ Square,XCircle} from 'lucide-react';-import { useEffect, useMemo, useRef, useState } from 'react';+import { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';import OpenCreatorMark from '../../components/brand/OpenCreatorMark.js';import { MarkdownRenderer } from '../../components/markdown/MarkdownRenderer.js';import { useLocalizedCopy } from '../../i18n/useLocalizedCopy.js';@@ -100,6 +100,7 @@ export default function CreatorCollaborationPanel(props: {const sendingRef = useRef(false);const permissionSessionRef = useRef<string | null>(null);const messageListRef = useRef<HTMLDivElement | null>(null);+ const followTimelineRef = useRef(true);const agentTurns = useMemo(() => session?.turns.filter(turn => ((turn.role === 'user' || turn.role === 'assistant')&& (turn.content.trim().length > 0 || ['queued', 'running', 'waiting_approval'].includes(turn.status))@@ -153,14 +154,11 @@ export default function CreatorCollaborationPanel(props: {if (sandbox === 'workspace-write') setPermission('approval');}, [session?.agentSession?.id, session?.agentSession?.sandbox]);- useEffect(() => {+ useLayoutEffect(() => {const list = messageListRef.current;- if (list !== null) list.scrollTop = list.scrollHeight;+ if (list !== null && followTimelineRef.current) list.scrollTop = list.scrollHeight;}, [- conversationMessages.at(-1)?.content,- conversationMessages.at(-1)?.status,- session?.job.updatedAt,- timelineItems.at(-1)?.id,+ timelineItems,pendingApprovals.length,session?.agentBusy,showAgentWorking@@ -217,7 +215,7 @@ export default function CreatorCollaborationPanel(props: {aria-label={l('停止 Agent 对话', 'Stop Agent conversation')}title={l('停止 Agent 对话', 'Stop Agent conversation')}>- <CircleStop size={15} strokeWidth={1.9} aria-hidden="true" />+ <Square size={15} fill="currentColor" aria-hidden="true" /></button>) : null}</header>@@ -265,6 +263,10 @@ export default function CreatorCollaborationPanel(props: {<divref={messageListRef}className="creator-collaboration-messages"+ onScroll={event => {+ const list = event.currentTarget;+ followTimelineRef.current = list.scrollHeight - list.clientHeight - list.scrollTop <= 24;+ }}role="log"aria-label={l('协作时间线', 'Collaboration timeline')}aria-live="polite"@@ -467,7 +469,7 @@ function CollaborationStageView(props: {aria-label={l(`终止${label}`, `Stop ${label}`)}title={l('终止当前阶段', 'Stop current stage')}>- <CircleStop size={14} strokeWidth={1.9} aria-hidden="true" />+ <Square size={14} fill="currentColor" aria-hidden="true" /></button>) : props.onResume !== undefined ? (<button@@ -802,7 +804,7 @@ function stageStatusIcon(stage: CreatorStageRun) {return <LoaderCircle className="creator-collaboration-spin" size={15} strokeWidth={1.8} />;}if (stage.status === 'canceled' || stage.status === 'interrupted') {- return <CircleStop size={14} strokeWidth={1.8} />;+ return <Square size={14} fill="currentColor" />;}return <CheckCircle2 size={15} strokeWidth={1.8} />;}diff --git a/apps/web/src/features/dashboard/VideoTranslationResultWorkspace.test.tsx b/apps/web/src/features/dashboard/VideoTranslationResultWorkspace.test.tsxindex 92b89bd4..e638463d 100644--- a/apps/web/src/features/dashboard/VideoTranslationResultWorkspace.test.tsx+++ b/apps/web/src/features/dashboard/VideoTranslationResultWorkspace.test.tsx@@ -129,7 +129,7 @@ describe('VideoTranslationResultWorkspace', () => {const onExport = vi.fn();const onSubtitleChange = vi.fn();const onSaveSubtitles = vi.fn();- render(+ const { container } = render(<VideoTranslationResultWorkspace{...baseProps}activeTab="subtitles"@@ -170,8 +170,13 @@ describe('VideoTranslationResultWorkspace', () => {expect(screen.getByRole('radio', { name: '竖屏' })).toHaveAttribute('aria-checked', 'false');const horizontal = screen.getByRole('textbox', { name: '横屏字幕 1' });expect(horizontal).not.toHaveAttribute('readonly');+ expect(screen.queryByRole('heading', { name: '横屏字幕' })).not.toBeInTheDocument();+ expect(screen.getByRole('list', { name: '横屏字幕内容' }).querySelectorAll('[data-subtitle-cue]'))+ .toHaveLength(1);expect(screen.queryByRole('textbox', { name: '竖屏字幕 1' })).not.toBeInTheDocument();- expect(screen.getByText('00:00:00,000 - 00:00:01,000')).toBeInTheDocument();+ expect(screen.getByText('00:00–00:01')).toBeInTheDocument();+ expect(screen.getByRole('button', { name: '跳转到 00:00:00,000' })).toHaveTextContent('00:00–00:01');+ expect(horizontal).toHaveAttribute('rows', '1');fireEvent.change(horizontal, { target: { value: '修改后的横屏字幕' } });expect(onSubtitleChange).toHaveBeenCalledWith('horizontal', 1, '修改后的横屏字幕');fireEvent.click(screen.getByRole('button', { name: '保存横屏字幕' }));@@ -187,15 +192,40 @@ describe('VideoTranslationResultWorkspace', () => {expect(onSaveSubtitles).toHaveBeenCalledWith('vertical');expect(screen.queryByRole('textbox', { name: '横屏字幕 1' })).not.toBeInTheDocument();expect(screen.getByRole('radio', { name: '竖屏' })).toHaveAttribute('aria-checked', 'true');+ expect(screen.getByRole('list', { name: '竖屏字幕内容' })).toBeInTheDocument();+ expect(screen.queryByRole('heading', { name: '竖屏字幕' })).not.toBeInTheDocument();const verticalVideo = screen.getByLabelText('竖屏字幕视频预览');expect(verticalVideo).toHaveAttribute('src', 'blob:http://localhost/horizontal-source-video');expect(verticalVideo.parentElement).toHaveAttribute('data-ratio', '9:16');+ Object.defineProperties(verticalVideo, {+ videoWidth: { configurable: true, value: 1920 },+ videoHeight: { configurable: true, value: 1080 }+ });+ fireEvent.loadedMetadata(verticalVideo);+ expect(verticalVideo.parentElement).toHaveAttribute('data-ratio', '9:16');+ fireEvent.click(screen.getByRole('radio', { name: '横屏' }));+ expect(screen.getByRole('radio', { name: '横屏' })).toHaveAttribute('aria-checked', 'true');+ expect(container.querySelector('.video-result-player-frame')).toHaveAttribute('data-ratio', '16:9');expect(screen.queryByText('target_language_srt.srt')).not.toBeInTheDocument();expect(screen.queryByText('short_origin_mixed_srt.srt')).not.toBeInTheDocument();expect(screen.queryByRole('button', { name: '下载横屏字幕' })).not.toBeInTheDocument();expect(screen.queryByRole('button', { name: '下载竖屏字幕' })).not.toBeInTheDocument();});+ it('keeps the read-only status in the page heading without repeating a list heading', () => {+ render(+ <VideoTranslationResultWorkspace+ {...baseProps}+ activeTab="subtitles"+ subtitleOutputs={[{ ...baseProps.subtitleOutputs[0]!, readOnly: true }]}+ />+ );++ expect(screen.getByText('项目 V1 · 1 条字幕 · 已保存 · 只读')).toBeInTheDocument();+ expect(screen.getByRole('list', { name: '横屏字幕内容' })).toBeInTheDocument();+ expect(screen.queryByRole('heading', { name: '横屏字幕' })).not.toBeInTheDocument();+ });+it('shows bilingual subtitle lines in the requested order while keeping the translation editable', () => {render(<VideoTranslationResultWorkspace@@ -223,12 +253,141 @@ describe('VideoTranslationResultWorkspace', () => {expect(translation).not.toHaveAttribute('readonly');expect(source).toHaveValue('Source below');expect(source).not.toHaveAttribute('readonly');+ expect(source).toHaveAttribute('rows', '1');+ expect(translation).toHaveAttribute('rows', '1');fireEvent.change(source, { target: { value: 'Corrected source' } });expect(baseProps.onSubtitleChange).toHaveBeenCalledWith('horizontal', 1, 'Corrected source', 'sourceText');expect(translation.compareDocumentPosition(source) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();expect(cue).toContainElement(source);});+ it('groups vertical cues within the longer timestamp while preserving editing and playback by cue ID', () => {+ const onSubtitleChange = vi.fn();+ render(+ <VideoTranslationResultWorkspace+ {...baseProps}+ activeTab="subtitles"+ subtitleVideoPreviews={{ vertical: {+ artifactId: 'vertical-video-v1',+ src: 'blob:http://localhost/vertical-video',+ source: false+ } }}+ subtitleOutputs={[{+ artifactId: 'vertical-subtitle-v1',+ variant: 'vertical',+ artifactVersion: 1,+ cues: [+ { id: 4, start: '00:00:01,000', end: '00:00:02,000', text: '我很乐意。' },+ { id: 5, start: '00:00:01,000', end: '00:00:02,000', text: "I'm happy to do it." },+ { id: 6, start: '00:00:02,000', end: '00:00:03,000', text: '另一句译文' },+ { id: 7, start: '00:00:02,250', end: '00:00:03,000', text: 'Other source' }+ ],+ readOnly: false+ }]}+ onSubtitleChange={onSubtitleChange}+ />+ );++ const list = screen.getByRole('list', { name: '竖屏字幕内容' });+ expect(list.querySelectorAll('[data-subtitle-cue]')).toHaveLength(2);+ const translation = screen.getByRole('textbox', { name: '竖屏字幕 1' });+ const source = screen.getByRole('textbox', { name: '竖屏字幕 2' });+ expect(translation.closest('[data-subtitle-cue]')).toBe(source.closest('[data-subtitle-cue]'));+ expect(translation.closest('[data-subtitle-cue]')).toHaveTextContent('00:01–00:02');+ expect(screen.getAllByText('00:02–00:03')).toHaveLength(1);+ expect(screen.getByRole('textbox', { name: '竖屏字幕 3' }).closest('[data-subtitle-cue]'))+ .toBe(screen.getByRole('textbox', { name: '竖屏字幕 4' }).closest('[data-subtitle-cue]'));++ fireEvent.change(translation, { target: { value: '很高兴。' } });+ fireEvent.change(source, { target: { value: 'Happy to help.' } });+ expect(onSubtitleChange).toHaveBeenNthCalledWith(1, 'vertical', 4, '很高兴。');+ expect(onSubtitleChange).toHaveBeenNthCalledWith(2, 'vertical', 5, 'Happy to help.');++ const video = screen.getByLabelText('竖屏字幕视频预览') as HTMLVideoElement;+ fireEvent.timeUpdate(video, { target: { currentTime: 1.5 } });+ expect(translation.closest('[data-subtitle-cue]')).toHaveAttribute('data-active', 'true');+ fireEvent.click(screen.getByRole('button', { name: '跳转到 00:00:02,000' }));+ expect(video.currentTime).toBe(2);+ expect(screen.getByRole('textbox', { name: '竖屏字幕 4' }).closest('[data-subtitle-cue]'))+ .toHaveAttribute('data-active', 'true');+ fireEvent.click(screen.getByRole('button', { name: '跳转到 00:00:01,000' }));+ expect(video.currentTime).toBe(1);+ expect(list.querySelectorAll('[data-subtitle-cue][data-active="true"]')).toHaveLength(1);+ });++ it('keeps consecutive split source lines under a longer vertical subtitle without swallowing overlapping cues', () => {+ const onSubtitleChange = vi.fn();+ render(+ <VideoTranslationResultWorkspace+ {...baseProps}+ activeTab="subtitles"+ subtitleVideoPreviews={{ vertical: {+ artifactId: 'vertical-video-v1',+ src: 'blob:http://localhost/vertical-video',+ source: false+ } }}+ subtitleOutputs={[{+ artifactId: 'vertical-subtitle-v1',+ variant: 'vertical',+ artifactVersion: 1,+ cues: [+ { id: 1, start: '00:00:00,000', end: '00:00:02,000', text: 'Jensen, 谢谢你今天这么做。' },+ { id: 2, start: '00:00:00,000', end: '00:00:01,000', text: 'Jensen, thank you' },+ { id: 3, start: '00:00:01,000', end: '00:00:02,000', text: 'for doing this today.' },+ { id: 4, start: '00:00:01,500', end: '00:00:03,000', text: '跨过边界的字幕' },+ { id: 5, start: '00:00:03,000', end: '00:00:04,000', text: '下一句译文' },+ { id: 6, start: '00:00:03,000', end: '00:00:04,000', text: 'Next source' }+ ],+ readOnly: false+ }]}+ onSubtitleChange={onSubtitleChange}+ />+ );++ const list = screen.getByRole('list', { name: '竖屏字幕内容' });+ expect(list.querySelectorAll('[data-subtitle-cue]')).toHaveLength(3);+ const first = screen.getByRole('textbox', { name: '竖屏字幕 1' }).closest('[data-subtitle-cue]');+ expect(first).toHaveTextContent('00:00–00:02');+ expect(first).toContainElement(screen.getByRole('textbox', { name: '竖屏字幕 2' }));+ expect(first).toContainElement(screen.getByRole('textbox', { name: '竖屏字幕 3' }));+ expect(screen.queryByRole('button', { name: '跳转到 00:00:01,000' })).not.toBeInTheDocument();+ expect(screen.getByRole('textbox', { name: '竖屏字幕 4' }).closest('[data-subtitle-cue]'))+ .not.toBe(first);+ expect(screen.getByRole('textbox', { name: '竖屏字幕 5' }).closest('[data-subtitle-cue]'))+ .toContainElement(screen.getByRole('textbox', { name: '竖屏字幕 6' }));++ fireEvent.change(screen.getByRole('textbox', { name: '竖屏字幕 3' }), { target: { value: 'for helping today.' } });+ expect(onSubtitleChange).toHaveBeenCalledWith('vertical', 3, 'for helping today.');+ const video = screen.getByLabelText('竖屏字幕视频预览') as HTMLVideoElement;+ fireEvent.click(screen.getByRole('button', { name: '跳转到 00:00:00,000' }));+ expect(video.currentTime).toBe(0);+ fireEvent.timeUpdate(video, { target: { currentTime: 1.25 } });+ expect(first).toHaveAttribute('data-active', 'true');+ fireEvent.timeUpdate(video, { target: { currentTime: 2.5 } });+ expect(first).toHaveAttribute('data-active', 'false');+ expect(screen.getByRole('textbox', { name: '竖屏字幕 4' }).closest('[data-subtitle-cue]'))+ .toHaveAttribute('data-active', 'true');+ });++ it('does not combine horizontal cues even when they have matching timestamps', () => {+ render(+ <VideoTranslationResultWorkspace+ {...baseProps}+ activeTab="subtitles"+ subtitleOutputs={[{+ ...baseProps.subtitleOutputs[0]!,+ cues: [+ { id: 1, start: '00:00:01,000', end: '00:00:02,000', text: '第一条' },+ { id: 2, start: '00:00:01,000', end: '00:00:02,000', text: '第二条' }+ ]+ }]}+ />+ );++ expect(screen.getByRole('list', { name: '横屏字幕内容' }).querySelectorAll('[data-subtitle-cue]'))+ .toHaveLength(2);+ });+it('keeps video playback and subtitle cues synchronized', () => {render(<VideoTranslationResultWorkspace@@ -254,6 +413,7 @@ describe('VideoTranslationResultWorkspace', () => {const video = screen.getByLabelText('横屏字幕视频预览') as HTMLVideoElement;expect(video).toHaveAttribute('src', 'blob:http://localhost/source-video');expect(screen.getByText('当前使用原视频同步预览')).toBeInTheDocument();+ expect(screen.getByRole('list', { name: '横屏字幕内容' }).querySelectorAll('[data-subtitle-cue]')).toHaveLength(2);fireEvent.timeUpdate(video, { target: { currentTime: 1.5 } });expect(screen.getByRole('textbox', { name: '横屏字幕 2' }).closest('[data-subtitle-cue]'))diff --git a/apps/web/src/features/dashboard/VideoTranslationResultWorkspace.tsx b/apps/web/src/features/dashboard/VideoTranslationResultWorkspace.tsxindex 94a3fbd9..1df44912 100644--- a/apps/web/src/features/dashboard/VideoTranslationResultWorkspace.tsx+++ b/apps/web/src/features/dashboard/VideoTranslationResultWorkspace.tsx@@ -140,6 +140,9 @@ export default function VideoTranslationResultWorkspace(props: {)) ?? [];const activeSubtitleCueIds = new Set(activeSubtitleCues.map(cue => cue.id));const activeSubtitleCueKey = activeSubtitleCues.map(cue => cue.id).join('|');+ const subtitleCueGroups = activeSubtitleOutput === undefined+ ? []+ : groupSubtitleCues(activeSubtitleOutput.cues, activeSubtitleOutput.variant);const subtitleCueCount = props.subtitleOutputs.reduce((total, output) => total + output.cues.length, 0);const generatedArtifactCount = props.videoOutputs.length+ props.subtitleOutputs.length@@ -335,7 +338,7 @@ export default function VideoTranslationResultWorkspace(props: {) : null}{props.activeTab === 'subtitles' ? (- <div className="video-result-pane">+ <div className="video-result-pane video-result-subtitle-pane"><header className="video-result-pane-heading"><div><h2>{l('字幕', 'Subtitles')}</h2>@@ -347,6 +350,7 @@ export default function VideoTranslationResultWorkspace(props: {: ` · ${activeSubtitleDirty? l('有未保存修改', 'Unsaved changes'): l('已保存', 'Saved')}`}+ {activeSubtitleOutput?.readOnly ? ` · ${l('只读', 'Read only')}` : ''}</p></div><div className="video-result-pane-actions">@@ -431,79 +435,83 @@ export default function VideoTranslationResultWorkspace(props: {</section><section className="video-result-output-column" data-variant={activeSubtitleOutput.variant}>- <div className="video-result-output-heading">- <div>- <h3>{subtitleVariantLabel(activeSubtitleOutput.variant, l)}</h3>- <small>- {l('子项', 'Item')} V{activeSubtitleOutput.artifactVersion}- {' · '}{activeSubtitleOutput.cues.length} {l('条字幕', 'subtitles')}- {activeSubtitleOutput.readOnly ? ` · ${l('只读', 'Read only')}` : ''}- </small>- </div>- </div>{activeSubtitleOutput.cues.length > 0 ? (<divclassName="video-subtitle-editor"+ role="list"aria-label={l(`${subtitleVariantLabel(activeSubtitleOutput.variant, l)}内容`,`${subtitleVariantLabel(activeSubtitleOutput.variant, l)} content`)}>- {activeSubtitleOutput.cues.map((cue, index) => {- const sourceLine = cue.sourceText === undefined ? null : (- <textarea- className="video-subtitle-cue-source"- rows={2}- value={cue.sourceText}- readOnly={activeSubtitleOutput.readOnly}- onChange={activeSubtitleOutput.readOnly ? undefined : event => props.onSubtitleChange(- activeSubtitleOutput.variant, cue.id, event.target.value, 'sourceText'- )}- aria-label={l(- `${subtitleVariantLabel(activeSubtitleOutput.variant, l)}原文 ${index + 1}`,- `${subtitleVariantLabel(activeSubtitleOutput.variant, l)} source ${index + 1}`- )}- />- );- const translationLine = (- <textarea- rows={2}- value={cue.text}- readOnly={activeSubtitleOutput.readOnly}- onChange={activeSubtitleOutput.readOnly- ? undefined- : event => props.onSubtitleChange(- activeSubtitleOutput.variant,- cue.id,- event.target.value- )}- aria-label={`${subtitleVariantLabel(activeSubtitleOutput.variant, l)} ${index + 1}`}- />- );+ {subtitleCueGroups.map((group, groupIndex) => {+ const firstCue = group[0]!.cue;return (<divclassName="video-subtitle-cue"- data-active={activeSubtitleCueIds.has(cue.id)}+ role="listitem"+ data-active={group.some(({ cue }) => activeSubtitleCueIds.has(cue.id))}data-subtitle-cue="true"- key={cue.id}+ key={firstCue.id}ref={node => {- if (node === null) subtitleCueRefs.current.delete(cue.id);- else subtitleCueRefs.current.set(cue.id, node);+ for (const { cue } of group) {+ if (node === null) subtitleCueRefs.current.delete(cue.id);+ else subtitleCueRefs.current.set(cue.id, node);+ }}}><buttontype="button"className="video-subtitle-cue-time"- onClick={() => seekToSubtitleCue(cue)}- aria-label={l(`跳转到 ${cue.start}`, `Jump to ${cue.start}`)}+ onClick={() => seekToSubtitleCue(firstCue)}+ aria-label={l(`跳转到 ${firstCue.start}`, `Jump to ${firstCue.start}`)}>- <span>{String(index + 1).padStart(2, '0')}</span>- <small>{cue.start} - {cue.end}</small>+ <span>{String(groupIndex + 1).padStart(2, '0')}</span>+ <small title={`${firstCue.start} - ${firstCue.end}`}>+ {subtitleCueShortTime(firstCue.start)}–{subtitleCueShortTime(firstCue.end)}+ </small></button><div className="video-subtitle-cue-lines">- {activeSubtitleOutput.translationPosition === 'bottom' ? sourceLine : null}- {translationLine}- {activeSubtitleOutput.translationPosition !== 'bottom' ? sourceLine : null}+ {group.map(({ cue, index }, lineIndex) => {+ const sourceLine = cue.sourceText === undefined ? null : (+ <textarea+ className="video-subtitle-cue-source"+ rows={1}+ value={cue.sourceText}+ readOnly={activeSubtitleOutput.readOnly}+ onChange={activeSubtitleOutput.readOnly ? undefined : event => props.onSubtitleChange(+ activeSubtitleOutput.variant, cue.id, event.target.value, 'sourceText'+ )}+ aria-label={l(+ `${subtitleVariantLabel(activeSubtitleOutput.variant, l)}原文 ${index + 1}`,+ `${subtitleVariantLabel(activeSubtitleOutput.variant, l)} source ${index + 1}`+ )}+ />+ );+ const translationLine = (+ <textarea+ className={lineIndex > 0 ? 'video-subtitle-cue-source' : 'video-subtitle-cue-translation'}+ rows={1}+ value={cue.text}+ readOnly={activeSubtitleOutput.readOnly}+ onChange={activeSubtitleOutput.readOnly+ ? undefined+ : event => props.onSubtitleChange(+ activeSubtitleOutput.variant,+ cue.id,+ event.target.value+ )}+ aria-label={`${subtitleVariantLabel(activeSubtitleOutput.variant, l)} ${index + 1}`}+ />+ );+ return (+ <div className="video-subtitle-cue-pair" key={cue.id}>+ {activeSubtitleOutput.translationPosition === 'bottom' ? sourceLine : null}+ {translationLine}+ {activeSubtitleOutput.translationPosition !== 'bottom' ? sourceLine : null}+ </div>+ );+ })}</div></div>);@@ -689,3 +697,34 @@ function subtitleTimestampSeconds(value: string): number {+ Number(match[3])+ milliseconds / 1000;}++function subtitleCueShortTime(value: string): string {+ const match = /^(\d+):(\d{2}):(\d{2})/.exec(value.trim());+ if (match === null) return value;+ return Number(match[1]) === 0+ ? `${match[2]}:${match[3]}`+ : `${match[1]}:${match[2]}:${match[3]}`;+}++function groupSubtitleCues(cues: SubtitleCue[], variant: SubtitleResultVariant) {+ const groups: Array<Array<{ cue: SubtitleCue; index: number }>> = [];+ cues.forEach((cue, index) => {+ const previous = groups[groups.length - 1];+ const firstCue = previous?.[0]?.cue;+ const firstStart = subtitleTimestampSeconds(firstCue?.start ?? '');+ const firstEnd = subtitleTimestampSeconds(firstCue?.end ?? '');+ const start = subtitleTimestampSeconds(cue.start);+ const end = subtitleTimestampSeconds(cue.end);+ const sameTime = firstStart === start && firstEnd === end;+ if (variant === 'vertical' && previous !== undefined+ && Number.isFinite(firstStart) && Number.isFinite(firstEnd)+ && Number.isFinite(start) && Number.isFinite(end) && end > start+ && start >= firstStart && end <= firstEnd+ && (!sameTime || previous.length === 1)) {+ previous.push({ cue, index });+ } else {+ groups.push([{ cue, index }]);+ }+ });+ return groups;+}diff --git a/apps/web/src/features/dashboard/VideoTranslationWorkspace.control.test.tsx b/apps/web/src/features/dashboard/VideoTranslationWorkspace.control.test.tsxindex 3313c023..6e5f7615 100644--- a/apps/web/src/features/dashboard/VideoTranslationWorkspace.control.test.tsx+++ b/apps/web/src/features/dashboard/VideoTranslationWorkspace.control.test.tsx@@ -768,12 +768,16 @@ describe('VideoTranslationWorkspace task controls', () => {);const workspace = screen.getByRole('region', { name: '视频翻译操作区' });- expect(await within(workspace).findByRole('button', { name: '终止任务' })).toBeInTheDocument();- expect(screen.getByRole('button', { name: '终止字幕翻译' })).toBeInTheDocument();+ const stopButton = await within(workspace).findByRole('button', { name: '终止任务' });+ expect(stopButton.querySelector('.lucide-square')).toHaveAttribute('fill', 'currentColor');+ expect(screen.getByRole('button', { name: '终止字幕翻译' }).querySelector('.lucide-square'))+ .toHaveAttribute('fill', 'currentColor');expect(within(workspace).queryByRole('button', { name: '开始翻译' })).not.toBeInTheDocument();fireEvent.click(within(workspace).getByRole('button', { name: '终止任务' }));const dialog = screen.getByRole('dialog', { name: '终止翻译任务?' });+ expect(within(dialog).getByRole('button', { name: '终止任务' }).querySelector('.lucide-square'))+ .toHaveAttribute('fill', 'currentColor');expect(dialog).toHaveTextContent('当前正在执行“字幕翻译”,进度 4%');expect(dialog).toHaveTextContent('当前 4% 的阶段内进度不会保留');expect(within(dialog).getByRole('button', { name: '取消' })).toBeInTheDocument();@@ -784,6 +788,8 @@ describe('VideoTranslationWorkspace task controls', () => {await waitFor(() => expect(resumeButton).toBeEnabled());expect(screen.getByRole('button', { name: '继续字幕翻译' })).toBeInTheDocument();expect(screen.getByText('已终止,可继续')).toBeInTheDocument();+ expect(screen.getByText('已终止,可继续').closest('[data-status="canceled"]')?.querySelector('.lucide-square'))+ .toHaveAttribute('fill', 'currentColor');fireEvent.click(resumeButton);await waitFor(() => expect(resumeJob).toHaveBeenCalledWith('job_control'));diff --git a/apps/web/src/features/dashboard/VideoTranslationWorkspace.tsx b/apps/web/src/features/dashboard/VideoTranslationWorkspace.tsxindex 2b3d8ac6..5f21b7db 100644--- a/apps/web/src/features/dashboard/VideoTranslationWorkspace.tsx+++ b/apps/web/src/features/dashboard/VideoTranslationWorkspace.tsx@@ -11,14 +11,14 @@ import {Captions,Check,ChevronDown,- CircleStop,FileVideo,History,Languages,Mic2,MonitorPlay,Play,- Sparkles+ Sparkles,+ Square} from 'lucide-react';import { TtsVoicePicker } from '../../components/tts/TtsVoicePicker.js';import { useLocalizedCopy, type LocalizeCopy } from '../../i18n/useLocalizedCopy.js';@@ -2519,7 +2519,7 @@ export default function VideoTranslationWorkspace(props: {disabled={taskControlPending !== undefined || cancelRequested}onClick={requestCancelTask}>- <CircleStop size={16} strokeWidth={1.9} aria-hidden="true" />+ <Square size={16} fill="currentColor" aria-hidden="true" />{taskControlPending === 'canceling' || cancelRequested? l('正在终止...', 'Stopping...'): l('终止任务', 'Stop task')}@@ -3318,7 +3318,7 @@ export default function VideoTranslationWorkspace(props: {aria-labelledby="video-translation-cancel-title"><header>- <span aria-hidden="true"><CircleStop size={18} strokeWidth={1.9} /></span>+ <span aria-hidden="true"><Square size={18} fill="currentColor" /></span><div><h2 id="video-translation-cancel-title">{l('终止翻译任务?', 'Stop translation task?')}</h2><p>@@ -3340,7 +3340,7 @@ export default function VideoTranslationWorkspace(props: {data-intent="danger"onClick={() => void cancelTask()}>- <CircleStop size={15} strokeWidth={1.9} aria-hidden="true" />+ <Square size={15} fill="currentColor" aria-hidden="true" />{l('终止任务', 'Stop task')}</button></footer>diff --git a/apps/web/src/features/dashboard/dashboard-css.test.ts b/apps/web/src/features/dashboard/dashboard-css.test.tsindex e0b3b450..6d446ad0 100644--- a/apps/web/src/features/dashboard/dashboard-css.test.ts+++ b/apps/web/src/features/dashboard/dashboard-css.test.ts@@ -91,7 +91,8 @@ describe('dashboard CSS contracts', () => {expect(sharedPanel).toHaveLength(1);expect(sharedPanel[0]).toContain('height: 100%;');expect(sharedPanel[0]).toContain('min-height: 0;');- expect(sharedPanel[0]).toContain('grid-template-rows: auto auto minmax(0, 1fr) auto auto;');+ expect(sharedPanel[0]).toContain('display: flex;');+ expect(sharedPanel[0]).toContain('flex-direction: column;');const resizableLayout = cssBlocks('.creator-resizable-layout');expect(resizableLayout[0]).toContain('min-width: 680px;');expect(resizableLayout[0]).toContain('minmax(280px, 1fr);');@@ -116,13 +117,44 @@ describe('dashboard CSS contracts', () => {expect(disabledFormat[0]).toContain('opacity: 0.45;');});- it('renders the subtitle preview in the selected vertical output ratio', () => {+ it('keeps subtitle style previews at their output aspect ratio instead of stretching with the form', () => {+ const layout = cssBlocks('.video-translation-subtitle-style-layout');+ const preview = cssBlocks('.video-translation-subtitle-preview');+ const player = cssBlocks('.video-translation-subtitle-preview > div');const verticalPreview = cssBlocks('.video-translation-subtitle-preview[data-ratio="9:16"] > div');+ expect(layout[0]).toContain('align-items: start;');+ expect(preview[0]).toContain('grid-template-rows: auto auto;');+ expect(preview[0]).toContain('align-content: start;');+ expect(player[0]).toContain('aspect-ratio: 16 / 9;');expect(verticalPreview).toHaveLength(1);expect(verticalPreview[0]).toContain('aspect-ratio: 9 / 16;');});+ it('fits subtitle previews to the available pane while keeping cues in one scrollable list', () => {+ const layout = cssBlocks('.video-result-subtitle-preview-layout');+ const pane = cssBlocks('.video-result-subtitle-pane');+ const video = cssBlocks('.video-result-subtitle-video');+ const list = cssBlocks('.video-result-subtitle-preview-layout .video-subtitle-editor');+ const portrait = cssBlocks('.video-result-subtitle-video .video-result-player-frame[data-ratio="9:16"]');+ const cue = cssBlocks('.video-result-subtitle-preview-layout .video-subtitle-cue');+ const editor = cssBlocks('.video-result-subtitle-preview-layout .video-subtitle-editor textarea');++ expect(layout[0]).toContain('grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);');+ expect(pane[0]).toContain('grid-template-rows: auto minmax(0, 1fr);');+ expect(pane[0]).toContain('container-name: video-result-subtitles;');+ expect(video[0]).toContain('container-type: size;');+ expect(video[0]).toContain('align-content: start;');+ expect(list[0]).toContain('min-height: 0;');+ expect(list[0]).toContain('overflow-y: auto;');+ expect(list[0]).not.toContain('max-height:');+ expect(portrait[0]).toContain('width: min(100%, calc((100cqh - 28px) * 0.5625));');+ expect(portrait[1]).toContain('width: min(100%, 440px);');+ expect(cue[0]).toContain('grid-template-columns: 100px minmax(0, 1fr);');+ expect(editor[0]).toContain('field-sizing: content;');+ expect(dashboardCss).toMatch(/@container video-result-subtitles \(max-width: 600px\) \{\s*\.video-result-subtitle-preview-layout/);+ });+it('keeps video result controls separate from the Agent panel layout', () => {const resultVersionButton = cssBlocks('.video-result-version > button');const resultVersionItem = cssBlocks('.video-result-version > div button');diff --git a/apps/web/src/features/dashboard/dashboard.css b/apps/web/src/features/dashboard/dashboard.cssindex ae87d439..ad738e9f 100644--- a/apps/web/src/features/dashboard/dashboard.css+++ b/apps/web/src/features/dashboard/dashboard.css@@ -1057,7 +1057,7 @@.video-translation-subtitle-style-layout {display: grid;grid-template-columns: minmax(230px, 0.82fr) minmax(300px, 1.18fr);- align-items: stretch;+ align-items: start;gap: 22px;}@@ -1182,12 +1182,13 @@.video-translation-subtitle-preview {min-width: 0;display: grid;- grid-template-rows: auto minmax(210px, 1fr);+ grid-template-rows: auto auto;+ align-content: start;gap: 7px;}.video-translation-subtitle-preview > div {- min-height: 210px;+ aspect-ratio: 16 / 9;display: flex;flex-direction: column;align-items: center;@@ -1203,13 +1204,8 @@text-align: center;}-.video-translation-subtitle-preview[data-ratio="9:16"] {- grid-template-rows: auto auto;-}-.video-translation-subtitle-preview[data-ratio="9:16"] > div {width: min(236px, 100%);- min-height: 0;aspect-ratio: 9 / 16;justify-self: center;}@@ -11880,8 +11876,8 @@min-width: 0;min-height: 0;height: 100%;- display: grid;- grid-template-rows: auto auto minmax(0, 1fr) auto auto;+ display: flex;+ flex-direction: column;overflow: hidden;border: 0;border-radius: 0;@@ -12096,6 +12092,24 @@white-space: nowrap;}+.creator-collaboration-preflight {+ display: grid;+ gap: 3px;+ padding: 10px 14px 0;+ color: var(--muted);+ font-size: 12px;+ line-height: 1.5;+}++.creator-collaboration-preflight strong {+ color: var(--text);+}++.creator-collaboration-preflight ul {+ margin: 2px 0 0;+ padding-left: 18px;+}+.creator-collaboration-messages {min-height: 0;display: flex;@@ -12132,9 +12146,6 @@.creator-collaboration-message[data-role="user"] {align-self: flex-end;- padding: 9px 11px;- border-radius: 7px;- background: var(--surface-2);color: var(--text);}@@ -12476,6 +12487,10 @@scrollbar-gutter: stable;}+.creator-collaboration-messages > * {+ flex: 0 0 auto;+}+.creator-collaboration-message {width: 100%;min-width: 0;@@ -13566,9 +13581,25 @@.video-result-subtitle-preview-layout {display: grid;- grid-template-columns: minmax(0, 1.4fr) minmax(300px, .7fr);- align-items: start;- gap: 22px;+ grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);+ min-height: 0;+ align-items: stretch;+ gap: 18px;+}++.video-result-subtitle-pane {+ container-type: inline-size;+ container-name: video-result-subtitles;+ display: grid;+ grid-template-rows: auto minmax(0, 1fr);+ overflow: hidden;+}++.video-result-subtitle-preview-layout > .video-result-output-column {+ min-height: 0;+ grid-template-rows: minmax(0, 1fr);+ align-content: stretch;+ gap: 0;}.video-result-subtitle-video {@@ -13576,7 +13607,9 @@top: 0;min-width: 0;display: grid;+ align-content: start;gap: 8px;+ container-type: size;}.video-result-subtitle-video > small {@@ -13643,7 +13676,7 @@}.video-result-subtitle-video .video-result-player-frame[data-ratio="9:16"] {- width: min(320px, 100%);+ width: min(100%, calc((100cqh - 28px) * 0.5625));}.video-result-player,@@ -13693,7 +13726,7 @@}.video-result-subtitle-preview-layout .video-subtitle-editor {- max-height: 480px;+ min-height: 0;overflow-y: auto;scrollbar-gutter: stable;}@@ -13701,10 +13734,10 @@.video-result-subtitle-preview-layout .video-subtitle-cue {min-width: 0;display: grid;- grid-template-columns: minmax(0, 1fr);+ grid-template-columns: 100px minmax(0, 1fr);align-items: start;- gap: 2px;- padding: 10px;+ gap: 10px;+ padding: 9px 11px;border-left: 3px solid transparent;transition: background 120ms ease, border-color 120ms ease;}@@ -13722,20 +13755,18 @@width: 100%;min-width: 0;display: grid;- grid-template-columns: 24px minmax(0, 1fr);- align-items: center;- gap: 5px;- padding: 3px 6px 5px;+ justify-items: start;+ gap: 2px;+ padding: 1px 0;border: 0;- border-radius: 6px;+ border-radius: 3px;background: transparent;color: var(--muted);text-align: left;}.video-subtitle-cue-time:hover {- background: var(--surface-2);- color: var(--text);+ color: var(--accent);}.video-subtitle-cue-time > span,@@ -13749,31 +13780,38 @@}.video-subtitle-cue-time > small {- overflow: hidden;- text-overflow: ellipsis;+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;white-space: nowrap;}.video-result-subtitle-preview-layout .video-subtitle-editor textarea {- min-height: 54px;+ min-height: 1.5em;+ field-sizing: content;+ resize: none;+ padding: 0;+ border: 0;+ border-radius: 0;+ font-size: 12px;+ line-height: 1.5;}.video-subtitle-cue-lines {display: grid;- gap: 5px;+ gap: 3px;}-.video-subtitle-cue-source {- min-height: 38px;- padding: 8px 10px;- border: 1px solid transparent;- border-radius: 6px;- background: var(--surface-2);+.video-subtitle-cue-pair {+ min-width: 0;+ display: grid;+ gap: 3px;+}++.video-result-subtitle-preview-layout .video-subtitle-cue-source {color: var(--muted);- font-size: 13px;- line-height: 1.45;- white-space: pre-wrap;- overflow-wrap: anywhere;+}++.video-result-subtitle-preview-layout .video-subtitle-cue-translation {+ color: var(--text);}.video-result-subtitle-preview-layout .video-subtitle-editor textarea[readonly],@@ -13781,23 +13819,36 @@.video-result-subtitle-preview-layout .video-subtitle-editor textarea[readonly]:focus {resize: none;border-color: transparent;- background: var(--surface-2);- color: var(--muted);+ background: transparent;box-shadow: none;- cursor: default;+ cursor: text;}-@media (max-width: 900px) {+@container video-result-subtitles (max-width: 600px) {.video-result-subtitle-preview-layout {grid-template-columns: minmax(0, 1fr);+ grid-template-rows: auto auto;+ align-content: start;+ align-items: start;+ overflow-y: auto;+ }++ .video-result-subtitle-preview-layout > .video-result-output-column {+ height: min(60dvh, 520px);}.video-result-subtitle-video {position: static;+ container-type: normal;}.video-result-subtitle-video .video-result-player-frame {- width: min(640px, 100%);+ width: 100%;+ justify-self: stretch;+ }++ .video-result-subtitle-video .video-result-player-frame[data-ratio="9:16"] {+ width: min(100%, 440px);justify-self: center;}}diff --git a/apps/web/src/features/runs/Composer.test.tsx b/apps/web/src/features/runs/Composer.test.tsxindex 7495ca3f..9a09587d 100644--- a/apps/web/src/features/runs/Composer.test.tsx+++ b/apps/web/src/features/runs/Composer.test.tsx@@ -260,7 +260,7 @@ describe('Composer', () => {const stopButton = screen.getByRole('button', { name: '停止任务' });expect(stopButton).toBeDisabled();expect(stopButton).toHaveAttribute('title', '停止任务');- expect(stopButton.querySelector('.lucide-square')).toBeInTheDocument();+ expect(stopButton.querySelector('.lucide-square')).toHaveAttribute('fill', 'currentColor');expect(screen.queryByRole('button', { name: '排队发送' })).not.toBeInTheDocument();});diff --git a/apps/web/src/styles/app-css.test.ts b/apps/web/src/styles/app-css.test.tsindex da717eea..1172f853 100644--- a/apps/web/src/styles/app-css.test.ts+++ b/apps/web/src/styles/app-css.test.ts@@ -167,6 +167,25 @@ describe('app CSS visual contracts', () => {expect(cssBlock('.settings-section h1')).toContain('min-height: var(--page-title-row-height);');});+ it('keeps collaboration entries top-aligned and scrollable instead of shrinking them into the panel', () => {+ const dashboardCss = readSource('src/features/dashboard/dashboard.css');+ expect(dashboardCss).toMatch(/\.creator-collaboration\s*\{[^}]*display: flex;\s*flex-direction: column;/);+ expect(dashboardCss).not.toMatch(/\.creator-collaboration\s*\{[^}]*grid-template-rows:/);+ expect(dashboardCss).toMatch(/\.creator-collaboration-preflight\s*\{[^}]*padding: 10px 14px 0;/);+ expect(dashboardCss).toMatch(/\.creator-collaboration-messages\s*>\s*\*\s*\{\s*flex: 0 0 auto;/);+ expect(dashboardCss).not.toMatch(/\.creator-collaboration-messages\s*\{[^}]*flex-direction:\s*column-reverse;/);+ });++ it('uses only the bordered bubble for user messages, without an outer surface', () => {+ const dashboardCss = readSource('src/features/dashboard/dashboard.css');+ const outerRules = [...dashboardCss.matchAll(/\.creator-collaboration-message\[data-role="user"\]\s*\{([^}]*)\}/g)];+ expect(outerRules).toHaveLength(2);+ for (const [, rules] of outerRules) {+ expect(rules).not.toMatch(/\b(?:padding|background|border-radius)\s*:/);+ }+ expect(dashboardCss).toMatch(/\.creator-collaboration-message\[data-role="user"\] \.creator-collaboration-bubble\s*\{[^}]*border: 1px solid var\(--border-hairline\);/);+ });+it('assigns page, sidebar, composer, and popover surfaces by semantic role', () => {expect(tokensCss).toContain('--bg: var(--surface-page);');expect(tokensCss).toContain('--conversation-bg: var(--surface-page);');diff --git a/docs/operations/opencreator-desktop-release-runbook.md b/docs/operations/opencreator-desktop-release-runbook.mdindex 412a2e5e..0a7fb3f3 100644--- a/docs/operations/opencreator-desktop-release-runbook.md+++ b/docs/operations/opencreator-desktop-release-runbook.md@@ -30,7 +30,7 @@ pnpm desktop:package1. Node.js 22。2. pnpm 9.15.0。-3. macOS 签名与公证环境提供 `codesign`、`notarytool` 和 `stapler`;普通本机未签名打包不依赖完整 Xcode。+3. macOS 打包机使用完整 Xcode 26 或更新版本,以编译明暗外观一致的应用图标;签名与公证环境还需提供 `codesign`、`notarytool` 和 `stapler`。4. Windows 构建机允许执行 PowerShell 和 NSIS 打包工具。5. 仓库全量测试、类型检查和构建通过。6. 打包脚本会删除目标架构旧目录,并要求构建后只找到一个 fresh package root。@@ -39,7 +39,7 @@ pnpm desktop:package9. OSV Scanner 2.3.8 扫描发布源码无未解释漏洞。10. `.github/workflows/desktop-release.yml` 通过 actionlint。-Desktop 使用 `resources/icon.png` 作为各平台统一的应用图标源。Electron Builder 在 macOS 包内生成 `icon.icns`,包校验同时检查正式 PNG 资源与生成后的 macOS 图标存在。+Desktop 使用 `resources/icon.png` 作为各平台统一的应用图标源。macOS 打包时从同一张 PNG 生成白底黑色图形的明暗两种相同外观,编译到 `Assets.car` 并通过 `CFBundleIconName` 引用;Electron Builder 生成的 `icon.icns` 保留为旧版 macOS 的回退资源。包校验会检查 PNG、两种外观的一致性和 App 的图标引用。## 3. 版本与标签diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex d34df3e6..fdccf771 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -167,6 +167,9 @@ importers:node-gyp:specifier: 13.0.2version: 13.0.2+ sharp:+ specifier: 0.35.4+ version: 0.35.4(@types/[email protected])typescript:specifier: ^5.7.3version: 5.9.3