--- name: agent-video-pipeline description: Orchestrate a configurable, debuggable local pipeline from approved narration packages to timed audio, captions, visual assets, semantic motion, rendered video, optional avatar compositing, publishing assets, and QC. Use for building, batch-producing, resuming, rerendering, or debugging explainer-video projects. Keep author identity, voice assets, CTA, illustration provider, canvas, avatar layout, brand, platform copy, delivery paths, and machine runtime in external profiles; use the separate adapt-longform-for-speech and compose-avatar-video Skills for those independent capabilities. --- # 通用 Agent 视频流水线 编排可复现、可调试、可增量重建的本地讲解视频。Skill 只保存通用流程、契约、Schema、provider adapter 和 QC;任何个人风格或本机路径必须通过外部配置注入。 ## 强制统一外部配置根目录 流水线没有合法的集中式 `.agent-video/` 时禁止运行。配置根目录必须位于项目目录的某一级祖先,或通过 `--config-root` / `AGENT_VIDEO_CONFIG_ROOT` 显式指定,并且必须完整包含: ```text .agent-video/ ├── profiles/workspace.yaml ├── runtime.local.yaml ├── projects/ ├── assets/ └── resolved/ ``` 外部工作区 Profile 只能来自 `profiles/`,项目覆盖只能来自 `projects/`,本机 runtime 只能使用根目录下唯一的 `runtime.local.yaml`。需要时,声音、人像、人物 IP、Logo、音乐等复用资产统一放进 `assets/`;项目目录不得再维护工作区配置副本。初始化生成的模板必须保持中性,不得预填作者姓名、人物 IP、CTA、品牌或其他个人信息。 Skill 内只保存可公开发布的脱敏模板: ```text references/templates/ ├── workspace.example.yaml └── runtime.local.example.yaml ``` 初始化脚本必须从这两份模板生成外部实例,不能在代码里另存一套字段。Skill 内模板只含中性默认值和占位符;真实解释器、模型、凭据引用、品牌与授权资产只能写入工作区的 `.agent-video/`。 第一次使用时,必须先运行纯 Python、跨平台的初始化脚本。它只创建缺失内容,重复执行不会覆盖已有 Profile 或 runtime: ```bash # macOS / Linux python scripts/init_config_root.py \ --workspace ``` ```powershell # Windows PowerShell python scripts\init_config_root.py ` --workspace ``` 默认生成 `profiles/workspace.yaml`,其中 `profile_id` 为 `workspace`。只有用户明确需要多个外部 Profile 时才传 `--profile-id `。需要指定独立的声音环境时增加 `--tts-python `,本地模型增加 `--model-path `;脚本默认把当前执行它的 Python 写入 `pipeline_runtime.python`。初始化后先审核中性工作区 Profile、runtime 和授权资产,再冻结项目配置。 Codex 接到运行请求时必须先检查 `.agent-video/`。如果不存在或不完整:停止生产,说明将生成的位置,使用 `init_config_root.py` 初始化,并引导用户只补充无法安全自动检测的选项;不得把真实配置写回 Skill。初始化完成后必须再由 `resolve_profile.py` 验证并冻结,验证失败时不得进入 TTS、插图、渲染或数字人阶段。 ## 先冻结配置 每个项目在高成本操作前必须生成唯一的 resolved profile: ```bash "" scripts/resolve_profile.py \ --config-root /.agent-video \ --profile-id workspace \ --project-config /.agent-video/projects/.yaml \ --project ``` 首次运行从统一根目录的 `runtime.local.yaml` 读取 `pipeline_runtime.python`;缺少集中配置根目录、外部工作区 Profile、runtime 或规定目录时立即失败,不能回退到散落在项目里的配置或只用 Skill 默认值。后续所有通用 Python 控制脚本都使用 resolved profile 中的该解释器。下游脚本优先读取 `/.pipeline/resolved-profile.json`,并校验其中的配置契约版本、配置根目录、来源角色与 SHA;旧式 resolved profile 必须重新生成。配置规则见 [references/profile-contract.md](references/profile-contract.md)。 ## 不可变质量规则 - 上游产物缺失、未批准、QC 失败或 SHA 过期时停止下游。 - 音频改变后重新强制对齐字幕和语义 cue。 - 数字人使用同一份获批母带,不重新朗读。 - 已有本地资产默认复用,除非用户明确要求替换。 - 最终交付必须包含视频、封面、描述、发布文案、manifest、阶段 QC 与耗时记录。 - Profile 可以改变风格与规格,不能关闭哈希新鲜度、音画同步、边界安全和交付完整性检查。 - `.agent-video` 集中配置契约无效时停止所有真实流水线阶段。 ## 阶段 ### 1. 内容包 长文改写调用独立的 `adapt-longform-for-speech` Skill。已批准稿件可直接标准化。流水线 adapter 再把通用 `spoken-script.json` 转换为项目的 `series.json` 与 `scenes.json`。 ```bash "" scripts/import_spoken_script.py \ --script \ --script-qc \ --profile \ --series-output \ --projects-root ``` ```bash "" scripts/validate_episode_independence.py \ --series \ --profile ``` ### 2. Prosody、声音与字幕 先生成并批准 `audio/prosody.json`,再调用 Profile 选择的声音 provider。随包的 VoxCPM2 脚本是可选 adapter,不是个人默认值;模型、对齐环境、声音原件和 prompt 由 resolved profile 或 CLI 提供。 本地声音 provider 必须使用 resolved profile 的 `tts_runtime.generator_python` 启动,不能沿用环境中的裸 `python3`。随包 adapter 的调用方式如下;解释器、模型与对齐器路径都来自同一份 frozen profile: ```bash "" scripts/analyze_prosody.py \ --scenes --profile \ --output