Sync latest TrueGrowth updates
Some checks failed
CI / main (push) Has been cancelled
CI / release-e2e (push) Has been cancelled

This commit is contained in:
jiam
2026-07-08 02:03:18 +08:00
parent 52636c91ae
commit 5119ac0ef8
102 changed files with 20985 additions and 1760 deletions

View File

@@ -0,0 +1,40 @@
## Context
VideoAgent is a broad Python agent framework for video understanding, editing, audio processing, and creative remaking. It is not a stable desktop SDK, so TrueGrowth must wrap it behind a local JSON task adapter and keep heavy dependencies isolated from Electron and the web renderer.
## Goals / Non-Goals
- Goals: make VideoAgent the clip workbench primary runtime, provide a customer-facing intent-first editing flow, and write structured deliverables back to tasks/assets.
- Goals: support a useful MVP even when the full VideoAgent model stack is not installed.
- Non-Goals: bundle full Python, CUDA, PyTorch, ONNX, or model packages into the default desktop/web process.
- Non-Goals: expose VideoAgent, FunClip, CUDA, model paths, or command-line details in customer-facing UI.
## Decisions
- Decision: run VideoAgent as an independent `videoagent-local` sidecar managed by the existing local API process.
- Decision: use a stable TrueGrowth JSON task shape instead of directly driving VideoAgent's interactive CLI.
- Decision: treat capability groups as installable/readiness-gated packages: basic clipping, video understanding, creative remaking, and voice/audio processing.
- Decision: the first implementation must provide a deterministic MVP plan/result fallback so the clip center can complete a real task loop before the full third-party runtime is installed.
- Decision: source inputs are workflow-aware. Understanding, transcription, text editing, and most long-to-short jobs use one primary video/audio source; B-roll, platform packaging, and remaking jobs use a primary source plus references; montage, batch processing, and script-to-video jobs may use multiple videos, images, and audio assets.
- Decision: structured plans, transcripts, SRT, timeline, titles, cover prompts, and publish copy are task deliverables first. They are written to task metadata and only become asset-center media records when a real playable media file or publishable image exists.
- Decision: first-screen quick scenarios show only workflows that can close with the current adapter and model-center capabilities: transcription/subtitles, long-to-short planning, transcript editing, video summary/Q&A, course/interview/ecommerce/podcast planning, B-roll planning, multi-source montage planning, and script-to-video planning.
- Decision: VideoAgent demo features that require heavy optional stacks, such as ImageBind semantic retrieval, Seed-VC voice conversion, DiffSinger singing/music-video, or specialized voice-remake models, remain hidden from first-screen quick scenarios until the model center reports the required pack as initialized.
- Decision: model requirements are mapped to TrueGrowth capability packs instead of raw third-party names. Whisper/FunASR map to `字幕转写`, CosyVoice/FishSpeech/IndexTTS-style models map to `配音音色`, LatentSync/MuseTalk/Wav2Lip-style models map to `数字人口播`, ImageBind maps to `素材语义检索`, Seed-VC maps to `声音重制`, and DiffSinger maps to `音乐视频`.
- Decision: customer first use bundles only the lightweight adapter, media handling, and checks that are safe for the desktop package. Larger Mac/Windows model packs are initialized through the existing model center so storage, platform, license, and GPU constraints can be shown in one place.
## API Contract
- `GET /local-api/videoagent` returns readiness, visible capability groups, service status, and setup progress.
- `POST /local-api/runtime/videoagent/start` starts or prepares the sidecar and returns an async startup state.
- `POST /local-api/runtime/videoagent/stop` stops the sidecar if it is running.
- `POST /local-api/videoagent/tasks` accepts source, goal, scene, platform, output options, model routing, and package flags.
- `POST /local-api/videoagent/tasks` also accepts `sources`, `primarySourceId`, `sourceMode`, `acceptedSourceTypes`, and `supportingSourceIds` for workflows that need multiple materials.
- `GET /local-api/videoagent/tasks/:id` returns task status, progress, generated plan, transcript, segments, deliverables, and asset ids.
## Risks / Trade-offs
- VideoAgent dependencies are heavy and platform-sensitive. Mitigation: isolate runtime, detect capability groups independently, and keep a deterministic MVP fallback.
- VideoAgent is research-oriented. Mitigation: wrap it behind TrueGrowth task adapters and avoid exposing internal graph prompts or CLI details.
- Existing FunClip tasks may exist in history. Mitigation: keep history display able to read legacy `funclip-local` records while new submissions use `videoagent-local`.
## Migration Plan
1. Add VideoAgent local runtime status and task endpoints.
2. Switch the clip workbench submission path to `videoagent-local`.
3. Replace capability-card-first UI with source/goal/plan/result workflow.
4. Preserve existing assets, task history, and publish handoff behavior.
5. Remove visible FunClip copy and provider jargon from the page.

View File

@@ -0,0 +1,16 @@
# Change: Replace FunClip clip center with VideoAgent workbench
## Why
The current FunClip-based clip center has not completed a reliable editing loop, and its clipping model is too narrow for a commercial AI video production workflow. TrueGrowth needs the clip center to start from user intent and source media, then produce plans, transcripts, segments, packaged outputs, and publishing assets through a broader VideoAgent-style runtime.
## What Changes
- **BREAKING**: Move the customer-facing AI clip workbench primary provider from `funclip-local` to `videoagent-local`.
- Add a local VideoAgent sidecar contract with readiness, start/stop, task submission, polling, and asset-writing endpoints.
- Replace the fixed capability-card-first flow with an intent-first workflow: source media, natural-language goal, business scene, output package, generated plan, execution, and deliverables.
- Expose customer-facing capability groups for basic clipping, video understanding, creative remaking, and voice/audio processing without showing third-party runtime names.
- Keep FunClip only as a hidden migration fallback where needed; it must not define visible product capability or user copy.
## Impact
- Affected specs: `ai-clip-workbench`
- Affected code: `scripts/truegrowth-local-api.mjs`, `apps/web/src/workbench/WorkbenchShell.tsx`, `apps/web/src/workbench/workbench.scss`
- Runtime integration: new `/local-api/videoagent*` local API family, replacing visible `/local-api/funclip/tasks` usage in the clip workbench

View File

@@ -0,0 +1,101 @@
## ADDED Requirements
### Requirement: VideoAgent Primary Runtime
The AI clip workbench SHALL submit new customer-facing clip tasks to `videoagent-local` instead of `funclip-local`.
#### Scenario: User submits a new clip job
- **WHEN** the user submits a configured AI clip job
- **THEN** the created task uses provider id `videoagent-local`
- **AND** customer-facing UI does not mention FunClip, VideoAgent, CUDA, model paths, or command-line details
### Requirement: Intent-First Clip Workflow
The AI clip workbench SHALL begin with source media and a natural-language production goal rather than a fixed list of clip presets.
#### Scenario: User defines the desired output
- **WHEN** the user selects source media and enters a goal such as turning a long course into short clips
- **THEN** the page captures the source, goal, business scene, platform format, and desired output package before task submission
### Requirement: Simplified First-Screen Monitor
The AI clip workbench SHALL present the first screen as a prompt-led work area with a single video monitor on the right.
#### Scenario: User has not selected media
- **WHEN** the user opens the first screen without selected media
- **THEN** the right-side monitor shows only two primary source actions: choose from the asset center or upload a local file
- **AND** the visible flow does not show the legacy capability-template wall
#### Scenario: User selects media
- **WHEN** the user chooses a video source
- **THEN** the right-side monitor previews the selected video and keeps source replacement inside the monitor controls
### Requirement: Workflow-Aware Multi-Source Inputs
The AI clip workbench SHALL choose the source input model from the selected workflow rather than assuming every job is a single-video trim.
#### Scenario: User chooses a single-primary workflow
- **WHEN** the user selects workflows such as transcript editing, auto captions, summary Q&A, course chapters, interview Q&A, or talking-head cleanup
- **THEN** the page requires one primary video or audio source
- **AND** optional reference media stays secondary and does not replace the primary monitor preview
#### Scenario: User chooses a multi-source workflow
- **WHEN** the user selects workflows such as multi-source montage, script-to-video, B-roll planning, platform packaging, or batch processing
- **THEN** the page allows multiple image, video, and audio assets from the asset center or local upload according to that workflow
- **AND** the submitted payload identifies primary source, supporting sources, source mode, accepted media types, and cardinality
### Requirement: Shared Asset Center Picker
The AI clip workbench SHALL reuse the shared asset center picker for source selection.
#### Scenario: User chooses from asset center
- **WHEN** the user clicks the source monitor asset-center action
- **THEN** the shared asset center modal opens with existing media browsing, preview, upload, delete, and multi-select behavior
- **AND** generated works from other TrueGrowth modules are available as selectable assets when they have a valid media URL
### Requirement: Quick Scenarios Configure The Job
The AI clip workbench SHALL expose practical quick scenarios based on supported clip-workbench abilities and mainstream AI editing workflows.
#### Scenario: User clicks a quick scenario
- **WHEN** the user selects a quick scenario such as long-video highlights, transcript editing, course chapters, interview Q&A, ecommerce live clips, auto captions, publish packaging, source montage, or script-to-video planning
- **THEN** the page fills the production goal and updates clip count, duration, platform, subtitle, speaker, context, title, publishing, batch, and regrouping options where applicable
#### Scenario: Capability is not first-version ready
- **WHEN** a VideoAgent demo ability depends on advanced voice conversion, singing, music-video generation, or semantic retrieval models that are not connected through the current TrueGrowth model center
- **THEN** the ability is not shown as a first-screen quick scenario
- **AND** the service check or model center may show it as an optional future capability without blocking the basic clip workflow
### Requirement: Structured Clip Plan And Deliverables
The AI clip workbench SHALL display a structured AI plan and generated deliverables for each submitted task.
#### Scenario: Task returns a plan
- **WHEN** a clip task is running or complete
- **THEN** the page shows the planned steps, transcript or draft transcript, candidate segments with reasons, timeline items, and deliverables such as SRT, title, cover prompt, publish copy, and video assets when available
#### Scenario: Adapter returns only structured deliverables
- **WHEN** the local adapter can generate a plan, transcript, segments, timeline, and publishing deliverables but has not rendered a playable video file
- **THEN** the task completes with structured result metadata and no generated video asset id
- **AND** the asset center does not receive an unplayable placeholder video or JSON plan asset
- **AND** the UI offers result editing from the structured task result without implying a playable video exists
### Requirement: Capability Package Readiness
The local runtime SHALL report customer-facing readiness for basic clipping, video understanding, creative remaking, and voice/audio processing packages.
#### Scenario: User opens service check
- **WHEN** the user opens the clip workbench service check dialog
- **THEN** the page shows package readiness as available, preparing, or needs initialization without exposing third-party technical names
### Requirement: Model Center Reuse
The AI clip runtime SHALL reuse existing TrueGrowth model-center and digital-human capabilities before requesting VideoAgent-specific model downloads.
#### Scenario: Existing local models can satisfy a clip capability
- **WHEN** the model center already has usable ASR, voice, image/video, or digital-human models
- **THEN** clip readiness counts those models as reusable for transcription, voice, B-roll planning, or digital-human handoff
- **AND** the customer does not need to download duplicate Whisper, CosyVoice, fish-speech, or digital-human model packages for the same first-version function
#### Scenario: Optional advanced model is missing
- **WHEN** ImageBind, Seed-VC, DiffSinger, or similar advanced packages are not present
- **THEN** first-version quick scenarios remain available for plan, transcript, segment, montage, and publish deliverables
- **AND** advanced semantic search, voice conversion, or music-video workflows are presented only as optional initialization from the model center
### Requirement: Legacy FunClip Migration Fallback
The system SHALL preserve existing FunClip task history while preventing FunClip from defining the new customer-facing clip workflow.
#### Scenario: User has older clip tasks
- **WHEN** the task history contains older `funclip-local` records
- **THEN** the history can still display them as clip workbench tasks
- **AND** new submissions use `videoagent-local`

View File

@@ -0,0 +1,31 @@
## 1. Specification
- [x] 1.1 Add proposal, design notes, and spec deltas for the VideoAgent clip workbench migration.
## 2. Local Runtime
- [x] 2.1 Add `videoagent-local` readiness, package status, and start/stop runtime management to the local API.
- [x] 2.2 Add `/local-api/videoagent/tasks` task creation, polling, and structured result payloads.
- [x] 2.3 Write VideoAgent task deliverables back to the unified task stream and generated asset list.
## 3. Workbench UI
- [x] 3.1 Refactor the clip page from FunClip-first naming/copy to AI clip workbench / VideoAgent-backed behavior.
- [x] 3.2 Replace the fixed 12-card first step with source + natural-language goal + scene/output package configuration.
- [x] 3.3 Add generated plan, transcript, candidate segments, deliverables, and result preview surfaces.
- [x] 3.4 Keep service status and task history in dialogs with customer-facing copy only.
- [x] 3.5 Simplify the first screen into a prompt-led left panel and a right-side video monitor with only asset-center and local-upload entry points before media is selected.
- [x] 3.6 Replace visible legacy template selection with quick scenarios that fill the prompt and configure output options.
- [x] 3.7 Reuse the shared asset center modal for clip source selection, including multi-select where the workflow supports it.
- [x] 3.8 Add workflow-aware source modes for single primary video/audio, primary plus reference media, multi-source montage, script-to-video, and batch processing.
- [x] 3.9 Align first-screen form controls and source tray with the `/image` golden page form standard.
- [x] 3.10 Hide unsupported advanced demo abilities from the first-screen quick scenarios and show only current MVP workflows.
- [x] 3.11 Replace broad legacy output toggles with scenario-specific output options.
## 4. Runtime And Assets
- [x] 4.1 Stop creating asset-center output assets when the adapter only returns structured plans or JSON files.
- [x] 4.2 Allow runtime-generated assets to be deleted from the local API and asset center.
- [x] 4.3 Map VideoAgent model needs to reusable TrueGrowth model-center capability packs and optional advanced packs.
## 5. Verification
- [ ] 5.1 Validate the OpenSpec change. (`openspec` / `pnpm exec openspec` not available in this environment.)
- [x] 5.2 Run focused TypeScript or app checks.
- [x] 5.3 Run a local API smoke check for status and task creation.
- [x] 5.4 Browser-check the simplified `/timeline` first screen, source picker, upload affordance, quick scenario behavior, and dark/light styling.