@biunow/agent-biutalk 0.0.0-stage → 1.1.1

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 (227) hide show
  1. package/bin/server.js +355 -0
  2. package/engine/AGENTS.md +1414 -0
  3. package/engine/CLAUDE.md +1 -0
  4. package/engine/LICENSE +21 -0
  5. package/engine/README.md +216 -0
  6. package/engine/bin/explainroo.js +19 -0
  7. package/engine/dev/audio-lab.mjs +268 -0
  8. package/engine/docs/media/contact-sheet.jpg +0 -0
  9. package/engine/docs/media/dns-poster.jpg +0 -0
  10. package/engine/docs/media/intro-poster.jpg +0 -0
  11. package/engine/docs/media/logo-dark.png +0 -0
  12. package/engine/docs/media/logo-light.png +0 -0
  13. package/engine/docs/media/looks-dark.webp +0 -0
  14. package/engine/docs/media/looks-light.webp +0 -0
  15. package/engine/docs/media/product-demo.webp +0 -0
  16. package/engine/docs/media/rebase-poster.jpg +0 -0
  17. package/engine/docs/media/sizes-dark.webp +0 -0
  18. package/engine/docs/media/sizes-light.webp +0 -0
  19. package/engine/engine/audio/dsp.js +69 -0
  20. package/engine/engine/audio/instruments.js +147 -0
  21. package/engine/engine/audio/music.js +576 -0
  22. package/engine/engine/audio/pcm.js +93 -0
  23. package/engine/engine/audio/rng.js +40 -0
  24. package/engine/engine/audio/sfx.js +287 -0
  25. package/engine/engine/audio/soundtrack.js +201 -0
  26. package/engine/engine/audio/synth.js +721 -0
  27. package/engine/engine/audio/theory.js +105 -0
  28. package/engine/engine/audio/wav.js +47 -0
  29. package/engine/engine/captions.js +131 -0
  30. package/engine/engine/clips.js +107 -0
  31. package/engine/engine/code.js +179 -0
  32. package/engine/engine/director.js +475 -0
  33. package/engine/engine/frame.html +135 -0
  34. package/engine/engine/icons/LICENSE-lucide.txt +43 -0
  35. package/engine/engine/icons/lucide-tags.json +1 -0
  36. package/engine/engine/icons/lucide.json +1 -0
  37. package/engine/engine/layout.js +69 -0
  38. package/engine/engine/pathdata.js +234 -0
  39. package/engine/engine/pen.js +240 -0
  40. package/engine/engine/player.html +67 -0
  41. package/engine/engine/player.js +219 -0
  42. package/engine/engine/readability.js +9 -0
  43. package/engine/engine/runtime.js +690 -0
  44. package/engine/engine/stage.js +2247 -0
  45. package/engine/engine/studio.html +216 -0
  46. package/engine/engine/text.js +81 -0
  47. package/engine/engine/themes.js +360 -0
  48. package/engine/engine/transitions.js +161 -0
  49. package/engine/engine/ui.js +1042 -0
  50. package/engine/engine/upload.js +32 -0
  51. package/engine/engine/util.js +204 -0
  52. package/engine/examples/callbacks-to-async-await/code-versions.js +34 -0
  53. package/engine/examples/callbacks-to-async-await/scenes.js +106 -0
  54. package/engine/examples/callbacks-to-async-await/script.md +22 -0
  55. package/engine/examples/callbacks-to-async-await/video.json +16 -0
  56. package/engine/examples/circle-area/scenes.js +228 -0
  57. package/engine/examples/circle-area/script.md +37 -0
  58. package/engine/examples/circle-area/video.json +14 -0
  59. package/engine/examples/explainroo-intro/scenes.js +133 -0
  60. package/engine/examples/explainroo-intro/script.md +27 -0
  61. package/engine/examples/explainroo-intro/video.json +8 -0
  62. package/engine/examples/how-dns-works/scenes.js +130 -0
  63. package/engine/examples/how-dns-works/script.md +28 -0
  64. package/engine/examples/how-dns-works/video.json +8 -0
  65. package/engine/examples/leap-years/scenes.js +156 -0
  66. package/engine/examples/leap-years/script.md +25 -0
  67. package/engine/examples/leap-years/video.json +16 -0
  68. package/engine/examples/leap-years-ja/scenes.js +194 -0
  69. package/engine/examples/leap-years-ja/script.md +32 -0
  70. package/engine/examples/leap-years-ja/video.json +17 -0
  71. package/engine/examples/merge-vs-rebase/scenes.js +129 -0
  72. package/engine/examples/merge-vs-rebase/script.md +22 -0
  73. package/engine/examples/merge-vs-rebase/video.json +8 -0
  74. package/engine/examples/password-storage-zh/scenes.js +185 -0
  75. package/engine/examples/password-storage-zh/script.md +25 -0
  76. package/engine/examples/password-storage-zh/video.json +19 -0
  77. package/engine/examples/sqlite-demo/README.md +19 -0
  78. package/engine/examples/sqlite-demo/scenes.js +423 -0
  79. package/engine/examples/sqlite-demo/script.md +35 -0
  80. package/engine/examples/sqlite-demo/video.json +17 -0
  81. package/engine/examples/unspar-demo/assets/fonts/Figtree-400.woff2 +0 -0
  82. package/engine/examples/unspar-demo/assets/fonts/Figtree-500.woff2 +0 -0
  83. package/engine/examples/unspar-demo/assets/fonts/Figtree-600.woff2 +0 -0
  84. package/engine/examples/unspar-demo/assets/fonts/Figtree-700.woff2 +0 -0
  85. package/engine/examples/unspar-demo/assets/fonts/Figtree-OFL.txt +93 -0
  86. package/engine/examples/unspar-demo/assets/unspar-logo.svg +23 -0
  87. package/engine/examples/unspar-demo/scenes.js +367 -0
  88. package/engine/examples/unspar-demo/script.md +25 -0
  89. package/engine/examples/unspar-demo/video.json +21 -0
  90. package/engine/examples/why-is-the-sky-blue-es/scenes.js +160 -0
  91. package/engine/examples/why-is-the-sky-blue-es/script.md +22 -0
  92. package/engine/examples/why-is-the-sky-blue-es/video.json +15 -0
  93. package/engine/fonts/ArchitectsDaughter-400-latin-ext.woff2 +0 -0
  94. package/engine/fonts/ArchitectsDaughter-400-latin.woff2 +0 -0
  95. package/engine/fonts/CabinSketch-400-latin.woff2 +0 -0
  96. package/engine/fonts/CabinSketch-700-latin.woff2 +0 -0
  97. package/engine/fonts/InstrumentSerif-400-italic-latin-ext.woff2 +0 -0
  98. package/engine/fonts/InstrumentSerif-400-italic-latin.woff2 +0 -0
  99. package/engine/fonts/InstrumentSerif-400-normal-latin-ext.woff2 +0 -0
  100. package/engine/fonts/InstrumentSerif-400-normal-latin.woff2 +0 -0
  101. package/engine/fonts/Inter-400-latin-ext.woff2 +0 -0
  102. package/engine/fonts/Inter-400-latin.woff2 +0 -0
  103. package/engine/fonts/JetBrainsMono-400-latin-ext.woff2 +0 -0
  104. package/engine/fonts/JetBrainsMono-400-latin.woff2 +0 -0
  105. package/engine/fonts/Kalam-400-latin-ext.woff2 +0 -0
  106. package/engine/fonts/Kalam-400-latin.woff2 +0 -0
  107. package/engine/fonts/Kalam-700-latin-ext.woff2 +0 -0
  108. package/engine/fonts/Kalam-700-latin.woff2 +0 -0
  109. package/engine/fonts/NotoSansDevanagari-400.ttf +0 -0
  110. package/engine/fonts/NotoSansDevanagari-700.ttf +0 -0
  111. package/engine/fonts/PatrickHand-400-latin-ext.woff2 +0 -0
  112. package/engine/fonts/PatrickHand-400-latin.woff2 +0 -0
  113. package/engine/fonts/PlusJakartaSans-600-latin-ext.woff2 +0 -0
  114. package/engine/fonts/PlusJakartaSans-600-latin.woff2 +0 -0
  115. package/engine/fonts/SpaceGrotesk-500-latin-ext.woff2 +0 -0
  116. package/engine/fonts/SpaceGrotesk-500-latin.woff2 +0 -0
  117. package/engine/fonts/fonts.json +216 -0
  118. package/engine/fonts/licenses/ArchitectsDaughter-OFL.txt +93 -0
  119. package/engine/fonts/licenses/CabinSketch-OFL.txt +93 -0
  120. package/engine/fonts/licenses/InstrumentSerif-OFL.txt +93 -0
  121. package/engine/fonts/licenses/Inter-OFL.txt +93 -0
  122. package/engine/fonts/licenses/JetBrainsMono-OFL.txt +93 -0
  123. package/engine/fonts/licenses/Kalam-OFL.txt +93 -0
  124. package/engine/fonts/licenses/NotoSansDevanagari-OFL.txt +118 -0
  125. package/engine/fonts/licenses/PatrickHand-OFL.txt +93 -0
  126. package/engine/fonts/licenses/PlusJakartaSans-OFL.txt +93 -0
  127. package/engine/fonts/licenses/SpaceGrotesk-OFL.txt +93 -0
  128. package/engine/package-lock.json +1201 -0
  129. package/engine/package.json +67 -0
  130. package/engine/scripts/build-icons.mjs +74 -0
  131. package/engine/scripts/fetch-fonts.mjs +68 -0
  132. package/engine/skills/explainroo/SKILL.md +51 -0
  133. package/engine/src/align.js +357 -0
  134. package/engine/src/browser.js +121 -0
  135. package/engine/src/capture.js +315 -0
  136. package/engine/src/chapters.js +32 -0
  137. package/engine/src/cli.js +421 -0
  138. package/engine/src/clips.js +19 -0
  139. package/engine/src/elevenlabs.js +90 -0
  140. package/engine/src/env.js +16 -0
  141. package/engine/src/export.js +187 -0
  142. package/engine/src/ffmpeg.js +103 -0
  143. package/engine/src/fonts.js +86 -0
  144. package/engine/src/g2p.py +76 -0
  145. package/engine/src/images.js +151 -0
  146. package/engine/src/licenses/misaki-Apache-2.0.txt +201 -0
  147. package/engine/src/math.js +83 -0
  148. package/engine/src/models.js +161 -0
  149. package/engine/src/phonemes.js +162 -0
  150. package/engine/src/pipeline.js +63 -0
  151. package/engine/src/project.js +331 -0
  152. package/engine/src/qa.js +186 -0
  153. package/engine/src/recordings.js +89 -0
  154. package/engine/src/render.js +156 -0
  155. package/engine/src/script.js +266 -0
  156. package/engine/src/server.js +288 -0
  157. package/engine/src/subtitles.js +78 -0
  158. package/engine/src/timeline.js +55 -0
  159. package/engine/src/voice.js +240 -0
  160. package/engine/src/wav.js +98 -0
  161. package/engine/templates/starter/scenes.js +31 -0
  162. package/engine/templates/starter/script.md +14 -0
  163. package/engine/test/align.test.js +108 -0
  164. package/engine/test/brand.test.js +41 -0
  165. package/engine/test/browser.test.js +89 -0
  166. package/engine/test/camera-browser.test.js +225 -0
  167. package/engine/test/caption-phrases.test.js +35 -0
  168. package/engine/test/capture-browser.test.js +90 -0
  169. package/engine/test/capture-fixture.js +46 -0
  170. package/engine/test/capture.test.js +62 -0
  171. package/engine/test/chapters.test.js +41 -0
  172. package/engine/test/cjk-browser.test.js +101 -0
  173. package/engine/test/cjk.test.js +232 -0
  174. package/engine/test/cli-exit.test.js +25 -0
  175. package/engine/test/cli.test.js +116 -0
  176. package/engine/test/clips-browser.test.js +125 -0
  177. package/engine/test/clips.test.js +67 -0
  178. package/engine/test/code-morph-browser.test.js +99 -0
  179. package/engine/test/code-morph.test.js +110 -0
  180. package/engine/test/contrast-browser.test.js +63 -0
  181. package/engine/test/contrast.test.js +80 -0
  182. package/engine/test/director.test.js +316 -0
  183. package/engine/test/engine-pure.test.js +29 -0
  184. package/engine/test/export-browser.test.js +224 -0
  185. package/engine/test/export.test.js +96 -0
  186. package/engine/test/fixtures/capture.html +55 -0
  187. package/engine/test/formats-pace.test.js +104 -0
  188. package/engine/test/languages-browser.test.js +78 -0
  189. package/engine/test/languages.test.js +140 -0
  190. package/engine/test/looks-browser.test.js +109 -0
  191. package/engine/test/looks-preview.test.js +57 -0
  192. package/engine/test/looks.test.js +130 -0
  193. package/engine/test/math-browser.test.js +114 -0
  194. package/engine/test/math.test.js +54 -0
  195. package/engine/test/multi-size-browser.test.js +133 -0
  196. package/engine/test/multi-size.test.js +116 -0
  197. package/engine/test/phonemes.test.js +92 -0
  198. package/engine/test/readability-browser.test.js +36 -0
  199. package/engine/test/readability.test.js +20 -0
  200. package/engine/test/render-options.test.js +52 -0
  201. package/engine/test/script.test.js +67 -0
  202. package/engine/test/server.test.js +256 -0
  203. package/engine/test/stills-browser.test.js +70 -0
  204. package/engine/test/subtitles.test.js +83 -0
  205. package/engine/test/timeline.test.js +31 -0
  206. package/engine/test/transparent-browser.test.js +123 -0
  207. package/engine/test/ui-kit.test.js +96 -0
  208. package/engine/test/upload-browser.test.js +55 -0
  209. package/engine/test/voice-providers.test.js +338 -0
  210. package/lib/host.mjs +480 -0
  211. package/manifest.json +54 -0
  212. package/package.json +8 -4
  213. package/skills/biutalk/SKILL.md +21 -0
  214. package/studio/app.js +209 -0
  215. package/studio/assert-panel-permit.mjs +67 -0
  216. package/studio/composer.css +354 -0
  217. package/studio/composer.js +169 -0
  218. package/studio/index.html +82 -0
  219. package/studio/looks/blueprint.svg +21 -0
  220. package/studio/looks/chalk.svg +15 -0
  221. package/studio/looks/clean.svg +20 -0
  222. package/studio/looks/editorial.svg +18 -0
  223. package/studio/looks/midnight.svg +17 -0
  224. package/studio/looks/paper.svg +11 -0
  225. package/studio/select-menu.js +268 -0
  226. package/studio/styles.css +4 -0
  227. package/README.md +0 -3
@@ -0,0 +1,169 @@
1
+ /**
2
+ * Shared helpers for CreateDesk-style agent studios.
3
+ */
4
+ (function (global) {
5
+ function esc(s) {
6
+ return String(s || '')
7
+ .replace(/&/g, '&')
8
+ .replace(/</g, '&lt;')
9
+ .replace(/>/g, '&gt;')
10
+ .replace(/"/g, '&quot;');
11
+ }
12
+
13
+ const MAX_UPLOAD_BYTES = 20 * 1024 * 1024;
14
+
15
+ async function api(path, opts) {
16
+ const res = await fetch(path, opts);
17
+ const data = await res.json().catch(() => ({}));
18
+ if (!res.ok) {
19
+ const raw = data.error || res.statusText || '请求失败';
20
+ if (res.status === 413 || /body too large/i.test(raw)) {
21
+ throw new Error('附件超过 20MB,请压缩或裁短后再上传');
22
+ }
23
+ throw new Error(raw);
24
+ }
25
+ return data;
26
+ }
27
+
28
+ function uploadBlockReason(file, usedBytes) {
29
+ const name = file?.name || '附件';
30
+ const size = Number(file?.size) || 0;
31
+ if (size > MAX_UPLOAD_BYTES) return `${name} 超过 20MB,请压缩或裁短后再上传`;
32
+ if ((Number(usedBytes) || 0) + size > MAX_UPLOAD_BYTES) {
33
+ return `附件合计超过 20MB,${name} 未加入`;
34
+ }
35
+ return '';
36
+ }
37
+
38
+ function fileToBase64(file) {
39
+ return new Promise((resolve, reject) => {
40
+ const reader = new FileReader();
41
+ reader.onload = () => {
42
+ const result = String(reader.result || '');
43
+ const i = result.indexOf(',');
44
+ resolve(i >= 0 ? result.slice(i + 1) : result);
45
+ };
46
+ reader.onerror = reject;
47
+ reader.readAsDataURL(file);
48
+ });
49
+ }
50
+
51
+ function phaseLabel(j) {
52
+ if (j.outputMp4 || j.phase === 'film') return { text: '成片就绪', cls: 'ok' };
53
+ if (j.status === 'failed') return { text: '失败', cls: 'bad' };
54
+ if (j.phase === 'dsh' || (j.kickoffOk && j.status === 'running')) return { text: 'DSH 创作中', cls: 'run' };
55
+ if (j.phase === 'stalled') return { text: '待确认', cls: 'warn' };
56
+ if (j.status === 'running') return { text: '进行中', cls: 'run' };
57
+ if (j.status === 'done') return { text: '完成', cls: 'ok' };
58
+ return { text: j.status || '排队', cls: '' };
59
+ }
60
+
61
+ function bindPlusMenu(btn, menu) {
62
+ const close = () => {
63
+ menu.hidden = true;
64
+ btn.classList.remove('on');
65
+ };
66
+ btn.addEventListener('click', (e) => {
67
+ e.stopPropagation();
68
+ const open = menu.hidden;
69
+ menu.hidden = !open;
70
+ btn.classList.toggle('on', open);
71
+ });
72
+ document.addEventListener('click', () => close());
73
+ menu.addEventListener('click', (e) => e.stopPropagation());
74
+ return { close };
75
+ }
76
+
77
+ function bindCount(textarea, countEl, max) {
78
+ const sync = () => {
79
+ const n = textarea.value.length;
80
+ countEl.textContent = `${n}/${max}`;
81
+ };
82
+ textarea.addEventListener('input', sync);
83
+ sync();
84
+ }
85
+
86
+ function renderJobs(box, jobs, opts) {
87
+ const onDelete = opts && typeof opts.onDelete === 'function' ? opts.onDelete : null;
88
+ if (!jobs.length) {
89
+ box.innerHTML = '<p class="muted">还没有任务</p>';
90
+ return;
91
+ }
92
+ box.innerHTML = '';
93
+ jobs.forEach((j) => {
94
+ const phase = phaseLabel(j);
95
+ const sessionId = String(j.dshSessionId || '').trim();
96
+ const el = document.createElement('div');
97
+ el.className = 'job' + (phase.cls ? ' ' + phase.cls : '');
98
+ el.innerHTML = `
99
+ <div class="job-head">
100
+ <div class="t">${esc(j.title || j.kind)}${j.styleName ? ' · ' + esc(j.styleName) : ''}${
101
+ j.styleId ? ' · ' + esc(j.styleId) : ''
102
+ }</div>
103
+ <span class="badge ${phase.cls}">${esc(phase.text)}</span>
104
+ <button type="button" class="job-open" ${sessionId ? '' : 'disabled'} title="${sessionId ? '打开这次创作的对话' : '这次任务没有对话'}">任务详情</button>
105
+ <button type="button" class="job-del" title="从列表删除" aria-label="删除">×</button>
106
+ </div>
107
+ <div class="m">${esc(j.message || '')}</div>
108
+ <div class="bar"><i style="width:${Number(j.progress) || 0}%"></i></div>`;
109
+ const openBtn = el.querySelector('.job-open');
110
+ if (openBtn && sessionId) {
111
+ openBtn.addEventListener('click', (e) => {
112
+ e.preventDefault();
113
+ e.stopPropagation();
114
+ window.parent.postMessage({ source: 'bn-studio', type: 'open-session', sessionId }, '*');
115
+ });
116
+ }
117
+ const delBtn = el.querySelector('.job-del');
118
+ if (delBtn) {
119
+ delBtn.addEventListener('click', (e) => {
120
+ e.preventDefault();
121
+ e.stopPropagation();
122
+ if (!j.id) return;
123
+ if (onDelete) onDelete(j);
124
+ else {
125
+ void api('/api/jobs/' + encodeURIComponent(j.id), { method: 'DELETE' })
126
+ .then(() => {
127
+ el.remove();
128
+ if (!box.querySelector('.job')) box.innerHTML = '<p class="muted">还没有任务</p>';
129
+ })
130
+ .catch((err) => {
131
+ window.alert(err.message || '删除失败');
132
+ });
133
+ }
134
+ });
135
+ }
136
+ box.appendChild(el);
137
+ });
138
+ }
139
+
140
+ function addChip(container, text, cls) {
141
+ const c = document.createElement('span');
142
+ c.className = 'chip' + (cls ? ' ' + cls : '');
143
+ c.textContent = text;
144
+ container.appendChild(c);
145
+ }
146
+
147
+ function titleFromPrompt(prompt, fallback) {
148
+ const line = String(prompt || '')
149
+ .trim()
150
+ .split(/\n/)[0]
151
+ .replace(/^#+\s*/, '')
152
+ .trim();
153
+ return (line || fallback || '未命名成片').slice(0, 120);
154
+ }
155
+
156
+ global.Composer = {
157
+ esc,
158
+ api,
159
+ fileToBase64,
160
+ uploadBlockReason,
161
+ MAX_UPLOAD_BYTES,
162
+ phaseLabel,
163
+ bindPlusMenu,
164
+ bindCount,
165
+ renderJobs,
166
+ addChip,
167
+ titleFromPrompt,
168
+ };
169
+ })(window);
@@ -0,0 +1,82 @@
1
+ <!doctype html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>BiuTalk Studio</title>
7
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
8
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
9
+ <link href="https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap" rel="stylesheet" />
10
+ <link rel="stylesheet" href="/composer.css" />
11
+ <link rel="stylesheet" href="/styles.css" />
12
+ </head>
13
+ <body>
14
+ <div class="desk">
15
+ <div class="hero">
16
+ <div class="hero-copy">
17
+ <span class="eyebrow">BIUNOW · FILM ENGINE</span>
18
+ <h1>BIU一下,马上出片。</h1>
19
+ <p class="hero-desc" id="heroDesc">加载中…</p>
20
+ <div class="sub" id="health">加载中…</div>
21
+ </div>
22
+ <div class="hero-aside">
23
+ <div class="hero-badge">
24
+ <span>核心</span>
25
+ <strong>talk</strong>
26
+ <em>Look · Size · Pace</em>
27
+ </div>
28
+ <div class="chips" id="chips"></div>
29
+ </div>
30
+ </div>
31
+
32
+ <div class="layout">
33
+ <section class="composer" id="composer">
34
+ <div class="link-bar">
35
+ <input id="linkInput" class="link-input" type="url" placeholder="粘贴参考网址,回车添加" />
36
+ <button type="button" class="link-add" id="linkAdd" disabled>添加链接</button>
37
+ </div>
38
+ <textarea id="prompt" maxlength="4000" rows="7" placeholder="写清楚要讲什么:主题、受众、必须出现的事实或产品点。可多行。"></textarea>
39
+ <div class="composer-foot">
40
+ <div class="left-tools">
41
+ <div class="plus-wrap">
42
+ <button type="button" class="plus" id="plusBtn" aria-label="更多">
43
+ <svg viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M8 3.2v9.6M3.2 8h9.6" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg>
44
+ </button>
45
+ <div class="plus-menu" id="plusMenu" hidden>
46
+ <button type="button" id="uploadBtn">
47
+ <span class="plus-ico">↑</span>
48
+ <span><strong>上传附件</strong><small>图片 / 视频 / 音频 / 文档</small></span>
49
+ </button>
50
+ <button type="button" id="paceToggle">
51
+ <span class="plus-ico">⏱</span>
52
+ <span><strong>节奏</strong><small id="paceHint">1.0×</small></span>
53
+ </button>
54
+ </div>
55
+ </div>
56
+ <span class="count" id="count">0/4000</span>
57
+ <span class="size-label">尺寸</span>
58
+ <div id="sizePick" class="size-pick"></div>
59
+ </div>
60
+ <div class="right-tools">
61
+ <div id="lookPick" class="theme-pick"></div>
62
+ <button type="button" class="primary" id="create">马上 BIU</button>
63
+ </div>
64
+ </div>
65
+ <div class="assets" id="assets" hidden>
66
+ <span class="assets-label">素材</span>
67
+ </div>
68
+ <input id="files" class="file-hidden" type="file" multiple accept="audio/*,video/*,image/*,.pdf,.md,.txt,.doc,.docx" />
69
+ <p class="err" id="err" hidden></p>
70
+ </section>
71
+
72
+ <aside class="side">
73
+ <h2>任务</h2>
74
+ <div id="jobs" class="jobs"><p class="muted">还没有任务</p></div>
75
+ </aside>
76
+ </div>
77
+ </div>
78
+ <script src="/select-menu.js"></script>
79
+ <script src="/composer.js"></script>
80
+ <script src="/app.js"></script>
81
+ </body>
82
+ </html>
@@ -0,0 +1,21 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 480 270">
2
+ <rect width="480" height="270" fill="#1b3f8f"/>
3
+ <defs>
4
+ <pattern id="bpgrid" width="24" height="24" patternUnits="userSpaceOnUse">
5
+ <path d="M24 0H0V24" fill="none" stroke="#ffffff" stroke-opacity=".14"/>
6
+ </pattern>
7
+ </defs>
8
+ <rect width="480" height="270" fill="url(#bpgrid)"/>
9
+ <g stroke="#ffffff" fill="none" stroke-width="2">
10
+ <rect x="70" y="58" width="150" height="102"/>
11
+ <rect x="92" y="80" width="60" height="40"/>
12
+ <path d="M92 132 h60 M122 80 v40" stroke-width="1" opacity=".6"/>
13
+ <circle cx="342" cy="118" r="46"/>
14
+ <circle cx="342" cy="118" r="18"/>
15
+ <path d="M342 56 V38 M342 198 v-18 M280 118 h-18 M422 118 h-18"/>
16
+ <path d="M70 190 h150 M70 184 v12 M220 184 v12" stroke-width="1.5"/>
17
+ </g>
18
+ <text x="70" y="222" font-family="Consolas, 'Courier New', monospace" font-size="14" fill="#ffffff">SCALE 1:50 · REV A</text>
19
+ <text x="300" y="222" font-family="Consolas, 'Courier New', monospace" font-size="14" fill="#ffffff" opacity=".65">BP-480-270</text>
20
+ <rect x="402" y="36" width="40" height="14" fill="none" stroke="#ffffff" stroke-width="1.5"/>
21
+ </svg>
@@ -0,0 +1,15 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 480 270">
2
+ <rect width="480" height="270" fill="#21362d"/>
3
+ <rect x="14" y="14" width="452" height="242" rx="6" fill="#243a30" stroke="#c9b58a" stroke-width="6"/>
4
+ <g stroke="#f4f1e6" stroke-linecap="round" fill="none">
5
+ <path d="M60 68 q50 -14 120 -4" stroke-width="4" opacity=".95"/>
6
+ <path d="M60 94 q70 8 150 -2" stroke-width="3" opacity=".5"/>
7
+ <path d="M240 208 V96 M230 198 H404" stroke-width="3" opacity=".8"/>
8
+ <path d="M252 188 C 292 118 332 198 382 128" stroke-width="4"/>
9
+ </g>
10
+ <text x="62" y="156" font-family="Georgia, serif" font-size="30" font-style="italic" fill="#f4f1e6">E = mc²</text>
11
+ <text x="62" y="192" font-family="Georgia, serif" font-size="16" fill="#f4f1e6" opacity=".55">chalk · 教学黑板</text>
12
+ <circle cx="412" cy="70" r="3" fill="#f4f1e6" opacity=".5"/>
13
+ <circle cx="422" cy="84" r="2" fill="#f4f1e6" opacity=".35"/>
14
+ <path d="M300 236 h120" stroke="#c9b58a" stroke-width="7" stroke-linecap="round" opacity=".8"/>
15
+ </svg>
@@ -0,0 +1,20 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 480 270">
2
+ <rect width="480" height="270" fill="#fbfbfa"/>
3
+ <rect x="40" y="44" width="180" height="14" rx="7" fill="#111111"/>
4
+ <rect x="40" y="68" width="120" height="10" rx="5" fill="#c9c9c5"/>
5
+ <circle cx="428" cy="56" r="18" fill="#2f6fed" opacity=".12"/>
6
+ <circle cx="428" cy="56" r="7" fill="#2f6fed"/>
7
+ <rect x="40" y="104" width="120" height="74" rx="12" fill="#ffffff" stroke="#e4e4e0"/>
8
+ <rect x="180" y="104" width="120" height="74" rx="12" fill="#ffffff" stroke="#e4e4e0"/>
9
+ <rect x="320" y="104" width="120" height="74" rx="12" fill="#ffffff" stroke="#e4e4e0"/>
10
+ <rect x="52" y="116" width="34" height="34" rx="8" fill="#eef3ff"/>
11
+ <rect x="52" y="158" width="84" height="8" rx="4" fill="#d9d9d5"/>
12
+ <circle cx="206" cy="133" r="17" fill="#2f6fed" opacity=".16"/>
13
+ <rect x="192" y="158" width="84" height="8" rx="4" fill="#d9d9d5"/>
14
+ <rect x="332" y="116" width="60" height="8" rx="4" fill="#111111"/>
15
+ <rect x="332" y="132" width="84" height="8" rx="4" fill="#d9d9d5"/>
16
+ <rect x="332" y="148" width="70" height="8" rx="4" fill="#e7e7e3"/>
17
+ <rect x="40" y="198" width="400" height="1.5" fill="#eaeae6"/>
18
+ <rect x="40" y="214" width="96" height="26" rx="13" fill="#111111"/>
19
+ <rect x="146" y="214" width="96" height="26" rx="13" fill="#ffffff" stroke="#dcdcd8"/>
20
+ </svg>
@@ -0,0 +1,18 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 480 270">
2
+ <rect width="480" height="270" fill="#f5f0e4"/>
3
+ <text x="40" y="56" font-family="Georgia, 'Songti SC', serif" font-size="15" letter-spacing="4" fill="#b3341f">THE DAILY REVIEW</text>
4
+ <path d="M40 70 H440" stroke="#191713" stroke-width="2"/>
5
+ <text x="40" y="116" font-family="Georgia, 'Songti SC', serif" font-size="34" font-weight="bold" fill="#191713">Markets, History</text>
6
+ <text x="40" y="152" font-family="Georgia, 'Songti SC', serif" font-size="34" font-weight="bold" fill="#191713">&amp; Ideas</text>
7
+ <g fill="#8a8378">
8
+ <rect x="40" y="176" width="120" height="6"/>
9
+ <rect x="40" y="188" width="120" height="6"/>
10
+ <rect x="40" y="200" width="100" height="6"/>
11
+ <rect x="180" y="176" width="120" height="6"/>
12
+ <rect x="180" y="188" width="120" height="6"/>
13
+ <rect x="180" y="200" width="86" height="6"/>
14
+ </g>
15
+ <rect x="330" y="158" width="110" height="70" fill="#e7dfcd"/>
16
+ <path d="M340 218 l22 -24 18 14 26 -30 24 40 z" fill="#b3341f" opacity=".85"/>
17
+ <path d="M40 238 H440" stroke="#191713"/>
18
+ </svg>
@@ -0,0 +1,17 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 480 270">
2
+ <rect width="480" height="270" fill="#0c1017"/>
3
+ <circle cx="400" cy="200" r="60" fill="#7ee787" opacity=".07"/>
4
+ <circle cx="80" cy="60" r="70" fill="#79c0ff" opacity=".05"/>
5
+ <rect x="40" y="40" width="400" height="190" rx="10" fill="#11161f" stroke="#232b3a"/>
6
+ <circle cx="62" cy="59" r="5" fill="#ff5f57"/>
7
+ <circle cx="80" cy="59" r="5" fill="#febc2e"/>
8
+ <circle cx="98" cy="59" r="5" fill="#28c840"/>
9
+ <path d="M52 74 H428" stroke="#232b3a"/>
10
+ <g font-family="Consolas, 'Courier New', monospace" font-size="15">
11
+ <text x="60" y="100" fill="#7ee787">$ biu render --look midnight</text>
12
+ <text x="60" y="128" fill="#8b98b8">▸ parsing scenes… <tspan fill="#d2a8ff">ok</tspan></text>
13
+ <text x="60" y="156" fill="#8b98b8">▸ composing frames <tspan fill="#79c0ff">1920×1080</tspan></text>
14
+ <text x="60" y="184" fill="#8b98b8">▸ export <tspan fill="#7ee787">done in 42s</tspan></text>
15
+ </g>
16
+ <rect x="60" y="196" width="10" height="16" fill="#7ee787"/>
17
+ </svg>
@@ -0,0 +1,11 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 480 270">
2
+ <rect width="480" height="270" fill="#f8f4ea"/>
3
+ <path d="M30 34 C120 28 340 30 452 36 C456 110 454 190 450 238 C330 244 140 242 32 238 C26 170 28 100 30 34 Z" fill="#fffdf7" stroke="#2b2620" stroke-width="2.5" stroke-linecap="round"/>
4
+ <path d="M118 96 c22 -14 56 -10 66 12 c10 24 -8 52 -36 55 c-28 4 -52 -16 -50 -42 c1 -12 8 -21 20 -25" fill="none" stroke="#2b2620" stroke-width="3" stroke-linecap="round"/>
5
+ <path d="M204 132 C 240 130 268 124 298 116 M286 104 l16 10 -18 8" fill="none" stroke="#2b2620" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
6
+ <path d="M322 152 h108" stroke="#f2c94c" stroke-width="13" stroke-linecap="round" opacity=".65"/>
7
+ <text x="322" y="148" font-family="Georgia, 'Songti SC', serif" font-size="22" fill="#2b2620">Sketch note</text>
8
+ <path d="M322 192 q40 -10 96 0 M322 210 q30 8 70 -2" stroke="#2b2620" stroke-width="2.5" fill="none" stroke-linecap="round"/>
9
+ <path d="M404 58 l4 10 10 2 -8 7 3 10 -9 -6 -9 6 3 -10 -8 -7 10 -2 z" fill="none" stroke="#2b2620" stroke-width="2" stroke-linejoin="round"/>
10
+ <path d="M66 216 q26 -8 52 0" stroke="#2b2620" stroke-width="2.5" fill="none" stroke-linecap="round" opacity=".5"/>
11
+ </svg>
@@ -0,0 +1,268 @@
1
+ /**
2
+ * Vanilla SelectMenu — Biunow CreateDesk SelectMenu 移植(缩略图网格 + 悬浮预览)
3
+ * usage: const sm = SelectMenu.mount(el, { value, options, size, onChange })
4
+ */
5
+ (function (global) {
6
+ const PREVIEW_W = 340;
7
+ const PREVIEW_H = 320;
8
+
9
+ function esc(s) {
10
+ return String(s || '')
11
+ .replace(/&/g, '&amp;')
12
+ .replace(/</g, '&lt;')
13
+ .replace(/>/g, '&gt;')
14
+ .replace(/"/g, '&quot;');
15
+ }
16
+
17
+ function SelectMenu(opts) {
18
+ this.opts = opts || {};
19
+ this.value = this.opts.value || '';
20
+ this.options = this.opts.options || [];
21
+ this.size = this.opts.size || 'sm';
22
+ this.placeholder = this.opts.placeholder || '请选择';
23
+ this.open = false;
24
+ this.activeIndex = 0;
25
+ this.dropUp = false;
26
+ this.pos = { left: 0, top: 0, bottom: 0, width: 0 };
27
+ this.previewIndex = -1;
28
+ this.hoverTop = 0;
29
+ this._previewTimer = null;
30
+ this.root = null;
31
+ this.trigger = null;
32
+ this.panel = null;
33
+ this.previewEl = null;
34
+ }
35
+
36
+ SelectMenu.mount = function (host, opts) {
37
+ const sm = new SelectMenu(opts);
38
+ sm.mount(host);
39
+ return sm;
40
+ };
41
+
42
+ SelectMenu.prototype.gridMode = function () {
43
+ return this.options.some((o) => !!o.thumb);
44
+ };
45
+
46
+ SelectMenu.prototype.selected = function () {
47
+ return this.options.find((o) => o.value === this.value) || null;
48
+ };
49
+
50
+ SelectMenu.prototype.mount = function (host) {
51
+ this.root = typeof host === 'string' ? document.querySelector(host) : host;
52
+ if (!this.root) throw new Error('SelectMenu host missing');
53
+ this.root.classList.add('sm');
54
+ this.root.innerHTML = '';
55
+ this.trigger = document.createElement('button');
56
+ this.trigger.type = 'button';
57
+ this.trigger.className = `sm-trigger sm-${this.size}`;
58
+ this.trigger.setAttribute('aria-haspopup', 'listbox');
59
+ this.trigger.addEventListener('click', (e) => {
60
+ e.stopPropagation();
61
+ this.toggle();
62
+ });
63
+ this.root.appendChild(this.trigger);
64
+ this.renderTrigger();
65
+ this._onDoc = (e) => {
66
+ if (!this.open) return;
67
+ const t = e.target;
68
+ if (this.root.contains(t) || this.panel?.contains(t)) return;
69
+ this.close();
70
+ };
71
+ this._onRepo = () => {
72
+ if (this.open) this.measure();
73
+ };
74
+ };
75
+
76
+ SelectMenu.prototype.setOptions = function (options, value) {
77
+ this.options = options || [];
78
+ if (value !== undefined) this.value = value;
79
+ if (!this.options.some((o) => o.value === this.value) && this.options[0]) {
80
+ this.value = this.options[0].value;
81
+ }
82
+ this.renderTrigger();
83
+ if (this.open) this.renderPanel();
84
+ };
85
+
86
+ SelectMenu.prototype.setValue = function (value, silent) {
87
+ this.value = value;
88
+ this.renderTrigger();
89
+ if (!silent && typeof this.opts.onChange === 'function') this.opts.onChange(this.value);
90
+ };
91
+
92
+ SelectMenu.prototype.renderTrigger = function () {
93
+ const sel = this.selected();
94
+ const thumb = sel?.thumb
95
+ ? `<span class="sm-thumb sm-thumb-trigger"><img src="${esc(sel.thumb)}" alt=""/></span>`
96
+ : '';
97
+ const hint = sel?.hint && !this.gridMode()
98
+ ? `<span class="sm-hint">${esc(sel.hint)}</span>`
99
+ : '';
100
+ this.trigger.classList.toggle('on', this.open);
101
+ this.trigger.innerHTML = `${thumb}<span class="sm-value${sel ? '' : ' placeholder'}">${esc(
102
+ sel ? sel.label : this.placeholder,
103
+ )}</span>${hint}<svg class="sm-chevron${this.open ? ' on' : ''}" viewBox="0 0 16 16" fill="none"><path d="M4 6l4 4 4-4" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>`;
104
+ };
105
+
106
+ SelectMenu.prototype.measure = function () {
107
+ const r = this.trigger.getBoundingClientRect();
108
+ const vw = window.innerWidth;
109
+ const vh = window.innerHeight;
110
+ const grid = this.gridMode();
111
+ const minWidth = grid ? 404 : 210;
112
+ const width = Math.min(Math.max(r.width, minWidth), vw - 24);
113
+ const left = Math.min(Math.max(12, r.left), Math.max(12, vw - width - 12));
114
+ const estHeight = grid
115
+ ? Math.min(430, Math.ceil(this.options.length / 3) * 96 + 14)
116
+ : Math.min(300, this.options.length * 38 + 12);
117
+ this.dropUp = vh - r.bottom < estHeight + 14 && r.top > estHeight + 14;
118
+ this.pos = { left, width, top: r.bottom + 6, bottom: vh - r.top + 6 };
119
+ if (this.panel) {
120
+ this.panel.style.left = `${left}px`;
121
+ this.panel.style.width = `${width}px`;
122
+ if (this.dropUp) {
123
+ this.panel.style.bottom = `${this.pos.bottom}px`;
124
+ this.panel.style.top = 'auto';
125
+ } else {
126
+ this.panel.style.top = `${this.pos.top}px`;
127
+ this.panel.style.bottom = 'auto';
128
+ }
129
+ }
130
+ };
131
+
132
+ SelectMenu.prototype.toggle = function () {
133
+ if (this.open) this.close();
134
+ else this.openAt(Math.max(0, this.options.findIndex((o) => o.value === this.value)));
135
+ };
136
+
137
+ SelectMenu.prototype.openAt = function (index) {
138
+ this.activeIndex = index;
139
+ this.open = true;
140
+ this.renderTrigger();
141
+ this.renderPanel();
142
+ this.measure();
143
+ document.addEventListener('pointerdown', this._onDoc, true);
144
+ window.addEventListener('resize', this._onRepo);
145
+ window.addEventListener('scroll', this._onRepo, true);
146
+ };
147
+
148
+ SelectMenu.prototype.close = function () {
149
+ this.open = false;
150
+ this.hidePreview();
151
+ this.renderTrigger();
152
+ if (this.panel) {
153
+ this.panel.remove();
154
+ this.panel = null;
155
+ }
156
+ if (this.previewEl) {
157
+ this.previewEl.remove();
158
+ this.previewEl = null;
159
+ }
160
+ document.removeEventListener('pointerdown', this._onDoc, true);
161
+ window.removeEventListener('resize', this._onRepo);
162
+ window.removeEventListener('scroll', this._onRepo, true);
163
+ };
164
+
165
+ SelectMenu.prototype.hidePreview = function () {
166
+ if (this._previewTimer) clearTimeout(this._previewTimer);
167
+ this._previewTimer = null;
168
+ this.previewIndex = -1;
169
+ if (this.previewEl) {
170
+ this.previewEl.remove();
171
+ this.previewEl = null;
172
+ }
173
+ };
174
+
175
+ SelectMenu.prototype.schedulePreview = function (index, top) {
176
+ this.hoverTop = top;
177
+ if (this._previewTimer) clearTimeout(this._previewTimer);
178
+ this._previewTimer = setTimeout(() => {
179
+ this.previewIndex = index;
180
+ this.renderPreview();
181
+ }, 250);
182
+ };
183
+
184
+ SelectMenu.prototype.renderPreview = function () {
185
+ if (!this.open || !this.gridMode() || this.previewIndex < 0) {
186
+ if (this.previewEl) {
187
+ this.previewEl.remove();
188
+ this.previewEl = null;
189
+ }
190
+ return;
191
+ }
192
+ const opt = this.options[this.previewIndex];
193
+ if (!opt) return;
194
+ if (!this.previewEl) {
195
+ this.previewEl = document.createElement('div');
196
+ this.previewEl.className = 'sm-preview';
197
+ document.body.appendChild(this.previewEl);
198
+ }
199
+ const vw = window.innerWidth;
200
+ const vh = window.innerHeight;
201
+ let left = this.pos.left - PREVIEW_W - 10;
202
+ if (left < 12) left = this.pos.left + this.pos.width + 10;
203
+ const top = Math.min(Math.max(12, this.hoverTop - 46), Math.max(12, vh - PREVIEW_H - 12));
204
+ this.previewEl.style.left = `${left}px`;
205
+ this.previewEl.style.top = `${top}px`;
206
+ this.previewEl.style.width = `${PREVIEW_W}px`;
207
+ const img = opt.thumb
208
+ ? `<img src="${esc(opt.thumb)}" alt=""/>`
209
+ : `<span class="sm-thumb-ph">${esc((opt.label || '?').slice(0, 1))}</span>`;
210
+ this.previewEl.innerHTML = `<div class="sm-preview-img">${img}</div><div class="sm-preview-body"><div class="sm-preview-title"><strong>${esc(
211
+ opt.label,
212
+ )}</strong>${opt.hint ? `<span class="sm-preview-hint">${esc(opt.hint)}</span>` : ''}</div>${
213
+ opt.desc ? `<p class="sm-preview-desc">${esc(opt.desc)}</p>` : ''
214
+ }</div>`;
215
+ };
216
+
217
+ SelectMenu.prototype.renderPanel = function () {
218
+ if (!this.panel) {
219
+ this.panel = document.createElement('div');
220
+ this.panel.className = 'sm-panel';
221
+ this.panel.setAttribute('role', 'listbox');
222
+ this.panel.tabIndex = -1;
223
+ document.body.appendChild(this.panel);
224
+ }
225
+ const grid = this.gridMode();
226
+ const scroll = document.createElement('div');
227
+ scroll.className = 'sm-scroll' + (grid ? ' grid' : '');
228
+ this.options.forEach((opt, i) => {
229
+ const btn = document.createElement('button');
230
+ btn.type = 'button';
231
+ btn.className =
232
+ 'sm-option' +
233
+ (i === this.activeIndex ? ' on' : '') +
234
+ (opt.value === this.value ? ' picked' : '') +
235
+ (grid ? ' tile' : '');
236
+ btn.setAttribute('role', 'option');
237
+ let html = '';
238
+ if (grid) {
239
+ html += opt.thumb
240
+ ? `<span class="sm-thumb"><img src="${esc(opt.thumb)}" alt="" loading="lazy"/></span>`
241
+ : `<span class="sm-thumb"><span class="sm-thumb-ph">${esc((opt.label || '?').slice(0, 1))}</span></span>`;
242
+ }
243
+ html += `<span class="sm-opt-label">${esc(opt.label)}</span>`;
244
+ if (opt.hint && !grid) html += `<span class="sm-opt-hint">${esc(opt.hint)}</span>`;
245
+ if (opt.value === this.value) html += `<span class="sm-check">✓</span>`;
246
+ btn.innerHTML = html;
247
+ btn.addEventListener('mouseenter', (e) => {
248
+ this.activeIndex = i;
249
+ scroll.querySelectorAll('.sm-option').forEach((el, idx) => {
250
+ el.classList.toggle('on', idx === i);
251
+ });
252
+ if (grid) this.schedulePreview(i, e.currentTarget.getBoundingClientRect().top);
253
+ });
254
+ btn.addEventListener('click', () => this.pick(opt.value));
255
+ scroll.appendChild(btn);
256
+ });
257
+ scroll.addEventListener('mouseleave', () => this.hidePreview());
258
+ this.panel.innerHTML = '';
259
+ this.panel.appendChild(scroll);
260
+ };
261
+
262
+ SelectMenu.prototype.pick = function (value) {
263
+ this.setValue(value);
264
+ this.close();
265
+ };
266
+
267
+ global.SelectMenu = SelectMenu;
268
+ })(window);
@@ -0,0 +1,4 @@
1
+ /* BiuTalk — agent-specific overrides on shared composer.css */
2
+ .look-thumb-fallback {
3
+ background: linear-gradient(135deg, #111, #333);
4
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.