@biunow/agent-biutalk 1.1.7 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/_shared/.tmp-panel-smoke/art/smoke.mp4 +0 -0
  2. package/_shared/.tmp-panel-smoke/art-pipe/out/biuart-01_cave-mwq5kfpm.mp4 +0 -0
  3. package/_shared/.tmp-panel-smoke/art-pipe/panel-delivery.json +7 -0
  4. package/_shared/.tmp-panel-smoke/reel-pipe/film/index.html +7 -0
  5. package/_shared/.tmp-panel-smoke/reel-pipe/film/main.js +68 -0
  6. package/_shared/.tmp-panel-smoke/reel-pipe/film/panel-beats.json +20 -0
  7. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/CREDITS +20 -0
  8. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/build.sh +17 -0
  9. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/ease.js +43 -0
  10. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/events.json +1 -0
  11. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/film.js +533 -0
  12. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/fonts/OFL-Archivo.txt +93 -0
  13. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/fonts/OFL-DMSerifDisplay.txt +93 -0
  14. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/fonts/OFL-UnifrakturMaguntia.txt +94 -0
  15. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/fonts/fonts.css +3 -0
  16. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/index.html +6 -0
  17. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/lines.json +10 -0
  18. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/main.js +15 -0
  19. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/mix.py +116 -0
  20. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/music/score.py +168 -0
  21. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/music/score_meta.json +59 -0
  22. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/score.json +235 -0
  23. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/stills/styleframe.jpg +0 -0
  24. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/tools/fonts.sh +17 -0
  25. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/tools/subs.py +11 -0
  26. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/tools/words.py +20 -0
  27. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/voices/dur.json +10 -0
  28. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/voices/words.json +213 -0
  29. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/voices/words_rel.json +56 -0
  30. package/_shared/.tmp-panel-smoke/reel-pipe/style-ref.json +5 -0
  31. package/_shared/.tmp-panel-smoke/reel-pipe2/film/index.html +7 -0
  32. package/_shared/.tmp-panel-smoke/reel-pipe2/film/main.js +68 -0
  33. package/_shared/.tmp-panel-smoke/reel-pipe2/film/panel-beats.json +20 -0
  34. package/_shared/.tmp-panel-smoke/reel-pipe2/out/video.mp4 +0 -0
  35. package/_shared/.tmp-panel-smoke/reel-pipe2/panel-delivery.json +8 -0
  36. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/CREDITS +20 -0
  37. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/build.sh +17 -0
  38. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/ease.js +43 -0
  39. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/events.json +1 -0
  40. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/film.js +533 -0
  41. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/fonts/OFL-Archivo.txt +93 -0
  42. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/fonts/OFL-DMSerifDisplay.txt +93 -0
  43. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/fonts/OFL-UnifrakturMaguntia.txt +94 -0
  44. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/fonts/fonts.css +3 -0
  45. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/index.html +6 -0
  46. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/lines.json +10 -0
  47. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/main.js +15 -0
  48. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/mix.py +116 -0
  49. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/music/score.py +168 -0
  50. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/music/score_meta.json +59 -0
  51. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/score.json +235 -0
  52. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/stills/styleframe.jpg +0 -0
  53. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/tools/fonts.sh +17 -0
  54. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/tools/subs.py +11 -0
  55. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/tools/words.py +20 -0
  56. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/voices/dur.json +10 -0
  57. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/voices/words.json +213 -0
  58. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/voices/words_rel.json +56 -0
  59. package/_shared/.tmp-panel-smoke/reel-pipe2/style-ref.json +5 -0
  60. package/_shared/.tmp-panel-smoke/remo-pipe/brief.md +2 -0
  61. package/_shared/.tmp-panel-smoke/remo-pipe/remo-job.json +4 -0
  62. package/_shared/.tmp-panel-smoke/remo-pipe2/brief.md +1 -0
  63. package/_shared/.tmp-panel-smoke/remo-pipe2/out/final.mp4 +0 -0
  64. package/_shared/.tmp-panel-smoke/remo-pipe2/panel-delivery.json +8 -0
  65. package/_shared/.tmp-panel-smoke/remo-pipe2/remo-job.json +4 -0
  66. package/_shared/.tmp-panel-smoke/vibe-pipe-ok/ep00-demo.mp4 +0 -0
  67. package/_shared/.tmp-panel-smoke/vibe-pipe-ok/out/ep00-demo.mp4 +0 -0
  68. package/_shared/.tmp-panel-smoke/vibe-pipe-ok/panel-delivery.json +7 -0
  69. package/_shared/.tmp-panel-smoke/vibe-pipe-ok/publish.json +10 -0
  70. package/_shared/.tmp-panel-smoke/vibe-still.jpg +0 -0
  71. package/_shared/.tmp-panel-smoke/vibe-still.log +6 -0
  72. package/_shared/.tmp-panel-smoke/vibe-still.log.err +0 -0
  73. package/_shared/.tmp-panel-smoke/vibe-still2.log +26 -0
  74. package/_shared/.tmp-panel-smoke/vibe-still2.log.err +0 -0
  75. package/_shared/lib/film-locate.mjs +203 -0
  76. package/_shared/lib/voice-catalog.mjs +127 -0
  77. package/_shared/scripts/apply-upload-limits.mjs +62 -0
  78. package/_shared/scripts/patch-film-hosts.mjs +233 -0
  79. package/_shared/scripts/patch-voice-options.mjs +41 -0
  80. package/_shared/scripts/sync-local-agents.mjs +67 -0
  81. package/_shared/scripts/wire-film-bridge.mjs +24 -0
  82. package/_shared/scripts/wire-voice-plus.mjs +68 -0
  83. package/_shared/studio/assert-panel-permit.mjs +67 -0
  84. package/_shared/studio/composer.css +559 -0
  85. package/_shared/studio/composer.js +728 -0
  86. package/_shared/studio/optimize-prompt.mjs +84 -0
  87. package/_shared/studio/optimize-prompt.test.mjs +47 -0
  88. package/_shared/studio/recipes.mjs +87 -0
  89. package/_shared/studio/select-menu.js +450 -0
  90. package/_shared/studio/to-english-prompt.mjs +165 -0
  91. package/_shared/studio/to-english-prompt.test.mjs +72 -0
  92. package/bin/server.js +22 -22
  93. package/data/looks.json +8 -0
  94. package/lib/film-bridge.mjs +1 -0
  95. package/lib/host.mjs +131 -264
  96. package/lib/voice-bridge.mjs +2 -0
  97. package/manifest.json +4 -3
  98. package/package.json +1 -1
  99. package/skills/biutalk/EXEC.md +69 -0
  100. package/skills/biutalk/SKILL.md +12 -10
  101. package/skills/biutalk/scripts/doctor.mjs +124 -0
  102. package/skills/biutalk/scripts/qc.mjs +129 -0
  103. package/skills/biutalk/scripts/scaffold.mjs +205 -0
  104. package/studio/app.js +16 -1
  105. package/studio/composer.css +94 -0
  106. package/studio/composer.js +257 -9
  107. package/studio/index.html +5 -1
  108. package/studio/to-english-prompt.mjs +16 -0
@@ -0,0 +1,41 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+
5
+ const products = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');
6
+ const agents = ['biuremtion', 'biureel', 'biutalk', 'biuvibe', 'biuart'];
7
+ const bridge = "export { buildVoiceOptionsFromEnv, FREE_VOICES, VOICE_RATES } from '../../_shared/lib/voice-catalog.mjs';\n";
8
+ const importLine =
9
+ "import { buildVoiceOptionsFromEnv } from './voice-bridge.mjs';\n";
10
+ const routeSnippet = `
11
+ if (pathname === '/api/voice-options' && req.method === 'GET') {
12
+ return sendJson(res, 200, buildVoiceOptionsFromEnv(process.env));
13
+ }
14
+ `;
15
+
16
+ for (const id of agents) {
17
+ const lib = path.join(products, id, 'lib');
18
+ fs.writeFileSync(path.join(lib, 'voice-bridge.mjs'), bridge);
19
+ const host = path.join(lib, 'host.mjs');
20
+ let src = fs.readFileSync(host, 'utf8');
21
+ if (!src.includes("voice-bridge.mjs")) {
22
+ const idx = src.lastIndexOf('import ');
23
+ const end = src.indexOf('\n', idx);
24
+ src = src.slice(0, end + 1) + importLine + src.slice(end + 1);
25
+ }
26
+ if (!src.includes("/api/voice-options")) {
27
+ src = src.replace(
28
+ /if \(pathname === '\/api\/health'\) \{[\s\S]*?return sendJson\(res, 200, \{[\s\S]*?\}\);\s*\n\s*\}/,
29
+ (block) => `${block}\n${routeSnippet}`,
30
+ );
31
+ }
32
+ // ensure body limit
33
+ if (!src.includes('300 * 1024 * 1024')) {
34
+ src = src.replace(
35
+ /buf = await readBody\(req, \d+ \* 1024 \* 1024\);/g,
36
+ 'buf = await readBody(req, 300 * 1024 * 1024);',
37
+ );
38
+ }
39
+ fs.writeFileSync(host, src);
40
+ console.log('voice-options', id);
41
+ }
@@ -0,0 +1,67 @@
1
+ /**
2
+ * 把源码 Agent + _shared 同步到本机已安装目录(panel-data / DSH-PANEL)。
3
+ * 安装树内 film-bridge 改为 ../_shared(包内布局)。
4
+ */
5
+ import fs from 'node:fs';
6
+ import path from 'node:path';
7
+ import { fileURLToPath } from 'node:url';
8
+ import { spawnSync } from 'node:child_process';
9
+
10
+ const products = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');
11
+ const sharedSrc = path.join(products, '_shared');
12
+ const agents = ['biuremtion', 'biureel', 'biutalk', 'biuvibe', 'biuart'];
13
+
14
+ function currentVersion(agentsRoot, id) {
15
+ const cur = path.join(agentsRoot, id, 'current.json');
16
+ if (fs.existsSync(cur)) {
17
+ try {
18
+ return String(JSON.parse(fs.readFileSync(cur, 'utf8')).version || '');
19
+ } catch {
20
+ /* ignore */
21
+ }
22
+ }
23
+ const base = path.join(agentsRoot, id);
24
+ if (!fs.existsSync(base)) return '';
25
+ const dirs = fs.readdirSync(base).filter((n) => fs.statSync(path.join(base, n)).isDirectory());
26
+ return dirs.sort().at(-1) || '';
27
+ }
28
+
29
+ function copyAgent(id, destRoot) {
30
+ const version = currentVersion(destRoot, id);
31
+ if (!version) {
32
+ console.log('skip (not installed)', destRoot, id);
33
+ return;
34
+ }
35
+ const dest = path.join(destRoot, id, version);
36
+ const src = path.join(products, id);
37
+ spawnSync('robocopy', [src, dest, '/E', '/XD', 'node_modules', '.git', 'workspace', '.tmp'], {
38
+ stdio: 'ignore',
39
+ windowsHide: true,
40
+ });
41
+ const sharedDest = path.join(dest, '_shared');
42
+ spawnSync('robocopy', [sharedSrc, sharedDest, '/E', '/XD', 'node_modules', '.git', 'scripts'], {
43
+ stdio: 'ignore',
44
+ windowsHide: true,
45
+ });
46
+ const filmBridge = path.join(dest, 'lib', 'film-bridge.mjs');
47
+ if (fs.existsSync(filmBridge)) {
48
+ fs.writeFileSync(filmBridge, "export * from '../_shared/lib/film-locate.mjs';\n");
49
+ }
50
+ const voiceBridge = path.join(dest, 'lib', 'voice-bridge.mjs');
51
+ if (fs.existsSync(voiceBridge)) {
52
+ fs.writeFileSync(
53
+ voiceBridge,
54
+ "export { buildVoiceOptionsFromEnv, FREE_VOICES, VOICE_RATES, normalizeVoicePick, voiceKickoffLine } from '../_shared/lib/voice-catalog.mjs';\n",
55
+ );
56
+ }
57
+ console.log('synced', dest);
58
+ }
59
+
60
+ const homes = [
61
+ path.join(process.env.LOCALAPPDATA || '', 'DSH-PANEL', 'agents'),
62
+ 'E:\\BiunowPanel\\BiunowPanel\\panel-data\\agents',
63
+ ].filter((p) => p && fs.existsSync(p));
64
+
65
+ for (const home of homes) {
66
+ for (const id of agents) copyAgent(id, home);
67
+ }
@@ -0,0 +1,24 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+
5
+ const products = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');
6
+ const agents = ['biuremtion', 'biureel', 'biutalk', 'biuvibe', 'biuart'];
7
+ const bridge = "export * from '../../_shared/lib/film-locate.mjs';\n";
8
+ const oldImport =
9
+ "import { isIntermediateMp4, rescueMissingFilm, findLatestMp4, locateFilm, locateJobFilm, chooseDeliverableFilm, filmHitFields } from '../../_shared/lib/film-locate.mjs';\n";
10
+ const newImport =
11
+ "import { isIntermediateMp4, rescueMissingFilm, findLatestMp4, locateFilm, locateJobFilm, chooseDeliverableFilm, filmHitFields } from './film-bridge.mjs';\n";
12
+
13
+ for (const id of agents) {
14
+ const lib = path.join(products, id, 'lib');
15
+ fs.writeFileSync(path.join(lib, 'film-bridge.mjs'), bridge);
16
+ const host = path.join(lib, 'host.mjs');
17
+ let src = fs.readFileSync(host, 'utf8');
18
+ if (src.includes(oldImport)) src = src.replace(oldImport, newImport);
19
+ else if (!src.includes("./film-bridge.mjs")) {
20
+ throw new Error(`import not found in ${id}`);
21
+ }
22
+ fs.writeFileSync(host, src);
23
+ console.log('ok', id);
24
+ }
@@ -0,0 +1,68 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+
5
+ const products = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');
6
+ const agents = ['biutalk', 'biureel', 'biuvibe'];
7
+ const voiceBtn = ` <button type="button" id="voiceBtn">
8
+ <span class="plus-ico">♪</span>
9
+ <span><strong>选择语音</strong><small>免费 / API / 复刻音色</small></span>
10
+ </button>
11
+ `;
12
+
13
+ for (const id of agents) {
14
+ const html = path.join(products, id, 'studio', 'index.html');
15
+ let text = fs.readFileSync(html, 'utf8');
16
+ if (!text.includes('id="voiceBtn"')) {
17
+ text = text.replace(
18
+ /(id="uploadBtn"[\s\S]*?<\/button>\s*)/,
19
+ `$1${voiceBtn}`,
20
+ );
21
+ fs.writeFileSync(html, text);
22
+ console.log('html', id);
23
+ }
24
+ const app = path.join(products, id, 'studio', 'app.js');
25
+ let src = fs.readFileSync(app, 'utf8');
26
+ if (!src.includes('openVoicePicker')) {
27
+ src = src.replace(
28
+ /const \{([^}]+)\} = Composer;/,
29
+ (m, inner) => `const {${inner.includes('openVoicePicker') ? inner : `${inner}, openVoicePicker`}} = Composer;`,
30
+ );
31
+ if (!/voice:\s*null/.test(src)) {
32
+ src = src.replace(
33
+ /const state = \{/,
34
+ 'const state = {\n voice: null,',
35
+ );
36
+ }
37
+ if (!src.includes('voiceBtn')) {
38
+ src = src.replace(
39
+ /\$\('uploadBtn'\)\.onclick = \(\) => \{[\s\S]*?\};/,
40
+ (block) => `${block}
41
+ if ($('voiceBtn')) {
42
+ $('voiceBtn').onclick = () => {
43
+ plus.close();
44
+ void openVoicePicker(state, (voice) => {
45
+ if (typeof showHealth === 'function') {
46
+ showHealth(voice ? ('已选语音 · ' + (voice.voiceName || voice.voiceId)) : '');
47
+ }
48
+ }).catch((err) => {
49
+ const errEl = $('err');
50
+ if (errEl) { errEl.hidden = false; errEl.textContent = err.message || '选音失败'; }
51
+ });
52
+ };
53
+ }`,
54
+ );
55
+ }
56
+ if (!/voice:\s*state\.voice/.test(src) && src.includes("api('/api/create'")) {
57
+ src = src.replace(
58
+ /body: JSON\.stringify\(\{([\s\S]*?)\}\),/,
59
+ (m, body) => {
60
+ if (body.includes('voice:')) return m;
61
+ return `body: JSON.stringify({${body.replace(/\s*$/, '')} voice: state.voice || undefined,\n }),`;
62
+ },
63
+ );
64
+ }
65
+ fs.writeFileSync(app, src);
66
+ console.log('app', id);
67
+ }
68
+ }
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Assert cwd/project has a valid panel Run Permit.
4
+ * node assert-panel-permit.mjs --project <dir> [--agent biuremtion]
5
+ * Exit 0 = ok; non-zero = refuse creation.
6
+ */
7
+ import fs from 'node:fs';
8
+ import path from 'node:path';
9
+ import os from 'node:os';
10
+
11
+ function arg(name, fallback = '') {
12
+ const i = process.argv.indexOf(name);
13
+ if (i >= 0 && process.argv[i + 1]) return process.argv[i + 1];
14
+ return fallback;
15
+ }
16
+
17
+ function defaultPanelHome() {
18
+ if (process.env.DSH_PANEL_HOME) return path.resolve(process.env.DSH_PANEL_HOME);
19
+ const base = process.env.LOCALAPPDATA || path.join(os.homedir(), '.local', 'share');
20
+ return path.join(base, 'DSH-PANEL');
21
+ }
22
+
23
+ function resolveApiBase() {
24
+ if (process.env.PANEL_API_BASE) return String(process.env.PANEL_API_BASE).replace(/\/$/, '');
25
+ const epFile = path.join(defaultPanelHome(), 'panel-endpoint.json');
26
+ if (!fs.existsSync(epFile)) return null;
27
+ try {
28
+ const ep = JSON.parse(fs.readFileSync(epFile, 'utf8'));
29
+ if (!ep.baseUrl) return null;
30
+ const basePath = String(ep.basePath || '/panel-api').replace(/\/$/, '') || '/panel-api';
31
+ return `${String(ep.baseUrl).replace(/\/$/, '')}${basePath.startsWith('/') ? basePath : `/${basePath}`}`;
32
+ } catch {
33
+ return null;
34
+ }
35
+ }
36
+
37
+ const projectPath = path.resolve(arg('--project', process.cwd()));
38
+ const agentId = arg('--agent', '');
39
+ const permitFile = path.join(projectPath, 'run-permit.json');
40
+
41
+ if (!fs.existsSync(permitFile)) {
42
+ console.error(JSON.stringify({ ok: false, reason: 'missing-permit-file', projectPath }));
43
+ process.exit(2);
44
+ }
45
+
46
+ const base = resolveApiBase();
47
+ if (!base) {
48
+ console.error(JSON.stringify({ ok: false, reason: 'panel-endpoint-missing' }));
49
+ process.exit(3);
50
+ }
51
+
52
+ const body = { projectPath };
53
+ if (agentId) body.agentId = agentId;
54
+
55
+ const res = await fetch(`${base}/agents/run-permit/verify`, {
56
+ method: 'POST',
57
+ headers: { 'content-type': 'application/json' },
58
+ body: JSON.stringify(body),
59
+ });
60
+ const data = await res.json().catch(() => ({}));
61
+ if (!res.ok || !data.ok) {
62
+ if (data.message) console.error(String(data.message));
63
+ console.error(JSON.stringify({ ok: false, status: res.status, ...data }));
64
+ process.exit(4);
65
+ }
66
+ console.log(JSON.stringify({ ok: true, agentId: data.permit?.agentId, jobId: data.permit?.jobId }));
67
+ process.exit(0);