@biunow/agent-biutalk 2.0.0 → 2.0.2

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.
Files changed (93) hide show
  1. package/_shared/lib/panel-llm.mjs +82 -0
  2. package/_shared/lib/panel-settings.mjs +16 -0
  3. package/_shared/scripts/.logs/2026-11-27T15-12-16-216Z.log +401 -0
  4. package/_shared/scripts/run-quiet.mjs +66 -0
  5. package/_shared/scripts/stage.mjs +105 -0
  6. package/_shared/studio/composer.css +55 -45
  7. package/_shared/studio/composer.js +198 -103
  8. package/bin/server.js +59 -6
  9. package/manifest.json +3 -3
  10. package/package.json +1 -1
  11. package/skills/biutalk/EXEC.md +29 -6
  12. package/skills/biutalk/SKILL.md +4 -0
  13. package/skills/biutalk/scripts/run-quiet.mjs +66 -0
  14. package/skills/biutalk/scripts/stage.mjs +105 -0
  15. package/skills/biutalk/scripts/stages.json +31 -0
  16. package/studio/app.js +45 -11
  17. package/studio/composer.css +55 -45
  18. package/studio/composer.js +198 -103
  19. package/studio/index.html +4 -4
  20. package/_shared/.tmp-panel-smoke/art/smoke.mp4 +0 -0
  21. package/_shared/.tmp-panel-smoke/art-pipe/out/biuart-01_cave-mwq5kfpm.mp4 +0 -0
  22. package/_shared/.tmp-panel-smoke/art-pipe/panel-delivery.json +0 -7
  23. package/_shared/.tmp-panel-smoke/reel-pipe/film/index.html +0 -7
  24. package/_shared/.tmp-panel-smoke/reel-pipe/film/main.js +0 -68
  25. package/_shared/.tmp-panel-smoke/reel-pipe/film/panel-beats.json +0 -20
  26. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/CREDITS +0 -20
  27. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/build.sh +0 -17
  28. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/ease.js +0 -43
  29. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/events.json +0 -1
  30. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/film.js +0 -533
  31. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/fonts/OFL-Archivo.txt +0 -93
  32. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/fonts/OFL-DMSerifDisplay.txt +0 -93
  33. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/fonts/OFL-UnifrakturMaguntia.txt +0 -94
  34. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/fonts/fonts.css +0 -3
  35. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/index.html +0 -6
  36. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/lines.json +0 -10
  37. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/main.js +0 -15
  38. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/mix.py +0 -116
  39. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/music/score.py +0 -168
  40. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/music/score_meta.json +0 -59
  41. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/score.json +0 -235
  42. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/stills/styleframe.jpg +0 -0
  43. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/tools/fonts.sh +0 -17
  44. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/tools/subs.py +0 -11
  45. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/tools/words.py +0 -20
  46. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/voices/dur.json +0 -10
  47. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/voices/words.json +0 -213
  48. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/voices/words_rel.json +0 -56
  49. package/_shared/.tmp-panel-smoke/reel-pipe/style-ref.json +0 -5
  50. package/_shared/.tmp-panel-smoke/reel-pipe2/film/index.html +0 -7
  51. package/_shared/.tmp-panel-smoke/reel-pipe2/film/main.js +0 -68
  52. package/_shared/.tmp-panel-smoke/reel-pipe2/film/panel-beats.json +0 -20
  53. package/_shared/.tmp-panel-smoke/reel-pipe2/out/video.mp4 +0 -0
  54. package/_shared/.tmp-panel-smoke/reel-pipe2/panel-delivery.json +0 -8
  55. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/CREDITS +0 -20
  56. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/build.sh +0 -17
  57. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/ease.js +0 -43
  58. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/events.json +0 -1
  59. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/film.js +0 -533
  60. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/fonts/OFL-Archivo.txt +0 -93
  61. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/fonts/OFL-DMSerifDisplay.txt +0 -93
  62. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/fonts/OFL-UnifrakturMaguntia.txt +0 -94
  63. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/fonts/fonts.css +0 -3
  64. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/index.html +0 -6
  65. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/lines.json +0 -10
  66. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/main.js +0 -15
  67. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/mix.py +0 -116
  68. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/music/score.py +0 -168
  69. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/music/score_meta.json +0 -59
  70. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/score.json +0 -235
  71. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/stills/styleframe.jpg +0 -0
  72. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/tools/fonts.sh +0 -17
  73. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/tools/subs.py +0 -11
  74. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/tools/words.py +0 -20
  75. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/voices/dur.json +0 -10
  76. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/voices/words.json +0 -213
  77. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/voices/words_rel.json +0 -56
  78. package/_shared/.tmp-panel-smoke/reel-pipe2/style-ref.json +0 -5
  79. package/_shared/.tmp-panel-smoke/remo-pipe/brief.md +0 -2
  80. package/_shared/.tmp-panel-smoke/remo-pipe/remo-job.json +0 -4
  81. package/_shared/.tmp-panel-smoke/remo-pipe2/brief.md +0 -1
  82. package/_shared/.tmp-panel-smoke/remo-pipe2/out/final.mp4 +0 -0
  83. package/_shared/.tmp-panel-smoke/remo-pipe2/panel-delivery.json +0 -8
  84. package/_shared/.tmp-panel-smoke/remo-pipe2/remo-job.json +0 -4
  85. package/_shared/.tmp-panel-smoke/vibe-pipe-ok/ep00-demo.mp4 +0 -0
  86. package/_shared/.tmp-panel-smoke/vibe-pipe-ok/out/ep00-demo.mp4 +0 -0
  87. package/_shared/.tmp-panel-smoke/vibe-pipe-ok/panel-delivery.json +0 -7
  88. package/_shared/.tmp-panel-smoke/vibe-pipe-ok/publish.json +0 -10
  89. package/_shared/.tmp-panel-smoke/vibe-still.jpg +0 -0
  90. package/_shared/.tmp-panel-smoke/vibe-still.log +0 -6
  91. package/_shared/.tmp-panel-smoke/vibe-still.log.err +0 -0
  92. package/_shared/.tmp-panel-smoke/vibe-still2.log +0 -26
  93. package/_shared/.tmp-panel-smoke/vibe-still2.log.err +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biunow/agent-biutalk",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "BiuTalk",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {
@@ -1,5 +1,16 @@
1
1
  # BiuTalk 执行卡(先读这张)
2
2
 
3
+ ## 0. 一键闸门(优先用这条,不要逐条敲)
4
+
5
+ ```bash
6
+ node "$SKILL/scripts/stage.mjs" pre --project . --engine "$ENGINE"
7
+ node "$SKILL/scripts/stage.mjs" post --project . --video <成片.mp4>
8
+ ```
9
+
10
+ 一条命令跑完该阶段的全部检查,**只回 ≤8 行**;`FAIL` 就按行里的 `code hint` 改,不要重跑整段、不要重读文档。
11
+ 下文的分步命令只在排障时单跑(正常流程用上面两条)。
12
+
13
+
3
14
  变量:`SKILL` = 本文件所在目录;`ENGINE` = `brief.json.engineRoot` 或面板 settings.engineRoots.biutalk;成片工程 = 含 `video.json` 的目录(通常是 `videos/<projectSlug>`)。
4
15
 
5
16
  ## 0. 开工前
@@ -22,6 +33,16 @@ node "$SKILL/scripts/scaffold.mjs" --project . --engine "$ENGINE" --json
22
33
  ```
23
34
  输出 `projectPath`、`mainFile: scenes.js`、`scriptFile: script.md`。已有 `video.json` 不覆盖;重置才加 `--force`。
24
35
 
36
+ ## 2.5 附件落位(有附件就必须先接上)
37
+ `brief.assets[]` 每项有 `role` 和相对工程目录的 `rel`:
38
+
39
+ - `media` → `assets/…`:截图/logo 用 `s.image('assets/x.png')`,视频用 `s.clip('assets/x.mp4')`(可 `volume:` 放原声)。
40
+ - `voice` → `assets/…`:**用户录音就是旁白**,在 `video.json` 写 `"voice": {"provider":"recording","src":"assets/x.m4a"}`(逐场录音放同目录子文件夹,见 `$ENGINE/docs/voices.md`)。有录音时不要再合成覆盖。
41
+ - `music` → `assets/…`:写 `"music": {"src":"assets/x.mp3","volume":0.35,"loop":true}`,并在发布文案里保留授权/署名。
42
+ - `doc` → `docs/…`:只用来核对事实/大纲,**不要拷进 `assets/`**(引擎白名单只服务媒体文件)。
43
+
44
+ 原始上传在 `assets/uploads/`;`brief.assets` 为空但 `brief.uploads` 非空,说明落位失败——停下来说明缺哪一类,不要猜。
45
+
25
46
  ## 3. 口播稿 script.md(先写,决定全片时长)
26
47
  - 每镜 `## scene-id`,id 必须与 `scenes.js` 函数同名;从 `hook / steps / outro` 起步。
27
48
  - 每镜 1–3 句、4–15 秒;全片 45–120 秒。中文约 200 字/分钟,英文 150 词/分钟。
@@ -42,8 +63,7 @@ node "$SKILL/scripts/scaffold.mjs" --project . --engine "$ENGINE" --json
42
63
  node "$ENGINE/bin/explainroo.js" voice .
43
64
  node "$ENGINE/bin/explainroo.js" check . --json
44
65
  node "$SKILL/scripts/qc.mjs" --project . --engine "$ENGINE" --json
45
- ```
46
- `check` 的 error / warn 必须清零;`qc.ok:false` 只读 `findings[].hint` 修,不要描述图片。
66
+ ````check` 的 error / warn 必须清零;`qc.ok:false` 只读 `findings[].hint` 修,不要描述图片。
47
67
 
48
68
  需要人看画面时只生成静帧和接触表,交给用户看:
49
69
  ```bash
@@ -53,11 +73,14 @@ node "$ENGINE/bin/explainroo.js" sheet .
53
73
 
54
74
  ## 6. 草稿 → 终版 → 验收
55
75
  ```bash
56
- node "$ENGINE/bin/explainroo.js" render . --draft --workers 6
57
- node "$SKILL/scripts/qc.mjs" --project . --engine "$ENGINE" --video ./out/draft.mp4 --json
58
- node "$ENGINE/bin/explainroo.js" render . --workers 6
59
- node "$ENGINE/bin/explainroo.js" verify . --json
76
+ node "$SKILL/scripts/run-quiet.mjs" --lines 8 -- node "$ENGINE/bin/explainroo.js" render . --draft --workers 6 --from 0 --to 20 --out ./out/draft-slice.mp4
77
+ node "$SKILL/scripts/qc.mjs" --project . --engine "$ENGINE" --video ./out/draft-slice.mp4 --json
78
+ node "$SKILL/scripts/run-quiet.mjs" --lines 8 -- node "$ENGINE/bin/explainroo.js" render . --workers 6
79
+ node "$SKILL/scripts/run-quiet.mjs" --lines 8 -- node "$ENGINE/bin/explainroo.js" verify . --json
60
80
  ```
81
+
82
+ - 改一镜只验那一镜:`render . --from <t0> --to <t1> --out out/fix-<scene>.mp4`,确认后再跑一次整片;不要为了改一镜重渲整片。
83
+ - 终版只渲一次;进了终版才发现问题,先退回 draft 阶段改。
61
84
  `qc.ok:true` 且 `verify` 无 error 才算完成;无音轨、响度偏差、黑帧按 hint 修。
62
85
 
63
86
  ## 7. 交付
@@ -21,3 +21,7 @@ description: Create narrated explainer videos with the explainroo engine from a
21
21
  - 引擎 CLI 永远用 `node "$ENGINE/bin/explainroo.js" <cmd>`。
22
22
 
23
23
  `brief.json` 是合同:不追问 intake,不改 look / size / pace / title。只改 `script.md` 和 `scenes.js`,不上生图,不加 watermark。完成后只回复成片路径、时长、分辨率、`qc.ok`。
24
+
25
+ ## 附件
26
+
27
+ `brief.assets[]` 按角色给出落位:`media`(图片/视频,已在 `assets/`)、`voice`(用户旁白录音,`provider: recording`,不要再合成)、`music`(配乐,写进 `music.src`)、`doc`(`../docs/`,只读事实)。详见 `EXEC.md` §2.5。
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * 输出收敛器:跑一条命令,只把"错误 + 结尾 20 行"还给模型,完整日志落盘。
4
+ *
5
+ * node run-quiet.mjs -- npx tsc -p . --noUnusedLocals
6
+ * node run-quiet.mjs --lines 12 -- explainroo render . --draft
7
+ *
8
+ * 为什么:渲染/编译工具的日志动辄几百上千行,全塞进上下文等于白烧 token;
9
+ * 但这些日志 99% 是进度条和重复警告,真正有用的是错误行和最后十几行。
10
+ *
11
+ * 输出格式(固定 3 段,总行数 ≤ lines+3):
12
+ * [quiet] exit=0 ok log=<path> 全输出 <n> 字节
13
+ * [quiet] 关键行: …(最多 lines 行)
14
+ */
15
+ import fs from 'node:fs';
16
+ import path from 'node:path';
17
+ import { spawn } from 'node:child_process';
18
+
19
+ const argv = process.argv.slice(2);
20
+ let lines = 20;
21
+ const sep = argv.indexOf('--');
22
+ const head = sep >= 0 ? argv.slice(0, sep) : [];
23
+ const cmd = sep >= 0 ? argv.slice(sep + 1) : argv;
24
+ for (let i = 0; i < head.length; i += 1) {
25
+ if (head[i] === '--lines') lines = Math.max(3, Number(head[i + 1]) || 20);
26
+ }
27
+ if (!cmd.length) {
28
+ console.error('usage: node run-quiet.mjs [--lines N] -- <command> [args...]');
29
+ process.exit(2);
30
+ }
31
+
32
+ const logDir = path.join(process.cwd(), '.logs');
33
+ fs.mkdirSync(logDir, { recursive: true });
34
+ const stamp = new Date().toISOString().replace(/[:.]/g, '-');
35
+ const logFile = path.join(logDir, `${stamp}.log`);
36
+
37
+ const child = spawn(cmd[0], cmd.slice(1), { stdio: ['ignore', 'pipe', 'pipe'], windowsHide: true });
38
+ let out = '';
39
+ let err = '';
40
+ child.stdout.on('data', (chunk) => { out += chunk.toString(); });
41
+ child.stderr.on('data', (chunk) => { err += chunk.toString(); });
42
+
43
+ const started = Date.now();
44
+ child.once('error', (error) => {
45
+ console.log(`[quiet] exit=127 fail log=- 启动失败:${error.message}`);
46
+ process.exit(127);
47
+ });
48
+
49
+ child.once('close', (code) => {
50
+ const seconds = ((Date.now() - started) / 1000).toFixed(1);
51
+ const all = `${out}${err}`;
52
+ fs.writeFileSync(logFile, all, 'utf8');
53
+ const bytes = Buffer.byteLength(all);
54
+ const keep = all
55
+ .split(/\r?\n/)
56
+ .map((line) => line.trimEnd())
57
+ .filter((line) => line.length > 0)
58
+ .slice(-lines);
59
+ const status = code === 0 ? 'ok' : 'fail';
60
+ console.log(`[quiet] exit=${code} ${status} ${seconds}s log=${path.relative(process.cwd(), logFile)} 全输出 ${bytes} 字节`);
61
+ if (keep.length) {
62
+ console.log('[quiet] 关键行:');
63
+ for (const line of keep) console.log(` ${line.slice(0, 400)}`);
64
+ }
65
+ process.exit(code === null ? 1 : code);
66
+ });
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * 一步到底的闸门聚合器:把 EXEC 里"要连着敲 3–6 条命令"的阶段压成一条。
4
+ *
5
+ * node stage.mjs pre --project . --engine "$ENGINE" [--ep <EP>]
6
+ * node stage.mjs post --project . --video out/final.mp4 [--ep <EP>] [--job job.json]
7
+ *
8
+ * 为什么:每次工具调用都会把整段上下文重发一遍,模型侧的 token 大致按「轮数²」涨。
9
+ * 把 5 条命令并成 1 条,等于把这一阶段的轮数从 5 降到 1;子命令输出也只回摘要。
10
+ *
11
+ * 配置在同目录 stages.json;`{engine}` `{project}` `{ep}` `{video}` `{job}` 会被替换。
12
+ * 输出固定 ≤8 行:一条总判定 + 每个失败项一行 `code hint`。
13
+ */
14
+ import fs from 'node:fs';
15
+ import path from 'node:path';
16
+ import { spawn } from 'node:child_process';
17
+ import { fileURLToPath } from 'node:url';
18
+
19
+ const here = path.dirname(fileURLToPath(import.meta.url));
20
+ const argv = process.argv.slice(2);
21
+ const stageName = argv.find((a) => !a.startsWith('--')) || '';
22
+ const opt = (name, fallback = '') => {
23
+ const i = argv.indexOf(name);
24
+ return i >= 0 && argv[i + 1] && !argv[i + 1].startsWith('--') ? argv[i + 1] : fallback;
25
+ };
26
+
27
+ const project = path.resolve(opt('--project', process.cwd()));
28
+ const engine = opt('--engine', process.env.ENGINE_ROOT || '');
29
+ const ep = opt('--ep', '');
30
+ const video = opt('--video', '');
31
+ const job = opt('--job', '');
32
+
33
+ if (!stageName) {
34
+ console.error('usage: node stage.mjs <stage> [--project .] [--engine DIR] [--ep ID] [--video FILE] [--job FILE]');
35
+ process.exit(2);
36
+ }
37
+
38
+ const cfgFile = path.join(here, 'stages.json');
39
+ if (!fs.existsSync(cfgFile)) {
40
+ console.error(`missing ${cfgFile}`);
41
+ process.exit(2);
42
+ }
43
+ const cfg = JSON.parse(fs.readFileSync(cfgFile, 'utf8').replace(/^\uFEFF/, ''));
44
+ const steps = cfg.stages?.[stageName];
45
+ if (!Array.isArray(steps) || !steps.length) {
46
+ console.error(`unknown stage "${stageName}"; have: ${Object.keys(cfg.stages || {}).join(', ')}`);
47
+ process.exit(2);
48
+ }
49
+
50
+ const vars = { engine, project, ep, video, job, skill: here };
51
+ const fill = (value) => String(value).replace(/\{(\w+)\}/g, (m, key) => (vars[key] ?? m));
52
+
53
+ function run(step) {
54
+ const [label, cmd, ...rest] = step;
55
+ const args = rest.map(fill);
56
+ return new Promise((resolve) => {
57
+ const child = spawn(cmd, args, { cwd: project, stdio: ['ignore', 'pipe', 'pipe'], windowsHide: true });
58
+ let out = '';
59
+ let err = '';
60
+ child.stdout.on('data', (c) => { out += c.toString(); });
61
+ child.stderr.on('data', (c) => { err += c.toString(); });
62
+ child.once('error', (e) => resolve({ label, code: 127, out: '', err: e.message }));
63
+ child.once('close', (code) => resolve({ label, code: code ?? 1, out, err }));
64
+ });
65
+ }
66
+
67
+ /** 从任意子命令输出里抠失败提示:优先 hint/detail 字段,退化到错误行。 */
68
+ function digest(text) {
69
+ const hints = [];
70
+ for (const m of text.matchAll(/"(?:hint|detail)"\s*:\s*"((?:[^"\\]|\\.)*)"/g)) {
71
+ const value = m[1].replace(/\\"/g, '"').replace(/\\\\/g, '\\');
72
+ if (value && value.length < 300) hints.push(value);
73
+ if (hints.length >= 5) break;
74
+ }
75
+ const okFlag = /"ok"\s*:\s*true/.test(text);
76
+ return { ok: okFlag, hints };
77
+ }
78
+
79
+ const started = Date.now();
80
+ const lines = [];
81
+ let failed = false;
82
+
83
+ for (const step of steps) {
84
+ if (failed) break;
85
+ const result = await run(step);
86
+ const combined = `${result.out}${result.err}`;
87
+ const info = digest(result.out) || digest(combined);
88
+ const ok = info.ok && result.code === 0;
89
+ if (!ok) {
90
+ failed = true;
91
+ if (info.hints.length) {
92
+ for (const hint of info.hints.slice(0, 4)) lines.push(`${result.label}: ${hint}`);
93
+ } else {
94
+ const tail = combined.split(/\r?\n/).filter(Boolean).slice(-3);
95
+ lines.push(`${result.label} exit=${result.code}`);
96
+ for (const t of tail) lines.push(` ${t.slice(0, 200)}`);
97
+ }
98
+ }
99
+ }
100
+
101
+ const seconds = ((Date.now() - started) / 1000).toFixed(1);
102
+ const head = failed ? `[stage] ${stageName} FAIL ${seconds}s` : `[stage] ${stageName} ok ${seconds}s (${steps.length} 步)`;
103
+ console.log(head);
104
+ for (const line of lines) console.log(` ${line}`);
105
+ process.exit(failed ? 1 : 0);
@@ -0,0 +1,31 @@
1
+ {
2
+ "agent": "biutalk",
3
+ "stages": {
4
+ "pre": [
5
+ [
6
+ "doctor",
7
+ "node",
8
+ "{skill}/doctor.mjs",
9
+ "--project",
10
+ ".",
11
+ "--engine",
12
+ "{engine}",
13
+ "--json"
14
+ ]
15
+ ],
16
+ "post": [
17
+ [
18
+ "qc",
19
+ "node",
20
+ "{skill}/qc.mjs",
21
+ "--project",
22
+ ".",
23
+ "--engine",
24
+ "{engine}",
25
+ "--video",
26
+ "{video}",
27
+ "--json"
28
+ ]
29
+ ]
30
+ }
31
+ }
package/studio/app.js CHANGED
@@ -7,7 +7,38 @@
7
7
  el.textContent = value;
8
8
  }
9
9
 
10
- const { api, fileToBase64, uploadBlockReason, bindPlusMenu, bindCount, renderJobs, addChip, titleFromPrompt, esc , openVoicePicker} = Composer;
10
+ const { api, fileToBase64, uploadBlockReason, bindPlusMenu, bindCount, bindRoleMenu, pickFilesByRole, roleLabel, renderJobs, addChip, titleFromPrompt, esc , openVoicePicker} = Composer;
11
+
12
+ const ATTACH_ROLES = [
13
+ {
14
+ role: 'media',
15
+ icon: '▣',
16
+ label: '图片 / 视频',
17
+ hint: '截图、logo、B-roll 素材',
18
+ accept: 'image/*,video/*',
19
+ },
20
+ {
21
+ role: 'voice',
22
+ icon: '♪',
23
+ label: '旁白录音',
24
+ hint: '我自己的声音;有录音就不合成',
25
+ accept: 'audio/*',
26
+ },
27
+ {
28
+ role: 'music',
29
+ icon: '♫',
30
+ label: '配乐 / 音效',
31
+ hint: '有授权的音乐或音效',
32
+ accept: 'audio/*',
33
+ },
34
+ {
35
+ role: 'doc',
36
+ icon: '▤',
37
+ label: '文档',
38
+ hint: 'PDF / Word / TXT,只用于核对事实',
39
+ accept: '.pdf,.md,.txt,.doc,.docx',
40
+ },
41
+ ];
11
42
 
12
43
  const state = {
13
44
  voice: null,
@@ -54,8 +85,9 @@
54
85
  });
55
86
  state.files.forEach((f, i) => {
56
87
  const el = document.createElement('span');
57
- el.className = 'asset';
58
- el.innerHTML = `${esc(f.name)} <button type="button">×</button>`;
88
+ const role = roleLabel(f.role);
89
+ el.className = 'asset' + (f.role ? ' ' + f.role : '');
90
+ el.innerHTML = `${esc(f.name)}${role ? `<span class="role-tag">${esc(role)}</span>` : ''} <button type="button">×</button>`;
59
91
  el.querySelector('button').onclick = () => {
60
92
  state.files.splice(i, 1);
61
93
  renderAssets();
@@ -121,9 +153,12 @@
121
153
  $('linkAdd').onclick = addLink;
122
154
 
123
155
  const plus = bindPlusMenu($('plusBtn'), $('plusMenu'));
124
- $('uploadBtn').onclick = () => {
125
- plus.close();
126
- $('files').click();
156
+ $('uploadBtn').onclick = (e) => {
157
+ e.stopPropagation();
158
+ bindRoleMenu($('uploadBtn'), ATTACH_ROLES, (item) => {
159
+ plus.close();
160
+ pickFilesByRole($('files'), item.role, item.accept, addPickedFiles);
161
+ });
127
162
  };
128
163
  if ($('voiceBtn')) {
129
164
  $('voiceBtn').onclick = () => {
@@ -145,12 +180,10 @@
145
180
  syncPaceHint();
146
181
  };
147
182
 
148
- $('files').onchange = async (e) => {
149
- const picked = Array.from(e.target.files || []);
150
- e.target.value = '';
183
+ async function addPickedFiles(role, picked) {
151
184
  const notes = [];
152
185
  let used = state.files.reduce((n, f) => n + (f.size || 0), 0);
153
- for (const file of picked) {
186
+ for (const file of picked || []) {
154
187
  const reason = uploadBlockReason(file, used);
155
188
  if (reason) {
156
189
  notes.push(reason);
@@ -159,6 +192,7 @@
159
192
  state.files.push({
160
193
  name: file.name,
161
194
  kind: file.type || 'file',
195
+ role: role || 'media',
162
196
  size: file.size,
163
197
  dataBase64: await fileToBase64(file),
164
198
  });
@@ -170,7 +204,7 @@
170
204
  $('err').textContent = notes.join(';');
171
205
  $('err').scrollIntoView({ block: 'nearest' });
172
206
  }
173
- };
207
+ }
174
208
 
175
209
  bindCount($('prompt'), $('count'), 4000);
176
210
 
@@ -112,26 +112,26 @@ button:disabled { cursor: not-allowed; opacity: .5; }
112
112
  width: 100%; min-height: 190px; border: 0; resize: vertical; outline: 0;
113
113
  padding: 18px 22px 8px; font-size: 15px; line-height: 1.7; background: transparent; color: var(--ink);
114
114
  }
115
- .composer textarea::placeholder { color: #a3a39f; }
116
-
117
- .prompt-stage { position: relative; }
118
- .prompt-stage textarea { padding-bottom: 48px; }
119
- .optimize {
120
- position: absolute; right: 14px; bottom: 12px; z-index: 2;
121
- border: 1px solid var(--line-strong); background: #fff; color: var(--ink);
122
- border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 650;
123
- box-shadow: 0 1px 2px rgb(0 0 0 / 6%);
124
- }
125
- .optimize:hover { background: var(--accent-soft); border-color: var(--accent-deep); }
126
- .optimize.is-locked { opacity: .55; }
127
- .optimize.is-locked:hover { background: #fff; border-color: var(--line-strong); }
128
- .optimize-tip {
129
- position: absolute; right: 14px; bottom: 48px; z-index: 3;
130
- background: #111; color: #fff; border-radius: 10px; padding: 8px 10px;
131
- font-size: 12px; line-height: 1.4; white-space: nowrap;
132
- box-shadow: 0 8px 24px rgb(0 0 0 / 18%);
133
- }
134
- .optimize-tip[hidden] { display: none !important; }
115
+ .composer textarea::placeholder { color: #a3a39f; }
116
+
117
+ .prompt-stage { position: relative; }
118
+ .prompt-stage textarea { padding-bottom: 48px; }
119
+ .optimize {
120
+ position: absolute; right: 14px; bottom: 12px; z-index: 2;
121
+ border: 1px solid var(--line-strong); background: #fff; color: var(--ink);
122
+ border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 650;
123
+ box-shadow: 0 1px 2px rgb(0 0 0 / 6%);
124
+ }
125
+ .optimize:hover { background: var(--accent-soft); border-color: var(--accent-deep); }
126
+ .optimize.is-locked { opacity: .55; }
127
+ .optimize.is-locked:hover { background: #fff; border-color: var(--line-strong); }
128
+ .optimize-tip {
129
+ position: absolute; right: 14px; bottom: 48px; z-index: 3;
130
+ background: #111; color: #fff; border-radius: 10px; padding: 8px 10px;
131
+ font-size: 12px; line-height: 1.4; white-space: nowrap;
132
+ box-shadow: 0 8px 24px rgb(0 0 0 / 18%);
133
+ }
134
+ .optimize-tip[hidden] { display: none !important; }
135
135
 
136
136
  .composer-foot {
137
137
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
@@ -392,6 +392,16 @@ button:disabled { cursor: not-allowed; opacity: .5; }
392
392
  .bd-viewer[hidden] { display: none; }
393
393
  .bd-viewer img { max-width: 100%; max-height: 100%; border-radius: 8px; }
394
394
  .asset.ref { background: var(--accent-soft); border-color: var(--accent-deep); }
395
+ /* 附件角色:+ 弹窗的二级菜单(参考素材 / 口播录音 / 配乐 / 文稿)与素材角色标签 */
396
+ .role-menu { position: fixed; width: 260px; z-index: 40; bottom: auto; }
397
+ .role-menu > button .plus-ico { width: 22px; height: 22px; font-size: 12px; border-radius: 7px; }
398
+ .asset .role-tag {
399
+ font-size: 10px; color: var(--muted-2); border: 1px solid var(--line);
400
+ border-radius: 99px; padding: 0 5px; margin-left: 2px;
401
+ }
402
+ .asset.voice { background: #e8f2ff; }
403
+ .asset.music { background: #f1ecff; }
404
+ .asset.doc { background: #f3f1e8; }
395
405
  button.job-play {
396
406
  appearance: none; border: 0; background: none; font: inherit; color: inherit;
397
407
  cursor: pointer; padding: 0; text-align: left; width: 100%;
@@ -531,29 +541,29 @@ button.job-play {
531
541
  .sm-entry-err { flex: 1 0 100%; margin: 0; font-size: 11px; line-height: 1.3; color: var(--danger); }
532
542
 
533
543
  .file-hidden { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; }
534
-
535
- .job-detail-card { width: min(520px, 100%); background: #fff; color: var(--ink); }
536
- .job-detail-card .film-modal-bar { color: var(--ink); border-bottom: 1px solid var(--line); }
537
- .job-detail-card .film-modal-x { color: var(--ink-soft); }
538
- .job-detail-body { padding: 14px 16px 18px; display: grid; gap: 10px; }
539
- .job-detail-body .jd-msg { font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
540
- .job-detail-body .jd-meta { font-size: 11px; white-space: pre-wrap; word-break: break-all; }
541
- .job-detail-body .jd-follow { display: grid; gap: 8px; padding-top: 4px; border-top: 1px dashed var(--line); }
542
- .job-detail-body .jd-follow-hint { margin: 0; font-size: 11.5px; }
543
- .job-detail-body .jd-follow-actions { display: flex; flex-wrap: wrap; gap: 6px; }
544
- .job-detail-body .jd-follow-btn {
545
- border: 1px solid var(--line); background: #fff; border-radius: 8px;
546
- padding: 6px 10px; font: inherit; font-size: 12px; cursor: pointer;
547
- }
548
- .job-detail-body .jd-follow-btn:hover { border-color: var(--ink); }
549
- .job-detail-body .jd-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
550
- .job-detail-body .jd-actions button {
551
- border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 7px 12px; font-size: 12px;
552
- }
553
- .job-detail-body .jd-actions .primary, .voice-picker-modal .primary {
554
- background: var(--ink); color: #fff; border-color: var(--ink);
555
- }
556
- .vp-field { display: grid; gap: 6px; font-size: 12px; }
557
- .vp-field select {
558
- width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; background: #fff;
544
+
545
+ .job-detail-card { width: min(520px, 100%); background: #fff; color: var(--ink); }
546
+ .job-detail-card .film-modal-bar { color: var(--ink); border-bottom: 1px solid var(--line); }
547
+ .job-detail-card .film-modal-x { color: var(--ink-soft); }
548
+ .job-detail-body { padding: 14px 16px 18px; display: grid; gap: 10px; }
549
+ .job-detail-body .jd-msg { font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
550
+ .job-detail-body .jd-meta { font-size: 11px; white-space: pre-wrap; word-break: break-all; }
551
+ .job-detail-body .jd-follow { display: grid; gap: 8px; padding-top: 4px; border-top: 1px dashed var(--line); }
552
+ .job-detail-body .jd-follow-hint { margin: 0; font-size: 11.5px; }
553
+ .job-detail-body .jd-follow-actions { display: flex; flex-wrap: wrap; gap: 6px; }
554
+ .job-detail-body .jd-follow-btn {
555
+ border: 1px solid var(--line); background: #fff; border-radius: 8px;
556
+ padding: 6px 10px; font: inherit; font-size: 12px; cursor: pointer;
557
+ }
558
+ .job-detail-body .jd-follow-btn:hover { border-color: var(--ink); }
559
+ .job-detail-body .jd-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
560
+ .job-detail-body .jd-actions button {
561
+ border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 7px 12px; font-size: 12px;
562
+ }
563
+ .job-detail-body .jd-actions .primary, .voice-picker-modal .primary {
564
+ background: var(--ink); color: #fff; border-color: var(--ink);
565
+ }
566
+ .vp-field { display: grid; gap: 6px; font-size: 12px; }
567
+ .vp-field select {
568
+ width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; background: #fff;
559
569
  }