@biunow/agent-biutalk 2.0.1 → 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.
@@ -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
  }
@@ -106,6 +106,97 @@
106
106
  sync();
107
107
  }
108
108
 
109
+ /** 附件的角色标签:所有 Studio 共用一套名字,避免五个面板各叫各的。 */
110
+ const ROLE_LABEL = {
111
+ ref: '参考',
112
+ media: '素材',
113
+ character: '人物',
114
+ voice: '口播',
115
+ music: '配乐',
116
+ doc: '文档',
117
+ script: '文稿',
118
+ lyrics: '歌词',
119
+ subtitle: '字幕',
120
+ };
121
+
122
+ function roleLabel(role) {
123
+ return ROLE_LABEL[role] || '';
124
+ }
125
+
126
+ let openRoleMenu = null;
127
+
128
+ /** + 菜单里的二级“附件角色”菜单(参考素材 / 口播录音 / 配乐 / 文稿 …)。 */
129
+ function bindRoleMenu(anchor, items, onPick) {
130
+ if (openRoleMenu) {
131
+ openRoleMenu.close();
132
+ openRoleMenu = null;
133
+ }
134
+ if (!items || !items.length) return null;
135
+ const menu = document.createElement('div');
136
+ menu.className = 'plus-menu role-menu';
137
+ items.forEach((item) => {
138
+ const btn = document.createElement('button');
139
+ btn.type = 'button';
140
+ btn.innerHTML =
141
+ `<span class="plus-ico">${esc(item.icon || '·')}</span>` +
142
+ `<span><strong>${esc(item.label)}</strong><small>${esc(item.hint || '')}</small></span>`;
143
+ btn.addEventListener('click', (e) => {
144
+ e.preventDefault();
145
+ e.stopPropagation();
146
+ close();
147
+ onPick(item);
148
+ });
149
+ menu.appendChild(btn);
150
+ });
151
+ document.body.appendChild(menu);
152
+ const rect = anchor.getBoundingClientRect();
153
+ const width = 260;
154
+ const left = Math.min(rect.right + 8, Math.max(8, window.innerWidth - width - 8));
155
+ const top = Math.min(Math.max(8, rect.top - 6), Math.max(8, window.innerHeight - menu.offsetHeight - 8));
156
+ menu.style.position = 'fixed';
157
+ menu.style.left = `${left}px`;
158
+ menu.style.top = `${top}px`;
159
+ menu.style.width = `${width}px`;
160
+ const close = () => {
161
+ menu.remove();
162
+ document.removeEventListener('click', onDocClick);
163
+ document.removeEventListener('keydown', onKey);
164
+ openRoleMenu = null;
165
+ };
166
+ const onDocClick = () => close();
167
+ const onKey = (e) => {
168
+ if (e.key === 'Escape') close();
169
+ };
170
+ setTimeout(() => {
171
+ document.addEventListener('click', onDocClick);
172
+ document.addEventListener('keydown', onKey);
173
+ }, 0);
174
+ openRoleMenu = { close };
175
+ return openRoleMenu;
176
+ }
177
+
178
+ /** 按角色取文件:设置 accept → 弹选择框 → 回传 { role, files }。 */
179
+ function pickFilesByRole(input, role, accept, onPicked) {
180
+ if (!input) return;
181
+ if (input.__roleHandler) {
182
+ input.removeEventListener('change', input.__roleHandler);
183
+ input.__roleHandler = null;
184
+ }
185
+ if (accept) input.setAttribute('accept', accept);
186
+ else input.removeAttribute('accept');
187
+ input.dataset.role = role;
188
+ const handler = () => {
189
+ input.removeEventListener('change', handler);
190
+ input.__roleHandler = null;
191
+ const files = Array.from(input.files || []);
192
+ input.value = '';
193
+ if (files.length) onPicked(role, files);
194
+ };
195
+ input.__roleHandler = handler;
196
+ input.addEventListener('change', handler);
197
+ input.click();
198
+ }
199
+
109
200
  let filmSelectedId = '';
110
201
  let selectedJobId = '';
111
202
 
@@ -590,6 +681,10 @@
590
681
  phaseLabel,
591
682
  bindPlusMenu,
592
683
  bindCount,
684
+ bindRoleMenu,
685
+ pickFilesByRole,
686
+ roleLabel,
687
+ ROLE_LABEL,
593
688
  renderJobs,
594
689
  addChip,
595
690
  titleFromPrompt,
@@ -622,107 +717,107 @@
622
717
  studioReadyForCase = true;
623
718
  writeCasePrompt();
624
719
  }
625
- let currentRecipe = null;
626
-
627
- let optimizeMember = false;
628
- let optimizeTipTimer = 0;
629
-
630
- function showOptimizeTip(message) {
631
- const tip = document.getElementById('optimizeTip');
632
- if (!tip) return;
633
- tip.hidden = false;
634
- tip.textContent = message;
635
- window.clearTimeout(optimizeTipTimer);
636
- optimizeTipTimer = window.setTimeout(() => {
637
- tip.hidden = true;
638
- }, 2600);
639
- }
640
-
641
- async function onOptimizePrompt() {
642
- const btn = document.getElementById('optimizeBtn');
643
- const prompt = document.getElementById('prompt');
644
- if (!btn || !prompt) return;
645
- if (!optimizeMember) {
646
- showOptimizeTip('会员专属,请先开通会员');
647
- return;
648
- }
649
- if (btn.dataset.busy === '1') return;
650
- btn.dataset.busy = '1';
651
- const previous = btn.textContent;
652
- btn.textContent = '优化中';
653
- try {
654
- const recipe = currentRecipe || {};
655
- const data = await api('/api/optimize-prompt', {
656
- method: 'POST',
657
- headers: { 'content-type': 'application/json' },
658
- body: JSON.stringify({
659
- text: prompt.value,
660
- templatePrompt: recipe.prompt || '',
661
- narration: recipe.narration || '',
662
- attachment: recipe.attachment || '',
663
- }),
664
- });
665
- const next = String((data && data.prompt) || '').trim();
666
- if (!next) throw new Error('没有得到可用的提示词');
667
- prompt.value = next;
668
- prompt.dispatchEvent(new Event('input'));
669
- if (data && data.kept) showOptimizeTip('没选模板,按你写的原文出片');
670
- } catch (error) {
671
- const message = (error && error.message) || '无法优化提示词';
672
- if (message.indexOf('会员专属') >= 0) {
673
- optimizeMember = false;
674
- btn.classList.add('is-locked');
675
- btn.setAttribute('aria-disabled', 'true');
676
- showOptimizeTip('会员专属,请先开通会员');
677
- } else {
678
- const err = document.getElementById('err');
679
- if (err) {
680
- err.hidden = false;
681
- err.textContent = message;
682
- } else {
683
- showOptimizeTip(message);
684
- }
685
- }
686
- } finally {
687
- btn.dataset.busy = '';
688
- btn.textContent = previous || '优化提示词';
689
- }
690
- }
691
-
692
- function mountOptimize() {
693
- const prompt = document.getElementById('prompt');
694
- if (!prompt || document.getElementById('optimizeBtn')) return;
695
- const stage = document.createElement('div');
696
- stage.className = 'prompt-stage';
697
- prompt.parentNode.insertBefore(stage, prompt);
698
- stage.appendChild(prompt);
699
- const btn = document.createElement('button');
700
- btn.type = 'button';
701
- btn.id = 'optimizeBtn';
702
- btn.className = 'optimize is-locked';
703
- btn.setAttribute('aria-disabled', 'true');
704
- btn.textContent = '优化提示词';
705
- const tip = document.createElement('div');
706
- tip.id = 'optimizeTip';
707
- tip.className = 'optimize-tip';
708
- tip.hidden = true;
709
- stage.appendChild(btn);
710
- stage.appendChild(tip);
711
- btn.addEventListener('click', () => {
712
- void onOptimizePrompt();
713
- });
714
- fetch('/api/health')
715
- .then((res) => res.json())
716
- .then((data) => {
717
- optimizeMember = !!(data && data.member === true);
718
- btn.classList.toggle('is-locked', !optimizeMember);
719
- btn.setAttribute('aria-disabled', optimizeMember ? 'false' : 'true');
720
- })
721
- .catch(() => {
722
- optimizeMember = false;
723
- });
724
- }
725
-
726
- mountOptimize();
727
-
720
+ let currentRecipe = null;
721
+
722
+ let optimizeMember = false;
723
+ let optimizeTipTimer = 0;
724
+
725
+ function showOptimizeTip(message) {
726
+ const tip = document.getElementById('optimizeTip');
727
+ if (!tip) return;
728
+ tip.hidden = false;
729
+ tip.textContent = message;
730
+ window.clearTimeout(optimizeTipTimer);
731
+ optimizeTipTimer = window.setTimeout(() => {
732
+ tip.hidden = true;
733
+ }, 2600);
734
+ }
735
+
736
+ async function onOptimizePrompt() {
737
+ const btn = document.getElementById('optimizeBtn');
738
+ const prompt = document.getElementById('prompt');
739
+ if (!btn || !prompt) return;
740
+ if (!optimizeMember) {
741
+ showOptimizeTip('会员专属,请先开通会员');
742
+ return;
743
+ }
744
+ if (btn.dataset.busy === '1') return;
745
+ btn.dataset.busy = '1';
746
+ const previous = btn.textContent;
747
+ btn.textContent = '优化中';
748
+ try {
749
+ const recipe = currentRecipe || {};
750
+ const data = await api('/api/optimize-prompt', {
751
+ method: 'POST',
752
+ headers: { 'content-type': 'application/json' },
753
+ body: JSON.stringify({
754
+ text: prompt.value,
755
+ templatePrompt: recipe.prompt || '',
756
+ narration: recipe.narration || '',
757
+ attachment: recipe.attachment || '',
758
+ }),
759
+ });
760
+ const next = String((data && data.prompt) || '').trim();
761
+ if (!next) throw new Error('没有得到可用的提示词');
762
+ prompt.value = next;
763
+ prompt.dispatchEvent(new Event('input'));
764
+ if (data && data.kept) showOptimizeTip('没选模板,按你写的原文出片');
765
+ } catch (error) {
766
+ const message = (error && error.message) || '无法优化提示词';
767
+ if (message.indexOf('会员专属') >= 0) {
768
+ optimizeMember = false;
769
+ btn.classList.add('is-locked');
770
+ btn.setAttribute('aria-disabled', 'true');
771
+ showOptimizeTip('会员专属,请先开通会员');
772
+ } else {
773
+ const err = document.getElementById('err');
774
+ if (err) {
775
+ err.hidden = false;
776
+ err.textContent = message;
777
+ } else {
778
+ showOptimizeTip(message);
779
+ }
780
+ }
781
+ } finally {
782
+ btn.dataset.busy = '';
783
+ btn.textContent = previous || '优化提示词';
784
+ }
785
+ }
786
+
787
+ function mountOptimize() {
788
+ const prompt = document.getElementById('prompt');
789
+ if (!prompt || document.getElementById('optimizeBtn')) return;
790
+ const stage = document.createElement('div');
791
+ stage.className = 'prompt-stage';
792
+ prompt.parentNode.insertBefore(stage, prompt);
793
+ stage.appendChild(prompt);
794
+ const btn = document.createElement('button');
795
+ btn.type = 'button';
796
+ btn.id = 'optimizeBtn';
797
+ btn.className = 'optimize is-locked';
798
+ btn.setAttribute('aria-disabled', 'true');
799
+ btn.textContent = '优化提示词';
800
+ const tip = document.createElement('div');
801
+ tip.id = 'optimizeTip';
802
+ tip.className = 'optimize-tip';
803
+ tip.hidden = true;
804
+ stage.appendChild(btn);
805
+ stage.appendChild(tip);
806
+ btn.addEventListener('click', () => {
807
+ void onOptimizePrompt();
808
+ });
809
+ fetch('/api/health')
810
+ .then((res) => res.json())
811
+ .then((data) => {
812
+ optimizeMember = !!(data && data.member === true);
813
+ btn.classList.toggle('is-locked', !optimizeMember);
814
+ btn.setAttribute('aria-disabled', optimizeMember ? 'false' : 'true');
815
+ })
816
+ .catch(() => {
817
+ optimizeMember = false;
818
+ });
819
+ }
820
+
821
+ mountOptimize();
822
+
728
823
  })(window);
package/bin/server.js CHANGED
@@ -31,7 +31,7 @@ function presentLook(look) {
31
31
  recipe: recipeView(findRecipe(RECIPES, [look.id, look.name, look.desc]), {
32
32
  narration: 'required',
33
33
  attachment: 'optional',
34
- hint: '成片自带解说,不用上传录音。参考材料可以不附。',
34
+ hint: '成片自带解说;想用自己的声音就从 + 上传「旁白录音」。参考材料可以不附。',
35
35
  }),
36
36
  };
37
37
  }
@@ -106,11 +106,41 @@ async function saveUploads(workspace, jobId, files) {
106
106
  const safe = f.name.replace(/[^\w.\-()\u4e00-\u9fff]+/g, '_').slice(0, 120);
107
107
  const dest = path.join(dir, safe);
108
108
  fs.writeFileSync(dest, Buffer.from(f.dataBase64, 'base64'));
109
- saved.push({ name: safe, path: dest, kind: f.kind || 'file' });
109
+ saved.push({ name: safe, path: dest, kind: f.kind || 'file', role: f.role || 'media' });
110
110
  }
111
111
  return saved;
112
112
  }
113
113
 
114
+ /**
115
+ * 附件落位:explainroo 只从工程目录的 assets/ 读素材。
116
+ * 媒体/录音/配乐 → <工程>/assets/;文档 → <项目>/docs/(只给 Agent 读,不进引擎)。
117
+ */
118
+ function placeUploads(projectDir, projectPath, uploads) {
119
+ const assetDir = ensureDir(path.join(projectPath, 'assets'));
120
+ const docDir = ensureDir(path.join(projectDir, 'docs'));
121
+ const sameDir = path.resolve(projectDir) === path.resolve(projectPath);
122
+ const placed = [];
123
+ for (const up of uploads) {
124
+ const isDoc = up.role === 'doc';
125
+ const dir = isDoc ? docDir : assetDir;
126
+ let dest = path.join(dir, up.name);
127
+ if (fs.existsSync(dest)) {
128
+ const ext = path.extname(up.name);
129
+ const stem = path.basename(up.name, ext);
130
+ dest = path.join(dir, `${stem}-${Date.now().toString(36)}${ext}`);
131
+ }
132
+ if (path.resolve(dest) !== path.resolve(up.path)) fs.copyFileSync(up.path, dest);
133
+ placed.push({
134
+ name: path.basename(dest),
135
+ role: up.role,
136
+ kind: up.kind,
137
+ path: dest,
138
+ rel: isDoc ? (sameDir ? `docs/${path.basename(dest)}` : `../docs/${path.basename(dest)}`) : `assets/${path.basename(dest)}`,
139
+ });
140
+ }
141
+ return placed;
142
+ }
143
+
114
144
  createAgentServer({
115
145
  root,
116
146
  api: async ({ req, res, pathname, cfg, jobs, sendJson, readJsonBody }) => {
@@ -192,7 +222,7 @@ createAgentServer({
192
222
  );
193
223
 
194
224
  const uploads = await saveUploads(cfg.workspace, job.id, body.files);
195
- brief.uploads = uploads.map((u) => ({ name: u.name, kind: u.kind }));
225
+ brief.uploads = uploads.map((u) => ({ name: u.name, kind: u.kind, role: u.role }));
196
226
  writeJson(path.join(projectDir, 'brief.json'), brief);
197
227
 
198
228
  const permitRes = await requestRunPermit(cfg, { projectPath: projectDir, jobId: job.id });
@@ -252,11 +282,33 @@ createAgentServer({
252
282
  projectPath = videoPath;
253
283
  }
254
284
 
285
+ // 附件落位:引擎只认工程目录里的 assets/,文档放项目 docs/ 供 Agent 读。
286
+ const placed = placeUploads(projectDir, projectPath, uploads);
287
+ brief.assets = placed.map((p) => ({ name: p.name, role: p.role, kind: p.kind, path: p.rel }));
288
+ brief.uploadDir = path.join(projectDir, 'assets', 'uploads');
289
+ writeJson(path.join(projectDir, 'brief.json'), brief);
290
+ if (path.resolve(projectPath) !== path.resolve(projectDir)) {
291
+ writeJson(path.join(projectPath, 'brief.json'), brief);
292
+ }
293
+
294
+ const byRole = (role) => placed.filter((p) => p.role === role);
295
+ const mediaAssets = byRole('media');
296
+ const voiceAssets = byRole('voice');
297
+ const musicAssets = byRole('music');
298
+ const docAssets = byRole('doc');
299
+ const assetLines = [
300
+ ...mediaAssets.map((p) => `Asset (image/video): ${p.rel}`),
301
+ ...voiceAssets.map((p) => `Narration recording (use as-is, provider "recording"): ${p.rel} — do not synthesize over it.`),
302
+ ...musicAssets.map((p) => `Music (user-licensed): ${p.rel} — set music.src, duck under narration.`),
303
+ ...docAssets.map((p) => `Document (facts only, not renderable): ${p.rel}`),
304
+ ];
305
+
255
306
  const kickoffPrompt = [
256
307
  'Follow the biutalk skill and finish the explainer film.',
257
308
  `Project folder: ${projectPath}`,
258
309
  `Read brief.json. Theme ${look}. Size ${size}. Pace ${pace}.`,
259
- voiceKickoffLine(voicePick),
310
+ ...assetLines,
311
+ voicePick && !voiceAssets.length ? voiceKickoffLine(voicePick) : '',
260
312
  audienceLine(prompt),
261
313
  `Creative brief: ${promptEn}`,
262
314
  'Read skills/biutalk/EXEC.md and follow it: doctor → scaffold → script.md → scenes.js → voice → check → still/sheet → render --draft → render → verify.',
package/manifest.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "schemaVersion": 1,
3
3
  "id": "biutalk",
4
4
  "name": "BiuTalk",
5
- "version": "2.0.1",
5
+ "version": "2.0.2",
6
6
  "publisher": "Biunow",
7
7
  "description": "BiuTalk 解说视频 Studio:模板、尺寸、附件与本地渲染引擎。",
8
8
  "entry": {
@@ -48,8 +48,8 @@
48
48
  "requiresEntitlement": "export"
49
49
  },
50
50
  "integrity": {
51
- "sha256": "9a8d1bfdbb9b22d3c8c783aa6d79f6df4a63f1f3dec25906834475aa02007a64",
52
- "signature": "dVzMrunsB5jFymT4/BZUuDwabnqq1ypjbol9lhTBo1bSOeJvcVvR+TiCtX7aOft+CkZ8qHz0atSrB+bfwPQ5DA==",
51
+ "sha256": "19bc0940cbcf7999563eb85f7d4e0ada65b3d3a5ccc96454c6e644bf9ec9a512",
52
+ "signature": "aq5RRRrOQ7or2EAdos2IsEgrCde6oA+IfCsYyV++4YEMvgfh7Wo9JpfT++U878l3hXNbjqvo4QD8EK8kj983DA==",
53
53
  "signedBy": "publisher-key"
54
54
  }
55
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biunow/agent-biutalk",
3
- "version": "2.0.1",
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。