[GH-ISSUE #1994] [Feature]: Add thumbnail-capable delivery for managed image asset grids #976

Closed
opened 2026-10-21 05:24:34 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Promansis on GitHub (Jun 3, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1994

Originally assigned to: @Promansis on GitHub.

What problem does this solve?

Repeated image surfaces render full-size managed assets into small thumbnail cells. This can waste transfer bytes, decode time, and memory when grids or lists show many gallery, background, game asset, or lorebook images at once.

Static audit evidence:

  • src/features/modes/game-assets/components/AssetGrid.tsx renders repeated game asset images via resolveGameAssetFileUrl.
  • src/features/shell/settings/components/SettingsPanel.tsx renders background picker tiles via resolveGameAssetFileUrl or resolveBackgroundFileUrl.
  • src/features/catalog/characters/components/CharacterGalleryTab.tsx renders character gallery grid tiles with image.url directly.
  • src/features/catalog/lorebooks/components/panel/LorebookRow.tsx renders resolved lorebook images into 40px row cells.
  • Bundled default image assets include several PNG sprite assets around 1.0-2.0 MB, so small tiles can decode much larger source files than needed.

Proposed behavior

Add thumbnail-capable managed asset delivery for gallery, background, game asset, and lorebook image surfaces.

Recommended shape:

  • Feature UI chooses a stable size bucket, such as 64, 128, 256, or 512.
  • src/shared/api/local-file-api.ts exposes thumbnail-capable resolvers that keep embedded Tauri and remote runtime behavior aligned.
  • src-tauri owns safe filesystem resolution, decoding, hashing/freshness checks, thumbnail generation, and cache file paths.
  • src-tauri/src/http_server.rs serves thumbnail routes with cache headers that match freshness and invalidation.
  • Lightbox/download/full preview actions should continue using original full-size assets.

Expected owner or impact area

  • App shell, navigation, startup, or providers
  • Catalog resources: chats, characters, personas, lorebooks, presets, connections, agents, gallery, or knowledge
  • Chat mode
  • Roleplay mode
  • Game mode
  • Shared mode UI
  • Runtime systems: generation, world-state, visuals, tracker, or haptics
  • Professor Mari or shell tools
  • React-free engine behavior, contracts, agents, or capability ports
  • Shared API wrapper or remote runtime routing
  • Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime
  • Docs, contributor workflow, or templates

Refactor branch considerations

Keep product placement aligned with the refactor architecture:

  • UI surfaces should request size buckets; they should not implement ad hoc thumbnail generation.
  • Shared API wrappers should own embedded vs remote URL resolution.
  • Rust should own privileged filesystem access, thumbnail cache generation, safe paths, and freshness.
  • Hostable runtime support needs explicit /api/assets routing parity.
  • Avoid raw Tauri calls or raw remote fetches from feature components.

Do not claim byte, memory, or timing wins until browser/network measurements are captured before and after.

Alternatives considered

Only adding loading="lazy" or CSS sizing would reduce some browser scheduling pressure, but it would not reduce source bytes or decode size. Pre-generating every thumbnail at import time may be heavier than lazy bucket generation for below-fold lists.

Additional context

Existing avatar thumbnails provide a model for bucketed sizes and Rust-owned cache generation. This issue extends that pattern to other high-volume managed image surfaces.

Template check

Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Promansis on GitHub (Jun 3, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1994 Originally assigned to: @Promansis on GitHub. ## What problem does this solve? Repeated image surfaces render full-size managed assets into small thumbnail cells. This can waste transfer bytes, decode time, and memory when grids or lists show many gallery, background, game asset, or lorebook images at once. Static audit evidence: - `src/features/modes/game-assets/components/AssetGrid.tsx` renders repeated game asset images via `resolveGameAssetFileUrl`. - `src/features/shell/settings/components/SettingsPanel.tsx` renders background picker tiles via `resolveGameAssetFileUrl` or `resolveBackgroundFileUrl`. - `src/features/catalog/characters/components/CharacterGalleryTab.tsx` renders character gallery grid tiles with `image.url` directly. - `src/features/catalog/lorebooks/components/panel/LorebookRow.tsx` renders resolved lorebook images into 40px row cells. - Bundled default image assets include several PNG sprite assets around 1.0-2.0 MB, so small tiles can decode much larger source files than needed. ## Proposed behavior Add thumbnail-capable managed asset delivery for gallery, background, game asset, and lorebook image surfaces. Recommended shape: - Feature UI chooses a stable size bucket, such as 64, 128, 256, or 512. - `src/shared/api/local-file-api.ts` exposes thumbnail-capable resolvers that keep embedded Tauri and remote runtime behavior aligned. - `src-tauri` owns safe filesystem resolution, decoding, hashing/freshness checks, thumbnail generation, and cache file paths. - `src-tauri/src/http_server.rs` serves thumbnail routes with cache headers that match freshness and invalidation. - Lightbox/download/full preview actions should continue using original full-size assets. ## Expected owner or impact area - [ ] App shell, navigation, startup, or providers - [x] Catalog resources: chats, characters, personas, lorebooks, presets, connections, agents, gallery, or knowledge - [ ] Chat mode - [ ] Roleplay mode - [x] Game mode - [x] Shared mode UI - [x] Runtime systems: generation, world-state, visuals, tracker, or haptics - [ ] Professor Mari or shell tools - [ ] React-free engine behavior, contracts, agents, or capability ports - [x] Shared API wrapper or remote runtime routing - [x] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime - [ ] Docs, contributor workflow, or templates ## Refactor branch considerations Keep product placement aligned with the refactor architecture: - UI surfaces should request size buckets; they should not implement ad hoc thumbnail generation. - Shared API wrappers should own embedded vs remote URL resolution. - Rust should own privileged filesystem access, thumbnail cache generation, safe paths, and freshness. - Hostable runtime support needs explicit `/api/assets` routing parity. - Avoid raw Tauri calls or raw remote fetches from feature components. Do not claim byte, memory, or timing wins until browser/network measurements are captured before and after. ## Alternatives considered Only adding `loading="lazy"` or CSS sizing would reduce some browser scheduling pressure, but it would not reduce source bytes or decode size. Pre-generating every thumbnail at import time may be heavier than lazy bucket generation for below-fold lists. ## Additional context Existing avatar thumbnails provide a model for bucketed sizes and Rust-owned cache generation. This issue extends that pattern to other high-volume managed image surfaces. ## Template check Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#976
No description provided.