@biunow/agent-biuart 0.1.3 → 0.1.5

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 (64) hide show
  1. package/bin/server.mjs +2 -83
  2. package/manifest.json +3 -3
  3. package/package.json +1 -1
  4. package/studio/composer.css +2 -2
  5. package/studio/thumbs/01_cave.png +0 -0
  6. package/studio/thumbs/02_egypt.png +0 -0
  7. package/studio/thumbs/03_greek.png +0 -0
  8. package/studio/thumbs/04_roman.png +0 -0
  9. package/studio/thumbs/05_gothic.png +0 -0
  10. package/studio/thumbs/06_renaissance.png +0 -0
  11. package/studio/thumbs/08_impressionism.png +0 -0
  12. package/studio/thumbs/09_postimp.png +0 -0
  13. package/studio/thumbs/10_nouveau.png +0 -0
  14. package/studio/thumbs/11_cubism.png +0 -0
  15. package/studio/thumbs/12_bauhaus.png +0 -0
  16. package/studio/thumbs/13_pop.png +0 -0
  17. package/studio/thumbs/14_8bit.png +0 -0
  18. package/studio/thumbs/15_raytrace.png +0 -0
  19. package/studio/thumbs/16_2026.png +0 -0
  20. package/studio/thumbs/17_ink.png +0 -0
  21. package/studio/thumbs/18_klimt.png +0 -0
  22. package/studio/thumbs/19_munch.png +0 -0
  23. package/studio/thumbs/20_dunhuang.png +0 -0
  24. package/studio/thumbs/21_kusama.png +0 -0
  25. package/studio/thumbs/22_constructivism.png +0 -0
  26. package/studio/thumbs/23_dali.png +0 -0
  27. package/studio/thumbs/24_hopper.png +0 -0
  28. package/studio/thumbs/25_ghibli.png +0 -0
  29. package/studio/thumbs/26_vaporwave.png +0 -0
  30. package/studio/thumbs/27_kirby.png +0 -0
  31. package/studio/thumbs/28_monet.png +0 -0
  32. package/studio/thumbs/29_seurat.png +0 -0
  33. package/studio/thumbs/30_matisse.png +0 -0
  34. package/studio/thumbs/31_haring.png +0 -0
  35. package/studio/thumbs/32_rembrandt.png +0 -0
  36. package/studio/thumbs/33_rubberhose.png +0 -0
  37. package/studio/thumbs/34_shadowpuppet.png +0 -0
  38. package/studio/thumbs/35_shinkai.png +0 -0
  39. package/studio/thumbs/36_picasso_blue.png +0 -0
  40. package/studio/thumbs/38_giotto.png +0 -0
  41. package/studio/thumbs/39_piero.png +0 -0
  42. package/studio/thumbs/40_raphael.png +0 -0
  43. package/studio/thumbs/41_michelangelo.png +0 -0
  44. package/studio/thumbs/42_guardi.png +0 -0
  45. package/studio/thumbs/43_lorenzetti.png +0 -0
  46. package/studio/thumbs/44_cortona.png +0 -0
  47. package/studio/thumbs/45_renoir.png +0 -0
  48. package/studio/thumbs/46_pissarro.png +0 -0
  49. package/studio/thumbs/47_sisley.png +0 -0
  50. package/studio/thumbs/48_gauguin.png +0 -0
  51. package/studio/thumbs/49_chagall.png +0 -0
  52. package/studio/thumbs/50_ma_yuan.png +0 -0
  53. package/studio/thumbs/51_persian_miniature.png +0 -0
  54. package/studio/thumbs/52_south_park.png +0 -0
  55. package/studio/thumbs/53_pixar.png +0 -0
  56. package/studio/thumbs/54_ghibli_lab.png +0 -0
  57. package/studio/thumbs/55_dunhuang.png +0 -0
  58. package/studio/thumbs/t1_3b1b.png +0 -0
  59. package/studio/thumbs/t2_keynote_ui.png +0 -0
  60. package/studio/thumbs/t3_finance_chart.png +0 -0
  61. package/studio/thumbs/y1_kurzgesagt.png +0 -0
  62. package/studio/thumbs/y2_vox.png +0 -0
  63. package/studio/thumbs/y3_whiteboard.png +0 -0
  64. package/studio/thumbs/y5_kinetic_type.png +0 -0
package/bin/server.mjs CHANGED
@@ -34,7 +34,7 @@ function publicStyle(item) {
34
34
  film: item.film || '',
35
35
  previewable: !!item.era,
36
36
  kind: 'style',
37
- thumb: `/api/thumb/${item.id}.png`,
37
+ thumb: `/thumbs/${item.id}.png`,
38
38
  desc: item.summary || '',
39
39
  };
40
40
  }
@@ -50,7 +50,7 @@ function publicGrammar(item) {
50
50
  film: '',
51
51
  previewable: false,
52
52
  kind: 'grammar',
53
- thumb: `/api/thumb/${item.id}.png`,
53
+ thumb: `/thumbs/${item.id}.png`,
54
54
  desc: item.summary || '',
55
55
  };
56
56
  }
@@ -98,55 +98,6 @@ async function saveUploads(workspace, jobId, files) {
98
98
  return saved;
99
99
  }
100
100
 
101
- /* ---- 画风缩略图:用引擎渲一帧静帧做封面,工作区缓存 ---- */
102
- const thumbPending = new Set();
103
-
104
- function thumbDirOf(cfg) {
105
- return ensureDir(path.join(cfg.workspace, 'thumbs'));
106
- }
107
-
108
- async function renderThumb(cfg, engineRoot, item, kind) {
109
- const dir = thumbDirOf(cfg);
110
- const dest = path.join(dir, `${item.id}.png`);
111
- if (fs.existsSync(dest)) return;
112
- const failedMark = path.join(dir, `${item.id}.failed`);
113
- if (fs.existsSync(failedMark)) return;
114
- if (thumbPending.has(item.id)) return;
115
- thumbPending.add(item.id);
116
- const tmpDir = ensureDir(path.join(dir, '.tmp', item.id));
117
- try {
118
- if (kind === 'style' && item.era) {
119
- await render({
120
- engineRoot, out: tmpDir, solo: item.era, film: item.film || '',
121
- stills: '1.2', stillWidth: 640,
122
- });
123
- } else {
124
- const example = path.join(engineRoot, 'examples', `${item.id}.json`);
125
- if (!fs.existsSync(example)) throw new Error(`缺少示例 spec:examples/${item.id}.json`);
126
- await render({ engineRoot, out: tmpDir, specPath: example, stills: '0.8', stillWidth: 640 });
127
- }
128
- const png = fs.readdirSync(tmpDir).find((name) => name.endsWith('.png'));
129
- if (!png) throw new Error('引擎没有产出静帧');
130
- fs.copyFileSync(path.join(tmpDir, png), dest);
131
- } catch (error) {
132
- // 写失败标记:避免每次启动/每次请求都重复触发一次注定失败的 Chromium 渲染
133
- fs.writeFileSync(failedMark, String(error?.message || error));
134
- console.warn(`[biuart] 缩略图失败 ${item.id}:`, error?.message || error);
135
- } finally {
136
- thumbPending.delete(item.id);
137
- fs.rmSync(tmpDir, { recursive: true, force: true });
138
- }
139
- }
140
-
141
- function ensureThumbs(cfg) {
142
- const engine = engineReady(cfg);
143
- if (!engine.present) return;
144
- void (async () => {
145
- for (const item of STYLES) await renderThumb(cfg, engine.engineRoot, item, 'style');
146
- for (const item of GRAMMARS) await renderThumb(cfg, engine.engineRoot, item, 'grammar');
147
- })();
148
- }
149
-
150
101
  function seedSkillDir(projectDir, packageRoot, skillId) {
151
102
  const src = path.join(packageRoot, 'skills', skillId);
152
103
  if (!fs.existsSync(src)) return null;
@@ -174,35 +125,6 @@ const app = createAgentServer({
174
125
  return true;
175
126
  }
176
127
 
177
- if (pathname.startsWith('/api/thumb/') && req.method === 'GET') {
178
- const id = decodeURIComponent(pathname.slice('/api/thumb/'.length)).replace(/\.png$/, '');
179
- if (!/^[\w-]+$/.test(id)) {
180
- sendJson(res, 400, { error: 'bad id' });
181
- return true;
182
- }
183
- const dir = thumbDirOf(cfg);
184
- const file = path.join(dir, `${id}.png`);
185
- if (fs.existsSync(file)) {
186
- serveLocalFile(req, res, file);
187
- } else {
188
- const engine = engineReady(cfg);
189
- const item = STYLES.find((s) => s.id === id);
190
- const grammar = GRAMMARS.find((g) => g.id === id);
191
- if (!item && !grammar) {
192
- sendJson(res, 404, { error: 'unknown id' });
193
- return true;
194
- }
195
- if (fs.existsSync(path.join(dir, `${id}.failed`)) || !engine.present) {
196
- sendJson(res, 404, { error: 'thumb unavailable' });
197
- return true;
198
- }
199
- void renderThumb(cfg, engine.engineRoot, item || grammar, item ? 'style' : 'grammar');
200
- res.writeHead(202, { 'content-type': 'application/json; charset=utf-8' });
201
- res.end(JSON.stringify({ pending: true }));
202
- }
203
- return true;
204
- }
205
-
206
128
  if (pathname === '/api/meta' && req.method === 'GET') {
207
129
  const manifest = JSON.parse(fs.readFileSync(path.join(root, 'manifest.json'), 'utf8'));
208
130
  const engine = engineReady(cfg);
@@ -570,6 +492,3 @@ const app = createAgentServer({
570
492
  },
571
493
  });
572
494
 
573
- // 启动后后台补齐画风缩略图(已存在则跳过)
574
- ensureThumbs(app.cfg);
575
-
package/manifest.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "schemaVersion": 1,
3
3
  "id": "biuart",
4
4
  "name": "BiuArt",
5
- "version": "0.1.3",
5
+ "version": "0.1.5",
6
6
  "publisher": "Biunow",
7
7
  "description": "BiuArt 艺术动画:锁定一种画风,用代码画出会动的画面,一镜一镜渲成片。",
8
8
  "entry": {
@@ -45,8 +45,8 @@
45
45
  "requiresEntitlement": "export"
46
46
  },
47
47
  "integrity": {
48
- "sha256": "abffc8170429a312a02a0275b661336f2c30e652d83e553140eba0e395d501bb",
49
- "signature": "mf5AuMQ3vXjnbUpfdpt0Lqi/BxYGeCllJo6W6W2xFuGG0ASAAOEtXwHnpeZkKML+Q6jUacjyyABaR5+ewsbUDA==",
48
+ "sha256": "9a17bbf3bd7357cb00cc767b09778ab5ab0290b2a852a2bcd52eee2ab772f5c8",
49
+ "signature": "vjO1S9jyuueulxk024KVjLDq2zyvr8ajjoi/HvTOhmo0R90zR6YqEys8Ulh9WL2KvD4cyrYO5Su2SXL0+K/4BA==",
50
50
  "signedBy": "publisher-key"
51
51
  }
52
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biunow/agent-biuart",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "BiuArt",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {
@@ -400,7 +400,7 @@ button:disabled { cursor: not-allowed; opacity: .5; }
400
400
  display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 7px;
401
401
  overflow: hidden; background: #ecece6;
402
402
  }
403
- .sm-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
403
+ .sm-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
404
404
  .sm-thumb-ph {
405
405
  display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
406
406
  font-size: 17px; font-weight: 600; color: var(--muted);
@@ -413,7 +413,7 @@ button:disabled { cursor: not-allowed; opacity: .5; }
413
413
  overflow: hidden; animation: sm-in .16s ease-out;
414
414
  }
415
415
  .sm-preview-img { width: 100%; aspect-ratio: 16 / 9; background: #ecece6; }
416
- .sm-preview-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
416
+ .sm-preview-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
417
417
  .sm-preview-body { padding: 11px 14px 13px; }
418
418
  .sm-preview-title { display: flex; align-items: baseline; gap: 8px; }
419
419
  .sm-preview-title strong {
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file