Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Build a portable, versioned declarative video composition protocol and a lightwe
- Protocol and domain semantics are the source of truth; UI and MCP are adapters.
- No image/video generation runtime, no ComfyUI-like execution graph, no built-in media rendering, no publishing integrations.
- Deployment MUST target Cloudflare Workers; do not introduce PM2/systemd/VPS runtime, fabricated hostnames, example.com domains or hardcoded ports as deployed facts.
- Production hostname MUST be a `talkincode.net` subdomain managed by Cloudflare; planned default `video-compose.talkincode.net` until actual DNS/Worker routing is verified.
- Production hostname MUST be a `talkincode.net` subdomain managed by Cloudflare; canonical target `vflow.talkincode.net`; retain `video-compose.talkincode.net` as a compatibility alias. Verify actual DNS/Worker routing before claiming it is live.
- Browser UI, REST API and MCP MUST be protected with Cloudflare Access (Zero Trust SSO / service authentication as appropriate); Worker MUST still enforce per-project authorization.
- GitHub-to-Workers deployment MUST be supported, preferring native Workers Builds GitHub integration; GitHub Actions + Wrangler is an alternative, never a simultaneous competing production deployer.
- Distinguish design decisions from verified live infrastructure. Do not report CI, DNS, Access, R2 or D1 as configured without inspecting actual resources.
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ Video Compose 面向人与多个 Agent 共创视频作品。项目记录可移
- Project 下多个 Composition,共享可检索的 Asset,并采用简洁的项目级 `reader` / `writer` 读写权限隔离。
- 首页提供项目列表、搜索与新建;项目页显示编排及共享资源概览,可创建编排并选择画面规格/帧率。工作台支持返回项目、切换编排和独立直达地址。
- **角色/道具设定库**:项目级主体(Subject)有独立定义、稳定 ID、带状态(`status: candidate | approved`)的修订版本、外观/状态变体(含 `defaultVariant`)和多视角参考图集;`candidate` 状态便于修改迭代,批准为 `approved` 后冻结;分镜绑定确定版本,禁止参考设定悄然漂移。详见 [主体与参考图规范草案](docs/subjects.md)。
- v1 JSON/YAML 声明式编排协议和可机读 Schema。
- v1/v2 JSON/YAML 声明式编排协议和独立可机读 Schema;v2 固定参考资料来源并拒绝有损 v1 导出。
- **参考制作工作流**:单角色面部/身体分包、道具逐格归属、独立场景与环境变体、无字序列、逐图审阅、准确的生成输入包和外部实际输入证据。MCP 提供 instructions、prompts、resources 与纯工具兜底,领域层防止旧写入口绕过。[制作规范与迁移指南](docs/reference-authoring.md)。
- 稳定 Shot ID、播放序列与分镜依赖拓扑(`dependsOn` DAG)、全局音轨(`audioTracks` 如全局 BGM/旁白)、分镜多参考图、可选参考视频、Prompt、音视频候选集(`candidates`)与选定输出(`selected`)、整数帧时长与扩展元数据。
- 不可变 R2 媒体(两阶段上传与 SHA-256 校验)与 D1 资产索引、修订历史、基于稳定 ID 的结构化 Patch、冲突检测和审阅提案(Proposal)。
- 统一 REST/MCP 接口;React 工作台提供分镜、素材、角色与道具、协作与历史、协议标签页,保留网格、清单和依赖视图。
- 统一 REST/MCP 接口;React 工作台提供分镜、素材、角色与道具、参考制作、协作与历史、协议标签页,保留网格、清单和依赖视图。
- 同源受权图片/视频/音频预览;按镜头保留当前页面草稿,明确保存范围与冲突处理;镜头搜索、前后跳转、排序与原子批量时长修改。

## 技术架构
Expand All @@ -25,7 +26,7 @@ TypeScript(strict/ESM)贯穿协议、服务与 Web;npm workspaces。
- Storage: Cloudflare D1(authoritative revisions / ACL / metadata)+ R2(immutable media)。
- Web: React + Vite,预览/编辑并排,可收起导航或进入专注编辑。
- Optional: Durable Objects 用于必要时的在线协作通知。
- **Deploy target**: Cloudflare Workers,已验证域名 `video-compose.talkincode.net`(`talkincode.net` Cloudflare 子域名),UI/API/MCP 统一受 Cloudflare Access Zero Trust SSO 保护;Agent 经受控非交互身份访问,Worker 做项目级授权。
- **Deploy target**: Cloudflare Workers,正式入口 `vflow.talkincode.net`,旧域名 `video-compose.talkincode.net` 保留兼容(`talkincode.net` Cloudflare 子域名),UI/API/MCP 统一受 Cloudflare Access Zero Trust SSO 保护;Agent 经受控非交互身份访问,Worker 做项目级授权。
- **GitHub-to-Workers**: 首选 Cloudflare Workers Builds 与 GitHub `main` 集成部署;GitHub Actions + Wrangler 仅作为替代部署路径,两者不并行部署生产。详见 [deployment](docs/deployment.md)。
详见 [architecture](docs/architecture.md)。

Expand All @@ -52,6 +53,10 @@ npm run test:browser

通过目标提交的 CI 后,已登录正确 Cloudflare 账户的维护者运行 `npm run deploy`。部署前后核对 Worker 版本、D1/R2 绑定、Access 保护和登录后的真实界面,不能把本地构建成功当成线上发布成功。

## MCP 接入

正式网站:`https://vflow.talkincode.net`;Remote MCP:`https://vflow.talkincode.net/mcp`。OAuth discovery 根据请求域名生成 issuer 和端点;UI/API 使用 Cloudflare Access,MCP 使用 OAuth Bearer 与项目 ACL。已有旧域名连接保持兼容,新配置使用 vflow。

## Quality & contributions
请先阅读 [AGENTS.md](AGENTS.md) 及 [roadmap acceptance matrix](docs/roadmap.md#验收矩阵业务能力覆盖矩阵)。新增一级能力必须补充 Happy Path E2E;高风险、权限及状态修改必须验证失败和恢复路径。禁止为功能开发而扩大非目标范围。

Expand Down
52 changes: 52 additions & 0 deletions apps/api/migrations/0002_mcp_oauth.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
-- Cloudflare D1 schema for MCP OAuth 2.1 in Video Compose
CREATE TABLE IF NOT EXISTS mcp_clients (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
redirect_uris_json TEXT NOT NULL,
grant_types_json TEXT NOT NULL,
response_types_json TEXT NOT NULL,
scope TEXT NOT NULL,
auth_method TEXT NOT NULL,
secret_hash TEXT,
owner TEXT,
disabled INTEGER NOT NULL DEFAULT 0,
created_at INTEGER NOT NULL,
last_used_at INTEGER
);

CREATE TABLE IF NOT EXISTS mcp_grants (
id TEXT PRIMARY KEY,
client_id TEXT NOT NULL,
redirect_uri TEXT NOT NULL,
owner TEXT NOT NULL,
scope TEXT NOT NULL,
state TEXT,
resource TEXT,
code_challenge TEXT NOT NULL,
code_challenge_method TEXT NOT NULL,
code_hash TEXT,
csrf TEXT NOT NULL,
approved INTEGER NOT NULL DEFAULT 0,
expires_at INTEGER NOT NULL,
created_at INTEGER NOT NULL,
used_at INTEGER,
FOREIGN KEY (client_id) REFERENCES mcp_clients(id) ON DELETE CASCADE
);

CREATE TABLE IF NOT EXISTS mcp_tokens (
id TEXT PRIMARY KEY,
client_id TEXT NOT NULL,
kind TEXT NOT NULL CHECK (kind IN ('access', 'refresh')),
token_hash TEXT NOT NULL UNIQUE,
scopes TEXT NOT NULL,
resource TEXT NOT NULL,
owner TEXT NOT NULL,
expires_at INTEGER NOT NULL,
revoked_at INTEGER,
created_at INTEGER NOT NULL,
last_used_at INTEGER,
FOREIGN KEY (client_id) REFERENCES mcp_clients(id) ON DELETE CASCADE
);

CREATE INDEX IF NOT EXISTS idx_mcp_grants_code_hash ON mcp_grants(code_hash);
CREATE INDEX IF NOT EXISTS idx_mcp_tokens_token_hash ON mcp_tokens(token_hash);
14 changes: 14 additions & 0 deletions apps/api/migrations/0003_reference_authoring.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- Immutable reference-workflow revisions and external execution evidence.
-- Existing projects without a policy remain legacy; no old composition is rewritten.
CREATE TABLE IF NOT EXISTS reference_documents (
project_id TEXT NOT NULL,
id TEXT NOT NULL,
record_json TEXT NOT NULL,
PRIMARY KEY (project_id, id)
);
CREATE TABLE IF NOT EXISTS reference_evidence (
project_id TEXT NOT NULL,
id TEXT NOT NULL,
record_json TEXT NOT NULL,
PRIMARY KEY (project_id, id)
);
Loading
Loading