Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
feat(transcript): an aggregated transcript pane, editable through a skip-range model
Etienne Lescotbe479097f5d5
diff --git a/electron/ai-edition/agent-tools.test.ts b/electron/ai-edition/agent-tools.test.tsindex b25f49738..6213daa4f 100644--- a/electron/ai-edition/agent-tools.test.ts+++ b/electron/ai-edition/agent-tools.test.ts@@ -1,204 +1,226 @@-import { describe, expect, it } from "vitest";-import {- type AxcutDocument,- createEmptyDocument,- documentSchema,-} from "../../src/lib/ai-edition/schema";-import { AGENT_TOOL_SPECS, executeAgentTool, isMutatingTool } from "./agent-tools";--function fixtureDocument(): AxcutDocument {- const base = createEmptyDocument({ title: "Test", projectId: "proj_1" });- return documentSchema.parse({- ...base,- project: { ...base.project, primaryAssetId: "asset_1" },- assets: [- {- id: "asset_1",- kind: "video",- label: "Recording",- originalPath: "C:/videos/rec.mp4",- durationSec: 60,- },- ],- transcripts: [- {- assetId: "asset_1",- language: "en",- segments: [- { id: "seg_1", kind: "speech", startSec: 0, endSec: 5, text: "Hello", wordIds: [] },- { id: "seg_2", kind: "silence", startSec: 5, endSec: 8, text: "", wordIds: [] },- ],- words: [],- },- ],- timeline: {- ...base.timeline,- clips: [- {- id: "clip_1",- assetId: "asset_1",- sourceStartSec: 0,- sourceEndSec: 30,- timelineStartSec: 0,- timelineEndSec: 30,- wordRefs: [],- origin: "user",- reason: "",- },- {- id: "clip_2",- assetId: "asset_1",- sourceStartSec: 30,- sourceEndSec: 60,- timelineStartSec: 30,- timelineEndSec: 60,- wordRefs: [],- origin: "user",- reason: "",- },- ],- skipRanges: [- {- id: "skip_1",- assetId: "asset_1",- startSec: 10,- endSec: 12,- reason: "",- origin: "user",- },- ],- },- });-}--describe("agent-tools specs", () => {- it("declares the six roadmap tools with mutation flags", () => {- const names = AGENT_TOOL_SPECS.map((t) => t.name);- expect(names).toEqual([- "getCurrentDocument",- "getTranscript",- "addSkip",- "setSkipRange",- "setClipRange",- "replaceTimeline",- ]);- expect(isMutatingTool("getTranscript")).toBe(false);- expect(isMutatingTool("replaceTimeline")).toBe(true);- expect(isMutatingTool("nope")).toBe(false);- });-});--describe("executeAgentTool", () => {- it("getCurrentDocument returns a compact snapshot with ids and times", () => {- const result = executeAgentTool(fixtureDocument(), "getCurrentDocument", "");- expect(result.ok).toBe(true);- const snapshot = JSON.parse(result.resultJson);- expect(snapshot.primaryAssetId).toBe("asset_1");- expect(snapshot.clips.map((c: { id: string }) => c.id)).toEqual(["clip_1", "clip_2"]);- expect(snapshot.skipRanges[0].id).toBe("skip_1");- expect(snapshot.hasTranscript).toBe(true);- expect(result.document).toBeUndefined();- });-- it("getTranscript returns segments for the primary asset by default", () => {- const result = executeAgentTool(fixtureDocument(), "getTranscript", "{}");- expect(result.ok).toBe(true);- const payload = JSON.parse(result.resultJson);- expect(payload.assetId).toBe("asset_1");- expect(payload.segments).toHaveLength(2);- expect(payload.segments[1].kind).toBe("silence");- });-- it("getTranscript fails cleanly when no transcript exists", () => {- const doc = { ...fixtureDocument(), transcripts: [], transcript: null };- const result = executeAgentTool(doc, "getTranscript", "{}");- expect(result.ok).toBe(false);- expect(JSON.parse(result.resultJson).error).toMatch(/No transcript/);- });-- it("addSkip appends an agent-origin skip range and normalizes reversed bounds", () => {- const result = executeAgentTool(- fixtureDocument(),- "addSkip",- JSON.stringify({ startSec: 22, endSec: 20, reason: "silence" }),- );- expect(result.ok).toBe(true);- expect(result.document).toBeDefined();- const added = result.document?.timeline.skipRanges.at(-1);- expect(added?.startSec).toBe(20);- expect(added?.endSec).toBe(22);- expect(added?.origin).toBe("agent");- expect(result.summary).toMatch(/added skip 0:20\.0 – 0:22\.0/);- });-- it("addSkip rejects unknown assets", () => {- const result = executeAgentTool(- fixtureDocument(),- "addSkip",- JSON.stringify({ startSec: 0, endSec: 1, assetId: "asset_missing" }),- );- expect(result.ok).toBe(false);- expect(result.document).toBeUndefined();- });-- it("setSkipRange moves an existing range and errors on unknown ids", () => {- const ok = executeAgentTool(- fixtureDocument(),- "setSkipRange",- JSON.stringify({ skipRangeId: "skip_1", startSec: 14, endSec: 18 }),- );- expect(ok.ok).toBe(true);- expect(ok.document?.timeline.skipRanges[0]).toMatchObject({ startSec: 14, endSec: 18 });-- const missing = executeAgentTool(- fixtureDocument(),- "setSkipRange",- JSON.stringify({ skipRangeId: "skip_x", startSec: 0, endSec: 1 }),- );- expect(missing.ok).toBe(false);- });-- it("setClipRange trims the clip and resequences downstream clips", () => {- const result = executeAgentTool(- fixtureDocument(),- "setClipRange",- JSON.stringify({ clipId: "clip_1", sourceStartSec: 0, sourceEndSec: 10 }),- );- expect(result.ok).toBe(true);- const clips = result.document?.timeline.clips ?? [];- expect(clips[0]).toMatchObject({- sourceEndSec: 10,- timelineStartSec: 0,- timelineEndSec: 10,- });- // Downstream clip reflows to start where the trimmed clip now ends.- expect(clips[1]).toMatchObject({ timelineStartSec: 10, timelineEndSec: 40 });- });-- it("replaceTimeline rebuilds clips and inverse skip ranges", () => {- const result = executeAgentTool(- fixtureDocument(),- "replaceTimeline",- JSON.stringify({- intervals: [- { startSec: 0, endSec: 10 },- { startSec: 20, endSec: 30 },- ],- reason: "cut silences",- }),- );- expect(result.ok).toBe(true);- const timeline = result.document?.timeline;- expect(timeline?.clips).toHaveLength(2);- expect(timeline?.skipRanges.map((s) => [s.startSec, s.endSec])).toEqual([- [10, 20],- [30, 60],- ]);- expect(result.summary).toMatch(/2 intervals/);- });-- it("rejects malformed JSON arguments and unknown tools", () => {- expect(executeAgentTool(fixtureDocument(), "addSkip", "{not json").ok).toBe(false);- expect(executeAgentTool(fixtureDocument(), "flyToTheMoon", "{}").ok).toBe(false);- });-});+import { describe, expect, it } from "vitest";+import {+ type AxcutDocument,+ createEmptyDocument,+ documentSchema,+} from "../../src/lib/ai-edition/schema";+import { AGENT_TOOL_SPECS, executeAgentTool, isMutatingTool } from "./agent-tools";++function fixtureDocument(): AxcutDocument {+ const base = createEmptyDocument({ title: "Test", projectId: "proj_1" });+ return documentSchema.parse({+ ...base,+ project: { ...base.project, primaryAssetId: "asset_1" },+ assets: [+ {+ id: "asset_1",+ kind: "video",+ label: "Recording",+ originalPath: "C:/videos/rec.mp4",+ durationSec: 60,+ },+ ],+ transcripts: [+ {+ assetId: "asset_1",+ language: "en",+ segments: [+ { id: "seg_1", kind: "speech", startSec: 0, endSec: 5, text: "Hello", wordIds: [] },+ { id: "seg_2", kind: "silence", startSec: 5, endSec: 8, text: "", wordIds: [] },+ ],+ words: [],+ },+ ],+ timeline: {+ ...base.timeline,+ clips: [+ {+ id: "clip_1",+ assetId: "asset_1",+ sourceStartSec: 0,+ sourceEndSec: 30,+ timelineStartSec: 0,+ timelineEndSec: 30,+ wordRefs: [],+ origin: "user",+ reason: "",+ },+ {+ id: "clip_2",+ assetId: "asset_1",+ sourceStartSec: 30,+ sourceEndSec: 60,+ timelineStartSec: 30,+ timelineEndSec: 60,+ wordRefs: [],+ origin: "user",+ reason: "",+ },+ ],+ skipRanges: [+ {+ id: "skip_1",+ assetId: "asset_1",+ startSec: 10,+ endSec: 12,+ reason: "",+ origin: "user",+ },+ ],+ },+ });+}++describe("agent-tools specs", () => {+ it("declares the six roadmap tools with mutation flags", () => {+ const names = AGENT_TOOL_SPECS.map((t) => t.name);+ expect(names).toEqual([+ "getCurrentDocument",+ "getTranscript",+ "addSkip",+ "setSkipRange",+ "setClipRange",+ "replaceTimeline",+ ]);+ expect(isMutatingTool("getTranscript")).toBe(false);+ expect(isMutatingTool("replaceTimeline")).toBe(true);+ expect(isMutatingTool("nope")).toBe(false);+ });+});++describe("executeAgentTool", () => {+ it("getCurrentDocument returns a compact snapshot with ids and times", () => {+ const result = executeAgentTool(fixtureDocument(), "getCurrentDocument", "");+ expect(result.ok).toBe(true);+ const snapshot = JSON.parse(result.resultJson);+ expect(snapshot.primaryAssetId).toBe("asset_1");+ expect(snapshot.clips.map((c: { id: string }) => c.id)).toEqual(["clip_1", "clip_2"]);+ expect(snapshot.skipRanges[0].id).toBe("skip_1");+ expect(snapshot.hasTranscript).toBe(true);+ expect(result.document).toBeUndefined();+ });++ it("getTranscript returns segments for the primary asset by default", () => {+ const result = executeAgentTool(fixtureDocument(), "getTranscript", "{}");+ expect(result.ok).toBe(true);+ const payload = JSON.parse(result.resultJson);+ expect(payload.assetId).toBe("asset_1");+ expect(payload.segments).toHaveLength(2);+ expect(payload.segments[1].kind).toBe("silence");+ });++ it("getTranscript fails cleanly when no transcript exists", () => {+ const doc = { ...fixtureDocument(), transcripts: [], transcript: null };+ const result = executeAgentTool(doc, "getTranscript", "{}");+ expect(result.ok).toBe(false);+ expect(JSON.parse(result.resultJson).error).toMatch(/No transcript/);+ });++ it("addSkip appends an agent-origin skip range and normalizes reversed bounds", () => {+ const result = executeAgentTool(+ fixtureDocument(),+ "addSkip",+ JSON.stringify({ startSec: 22, endSec: 20, reason: "silence" }),+ );+ expect(result.ok).toBe(true);+ expect(result.document).toBeDefined();+ const added = result.document?.timeline.skipRanges.at(-1);+ expect(added?.startSec).toBe(20);+ expect(added?.endSec).toBe(22);+ expect(added?.origin).toBe("agent");+ expect(result.summary).toMatch(/added skip 0:20\.0 – 0:22\.0/);+ });++ it("addSkip rejects unknown assets", () => {+ const result = executeAgentTool(+ fixtureDocument(),+ "addSkip",+ JSON.stringify({ startSec: 0, endSec: 1, assetId: "asset_missing" }),+ );+ expect(result.ok).toBe(false);+ expect(result.document).toBeUndefined();+ });++ it("setSkipRange moves an existing range and errors on unknown ids", () => {+ const ok = executeAgentTool(+ fixtureDocument(),+ "setSkipRange",+ JSON.stringify({ skipRangeId: "skip_1", startSec: 14, endSec: 18 }),+ );+ expect(ok.ok).toBe(true);+ expect(ok.document?.timeline.skipRanges[0]).toMatchObject({ startSec: 14, endSec: 18 });++ const missing = executeAgentTool(+ fixtureDocument(),+ "setSkipRange",+ JSON.stringify({ skipRangeId: "skip_x", startSec: 0, endSec: 1 }),+ );+ expect(missing.ok).toBe(false);+ });++ it("setClipRange trims the clip and resequences downstream clips", () => {+ const result = executeAgentTool(+ fixtureDocument(),+ "setClipRange",+ JSON.stringify({ clipId: "clip_1", sourceStartSec: 0, sourceEndSec: 10 }),+ );+ expect(result.ok).toBe(true);+ const clips = result.document?.timeline.clips ?? [];+ expect(clips[0]).toMatchObject({+ sourceEndSec: 10,+ timelineStartSec: 0,+ timelineEndSec: 10,+ });+ // Downstream clip reflows to start where the trimmed clip now ends.+ expect(clips[1]).toMatchObject({ timelineStartSec: 10, timelineEndSec: 40 });+ });++ it("replaceTimeline rebuilds clips and inverse skip ranges", () => {+ const doc = fixtureDocument();+ // Test the rebuild path: strip user-placed clips first so the tool+ // is allowed to operate (it refuses when origin:user clips are present).+ const stripped: AxcutDocument = {+ ...doc,+ timeline: { ...doc.timeline, clips: [] },+ };+ const result = executeAgentTool(+ stripped,+ "replaceTimeline",+ JSON.stringify({+ intervals: [+ { startSec: 0, endSec: 10 },+ { startSec: 20, endSec: 30 },+ ],+ reason: "cut silences",+ }),+ );+ expect(result.ok).toBe(true);+ const timeline = result.document?.timeline;+ expect(timeline?.clips).toHaveLength(2);+ expect(timeline?.skipRanges.map((s) => [s.startSec, s.endSec])).toEqual([+ [10, 20],+ [30, 60],+ ]);+ expect(result.summary).toMatch(/2 intervals/);+ });++ it("replaceTimeline refuses when the timeline has user-placed clips", () => {+ const result = executeAgentTool(+ fixtureDocument(),+ "replaceTimeline",+ JSON.stringify({+ intervals: [{ startSec: 0, endSec: 30 }],+ reason: "remove silences",+ }),+ );+ expect(result.ok).toBe(false);+ const payload = JSON.parse(result.resultJson) as { error: string };+ expect(payload.error).toMatch(/user-placed clip/);+ expect(payload.error).toMatch(/addSkip/);+ });++ it("rejects malformed JSON arguments and unknown tools", () => {+ expect(executeAgentTool(fixtureDocument(), "addSkip", "{not json").ok).toBe(false);+ expect(executeAgentTool(fixtureDocument(), "flyToTheMoon", "{}").ok).toBe(false);+ });+});diff --git a/electron/ai-edition/agent-tools.ts b/electron/ai-edition/agent-tools.tsindex 23d55737a..14f745605 100644--- a/electron/ai-edition/agent-tools.ts+++ b/electron/ai-edition/agent-tools.ts@@ -1,375 +1,389 @@-// Agent tool layer (P1.1/P1.2): the JSON-schema tool definitions fed to the-// LLM as `tools[]`, plus the executor that validates arguments (zod) and-// applies each tool against an AxcutDocument snapshot. Pure — no IPC, no fs.-// The chat-service tool loop owns checkpoints and persistence; this module-// only knows how to turn (document, toolName, argsJson) into a new document.-//-// Read tools return JSON the model can reason over; write tools return the-// mutated document plus a human-readable summary line for the chat panel-// ("applied: added skip 0:02.1 – 0:02.4").--import { z } from "zod";-import { createId } from "../../src/lib/ai-edition/document/ids";-import { replaceTimeline, resequenceClips } from "../../src/lib/ai-edition/document/timeline";-import type { AxcutDocument } from "../../src/lib/ai-edition/schema";--export interface AgentToolSpec {- name: string;- description: string;- /** JSON schema for the tool arguments, sent verbatim to the provider. */- parameters: Record<string, unknown>;- /** True when the tool mutates the document (gates checkpoint + permission). */- mutating: boolean;-}--export interface AgentToolExecution {- ok: boolean;- /** JSON payload returned to the model as the tool result. */- resultJson: string;- /** Updated document — only set when the tool mutated it. */- document?: AxcutDocument;- /** One-line human summary for the chat panel (mutating tools only). */- summary?: string;-}--function formatSec(sec: number): string {- if (!Number.isFinite(sec) || sec < 0) return "0:00.0";- const m = Math.floor(sec / 60);- const s = (sec % 60).toFixed(1);- return `${m}:${s.padStart(4, "0")}`;-}--const secondsSchema = z.number().finite().nonnegative();--const addSkipArgs = z.object({- startSec: secondsSchema,- endSec: secondsSchema,- assetId: z.string().min(1).optional(),- reason: z.string().default(""),-});--const setSkipRangeArgs = z.object({- skipRangeId: z.string().min(1),- startSec: secondsSchema,- endSec: secondsSchema,-});--const setClipRangeArgs = z.object({- clipId: z.string().min(1),- sourceStartSec: secondsSchema,- sourceEndSec: secondsSchema,-});--const replaceTimelineArgs = z.object({- intervals: z.array(z.object({ startSec: secondsSchema, endSec: secondsSchema })).min(1),- reason: z.string().default(""),-});--const getTranscriptArgs = z.object({- assetId: z.string().min(1).optional(),-});--export const AGENT_TOOL_SPECS: AgentToolSpec[] = [- {- name: "getCurrentDocument",- description:- "Read a compact snapshot of the current project: assets (with durations), timeline clips, skip ranges, and counts of annotations/zoom ranges. Call this before editing if the snapshot in the system prompt may be stale.",- parameters: { type: "object", properties: {}, additionalProperties: false },- mutating: false,- },- {- name: "getTranscript",- description:- "Read the transcript segments (speech and silence, with start/end seconds and text) for an asset. Omit assetId to read the primary asset's transcript.",- parameters: {- type: "object",- properties: {- assetId: { type: "string", description: "Asset id; defaults to the primary asset." },- },- additionalProperties: false,- },- mutating: false,- },- {- name: "addSkip",- description:- "Add a skip range (a cut — this source-time span will not be played or exported). Times are in seconds of the asset's source time.",- parameters: {- type: "object",- properties: {- startSec: { type: "number", minimum: 0 },- endSec: { type: "number", minimum: 0 },- assetId: { type: "string", description: "Asset id; defaults to the primary asset." },- reason: { type: "string", description: "Why this range is being cut." },- },- required: ["startSec", "endSec"],- additionalProperties: false,- },- mutating: true,- },- {- name: "setSkipRange",- description: "Move or resize an existing skip range by id. Times are source-time seconds.",- parameters: {- type: "object",- properties: {- skipRangeId: { type: "string" },- startSec: { type: "number", minimum: 0 },- endSec: { type: "number", minimum: 0 },- },- required: ["skipRangeId", "startSec", "endSec"],- additionalProperties: false,- },- mutating: true,- },- {- name: "setClipRange",- description:- "Trim a clip: set its source in/out points (seconds). All clips are re-laid back-to-back afterwards, so downstream clips shift automatically.",- parameters: {- type: "object",- properties: {- clipId: { type: "string" },- sourceStartSec: { type: "number", minimum: 0 },- sourceEndSec: { type: "number", minimum: 0 },- },- required: ["clipId", "sourceStartSec", "sourceEndSec"],- additionalProperties: false,- },- mutating: true,- },- {- name: "replaceTimeline",- description:- "Replace the whole timeline with the given kept intervals of the primary asset's source time. Everything outside the intervals becomes a skip. Use for bulk edits like 'cut all silences'.",- parameters: {- type: "object",- properties: {- intervals: {- type: "array",- minItems: 1,- items: {- type: "object",- properties: {- startSec: { type: "number", minimum: 0 },- endSec: { type: "number", minimum: 0 },- },- required: ["startSec", "endSec"],- additionalProperties: false,- },- },- reason: { type: "string" },- },- required: ["intervals"],- additionalProperties: false,- },- mutating: true,- },-];--export function isMutatingTool(name: string): boolean {- return AGENT_TOOL_SPECS.find((t) => t.name === name)?.mutating ?? false;-}--// Compact projection of the document for the model: everything it needs to-// reference ids and times, nothing it doesn't (no waveform paths, no history).-export function documentSnapshotForModel(document: AxcutDocument): Record<string, unknown> {- return {- project: { id: document.project.id, title: document.project.title },- primaryAssetId: document.project.primaryAssetId ?? document.assets[0]?.id ?? null,- assets: document.assets.map((a) => ({- id: a.id,- label: a.label,- durationSec: a.durationSec ?? null,- })),- clips: document.timeline.clips.map((c) => ({- id: c.id,- assetId: c.assetId,- sourceStartSec: c.sourceStartSec,- sourceEndSec: c.sourceEndSec ?? null,- timelineStartSec: c.timelineStartSec,- timelineEndSec: c.timelineEndSec,- })),- skipRanges: document.timeline.skipRanges.map((s) => ({- id: s.id,- assetId: s.assetId,- startSec: s.startSec,- endSec: s.endSec,- reason: s.reason,- })),- annotationCount: document.annotations.length,- zoomRangeCount: document.zoomRanges.length,- hasTranscript: document.transcripts.length > 0 || document.transcript !== null,- };-}--function failure(message: string): AgentToolExecution {- return { ok: false, resultJson: JSON.stringify({ error: message }) };-}--export function executeAgentTool(- document: AxcutDocument,- name: string,- rawArgs: string,-): AgentToolExecution {- let args: unknown = {};- if (rawArgs.trim()) {- try {- args = JSON.parse(rawArgs);- } catch {- return failure(`Tool arguments are not valid JSON: ${rawArgs.slice(0, 120)}`);- }- }-- switch (name) {- case "getCurrentDocument": {- return { ok: true, resultJson: JSON.stringify(documentSnapshotForModel(document)) };- }-- case "getTranscript": {- const parsed = getTranscriptArgs.safeParse(args);- if (!parsed.success) return failure(parsed.error.message);- const assetId =- parsed.data.assetId ?? document.project.primaryAssetId ?? document.assets[0]?.id;- const transcript =- document.transcripts.find((t) => t.assetId === assetId) ??- (document.transcript?.assetId === assetId ? document.transcript : null);- if (!transcript) {- return failure(`No transcript for asset ${assetId ?? "(none)"}.`);- }- // ponytail: segments only — words would blow the context for long- // recordings and the segment text already carries the content.- const segments = transcript.segments.slice(0, 800).map((s) => ({- id: s.id,- kind: s.kind,- startSec: s.startSec,- endSec: s.endSec,- text: s.text,- }));- return {- ok: true,- resultJson: JSON.stringify({ assetId, language: transcript.language, segments }),- };- }-- case "addSkip": {- const parsed = addSkipArgs.safeParse(args);- if (!parsed.success) return failure(parsed.error.message);- const assetId =- parsed.data.assetId ?? document.project.primaryAssetId ?? document.assets[0]?.id;- if (!assetId) return failure("Project has no assets — nothing to skip.");- if (!document.assets.some((a) => a.id === assetId)) {- return failure(`Unknown asset: ${assetId}`);- }- const startSec = Math.min(parsed.data.startSec, parsed.data.endSec);- const endSec = Math.max(parsed.data.startSec, parsed.data.endSec);- const skip = {- id: createId("skip"),- assetId,- startSec,- endSec,- reason: parsed.data.reason,- origin: "agent" as const,- };- const next: AxcutDocument = {- ...document,- timeline: {- ...document.timeline,- skipRanges: [...document.timeline.skipRanges, skip],- },- };- return {- ok: true,- document: next,- resultJson: JSON.stringify({ skipRangeId: skip.id, startSec, endSec }),- summary: `added skip ${formatSec(startSec)} – ${formatSec(endSec)}`,- };- }-- case "setSkipRange": {- const parsed = setSkipRangeArgs.safeParse(args);- if (!parsed.success) return failure(parsed.error.message);- const { skipRangeId } = parsed.data;- if (!document.timeline.skipRanges.some((r) => r.id === skipRangeId)) {- return failure(`Unknown skip range: ${skipRangeId}`);- }- const startSec = Math.min(parsed.data.startSec, parsed.data.endSec);- const endSec = Math.max(parsed.data.startSec, parsed.data.endSec);- const next: AxcutDocument = {- ...document,- timeline: {- ...document.timeline,- skipRanges: document.timeline.skipRanges.map((r) =>- r.id === skipRangeId ? { ...r, startSec, endSec } : r,- ),- },- };- return {- ok: true,- document: next,- resultJson: JSON.stringify({ skipRangeId, startSec, endSec }),- summary: `moved skip to ${formatSec(startSec)} – ${formatSec(endSec)}`,- };- }-- case "setClipRange": {- const parsed = setClipRangeArgs.safeParse(args);- if (!parsed.success) return failure(parsed.error.message);- const { clipId } = parsed.data;- if (!document.timeline.clips.some((c) => c.id === clipId)) {- return failure(`Unknown clip: ${clipId}`);- }- const sourceStartSec = Math.min(parsed.data.sourceStartSec, parsed.data.sourceEndSec);- const sourceEndSec = Math.max(parsed.data.sourceStartSec, parsed.data.sourceEndSec);- const clips = resequenceClips(- document.timeline.clips.map((c) =>- c.id === clipId- ? {- ...c,- sourceStartSec,- sourceEndSec,- // ponytail: zero the timeline span so resequenceClips derives the- // clip length from the new source range instead of the stale one.- timelineStartSec: 0,- timelineEndSec: 0,- }- : c,- ),- );- const next: AxcutDocument = {- ...document,- timeline: { ...document.timeline, clips },- };- return {- ok: true,- document: next,- resultJson: JSON.stringify({ clipId, sourceStartSec, sourceEndSec }),- summary: `trimmed clip to ${formatSec(sourceStartSec)} – ${formatSec(sourceEndSec)}`,- };- }-- case "replaceTimeline": {- const parsed = replaceTimelineArgs.safeParse(args);- if (!parsed.success) return failure(parsed.error.message);- let next: AxcutDocument;- try {- next = replaceTimeline(document, parsed.data.intervals, parsed.data.reason, "agent");- } catch (err) {- return failure(err instanceof Error ? err.message : String(err));- }- const kept = parsed.data.intervals.length;- return {- ok: true,- document: next,- resultJson: JSON.stringify({- clipCount: next.timeline.clips.length,- skipCount: next.timeline.skipRanges.length,- }),- summary: `rebuilt timeline from ${kept} interval${kept === 1 ? "" : "s"} (${next.timeline.clips.length} clips, ${next.timeline.skipRanges.length} skips)`,- };- }-- default:- return failure(`Unknown tool: ${name}`);- }-}+// Agent tool layer (P1.1/P1.2): the JSON-schema tool definitions fed to the+// LLM as `tools[]`, plus the executor that validates arguments (zod) and+// applies each tool against an AxcutDocument snapshot. Pure — no IPC, no fs.+// The chat-service tool loop owns checkpoints and persistence; this module+// only knows how to turn (document, toolName, argsJson) into a new document.+//+// Read tools return JSON the model can reason over; write tools return the+// mutated document plus a human-readable summary line for the chat panel+// ("applied: added skip 0:02.1 – 0:02.4").++import { z } from "zod";+import { createId } from "../../src/lib/ai-edition/document/ids";+import { replaceTimeline, resequenceClips } from "../../src/lib/ai-edition/document/timeline";+import type { AxcutDocument } from "../../src/lib/ai-edition/schema";++export interface AgentToolSpec {+ name: string;+ description: string;+ /** JSON schema for the tool arguments, sent verbatim to the provider. */+ parameters: Record<string, unknown>;+ /** True when the tool mutates the document (gates checkpoint + permission). */+ mutating: boolean;+}++export interface AgentToolExecution {+ ok: boolean;+ /** JSON payload returned to the model as the tool result. */+ resultJson: string;+ /** Updated document — only set when the tool mutated it. */+ document?: AxcutDocument;+ /** One-line human summary for the chat panel (mutating tools only). */+ summary?: string;+}++function formatSec(sec: number): string {+ if (!Number.isFinite(sec) || sec < 0) return "0:00.0";+ const m = Math.floor(sec / 60);+ const s = (sec % 60).toFixed(1);+ return `${m}:${s.padStart(4, "0")}`;+}++const secondsSchema = z.number().finite().nonnegative();++const addSkipArgs = z.object({+ startSec: secondsSchema,+ endSec: secondsSchema,+ assetId: z.string().min(1).optional(),+ reason: z.string().default(""),+});++const setSkipRangeArgs = z.object({+ skipRangeId: z.string().min(1),+ startSec: secondsSchema,+ endSec: secondsSchema,+});++const setClipRangeArgs = z.object({+ clipId: z.string().min(1),+ sourceStartSec: secondsSchema,+ sourceEndSec: secondsSchema,+});++const replaceTimelineArgs = z.object({+ intervals: z.array(z.object({ startSec: secondsSchema, endSec: secondsSchema })).min(1),+ reason: z.string().default(""),+});++const getTranscriptArgs = z.object({+ assetId: z.string().min(1).optional(),+});++export const AGENT_TOOL_SPECS: AgentToolSpec[] = [+ {+ name: "getCurrentDocument",+ description:+ "Read a compact snapshot of the current project: assets (with durations), timeline clips, skip ranges, and counts of annotations/zoom ranges. Call this before editing if the snapshot in the system prompt may be stale.",+ parameters: { type: "object", properties: {}, additionalProperties: false },+ mutating: false,+ },+ {+ name: "getTranscript",+ description:+ "Read the transcript segments (speech and silence, with start/end seconds and text) for an asset. Omit assetId to read the primary asset's transcript.",+ parameters: {+ type: "object",+ properties: {+ assetId: { type: "string", description: "Asset id; defaults to the primary asset." },+ },+ additionalProperties: false,+ },+ mutating: false,+ },+ {+ name: "addSkip",+ description:+ "Add a skip range (a cut — this source-time span will not be played or exported). Times are in seconds of the asset's source time.",+ parameters: {+ type: "object",+ properties: {+ startSec: { type: "number", minimum: 0 },+ endSec: { type: "number", minimum: 0 },+ assetId: { type: "string", description: "Asset id; defaults to the primary asset." },+ reason: { type: "string", description: "Why this range is being cut." },+ },+ required: ["startSec", "endSec"],+ additionalProperties: false,+ },+ mutating: true,+ },+ {+ name: "setSkipRange",+ description: "Move or resize an existing skip range by id. Times are source-time seconds.",+ parameters: {+ type: "object",+ properties: {+ skipRangeId: { type: "string" },+ startSec: { type: "number", minimum: 0 },+ endSec: { type: "number", minimum: 0 },+ },+ required: ["skipRangeId", "startSec", "endSec"],+ additionalProperties: false,+ },+ mutating: true,+ },+ {+ name: "setClipRange",+ description:+ "Trim a clip: set its source in/out points (seconds). All clips are re-laid back-to-back afterwards, so downstream clips shift automatically.",+ parameters: {+ type: "object",+ properties: {+ clipId: { type: "string" },+ sourceStartSec: { type: "number", minimum: 0 },+ sourceEndSec: { type: "number", minimum: 0 },+ },+ required: ["clipId", "sourceStartSec", "sourceEndSec"],+ additionalProperties: false,+ },+ mutating: true,+ },+ {+ name: "replaceTimeline",+ description:+ "Replace the whole timeline with the given kept intervals of the primary asset's source time. Everything outside the intervals becomes a skip. Use for bulk edits like 'cut all silences'.",+ parameters: {+ type: "object",+ properties: {+ intervals: {+ type: "array",+ minItems: 1,+ items: {+ type: "object",+ properties: {+ startSec: { type: "number", minimum: 0 },+ endSec: { type: "number", minimum: 0 },+ },+ required: ["startSec", "endSec"],+ additionalProperties: false,+ },+ },+ reason: { type: "string" },+ },+ required: ["intervals"],+ additionalProperties: false,+ },+ mutating: true,+ },+];++export function isMutatingTool(name: string): boolean {+ return AGENT_TOOL_SPECS.find((t) => t.name === name)?.mutating ?? false;+}++// Compact projection of the document for the model: everything it needs to+// reference ids and times, nothing it doesn't (no waveform paths, no history).+export function documentSnapshotForModel(document: AxcutDocument): Record<string, unknown> {+ return {+ project: { id: document.project.id, title: document.project.title },+ primaryAssetId: document.project.primaryAssetId ?? document.assets[0]?.id ?? null,+ assets: document.assets.map((a) => ({+ id: a.id,+ label: a.label,+ durationSec: a.durationSec ?? null,+ })),+ clips: document.timeline.clips.map((c) => ({+ id: c.id,+ assetId: c.assetId,+ sourceStartSec: c.sourceStartSec,+ sourceEndSec: c.sourceEndSec ?? null,+ timelineStartSec: c.timelineStartSec,+ timelineEndSec: c.timelineEndSec,+ })),+ skipRanges: document.timeline.skipRanges.map((s) => ({+ id: s.id,+ assetId: s.assetId,+ startSec: s.startSec,+ endSec: s.endSec,+ reason: s.reason,+ })),+ annotationCount: document.annotations.length,+ zoomRangeCount: document.zoomRanges.length,+ hasTranscript: document.transcripts.length > 0 || document.transcript !== null,+ };+}++function failure(message: string): AgentToolExecution {+ return { ok: false, resultJson: JSON.stringify({ error: message }) };+}++export function executeAgentTool(+ document: AxcutDocument,+ name: string,+ rawArgs: string,+): AgentToolExecution {+ let args: unknown = {};+ if (rawArgs.trim()) {+ try {+ args = JSON.parse(rawArgs);+ } catch {+ return failure(`Tool arguments are not valid JSON: ${rawArgs.slice(0, 120)}`);+ }+ }++ switch (name) {+ case "getCurrentDocument": {+ return { ok: true, resultJson: JSON.stringify(documentSnapshotForModel(document)) };+ }++ case "getTranscript": {+ const parsed = getTranscriptArgs.safeParse(args);+ if (!parsed.success) return failure(parsed.error.message);+ const assetId =+ parsed.data.assetId ?? document.project.primaryAssetId ?? document.assets[0]?.id;+ const transcript =+ document.transcripts.find((t) => t.assetId === assetId) ??+ (document.transcript?.assetId === assetId ? document.transcript : null);+ if (!transcript) {+ return failure(`No transcript for asset ${assetId ?? "(none)"}.`);+ }+ // ponytail: segments only — words would blow the context for long+ // recordings and the segment text already carries the content.+ const segments = transcript.segments.slice(0, 800).map((s) => ({+ id: s.id,+ kind: s.kind,+ startSec: s.startSec,+ endSec: s.endSec,+ text: s.text,+ }));+ return {+ ok: true,+ resultJson: JSON.stringify({ assetId, language: transcript.language, segments }),+ };+ }++ case "addSkip": {+ const parsed = addSkipArgs.safeParse(args);+ if (!parsed.success) return failure(parsed.error.message);+ const assetId =+ parsed.data.assetId ?? document.project.primaryAssetId ?? document.assets[0]?.id;+ if (!assetId) return failure("Project has no assets — nothing to skip.");+ if (!document.assets.some((a) => a.id === assetId)) {+ return failure(`Unknown asset: ${assetId}`);+ }+ const startSec = Math.min(parsed.data.startSec, parsed.data.endSec);+ const endSec = Math.max(parsed.data.startSec, parsed.data.endSec);+ const skip = {+ id: createId("skip"),+ assetId,+ startSec,+ endSec,+ reason: parsed.data.reason,+ origin: "agent" as const,+ };+ const next: AxcutDocument = {+ ...document,+ timeline: {+ ...document.timeline,+ skipRanges: [...document.timeline.skipRanges, skip],+ },+ };+ return {+ ok: true,+ document: next,+ resultJson: JSON.stringify({ skipRangeId: skip.id, startSec, endSec }),+ summary: `added skip ${formatSec(startSec)} – ${formatSec(endSec)}`,+ };+ }++ case "setSkipRange": {+ const parsed = setSkipRangeArgs.safeParse(args);+ if (!parsed.success) return failure(parsed.error.message);+ const { skipRangeId } = parsed.data;+ if (!document.timeline.skipRanges.some((r) => r.id === skipRangeId)) {+ return failure(`Unknown skip range: ${skipRangeId}`);+ }+ const startSec = Math.min(parsed.data.startSec, parsed.data.endSec);+ const endSec = Math.max(parsed.data.startSec, parsed.data.endSec);+ const next: AxcutDocument = {+ ...document,+ timeline: {+ ...document.timeline,+ skipRanges: document.timeline.skipRanges.map((r) =>+ r.id === skipRangeId ? { ...r, startSec, endSec } : r,+ ),+ },+ };+ return {+ ok: true,+ document: next,+ resultJson: JSON.stringify({ skipRangeId, startSec, endSec }),+ summary: `moved skip to ${formatSec(startSec)} – ${formatSec(endSec)}`,+ };+ }++ case "setClipRange": {+ const parsed = setClipRangeArgs.safeParse(args);+ if (!parsed.success) return failure(parsed.error.message);+ const { clipId } = parsed.data;+ if (!document.timeline.clips.some((c) => c.id === clipId)) {+ return failure(`Unknown clip: ${clipId}`);+ }+ const sourceStartSec = Math.min(parsed.data.sourceStartSec, parsed.data.sourceEndSec);+ const sourceEndSec = Math.max(parsed.data.sourceStartSec, parsed.data.sourceEndSec);+ const clips = resequenceClips(+ document.timeline.clips.map((c) =>+ c.id === clipId+ ? {+ ...c,+ sourceStartSec,+ sourceEndSec,+ // ponytail: zero the timeline span so resequenceClips derives the+ // clip length from the new source range instead of the stale one.+ timelineStartSec: 0,+ timelineEndSec: 0,+ }+ : c,+ ),+ );+ const next: AxcutDocument = {+ ...document,+ timeline: { ...document.timeline, clips },+ };+ return {+ ok: true,+ document: next,+ resultJson: JSON.stringify({ clipId, sourceStartSec, sourceEndSec }),+ summary: `trimmed clip to ${formatSec(sourceStartSec)} – ${formatSec(sourceEndSec)}`,+ };+ }++ case "replaceTimeline": {+ const parsed = replaceTimelineArgs.safeParse(args);+ if (!parsed.success) return failure(parsed.error.message);+ const userPlaced = document.timeline.clips.filter((c) => c.origin === "user");+ if (userPlaced.length > 0) {+ return {+ ok: false,+ resultJson: JSON.stringify({+ error: `Refused: ${userPlaced.length} user-placed clip(s) would be discarded. ` ++ `For 'remove silences' / 'cut pauses' use addSkip (one call per silent range), ` ++ `which preserves the placed clips and adds the cuts. ` ++ `For 'trim this clip' use setClipRange. ` ++ `Only call replaceTimeline when the user explicitly asks to rebuild the timeline from scratch ` ++ `(after they have already cleared their placed clips).`,+ }),+ };+ }+ let next: AxcutDocument;+ try {+ next = replaceTimeline(document, parsed.data.intervals, parsed.data.reason, "agent");+ } catch (err) {+ return failure(err instanceof Error ? err.message : String(err));+ }+ const kept = parsed.data.intervals.length;+ return {+ ok: true,+ document: next,+ resultJson: JSON.stringify({+ clipCount: next.timeline.clips.length,+ skipCount: next.timeline.skipRanges.length,+ }),+ summary: `rebuilt timeline from ${kept} interval${kept === 1 ? "" : "s"} (${next.timeline.clips.length} clips, ${next.timeline.skipRanges.length} skips)`,+ };+ }++ default:+ return failure(`Unknown tool: ${name}`);+ }+}diff --git a/electron/ai-edition/deep-agent/service.ts b/electron/ai-edition/deep-agent/service.tsindex 548ee52d2..a4aa9d57f 100644--- a/electron/ai-edition/deep-agent/service.ts+++ b/electron/ai-edition/deep-agent/service.ts@@ -60,20 +60,27 @@ const SYSTEM_PROMPT = ["Help them cut silences, tighten pacing, add captions, and rewrite titles.","Be concise, action-oriented, and reference the timeline or transcript by time when relevant.","You can call the tools below against the live document snapshot; the runtime executes each edit and feeds the result back into the loop.",-].join(" ");+ "The AxcutDocument is the single source of truth. The timeline, the transcript editor, and the chat panel are all direct editors of the same document — when the user places a clip on the timeline, the document updates immediately, and when the timeline is empty, the document has no clips. Your edits operate on the live document, so preserve the user's placed clips.",+ "",+ "Tool-selection rules (these are non-negotiable):",+ "- 'remove silences' / 'cut pauses' / 'cut the silence' / 'kill the silence' / 'tighten pacing': call addSkip ONCE PER SILENT RANGE. Do NOT call setClipRange, do NOT call replaceTimeline. The placed clip is the canonical cut, the silence becomes a skip range inside it.",+ "- 'trim this clip to 0-30' / 'cut the end of this clip' / 'shorten this clip': call setClipRange with the new sourceStartSec/sourceEndSec.",+ "- 'replace the timeline' / 'rebuild the timeline' / 'start over with these intervals': call replaceTimeline. Only when the user explicitly asks for a full rebuild.",+ "Anything else (move a clip, resize a skip, change a clip's order, etc.) — pick the most specific tool. If the request is ambiguous, prefer the smallest edit that satisfies it.",+].join("\n");const TOOL_DESCRIPTIONS: Record<string, string> = {getCurrentDocument:- "Read a compact snapshot of the current project: assets (with durations), timeline clips, skip ranges, and counts of annotations/zoom regions. Call this before editing if the snapshot in the system prompt may be stale.",+ "Read a compact snapshot of the current project: assets (with durations), timeline clips, skip ranges, and counts of annotations/zoom ranges. Call this before editing if the snapshot in the system prompt may be stale. The AxcutDocument is the single source of truth — your edits should preserve the user's placed clips and any timeline state they have already set up.",getTranscript:"Read the transcript segments (speech and silence, with start/end seconds and text) for an asset. Omit assetId to read the primary asset's transcript.",addSkip:- "Add a skip range (a cut — this source-time span will not be played or exported). Times are in seconds of the asset's source time.",+ "Add a skip range (a cut — this source-time span will not be played or exported). Times are in seconds of the asset's source time. This is the preferred (and for 'remove silences' requests, the only) way to handle silences; it preserves the user's placed clips and only adds a cut. Call this once per silent range.",setSkipRange: "Move or resize an existing skip range by id. Times are source-time seconds.",setClipRange:- "Trim a clip: set its source in/out points (seconds). All clips are re-laid back-to-back afterwards, so downstream clips shift automatically.",+ "Trim a clip: set its source in/out points (seconds). All clips are re-laid back-to-back afterwards, so downstream clips shift automatically. Use this ONLY when the user explicitly asks to shorten or extend a user-placed clip. Do NOT use this for 'remove silences' or 'cut pauses' — for those, use addSkip.",replaceTimeline:- "Replace the whole timeline with the given kept intervals of the primary asset's source time. Everything outside the intervals becomes a skip. Use for bulk edits like 'cut all silences'.",+ "Replace the whole timeline with the given kept intervals of the primary asset's source time. Everything outside the intervals becomes a skip. DO NOT use this for 'cut silences' or 'remove pauses' — the user has likely placed clips on the timeline that you'd be discarding. Use this ONLY when the user explicitly asks you to rebuild the timeline from scratch (e.g. 'start over with the kept intervals from the transcript' or 'replace everything with these intervals').",};// ponytail: mutable document holder so a write-tool that updates the snapshotdiff --git a/src/components/ai-edition/LeftPanel.tsx b/src/components/ai-edition/LeftPanel.tsxindex bfd5e58ef..a38dcdce0 100644--- a/src/components/ai-edition/LeftPanel.tsx+++ b/src/components/ai-edition/LeftPanel.tsx@@ -773,6 +773,20 @@ function ChatStripPanel() {const text = input.trim();setInput("");setBusy(true);+ // ponytail: pre-seed the user message so the rewind ↩ button is+ // available before the server confirms. Mirrors axcut's+ // `before-message` checkpoint that runChat records in chat-service.+ const optimisticUserId = `local_${Date.now()}_u`;+ setMessages((prev) => [+ ...prev,+ {+ id: optimisticUserId,+ role: "user",+ content: text,+ time: new Date().toLocaleTimeString(),+ checkpointId: optimisticUserId,+ },+ ]);try {// Mirror axcut's `getOrCreateSession`: the composer works with zero// setup, so the first message on a project with no sessions yet@@ -793,10 +807,6 @@ function ChatStripPanel() {text,documentSnapshot,);- setMessages((prev) => [- ...prev,- { role: "user", content: text, time: new Date().toLocaleTimeString() },- ]);const assistant = result.assistantMessage;if (result.success && assistant) {if (result.document) {@@ -980,8 +990,10 @@ function ChatStripPanel() {// change so the % tracks the live history.const budget = computeBudget(messages);+ const [compactNowPending, setCompactNowPending] = useState(false);const compactNow = useCallback(async () => {- if (!projectId || !activeSessionId) return;+ if (!projectId || !activeSessionId || compactNowPending) return;+ setCompactNowPending(true);try {const result = await nativeBridgeClient.aiEdition.chatCompact(projectId, activeSessionId);if (!result) {@@ -1003,8 +1015,10 @@ function ChatStripPanel() {toast.error("Compact failed", {description: err instanceof Error ? err.message : String(err),});+ } finally {+ setCompactNowPending(false);}- }, [projectId, activeSessionId]);+ }, [projectId, activeSessionId, compactNowPending]);const newChat = useCallback(async () => {if (!projectId) return;@@ -1121,46 +1135,192 @@ function ChatStripPanel() {return (<aside className={styles.panel}>- <div className={styles.chatStrip}>- <div className={styles.chatStripRow}>- <span- className={styles.ctxPill}- title={`${budget.usedTokens} / ${budget.budgetTokens} estimated tokens`}- >- <span className={styles.d} aria-hidden />- {Math.min(100, Math.round(budget.ratio * 100))}% context- </span>- <span className={styles.stripActions}>- <button- type="button"- title="Compact"- aria-label="Compact"- onClick={() => void compactNow()}+ <div className={styles.panelHeader}>+ <div className={styles.chatStrip}>+ <div className={styles.chatStripRow}>+ <span+ className={styles.ctxPill}+ title={`${budget.usedTokens} / ${budget.budgetTokens} estimated tokens`}>- <svg- width={14}- height={14}- viewBox="0 0 24 24"- fill="none"- stroke="currentColor"- strokeWidth="2"- strokeLinecap="round"- strokeLinejoin="round"+ <span className={styles.d} aria-hidden />+ {Math.min(100, Math.round(budget.ratio * 100))}% context+ </span>+ <span className={styles.stripActions}>+ <button+ type="button"+ title="Compact context"+ aria-label="Compact context"+ className={styles.iconBtn}+ onClick={() => void compactNow()}+ disabled={!activeSessionId || compactNowPending}>- <path d="M 6 6 L 12 10 L 18 6" />- <path d="M 4 12 L 20 12" />- <path d="M 6 18 L 12 14 L 18 18" />- </svg>- </button>+ <svg+ width={14}+ height={14}+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ strokeWidth="2"+ strokeLinecap="round"+ strokeLinejoin="round"+ aria-hidden="true"+ >+ <path d="M8 4l4 4 4-4" />+ <path d="M8 20l4-4 4 4" />+ <path d="M6 12h12" />+ </svg>+ </button>+ <button+ type="button"+ title="AI settings"+ aria-label="AI settings"+ onClick={() => setSettingsOpen(true)}+ >+ <svg+ width={14}+ height={14}+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ strokeWidth="2"+ strokeLinecap="round"+ strokeLinejoin="round"+ >+ <circle cx="12" cy="12" r="3" />+ <path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z" />+ </svg>+ </button>+ </span>+ <span className={styles.stripActions}>+ <button+ type="button"+ title="History"+ aria-label="History"+ onClick={() => setChatsOpen(true)}+ >+ <svg+ width={14}+ height={14}+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ strokeWidth="2"+ strokeLinecap="round"+ strokeLinejoin="round"+ >+ <path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" />+ <path d="M3 3v5h5" />+ <path d="M12 7v5l4 2" />+ </svg>+ </button>+ <button+ type="button"+ title="New conversation"+ aria-label="New conversation"+ onClick={newChat}+ >+ <svg+ width={14}+ height={14}+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ strokeWidth="2"+ strokeLinecap="round"+ strokeLinejoin="round"+ >+ <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" />+ <path d="M12 7v6" />+ <path d="M9 10h6" />+ </svg>+ </button>+ </span>+ </div>+ </div>++ {activeSessionId ? (+ <div+ style={{+ display: "flex",+ alignItems: "center",+ justifyContent: "space-between",+ gap: 8,+ padding: "6px var(--sp-3)",+ borderTop: "1px solid var(--border-soft)",+ background: "var(--surface-warm)",+ }}+ >+ {editingSessionId === activeSessionId ? (+ <input+ ref={editingInputRef}+ type="text"+ autoFocus+ value={editingTitle}+ onChange={(event) => setEditingTitle(event.target.value)}+ onFocus={(event) => event.currentTarget.select()}+ onBlur={() => {+ if (editingSessionId) void commitEditTitle(editingSessionId);+ }}+ onKeyDown={(event) => {+ if (event.key === "Enter") {+ event.preventDefault();+ if (editingSessionId) void commitEditTitle(editingSessionId);+ } else if (event.key === "Escape") {+ event.preventDefault();+ cancelEditTitle();+ }+ }}+ style={{+ font: "500 12px/1.3 var(--font-body)",+ color: "var(--fg)",+ background: "var(--surface)",+ border: "1px solid var(--accent)",+ borderRadius: "var(--r-sm)",+ padding: "2px 6px",+ flex: 1,+ minWidth: 0,+ }}+ />+ ) : (+ <span+ style={{+ font: "500 12px/1.3 var(--font-body)",+ color: "var(--fg-2)",+ overflow: "hidden",+ textOverflow: "ellipsis",+ whiteSpace: "nowrap",+ flex: 1,+ cursor: "text",+ }}+ title="Click to rename"+ onClick={() => {+ const current = sessions.find((s) => s.id === activeSessionId);+ if (current) beginEditTitle(activeSessionId, current.title);+ }}+ >+ {sessions.find((s) => s.id === activeSessionId)?.title ?? "Conversation"}+ </span>+ )}<buttontype="button"- title="AI settings"- aria-label="AI settings"- onClick={() => setSettingsOpen(true)}+ title="Rename conversation"+ aria-label="Rename conversation"+ disabled={editingSessionId === activeSessionId}+ onClick={() => {+ const current = sessions.find((s) => s.id === activeSessionId);+ if (current) beginEditTitle(activeSessionId, current.title);+ }}+ style={{+ background: "transparent",+ border: 0,+ color: "var(--meta)",+ cursor: "pointer",+ padding: 2,+ }}><svg- width={14}- height={14}+ width={12}+ height={12}viewBox="0 0 24 24"fill="none"stroke="currentColor"@@ -1168,21 +1328,32 @@ function ChatStripPanel() {strokeLinecap="round"strokeLinejoin="round">- <circle cx="12" cy="12" r="3" />- <path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z" />+ <path d="M12 20h9" />+ <path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4z" /></svg></button>- </span>- <span className={styles.stripActions}><buttontype="button"- title="History"- aria-label="History"- onClick={() => setChatsOpen(true)}+ title="Delete conversation"+ aria-label="Delete conversation"+ onClick={() => {+ const current = sessions.find((s) => s.id === activeSessionId);+ if (!current) return;+ if (window.confirm(`Delete "${current.title}"?`)) {+ void handleDelete(activeSessionId);+ }+ }}+ style={{+ background: "transparent",+ border: 0,+ color: "var(--meta)",+ cursor: "pointer",+ padding: 2,+ }}><svg- width={14}- height={14}+ width={12}+ height={12}viewBox="0 0 24 24"fill="none"stroke="currentColor"@@ -1190,188 +1361,35 @@ function ChatStripPanel() {strokeLinecap="round"strokeLinejoin="round">- <path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" />- <path d="M3 3v5h5" />- <path d="M12 7v5l4 2" />+ <polyline points="3 6 5 6 21 6" />+ <path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6" />+ <path d="M10 11v6" />+ <path d="M14 11v6" />+ <path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2" /></svg></button><buttontype="button"- title="New conversation"- aria-label="New conversation"- onClick={newChat}- >- <svg- width={14}- height={14}- viewBox="0 0 24 24"- fill="none"- stroke="currentColor"- strokeWidth="2"- strokeLinecap="round"- strokeLinejoin="round"- >- <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" />- <path d="M12 7v6" />- <path d="M9 10h6" />- </svg>- </button>- </span>- </div>- <div className={styles.chatHint}>Describe the edit you want…</div>- </div>-- {activeSessionId ? (- <div- style={{- display: "flex",- alignItems: "center",- justifyContent: "space-between",- gap: 8,- padding: "6px var(--sp-3)",- borderTop: "1px solid var(--border-soft)",- background: "var(--surface-warm)",- }}- >- {editingSessionId === activeSessionId ? (- <input- ref={editingInputRef}- type="text"- autoFocus- value={editingTitle}- onChange={(event) => setEditingTitle(event.target.value)}- onFocus={(event) => event.currentTarget.select()}- onBlur={() => {- if (editingSessionId) void commitEditTitle(editingSessionId);- }}- onKeyDown={(event) => {- if (event.key === "Enter") {- event.preventDefault();- if (editingSessionId) void commitEditTitle(editingSessionId);- } else if (event.key === "Escape") {- event.preventDefault();- cancelEditTitle();- }- }}+ title="Add skip range"+ aria-label="Add skip range"+ disabled={!activeSessionId || queueBusy}+ onClick={runAddSkip}style={{- font: "500 12px/1.3 var(--font-body)",- color: "var(--fg)",- background: "var(--surface)",- border: "1px solid var(--accent)",+ background: "transparent",+ border: "1px solid var(--border-soft)",borderRadius: "var(--r-sm)",- padding: "2px 6px",- flex: 1,- minWidth: 0,- }}- />- ) : (- <span- style={{- font: "500 12px/1.3 var(--font-body)",color: "var(--fg-2)",- overflow: "hidden",- textOverflow: "ellipsis",+ font: "500 10px var(--font-body)",+ padding: "2px 6px",+ cursor: queueBusy ? "wait" : "pointer",whiteSpace: "nowrap",- flex: 1,- cursor: "text",}}- title="Click to rename"- onClick={() => {- const current = sessions.find((s) => s.id === activeSessionId);- if (current) beginEditTitle(activeSessionId, current.title);- }}- >- {sessions.find((s) => s.id === activeSessionId)?.title ?? "Conversation"}- </span>- )}- <button- type="button"- title="Rename conversation"- aria-label="Rename conversation"- disabled={editingSessionId === activeSessionId}- onClick={() => {- const current = sessions.find((s) => s.id === activeSessionId);- if (current) beginEditTitle(activeSessionId, current.title);- }}- style={{- background: "transparent",- border: 0,- color: "var(--meta)",- cursor: "pointer",- padding: 2,- }}- >- <svg- width={12}- height={12}- viewBox="0 0 24 24"- fill="none"- stroke="currentColor"- strokeWidth="2"- strokeLinecap="round"- strokeLinejoin="round"- >- <path d="M12 20h9" />- <path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4z" />- </svg>- </button>- <button- type="button"- title="Delete conversation"- aria-label="Delete conversation"- onClick={() => {- const current = sessions.find((s) => s.id === activeSessionId);- if (!current) return;- if (window.confirm(`Delete "${current.title}"?`)) {- void handleDelete(activeSessionId);- }- }}- style={{- background: "transparent",- border: 0,- color: "var(--meta)",- cursor: "pointer",- padding: 2,- }}- >- <svg- width={12}- height={12}- viewBox="0 0 24 24"- fill="none"- stroke="currentColor"- strokeWidth="2"- strokeLinecap="round"- strokeLinejoin="round">- <polyline points="3 6 5 6 21 6" />- <path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6" />- <path d="M10 11v6" />- <path d="M14 11v6" />- <path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2" />- </svg>- </button>- <button- type="button"- title="Add skip range"- aria-label="Add skip range"- disabled={!activeSessionId || queueBusy}- onClick={runAddSkip}- style={{- background: "transparent",- border: "1px solid var(--border-soft)",- borderRadius: "var(--r-sm)",- color: "var(--fg-2)",- font: "500 10px var(--font-body)",- padding: "2px 6px",- cursor: queueBusy ? "wait" : "pointer",- whiteSpace: "nowrap",- }}- >- + skip- </button>- </div>- ) : null}+ + skip+ </button>+ </div>+ ) : null}+ </div><div className={styles.panelBody} ref={scrollRef}>{messages.length === 0 ? (diff --git a/src/components/ai-edition/NewEditorShell.module.css b/src/components/ai-edition/NewEditorShell.module.cssindex d86303eed..d6e248cd7 100644--- a/src/components/ai-edition/NewEditorShell.module.css+++ b/src/components/ai-edition/NewEditorShell.module.css@@ -1,2143 +1,2156 @@-/* Editor shell — 4-row grid: titlebar · workbench · handle · bottombar.- * Mirrors design/openscreen-editor.html. Tokens come from- * src/styles/design-tokens.css (light + dark via :root[data-theme="dark"]). */--.app {- display: grid;- grid-template-rows: var(--titlebar-h) 1fr var(--handle-h) var(--bottom-h);- height: 100vh;- min-width: 1024px;- background: var(--bg);- color: var(--fg);- font-family: var(--font-body);- font-size: var(--fs-app);- line-height: 1.5;- overflow: hidden;- user-select: none;-}--.app[data-collapse~="left"] {- --panel-w-left: 0px;-}-.app[data-collapse~="left"] .leftRail,-.app[data-collapse~="left"] .leftPanel,-.app[data-collapse~="left"] .handleLeft {- display: none;-}--.app[data-collapse~="right"] {- --panel-w-right: 0px;-}-.app[data-collapse~="right"] .rightStack,-.app[data-collapse~="right"] .rightRail,-.app[data-collapse~="right"] .handleRight {- display: none;-}--.app[data-collapse~="bottom"] {- --bottom-h: 0px;-}-.app[data-collapse~="bottom"] .bottombar {- display: none;-}-.app[data-collapse~="bottom"] .handleBottom {- display: none;-}--/* ─── titlebar ──────────────────────────────────────────────────── */-.titlebar {- display: flex;- align-items: center;- gap: var(--sp-3);- padding-inline: var(--sp-4);- background: var(--bg);- border-bottom: 1px solid var(--border-soft);- min-width: 0;- /* ponytail: make the titlebar the drag region in Electron. The buttons- * opt out via inline -webkit-app-region: no-drag (see Titlebar.tsx). */- -webkit-app-region: drag;- app-region: drag;-}-.titlebar button,-.titlebar input,-.titlebar select,-.titlebar textarea,-.titlebar .langSel,-.titlebar .recorderBtn {- -webkit-app-region: no-drag;- app-region: no-drag;-}-.titlebar .lights {- display: inline-flex;- gap: 6px;- margin-right: var(--sp-3);-}-.titlebar .lights span {- width: 11px;- height: 11px;- border-radius: 50%;- border: 1px solid var(--overlay-border);-}-.titlebar .lights .r { background: var(--light-red); }-.titlebar .lights .y { background: var(--light-yellow); }-.titlebar .lights .g { background: var(--light-green); }--.titlebar .brand {- display: inline-flex;- align-items: center;- gap: 8px;- font-family: var(--font-display);- font-size: var(--fs-title);- font-weight: 500;- letter-spacing: -0.005em;- color: var(--fg);-}-.titlebar .brandMark {- width: 18px;- height: 18px;- border-radius: 5px;- background: var(--accent);- display: grid;- place-items: center;- color: var(--accent-on);- font: 600 11px/1 var(--font-display);-}-.titlebar .sep {- width: 1px;- height: 16px;- background: var(--border);-}-.titlebar .project {- display: inline-flex;- align-items: center;- gap: var(--sp-2);- font-size: var(--fs-app);- color: var(--muted);- min-width: 0;-}-.titlebar .projectName {- color: var(--fg-2);- font-weight: 500;- overflow: hidden;- text-overflow: ellipsis;- white-space: nowrap;- max-width: 280px;- background: transparent;- border: 0;- padding: 2px 6px;- border-radius: var(--r-sm);- cursor: text;- font: inherit;- -webkit-app-region: no-drag;- app-region: no-drag;-}-.titlebar .projectName:hover:not(:disabled) {- background: var(--surface-3);-}-.titlebar .projectInput {- background: var(--surface);- color: var(--fg);- border: 1px solid var(--accent);- border-radius: var(--r-sm);- padding: 2px 6px;- font: 500 13px var(--font-body);- outline: none;- min-width: 200px;- max-width: 360px;- -webkit-app-region: no-drag;- app-region: no-drag;-}-.titlebar .saved {- display: inline-flex;- align-items: center;- gap: 6px;- font-family: var(--font-mono);- font-size: var(--fs-app-sm);- color: var(--muted);-}-.titlebar .saved .dot {- width: 6px;- height: 6px;- border-radius: 50%;- background: var(--success);-}-.titlebar .projActions {- display: inline-flex;- align-items: center;- gap: var(--sp-1);- margin-right: var(--sp-1);-}-.titlebar .right {- margin-left: auto;- display: inline-flex;- align-items: center;- gap: var(--sp-1);-}-.titlebar .iconBtn {- width: 28px;- height: 28px;- display: grid;- place-items: center;- border-radius: var(--r-sm);- color: var(--muted);- background: transparent;- border: 0;- cursor: pointer;- transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);-}-.titlebar .iconBtn:hover {- background: var(--surface-3);- color: var(--fg);-}-.titlebar .iconBtn[aria-pressed="true"] {- background: var(--accent-soft);- color: var(--accent);-}-.titlebar .langSel {- display: inline-flex;- align-items: center;- gap: 6px;- height: 26px;- padding: 0 6px;- background: transparent;- border: 1px solid var(--border-soft);- border-radius: var(--r-md);- color: var(--fg-2);- font: 500 var(--fs-app)/1 var(--font-display);- cursor: pointer;- transition: background var(--motion-fast) var(--ease), border-color var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);-}-.titlebar .langSel:hover {- background: var(--surface-3);- border-color: var(--border);- color: var(--fg);-}-.titlebar .recorderBtn {- display: inline-flex;- align-items: center;- gap: 6px;- height: 26px;- padding: 0 10px 0 8px;- border-radius: var(--r-md);- background: var(--accent-soft);- color: var(--accent);- border: 1px solid color-mix(in oklch, var(--accent) 22%, transparent);- transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);- font: 500 var(--fs-app-sm)/1 var(--font-display);- letter-spacing: 0.01em;- cursor: pointer;-}-.titlebar .recorderBtn:hover {- background: color-mix(in oklch, var(--accent) 18%, var(--surface-3));-}--/* ─── workbench — 7 columns: rail · panel · handle · preview · handle · stack · rail */-.workbench {- display: grid;- grid-template-columns:- var(--rail-w)- var(--panel-w-left)- var(--handle-w)- 1fr- var(--handle-w)- var(--panel-w-right)- var(--rail-w);- min-height: 0;- background: var(--bg);- overflow: hidden;-}-.workbench > * {- min-height: 0;-}-.workbench > * + * {- border-left: 1px solid var(--border-soft);-}--/* ─── rails — vertical icon strips ─────────────────────────────── */-.rail {- display: flex;- flex-direction: column;- align-items: center;- gap: var(--sp-1);- padding: var(--sp-2) 0;- background: var(--bg);- min-width: 0;-}-.rail button {- width: 36px;- height: 36px;- display: grid;- place-items: center;- border-radius: var(--r-md);- color: var(--muted);- background: transparent;- border: 0;- cursor: pointer;- transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);- position: relative;-}-.rail button:hover {- background: var(--surface-3);- color: var(--fg);-}-.rail button[aria-pressed="true"] {- color: var(--accent);- background: var(--accent-soft);-}-.rail button[aria-pressed="true"]::before {- content: "";- position: absolute;- left: -8px;- top: 8px;- bottom: 8px;- width: 3px;- border-radius: 2px;- background: var(--accent);-}-.rail .sepH {- width: 24px;- height: 1px;- background: var(--border);- margin: var(--sp-1) 0;-}--/* ─── panels (chat, transcript, etc.) ──────────────────────────── */-.panel {- display: grid;- grid-template-rows: auto 1fr auto;- min-width: 0;- min-height: 0;- background: var(--bg);- overflow: hidden;-}-.panelHead {- display: flex;- align-items: center;- gap: var(--sp-2);- padding: var(--sp-3) var(--sp-4);- border-bottom: 1px solid var(--border-soft);- min-height: 44px;-}-.panelHead h2 {- margin: 0;- font-family: var(--font-display);- font-size: 14px;- font-weight: 500;- letter-spacing: -0.005em;- color: var(--fg);-}-.panelHead .right {- margin-left: auto;- display: inline-flex;- gap: var(--sp-1);-}-.panelHead .iconBtn {- width: 24px;- height: 24px;- display: grid;- place-items: center;- border-radius: var(--r-sm);- color: var(--meta);- background: transparent;- border: 0;- cursor: pointer;- transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);-}-.panelHead .iconBtn:hover {- background: var(--surface-3);- color: var(--fg-2);-}-.panelBody {- overflow-y: auto;- padding: var(--sp-3) var(--sp-4);- scrollbar-width: thin;- scrollbar-color: var(--border) transparent;- min-height: 0;-}-.panelBody::-webkit-scrollbar {- width: 8px;- height: 8px;-}-.panelBody::-webkit-scrollbar-thumb {- background: var(--border);- border-radius: 4px;-}-.panelBody::-webkit-scrollbar-thumb:hover {- background: var(--border-hi);-}--/* ─── resize handles ───────────────────────────────────────────── */-.handle {- background: transparent;- position: relative;- z-index: 2;- transition: background var(--motion-fast) var(--ease);- cursor: col-resize;-}-.handleRow {- cursor: row-resize;- grid-column: 1 / -1;- border-bottom: 1px solid var(--border);-}-.handle:hover,-.handle.isDragging {- background: var(--surface-2);-}-.handle::before,-.handle::after {- content: "";- position: absolute;- background: var(--dim);- border-radius: 1px;- opacity: 0.45;- transition: opacity var(--motion-fast) var(--ease);- pointer-events: none;-}-.handleCol::before,-.handleCol::after {- left: 50%;- width: 1px;- height: 14px;- transform: translateX(-50%);-}-.handleCol::before { top: calc(50% - 16px); }-.handleCol::after { top: calc(50% + 2px); }-.handleRow::before,-.handleRow::after {- top: 50%;- height: 1px;- width: 14px;- transform: translateY(-50%);-}-.handleRow::before { left: calc(50% - 16px); }-.handleRow::after { left: calc(50% + 2px); }-.handle:hover::before,-.handle:hover::after,-.handle.isDragging::before,-.handle.isDragging::after {- opacity: 1;-}-.handle.isDragging {- background: var(--accent-soft);-}--/* ─── preview area ─────────────────────────────────────────────── */-.previewWrap {- display: grid;- grid-template-rows: 1fr auto;- background: var(--surface-1);- min-width: 0;- min-height: 0;- position: relative;-}-.previewCanvas {- position: relative;- display: grid;- place-items: center;- overflow: hidden;- padding: var(--sp-5);- min-height: 0;-}-.previewFrame {- position: relative;- aspect-ratio: 16 / 9;- max-width: 100%;- max-height: 100%;- width: 100%;- min-width: 0;- min-height: 0;- background:- radial-gradient(ellipse at 50% 35%,- var(--scene-sky-hi) 0%,- var(--scene-sky-mid) 35%,- var(--scene-foliage) 70%,- var(--scene-foliage-d) 100%);- /* ponytail: don't make the canvas itself a rounded card — the video /- camera apply their own border-radius for content clipping. A square- canvas blends into the editor chrome; the wallpaper is the visible- area, but no "frame around the canvas" effect. */- border-radius: 0;- overflow: hidden;- display: grid;- place-items: center;-}-.videoStage {- position: relative;- display: grid;- place-items: center;- min-width: 0;- min-height: 0;- overflow: visible;- z-index: 1;-}-.screenStage {- position: absolute;- overflow: hidden;- z-index: 1;- display: flex;-}-.screenStage > .container,-.screenStage > div > .container {- width: 100%;- height: 100%;-}-.previewEmpty {- display: flex;- flex-direction: column;- align-items: center;- justify-content: center;- gap: 8px;- color: var(--muted);- font-size: var(--fs-app);-}-.previewEmpty strong { color: var(--fg-2); }--/* ─── preview empty state (no project / no asset) ───────────────── */-.previewEmptyDrop {- position: relative;- width: 100%;- height: 100%;- display: flex;- align-items: center;- justify-content: center;-}-.previewEmptyDropOverlay {- position: absolute;- inset: 0;- z-index: 10;- display: flex;- flex-direction: column;- align-items: center;- justify-content: center;- gap: var(--sp-2);- border: 2px dashed var(--primary, #34B27B);- background: color-mix(in srgb, var(--primary, #34B27B) 10%, transparent);- border-radius: var(--r-sm);- pointer-events: none;-}-.previewEmptyDropIcon {- width: 40px;- height: 40px;- color: var(--primary, #34B27B);-}-.previewEmptyDropLabel {- font-size: var(--fs-app);- font-weight: 600;- color: var(--primary, #34B27B);-}-.previewEmptyInner {- display: flex;- flex-direction: column;- align-items: center;- gap: var(--sp-4);- padding: var(--sp-5);- text-align: center;- max-width: 28rem;-}-.previewEmptyLogo {- width: 64px;- height: 64px;- border-radius: var(--r-md);- opacity: 0.9;-}-.previewEmptyHeading {- display: flex;- flex-direction: column;- gap: var(--sp-1);-}-.previewEmptyTitle {- margin: 0;- font-size: 1.25rem;- font-weight: 600;- color: var(--fg-2);-}-.previewEmptyDescription {- margin: 0;- font-size: 0.875rem;- color: var(--muted);- line-height: 1.5;-}-.previewEmptyActions {- display: flex;- flex-direction: column;- gap: var(--sp-2);- width: 100%;- max-width: 18rem;-}-.previewEmptyPrimaryButton {- display: flex;- align-items: center;- justify-content: center;- gap: var(--sp-2);- padding: var(--sp-3) var(--sp-4);- border-radius: var(--r-sm);- background: var(--primary, #34B27B);- color: #fff;- border: none;- font-weight: 500;- font-size: 0.875rem;- cursor: pointer;- transition: background-color 120ms ease;-}-.previewEmptyPrimaryButton:hover {- filter: brightness(0.95);-}-.previewEmptySecondaryButton {- display: flex;- align-items: center;- justify-content: center;- gap: var(--sp-2);- padding: var(--sp-3) var(--sp-4);- border-radius: var(--r-sm);- background: var(--card);- color: var(--fg-2);- border: 1px solid var(--border);- font-weight: 500;- font-size: 0.875rem;- cursor: pointer;- transition: background-color 120ms ease;-}-.previewEmptySecondaryButton:hover {- background: var(--accent, rgba(255, 255, 255, 0.06));-}-.previewEmptyButtonIcon {- width: 16px;- height: 16px;-}-.previewEmptyHint {- margin: 0;- font-size: 0.75rem;- color: var(--muted-foreground, rgba(255, 255, 255, 0.5));-}-.previewEmptyDragHint {- display: flex;- align-items: center;- gap: var(--sp-1);- margin: 0;- font-size: 0.75rem;- color: var(--muted-foreground, rgba(255, 255, 255, 0.4));-}-.previewEmptyDragHintIcon {- width: 12px;- height: 12px;-}-.previewEmptyDialog {- max-width: 24rem;- padding: var(--sp-5);- background: var(--bg);- border: 1px solid var(--border);-}-.previewEmptyDialogHeader {- margin-bottom: var(--sp-3);-}-.previewEmptyDialogHeaderInner {- display: flex;- align-items: center;- gap: var(--sp-2);-}-.previewEmptyDialogLogo {- width: 36px;- height: 36px;- border-radius: var(--r-sm);- flex-shrink: 0;-}-.previewEmptyDialogTitle {- font-size: 1rem;- font-weight: 600;- color: var(--fg-2);- line-height: 1.2;-}-.previewEmptyDialogBody {- display: flex;- flex-direction: column;- align-items: center;- gap: var(--sp-2);- margin-bottom: var(--sp-4);- text-align: center;-}-.previewEmptyDialogIcon {- display: flex;- align-items: center;- justify-content: center;- width: 40px;- height: 40px;- border-radius: 9999px;- background: var(--card);- border: 1px solid var(--border);-}-.previewEmptyDialogAlertIcon {- width: 20px;- height: 20px;- color: var(--muted);-}-.previewEmptyDialogMessage {- margin: 0;- font-size: 0.875rem;- color: var(--muted);- line-height: 1.5;-}-.previewEmptyDialogClose {- display: flex;- align-items: center;- justify-content: center;- gap: var(--sp-1);- width: 100%;- padding: var(--sp-2) var(--sp-3);- border-radius: var(--r-sm);- background: var(--card);- color: var(--fg-2);- border: 1px solid var(--border);- font-size: 0.875rem;- font-weight: 500;- cursor: pointer;-}-.previewEmptyDialogCloseIcon {- width: 14px;- height: 14px;-}-.previewPip {- position: absolute;- right: var(--sp-3);- bottom: var(--sp-3);- width: 120px;- aspect-ratio: 16 / 9;- border-radius: var(--r-sm);- background: linear-gradient(135deg, var(--pip-bg-1) 0%, var(--pip-bg-2) 50%, var(--pip-bg-3) 100%);- border: 2px solid var(--bg);- box-shadow: var(--elev-card);- overflow: hidden;- display: grid;- place-items: center;- color: var(--overlay-text);- font-family: var(--font-mono);- font-size: 9px;- letter-spacing: 0.06em;- text-transform: uppercase;-}-.previewBadge {- position: absolute;- top: var(--sp-3);- right: var(--sp-3);- padding: 4px 8px;- border-radius: var(--r-xs);- background: var(--overlay-light);- color: var(--fg);- font-family: var(--font-mono);- font-size: 10px;- letter-spacing: 0.02em;- font-weight: 500;- backdrop-filter: blur(8px);-}-.bgBlur {- position: absolute;- inset: 0;- pointer-events: none;- z-index: 0;- transform: scale(1.06);-}-.previewFrame > .screenStage > video,-.previewFrame > .screenStage > div > video {- position: relative;- z-index: 1;-}-.pipCircle {- border-radius: 9999px !important;-}-.pipSquare {- border-radius: 0 !important;-}-.pipRounded {- border-radius: 18px !important;-}--/* Webcam overlay: real <video> driven by the cameraTrack. The slot is- transparent so clip-path / border-radius carve the camera without leaving- a rectangular placeholder peeking through. */-.webcamSlot {- background: transparent;- overflow: hidden;- z-index: 2;- display: flex;-}-.webcamSlot .webcamVideo {- width: 100%;- height: 100%;- object-fit: cover;- display: block;-}-.previewTimecode {- position: absolute;- top: var(--sp-3);- left: var(--sp-3);- padding: 4px 8px;- border-radius: var(--r-xs);- background: var(--overlay-dark);- color: var(--bg);- font-family: var(--font-mono);- font-size: 11px;- letter-spacing: 0.02em;-}--/* ─── transport bar ────────────────────────────────────────────── */-.transport {- display: flex;- align-items: center;- gap: var(--sp-2);- padding: var(--sp-2) var(--sp-4);- background: var(--bg);- border-top: 1px solid var(--border-soft);-}-.transport .tbtn {- width: 32px;- height: 32px;- display: grid;- place-items: center;- border-radius: var(--r-sm);- color: var(--fg-2);- background: transparent;- border: 0;- cursor: pointer;- transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);-}-.transport .tbtn:hover {- background: var(--surface-3);- color: var(--fg);-}-.transport .tbtn.play {- width: 36px;- height: 36px;- background: var(--fg);- color: var(--bg);- border-radius: 50%;-}-.transport .tbtn.play:hover {- background: var(--fg-2);-}-.transport .time {- font-family: var(--font-mono);- font-size: var(--fs-app-sm);- color: var(--fg);- letter-spacing: 0.02em;- min-width: 96px;- text-align: center;-}-.transport .time .sep { color: var(--meta); margin-inline: 4px; }-.transport .time .total { color: var(--muted); }-.transport .spacer { flex: 1; }--/* ─── right panel-stack (one pane visible at a time) ──────────── */-.rightStack {- grid-column: 6;- display: grid;- min-width: 0;- min-height: 0;- background: var(--bg);-}-.pane {- display: none;- grid-template-rows: auto 1fr;- min-height: 0;-}-.pane.isActive {- display: grid;-}-.paneHead {- display: flex;- align-items: center;- gap: var(--sp-2);- padding: 12px var(--sp-4);- border-bottom: 1px solid var(--border-soft);- min-height: 44px;-}-.paneHead h2 {- margin: 0;- font-family: var(--font-display);- font-size: 14px;- font-weight: 500;- letter-spacing: -0.005em;- color: var(--fg);-}-.paneBody {- overflow-y: auto;- padding: 12px var(--sp-4);- scrollbar-width: thin;- scrollbar-color: var(--border) transparent;- min-height: 0;-}--/* ─── pane tabs (sub-nav inside a pane) ───────────────────────── */-.paneTabs {- display: flex;- gap: 2px;- padding: 3px;- margin: 12px var(--sp-4);- background: var(--surface-warm);- border-radius: 10px;-}-.paneTabs button {- flex: 1;- padding: 7px 10px;- border: 0;- background: transparent;- border-radius: 7px;- font: 500 var(--fs-app-sm)/1 var(--font-body);- color: var(--muted);- cursor: pointer;- transition: background 150ms ease, color 150ms ease;-}-.paneTabs button.isActive {- background: var(--brand);- color: var(--accent-on);- box-shadow: 0 1px 2px rgba(22, 23, 29, 0.12);-}-.paneSection { display: none; }-.paneSection.isActive { display: block; }--/* ─── pane rows (label + control) ─────────────────────────────── */-.paneRow {- display: flex;- align-items: center;- justify-content: space-between;- gap: 12px;- padding: 12px 14px;- margin: 8px var(--sp-4);- border: 1px solid var(--border);- border-radius: 10px;- background: var(--bg);-}-.paneRow .label { font: 500 var(--fs-app) var(--font-body); color: var(--fg-2); }-.paneRow .info { color: var(--meta); font-size: var(--fs-app-sm); margin-left: 4px; }-.sectionLabel {- font: 500 var(--fs-app-sm) var(--font-body);- color: var(--fg-2);- margin: 4px var(--sp-4) 8px;-}-.uploadBtn {- display: flex;- align-items: center;- justify-content: center;- gap: 8px;- margin: 0 var(--sp-4) 12px;- padding: 12px;- border: 1px dashed var(--border);- border-radius: 10px;- background: var(--bg);- color: var(--muted);- font: 500 var(--fs-app-sm) var(--font-body);- cursor: pointer;-}-.uploadBtn:hover { border-color: var(--success); color: var(--success); }-.field {- display: grid;- grid-template-columns: 80px 1fr;- align-items: center;- gap: 8px;- padding: 4px var(--sp-4);-}-.field label {- font: 500 var(--fs-app-sm) var(--font-body);- color: var(--muted);-}-.field select,-.field input {- width: 100%;- padding: 6px 8px;- font: 400 var(--fs-app-sm) var(--font-body);- color: var(--fg-2);- background: var(--surface);- border: 1px solid var(--border);- border-radius: 6px;- outline: none;-}-.field select:focus,-.field input:focus { border-color: var(--brand); }--/* ─── bg thumb grid ────────────────────────────────────────────── */-.bgGrid {- display: grid;- grid-template-columns: repeat(4, 1fr);- gap: 8px;- padding: 0 var(--sp-4) var(--sp-4);-}-.bgThumb {- aspect-ratio: 1/1;- border-radius: 10px;- border: 1px solid transparent;- cursor: pointer;- transition: transform 150ms ease, border-color 150ms ease;- background: var(--surface-2);-}-.bgThumb:hover { transform: translateY(-1px); }-.bgThumb.isActive {- border-color: var(--brand);- box-shadow: 0 0 0 2px color-mix(in oklab, var(--brand), transparent 70%);-}--/* ─── toggle (switch) ──────────────────────────────────────────── */-.toggle {- width: 36px;- height: 20px;- border: 0;- padding: 0;- background: var(--border);- border-radius: 9999px;- position: relative;- cursor: pointer;- transition: background 150ms ease;- flex-shrink: 0;-}-.toggle::after {- content: "";- position: absolute;- top: 2px;- left: 2px;- width: 16px;- height: 16px;- background: var(--accent-on);- border-radius: 50%;- box-shadow: 0 1px 3px rgba(22, 23, 29, 0.2);- transition: transform 150ms ease;-}-.toggle.isOn { background: var(--brand); }-.toggle.isOn::after { transform: translateX(16px); }--/* ─── slider cell (effect) ─────────────────────────────────────── */-.sliderGrid {- display: grid;- grid-template-columns: 1fr 1fr;- gap: 10px;- padding: 0 var(--sp-4) var(--sp-4);-}-.sliderCell {- border: 1px solid var(--border);- border-radius: 10px;- background: var(--bg);- padding: 10px 12px;- display: grid;- grid-template-rows: auto auto;- gap: 8px;-}-.sliderCell .head { display: flex; align-items: center; gap: 6px; }-.sliderCell .label { font: 500 11px var(--font-body); color: var(--fg-2); }-.sliderCell .val { font: 500 11px var(--font-mono); color: var(--brand); margin-left: auto; }-.sliderCell input[type=range] {- width: 100%;- height: 4px;- background: var(--border);- border-radius: 2px;- outline: none;- -webkit-appearance: none;- cursor: pointer;-}-.sliderCell input[type=range]::-webkit-slider-thumb {- -webkit-appearance: none;- width: 14px;- height: 14px;- border-radius: 50%;- background: var(--brand);- box-shadow: 0 0 0 4px color-mix(in oklab, var(--brand), transparent 80%);- cursor: pointer;-}-.sliderCell input[type=range]::-moz-range-thumb {- width: 14px;- height: 14px;- border-radius: 50%;- background: var(--brand);- border: 0;- box-shadow: 0 0 0 4px color-mix(in oklab, var(--brand), transparent 80%);- cursor: pointer;-}-.sliderCell.full { grid-column: 1 / -1; }--/* ─── cursor style grid ────────────────────────────────────────── */-.cursorGrid {- display: grid;- grid-template-columns: repeat(5, 1fr);- gap: 6px;- padding: 0 var(--sp-4) var(--sp-4);-}-.cursorCell {- aspect-ratio: 1/1;- border: 1px solid var(--border);- border-radius: 8px;- background: var(--bg);- display: grid;- place-items: center;- cursor: pointer;- transition: border-color 150ms ease, box-shadow 150ms ease;- color: var(--muted);-}-.cursorCell:hover { border-color: var(--border-hi); color: var(--fg-2); }-.cursorCell.isActive {- border-color: var(--brand);- box-shadow: 0 0 0 2px color-mix(in oklab, var(--brand), transparent 75%);-}--/* ─── chat strip + input ───────────────────────────────────────── */-.chatStrip {- padding: var(--sp-3) var(--sp-4) var(--sp-2);- border-bottom: 1px solid var(--border-soft);- background: var(--bg);-}-.chatStripRow {- display: flex;- align-items: center;- gap: var(--sp-2);- margin-bottom: 6px;-}-.ctxPill {- display: inline-flex;- align-items: center;- gap: 5px;- padding: 3px 9px 3px 7px;- border-radius: var(--r-pill);- background: var(--success-soft);- color: var(--success);- font-family: var(--font-mono);- font-size: 10.5px;- font-weight: 500;- letter-spacing: 0.02em;-}-.ctxPill .d {- width: 5px;- height: 5px;- border-radius: 50%;- background: var(--success);-}-.stripActions {- margin-left: auto;- display: inline-flex;- gap: 2px;-}-.stripActions button {- width: 24px;- height: 24px;- display: grid;- place-items: center;- border-radius: var(--r-sm);- color: var(--meta);- background: transparent;- border: 0;- cursor: pointer;- transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);-}-.stripActions button:hover {- background: var(--surface-3);- color: var(--fg-2);-}-.chatHint {- font-size: var(--fs-app-sm);- color: var(--muted);- letter-spacing: 0.005em;- white-space: nowrap;- overflow: hidden;- text-overflow: ellipsis;-}--.msg { margin-bottom: var(--sp-3); }-.msgHead {- display: flex;- align-items: center;- gap: var(--sp-2);- padding: 0 var(--sp-1);- margin-bottom: var(--sp-1);-}-.msgAuthor {- font-family: var(--font-mono);- font-size: 10px;- letter-spacing: 0.08em;- color: var(--meta);- text-transform: uppercase;-}-.msgHead .right {- margin-left: auto;- display: inline-flex;- gap: 2px;-}-.msgHead .right button {- width: 22px;- height: 22px;- display: grid;- place-items: center;- border-radius: var(--r-xs);- color: var(--meta);- background: transparent;- border: 0;- cursor: pointer;- transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);-}-.msgHead .right button:hover {- background: var(--surface-3);- color: var(--fg-2);-}-.msgBubble {- padding: var(--sp-3) var(--sp-4);- border-radius: var(--r-md);- background: var(--bg);- border: 1px solid var(--border);- font-size: var(--fs-app);- color: var(--fg-2);- line-height: 1.5;-}-.msgBubble .msgAuthor { color: var(--accent); }--.chatInput {- padding: var(--sp-3) var(--sp-4);- border-top: 1px solid var(--border-soft);- background: var(--bg);-}-.chatInput textarea {- width: 100%;- min-height: 64px;- resize: none;- padding: var(--sp-3);- border-radius: var(--r-md);- border: 1px solid var(--border);- background: var(--bg);- font-family: var(--font-body);- font-size: var(--fs-app);- line-height: 1.5;- color: var(--fg);- outline: none;- transition: border-color var(--motion-fast) var(--ease), box-shadow var(--motion-fast) var(--ease);-}-.chatInput textarea::placeholder { color: var(--meta); }-.chatInput textarea:focus {- border-color: var(--accent);- box-shadow: var(--focus-ring);-}-.chatInput .actions {- display: flex;- align-items: center;- gap: var(--sp-2);- margin-top: var(--sp-2);-}-.modelPicker {- display: inline-flex;- align-items: center;- gap: 6px;- padding: 5px 4px 5px 10px;- border-radius: var(--r-pill);- background: var(--surface-2);- font-family: var(--font-mono);- font-size: 11px;- color: var(--fg-2);- letter-spacing: 0.01em;- cursor: pointer;- transition: background var(--motion-fast) var(--ease);- border: 0;-}-.modelPicker:hover { background: var(--surface-3); }-.modelPicker .chip {- padding: 3px 8px;- border-radius: var(--r-pill);- background: var(--success-soft);- color: var(--success);- font-size: 10.5px;- font-weight: 500;- letter-spacing: 0.01em;- display: inline-flex;- align-items: center;- gap: 4px;-}-.modelPicker .chip .d {- width: 5px;- height: 5px;- border-radius: 50%;- background: var(--success);-}-.sendBtn {- margin-left: auto;- width: 32px;- height: 32px;- display: grid;- place-items: center;- border-radius: 50%;- background: transparent;- color: var(--fg);- border: 0;- cursor: pointer;- transition: color var(--motion-fast) var(--ease), transform var(--motion-fast) var(--ease);-}-.sendBtn:hover { color: var(--accent); transform: scale(1.05); }-.sendBtn:disabled { opacity: 0.4; cursor: not-allowed; }--/* ─── transcript pane content ─────────────────────────────────── */-.transcriptClipHead {- display: flex;- align-items: center;- gap: 10px;- padding: 0 4px 4px;- border-bottom: 1px solid var(--border-soft);- margin-bottom: 8px;-}-.transcriptClipHead .badge {- width: 22px;- height: 22px;- display: inline-flex;- align-items: center;- justify-content: center;- background: var(--brand-soft);- color: var(--brand);- border-radius: var(--r-sm);- font: 700 12px/1 var(--font-mono);- flex-shrink: 0;-}-.transcriptClipHead .title {- font: 600 var(--fs-app)/1.2 var(--font-body);- color: var(--fg);- margin: 0;- padding: 0;-}-.transcriptClipHead .sub {- font: 400 11px/1.3 var(--font-mono);- color: var(--muted);- margin-top: 2px;-}-.transcriptFlow {- margin: 0;- padding: 0 4px;- font: 400 var(--fs-app-lg)/1.65 var(--font-body);- color: var(--fg);- text-wrap: pretty;-}-.transcriptFlow .tc {- display: inline-block;- margin: 0 4px;- padding: 1px 6px;- background: transparent;- color: var(--brand);- border-radius: var(--r-sm);- font: 500 11px/1.4 var(--font-mono);- vertical-align: middle;- white-space: nowrap;-}-.transcriptFlow .filler {- display: inline-block;- padding: 1px 6px;- margin: 0 1px;- background: var(--danger-soft);- color: var(--danger);- border-radius: var(--r-sm);- font-weight: 500;-}--/* ─── bottombar / timeline ─────────────────────────────────────── */-.bottombar {- display: grid;- grid-template-columns: 1fr;- min-height: 0;- background: var(--bg);- overflow: hidden;-}--/* Region lanes (annotations / speed / zoom) inside the timeline body. */-/* Lanes: fixed-width label column + one shared dnd-timeline surface column.- Both columns lay out 3 rows independently but with identical height (22px)- + gap (2px), so they line up without needing CSS grid row-spanning. */-.lanes {- display: flex;- gap: 8px;- padding: 4px var(--sp-4) 2px;- flex-shrink: 0;- border-bottom: 1px solid var(--border-soft);-}-.laneLabelCol {- width: 64px;- flex-shrink: 0;- display: flex;- flex-direction: column;- gap: 2px;-}-.laneLabelCell {- height: 22px;- display: flex;- align-items: center;- justify-content: space-between;- gap: 4px;-}-.laneLabel {- font: 600 10px/1 var(--font-mono);- color: var(--meta);- letter-spacing: 0.04em;- text-transform: uppercase;-}-.laneMeta {- font: 500 10.5px/1 var(--font-mono);- color: var(--muted);- min-width: 12px;- text-align: right;-}-.laneDelete {- width: 18px;- height: 18px;- display: inline-flex;- align-items: center;- justify-content: center;- border: 0;- border-radius: var(--r-xs);- background: var(--danger-soft);- color: var(--danger);- font-size: 13px;- line-height: 1;- cursor: pointer;-}-.laneDelete:hover {- filter: brightness(0.95);-}-.laneSurface {- flex: 1;- min-width: 0;- position: relative;- display: flex;- flex-direction: column;- gap: 2px;-}-/* F2.6 — vertical snap-guide lines at both edges of the region being- dragged/resized. Spans the full lane stack (parity with T24 on the- clip timeline). */-.laneSnapGuide {- position: absolute;- top: 0;- bottom: 0;- width: 2px;- background: var(--danger);- box-shadow: 0 0 6px color-mix(in oklch, var(--danger) 60%, transparent);- pointer-events: none;- z-index: 14;-}-/* F2.6 — floating tooltip with the live start – end range (parity with- T25 on the clip timeline). */-.laneDragTooltip {- position: absolute;- top: -20px;- height: 18px;- padding: 0 8px;- background: var(--surface);- border: 1px solid var(--border-soft);- border-radius: 9px;- color: var(--fg-2);- font: 500 10.5px/18px var(--font-mono);- letter-spacing: 0.02em;- white-space: nowrap;- pointer-events: none;- z-index: 15;- box-shadow: var(--elev-card-soft);-}-.laneTrackRow {- position: relative;- height: 22px;- background: var(--surface-2);- border: 1px dashed var(--border-soft);- border-radius: var(--r-sm);- overflow: hidden;-}-.laneEmpty {- position: absolute;- inset: 0;- display: flex;- align-items: center;- justify-content: center;- font: 500 11px/1 var(--font-body);- color: var(--muted);- opacity: 0.6;- pointer-events: none;-}--/* Lane pills: zoom / speed / annotation. Visuals match the design — tab caps- * on each side, frame color per kind, gradient sheen on top. */-.zoomPill,-.speedPill,-.annotationPill,-.skipPill {- --_pill: var(--accent);- position: absolute;- top: 50%;- transform: translateY(-50%);- display: inline-flex;- align-items: center;- gap: 6px;- padding: 4px 10px;- background: linear-gradient(- 180deg,- color-mix(in oklch, var(--_pill) 14%, var(--bg)) 0%,- color-mix(in oklch, var(--_pill) 6%, var(--bg)) 60%,- var(--bg) 100%- );- border: 1.5px solid var(--_pill);- border-radius: var(--r-md);- color: var(--fg);- font: 600 11px/1 var(--font-display);- letter-spacing: 0.01em;- font-variant-numeric: tabular-nums;- white-space: nowrap;- pointer-events: auto;- box-shadow:- 0 4px 12px -8px color-mix(in oklch, var(--_pill) 60%, transparent),- inset 0 1px 0 color-mix(in oklch, var(--_pill) 30%, transparent);- cursor: pointer;- z-index: 2;-}-.zoomPill {- --_pill: var(--accent);-}-.speedPill {- --_pill: var(--speed);-}-.annotationPill {- --_pill: var(--annotation);-}-.skipPill {- --_pill: var(--danger);-}-.lanePillSelected {- box-shadow:- 0 4px 12px -8px color-mix(in oklch, var(--_pill) 60%, transparent),- inset 0 1px 0 color-mix(in oklch, var(--_pill) 30%, transparent),- 0 0 0 3px color-mix(in oklch, var(--_pill) 35%, transparent);-}-.lanePillSelected::before,-.lanePillSelected::after {- background: color-mix(in oklch, var(--_pill) 80%, var(--bg));- box-shadow:- 0 0 0 1px var(--bg),- 0 2px 6px -2px color-mix(in oklch, var(--_pill) 65%, transparent);-}-/* tab caps at the ends */-.zoomPill::before,-.zoomPill::after,-.speedPill::before,-.speedPill::after,-.annotationPill::before,-.annotationPill::after,-.skipPill::before,-.skipPill::after {- content: "";- position: absolute;- top: 50%;- width: 6px;- height: 14px;- background: var(--_pill);- border-radius: 3px;- transform: translateY(-50%);- pointer-events: none;- z-index: 1;- box-shadow:- 0 0 0 1px var(--bg),- 0 2px 6px -2px color-mix(in oklch, var(--_pill) 55%, transparent);-}-.zoomPill::before,-.speedPill::before,-.annotationPill::before,-.skipPill::before {- left: -4px;-}-.zoomPill::after,-.speedPill::after,-.annotationPill::after,-.skipPill::after {- right: -4px;-}-.pillIcon {- width: 11px;- height: 11px;- flex-shrink: 0;- color: color-mix(in oklch, var(--_pill) 70%, var(--fg));-}-.pillValue {- color: var(--fg);- font-variant-numeric: tabular-nums;-}--.timelineHead {- display: flex;- align-items: center;- gap: var(--sp-2);- padding: var(--sp-2) var(--sp-4);- border-bottom: 1px solid var(--border-soft);- min-height: 40px;-}-.timelineHead .viewTools {- display: flex;- align-items: center;- gap: 4px;- padding: 3px;- background: var(--surface-2);- border: 1px solid var(--border-soft);- border-radius: var(--r-sm);-}-.timelineHead .vtBtn {- display: inline-flex;- align-items: center;- justify-content: center;- width: 30px;- height: 30px;- padding: 0;- border: 0;- background: transparent;- color: var(--muted);- border-radius: var(--r-xs);- cursor: pointer;- transition: color 0.12s ease, background 0.12s ease;-}-.timelineHead .vtBtn:hover { color: var(--fg); background: var(--surface); }-.timelineHead .vtBtn.isOn { color: var(--accent); background: var(--accent-wash); }-.timelineHead .ratio {- display: inline-flex;- align-items: center;- gap: 5px;- height: 30px;- padding: 0 10px;- font-family: var(--font-mono);- font-size: var(--fs-app-sm);- color: var(--muted);- letter-spacing: 0.02em;- background: transparent;- border: 0;- border-left: 1px solid var(--border-soft);- margin-left: 4px;- cursor: pointer;- border-radius: 0 var(--r-sm) var(--r-sm) 0;-}-.timelineHead .ratio:hover { color: var(--fg); }-.timelineHead .hintRow {- margin-left: auto;- display: flex;- align-items: center;- gap: var(--sp-4);-}-.timelineHead .hint {- display: inline-flex;- align-items: center;- gap: 6px;- font-family: var(--font-display);- font-size: 11.5px;- color: var(--muted);- letter-spacing: 0.005em;-}-.timelineHead .hint .kbd {- display: inline-flex;- align-items: center;- justify-content: center;- height: 20px;- padding: 0 7px;- font-family: var(--font-mono);- font-size: 10.5px;- font-weight: 500;- color: var(--accent);- background: var(--accent-soft);- border: 1px solid color-mix(in oklch, var(--accent) 24%, transparent);- border-radius: var(--r-xs);- letter-spacing: 0.02em;- white-space: nowrap;-}-.timelineBody {- display: flex;- flex-direction: column;- min-height: 0;- flex: 1;- overflow: hidden;-}-.timelineBody :global(.timelinePaneWrap) {- flex: 1;- min-height: 0;- overflow: hidden;-}-.zoombar {- padding: 4px var(--sp-4) 8px;- background: var(--bg);- flex-shrink: 0;- border-top: 1px solid var(--border-soft);-}--/* T11 — Navigator strip. Moved to TimelinePane.module.css so the- className (applied via TimelinePane's own styles import) actually- matches the CSS. CSS modules' class hashes don't match across- files. The shape and the elements are unchanged from axcut's- .timeline-navigator / .timeline-navigator-window. */-.zoombar .zoomTrack {- position: relative;- height: 18px;- width: 100%;-}-.zoombar .zoomFill {- position: absolute;- top: 50%;- transform: translateY(-50%);- left: 0;- width: 100%;- height: 6px;- background: var(--accent);- border-radius: 3px;- pointer-events: none;-}--/* Radix Slider — visible two-handle range, design-aligned. */-.sliderRoot {- position: relative;- display: flex;- align-items: center;- height: 18px;- width: 100%;- touch-action: none;- user-select: none;-}-.sliderTrack {- position: relative;- height: 6px;- width: 100%;- background: var(--surface-2);- border-radius: 3px;- overflow: hidden;-}-.sliderRange {- position: absolute;- height: 100%;- background: var(--accent);- border-radius: 3px;-}-.sliderThumb {- display: block;- width: 14px;- height: 14px;- background: var(--accent);- border: 1px solid var(--bg);- border-radius: 3px;- cursor: ew-resize;- transition: box-shadow var(--motion-fast) var(--ease);-}-.sliderThumb:hover,-.sliderThumb:focus-visible {- outline: none;- box-shadow: 0 0 0 4px color-mix(in oklch, var(--accent) 22%, transparent);-}--/* ─── modals ───────────────────────────────────────────────────── */-.modal {- position: fixed;- inset: 0;- display: none;- z-index: 100;-}-.modal.isOpen { display: block; }-.modalBackdrop {- position: absolute;- inset: 0;- background: var(--overlay-dark);- backdrop-filter: blur(4px);- -webkit-backdrop-filter: blur(4px);-}-.modalCard {- position: relative;- width: min(960px, 92vw);- max-height: 88vh;- margin: 6vh auto 0;- background: var(--bg);- border: 1px solid var(--border);- border-radius: var(--r-lg);- box-shadow: 0 24px 60px rgba(22, 23, 29, 0.5);- display: flex;- flex-direction: column;- overflow: hidden;- color: var(--fg);-}-.modalCard.wide { width: min(720px, 92vw); }-.modalHead {- display: flex;- align-items: flex-start;- justify-content: space-between;- padding: 20px 24px 12px;- gap: 16px;-}-.modalHead h2 {- margin: 0;- font: 600 20px/1.3 var(--font-display);- color: var(--fg);-}-.modalHead p {- margin: 4px 0 0;- font: 400 var(--fs-app)/1.5 var(--font-body);- color: var(--muted);-}-.modalHead .closeBtn {- width: 28px;- height: 28px;- display: grid;- place-items: center;- border-radius: var(--r-sm);- color: var(--muted);- background: transparent;- border: 0;- cursor: pointer;-}-.modalHead .closeBtn:hover { background: var(--surface-3); color: var(--fg); }-.modalBody {- padding: 8px 24px 24px;- display: flex;- flex-direction: column;- gap: 20px;- overflow: auto;-}--.btn {- height: 32px;- padding: 0 14px;- border-radius: var(--r-md);- font: 500 var(--fs-app)/1 var(--font-body);- cursor: pointer;- display: inline-flex;- align-items: center;- gap: 6px;- transition: background var(--motion-fast) var(--ease), border-color var(--motion-fast) var(--ease);-}-.btnSecondary {- background: var(--surface);- color: var(--fg);- border: 1px solid var(--border);-}-.btnSecondary:hover { background: var(--surface-warm); border-color: var(--border-hi); }-.btnPrimary {- background: var(--accent);- color: var(--accent-on);- border: 1px solid var(--accent);-}-.btnPrimary:hover { background: var(--brand-lo); }-.btnPrimary:disabled {- background: var(--surface-2);- border-color: var(--border);- color: var(--muted);- cursor: not-allowed;-}--/* ─── Edit Clip modal — draggable source-range track ────────────── */-.editClipRangeDragging {- box-shadow: 0 0 0 2px var(--accent-soft);-}--/* ─── media card (left panel media list) ───────────────────────── */-.mediaList {- list-style: none;- padding: 0;- margin: 0;- display: flex;- flex-direction: column;- gap: 10px;-}-.mediaCard {- display: flex;- flex-direction: column;- border-radius: var(--r-md);- overflow: hidden;- border: 1px solid var(--border-soft);- background: var(--bg);- cursor: pointer;- transition: border-color var(--motion-fast) var(--ease);-}-.mediaCard:hover { border-color: var(--brand); }-.mediaCard .thumb {- aspect-ratio: 16 / 9;- display: flex;- align-items: center;- justify-content: center;- color: rgba(255, 255, 255, 0.95);-}-.thumbRed { background: var(--danger); }-.thumbGreen { background: var(--success); }-.thumbAmber { background: var(--warn); }-.thumbCyan { background: var(--accent); }-.mediaMeta {- padding: 8px 10px 10px;- background: var(--surface-2);- display: flex;- flex-direction: column;- gap: 2px;-}-.mediaMeta .name {- font: var(--fs-app) var(--font-body);- color: var(--fg);- white-space: nowrap;- overflow: hidden;- text-overflow: ellipsis;-}-.mediaMeta .row {- display: flex;- align-items: center;- justify-content: space-between;- gap: 8px;-}-.mediaMeta .timecode { font: 11px var(--font-mono); color: var(--muted); }-.mediaMeta .size { font: 11px var(--font-body); color: var(--muted); }--.importBtn {- margin: 8px var(--sp-3) 12px;- padding: 10px 12px;- display: inline-flex;- align-items: center;- justify-content: center;- gap: var(--sp-2);- border: 1px dashed var(--border-hi);- border-radius: var(--r-md);- background: transparent;- color: var(--muted);- font: var(--fs-app) var(--font-body);- font-weight: 500;- cursor: pointer;-}-.importBtn:hover { background: var(--surface-warm); color: var(--fg); border-color: var(--accent); }--/* Custom range slider / progress bar */-.scrubBar {- flex: 1;- min-width: 0;- position: relative;- height: 24px;- display: flex;- align-items: center;- cursor: pointer;-}-.scrubTrack {- position: absolute;- left: 0;- right: 0;- height: 4px;- background: var(--border);- border-radius: 9999px;- overflow: hidden;-}-.scrubProgress {- height: 100%;- background: var(--accent);- border-radius: 9999px;-}-.scrubInput {- position: absolute;- inset: 0;- width: 100%;- height: 100%;- opacity: 0;- cursor: pointer;- z-index: 10;- margin: 0;-}-.scrubThumb {- position: absolute;- width: 10px;- height: 10px;- background: #ffffff;- border-radius: 50%;- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);- pointer-events: none;- transform: translate(-50%, -50%);- top: 50%;- opacity: 1;- transition: transform 100ms ease;-}-.scrubBar:hover .scrubThumb {- transform: translate(-50%, -50%) scale(1.2);-}--/* ─── AI provider settings (axcut parity) ────────────────────────── */--.providerGrid {- display: grid;- grid-template-columns: repeat(2, minmax(0, 1fr));- gap: 10px;-}-.providerCard {- display: flex;- flex-direction: column;- gap: 6px;- padding: 12px 14px;- border: 1px solid var(--border);- border-radius: var(--r-md);- background: var(--surface);- color: var(--fg-2);- cursor: pointer;- font: 500 13px/1.2 var(--font-body);- text-align: left;- transition: border-color var(--motion-fast) var(--ease), background var(--motion-fast) var(--ease);-}-.providerCard:hover { border-color: var(--border-hi); }-.providerCard.active {- border-color: var(--accent);- background: var(--accent-soft);- color: var(--fg);-}-.providerCard .head {- display: flex;- align-items: center;- justify-content: space-between;- gap: 8px;-}-.providerCard .label {- font-weight: 600;- font-size: 14px;- color: var(--fg);-}-.providerCard .model {- font: 500 11px var(--font-mono);- color: var(--muted);- letter-spacing: 0.02em;- text-transform: lowercase;-}-.statusPill {- display: inline-flex;- align-items: center;- gap: 4px;- padding: 2px 8px;- border-radius: 9999px;- font: 600 10px/1 var(--font-mono);- letter-spacing: 0.06em;- text-transform: uppercase;- border: 1px solid transparent;-}-.statusPill.ready {- background: var(--success-soft, rgba(68, 175, 105, 0.18));- color: var(--success, #44af69);- border-color: color-mix(in srgb, var(--success, #44af69) 30%, transparent);-}-.statusPill.idle {- background: var(--surface-2);- color: var(--muted);- border-color: var(--border);-}-.statusPill.auth {- background: color-mix(in srgb, var(--accent) 18%, transparent);- color: var(--accent);- border-color: color-mix(in srgb, var(--accent) 35%, transparent);-}-.statusPill.pat {- background: color-mix(in srgb, var(--warn) 18%, transparent);- color: var(--warn);- border-color: color-mix(in srgb, var(--warn) 35%, transparent);-}--.providerForm {- display: flex;- flex-direction: column;- gap: 16px;-}-.providerForm .title {- display: flex;- align-items: center;- justify-content: space-between;- gap: 8px;-}-.providerForm .title h3 {- margin: 0;- font: 600 16px var(--font-display);- color: var(--fg);-}-.providerForm .actions {- display: flex;- justify-content: flex-end;- gap: 8px;- padding-top: 8px;- border-top: 1px solid var(--border-soft);- margin-top: 4px;-}-.providerForm .actionsLeft {- display: flex;- gap: 8px;-}-.dangerBtn {- background: color-mix(in srgb, var(--danger) 14%, transparent);- color: var(--danger);- border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);-}-.dangerBtn:hover {- background: color-mix(in srgb, var(--danger) 22%, transparent);- color: var(--danger);-}--.authPanel {- padding: 14px 16px;- border: 1px solid var(--brand);- background: color-mix(in srgb, var(--accent) 8%, var(--surface));- border-radius: var(--r-md);- display: flex;- flex-direction: column;- gap: 10px;-}-.authPanel strong {- display: block;- font: 600 13px var(--font-body);- color: var(--fg);-}-.authPanel p {- margin: 4px 0 0;- font: 400 12px/1.45 var(--font-body);- color: var(--muted);-}-.authCodeRow {- display: flex;- align-items: center;- gap: 10px;-}-.authCodeRow code {- flex: 1;- font: 600 18px/1 var(--font-mono);- letter-spacing: 0.18em;- padding: 10px 14px;- background: var(--bg);- border: 1px solid var(--border);- border-radius: var(--r-md);- color: var(--fg);- user-select: all;-}-.linkBtn {- display: inline-flex;- align-items: center;- gap: 6px;- padding: 0 12px;- height: 32px;- border-radius: var(--r-md);- background: var(--surface);- border: 1px solid var(--border);- color: var(--fg);- font: 500 var(--fs-app) var(--font-body);- cursor: pointer;- text-decoration: none;-}-.linkBtn:hover { background: var(--surface-warm); border-color: var(--border-hi); }--.errorRow {- margin: 0;- padding: 10px 12px;- border-radius: var(--r-md);- border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);- background: color-mix(in srgb, var(--danger) 8%, var(--surface));- color: var(--danger);- font: 500 12px var(--font-body);-}--.iconBtn {- width: 28px;- height: 28px;- display: inline-grid;- place-items: center;- border-radius: var(--r-sm);- background: transparent;- border: 1px solid transparent;- color: var(--muted);- cursor: pointer;-}-.iconBtn:hover { background: var(--surface-3); color: var(--fg); }-.iconBtn:disabled { opacity: 0.5; cursor: not-allowed; }--.backBtn {- display: inline-flex;- align-items: center;- gap: 6px;- padding: 0 10px;- height: 28px;- border-radius: var(--r-sm);- background: transparent;- color: var(--fg);- border: 1px solid var(--border);- cursor: pointer;- font: 500 12px var(--font-body);-}-.backBtn:hover { background: var(--surface-3); }-.backBtn:disabled { opacity: 0.5; cursor: not-allowed; }-+/* Editor shell — 4-row grid: titlebar · workbench · handle · bottombar.+ * Mirrors design/openscreen-editor.html. Tokens come from+ * src/styles/design-tokens.css (light + dark via :root[data-theme="dark"]). */++.app {+ display: grid;+ grid-template-rows: var(--titlebar-h) 1fr var(--handle-h) var(--bottom-h);+ height: 100vh;+ min-width: 1024px;+ background: var(--bg);+ color: var(--fg);+ font-family: var(--font-body);+ font-size: var(--fs-app);+ line-height: 1.5;+ overflow: hidden;+ user-select: none;+}++.app[data-collapse~="left"] {+ --panel-w-left: 0px;+}+.app[data-collapse~="left"] .leftRail,+.app[data-collapse~="left"] .leftPanel,+.app[data-collapse~="left"] .handleLeft {+ display: none;+}++.app[data-collapse~="right"] {+ --panel-w-right: 0px;+}+.app[data-collapse~="right"] .rightStack,+.app[data-collapse~="right"] .rightRail,+.app[data-collapse~="right"] .handleRight {+ display: none;+}++.app[data-collapse~="bottom"] {+ --bottom-h: 0px;+}+.app[data-collapse~="bottom"] .bottombar {+ display: none;+}+.app[data-collapse~="bottom"] .handleBottom {+ display: none;+}++/* ─── titlebar ──────────────────────────────────────────────────── */+.titlebar {+ display: flex;+ align-items: center;+ gap: var(--sp-3);+ padding-inline: var(--sp-4);+ background: var(--bg);+ border-bottom: 1px solid var(--border-soft);+ min-width: 0;+ /* ponytail: make the titlebar the drag region in Electron. The buttons+ * opt out via inline -webkit-app-region: no-drag (see Titlebar.tsx). */+ -webkit-app-region: drag;+ app-region: drag;+}+.titlebar button,+.titlebar input,+.titlebar select,+.titlebar textarea,+.titlebar .langSel,+.titlebar .recorderBtn {+ -webkit-app-region: no-drag;+ app-region: no-drag;+}+.titlebar .lights {+ display: inline-flex;+ gap: 6px;+ margin-right: var(--sp-3);+}+.titlebar .lights span {+ width: 11px;+ height: 11px;+ border-radius: 50%;+ border: 1px solid var(--overlay-border);+}+.titlebar .lights .r { background: var(--light-red); }+.titlebar .lights .y { background: var(--light-yellow); }+.titlebar .lights .g { background: var(--light-green); }++.titlebar .brand {+ display: inline-flex;+ align-items: center;+ gap: 8px;+ font-family: var(--font-display);+ font-size: var(--fs-title);+ font-weight: 500;+ letter-spacing: -0.005em;+ color: var(--fg);+}+.titlebar .brandMark {+ width: 18px;+ height: 18px;+ border-radius: 5px;+ background: var(--accent);+ display: grid;+ place-items: center;+ color: var(--accent-on);+ font: 600 11px/1 var(--font-display);+}+.titlebar .sep {+ width: 1px;+ height: 16px;+ background: var(--border);+}+.titlebar .project {+ display: inline-flex;+ align-items: center;+ gap: var(--sp-2);+ font-size: var(--fs-app);+ color: var(--muted);+ min-width: 0;+}+.titlebar .projectName {+ color: var(--fg-2);+ font-weight: 500;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ max-width: 280px;+ background: transparent;+ border: 0;+ padding: 2px 6px;+ border-radius: var(--r-sm);+ cursor: text;+ font: inherit;+ -webkit-app-region: no-drag;+ app-region: no-drag;+}+.titlebar .projectName:hover:not(:disabled) {+ background: var(--surface-3);+}+.titlebar .projectInput {+ background: var(--surface);+ color: var(--fg);+ border: 1px solid var(--accent);+ border-radius: var(--r-sm);+ padding: 2px 6px;+ font: 500 13px var(--font-body);+ outline: none;+ min-width: 200px;+ max-width: 360px;+ -webkit-app-region: no-drag;+ app-region: no-drag;+}+.titlebar .saved {+ display: inline-flex;+ align-items: center;+ gap: 6px;+ font-family: var(--font-mono);+ font-size: var(--fs-app-sm);+ color: var(--muted);+}+.titlebar .saved .dot {+ width: 6px;+ height: 6px;+ border-radius: 50%;+ background: var(--success);+}+.titlebar .projActions {+ display: inline-flex;+ align-items: center;+ gap: var(--sp-1);+ margin-right: var(--sp-1);+}+.titlebar .right {+ margin-left: auto;+ display: inline-flex;+ align-items: center;+ gap: var(--sp-1);+}+.titlebar .iconBtn {+ width: 28px;+ height: 28px;+ display: grid;+ place-items: center;+ border-radius: var(--r-sm);+ color: var(--muted);+ background: transparent;+ border: 0;+ cursor: pointer;+ transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);+}+.titlebar .iconBtn:hover {+ background: var(--surface-3);+ color: var(--fg);+}+.titlebar .iconBtn[aria-pressed="true"] {+ background: var(--accent-soft);+ color: var(--accent);+}+.titlebar .langSel {+ display: inline-flex;+ align-items: center;+ gap: 6px;+ height: 26px;+ padding: 0 6px;+ background: transparent;+ border: 1px solid var(--border-soft);+ border-radius: var(--r-md);+ color: var(--fg-2);+ font: 500 var(--fs-app)/1 var(--font-display);+ cursor: pointer;+ transition: background var(--motion-fast) var(--ease), border-color var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);+}+.titlebar .langSel:hover {+ background: var(--surface-3);+ border-color: var(--border);+ color: var(--fg);+}+.titlebar .recorderBtn {+ display: inline-flex;+ align-items: center;+ gap: 6px;+ height: 26px;+ padding: 0 10px 0 8px;+ border-radius: var(--r-md);+ background: var(--accent-soft);+ color: var(--accent);+ border: 1px solid color-mix(in oklch, var(--accent) 22%, transparent);+ transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);+ font: 500 var(--fs-app-sm)/1 var(--font-display);+ letter-spacing: 0.01em;+ cursor: pointer;+}+.titlebar .recorderBtn:hover {+ background: color-mix(in oklch, var(--accent) 18%, var(--surface-3));+}++/* ─── workbench — 7 columns: rail · panel · handle · preview · handle · stack · rail */+.workbench {+ display: grid;+ grid-template-columns:+ var(--rail-w)+ var(--panel-w-left)+ var(--handle-w)+ 1fr+ var(--handle-w)+ var(--panel-w-right)+ var(--rail-w);+ min-height: 0;+ background: var(--bg);+ overflow: hidden;+}+.workbench > * {+ min-height: 0;+}+.workbench > * + * {+ border-left: 1px solid var(--border-soft);+}++.leftPanel {+ display: flex;+ flex-direction: column;+ overflow: hidden;+ min-height: 0;+}++/* ─── rails — vertical icon strips ─────────────────────────────── */+.rail {+ display: flex;+ flex-direction: column;+ align-items: center;+ gap: var(--sp-1);+ padding: var(--sp-2) 0;+ background: var(--bg);+ min-width: 0;+}+.rail button {+ width: 36px;+ height: 36px;+ display: grid;+ place-items: center;+ border-radius: var(--r-md);+ color: var(--muted);+ background: transparent;+ border: 0;+ cursor: pointer;+ transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);+ position: relative;+}+.rail button:hover {+ background: var(--surface-3);+ color: var(--fg);+}+.rail button[aria-pressed="true"] {+ color: var(--accent);+ background: var(--accent-soft);+}+.rail button[aria-pressed="true"]::before {+ content: "";+ position: absolute;+ left: -8px;+ top: 8px;+ bottom: 8px;+ width: 3px;+ border-radius: 2px;+ background: var(--accent);+}+.rail .sepH {+ width: 24px;+ height: 1px;+ background: var(--border);+ margin: var(--sp-1) 0;+}++/* ─── panels (chat, transcript, etc.) ──────────────────────────── */+.panel {+ display: flex;+ flex-direction: column;+ flex: 1 1 0;+ min-width: 0;+ min-height: 0;+ background: var(--bg);+ overflow: hidden;+}++/* Direct children of .panel: panelHeader (auto), panelBody (1fr), chatInput (auto). */+.panel > .panelHeader,+.panel > .chatInput {+ flex: 0 0 auto;+}+.panel > .panelBody {+ flex: 1 1 0;+}+.panelHead {+ display: flex;+ align-items: center;+ gap: var(--sp-2);+ padding: var(--sp-3) var(--sp-4);+ border-bottom: 1px solid var(--border-soft);+ min-height: 44px;+}+.panelHead h2 {+ margin: 0;+ font-family: var(--font-display);+ font-size: 14px;+ font-weight: 500;+ letter-spacing: -0.005em;+ color: var(--fg);+}+.panelHead .right {+ margin-left: auto;+ display: inline-flex;+ gap: var(--sp-1);+}+.panelHead .iconBtn {+ width: 24px;+ height: 24px;+ display: grid;+ place-items: center;+ border-radius: var(--r-sm);+ color: var(--meta);+ background: transparent;+ border: 0;+ cursor: pointer;+ transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);+}+.panelHead .iconBtn:hover {+ background: var(--surface-3);+ color: var(--fg-2);+}+.panelBody {+ overflow-y: auto;+ padding: var(--sp-3) var(--sp-4);+ scrollbar-width: thin;+ scrollbar-color: var(--border) transparent;+ min-height: 0;+}+.panelBody::-webkit-scrollbar {+ width: 8px;+ height: 8px;+}+.panelBody::-webkit-scrollbar-thumb {+ background: var(--border);+ border-radius: 4px;+}+.panelBody::-webkit-scrollbar-thumb:hover {+ background: var(--border-hi);+}++/* ─── resize handles ───────────────────────────────────────────── */+.handle {+ background: transparent;+ position: relative;+ z-index: 2;+ transition: background var(--motion-fast) var(--ease);+ cursor: col-resize;+}+.handleRow {+ cursor: row-resize;+ grid-column: 1 / -1;+ border-bottom: 1px solid var(--border);+}+.handle:hover,+.handle.isDragging {+ background: var(--surface-2);+}+.handle::before,+.handle::after {+ content: "";+ position: absolute;+ background: var(--dim);+ border-radius: 1px;+ opacity: 0.45;+ transition: opacity var(--motion-fast) var(--ease);+ pointer-events: none;+}+.handleCol::before,+.handleCol::after {+ left: 50%;+ width: 1px;+ height: 14px;+ transform: translateX(-50%);+}+.handleCol::before { top: calc(50% - 16px); }+.handleCol::after { top: calc(50% + 2px); }+.handleRow::before,+.handleRow::after {+ top: 50%;+ height: 1px;+ width: 14px;+ transform: translateY(-50%);+}+.handleRow::before { left: calc(50% - 16px); }+.handleRow::after { left: calc(50% + 2px); }+.handle:hover::before,+.handle:hover::after,+.handle.isDragging::before,+.handle.isDragging::after {+ opacity: 1;+}+.handle.isDragging {+ background: var(--accent-soft);+}++/* ─── preview area ─────────────────────────────────────────────── */+.previewWrap {+ display: grid;+ grid-template-rows: 1fr auto;+ background: var(--surface-1);+ min-width: 0;+ min-height: 0;+ position: relative;+}+.previewCanvas {+ position: relative;+ display: grid;+ place-items: center;+ overflow: hidden;+ padding: var(--sp-5);+ min-height: 0;+}+.previewFrame {+ position: relative;+ aspect-ratio: 16 / 9;+ max-width: 100%;+ max-height: 100%;+ width: 100%;+ min-width: 0;+ min-height: 0;+ background:+ radial-gradient(ellipse at 50% 35%,+ var(--scene-sky-hi) 0%,+ var(--scene-sky-mid) 35%,+ var(--scene-foliage) 70%,+ var(--scene-foliage-d) 100%);+ /* ponytail: don't make the canvas itself a rounded card — the video /+ camera apply their own border-radius for content clipping. A square+ canvas blends into the editor chrome; the wallpaper is the visible+ area, but no "frame around the canvas" effect. */+ border-radius: 0;+ overflow: hidden;+ display: grid;+ place-items: center;+}+.videoStage {+ position: relative;+ display: grid;+ place-items: center;+ min-width: 0;+ min-height: 0;+ overflow: visible;+ z-index: 1;+}+.screenStage {+ position: absolute;+ overflow: hidden;+ z-index: 1;+ display: flex;+}+.screenStage > .container,+.screenStage > div > .container {+ width: 100%;+ height: 100%;+}+.previewEmpty {+ display: flex;+ flex-direction: column;+ align-items: center;+ justify-content: center;+ gap: 8px;+ color: var(--muted);+ font-size: var(--fs-app);+}+.previewEmpty strong { color: var(--fg-2); }++/* ─── preview empty state (no project / no asset) ───────────────── */+.previewEmptyDrop {+ position: relative;+ width: 100%;+ height: 100%;+ display: flex;+ align-items: center;+ justify-content: center;+}+.previewEmptyDropOverlay {+ position: absolute;+ inset: 0;+ z-index: 10;+ display: flex;+ flex-direction: column;+ align-items: center;+ justify-content: center;+ gap: var(--sp-2);+ border: 2px dashed var(--primary, #34B27B);+ background: color-mix(in srgb, var(--primary, #34B27B) 10%, transparent);+ border-radius: var(--r-sm);+ pointer-events: none;+}+.previewEmptyDropIcon {+ width: 40px;+ height: 40px;+ color: var(--primary, #34B27B);+}+.previewEmptyDropLabel {+ font-size: var(--fs-app);+ font-weight: 600;+ color: var(--primary, #34B27B);+}+.previewEmptyInner {+ display: flex;+ flex-direction: column;+ align-items: center;+ gap: var(--sp-4);+ padding: var(--sp-5);+ text-align: center;+ max-width: 28rem;+}+.previewEmptyLogo {+ width: 64px;+ height: 64px;+ border-radius: var(--r-md);+ opacity: 0.9;+}+.previewEmptyHeading {+ display: flex;+ flex-direction: column;+ gap: var(--sp-1);+}+.previewEmptyTitle {+ margin: 0;+ font-size: 1.25rem;+ font-weight: 600;+ color: var(--fg-2);+}+.previewEmptyDescription {+ margin: 0;+ font-size: 0.875rem;+ color: var(--muted);+ line-height: 1.5;+}+.previewEmptyActions {+ display: flex;+ flex-direction: column;+ gap: var(--sp-2);+ width: 100%;+ max-width: 18rem;+}+.previewEmptyPrimaryButton {+ display: flex;+ align-items: center;+ justify-content: center;+ gap: var(--sp-2);+ padding: var(--sp-3) var(--sp-4);+ border-radius: var(--r-sm);+ background: var(--primary, #34B27B);+ color: #fff;+ border: none;+ font-weight: 500;+ font-size: 0.875rem;+ cursor: pointer;+ transition: background-color 120ms ease;+}+.previewEmptyPrimaryButton:hover {+ filter: brightness(0.95);+}+.previewEmptySecondaryButton {+ display: flex;+ align-items: center;+ justify-content: center;+ gap: var(--sp-2);+ padding: var(--sp-3) var(--sp-4);+ border-radius: var(--r-sm);+ background: var(--card);+ color: var(--fg-2);+ border: 1px solid var(--border);+ font-weight: 500;+ font-size: 0.875rem;+ cursor: pointer;+ transition: background-color 120ms ease;+}+.previewEmptySecondaryButton:hover {+ background: var(--accent, rgba(255, 255, 255, 0.06));+}+.previewEmptyButtonIcon {+ width: 16px;+ height: 16px;+}+.previewEmptyHint {+ margin: 0;+ font-size: 0.75rem;+ color: var(--muted-foreground, rgba(255, 255, 255, 0.5));+}+.previewEmptyDragHint {+ display: flex;+ align-items: center;+ gap: var(--sp-1);+ margin: 0;+ font-size: 0.75rem;+ color: var(--muted-foreground, rgba(255, 255, 255, 0.4));+}+.previewEmptyDragHintIcon {+ width: 12px;+ height: 12px;+}+.previewEmptyDialog {+ max-width: 24rem;+ padding: var(--sp-5);+ background: var(--bg);+ border: 1px solid var(--border);+}+.previewEmptyDialogHeader {+ margin-bottom: var(--sp-3);+}+.previewEmptyDialogHeaderInner {+ display: flex;+ align-items: center;+ gap: var(--sp-2);+}+.previewEmptyDialogLogo {+ width: 36px;+ height: 36px;+ border-radius: var(--r-sm);+ flex-shrink: 0;+}+.previewEmptyDialogTitle {+ font-size: 1rem;+ font-weight: 600;+ color: var(--fg-2);+ line-height: 1.2;+}+.previewEmptyDialogBody {+ display: flex;+ flex-direction: column;+ align-items: center;+ gap: var(--sp-2);+ margin-bottom: var(--sp-4);+ text-align: center;+}+.previewEmptyDialogIcon {+ display: flex;+ align-items: center;+ justify-content: center;+ width: 40px;+ height: 40px;+ border-radius: 9999px;+ background: var(--card);+ border: 1px solid var(--border);+}+.previewEmptyDialogAlertIcon {+ width: 20px;+ height: 20px;+ color: var(--muted);+}+.previewEmptyDialogMessage {+ margin: 0;+ font-size: 0.875rem;+ color: var(--muted);+ line-height: 1.5;+}+.previewEmptyDialogClose {+ display: flex;+ align-items: center;+ justify-content: center;+ gap: var(--sp-1);+ width: 100%;+ padding: var(--sp-2) var(--sp-3);+ border-radius: var(--r-sm);+ background: var(--card);+ color: var(--fg-2);+ border: 1px solid var(--border);+ font-size: 0.875rem;+ font-weight: 500;+ cursor: pointer;+}+.previewEmptyDialogCloseIcon {+ width: 14px;+ height: 14px;+}+.previewPip {+ position: absolute;+ right: var(--sp-3);+ bottom: var(--sp-3);+ width: 120px;+ aspect-ratio: 16 / 9;+ border-radius: var(--r-sm);+ background: linear-gradient(135deg, var(--pip-bg-1) 0%, var(--pip-bg-2) 50%, var(--pip-bg-3) 100%);+ border: 2px solid var(--bg);+ box-shadow: var(--elev-card);+ overflow: hidden;+ display: grid;+ place-items: center;+ color: var(--overlay-text);+ font-family: var(--font-mono);+ font-size: 9px;+ letter-spacing: 0.06em;+ text-transform: uppercase;+}+.previewBadge {+ position: absolute;+ top: var(--sp-3);+ right: var(--sp-3);+ padding: 4px 8px;+ border-radius: var(--r-xs);+ background: var(--overlay-light);+ color: var(--fg);+ font-family: var(--font-mono);+ font-size: 10px;+ letter-spacing: 0.02em;+ font-weight: 500;+ backdrop-filter: blur(8px);+}+.bgBlur {+ position: absolute;+ inset: 0;+ pointer-events: none;+ z-index: 0;+ transform: scale(1.06);+}+.previewFrame > .screenStage > video,+.previewFrame > .screenStage > div > video {+ position: relative;+ z-index: 1;+}+.pipCircle {+ border-radius: 9999px !important;+}+.pipSquare {+ border-radius: 0 !important;+}+.pipRounded {+ border-radius: 18px !important;+}++/* Webcam overlay: real <video> driven by the cameraTrack. The slot is+ transparent so clip-path / border-radius carve the camera without leaving+ a rectangular placeholder peeking through. */+.webcamSlot {+ background: transparent;+ overflow: hidden;+ z-index: 2;+ display: flex;+}+.webcamSlot .webcamVideo {+ width: 100%;+ height: 100%;+ object-fit: cover;+ display: block;+}+.previewTimecode {+ position: absolute;+ top: var(--sp-3);+ left: var(--sp-3);+ padding: 4px 8px;+ border-radius: var(--r-xs);+ background: var(--overlay-dark);+ color: var(--bg);+ font-family: var(--font-mono);+ font-size: 11px;+ letter-spacing: 0.02em;+}++/* ─── transport bar ────────────────────────────────────────────── */+.transport {+ display: flex;+ align-items: center;+ gap: var(--sp-2);+ padding: var(--sp-2) var(--sp-4);+ background: var(--bg);+ border-top: 1px solid var(--border-soft);+}+.transport .tbtn {+ width: 32px;+ height: 32px;+ display: grid;+ place-items: center;+ border-radius: var(--r-sm);+ color: var(--fg-2);+ background: transparent;+ border: 0;+ cursor: pointer;+ transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);+}+.transport .tbtn:hover {+ background: var(--surface-3);+ color: var(--fg);+}+.transport .tbtn.play {+ width: 36px;+ height: 36px;+ background: var(--fg);+ color: var(--bg);+ border-radius: 50%;+}+.transport .tbtn.play:hover {+ background: var(--fg-2);+}+.transport .time {+ font-family: var(--font-mono);+ font-size: var(--fs-app-sm);+ color: var(--fg);+ letter-spacing: 0.02em;+ min-width: 96px;+ text-align: center;+}+.transport .time .sep { color: var(--meta); margin-inline: 4px; }+.transport .time .total { color: var(--muted); }+.transport .spacer { flex: 1; }++/* ─── right panel-stack (one pane visible at a time) ──────────── */+.rightStack {+ grid-column: 6;+ display: grid;+ min-width: 0;+ min-height: 0;+ background: var(--bg);+}+.pane {+ display: none;+ grid-template-rows: auto 1fr;+ min-height: 0;+}+.pane.isActive {+ display: grid;+}+.paneHead {+ display: flex;+ align-items: center;+ gap: var(--sp-2);+ padding: 12px var(--sp-4);+ border-bottom: 1px solid var(--border-soft);+ min-height: 44px;+}+.paneHead h2 {+ margin: 0;+ font-family: var(--font-display);+ font-size: 14px;+ font-weight: 500;+ letter-spacing: -0.005em;+ color: var(--fg);+}+.paneBody {+ overflow-y: auto;+ padding: 12px var(--sp-4);+ scrollbar-width: thin;+ scrollbar-color: var(--border) transparent;+ min-height: 0;+}++/* ─── pane tabs (sub-nav inside a pane) ───────────────────────── */+.paneTabs {+ display: flex;+ gap: 2px;+ padding: 3px;+ margin: 12px var(--sp-4);+ background: var(--surface-warm);+ border-radius: 10px;+}+.paneTabs button {+ flex: 1;+ padding: 7px 10px;+ border: 0;+ background: transparent;+ border-radius: 7px;+ font: 500 var(--fs-app-sm)/1 var(--font-body);+ color: var(--muted);+ cursor: pointer;+ transition: background 150ms ease, color 150ms ease;+}+.paneTabs button.isActive {+ background: var(--brand);+ color: var(--accent-on);+ box-shadow: 0 1px 2px rgba(22, 23, 29, 0.12);+}+.paneSection { display: none; }+.paneSection.isActive { display: block; }++/* ─── pane rows (label + control) ─────────────────────────────── */+.paneRow {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 12px;+ padding: 12px 14px;+ margin: 8px var(--sp-4);+ border: 1px solid var(--border);+ border-radius: 10px;+ background: var(--bg);+}+.paneRow .label { font: 500 var(--fs-app) var(--font-body); color: var(--fg-2); }+.paneRow .info { color: var(--meta); font-size: var(--fs-app-sm); margin-left: 4px; }+.sectionLabel {+ font: 500 var(--fs-app-sm) var(--font-body);+ color: var(--fg-2);+ margin: 4px var(--sp-4) 8px;+}+.uploadBtn {+ display: flex;+ align-items: center;+ justify-content: center;+ gap: 8px;+ margin: 0 var(--sp-4) 12px;+ padding: 12px;+ border: 1px dashed var(--border);+ border-radius: 10px;+ background: var(--bg);+ color: var(--muted);+ font: 500 var(--fs-app-sm) var(--font-body);+ cursor: pointer;+}+.uploadBtn:hover { border-color: var(--success); color: var(--success); }+.field {+ display: grid;+ grid-template-columns: 80px 1fr;+ align-items: center;+ gap: 8px;+ padding: 4px var(--sp-4);+}+.field label {+ font: 500 var(--fs-app-sm) var(--font-body);+ color: var(--muted);+}+.field select,+.field input {+ width: 100%;+ padding: 6px 8px;+ font: 400 var(--fs-app-sm) var(--font-body);+ color: var(--fg-2);+ background: var(--surface);+ border: 1px solid var(--border);+ border-radius: 6px;+ outline: none;+}+.field select:focus,+.field input:focus { border-color: var(--brand); }++/* ─── bg thumb grid ────────────────────────────────────────────── */+.bgGrid {+ display: grid;+ grid-template-columns: repeat(4, 1fr);+ gap: 8px;+ padding: 0 var(--sp-4) var(--sp-4);+}+.bgThumb {+ aspect-ratio: 1/1;+ border-radius: 10px;+ border: 1px solid transparent;+ cursor: pointer;+ transition: transform 150ms ease, border-color 150ms ease;+ background: var(--surface-2);+}+.bgThumb:hover { transform: translateY(-1px); }+.bgThumb.isActive {+ border-color: var(--brand);+ box-shadow: 0 0 0 2px color-mix(in oklab, var(--brand), transparent 70%);+}++/* ─── toggle (switch) ──────────────────────────────────────────── */+.toggle {+ width: 36px;+ height: 20px;+ border: 0;+ padding: 0;+ background: var(--border);+ border-radius: 9999px;+ position: relative;+ cursor: pointer;+ transition: background 150ms ease;+ flex-shrink: 0;+}+.toggle::after {+ content: "";+ position: absolute;+ top: 2px;+ left: 2px;+ width: 16px;+ height: 16px;+ background: var(--accent-on);+ border-radius: 50%;+ box-shadow: 0 1px 3px rgba(22, 23, 29, 0.2);+ transition: transform 150ms ease;+}+.toggle.isOn { background: var(--brand); }+.toggle.isOn::after { transform: translateX(16px); }++/* ─── slider cell (effect) ─────────────────────────────────────── */+.sliderGrid {+ display: grid;+ grid-template-columns: 1fr 1fr;+ gap: 10px;+ padding: 0 var(--sp-4) var(--sp-4);+}+.sliderCell {+ border: 1px solid var(--border);+ border-radius: 10px;+ background: var(--bg);+ padding: 10px 12px;+ display: grid;+ grid-template-rows: auto auto;+ gap: 8px;+}+.sliderCell .head { display: flex; align-items: center; gap: 6px; }+.sliderCell .label { font: 500 11px var(--font-body); color: var(--fg-2); }+.sliderCell .val { font: 500 11px var(--font-mono); color: var(--brand); margin-left: auto; }+.sliderCell input[type=range] {+ width: 100%;+ height: 4px;+ background: var(--border);+ border-radius: 2px;+ outline: none;+ -webkit-appearance: none;+ cursor: pointer;+}+.sliderCell input[type=range]::-webkit-slider-thumb {+ -webkit-appearance: none;+ width: 14px;+ height: 14px;+ border-radius: 50%;+ background: var(--brand);+ box-shadow: 0 0 0 4px color-mix(in oklab, var(--brand), transparent 80%);+ cursor: pointer;+}+.sliderCell input[type=range]::-moz-range-thumb {+ width: 14px;+ height: 14px;+ border-radius: 50%;+ background: var(--brand);+ border: 0;+ box-shadow: 0 0 0 4px color-mix(in oklab, var(--brand), transparent 80%);+ cursor: pointer;+}+.sliderCell.full { grid-column: 1 / -1; }++/* ─── cursor style grid ────────────────────────────────────────── */+.cursorGrid {+ display: grid;+ grid-template-columns: repeat(5, 1fr);+ gap: 6px;+ padding: 0 var(--sp-4) var(--sp-4);+}+.cursorCell {+ aspect-ratio: 1/1;+ border: 1px solid var(--border);+ border-radius: 8px;+ background: var(--bg);+ display: grid;+ place-items: center;+ cursor: pointer;+ transition: border-color 150ms ease, box-shadow 150ms ease;+ color: var(--muted);+}+.cursorCell:hover { border-color: var(--border-hi); color: var(--fg-2); }+.cursorCell.isActive {+ border-color: var(--brand);+ box-shadow: 0 0 0 2px color-mix(in oklab, var(--brand), transparent 75%);+}++/* ─── chat strip + input ───────────────────────────────────────── */+.chatStrip {+ padding: var(--sp-3) var(--sp-4) var(--sp-2);+ border-bottom: 1px solid var(--border-soft);+ background: var(--bg);+}+.chatStripRow {+ display: flex;+ align-items: center;+ gap: var(--sp-2);+ margin-bottom: 6px;+}+.ctxPill {+ display: inline-flex;+ align-items: center;+ gap: 5px;+ padding: 3px 9px 3px 7px;+ border-radius: var(--r-pill);+ background: var(--success-soft);+ color: var(--success);+ font-family: var(--font-mono);+ font-size: 10.5px;+ font-weight: 500;+ letter-spacing: 0.02em;+}+.ctxPill .d {+ width: 5px;+ height: 5px;+ border-radius: 50%;+ background: var(--success);+}+.stripActions {+ margin-left: auto;+ display: inline-flex;+ gap: 2px;+}+.stripActions button {+ width: 24px;+ height: 24px;+ display: grid;+ place-items: center;+ border-radius: var(--r-sm);+ color: var(--meta);+ background: transparent;+ border: 0;+ cursor: pointer;+ transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);+}+.stripActions button:hover {+ background: var(--surface-3);+ color: var(--fg-2);+}+.stripActions button:disabled {+ opacity: 0.4;+ cursor: not-allowed;+}+.chatHint {+ font-size: var(--fs-app-sm);+ color: var(--muted);+ letter-spacing: 0.005em;+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+}++.msg { margin-bottom: var(--sp-3); }+.msgHead {+ display: flex;+ align-items: center;+ gap: var(--sp-2);+ padding: 0 var(--sp-1);+ margin-bottom: var(--sp-1);+}+.msgAuthor {+ font-family: var(--font-mono);+ font-size: 10px;+ letter-spacing: 0.08em;+ color: var(--meta);+ text-transform: uppercase;+}+.msgHead .right {+ margin-left: auto;+ display: inline-flex;+ gap: 2px;+}+.msgHead .right button {+ width: 22px;+ height: 22px;+ display: grid;+ place-items: center;+ border-radius: var(--r-xs);+ color: var(--meta);+ background: transparent;+ border: 0;+ cursor: pointer;+ transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);+}+.msgHead .right button:hover {+ background: var(--surface-3);+ color: var(--fg-2);+}+.msgBubble {+ padding: var(--sp-3) var(--sp-4);+ border-radius: var(--r-md);+ background: var(--bg);+ border: 1px solid var(--border);+ font-size: var(--fs-app);+ color: var(--fg-2);+ line-height: 1.5;+}+.msgBubble .msgAuthor { color: var(--accent); }++.chatInput {+ padding: var(--sp-3) var(--sp-4);+ border-top: 1px solid var(--border-soft);+ background: var(--bg);+}+.chatInput textarea {+ width: 100%;+ min-height: 64px;+ resize: none;+ padding: var(--sp-3);+ border-radius: var(--r-md);+ border: 1px solid var(--border);+ background: var(--bg);+ font-family: var(--font-body);+ font-size: var(--fs-app);+ line-height: 1.5;+ color: var(--fg);+ outline: none;+ transition: border-color var(--motion-fast) var(--ease), box-shadow var(--motion-fast) var(--ease);+}+.chatInput textarea::placeholder { color: var(--meta); }+.chatInput textarea:focus {+ border-color: var(--accent);+ box-shadow: var(--focus-ring);+}+.chatInput .actions {+ display: flex;+ align-items: center;+ gap: var(--sp-2);+ margin-top: var(--sp-2);+}+.modelPicker {+ display: inline-flex;+ align-items: center;+ gap: 6px;+ padding: 5px 4px 5px 10px;+ border-radius: var(--r-pill);+ background: var(--surface-2);+ font-family: var(--font-mono);+ font-size: 11px;+ color: var(--fg-2);+ letter-spacing: 0.01em;+ cursor: pointer;+ transition: background var(--motion-fast) var(--ease);+ border: 0;+}+.modelPicker:hover { background: var(--surface-3); }+.modelPicker .chip {+ padding: 3px 8px;+ border-radius: var(--r-pill);+ background: var(--success-soft);+ color: var(--success);+ font-size: 10.5px;+ font-weight: 500;+ letter-spacing: 0.01em;+ display: inline-flex;+ align-items: center;+ gap: 4px;+}+.modelPicker .chip .d {+ width: 5px;+ height: 5px;+ border-radius: 50%;+ background: var(--success);+}+.sendBtn {+ margin-left: auto;+ width: 32px;+ height: 32px;+ display: grid;+ place-items: center;+ border-radius: 50%;+ background: transparent;+ color: var(--fg);+ border: 0;+ cursor: pointer;+ transition: color var(--motion-fast) var(--ease), transform var(--motion-fast) var(--ease);+}+.sendBtn:hover { color: var(--accent); transform: scale(1.05); }+.sendBtn:disabled { opacity: 0.4; cursor: not-allowed; }++/* ─── transcript pane content ─────────────────────────────────── */+.transcriptClipHead {+ display: flex;+ align-items: center;+ gap: 10px;+ padding: 0 4px 4px;+ border-bottom: 1px solid var(--border-soft);+ margin-bottom: 8px;+}+.transcriptClipHead .badge {+ width: 22px;+ height: 22px;+ display: inline-flex;+ align-items: center;+ justify-content: center;+ background: var(--brand-soft);+ color: var(--brand);+ border-radius: var(--r-sm);+ font: 700 12px/1 var(--font-mono);+ flex-shrink: 0;+}+.transcriptClipHead .title {+ font: 600 var(--fs-app)/1.2 var(--font-body);+ color: var(--fg);+ margin: 0;+ padding: 0;+}+.transcriptClipHead .sub {+ font: 400 11px/1.3 var(--font-mono);+ color: var(--muted);+ margin-top: 2px;+}+.transcriptFlow {+ margin: 0;+ padding: 0 4px;+ font: 400 var(--fs-app-lg)/1.65 var(--font-body);+ color: var(--fg);+ text-wrap: pretty;+}+.transcriptFlow .tc {+ display: inline-block;+ margin: 0 4px;+ padding: 1px 6px;+ background: transparent;+ color: var(--brand);+ border-radius: var(--r-sm);+ font: 500 11px/1.4 var(--font-mono);+ vertical-align: middle;+ white-space: nowrap;+}+++/* ─── bottombar / timeline ─────────────────────────────────────── */+.bottombar {+ display: grid;+ grid-template-columns: 1fr;+ min-height: 0;+ background: var(--bg);+ overflow: hidden;+}++/* Region lanes (annotations / speed / zoom) inside the timeline body. */+/* Lanes: fixed-width label column + one shared dnd-timeline surface column.+ Both columns lay out 3 rows independently but with identical height (22px)+ + gap (2px), so they line up without needing CSS grid row-spanning. */+.lanes {+ display: flex;+ gap: 8px;+ padding: 4px var(--sp-4) 2px;+ flex-shrink: 0;+ border-bottom: 1px solid var(--border-soft);+}+.laneLabelCol {+ width: 64px;+ flex-shrink: 0;+ display: flex;+ flex-direction: column;+ gap: 2px;+}+.laneLabelCell {+ height: 22px;+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 4px;+}+.laneLabel {+ font: 600 10px/1 var(--font-mono);+ color: var(--meta);+ letter-spacing: 0.04em;+ text-transform: uppercase;+}+.laneMeta {+ font: 500 10.5px/1 var(--font-mono);+ color: var(--muted);+ min-width: 12px;+ text-align: right;+}+.laneDelete {+ width: 18px;+ height: 18px;+ display: inline-flex;+ align-items: center;+ justify-content: center;+ border: 0;+ border-radius: var(--r-xs);+ background: var(--danger-soft);+ color: var(--danger);+ font-size: 13px;+ line-height: 1;+ cursor: pointer;+}+.laneDelete:hover {+ filter: brightness(0.95);+}+.laneSurface {+ flex: 1;+ min-width: 0;+ position: relative;+ display: flex;+ flex-direction: column;+ gap: 2px;+}+/* F2.6 — vertical snap-guide lines at both edges of the region being+ dragged/resized. Spans the full lane stack (parity with T24 on the+ clip timeline). */+.laneSnapGuide {+ position: absolute;+ top: 0;+ bottom: 0;+ width: 2px;+ background: var(--danger);+ box-shadow: 0 0 6px color-mix(in oklch, var(--danger) 60%, transparent);+ pointer-events: none;+ z-index: 14;+}+/* F2.6 — floating tooltip with the live start – end range (parity with+ T25 on the clip timeline). */+.laneDragTooltip {+ position: absolute;+ top: -20px;+ height: 18px;+ padding: 0 8px;+ background: var(--surface);+ border: 1px solid var(--border-soft);+ border-radius: 9px;+ color: var(--fg-2);+ font: 500 10.5px/18px var(--font-mono);+ letter-spacing: 0.02em;+ white-space: nowrap;+ pointer-events: none;+ z-index: 15;+ box-shadow: var(--elev-card-soft);+}+.laneTrackRow {+ position: relative;+ height: 22px;+ background: var(--surface-2);+ border: 1px dashed var(--border-soft);+ border-radius: var(--r-sm);+ overflow: hidden;+}+.laneEmpty {+ position: absolute;+ inset: 0;+ display: flex;+ align-items: center;+ justify-content: center;+ font: 500 11px/1 var(--font-body);+ color: var(--muted);+ opacity: 0.6;+ pointer-events: none;+}++/* Lane pills: zoom / speed / annotation. Visuals match the design — tab caps+ * on each side, frame color per kind, gradient sheen on top. */+.zoomPill,+.speedPill,+.annotationPill,+.skipPill {+ --_pill: var(--accent);+ position: absolute;+ top: 50%;+ transform: translateY(-50%);+ display: inline-flex;+ align-items: center;+ gap: 6px;+ padding: 4px 10px;+ background: linear-gradient(+ 180deg,+ color-mix(in oklch, var(--_pill) 14%, var(--bg)) 0%,+ color-mix(in oklch, var(--_pill) 6%, var(--bg)) 60%,+ var(--bg) 100%+ );+ border: 1.5px solid var(--_pill);+ border-radius: var(--r-md);+ color: var(--fg);+ font: 600 11px/1 var(--font-display);+ letter-spacing: 0.01em;+ font-variant-numeric: tabular-nums;+ white-space: nowrap;+ pointer-events: auto;+ box-shadow:+ 0 4px 12px -8px color-mix(in oklch, var(--_pill) 60%, transparent),+ inset 0 1px 0 color-mix(in oklch, var(--_pill) 30%, transparent);+ cursor: pointer;+ z-index: 2;+}+.zoomPill {+ --_pill: var(--accent);+}+.speedPill {+ --_pill: var(--speed);+}+.annotationPill {+ --_pill: var(--annotation);+}+.skipPill {+ --_pill: var(--danger);+}+.lanePillSelected {+ box-shadow:+ 0 4px 12px -8px color-mix(in oklch, var(--_pill) 60%, transparent),+ inset 0 1px 0 color-mix(in oklch, var(--_pill) 30%, transparent),+ 0 0 0 3px color-mix(in oklch, var(--_pill) 35%, transparent);+}+.lanePillSelected::before,+.lanePillSelected::after {+ background: color-mix(in oklch, var(--_pill) 80%, var(--bg));+ box-shadow:+ 0 0 0 1px var(--bg),+ 0 2px 6px -2px color-mix(in oklch, var(--_pill) 65%, transparent);+}+/* tab caps at the ends */+.zoomPill::before,+.zoomPill::after,+.speedPill::before,+.speedPill::after,+.annotationPill::before,+.annotationPill::after,+.skipPill::before,+.skipPill::after {+ content: "";+ position: absolute;+ top: 50%;+ width: 6px;+ height: 14px;+ background: var(--_pill);+ border-radius: 3px;+ transform: translateY(-50%);+ pointer-events: none;+ z-index: 1;+ box-shadow:+ 0 0 0 1px var(--bg),+ 0 2px 6px -2px color-mix(in oklch, var(--_pill) 55%, transparent);+}+.zoomPill::before,+.speedPill::before,+.annotationPill::before,+.skipPill::before {+ left: -4px;+}+.zoomPill::after,+.speedPill::after,+.annotationPill::after,+.skipPill::after {+ right: -4px;+}+.pillIcon {+ width: 11px;+ height: 11px;+ flex-shrink: 0;+ color: color-mix(in oklch, var(--_pill) 70%, var(--fg));+}+.pillValue {+ color: var(--fg);+ font-variant-numeric: tabular-nums;+}++.timelineHead {+ display: flex;+ align-items: center;+ gap: var(--sp-2);+ padding: var(--sp-2) var(--sp-4);+ border-bottom: 1px solid var(--border-soft);+ min-height: 40px;+}+.timelineHead .viewTools {+ display: flex;+ align-items: center;+ gap: 4px;+ padding: 3px;+ background: var(--surface-2);+ border: 1px solid var(--border-soft);+ border-radius: var(--r-sm);+}+.timelineHead .vtBtn {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ width: 30px;+ height: 30px;+ padding: 0;+ border: 0;+ background: transparent;+ color: var(--muted);+ border-radius: var(--r-xs);+ cursor: pointer;+ transition: color 0.12s ease, background 0.12s ease;+}+.timelineHead .vtBtn:hover { color: var(--fg); background: var(--surface); }+.timelineHead .vtBtn.isOn { color: var(--accent); background: var(--accent-wash); }+.timelineHead .ratio {+ display: inline-flex;+ align-items: center;+ gap: 5px;+ height: 30px;+ padding: 0 10px;+ font-family: var(--font-mono);+ font-size: var(--fs-app-sm);+ color: var(--muted);+ letter-spacing: 0.02em;+ background: transparent;+ border: 0;+ border-left: 1px solid var(--border-soft);+ margin-left: 4px;+ cursor: pointer;+ border-radius: 0 var(--r-sm) var(--r-sm) 0;+}+.timelineHead .ratio:hover { color: var(--fg); }+.timelineHead .hintRow {+ margin-left: auto;+ display: flex;+ align-items: center;+ gap: var(--sp-4);+}+.timelineHead .hint {+ display: inline-flex;+ align-items: center;+ gap: 6px;+ font-family: var(--font-display);+ font-size: 11.5px;+ color: var(--muted);+ letter-spacing: 0.005em;+}+.timelineHead .hint .kbd {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ height: 20px;+ padding: 0 7px;+ font-family: var(--font-mono);+ font-size: 10.5px;+ font-weight: 500;+ color: var(--accent);+ background: var(--accent-soft);+ border: 1px solid color-mix(in oklch, var(--accent) 24%, transparent);+ border-radius: var(--r-xs);+ letter-spacing: 0.02em;+ white-space: nowrap;+}+.timelineBody {+ display: flex;+ flex-direction: column;+ min-height: 0;+ flex: 1;+ overflow: hidden;+}+.timelineBody :global(.timelinePaneWrap) {+ flex: 1;+ min-height: 0;+ overflow: hidden;+}+.zoombar {+ padding: 4px var(--sp-4) 8px;+ background: var(--bg);+ flex-shrink: 0;+ border-top: 1px solid var(--border-soft);+}++/* T11 — Navigator strip. Moved to TimelinePane.module.css so the+ className (applied via TimelinePane's own styles import) actually+ matches the CSS. CSS modules' class hashes don't match across+ files. The shape and the elements are unchanged from axcut's+ .timeline-navigator / .timeline-navigator-window. */+.zoombar .zoomTrack {+ position: relative;+ height: 18px;+ width: 100%;+}+.zoombar .zoomFill {+ position: absolute;+ top: 50%;+ transform: translateY(-50%);+ left: 0;+ width: 100%;+ height: 6px;+ background: var(--accent);+ border-radius: 3px;+ pointer-events: none;+}++/* Radix Slider — visible two-handle range, design-aligned. */+.sliderRoot {+ position: relative;+ display: flex;+ align-items: center;+ height: 18px;+ width: 100%;+ touch-action: none;+ user-select: none;+}+.sliderTrack {+ position: relative;+ height: 6px;+ width: 100%;+ background: var(--surface-2);+ border-radius: 3px;+ overflow: hidden;+}+.sliderRange {+ position: absolute;+ height: 100%;+ background: var(--accent);+ border-radius: 3px;+}+.sliderThumb {+ display: block;+ width: 14px;+ height: 14px;+ background: var(--accent);+ border: 1px solid var(--bg);+ border-radius: 3px;+ cursor: ew-resize;+ transition: box-shadow var(--motion-fast) var(--ease);+}+.sliderThumb:hover,+.sliderThumb:focus-visible {+ outline: none;+ box-shadow: 0 0 0 4px color-mix(in oklch, var(--accent) 22%, transparent);+}++/* ─── modals ───────────────────────────────────────────────────── */+.modal {+ position: fixed;+ inset: 0;+ display: none;+ z-index: 100;+}+.modal.isOpen { display: block; }+.modalBackdrop {+ position: absolute;+ inset: 0;+ background: var(--overlay-dark);+ backdrop-filter: blur(4px);+ -webkit-backdrop-filter: blur(4px);+}+.modalCard {+ position: relative;+ width: min(960px, 92vw);+ max-height: 88vh;+ margin: 6vh auto 0;+ background: var(--bg);+ border: 1px solid var(--border);+ border-radius: var(--r-lg);+ box-shadow: 0 24px 60px rgba(22, 23, 29, 0.5);+ display: flex;+ flex-direction: column;+ overflow: hidden;+ color: var(--fg);+}+.modalCard.wide { width: min(720px, 92vw); }+.modalHead {+ display: flex;+ align-items: flex-start;+ justify-content: space-between;+ padding: 20px 24px 12px;+ gap: 16px;+}+.modalHead h2 {+ margin: 0;+ font: 600 20px/1.3 var(--font-display);+ color: var(--fg);+}+.modalHead p {+ margin: 4px 0 0;+ font: 400 var(--fs-app)/1.5 var(--font-body);+ color: var(--muted);+}+.modalHead .closeBtn {+ width: 28px;+ height: 28px;+ display: grid;+ place-items: center;+ border-radius: var(--r-sm);+ color: var(--muted);+ background: transparent;+ border: 0;+ cursor: pointer;+}+.modalHead .closeBtn:hover { background: var(--surface-3); color: var(--fg); }+.modalBody {+ padding: 8px 24px 24px;+ display: flex;+ flex-direction: column;+ gap: 20px;+ overflow: auto;+}++.btn {+ height: 32px;+ padding: 0 14px;+ border-radius: var(--r-md);+ font: 500 var(--fs-app)/1 var(--font-body);+ cursor: pointer;+ display: inline-flex;+ align-items: center;+ gap: 6px;+ transition: background var(--motion-fast) var(--ease), border-color var(--motion-fast) var(--ease);+}+.btnSecondary {+ background: var(--surface);+ color: var(--fg);+ border: 1px solid var(--border);+}+.btnSecondary:hover { background: var(--surface-warm); border-color: var(--border-hi); }+.btnPrimary {+ background: var(--accent);+ color: var(--accent-on);+ border: 1px solid var(--accent);+}+.btnPrimary:hover { background: var(--brand-lo); }+.btnPrimary:disabled {+ background: var(--surface-2);+ border-color: var(--border);+ color: var(--muted);+ cursor: not-allowed;+}++/* ─── Edit Clip modal — draggable source-range track ────────────── */+.editClipRangeDragging {+ box-shadow: 0 0 0 2px var(--accent-soft);+}++/* ─── media card (left panel media list) ───────────────────────── */+.mediaList {+ list-style: none;+ padding: 0;+ margin: 0;+ display: flex;+ flex-direction: column;+ gap: 10px;+}+.mediaCard {+ display: flex;+ flex-direction: column;+ border-radius: var(--r-md);+ overflow: hidden;+ border: 1px solid var(--border-soft);+ background: var(--bg);+ cursor: pointer;+ transition: border-color var(--motion-fast) var(--ease);+}+.mediaCard:hover { border-color: var(--brand); }+.mediaCard .thumb {+ aspect-ratio: 16 / 9;+ display: flex;+ align-items: center;+ justify-content: center;+ color: rgba(255, 255, 255, 0.95);+}+.thumbRed { background: var(--danger); }+.thumbGreen { background: var(--success); }+.thumbAmber { background: var(--warn); }+.thumbCyan { background: var(--accent); }+.mediaMeta {+ padding: 8px 10px 10px;+ background: var(--surface-2);+ display: flex;+ flex-direction: column;+ gap: 2px;+}+.mediaMeta .name {+ font: var(--fs-app) var(--font-body);+ color: var(--fg);+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+}+.mediaMeta .row {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 8px;+}+.mediaMeta .timecode { font: 11px var(--font-mono); color: var(--muted); }+.mediaMeta .size { font: 11px var(--font-body); color: var(--muted); }++.importBtn {+ margin: 8px var(--sp-3) 12px;+ padding: 10px 12px;+ display: inline-flex;+ align-items: center;+ justify-content: center;+ gap: var(--sp-2);+ border: 1px dashed var(--border-hi);+ border-radius: var(--r-md);+ background: transparent;+ color: var(--muted);+ font: var(--fs-app) var(--font-body);+ font-weight: 500;+ cursor: pointer;+}+.importBtn:hover { background: var(--surface-warm); color: var(--fg); border-color: var(--accent); }++/* Custom range slider / progress bar */+.scrubBar {+ flex: 1;+ min-width: 0;+ position: relative;+ height: 24px;+ display: flex;+ align-items: center;+ cursor: pointer;+}+.scrubTrack {+ position: absolute;+ left: 0;+ right: 0;+ height: 4px;+ background: var(--border);+ border-radius: 9999px;+ overflow: hidden;+}+.scrubProgress {+ height: 100%;+ background: var(--accent);+ border-radius: 9999px;+}+.scrubInput {+ position: absolute;+ inset: 0;+ width: 100%;+ height: 100%;+ opacity: 0;+ cursor: pointer;+ z-index: 10;+ margin: 0;+}+.scrubThumb {+ position: absolute;+ width: 10px;+ height: 10px;+ background: #ffffff;+ border-radius: 50%;+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);+ pointer-events: none;+ transform: translate(-50%, -50%);+ top: 50%;+ opacity: 1;+ transition: transform 100ms ease;+}+.scrubBar:hover .scrubThumb {+ transform: translate(-50%, -50%) scale(1.2);+}++/* ─── AI provider settings (axcut parity) ────────────────────────── */++.providerGrid {+ display: grid;+ grid-template-columns: repeat(2, minmax(0, 1fr));+ gap: 10px;+}+.providerCard {+ display: flex;+ flex-direction: column;+ gap: 6px;+ padding: 12px 14px;+ border: 1px solid var(--border);+ border-radius: var(--r-md);+ background: var(--surface);+ color: var(--fg-2);+ cursor: pointer;+ font: 500 13px/1.2 var(--font-body);+ text-align: left;+ transition: border-color var(--motion-fast) var(--ease), background var(--motion-fast) var(--ease);+}+.providerCard:hover { border-color: var(--border-hi); }+.providerCard.active {+ border-color: var(--accent);+ background: var(--accent-soft);+ color: var(--fg);+}+.providerCard .head {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 8px;+}+.providerCard .label {+ font-weight: 600;+ font-size: 14px;+ color: var(--fg);+}+.providerCard .model {+ font: 500 11px var(--font-mono);+ color: var(--muted);+ letter-spacing: 0.02em;+ text-transform: lowercase;+}+.statusPill {+ display: inline-flex;+ align-items: center;+ gap: 4px;+ padding: 2px 8px;+ border-radius: 9999px;+ font: 600 10px/1 var(--font-mono);+ letter-spacing: 0.06em;+ text-transform: uppercase;+ border: 1px solid transparent;+}+.statusPill.ready {+ background: var(--success-soft, rgba(68, 175, 105, 0.18));+ color: var(--success, #44af69);+ border-color: color-mix(in srgb, var(--success, #44af69) 30%, transparent);+}+.statusPill.idle {+ background: var(--surface-2);+ color: var(--muted);+ border-color: var(--border);+}+.statusPill.auth {+ background: color-mix(in srgb, var(--accent) 18%, transparent);+ color: var(--accent);+ border-color: color-mix(in srgb, var(--accent) 35%, transparent);+}+.statusPill.pat {+ background: color-mix(in srgb, var(--warn) 18%, transparent);+ color: var(--warn);+ border-color: color-mix(in srgb, var(--warn) 35%, transparent);+}++.providerForm {+ display: flex;+ flex-direction: column;+ gap: 16px;+}+.providerForm .title {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 8px;+}+.providerForm .title h3 {+ margin: 0;+ font: 600 16px var(--font-display);+ color: var(--fg);+}+.providerForm .actions {+ display: flex;+ justify-content: flex-end;+ gap: 8px;+ padding-top: 8px;+ border-top: 1px solid var(--border-soft);+ margin-top: 4px;+}+.providerForm .actionsLeft {+ display: flex;+ gap: 8px;+}+.dangerBtn {+ background: color-mix(in srgb, var(--danger) 14%, transparent);+ color: var(--danger);+ border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);+}+.dangerBtn:hover {+ background: color-mix(in srgb, var(--danger) 22%, transparent);+ color: var(--danger);+}++.authPanel {+ padding: 14px 16px;+ border: 1px solid var(--brand);+ background: color-mix(in srgb, var(--accent) 8%, var(--surface));+ border-radius: var(--r-md);+ display: flex;+ flex-direction: column;+ gap: 10px;+}+.authPanel strong {+ display: block;+ font: 600 13px var(--font-body);+ color: var(--fg);+}+.authPanel p {+ margin: 4px 0 0;+ font: 400 12px/1.45 var(--font-body);+ color: var(--muted);+}+.authCodeRow {+ display: flex;+ align-items: center;+ gap: 10px;+}+.authCodeRow code {+ flex: 1;+ font: 600 18px/1 var(--font-mono);+ letter-spacing: 0.18em;+ padding: 10px 14px;+ background: var(--bg);+ border: 1px solid var(--border);+ border-radius: var(--r-md);+ color: var(--fg);+ user-select: all;+}+.linkBtn {+ display: inline-flex;+ align-items: center;+ gap: 6px;+ padding: 0 12px;+ height: 32px;+ border-radius: var(--r-md);+ background: var(--surface);+ border: 1px solid var(--border);+ color: var(--fg);+ font: 500 var(--fs-app) var(--font-body);+ cursor: pointer;+ text-decoration: none;+}+.linkBtn:hover { background: var(--surface-warm); border-color: var(--border-hi); }++.errorRow {+ margin: 0;+ padding: 10px 12px;+ border-radius: var(--r-md);+ border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);+ background: color-mix(in srgb, var(--danger) 8%, var(--surface));+ color: var(--danger);+ font: 500 12px var(--font-body);+}++.iconBtn {+ width: 28px;+ height: 28px;+ display: inline-grid;+ place-items: center;+ border-radius: var(--r-sm);+ background: transparent;+ border: 1px solid transparent;+ color: var(--muted);+ cursor: pointer;+}+.iconBtn:hover { background: var(--surface-3); color: var(--fg); }+.iconBtn:disabled { opacity: 0.5; cursor: not-allowed; }++.backBtn {+ display: inline-flex;+ align-items: center;+ gap: 6px;+ padding: 0 10px;+ height: 28px;+ border-radius: var(--r-sm);+ background: transparent;+ color: var(--fg);+ border: 1px solid var(--border);+ cursor: pointer;+ font: 500 12px var(--font-body);+}+.backBtn:hover { background: var(--surface-3); }+.backBtn:disabled { opacity: 0.5; cursor: not-allowed; }+diff --git a/src/components/ai-edition/NewEditorShell.tsx b/src/components/ai-edition/NewEditorShell.tsxindex b38bc3b75..bf54d39d8 100644--- a/src/components/ai-edition/NewEditorShell.tsx+++ b/src/components/ai-edition/NewEditorShell.tsx@@ -51,7 +51,6 @@ export function NewEditorShell() {const lastSavedAt = useProjectStore((s) => s.lastSavedAt);const createProject = useProjectStore((s) => s.createProject);const addAsset = useProjectStore((s) => s.addAsset);- const replaceTimeline = useProjectStore((s) => s.replaceTimeline);const setTranscript = useProjectStore((s) => s.setTranscript);const setCurrentTime = useProjectStore((s) => s.setCurrentTime);const setSourceDuration = useProjectStore((s) => s.setSourceDuration);@@ -101,6 +100,12 @@ export function NewEditorShell() {const seekSeqRef = useRef(0);const initRef = useRef(false);+ // ponytail: serialise timeline-edit saves so two rapid Backspaces+ // don't race each other's IPC save and overwrite one another in the+ // store. Each new save chains off the previous one, so the store is+ // always updated in the order the user issued the trims.+ const saveQueueRef = useRef<Promise<void>>(Promise.resolve());+const promptUnsaved = useCallback((action: "close" | "new" | "open" | "record"): Promise<UnsavedChoice> => {if (!dirty) return Promise.resolve("discard");@@ -417,20 +422,68 @@ export function NewEditorShell() {}}, [loadProject]);- const handleDropWordRange = useCallback(- async (startSec: number, endSec: number) => {- if (!document) return;- const { subtractInterval, timelineIntervals: getIntervals } = await import(- "@/lib/ai-edition/document/timeline"+ // ponytail: transcript-pane → timeline skip ranges. The right pane's+ // contentEditable region converts user Backspace/Delete into a new+ // skipRange (NOT a destructive word removal — the source text stays+ // intact, the word is just hidden by the skip overlay). Mirrors+ // axcut's `queueAddSkipRange` / `queueRemoveSkipRange` callbacks in+ // apps/web/src/App.tsx.+ const handleAddSkipRange = useCallback(+ (assetId: string, startSec: number, endSec: number, reason: string) => {+ // ponytail: read the latest document from the store, not the+ // closure. The closure captures the document at render time; if+ // the user fires two rapid Backspaces before React re-renders,+ // the second call would see the same stale document and add the+ // second skip to a base that already has the first skip's+ // pending-state. Then the two saveDocument calls race and the+ // last one to call set() wins. Reading from getState() always+ // returns the latest committed value.+ const doc = useProjectStore.getState().document ?? document;+ if (!doc) return;+ // ponytail: serialise via saveQueueRef so two rapid trims+ // can't race each other's IPC save and overwrite one another.+ const queued = saveQueueRef.current+ .then(() => import("@/lib/ai-edition/document/operations"))+ .then(({ applyTimelineOperation }) =>+ applyTimelineOperation(doc, {+ type: "add_skip_range",+ assetId,+ startSec,+ endSec,+ reason,+ }),+ )+ .then((next) => saveDocument(next.document));+ saveQueueRef.current = queued.then(+ () => undefined,+ () => undefined,);- const intervals = getIntervals(document);- const next = subtractInterval(intervals, { startSec, endSec });- await replaceTimeline(- next,- `Dropped word range ${startSec.toFixed(1)}s-${endSec.toFixed(1)}s`,+ return queued;+ },+ [document, saveDocument],+ );++ const handleRemoveSkipRange = useCallback(+ (skipId: string) => {+ const doc = useProjectStore.getState().document ?? document;+ if (!doc) return;+ const queued = saveQueueRef.current+ .then(() => import("@/lib/ai-edition/document/operations"))+ .then(({ applyTimelineOperation }) =>+ applyTimelineOperation(doc, {+ type: "remove_skip_range",+ skipId,+ reason: "Restored from transcript pane.",+ }),+ )+ .then((next) => saveDocument(next.document));+ saveQueueRef.current = queued.then(+ () => undefined,+ () => undefined,);+ return queued;},- [document, replaceTimeline],+ [document, saveDocument],);const handleSelectProject = useCallback(@@ -957,11 +1010,15 @@ export function NewEditorShell() {active={rightPane}onChange={setRightPane}onCrop={() => setCropOpen(true)}- transcript={document?.transcript ?? null}+ transcripts={document?.transcripts ?? []}+ assets={document?.assets ?? []}clips={clips}+ skipRanges={document?.timeline?.skipRanges ?? []}+ busy={isTranscribing}currentTimeSec={currentTimeSec}onSeek={handleSeek}- onDropWordRange={handleDropWordRange}+ onAddSkipRange={handleAddSkipRange}+ onRemoveSkipRange={handleRemoveSkipRange}onTranscribe={handleTranscribe}canTranscribe={hasAsset}isTranscribing={isTranscribing}diff --git a/src/components/ai-edition/RightPanelStack.tsx b/src/components/ai-edition/RightPanelStack.tsxindex 6ac5edfe4..63e19440a 100644--- a/src/components/ai-edition/RightPanelStack.tsx+++ b/src/components/ai-edition/RightPanelStack.tsx@@ -20,8 +20,10 @@ import {} from "@/components/video-editor/types";import type {AxcutAnnotationRegion,+ AxcutAsset,AxcutClip,AxcutDocument,+ AxcutSkipRange,AxcutTranscript,} from "@/lib/ai-edition/schema";import { useProjectStore } from "@/lib/ai-edition/store/projectStore";@@ -47,11 +49,15 @@ interface RightPanelStackProps {active: RightPaneId;onChange: (id: RightPaneId) => void;onCrop: () => void;- transcript: AxcutTranscript | null;+ transcripts: AxcutTranscript[];+ assets: AxcutAsset[];clips: AxcutClip[];+ skipRanges: AxcutSkipRange[];+ busy: boolean;currentTimeSec: number;onSeek: (sec: number) => void;- onDropWordRange: (start: number, end: number) => void;+ onAddSkipRange: (assetId: string, startSec: number, endSec: number, reason: string) => void;+ onRemoveSkipRange: (skipId: string) => void;onTranscribe: () => void;canTranscribe: boolean;isTranscribing: boolean;@@ -77,11 +83,15 @@ export function RightPanelStack({active,onChange,onCrop,- transcript,+ transcripts,+ assets,clips,+ skipRanges,+ busy,currentTimeSec,onSeek,- onDropWordRange,+ onAddSkipRange,+ onRemoveSkipRange,onTranscribe,canTranscribe,isTranscribing,@@ -109,11 +119,15 @@ export function RightPanelStack({{active === "background" ? <BackgroundPane /> : null}{active === "transcript" ? (<TranscriptPane- transcript={transcript}+ transcripts={transcripts}+ assets={assets}clips={clips}+ skipRanges={skipRanges}+ busy={busy}currentTimeSec={currentTimeSec}onSeek={onSeek}- onDropWordRange={onDropWordRange}+ onAddSkipRange={onAddSkipRange}+ onRemoveSkipRange={onRemoveSkipRange}onTranscribe={onTranscribe}canTranscribe={canTranscribe}isTranscribing={isTranscribing}diff --git a/src/components/ai-edition/RightPanes.tsx b/src/components/ai-edition/RightPanes.tsxindex 31916f56e..2dd02930b 100644--- a/src/components/ai-edition/RightPanes.tsx+++ b/src/components/ai-edition/RightPanes.tsx@@ -13,16 +13,44 @@ import {MousePointerClick,Palette,Sliders,+ Trash2,} from "lucide-react";-import { type ChangeEvent, type ReactNode, useEffect, useMemo, useRef, useState } from "react";+import {+ type ChangeEvent,+ type FormEvent,+ type ClipboardEvent as ReactClipboardEvent,+ type KeyboardEvent as ReactKeyboardEvent,+ type ReactNode,+ type PointerEvent as ReactPointerEvent,+ useCallback,+ useEffect,+ useLayoutEffect,+ useMemo,+ useRef,+ useState,+} from "react";import defaultCursorPreviewUrl from "@/assets/cursors/Cursor=Default.svg";-import type { AxcutClip, AxcutTranscript } from "@/lib/ai-edition/schema";+import type {+ AxcutAsset,+ AxcutClip,+ AxcutSkipRange,+ AxcutTranscript,+ AxcutWord,+} from "@/lib/ai-edition/schema";import { useEditorSettings } from "@/lib/ai-edition/store/useEditorSettings";+import {+ buildAggregatedSections,+ type ClipSection,+ type ClipWord,+ findCueWordId,+ type SkipRun,+} from "@/lib/ai-edition/timeline/aggregated-transcript";+import { formatMs } from "@/lib/ai-edition/timeline/format";+import { locateVirtualPosition } from "@/lib/ai-edition/timeline/virtual-preview";import { getAssetPath } from "@/lib/assetPath";import { CURSOR_THEMES, DEFAULT_CURSOR_THEME_ID } from "@/lib/cursor/cursorThemes";import { resolveImageWallpaperUrl, WALLPAPER_PATHS } from "@/lib/wallpaper";import styles from "./NewEditorShell.module.css";-import { TranscriptEditor } from "./TranscriptEditor";export type RightPaneId =| "background"@@ -377,32 +405,77 @@ function normaliseHex(raw: string): string | null {}// ─── Transcript ────────────────────────────────────────────────────-+// Aggregated transcript view: one contentEditable region per clip on the+// timeline, in timeline order. Each word is rendered as a `<span+// data-word-id>` inside the editable div. Words inside any `skipRange`+// for the clip's asset are styled red+strikethrough and show a bin icon+// on hover (removing the skip restores them). User actions:+//+// - Click on a word → seek (timeline.playhead)+// - Backspace / Delete → convert selection (or caret-adjacent word)+// into a new skipRange (the document's+// `timeline.skipRanges[]`, NOT the transcript+// text). The deleted word stays in the DOM as+// red text — nothing destructive.+//+// Mirrors axcut's apps/web/src/components/CurrentTranscriptView.tsx.export function TranscriptPane({- transcript,clips,+ transcripts,+ assets,+ skipRanges,+ busy,currentTimeSec,onSeek,- onDropWordRange,+ onAddSkipRange,+ onRemoveSkipRange,onTranscribe,canTranscribe,isTranscribing,}: {- transcript: AxcutTranscript | null;clips: AxcutClip[];+ transcripts: AxcutTranscript[];+ assets: AxcutAsset[];+ skipRanges: AxcutSkipRange[];+ busy: boolean;currentTimeSec: number;onSeek: (sec: number) => void;- onDropWordRange: (start: number, end: number) => void;+ onAddSkipRange: (assetId: string, startSec: number, endSec: number, reason: string) => void;+ onRemoveSkipRange: (skipId: string) => void;onTranscribe: () => void;canTranscribe: boolean;isTranscribing: boolean;}) {- if (!transcript) {+ const sections = useMemo(+ () => buildAggregatedSections(clips, transcripts, assets, skipRanges),+ [clips, transcripts, assets, skipRanges],+ );++ // ponytail: the cue position is the playback head's location in the+ // current clip's source time. `locateVirtualPosition` already accounts+ // for skip ranges and clipped durations — the cue word naturally+ // jumps over gaps the user has trimmed.+ const cue = useMemo(() => {+ if (clips.length === 0) return null;+ const position = locateVirtualPosition(clips, currentTimeSec);+ if (!position) return null;+ return {+ assetId: position.clip.assetId,+ clipId: position.clip.id,+ sourceTimeSec: position.sourceTimeSec,+ };+ }, [clips, currentTimeSec]);++ const cueWordId = useMemo(() => findCueWordId(sections, cue), [sections, cue]);++ const hasAnyTranscript = transcripts.length > 0;++ if (clips.length === 0 || !hasAnyTranscript) {return (<Panetitle="Current transcription"icon={<FileText size={14} />}- helpText="The transcript of the spoken words, generated on-device by Whisper. Click a word to seek; select a range to cut it from the timeline."+ helpText="Aggregated transcript of every clip on the timeline. Backspace / Delete a word or selection to mark it as skipped (red). Hover a red span to restore it."><divstyle={{@@ -418,7 +491,7 @@ export function TranscriptPane({><FileText size={28} style={{ color: "var(--dim)" }} /><p style={{ font: "500 13px var(--font-body)", color: "var(--fg-2)" }}>- No transcript yet+ {clips.length === 0 ? "No clips yet" : "No transcript yet"}</p><p style={{ font: "400 12px var(--font-body)", color: "var(--muted)", maxWidth: 260 }}>Transcribe uses local Whisper — runs in your browser, no data leaves the device.@@ -435,24 +508,572 @@ export function TranscriptPane({</Pane>);}+return (<div className={`${styles.pane} ${styles.isActive}`}><header className={styles.paneHead}><h2>Current transcription</h2></header><div className={styles.paneBody}>- <TranscriptEditor- transcript={transcript}- clips={clips}- currentTimeSec={currentTimeSec}- onSeek={onSeek}- onDropWordRange={onDropWordRange}- />+ {sections.map((section, idx) => (+ <TranscriptClipBlock+ key={section.clip.id}+ index={idx}+ section={section}+ busy={busy}+ cueWordId={cueWordId}+ onSeek={onSeek}+ onAddSkipRange={onAddSkipRange}+ onRemoveSkipRange={onRemoveSkipRange}+ />+ ))}</div></div>);}+// One contentEditable block per clip — header (vignette + filename ++// range) and a flowing word stream. The stream contains every transcript+// word inside the clip's source range, color-coded by whether the word+// is inside any skipRange. Backspace/Delete adds a new skipRange via+// onAddSkipRange; hover-bin on a skip run removes it via onRemoveSkipRange.+function TranscriptClipBlock({+ index,+ section,+ busy,+ cueWordId,+ onSeek,+ onAddSkipRange,+ onRemoveSkipRange,+}: {+ index: number;+ section: ClipSection;+ busy: boolean;+ cueWordId: string | null;+ onSeek: (sec: number) => void;+ onAddSkipRange: (assetId: string, startSec: number, endSec: number, reason: string) => void;+ onRemoveSkipRange: (skipId: string) => void;+}) {+ const { clip, asset, words } = section;+ const filename = asset?.label ?? clip.assetId;+ const sourceRangeLabel =+ clip.sourceEndSec !== undefined+ ? `${formatMs(clip.sourceStartSec * 1000)}—${formatMs(clip.sourceEndSec * 1000)}`+ : `${formatMs(clip.sourceStartSec * 1000)}—`;++ const editorRef = useRef<HTMLDivElement | null>(null);+ const pendingCaretWordIdRef = useRef<string | null>(null);++ // ponytail: auto-scroll the cue word into view as the playback head+ // moves. The right pane has ONE scroll container (paneBody, which+ // already has overflow-y: auto) — the per-clip editor itself is not+ // scrollable, so the cue scroll always lands on the paneBody.+ // Mirrors axcut's `scrollCueWordIntoView` in CurrentTranscriptView+ // (margins keep the highlighted word clear of the editor's edges).+ const SCROLL_MARGIN_PX = 56;+ useLayoutEffect(() => {+ const editor = editorRef.current;+ if (!editor || !cueWordId) return;+ const wordElement = editor.querySelector<HTMLElement>(`[data-word-id="${cueWordId}"]`);+ if (!wordElement) return;+ // ponytail: walk up to the first scrollable ancestor (paneBody)+ // and scroll so the word element lands inside its viewport.+ let ancestor: HTMLElement | null = wordElement.parentElement;+ while (ancestor && ancestor !== document.body) {+ const style = globalThis.getComputedStyle(ancestor);+ const overflowY = style.overflowY;+ if (overflowY === "auto" || overflowY === "scroll") {+ const ancestorRect = ancestor.getBoundingClientRect();+ const wordRect = wordElement.getBoundingClientRect();+ if (+ wordRect.top >= ancestorRect.top + SCROLL_MARGIN_PX &&+ wordRect.bottom <= ancestorRect.bottom - SCROLL_MARGIN_PX+ ) {+ return;+ }+ if (wordRect.top < ancestorRect.top + SCROLL_MARGIN_PX) {+ ancestor.scrollTop -= ancestorRect.top + SCROLL_MARGIN_PX - wordRect.top;+ } else if (wordRect.bottom > ancestorRect.bottom - SCROLL_MARGIN_PX) {+ ancestor.scrollTop += wordRect.bottom - (ancestorRect.bottom - SCROLL_MARGIN_PX);+ }+ return;+ }+ ancestor = ancestor.parentElement;+ }+ }, [cueWordId]);++ // ponytail: keep the caret anchored to the next kept word after a+ // skipRange is added (so the user can keep deleting without the caret+ // jumping to the start of the block).+ useLayoutEffect(() => {+ const wordId = pendingCaretWordIdRef.current;+ if (!wordId) return;+ pendingCaretWordIdRef.current = null;+ restoreCaretBeforeWord(editorRef.current, wordId);+ });++ const skipWordRange = useCallback(+ (rangeWords: ClipWord[]) => {+ if (busy || rangeWords.length === 0) return;+ // Only skip words that are currently kept (don't double-skip).+ const keptRange = rangeWords.filter((w) => w.kept);+ if (keptRange.length === 0) return;+ pendingCaretWordIdRef.current = keptRange[0].word.id;+ const startSec = Math.min(...keptRange.map((w) => w.word.startSec));+ const endSec = Math.max(...keptRange.map((w) => w.word.endSec));+ onAddSkipRange(+ clip.assetId,+ startSec,+ endSec,+ `Skip ${formatMs(startSec * 1000)}-${formatMs(endSec * 1000)} from ${clip.assetId}.`,+ );+ },+ [busy, clip.assetId, onAddSkipRange],+ );++ const removeSkipRun = useCallback(+ (run: SkipRun) => {+ if (busy || !run.skipId) return;+ onRemoveSkipRange(run.skipId);+ },+ [busy, onRemoveSkipRange],+ );++ const cutNativeSelection = useCallback(+ (direction: "backward" | "forward") => {+ const editor = editorRef.current;+ const selection = globalThis.getSelection();+ if (!selection || !editor) return false;+ if (!editor.contains(selection.anchorNode) || !editor.contains(selection.focusNode)) {+ return false;+ }+ if (selection.isCollapsed) {+ const wordId = findCollapsedDeletionWordId(+ editor,+ selection.anchorNode,+ selection.anchorOffset,+ direction,+ words,+ );+ if (!wordId) return false;+ const cw = words.find((w) => w.word.id === wordId);+ if (!cw) return false;+ skipWordRange([cw]);+ return true;+ }+ // ponytail: for a non-collapsed selection, the anchor/focus+ // already identify the endpoints — no need to apply the+ // "Backspace at start of word" / "Delete at end of word"+ // boundary heuristic (that fallback is for collapsed carets+ // only — it would return the previous/next word here and+ // shrink the trim range to a few words at the selection+ // boundary). Use findWordId directly to get the word+ // containing each endpoint.+ const anchorId = findWordId(selection.anchorNode);+ const focusId = findWordId(selection.focusNode);+ if (!anchorId || !focusId) return false;+ const fromIdx = words.findIndex((w) => w.word.id === anchorId);+ const toIdx = words.findIndex((w) => w.word.id === focusId);+ if (fromIdx < 0 || toIdx < 0) return false;+ const [lo, hi] = fromIdx <= toIdx ? [fromIdx, toIdx] : [toIdx, fromIdx];+ skipWordRange(words.slice(lo, hi + 1));+ return true;+ },+ [skipWordRange, words],+ );++ const handleKeyDown = useCallback(+ (event: ReactKeyboardEvent<HTMLDivElement>) => {+ if (event.key !== "Backspace" && event.key !== "Delete") return;+ event.preventDefault();+ cutNativeSelection(event.key === "Backspace" ? "backward" : "forward");+ },+ [cutNativeSelection],+ );++ const handleBeforeInput = useCallback(+ (event: FormEvent<HTMLDivElement>) => {+ const inputEvent = event.nativeEvent as InputEvent;+ if (inputEvent.inputType.startsWith("delete")) {+ event.preventDefault();+ cutNativeSelection(+ inputEvent.inputType === "deleteContentForward" ? "forward" : "backward",+ );+ return;+ }+ // ponytail: typing/pasting free text is non-destructive by design+ // (the user's transcript edits come via the Source Transcript+ // modal, not here). Block inserts to keep the projection stable.+ if (inputEvent.inputType === "insertText" || inputEvent.inputType === "insertFromPaste") {+ event.preventDefault();+ }+ },+ [cutNativeSelection],+ );++ const handlePaste = useCallback((event: ReactClipboardEvent<HTMLDivElement>) => {+ event.preventDefault();+ }, []);++ const handlePointerUp = useCallback(+ (event: ReactPointerEvent<HTMLDivElement>) => {+ if (event.button !== 0) return;+ // ponytail: a click on the trim-pill button (bin) bubbles up here+ // before the button's onClick fires. Skip those — the bin's own+ // handler is responsible for restoring the skip range.+ if (event.target instanceof Element && event.target.closest("button")) return;+ const editor = editorRef.current;+ if (!editor) return;+ const selection = globalThis.getSelection();+ if (selection && !selection.isCollapsed) return; // user is selecting text — let them++ // ponytail: clicks land on the deepest element under the cursor,+ // which is usually the text node inside a word span. Text nodes+ // don't have `closest`, and a non-filler word's text is rendered+ // as a bare text node (no inner span). Walk up to an Element+ // first, then look for the enclosing word span.+ const targetEl =+ event.target instanceof Element+ ? event.target+ : event.target instanceof Text+ ? (event.target.parentElement ?? null)+ : null;+ if (!targetEl) return;+ const wordEl = targetEl.closest<HTMLElement>("[data-word-id]");+ if (!wordEl?.dataset.wordId) return;+ const cw = words.find((w) => w.word.id === wordEl.dataset.wordId);+ if (!cw) return;+ onSeek(cw.word.startSec);+ },+ [onSeek, words],+ );++ return (+ <span+ style={{+ display: "block",+ marginBottom: 16,+ }}+ >+ <span+ style={{+ display: "flex",+ alignItems: "center",+ gap: 10,+ padding: "0 4px 4px",+ borderBottom: "1px solid var(--border-soft)",+ marginBottom: 6,+ }}+ >+ <span+ style={{+ width: 22,+ height: 22,+ display: "inline-flex",+ alignItems: "center",+ justifyContent: "center",+ background: "var(--accent-soft)",+ color: "var(--accent)",+ borderRadius: "var(--r-sm)",+ font: "700 12px/1 var(--font-mono)",+ flexShrink: 0,+ }}+ >+ {index + 1}+ </span>+ <span style={{ minWidth: 0, flex: 1 }}>+ <span+ style={{+ display: "block",+ font: "600 13px/1.2 var(--font-body)",+ color: "var(--fg)",+ overflow: "hidden",+ textOverflow: "ellipsis",+ whiteSpace: "nowrap",+ }}+ >+ {filename}+ </span>+ <span+ style={{+ display: "block",+ font: "400 11px/1.3 var(--font-mono)",+ color: "var(--muted)",+ marginTop: 2,+ }}+ >+ Clip {index + 1} · {sourceRangeLabel}+ </span>+ </span>+ </span>+ {words.length === 0 ? (+ <p+ style={{+ margin: 0,+ padding: "4px 4px",+ font: "400 12px/1.5 var(--font-body)",+ color: "var(--muted)",+ fontStyle: "italic",+ }}+ >+ No transcript for this clip — open the asset card and regenerate.+ </p>+ ) : (+ <div+ ref={editorRef}+ role="textbox"+ tabIndex={0}+ contentEditable={!busy}+ suppressContentEditableWarning+ spellCheck={false}+ aria-label={`Transcript for ${filename}`}+ aria-multiline="true"+ onBeforeInput={handleBeforeInput}+ onKeyDown={handleKeyDown}+ onPaste={handlePaste}+ onPointerUp={handlePointerUp}+ style={{+ padding: "4px 4px",+ font: "400 13px/1.65 var(--font-body)",+ color: "var(--fg)",+ textWrap: "pretty",+ cursor: "text",+ outline: "none",+ // ponytail: no overflow on the per-clip editor — the+ // parent paneBody (already overflow-y: auto) is the+ // single scroll container for the whole transcript.+ // Scrolling within the editor would create a nested+ // scrollbar that breaks the cue auto-scroll UX.+ }}+ >+ {words.map((cw) => (+ <TranscriptWord+ key={cw.word.id}+ cw={cw}+ isCue={cw.word.id === cueWordId}+ onRestore={removeSkipRun}+ />+ ))}+ </div>+ )}+ </span>+ );+}++// One word inside the editable block. Kept words render plain; removed+// words (inside a skip range) render red+strikethrough with a hover bin.+// `isCue` highlights the word the playback head is currently inside with+// an accent underline (matches axcut's `word.transcript-word.cue` rule).+function TranscriptWord({+ cw,+ isCue,+ onRestore,+}: {+ cw: ClipWord;+ isCue: boolean;+ onRestore: (run: SkipRun) => void;+}) {+ const [hover, setHover] = useState(false);+ const removed = !cw.kept;+ return (+ <span+ data-word-id={cw.word.id}+ data-start-sec={cw.word.startSec}+ data-end-sec={cw.word.endSec}+ data-skip-id={cw.skipId ?? undefined}+ data-cue={isCue ? "true" : undefined}+ style={{+ display: "inline",+ color: removed ? "var(--danger)" : "var(--fg)",+ fontWeight: removed ? 600 : 400,+ textDecoration: removed ? "line-through" : "none",+ textDecorationColor: removed ? "var(--danger)" : undefined,+ opacity: removed ? 0.9 : 1,+ borderBottom: isCue ? "2px solid var(--accent)" : "none",+ paddingBottom: isCue ? 1 : 0,+ }}+ onMouseEnter={() => setHover(true)}+ onMouseLeave={() => setHover(false)}+ >+ {/* ponytail: no filler chip. axcut renders every word the same way;+ the LLM is the only place that names a word a filler (via the+ filler_or_hesitation reason when generating suggestions). */}+ {cw.word.text}{" "}+ {removed && hover && cw.skipId ? (+ <button+ type="button"+ contentEditable={false}+ title={`Restore "${cw.word.text}"`}+ aria-label={`Restore "${cw.word.text}"`}+ onClick={(e) => {+ e.stopPropagation();+ // ponytail: build a minimal SkipRun stub — only skipId is+ // read by onRestore.+ onRestore({+ skipId: cw.skipId ?? "",+ assetId: "",+ startWordIndex: 0,+ endWordIndex: 0,+ durationSec: 0,+ });+ }}+ style={{+ display: "inline-flex",+ alignItems: "center",+ justifyContent: "center",+ width: 18,+ height: 18,+ marginLeft: 4,+ padding: 0,+ border: 0,+ borderRadius: 4,+ background: "var(--danger)",+ color: "white",+ cursor: "pointer",+ verticalAlign: "middle",+ }}+ >+ <Trash2 size={12} strokeWidth={1.9} aria-hidden="true" />+ </button>+ ) : null}+ </span>+ );+}++// ─── Caret / selection helpers ────────────────────────────────────+// Ponytail port of axcut's findCollapsedDeletionWordId. The non-collapsed+// path uses findWordId directly (a range selection's endpoints already+// identify the boundary words — no boundary heuristic needed).++function findWordId(node: Node | null): string | null {+ const element = node instanceof Element ? node : node?.parentElement;+ return element?.closest<HTMLElement>("[data-word-id]")?.dataset.wordId ?? null;+}++function findCollapsedDeletionWordId(+ editor: HTMLElement,+ node: Node | null,+ offset: number,+ direction: "backward" | "forward",+ words: ClipWord[],+): string | null {+ // ponytail: read the kept/skip state from the words array, not the+ // DOM's data-skip-id. The DOM may be lagging a render behind (its+ // skipId is only set on the next React commit), so a DOM check would+ // re-trim an already-trimmed word. The words array is the React state+ // captured at the call site — always current.+ const skippedIds = new Set(words.filter((w) => !w.kept).map((w) => w.word.id));++ const direct = closestWordElement(node);+ if (direct) {+ const textLength = node?.textContent?.length ?? 0;+ if (node?.nodeType === Node.TEXT_NODE) {+ if (direction === "backward" && offset <= 0) {+ // ponytail: clicking at the start of a word normally deletes+ // the previous word, but when the previous word is already+ // trimmed, that would be a no-op. Fall back to the current+ // word so Backspace always does something.+ const prev = adjacentWordId(editor, direct, "backward");+ if (prev && !skippedIds.has(prev)) {+ return prev;+ }+ return direct.dataset.wordId ?? null;+ }+ if (direction === "forward" && offset >= textLength) {+ const next = adjacentWordId(editor, direct, "forward");+ if (next && !skippedIds.has(next)) {+ return next;+ }+ return direct.dataset.wordId ?? null;+ }+ }+ return direct.dataset.wordId ?? null;+ }+ if (!node) return null;+ const wordNodes = Array.from(editor.querySelectorAll<HTMLElement>("[data-word-id]"));+ if (wordNodes.length === 0) return null;+ const boundaryNode = node instanceof Element ? node : node.parentElement;+ if (!boundaryNode) return null;+ const childNodes = Array.from(boundaryNode.childNodes);++ // ponytail: when restoreCaretBeforeWord places the caret before word W+ // (via setStartBefore), `anchorNode` becomes the parent div and+ // `anchorOffset` is W's index. The naive "previous sibling" lookup+ // below would always return the word that was *just* trimmed, which+ // is a no-op (the previous word is already skipped). The user+ // expects Backspace at the start of W to delete W. So when the+ // previous adjacent word is already trimmed, fall forward to W.+ if (direction === "backward" && node instanceof Element && node === editor) {+ const idx = Math.max(0, Math.min(offset, wordNodes.length) - 1);+ const previousWordId = wordNodes[idx]?.dataset.wordId ?? null;+ if (previousWordId && skippedIds.has(previousWordId)) {+ return wordNodes[idx]?.dataset.wordId ?? null;+ }+ }++ const candidates =+ direction === "backward" ? childNodes.slice(0, offset).reverse() : childNodes.slice(offset);+ for (const candidate of candidates) {+ const wordId = findWordId(candidate) ?? findDescendantWordId(candidate);+ if (wordId) return wordId;+ }+ const range = globalThis.document.createRange();+ range.setStart(editor, 0);+ range.setEnd(node, clampRangeOffset(node, offset));+ const wordsBefore = wordNodes.filter((wordNode) => range.comparePoint(wordNode, 0) <= 0);+ return direction === "backward"+ ? (wordsBefore.at(-1)?.dataset.wordId ?? null)+ : (wordNodes.find((wordNode) => !wordsBefore.includes(wordNode))?.dataset.wordId ?? null);+}++function findDescendantWordId(node: Node): string | null {+ if (node instanceof HTMLElement && node.dataset.wordId) {+ return node.dataset.wordId;+ }+ return node instanceof Element+ ? (node.querySelector<HTMLElement>("[data-word-id]")?.dataset.wordId ?? null)+ : null;+}++function closestWordElement(node: Node | null): HTMLElement | null {+ const element = node instanceof Element ? node : node?.parentElement;+ return element?.closest<HTMLElement>("[data-word-id]") ?? null;+}++function adjacentWordId(+ editor: HTMLElement,+ wordElement: HTMLElement,+ direction: "backward" | "forward",+): string | null {+ const wordNodes = Array.from(editor.querySelectorAll<HTMLElement>("[data-word-id]"));+ const index = wordNodes.indexOf(wordElement);+ if (index < 0) return null;+ return wordNodes[index + (direction === "backward" ? -1 : 1)]?.dataset.wordId ?? null;+}++function clampRangeOffset(node: Node, offset: number): number {+ if (node.nodeType === Node.TEXT_NODE) {+ return Math.max(0, Math.min(offset, node.textContent?.length ?? 0));+ }+ return Math.max(0, Math.min(offset, node.childNodes.length));+}++function restoreCaretBeforeWord(editor: HTMLElement | null, wordId: string): void {+ const wordElement = editor?.querySelector<HTMLElement>(`[data-word-id="${wordId}"]`);+ if (!editor || !wordElement) return;+ editor.focus();+ const range = globalThis.document.createRange();+ range.setStartBefore(wordElement);+ range.collapse(true);+ const selection = globalThis.getSelection();+ selection?.removeAllRanges();+ selection?.addRange(range);+}++// Re-export AxcutWord type so the helpers above can be typed without+// pulling the schema into the helpers block.+export type { AxcutWord };+// ─── Video Effects ─────────────────────────────────────────────────export function VideoEffectsPane() {diff --git a/src/components/ai-edition/TranscriptEditor.module.css b/src/components/ai-edition/TranscriptEditor.module.cssdeleted file mode 100644index 74e4ace7a..000000000--- a/src/components/ai-edition/TranscriptEditor.module.css+++ /dev/null@@ -1,75 +0,0 @@-.container {- display: flex;- flex-direction: column;- gap: 0.25rem;- padding: 0.5rem 0.75rem;- border-top: 1px solid var(--border);- background: var(--card);- max-height: 180px;- overflow: hidden;-}--.header {- display: flex;- align-items: center;- justify-content: space-between;- gap: 0.5rem;-}--.heading {- font-size: 0.75rem;- font-weight: 600;- margin: 0;- color: var(--muted-foreground);- text-transform: uppercase;- letter-spacing: 0.025em;-}--.cutButton {- padding: 0.25rem 0.625rem;- border-radius: 0.375rem;- border: 1px solid var(--destructive);- background: var(--destructive);- color: white;- font-size: 0.75rem;- cursor: pointer;-}--.cutButton:hover {- opacity: 0.85;-}--.textArea {- flex: 1;- overflow-y: auto;- line-height: 1.6;- font-size: 0.8125rem;- padding: 0.25rem;-}--.word {- display: inline-block;- padding: 0.0625rem 0.1875rem;- border-radius: 0.125rem;- cursor: pointer;- transition: background-color 100ms ease;-}--.word:hover {- background: var(--accent);-}--.word.skipped {- color: var(--destructive);- text-decoration: line-through;- opacity: 0.6;-}--.word.selected {- background: var(--primary);- color: var(--primary-foreground);-}--.word.current {- border-bottom: 2px solid var(--primary);-}diff --git a/src/components/ai-edition/TranscriptEditor.tsx b/src/components/ai-edition/TranscriptEditor.tsxdeleted file mode 100644index bbccc45e2..000000000--- a/src/components/ai-edition/TranscriptEditor.tsx+++ /dev/null@@ -1,117 +0,0 @@-import { useCallback, useMemo, useState } from "react";-import type { AxcutClip, AxcutTranscript } from "@/lib/ai-edition/schema";-import { formatSeconds, keptWordIdSet } from "@/lib/ai-edition/timeline/virtual-preview";-import styles from "./TranscriptEditor.module.css";--// ponytail: simplified port of axcut's TranscriptEditor. Click a word to-// select, shift-click another word to select a range, press "Cut" to drop-// that range from the timeline. Kept words = default, skipped = red.--interface TranscriptEditorProps {- transcript: AxcutTranscript;- clips: AxcutClip[];- currentTimeSec: number;- onSeek: (timeSec: number) => void;- onDropWordRange: (startSec: number, endSec: number) => void;-}--export function TranscriptEditor({- transcript,- clips,- currentTimeSec,- onSeek,- onDropWordRange,-}: TranscriptEditorProps) {- const [anchorWordId, setAnchorWordId] = useState<string | null>(null);- const [focusWordId, setFocusWordId] = useState<string | null>(null);- const keptIds = useMemo(() => keptWordIdSet(clips), [clips]);-- const handleWordClick = useCallback(- (event: React.MouseEvent, wordId: string, startSec: number) => {- if (event.shiftKey && anchorWordId) {- setFocusWordId(wordId);- } else {- setAnchorWordId(wordId);- setFocusWordId(wordId);- onSeek(startSec);- }- },- [anchorWordId, onSeek],- );-- const selectedRange = useMemo(() => {- if (!anchorWordId || !focusWordId) return null;- const startIndex = transcript.words.findIndex((w) => w.id === anchorWordId);- const endIndex = transcript.words.findIndex((w) => w.id === focusWordId);- if (startIndex < 0 || endIndex < 0) return null;- const [from, to] = startIndex <= endIndex ? [startIndex, endIndex] : [endIndex, startIndex];- const selected = transcript.words.slice(from, to + 1);- if (selected.length === 0) return null;- return {- startSec: Math.min(...selected.map((w) => w.startSec)),- endSec: Math.max(...selected.map((w) => w.endSec)),- text: selected.map((w) => w.text).join(" "),- };- }, [anchorWordId, focusWordId, transcript.words]);-- const handleCut = useCallback(() => {- if (selectedRange) {- onDropWordRange(selectedRange.startSec, selectedRange.endSec);- setAnchorWordId(null);- setFocusWordId(null);- }- }, [onDropWordRange, selectedRange]);-- return (- <div className={styles.container}>- <div className={styles.header}>- <h3 className={styles.heading}>Transcript</h3>- {selectedRange && (- <button type="button" className={styles.cutButton} onClick={handleCut}>- Cut {formatSeconds(selectedRange.startSec)}–{formatSeconds(selectedRange.endSec)}- </button>- )}- </div>- <div className={styles.textArea}>- {transcript.words.map((word) => {- const isKept = keptIds.has(word.id);- const isSelected =- anchorWordId && focusWordId- ? isInRange(word.id, anchorWordId, focusWordId, transcript.words)- : false;- const isCurrent = currentTimeSec >= word.startSec && currentTimeSec <= word.endSec;- return (- <span- key={word.id}- className={[- styles.word,- !isKept ? styles.skipped : "",- isSelected ? styles.selected : "",- isCurrent ? styles.current : "",- ]- .filter(Boolean)- .join(" ")}- onClick={(e) => handleWordClick(e, word.id, word.startSec)}- >- {word.text}- </span>- );- })}- </div>- </div>- );-}--function isInRange(- wordId: string,- anchorId: string,- focusId: string,- words: { id: string }[],-): boolean {- const start = words.findIndex((w) => w.id === anchorId);- const end = words.findIndex((w) => w.id === focusId);- if (start < 0 || end < 0) return false;- const [from, to] = start <= end ? [start, end] : [end, start];- const index = words.findIndex((w) => w.id === wordId);- return index >= from && index <= to;-}diff --git a/src/lib/ai-edition/document/operations.ts b/src/lib/ai-edition/document/operations.tsindex 553cbb7f6..76cb0d5d0 100644--- a/src/lib/ai-edition/document/operations.ts+++ b/src/lib/ai-edition/document/operations.ts@@ -11,7 +11,8 @@import type { AxcutDocument } from "../schema";import {- byStart,+ duplicateClip,+ moveClip,normalizeIntervals,primaryAssetDuration,replaceTimeline,@@ -38,6 +39,18 @@ export type AxcutTimelineOperation =endSec: number;reason?: string;}+ | {+ type: "update_skip_range";+ skipId: string;+ startSec: number;+ endSec: number;+ reason?: string;+ }+ | {+ type: "remove_skip_range";+ skipId: string;+ reason?: string;+ }| {type: "restore_full_timeline";reason?: string;@@ -48,6 +61,17 @@ export type AxcutTimelineOperation =sourceStartSec: number;sourceEndSec: number;reason?: string;+ }+ | {+ type: "move_clip";+ clipId: string;+ insertIndex: number;+ reason?: string;+ }+ | {+ type: "duplicate_clip";+ clipId: string;+ reason?: string;};export interface AppliedTimelineOperation {@@ -155,7 +179,14 @@ export function applyTimelineOperation(const lo = Math.max(0, Math.min(op.startSec, op.endSec));const hi = Math.max(lo, Math.max(op.startSec, op.endSec));const existing = document.timeline.skipRanges.filter((s) => s.assetId === assetId);- const merged = normalizeIntervals(primaryAssetDuration(document), [+ // ponytail: bound by the skip-range asset's duration, not the+ // primary asset's. Recording projects can have a short primary+ // asset (snippet) while the clip uses a long video — using+ // primaryAssetDuration here would truncate the skip range and+ // only trim a few words instead of the user's full selection.+ const asset = document.assets.find((a) => a.id === assetId);+ const duration = asset?.durationSec ?? Infinity;+ const merged = normalizeIntervals(duration, [{ startSec: lo, endSec: hi },...existing.map((s) => ({ startSec: s.startSec, endSec: s.endSec })),]);@@ -179,6 +210,42 @@ export function applyTimelineOperation(summary: `added skip ${formatSec(lo)}–${formatSec(hi)}`,};}+ case "update_skip_range": {+ const lo = Math.max(0, Math.min(op.startSec, op.endSec));+ const hi = Math.max(lo, Math.max(op.startSec, op.endSec));+ let found = false;+ const next: AxcutDocument = {+ ...document,+ timeline: {+ ...document.timeline,+ skipRanges: document.timeline.skipRanges.map((s) => {+ if (s.id !== op.skipId) return s;+ found = true;+ return { ...s, startSec: lo, endSec: hi, reason: op.reason ?? s.reason };+ }),+ },+ preview: { ...document.preview, revision: document.preview.revision + 1 },+ };+ if (!found) return { document, summary: `unknown skip ${op.skipId}` };+ return {+ document: next,+ summary: `updated skip ${op.skipId} to ${formatSec(lo)}–${formatSec(hi)}`,+ };+ }+ case "remove_skip_range": {+ const next: AxcutDocument = {+ ...document,+ timeline: {+ ...document.timeline,+ skipRanges: document.timeline.skipRanges.filter((s) => s.id !== op.skipId),+ },+ preview: { ...document.preview, revision: document.preview.revision + 1 },+ };+ return {+ document: next,+ summary: `removed skip ${op.skipId}`,+ };+ }case "restore_full_timeline": {const duration = primaryAssetDuration(document);if (duration <= 0) return { document, summary: "no duration yet" };@@ -216,6 +283,14 @@ export function applyTimelineOperation(summary: `trimmed clip to ${formatSec(Math.min(op.sourceStartSec, op.sourceEndSec))}–${formatSec(Math.max(op.sourceStartSec, op.sourceEndSec))}`,};}+ case "move_clip": {+ const next = moveClip(document, op.clipId, op.insertIndex, "user", op.reason ?? "");+ return { document: next, summary: `moved clip ${op.clipId} to position ${op.insertIndex}` };+ }+ case "duplicate_clip": {+ const next = duplicateClip(document, op.clipId, "user", op.reason ?? "");+ return { document: next, summary: `duplicated clip ${op.clipId}` };+ }default: {// ponytail: exhaustive — TS errors here when a new variant is added.const exhaustive: never = op;diff --git a/src/lib/ai-edition/document/timeline.ts b/src/lib/ai-edition/document/timeline.tsindex 82c4a6f85..6eb806c1b 100644--- a/src/lib/ai-edition/document/timeline.ts+++ b/src/lib/ai-edition/document/timeline.ts@@ -1,190 +1,262 @@-// Ported from axcut/apps/server/src/lib/timeline.ts — pure interval math for-// the clip/skip model. No DOM, no IPC, no side effects. The caller (store,-// exporter, agent) feeds an AxcutDocument and gets back intervals or a new-// document with updated clips.-//-// ponytail: only the ops Phase 1 needs (replaceTimeline, dropRange, restore).-// The full 11-op dispatcher lands in Phase 6 with the agent runtime.--import type { AxcutClip, AxcutDocument, AxcutTranscript } from "../schema";--export function byStart(a: { startSec: number }, b: { startSec: number }): number {- return a.startSec - b.startSec;-}--export interface Interval {- startSec: number;- endSec: number;-}--export function normalizeIntervals(durationSec: number, intervals: Interval[]): Interval[] {- const bounded = intervals- .map((item) => ({- startSec: Math.max(0, Math.min(durationSec, item.startSec)),- endSec: Math.max(0, Math.min(durationSec, item.endSec)),- }))- .filter((item) => item.endSec > item.startSec)- .sort(byStart);-- const merged: Interval[] = [];- for (const item of bounded) {- const last = merged.at(-1);- if (!last || item.startSec > last.endSec) {- merged.push({ ...item });- continue;- }- last.endSec = Math.max(last.endSec, item.endSec);- }- return merged;-}--export function primaryAssetDuration(document: AxcutDocument): number {- const asset =- document.assets.find((item) => item.id === document.project.primaryAssetId) ??- document.assets[0];- return asset?.durationSec ?? 0;-}--export function timelineIntervals(document: AxcutDocument): Interval[] {- return normalizeIntervals(- primaryAssetDuration(document),- document.timeline.clips.map((clip) => ({- startSec: clip.sourceStartSec,- endSec: clip.sourceEndSec ?? primaryAssetDuration(document),- })),- );-}--export function buildTimelineFromIntervals(- assetId: string,- intervals: Interval[],- options: {- origin: "system" | "agent" | "user";- reason: string;- transcript: AxcutTranscript | null;- },-): AxcutClip[] {- let cursor = 0;- return intervals.map((interval, index) => {- const duration = interval.endSec - interval.startSec;- const timelineStartSec = cursor;- const timelineEndSec = cursor + duration;- cursor = timelineEndSec;- return {- id: `clip_${index + 1}`,- assetId,- sourceStartSec: interval.startSec,- sourceEndSec: interval.endSec,- timelineStartSec,- timelineEndSec,- wordRefs: collectWordRefs(options.transcript, interval.startSec, interval.endSec),- origin: options.origin,- reason: options.reason,- };- });-}--function collectWordRefs(- transcript: AxcutTranscript | null,- startSec: number,- endSec: number,-): string[] {- if (!transcript) return [];- return transcript.words- .filter((word) => word.endSec > startSec && word.startSec < endSec)- .map((word) => word.id);-}--// Lay clips back-to-back from t=0, preserving each clip's own length. Called-// after any structural change (insert / move / remove / trim) so the timeline-// never has gaps or overlaps between clips. Shared by useTimeline (UI) and-// the agent tool executor (main process) so both enforce the same invariant.-export function resequenceClips(clips: AxcutClip[]): AxcutClip[] {- let cursor = 0;- return clips.map((c) => {- const timelineLen = c.timelineEndSec - c.timelineStartSec;- const sourceLen = (c.sourceEndSec ?? 0) - c.sourceStartSec;- const len = Math.max(0.001, timelineLen > 0 ? timelineLen : sourceLen);- const next = { ...c, timelineStartSec: cursor, timelineEndSec: cursor + len };- cursor += len;- return next;- });-}--export function subtractInterval(intervals: Interval[], cut: Interval): Interval[] {- const output: Interval[] = [];- for (const interval of intervals) {- if (cut.endSec <= interval.startSec || cut.startSec >= interval.endSec) {- output.push(interval);- continue;- }- if (cut.startSec > interval.startSec) {- output.push({ startSec: interval.startSec, endSec: cut.startSec });- }- if (cut.endSec < interval.endSec) {- output.push({ startSec: cut.endSec, endSec: interval.endSec });- }- }- return output;-}--export function invertIntervals(intervals: Interval[], durationSec: number): Interval[] {- const cuts: Interval[] = [];- let cursor = 0;- for (const interval of normalizeIntervals(durationSec, intervals)) {- if (interval.startSec > cursor) {- cuts.push({ startSec: cursor, endSec: interval.startSec });- }- cursor = Math.max(cursor, interval.endSec);- }- if (cursor < durationSec) {- cuts.push({ startSec: cursor, endSec: durationSec });- }- return cuts;-}--export function replaceTimeline(- document: AxcutDocument,- intervals: Interval[],- reason: string,- origin: "system" | "agent" | "user" = "user",-): AxcutDocument {- const assetId = document.project.primaryAssetId ?? document.assets[0]?.id;- if (!assetId) {- throw new Error("Cannot update timeline without a primary asset.");- }- const duration = primaryAssetDuration(document);- const normalized = normalizeIntervals(duration, intervals);- const clips = buildTimelineFromIntervals(assetId, normalized, {- origin,- reason,- transcript: document.transcript,- });- const skipRanges = invertIntervals(normalized, duration).map((cut, i) => ({- id: `skip_${i + 1}`,- assetId,- startSec: cut.startSec,- endSec: cut.endSec,- origin,- reason,- }));- return {- ...document,- timeline: {- ...document.timeline,- clips,- skipRanges,- gaps: [],- },- preview: {- ...document.preview,- revision: document.preview.revision + 1,- },- };-}--export function restoreFullTimeline(document: AxcutDocument): AxcutDocument {- const duration = primaryAssetDuration(document);- if (duration <= 0) return document;- return replaceTimeline(document, [{ startSec: 0, endSec: duration }], "Restore full timeline");-}+// Ported from axcut/apps/server/src/lib/timeline.ts — pure interval math+// for the clip/skip model. No DOM, no IPC, no side effects. The caller+// (store, exporter, agent) feeds an AxcutDocument and gets back intervals+// or a new document with updated clips.++import type { AxcutClip, AxcutDocument, AxcutTranscript } from "../schema";++export function byStart(a: { startSec: number }, b: { startSec: number }): number {+ return a.startSec - b.startSec;+}++export interface Interval {+ startSec: number;+ endSec: number;+}++export function normalizeIntervals(durationSec: number, intervals: Interval[]): Interval[] {+ const bounded = intervals+ .map((item) => ({+ startSec: Math.max(0, Math.min(durationSec, item.startSec)),+ endSec: Math.max(0, Math.min(durationSec, item.endSec)),+ }))+ .filter((item) => item.endSec > item.startSec)+ .sort(byStart);++ const merged: Interval[] = [];+ for (const item of bounded) {+ const last = merged.at(-1);+ if (!last || item.startSec > last.endSec) {+ merged.push({ ...item });+ continue;+ }+ last.endSec = Math.max(last.endSec, item.endSec);+ }+ return merged;+}++export function primaryAssetDuration(document: AxcutDocument): number {+ const asset =+ document.assets.find((item) => item.id === document.project.primaryAssetId) ??+ document.assets[0];+ return asset?.durationSec ?? 0;+}++export function timelineIntervals(document: AxcutDocument): Interval[] {+ return normalizeIntervals(+ primaryAssetDuration(document),+ document.timeline.clips.map((clip) => ({+ startSec: clip.sourceStartSec,+ endSec: clip.sourceEndSec ?? primaryAssetDuration(document),+ })),+ );+}++export function buildTimelineFromIntervals(+ assetId: string,+ intervals: Interval[],+ options: {+ origin: "system" | "agent" | "user";+ reason: string;+ transcript: AxcutTranscript | null;+ },+): AxcutClip[] {+ let cursor = 0;+ return intervals.map((interval, index) => {+ const duration = interval.endSec - interval.startSec;+ const timelineStartSec = cursor;+ const timelineEndSec = cursor + duration;+ cursor = timelineEndSec;+ return {+ id: `clip_${index + 1}`,+ assetId,+ sourceStartSec: interval.startSec,+ sourceEndSec: interval.endSec,+ timelineStartSec,+ timelineEndSec,+ wordRefs: collectWordRefs(options.transcript, interval.startSec, interval.endSec),+ origin: options.origin,+ reason: options.reason,+ };+ });+}++function collectWordRefs(+ transcript: AxcutTranscript | null,+ startSec: number,+ endSec: number,+): string[] {+ if (!transcript) return [];+ return transcript.words+ .filter((word) => word.endSec > startSec && word.startSec < endSec)+ .map((word) => word.id);+}++// Lay clips back-to-back from t=0, preserving each clip's own length. Called+// after any structural change (insert / move / remove / trim) so the timeline+// never has gaps or overlaps between clips. Shared by useTimeline (UI) and+// the agent tool executor (main process) so both enforce the same invariant.+export function resequenceClips(clips: AxcutClip[]): AxcutClip[] {+ let cursor = 0;+ return clips.map((c) => {+ const timelineLen = c.timelineEndSec - c.timelineStartSec;+ const sourceLen = (c.sourceEndSec ?? 0) - c.sourceStartSec;+ const len = Math.max(0.001, timelineLen > 0 ? timelineLen : sourceLen);+ const next = { ...c, timelineStartSec: cursor, timelineEndSec: cursor + len };+ cursor += len;+ return next;+ });+}++export function subtractInterval(intervals: Interval[], cut: Interval): Interval[] {+ const output: Interval[] = [];+ for (const interval of intervals) {+ if (cut.endSec <= interval.startSec || cut.startSec >= interval.endSec) {+ output.push(interval);+ continue;+ }+ if (cut.startSec > interval.startSec) {+ output.push({ startSec: interval.startSec, endSec: cut.startSec });+ }+ if (cut.endSec < interval.endSec) {+ output.push({ startSec: cut.endSec, endSec: interval.endSec });+ }+ }+ return output;+}++export function invertIntervals(intervals: Interval[], durationSec: number): Interval[] {+ const cuts: Interval[] = [];+ let cursor = 0;+ for (const interval of normalizeIntervals(durationSec, intervals)) {+ if (interval.startSec > cursor) {+ cuts.push({ startSec: cursor, endSec: interval.startSec });+ }+ cursor = Math.max(cursor, interval.endSec);+ }+ if (cursor < durationSec) {+ cuts.push({ startSec: cursor, endSec: durationSec });+ }+ return cuts;+}++export function replaceTimeline(+ document: AxcutDocument,+ intervals: Interval[],+ reason: string,+ origin: "system" | "agent" | "user" = "user",+): AxcutDocument {+ const assetId = document.project.primaryAssetId ?? document.assets[0]?.id;+ if (!assetId) {+ throw new Error("Cannot update timeline without a primary asset.");+ }+ const duration = primaryAssetDuration(document);+ const normalized = normalizeIntervals(duration, intervals);+ const clips = buildTimelineFromIntervals(assetId, normalized, {+ origin,+ reason,+ transcript: document.transcript,+ });+ const skipRanges = invertIntervals(normalized, duration).map((cut, i) => ({+ id: `skip_${i + 1}`,+ assetId,+ startSec: cut.startSec,+ endSec: cut.endSec,+ origin,+ reason,+ }));+ return {+ ...document,+ timeline: {+ ...document.timeline,+ clips,+ skipRanges,+ gaps: [],+ },+ preview: {+ ...document.preview,+ revision: document.preview.revision + 1,+ },+ };+}++// ponytail: reorder an existing clip by removing it from its current+// position and inserting at `insertIndex` (clamped to the array length).+// Used for "move this clip there" / "swap these clips" — preserves all+// user-placed clip ids, origins, and source ranges. Mirrors axcut's+// apps/server/src/lib/timeline.ts#moveClip.+export function moveClip(+ document: AxcutDocument,+ clipId: string,+ insertIndex: number,+ origin: "system" | "agent" | "user" = "user",+ reason: string = "",+): AxcutDocument {+ const index = document.timeline.clips.findIndex((c) => c.id === clipId);+ if (index < 0) {+ throw new Error(`Unknown clip ${clipId}.`);+ }+ const movingClip = {+ ...document.timeline.clips[index],+ origin,+ reason: reason || document.timeline.clips[index].reason,+ };+ const remaining = document.timeline.clips.filter((c) => c.id !== clipId);+ const bounded = Math.max(0, Math.min(insertIndex, remaining.length));+ const reordered = [...remaining.slice(0, bounded), movingClip, ...remaining.slice(bounded)];+ return {+ ...document,+ timeline: {+ ...document.timeline,+ clips: resequenceClips(reordered),+ },+ preview: {+ ...document.preview,+ revision: document.preview.revision + 1,+ },+ };+}++// ponytail: duplicate a clip (preserves the original). Used for "split this+// clip into two" or "make a copy". Mirrors axcut's+// apps/server/src/lib/timeline.ts#duplicateClip.+export function duplicateClip(+ document: AxcutDocument,+ clipId: string,+ origin: "system" | "agent" | "user" = "user",+ reason: string = "",+): AxcutDocument {+ const index = document.timeline.clips.findIndex((c) => c.id === clipId);+ if (index < 0) {+ throw new Error(`Unknown clip ${clipId}.`);+ }+ const original = document.timeline.clips[index];+ const copy = {+ ...original,+ id: `clip_${document.timeline.clips.length + 1}_copy`,+ origin,+ reason: reason || original.reason,+ };+ const next = [+ ...document.timeline.clips.slice(0, index + 1),+ copy,+ ...document.timeline.clips.slice(index + 1),+ ];+ return {+ ...document,+ timeline: {+ ...document.timeline,+ clips: resequenceClips(next),+ },+ preview: {+ ...document.preview,+ revision: document.preview.revision + 1,+ },+ };+}++export function restoreFullTimeline(document: AxcutDocument): AxcutDocument {+ const duration = primaryAssetDuration(document);+ if (duration <= 0) return document;+ return replaceTimeline(document, [{ startSec: 0, endSec: duration }], "Restore full timeline");+}diff --git a/src/lib/ai-edition/timeline/aggregated-transcript.test.ts b/src/lib/ai-edition/timeline/aggregated-transcript.test.tsnew file mode 100644index 000000000..f4fc27382--- /dev/null+++ b/src/lib/ai-edition/timeline/aggregated-transcript.test.ts@@ -0,0 +1,283 @@+import { describe, expect, it } from "vitest";+import type { AxcutAsset, AxcutClip, AxcutSkipRange, AxcutTranscript } from "../schema";+import { buildAggregatedSections, buildClipSection, findCueWordId } from "./aggregated-transcript";++function makeClip(overrides: Partial<AxcutClip> = {}): AxcutClip {+ return {+ id: "clip_1",+ assetId: "asset_1",+ sourceStartSec: 0,+ sourceEndSec: 10,+ timelineStartSec: 0,+ timelineEndSec: 10,+ wordRefs: [],+ origin: "system",+ reason: "",+ ...overrides,+ };+}++function makeAsset(overrides: Partial<AxcutAsset> = {}): AxcutAsset {+ return {+ id: "asset_1",+ kind: "video",+ label: "demo.mp4",+ originalPath: "/tmp/demo.mp4",+ durationSec: 30,+ ...overrides,+ };+}++function makeTranscript(words: AxcutTranscript["words"]): AxcutTranscript {+ return { assetId: "asset_1", language: "en", segments: [], words };+}++function makeSkip(overrides: Partial<AxcutSkipRange>): AxcutSkipRange {+ return {+ id: overrides.id ?? "skip_1",+ assetId: overrides.assetId ?? "asset_1",+ startSec: overrides.startSec ?? 0,+ endSec: overrides.endSec ?? 0,+ origin: overrides.origin ?? "user",+ reason: overrides.reason ?? "",+ };+}++describe("buildClipSection", () => {+ it("marks every word in source range as kept when no skips exist", () => {+ const clip = makeClip({ sourceStartSec: 0, sourceEndSec: 3 });+ const transcript = makeTranscript([+ { id: "w1", segmentId: "s1", startSec: 0, endSec: 1, text: "hi" },+ { id: "w2", segmentId: "s1", startSec: 1, endSec: 2, text: "there" },+ { id: "w3", segmentId: "s1", startSec: 2, endSec: 3, text: "friend" },+ ]);++ const section = buildClipSection(clip, transcript, makeAsset(), []);+ expect(section.words.map((cw) => cw.kept)).toEqual([true, true, true]);+ expect(section.skipRuns).toEqual([]);+ });++ it("flags words inside a skip range as removed and groups them into one SkipRun", () => {+ const clip = makeClip({ sourceStartSec: 0, sourceEndSec: 5 });+ const transcript = makeTranscript([+ { id: "w1", segmentId: "s1", startSec: 0, endSec: 1, text: "hi" },+ { id: "w2", segmentId: "s1", startSec: 1, endSec: 2, text: "uh" },+ { id: "w3", segmentId: "s1", startSec: 2, endSec: 3, text: "long" },+ { id: "w4", segmentId: "s1", startSec: 3, endSec: 4, text: "pause" },+ { id: "w5", segmentId: "s1", startSec: 4, endSec: 5, text: "bye" },+ ]);+ const skip = makeSkip({ id: "skip_a", startSec: 1, endSec: 4 });++ const section = buildClipSection(clip, transcript, makeAsset(), [skip]);+ expect(section.words.map((cw) => cw.kept)).toEqual([true, false, false, false, true]);+ expect(section.words.map((cw) => cw.skipId)).toEqual([+ null,+ "skip_a",+ "skip_a",+ "skip_a",+ null,+ ]);+ expect(section.skipRuns).toHaveLength(1);+ expect(section.skipRuns[0]).toMatchObject({+ skipId: "skip_a",+ startWordIndex: 1,+ endWordIndex: 3,+ durationSec: 3,+ });+ });++ it("splits separated skip ranges into multiple SkipRuns", () => {+ const clip = makeClip({ sourceStartSec: 0, sourceEndSec: 6 });+ const transcript = makeTranscript([+ { id: "w1", segmentId: "s1", startSec: 0, endSec: 1, text: "a" },+ { id: "w2", segmentId: "s1", startSec: 1, endSec: 2, text: "b" },+ { id: "w3", segmentId: "s1", startSec: 2, endSec: 3, text: "c" },+ { id: "w4", segmentId: "s1", startSec: 3, endSec: 4, text: "d" },+ { id: "w5", segmentId: "s1", startSec: 4, endSec: 5, text: "e" },+ { id: "w6", segmentId: "s1", startSec: 5, endSec: 6, text: "f" },+ ]);+ const skips = [+ makeSkip({ id: "skip_a", startSec: 1, endSec: 2 }),+ makeSkip({ id: "skip_b", startSec: 3, endSec: 4 }),+ ];++ const section = buildClipSection(clip, transcript, makeAsset(), skips);+ expect(section.skipRuns).toHaveLength(2);+ expect(section.skipRuns[0]).toMatchObject({+ skipId: "skip_a",+ startWordIndex: 1,+ endWordIndex: 1,+ });+ expect(section.skipRuns[1]).toMatchObject({+ skipId: "skip_b",+ startWordIndex: 3,+ endWordIndex: 3,+ });+ });++ it("does NOT apply skips from a different asset", () => {+ const clip = makeClip({ sourceStartSec: 0, sourceEndSec: 3 });+ const transcript = makeTranscript([+ { id: "w1", segmentId: "s1", startSec: 0, endSec: 1, text: "hi" },+ { id: "w2", segmentId: "s1", startSec: 1, endSec: 2, text: "there" },+ ]);+ const skip = makeSkip({ id: "skip_x", assetId: "asset_2", startSec: 0.5, endSec: 2.5 });++ const section = buildClipSection(clip, transcript, makeAsset(), [skip]);+ expect(section.words.map((cw) => cw.kept)).toEqual([true, true]);+ });++ it("treats every word the same (no filler concept)", () => {+ const clip = makeClip({ sourceStartSec: 0, sourceEndSec: 3 });+ const transcript = makeTranscript([+ { id: "w1", segmentId: "s1", startSec: 0, endSec: 1, text: "okay" },+ { id: "w2", segmentId: "s1", startSec: 1, endSec: 2, text: "real" },+ { id: "w3", segmentId: "s1", startSec: 2, endSec: 3, text: "Um," },+ ]);++ const section = buildClipSection(clip, transcript, makeAsset(), []);+ // ponytail: the LLM (not the renderer) decides what is a filler. Every+ // word renders as plain text in the right pane.+ expect(section.words.map((cw) => cw.kept)).toEqual([true, true, true]);+ expect(section.words.map((cw) => cw.skipId)).toEqual([null, null, null]);+ });++ it("returns an empty words list when the clip has no matching transcript", () => {+ const clip = makeClip({ sourceStartSec: 0, sourceEndSec: 5 });+ const section = buildClipSection(clip, null, makeAsset(), []);++ expect(section.words).toEqual([]);+ expect(section.skipRuns).toEqual([]);+ expect(section.transcript).toBeNull();+ });++ it("ignores transcript words outside the clip's source range", () => {+ const clip = makeClip({ sourceStartSec: 2, sourceEndSec: 4 });+ const transcript = makeTranscript([+ { id: "w_before", segmentId: "s1", startSec: 0, endSec: 1, text: "skip" },+ { id: "w_mid", segmentId: "s1", startSec: 2.5, endSec: 3.5, text: "in" },+ { id: "w_after", segmentId: "s1", startSec: 5, endSec: 6, text: "skip" },+ ]);++ const section = buildClipSection(clip, transcript, makeAsset(), []);+ expect(section.words.map((cw) => cw.word.id)).toEqual(["w_mid"]);+ });+});++describe("buildAggregatedSections", () => {+ it("joins per-clip sections across two assets in timeline order", () => {+ const clips = [+ makeClip({ id: "c1", assetId: "asset_1", sourceStartSec: 0, sourceEndSec: 2 }),+ makeClip({+ id: "c2",+ assetId: "asset_2",+ sourceStartSec: 0,+ sourceEndSec: 2,+ timelineStartSec: 2,+ timelineEndSec: 4,+ }),+ ];+ const transcripts = [+ makeTranscript([+ { id: "w1", segmentId: "s1", startSec: 0, endSec: 1, text: "hi" },+ { id: "w2", segmentId: "s1", startSec: 1, endSec: 2, text: "there" },+ ]),+ {+ assetId: "asset_2",+ language: "en",+ segments: [],+ words: [+ { id: "w3", segmentId: "s1", startSec: 0, endSec: 1, text: "bye" },+ { id: "w4", segmentId: "s1", startSec: 1, endSec: 2, text: "now" },+ ],+ },+ ];+ const assets = [+ makeAsset({ id: "asset_1", label: "first.mp4" }),+ makeAsset({ id: "asset_2", label: "second.mp4" }),+ ];++ const sections = buildAggregatedSections(clips, transcripts, assets, []);+ expect(sections).toHaveLength(2);+ expect(sections[0]?.clip.id).toBe("c1");+ expect(sections[1]?.clip.id).toBe("c2");+ expect(sections[0]?.asset?.label).toBe("first.mp4");+ expect(sections[1]?.asset?.label).toBe("second.mp4");+ });++ it("still renders a section when a clip's asset has no transcript", () => {+ const clips = [makeClip({ id: "c1" }), makeClip({ id: "c2", assetId: "asset_2" })];+ const transcripts = [makeTranscript([])];+ const assets = [makeAsset(), makeAsset({ id: "asset_2" })];++ const sections = buildAggregatedSections(clips, transcripts, assets, []);+ expect(sections).toHaveLength(2);+ expect(sections[0]?.transcript).toBeTruthy();+ expect(sections[1]?.transcript).toBeNull();+ expect(sections[1]?.words).toEqual([]);+ });+});++describe("findCueWordId", () => {+ function makeSection(+ clipId: string,+ assetId: string,+ wordTimes: Array<[string, number, number]>,+ ) {+ return {+ clip: makeClip({ id: clipId, assetId, sourceStartSec: 0, sourceEndSec: 100 }),+ asset: makeAsset({ id: assetId }),+ transcript: null,+ words: wordTimes.map(([id, start, end]) => ({+ word: { id, segmentId: "s1", startSec: start, endSec: end, text: id },+ kept: true,+ skipId: null,+ })),+ skipRuns: [],+ };+ }++ it("returns null when cue is null", () => {+ const section = makeSection("c1", "asset_1", [["w1", 0, 1]]);+ expect(findCueWordId([section], null)).toBeNull();+ });++ it("returns null when no section matches the cue asset", () => {+ const section = makeSection("c1", "asset_1", [["w1", 0, 1]]);+ const cue = { assetId: "asset_2", sourceTimeSec: 0.5 };+ expect(findCueWordId([section], cue)).toBeNull();+ });++ it("returns the word containing the cue time", () => {+ const section = makeSection("c1", "asset_1", [+ ["w1", 0, 1],+ ["w2", 1, 2],+ ["w3", 2, 3],+ ]);+ expect(findCueWordId([section], { assetId: "asset_1", sourceTimeSec: 1.5 })).toBe("w2");+ });++ it("returns the previous word when the cue is between two words", () => {+ const section = makeSection("c1", "asset_1", [+ ["w1", 0, 1],+ ["w2", 2, 3],+ ]);+ expect(findCueWordId([section], { assetId: "asset_1", sourceTimeSec: 1.5 })).toBe("w1");+ });++ it("returns the previous word when the cue is before the first word", () => {+ const section = makeSection("c1", "asset_1", [+ ["w1", 5, 6],+ ["w2", 7, 8],+ ]);+ expect(findCueWordId([section], { assetId: "asset_1", sourceTimeSec: 0.5 })).toBeNull();+ });++ it("returns the last word when the cue is after the last word", () => {+ const section = makeSection("c1", "asset_1", [+ ["w1", 0, 1],+ ["w2", 1, 2],+ ]);+ expect(findCueWordId([section], { assetId: "asset_1", sourceTimeSec: 99 })).toBe("w2");+ });+});diff --git a/src/lib/ai-edition/timeline/aggregated-transcript.ts b/src/lib/ai-edition/timeline/aggregated-transcript.tsnew file mode 100644index 000000000..d47e9d600--- /dev/null+++ b/src/lib/ai-edition/timeline/aggregated-transcript.ts@@ -0,0 +1,202 @@+// Aggregated transcript view for the right pane — joins the per-asset+// transcripts into a single flowing read of every clip on the timeline.+//+// ponytail: pure functions, no React. Mirrors axcut's+// apps/web/src/components/CurrentTranscriptView.tsx#buildClipTranscriptProjections+// + buildTranscriptRuns. Word kept/removed is decided by whether the word+// falls inside one of the document's `timeline.skipRanges` for the same+// asset — not by `clip.wordRefs` (which is now only used by the timeline+// retime math, not by the right pane).+//+// ponytail: no "filler" concept here. axcut does not classify words as+// filler in the right-pane renderer — the LLM (via the deep-agent's+// fillerLexicon + fillerOrHesitation reason) is the only place that+// names a word a filler. The transcript view shows plain text for every+// kept word; the user or the LLM decides what to mark as skipped.++import type { AxcutAsset, AxcutClip, AxcutSkipRange, AxcutTranscript, AxcutWord } from "../schema";++/** A contiguous run of removed words inside one clip's source range. */+export interface SkipRun {+ /** Id of the skip range this run came from (used by the bin-icon restore). */+ skipId: string;+ /** Index of the first removed word in `words`. */+ startWordIndex: number;+ /** Inclusive index of the last removed word in `words`. */+ endWordIndex: number;+ /** Asset id the skip belongs to. */+ assetId: string;+ /** Wall-clock seconds from the first removed word's start to the last removed word's end. */+ durationSec: number;+}++/** One word in the clip's source range, tagged kept / removed. */+export interface ClipWord {+ word: AxcutWord;+ /** Whether the word is inside a skipRange for this clip's asset. */+ kept: boolean;+ /** Id of the skip range that removed this word, if any. */+ skipId: string | null;+}++/** One clip's contribution to the aggregated flow. */+export interface ClipSection {+ clip: AxcutClip;+ asset: AxcutAsset | null;+ transcript: AxcutTranscript | null;+ words: ClipWord[];+ skipRuns: SkipRun[];+}++function wordsInRange(transcript: AxcutTranscript, startSec: number, endSec: number): AxcutWord[] {+ return transcript.words.filter((w) => w.endSec > startSec && w.startSec < endSec);+}++/** Find the skip range covering this word's center (returns the deepest match). */+function findCoveringSkip(word: AxcutWord, skipRanges: AxcutSkipRange[]): AxcutSkipRange | null {+ const center = (word.startSec + word.endSec) / 2;+ for (const skip of skipRanges) {+ if (center >= skip.startSec && center <= skip.endSec) return skip;+ }+ return null;+}++/**+ * Build one clip section. Words inside the clip's source range that fall+ * inside any skip range for the same asset are marked removed; the rest+ * are kept. Contiguous removed words from the same skip range group into+ * one `SkipRun` (for the trim-duration pill + bin-icon restore).+ */+export function buildClipSection(+ clip: AxcutClip,+ transcript: AxcutTranscript | null,+ asset: AxcutAsset | null,+ skipRanges: AxcutSkipRange[],+): ClipSection {+ const clipSkips = skipRanges.filter(+ (skip) =>+ skip.assetId === clip.assetId &&+ skip.endSec > clip.sourceStartSec &&+ skip.startSec < (clip.sourceEndSec ?? Infinity),+ );++ const words = transcript+ ? wordsInRange(transcript, clip.sourceStartSec, clip.sourceEndSec ?? Infinity)+ : [];+ const tagged: ClipWord[] = words.map((word) => {+ const covering = findCoveringSkip(word, clipSkips);+ return {+ word,+ kept: covering === null,+ skipId: covering?.id ?? null,+ };+ });++ const skipRuns: SkipRun[] = [];+ let runStart = -1;+ let runEnd = -1;+ let runSkipId = "";+ let runMinStart = 0;+ let runMaxEnd = 0;+ const flush = () => {+ if (runStart >= 0) {+ skipRuns.push({+ skipId: runSkipId,+ assetId: clip.assetId,+ startWordIndex: runStart,+ endWordIndex: runEnd,+ durationSec: Math.max(0, runMaxEnd - runMinStart),+ });+ }+ runStart = -1;+ runEnd = -1;+ runSkipId = "";+ runMinStart = 0;+ runMaxEnd = 0;+ };+ tagged.forEach((cw, i) => {+ if (cw.kept) {+ flush();+ return;+ }+ // Split the run if the skip range id changes (overlapping skips).+ if (runStart >= 0 && cw.skipId !== runSkipId) {+ flush();+ }+ if (runStart < 0) {+ runStart = i;+ runMinStart = cw.word.startSec;+ runSkipId = cw.skipId ?? "";+ }+ runEnd = i;+ runMaxEnd = Math.max(runMaxEnd, cw.word.endSec);+ });+ flush();++ return { clip, asset, transcript, words: tagged, skipRuns };+}++/**+ * Build every clip section in timeline order. Clips without a matching+ * transcript still render (asset label + an empty flow) so the user sees+ * the clip exists but no transcript is available for it yet.+ */+export function buildAggregatedSections(+ clips: AxcutClip[],+ transcripts: AxcutTranscript[],+ assets: AxcutAsset[],+ skipRanges: AxcutSkipRange[],+): ClipSection[] {+ const transcriptById = new Map(transcripts.map((t) => [t.assetId, t]));+ const assetById = new Map(assets.map((a) => [a.id, a]));+ return clips.map((clip) =>+ buildClipSection(+ clip,+ transcriptById.get(clip.assetId) ?? null,+ assetById.get(clip.assetId) ?? null,+ skipRanges,+ ),+ );+}++/** Where the playback head currently is, in source time. */+export interface CuePosition {+ assetId: string;+ /** Optional clip id filter (lets the caller restrict to a single clip). */+ clipId?: string;+ sourceTimeSec: number;+}++/**+ * Find the word in `sections` that the playback head is currently inside.+ * Used to highlight the active word and auto-scroll the transcript. Mirrors+ * axcut's `findCueWordId` in CurrentTranscriptView.+ *+ * - If the head is before the first word → null.+ * - If the head is between two words → the previous word (so the+ * highlight "sticks" until the next word starts).+ * - Silence tokens (id starts with `silence_`) are skipped over so a+ * long pause doesn't surface a fake cue word.+ */+export function findCueWordId(sections: ClipSection[], cue: CuePosition | null): string | null {+ if (!cue) return null;+ const assetMatch = sections+ .filter((s) => s.words.length > 0)+ .find((s) => s.clip.assetId === cue.assetId);+ if (!assetMatch) return null;+ // ponytail: clipId is part of the cue position for future use, but the+ // word-id projection already encodes clipId in the prefix; the+ // current iteration just walks every word in the asset. If we need+ // clip-scoped lookup later, store the clip id on each ClipWord.+ const pool = assetMatch.words;++ const t = cue.sourceTimeSec;+ let previous: string | null = null;+ for (const cw of pool) {+ if (cw.word.id.startsWith("silence_")) continue;+ if (t < cw.word.startSec) return previous;+ if (t >= cw.word.startSec && t <= cw.word.endSec) return cw.word.id;+ previous = cw.word.id;+ }+ return previous;+}