@dawnwood/cli 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mcp.js +109 -9
- package/package.json +1 -1
package/dist/mcp.js
CHANGED
|
@@ -34,7 +34,7 @@ async function call(path, tool, method, body) {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
export function buildServer() {
|
|
37
|
-
const server = new McpServer({ name: "dawnwood", version: "0.
|
|
37
|
+
const server = new McpServer({ name: "dawnwood", version: "0.3.0" });
|
|
38
38
|
// ---- runs 生命周期 ---------------------------------------------------------
|
|
39
39
|
server.tool("list_runs", "列出你的 runs(草稿与进行中)。浏览用——**禁止用它轮询状态**,查单个 run 用 get_run。", async () => call("/runs", "list_runs"));
|
|
40
40
|
server.tool("get_run", "读单个 run 的完整状态(向导步骤/圣经/剧本/pack/art 进度)。这是轮询状态的正确工具(O(1) 直取);轮询间隔 ≥10 秒。", { run_id: z.string().describe("run id(snake_case)") }, async ({ run_id }) => call(`/runs/${encodeURIComponent(run_id)}`, "get_run"));
|
|
@@ -46,21 +46,30 @@ export function buildServer() {
|
|
|
46
46
|
lang: z.string().default("en").describe("产出语言(BCP-47)"),
|
|
47
47
|
render_style: z.enum(["real", "comic"]).default("real"),
|
|
48
48
|
compliance_ack: z.boolean().describe("确认无真人肖像/无第三方 IP,必须 true"),
|
|
49
|
+
episodes: z.number().int().optional()
|
|
50
|
+
.describe("集数(运营特权:服务端要求 OPS 权限且限 6-120;不填 = 10)"),
|
|
49
51
|
}, async (a) => call("/runs", "create_run", "POST", {
|
|
50
52
|
id: a.run_id, titles: a.titles, primary_locale: a.primary_locale,
|
|
51
53
|
premise: a.premise, lang: a.lang, render_style: a.render_style,
|
|
52
54
|
compliance_ack: a.compliance_ack,
|
|
55
|
+
...(a.episodes != null ? { episodes: a.episodes } : {}),
|
|
53
56
|
}));
|
|
54
57
|
server.tool("delete_run", "放弃一个向导草稿 run(不可逆;只能删自助 run)。", { run_id: z.string() }, async ({ run_id }) => call(`/runs/${encodeURIComponent(run_id)}`, "delete_run", "DELETE"));
|
|
55
58
|
// ---- 圣经(Step 2) ---------------------------------------------------------
|
|
56
|
-
server.tool("generate_bible", "生成剧集圣经(
|
|
57
|
-
server.tool("get_bible", "读当前圣经(含版本轨)
|
|
58
|
-
server.tool("
|
|
59
|
+
server.tool("generate_bible", "生成剧集圣经(世界观/人物/弧线/情绪框架/中点/逐集 beat)。异步倾向的长操作,完成后用 get_bible 读。可带 feedback 重生成。圣经字段:emotion_frame(revenge|sweet_healing|angst|benevolence|career|light_mystery|family_ethics 之一,含四段弧)、midpoint(ally_flip|hidden_truth|major_failure,落在全季 40-60%)、reveal_ladder、beats[]{hook_0_5s,turn,cliffhanger,payoff_next(下集必须先兑现的爽点),phase(1-4 单调不降)}。", { run_id: z.string(), feedback: z.string().optional().describe("对上一版的修改意见") }, async ({ run_id, feedback }) => call(`/runs/${encodeURIComponent(run_id)}/bible/generate`, "generate_bible", "POST", feedback ? { feedback } : {}));
|
|
60
|
+
server.tool("get_bible", "读当前圣经(含版本轨)。返回里的 stale_eps = 这些集的 beat 落后于现行剧本(以 get_script 为准,别信 beat);pending_deltas = 回流判出的圣经级改动(新世界规则/cast/ladder),等人确认,勿自动写。content.writing_rules = 本剧写法约束(谁何时可被怀疑/披露时间表/颜色口径/禁句),改剧本前必读、当硬约束。", { run_id: z.string() }, async ({ run_id }) => call(`/runs/${encodeURIComponent(run_id)}/bible`, "get_bible"));
|
|
61
|
+
server.tool("sync_bible", "按现行剧本重出圣经 beat(后台异步)。给 ep 只回流一集;不给 = 整季从 EP1 串行回填。正常不必调:每次剧本写版本都自动回流;get_bible 报了 stale_eps 又急用时才手动。", { run_id: z.string(), ep: z.string().optional().describe("集号,如 '5';不填 = 整季") }, async ({ run_id, ep }) => call(`/runs/${encodeURIComponent(run_id)}/bible/sync`, "sync_bible", "POST", ep ? { ep: String(parseInt(ep, 10)) } : {}));
|
|
62
|
+
server.tool("update_bible", "直接改写圣经内容(整体 PUT;细粒度改动优先走 generate_bible 的 feedback)。校验:emotion_frame.type/midpoint.type 必须取自固定枚举,midpoint.ep 落在 40-60% 区间,beats[].phase 1-4 且跨集不降;writing_rules 可选,≤12 条字符串(本剧写法约束,通用写法规则系统自带不用写)。", { run_id: z.string(), bible: z.record(z.string(), z.unknown()).describe("圣经 JSON 全量") }, async ({ run_id, bible }) => call(`/runs/${encodeURIComponent(run_id)}/bible`, "update_bible", "PUT", bible));
|
|
59
63
|
server.tool("approve_bible", "批准圣经,解锁剧本链。批准是闸门动作——建议先用 get_review_url 让人在 console 里过目。", { run_id: z.string() }, async ({ run_id }) => call(`/runs/${encodeURIComponent(run_id)}/bible/approve`, "approve_bible", "POST"));
|
|
60
64
|
// ---- 剧本链(Step 3) -------------------------------------------------------
|
|
61
|
-
server.tool("generate_scripts", "跑剧本链(逐集生成,带前情摘要)。长操作;进度用 get_run 轮询(≥10s)。"
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
server.tool("generate_scripts", "跑剧本链(逐集生成,带前情摘要)。长操作;进度用 get_run 轮询(≥10s)。" +
|
|
66
|
+
"缺省**续跑**:已 ready/已批准的集跳过 —— 链被杀/卡死后重调是安全的。" +
|
|
67
|
+
"force=true 才全量重生成(如 bible 反馈后整链重写;会把每集顶成新 LLM 版)。", { run_id: z.string(), force: z.boolean().optional().describe("全量重生成(慎用)") }, async ({ run_id, force }) => call(`/runs/${encodeURIComponent(run_id)}/scripts/generate`, "generate_scripts", "POST", force ? { force: true } : {}));
|
|
68
|
+
server.tool("get_script", "读某一集剧本。ep 形如 '0001'。响应带 render_lock:{locked, reason} —— locked=true 时这一集不能起草/渲染:" +
|
|
69
|
+
"reason=proposal_pending 是有一份改写提案等用户确认(Apply/Reject),reason=unapproved 是新版本还没批准。" +
|
|
70
|
+
"遇到 locked 必须原话告诉用户去 console 的 Script 页处理(或经用户明确同意后调 approve_script),不要绕开。", { run_id: z.string(), ep: z.string().describe("集号,如 0001") }, async ({ run_id, ep }) => call(`/runs/${encodeURIComponent(run_id)}/scripts/${encodeURIComponent(ep)}`, "get_script"));
|
|
71
|
+
server.tool("update_script", "改写某一集剧本(PUT;approve 后的改动会计费,approve 前的 feedback 重生免费)。写入后圣经该集 beat 自动回流。" +
|
|
72
|
+
"**写入即清掉批准**:响应 render_lock.locked=true,该集在用户重新批准前不能起草/渲染 —— 必须提醒用户去批准(或得到明确同意后调 approve_script)。改已有剧本前先读前后两集(get_script),保留用户没点名要改的 beat/道具/人物;用户要你「核查」某集是否支持一个前提时,先原文引用说明成不成立,不许补台词让前提成立。", { run_id: z.string(), ep: z.string(), body: z.record(z.string(), z.unknown()) }, async ({ run_id, ep, body }) => call(`/runs/${encodeURIComponent(run_id)}/scripts/${encodeURIComponent(ep)}`, "update_script", "PUT", body));
|
|
64
73
|
server.tool("approve_script", "批准某一集剧本(闸门动作;建议先 get_review_url 人工过目)。", { run_id: z.string(), ep: z.string() }, async ({ run_id, ep }) => call(`/runs/${encodeURIComponent(run_id)}/scripts/${encodeURIComponent(ep)}/approve`, "approve_script", "POST"));
|
|
65
74
|
// ---- 设定包(Step 4) -------------------------------------------------------
|
|
66
75
|
server.tool("generate_pack", "生成设定包草稿(角色/场景/道具的视觉设定)。", { run_id: z.string() }, async ({ run_id }) => call(`/runs/${encodeURIComponent(run_id)}/pack/generate`, "generate_pack", "POST"));
|
|
@@ -68,16 +77,107 @@ export function buildServer() {
|
|
|
68
77
|
server.tool("commit_pack", "锁定设定包,进入美术/渲染阶段(闸门动作)。", { run_id: z.string() }, async ({ run_id }) => call(`/runs/${encodeURIComponent(run_id)}/pack/commit`, "commit_pack", "POST"));
|
|
69
78
|
// ---- 美术/渲染(Step 5) ----------------------------------------------------
|
|
70
79
|
server.tool("art_estimate", "美术/渲染的 credits 报价(动手前先看账)。", { run_id: z.string() }, async ({ run_id }) => call(`/runs/${encodeURIComponent(run_id)}/art/estimate`, "art_estimate"));
|
|
71
|
-
server.tool("generate_art", "启动美术/渲染(烧 credits 的一步;先跑 art_estimate 确认)。进度用 art_status 轮询(≥10s)。"
|
|
80
|
+
server.tool("generate_art", "启动美术/渲染(烧 credits 的一步;先跑 art_estimate 确认)。进度用 art_status 轮询(≥10s)。" +
|
|
81
|
+
"409 code=script_proposal_pending / script_unapproved = 某集剧本等用户确认(提案未 Apply/Reject 或新版本未批准):转述原因让用户去 Script 页处理,不要重试。", { run_id: z.string() }, async ({ run_id }) => call(`/runs/${encodeURIComponent(run_id)}/art/generate`, "generate_art", "POST"));
|
|
72
82
|
server.tool("art_status", "美术/渲染进度(单 run 直取,轮询用这个,间隔 ≥10 秒)。", { run_id: z.string() }, async ({ run_id }) => call(`/runs/${encodeURIComponent(run_id)}/art/status`, "art_status"));
|
|
83
|
+
server.tool("covers_estimate", "渲前生成式剧集封面的报量:哪些集还缺封面 + credits 价 + 闸门 blockers(需全剧本" +
|
|
84
|
+
"批准 + 立绘锚齐)。调 generate_covers **之前**先读这个,把张数/价钱告知用户确认。", { run_id: z.string() }, async ({ run_id }) => call(`/runs/${encodeURIComponent(run_id)}/covers/estimate`, "covers_estimate"));
|
|
85
|
+
server.tool("generate_covers", "批量生成缺封面的集(剧本 → 封面场景+钩子 → 脸锁 9:16 出图 → 按封面主题 typeset)。" +
|
|
86
|
+
"异步批;进度在 covers_estimate / get_run 的 covers 字段(轮询 ≥10s)。幂等:已有" +
|
|
87
|
+
"封面的集跳过;之后成片抽帧/手修的封面会自然覆盖生成版(发布取最新)。", { run_id: z.string() }, async ({ run_id }) => call(`/runs/${encodeURIComponent(run_id)}/covers/generate`, "generate_covers", "POST", {}));
|
|
88
|
+
server.tool("set_cover_theme", "设置本剧的封面主题(同频道多剧混排时,个人页网格靠它一眼分剧)。全部字段可选:" +
|
|
89
|
+
"accent/text/dim 为 #RRGGBB(缺省金/白/暗白),wordmark 为烧在每张封面上的系列字标" +
|
|
90
|
+
"(≤24 字符,如 'BOUGHT BRIDE'),ep_badge 为章行格式串(可用 {n}/{title})。" +
|
|
91
|
+
"省略的字段保持缺省;校验在服务端。", {
|
|
92
|
+
run_id: z.string().describe("run/work id(snake_case)"),
|
|
93
|
+
accent: z.string().optional().describe("#RRGGBB 主色(书名/分隔线/字标)"),
|
|
94
|
+
text: z.string().optional().describe("#RRGGBB 正文色(钩子)"),
|
|
95
|
+
dim: z.string().optional().describe("#RRGGBB 次级色(章行)"),
|
|
96
|
+
wordmark: z.string().optional().describe("系列字标,≤24 字符"),
|
|
97
|
+
ep_badge: z.string().optional().describe("章行格式串,如 'EP {n}'"),
|
|
98
|
+
}, async ({ run_id, ...t }) => call(`/works/${encodeURIComponent(run_id)}`, "set_cover_theme", "PUT", { cover_theme: Object.fromEntries(Object.entries(t).filter(([, v]) => v != null)) }));
|
|
99
|
+
server.tool("import_clip", "从前作成片剪一段进本剧(直接复用或闪回):source_asset_id 为源作品的视频资产" +
|
|
100
|
+
"(segment_cut/母带),按 [start_ms, end_ms] 剪出落为本剧 archival_clip 资产(带出处)。" +
|
|
101
|
+
"treatment='flashback' 提取期烧死往事感滤镜。可选 splice={chapter, seg_id, position} " +
|
|
102
|
+
"剪好即插进该 segment 的拼接序(不渲染)。异步——轮询返回 asset_id 的 import_status。" +
|
|
103
|
+
"staff-only(服务端把门);跨账户旧母带需运维先拷进本桶。", {
|
|
104
|
+
run_id: z.string().describe("目标 run/work id"),
|
|
105
|
+
source_work_id: z.string().describe("源作品 id(出处校验)"),
|
|
106
|
+
source_asset_id: z.string().describe("源视频资产 id"),
|
|
107
|
+
start_ms: z.number().int().describe("起点毫秒"),
|
|
108
|
+
end_ms: z.number().int().describe("终点毫秒(≤起点+120000)"),
|
|
109
|
+
treatment: z.enum(["none", "flashback"]).optional(),
|
|
110
|
+
note: z.string().optional().describe("备注(如「EP7 退婚戏」)"),
|
|
111
|
+
splice: z.object({ chapter: z.number().int(), seg_id: z.string(),
|
|
112
|
+
position: z.number().int().optional() }).optional()
|
|
113
|
+
.describe("剪好即插组:目标章/段/1-based 组位(缺省段尾)"),
|
|
114
|
+
}, async ({ run_id, ...body }) => call(`/works/${encodeURIComponent(run_id)}/clips/import`, "import_clip", "POST", body));
|
|
115
|
+
// ---- EP21 感情戏兑现沉淀(TQ 2026-09-25):回忆蒙太奇 / 片中声线重克隆 / KYC 撞脸重抽 ------------
|
|
116
|
+
server.tool("flashback_montage", "用观众**看过的**前几集成片拼回忆(分镜指南 B24):每段 3–6 个短切片,统一往事调色、原声静音(默片)," +
|
|
117
|
+
"每片配一句 ≤16 词的内心旁白(说话人自己的克隆声线),拼成一个 archival 组插进目标段(position 1-based,缺省段尾)," +
|
|
118
|
+
"带字幕拍,段自动重拼。绝不重渲往事——新渲的过去对不上老脸老造型。clips 的 seg_no/group_no 是**源集**的 1-based 序号;" +
|
|
119
|
+
"单片 ≤12s、合计 ≤30s。旁白声线不像本人先调 reclone_voice。异步——返回 job_id,用 job_status 轮询(≥10 秒)。", {
|
|
120
|
+
run_id: z.string(),
|
|
121
|
+
episode: z.number().int().describe("插入回忆的集"),
|
|
122
|
+
seg_id: z.string().describe("插入的段 id"),
|
|
123
|
+
clips: z.array(z.object({
|
|
124
|
+
ep: z.number().int(), seg_no: z.number().int(), group_no: z.number().int(),
|
|
125
|
+
t0: z.number(), t1: z.number(), vo: z.string().optional(),
|
|
126
|
+
})).min(1).max(8),
|
|
127
|
+
speaker: z.string().optional().describe("这段回忆是谁的(角色名或 id);有 vo 时必填"),
|
|
128
|
+
position: z.number().int().optional(),
|
|
129
|
+
silent: z.boolean().optional().describe("默认 true:原声静音只留旁白"),
|
|
130
|
+
}, async ({ run_id, episode, seg_id, ...body }) => call(`/works/${encodeURIComponent(run_id)}/chapters/${episode}/storyboard/segments/${encodeURIComponent(seg_id)}/flashback`, "flashback_montage", "POST", body));
|
|
131
|
+
server.tool("reclone_voice", "用角色在某集成片里的**真实表演**重克隆声线(写回默认声线):各段人声分离→只留这个角色的台词→即时克隆。" +
|
|
132
|
+
"旁白/新台词听着不像片里的他/她时用;选他/她台词多的已拼好集。干净语音 <4s 或原声线是共享库声线时保留原声线。" +
|
|
133
|
+
"按 voice_recast 计费。异步——job_id → job_status。", { character_id: z.string(), run_id: z.string().optional(), episode: z.number().int() }, async ({ character_id, run_id, episode }) => call(`/characters/${encodeURIComponent(character_id)}/voice/reclone`, "reclone_voice", "POST", { chapter: episode, ...(run_id ? { work_id: run_id } : {}) }));
|
|
134
|
+
server.tool("likeness_reroll", "某组被引擎按「像真人」连拒(改过镜头仍拒)时,给惹审核的那位演员临时开 KYC 资产库(参考图以可信素材送审)并重渲该组;" +
|
|
135
|
+
"组出片后自动删库。character 缺省=本集撞脸组里出现最多的那位。仅内部账户的剧(服务端把门,客户剧 403——改机位/加动作)。", { run_id: z.string(), episode: z.number().int(), seg_id: z.string(), group_id: z.string(),
|
|
136
|
+
character: z.string().optional(), engine: z.string().optional() }, async ({ run_id, episode, seg_id, group_id, ...body }) => call(`/works/${encodeURIComponent(run_id)}/chapters/${episode}/storyboard/segments/${encodeURIComponent(seg_id)}` +
|
|
137
|
+
`/groups/${encodeURIComponent(group_id)}/likeness-reroll`, "likeness_reroll", "POST", body));
|
|
138
|
+
server.tool("job_status", "查异步任务(flashback_montage / reclone_voice 等返回的 job_id):status PENDING/RUNNING/DONE/FAILED + result/error。轮询间隔 ≥10 秒。", { job_id: z.string() }, async ({ job_id }) => call(`/jobs/${encodeURIComponent(job_id)}`, "job_status"));
|
|
139
|
+
server.tool("upload_character_ref", "上传角色外部参考图(如 face-blend 脸模):登记 variant='ref' 资产并把本地文件传上去。" +
|
|
140
|
+
"之后该角色的立绘锚生成会把最新参考图作为脸部参考(脸随参考图)。" +
|
|
141
|
+
"char: subject 服务端限内部员工(staff-only)。", {
|
|
142
|
+
character_id: z.string().describe("角色 id(snake_case)"),
|
|
143
|
+
file_path: z.string().describe("本地图片路径(png/jpg/webp)"),
|
|
144
|
+
note: z.string().optional().describe("备注(存 label_en,如来源/用途)"),
|
|
145
|
+
}, async ({ character_id, file_path, note }) => {
|
|
146
|
+
try {
|
|
147
|
+
const { readFile } = await import("node:fs/promises");
|
|
148
|
+
const data = await readFile(file_path);
|
|
149
|
+
const ext = (file_path.split(".").pop() || "").toLowerCase();
|
|
150
|
+
const ctype = { png: "image/png", jpg: "image/jpeg", jpeg: "image/jpeg",
|
|
151
|
+
webp: "image/webp" }[ext] || "image/png";
|
|
152
|
+
const reg = await apiCall("/assets", {
|
|
153
|
+
method: "POST", tool: "upload_character_ref", agent: AGENT,
|
|
154
|
+
body: {
|
|
155
|
+
type: "character", subject_ref: `char:${character_id}`,
|
|
156
|
+
variant: "ref", category: "ref", style: "real", content_type: ctype,
|
|
157
|
+
...(note ? { label_en: note } : {}),
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
const put = await fetch(reg.upload_url, {
|
|
161
|
+
method: "PUT", headers: { "content-type": ctype }, body: data,
|
|
162
|
+
});
|
|
163
|
+
if (!put.ok)
|
|
164
|
+
throw new Error(`S3 upload failed: HTTP ${put.status}`);
|
|
165
|
+
return ok({ asset_id: reg.asset_id, key: reg.key, uploaded: true });
|
|
166
|
+
}
|
|
167
|
+
catch (e) {
|
|
168
|
+
return fail(e);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
73
171
|
// ---- 签收与交付(TQ 2026-08-31:Review 不自动绿,人签字才算) ----------------
|
|
74
172
|
server.tool("signoff_episode", "签收一集(闸门动作:看过成片才签;发布与交付都以签收为前提)。响应带全剧进度" +
|
|
75
173
|
"(signed/total/all_signed)——all_signed=true 时**问用户**是否生成整剧交付包," +
|
|
76
174
|
"用户确认后再调 build_delivery_pack;不确认就停,绝不擅自打包。传 revoke=true 撤签。", { run_id: z.string(), episode: z.number().int(), revoke: z.boolean().optional() }, async ({ run_id, episode, revoke }) => call(`/works/${encodeURIComponent(run_id)}/chapters/${episode}/signoff`, "signoff_episode", "POST", revoke ? { revoke: true } : {}));
|
|
175
|
+
server.tool("regen_cover", "重出**一集**封面(封面是签收时的默认产物,用户对那张不满意才调;强制重出,不看已有," +
|
|
176
|
+
"新图发布时自动取最新一张;按价卡扣一张 art_reroll)。", { run_id: z.string(), episode: z.number().int() }, async ({ run_id, episode }) => call(`/works/${encodeURIComponent(run_id)}/chapters/${episode}/cover/regen`, "regen_cover", "POST", {}));
|
|
77
177
|
server.tool("build_delivery_pack", "生成整剧交付包(母带/干净母版/SRT/封面,按章异步打包,分钟级)。只在用户明确" +
|
|
78
178
|
"确认后调用——通常是 signoff_episode 返回 all_signed 后询问的下一步。", { run_id: z.string() }, async ({ run_id }) => call(`/works/${encodeURIComponent(run_id)}/delivery-package`, "build_delivery_pack", "POST", {}));
|
|
79
179
|
// ---- 账面 ------------------------------------------------------------------
|
|
80
|
-
server.tool("credits_balance", "查 credits
|
|
180
|
+
server.tool("credits_balance", "查 credits 余额与免费额度;附 usage.by_source(console vs 各 agent 名的扣费净额/笔数)与 usage.by_token(每枚 PAT),entries 逐笔带 source/token_id/tool。", async () => call("/credits", "credits_balance"));
|
|
81
181
|
// ---- 人工审核动线(前提 5:console = 审核/裁决面) ---------------------------
|
|
82
182
|
server.tool("get_review_url", "返回 console 深链,交给人类在浏览器里做视觉审核/裁决(选图、审片、批准)。不发任何 API 请求。在 approve_* 之前把这个链接给用户是推荐动线。", { run_id: z.string() }, async ({ run_id }) => ok({
|
|
83
183
|
url: `${consoleBase()}/#run-wizard/${encodeURIComponent(run_id)}`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dawnwood/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Dawnwood for agents — CLI + MCP server. Your agent drives the full short-drama pipeline (bible → scripts → pack → renders) against console.dawnwood.ai.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|