@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.
- package/bin/server.mjs +2 -83
- package/manifest.json +3 -3
- package/package.json +1 -1
- package/studio/composer.css +2 -2
- package/studio/thumbs/01_cave.png +0 -0
- package/studio/thumbs/02_egypt.png +0 -0
- package/studio/thumbs/03_greek.png +0 -0
- package/studio/thumbs/04_roman.png +0 -0
- package/studio/thumbs/05_gothic.png +0 -0
- package/studio/thumbs/06_renaissance.png +0 -0
- package/studio/thumbs/08_impressionism.png +0 -0
- package/studio/thumbs/09_postimp.png +0 -0
- package/studio/thumbs/10_nouveau.png +0 -0
- package/studio/thumbs/11_cubism.png +0 -0
- package/studio/thumbs/12_bauhaus.png +0 -0
- package/studio/thumbs/13_pop.png +0 -0
- package/studio/thumbs/14_8bit.png +0 -0
- package/studio/thumbs/15_raytrace.png +0 -0
- package/studio/thumbs/16_2026.png +0 -0
- package/studio/thumbs/17_ink.png +0 -0
- package/studio/thumbs/18_klimt.png +0 -0
- package/studio/thumbs/19_munch.png +0 -0
- package/studio/thumbs/20_dunhuang.png +0 -0
- package/studio/thumbs/21_kusama.png +0 -0
- package/studio/thumbs/22_constructivism.png +0 -0
- package/studio/thumbs/23_dali.png +0 -0
- package/studio/thumbs/24_hopper.png +0 -0
- package/studio/thumbs/25_ghibli.png +0 -0
- package/studio/thumbs/26_vaporwave.png +0 -0
- package/studio/thumbs/27_kirby.png +0 -0
- package/studio/thumbs/28_monet.png +0 -0
- package/studio/thumbs/29_seurat.png +0 -0
- package/studio/thumbs/30_matisse.png +0 -0
- package/studio/thumbs/31_haring.png +0 -0
- package/studio/thumbs/32_rembrandt.png +0 -0
- package/studio/thumbs/33_rubberhose.png +0 -0
- package/studio/thumbs/34_shadowpuppet.png +0 -0
- package/studio/thumbs/35_shinkai.png +0 -0
- package/studio/thumbs/36_picasso_blue.png +0 -0
- package/studio/thumbs/38_giotto.png +0 -0
- package/studio/thumbs/39_piero.png +0 -0
- package/studio/thumbs/40_raphael.png +0 -0
- package/studio/thumbs/41_michelangelo.png +0 -0
- package/studio/thumbs/42_guardi.png +0 -0
- package/studio/thumbs/43_lorenzetti.png +0 -0
- package/studio/thumbs/44_cortona.png +0 -0
- package/studio/thumbs/45_renoir.png +0 -0
- package/studio/thumbs/46_pissarro.png +0 -0
- package/studio/thumbs/47_sisley.png +0 -0
- package/studio/thumbs/48_gauguin.png +0 -0
- package/studio/thumbs/49_chagall.png +0 -0
- package/studio/thumbs/50_ma_yuan.png +0 -0
- package/studio/thumbs/51_persian_miniature.png +0 -0
- package/studio/thumbs/52_south_park.png +0 -0
- package/studio/thumbs/53_pixar.png +0 -0
- package/studio/thumbs/54_ghibli_lab.png +0 -0
- package/studio/thumbs/55_dunhuang.png +0 -0
- package/studio/thumbs/t1_3b1b.png +0 -0
- package/studio/thumbs/t2_keynote_ui.png +0 -0
- package/studio/thumbs/t3_finance_chart.png +0 -0
- package/studio/thumbs/y1_kurzgesagt.png +0 -0
- package/studio/thumbs/y2_vox.png +0 -0
- package/studio/thumbs/y3_whiteboard.png +0 -0
- 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: `/
|
|
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: `/
|
|
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.
|
|
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": "
|
|
49
|
-
"signature": "
|
|
48
|
+
"sha256": "9a17bbf3bd7357cb00cc767b09778ab5ab0290b2a852a2bcd52eee2ab772f5c8",
|
|
49
|
+
"signature": "vjO1S9jyuueulxk024KVjLDq2zyvr8ajjoi/HvTOhmo0R90zR6YqEys8Ulh9WL2KvD4cyrYO5Su2SXL0+K/4BA==",
|
|
50
50
|
"signedBy": "publisher-key"
|
|
51
51
|
}
|
|
52
52
|
}
|
package/package.json
CHANGED
package/studio/composer.css
CHANGED
|
@@ -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:
|
|
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:
|
|
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
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|