feat: image core — format math, sharp pipeline, sticker contour, prompts, pg-boss queue+worker

- format.ts: exact px (cm/2.54*dpi), catalog incl. The Frame/portrait, aspect ratio
- pipeline.ts: finalizeToFormat (cover/attention crop, dpi metadata), stickerContour
  (alpha dilation -> white border), heic->png, german filename slug
- prompts.ts: task prompts (clean/cutout/format) — reproduce, don't reinterpret
- process.ts: per-item chain (load -> model /v1/images -> finalize -> contour -> store)
- queue.ts + worker.ts: pg-boss (concurrency, retry, counters, 402 pause, completion)
- verified locally: 30x40@300dpi = exact 3543x4724 + dpi meta; sticker white border + alpha
This commit is contained in:
2026-07-23 11:20:55 +00:00
parent b46dbbe889
commit 577b13f680
8 changed files with 434 additions and 1 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
import { runMigrations } from './db';
import { ensureBucket } from './storage';
import { seed } from './seed';
import { startImageWorker } from '../worker';
let started: Promise<void> | null = null;
@@ -11,8 +12,8 @@ export function ensureInit(): Promise<void> {
await runMigrations();
try { await ensureBucket(); } catch (e) { console.error('[init] S3 nicht bereit:', e); }
await seed();
try { await startImageWorker(); } catch (e) { console.error('[init] Worker-Start fehlgeschlagen:', e); }
console.log('[init] Klarbild bereit.');
// TODO (Phase Bildkern): pg-boss-Worker hier starten.
})().catch((e) => { started = null; throw e; });
}
return started;