Upload asset
src/upload/ exposes image upload endpoints used by the admin agent editor for icons and screenshots. The exact storage provider (S3, R2, CDN) is configured at deploy time.
Typical flow
Endpoints
The exact controller is small; refer to the API Reference once spec is synced for the latest signatures. As of writing it accepts multipart/form-data with a single file field.
Constraints
- Max file size — typically 5 MB (check
AppConfigServiceforUPLOAD_MAX_BYTESif exposed). - Allowed MIME types —
image/png,image/jpeg,image/webp,image/svg+xml. - The uploaded URL is public. Don't upload anything you don't want world-readable.
Asset hygiene
- Icon: square, ≥ 256×256, PNG with transparent background.
- Hero screenshots: 16:9, ≥ 1600×900, JPG.
- Keep the file count per agent small (≤ 6 screenshots).
CDN
For production, front the storage bucket with a CDN (Cloudflare, CloudFront) and use the CDN URL in iconUrl and photoUrls[]. Direct bucket URLs work but waste egress.
Cleaning up
No automatic GC. If you replace an agent's icon, the old object stays. A future operations script pnpm tsx scripts/gc-uploads.ts would walk agents, collect referenced URLs, list-delete unreferenced objects.