[PR #2361] [MERGED] Add persona and global image galleries #5564

Closed
opened 2026-10-22 04:17:24 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2361
Author: @kolacheee
Created: 6/5/2026
Status: ✅ Merged
Merged: 6/7/2026
Merged by: @SpicyMarinara

Base: refactor ← Head: feat/persona-global-galleries


📝 Commits (10+)

  • d33a2c7 Add persona and global image galleries
  • 8d1ca46 Validate global gallery folder refs and roll back failed lightbox moves
  • 38efb0f Guard lightbox move rollback against superseding moves
  • 7ea7825 Document intentional partial-success-as-failure in gallery uploads
  • c409dcc Address gallery review feedback
  • ba86773 Clear gallery rows before deleting their files on purge
  • 9dd00ba Name the files and reasons when gallery uploads partially fail
  • 696f0d9 Stop exporting RIGHT_PANEL_BUTTONS
  • 0467ed5 Add Gallery to the mobile tools nav
  • ad511de Resolve gallery upload folder before persisting bytes

📊 Changes

33 files changed (+1560 additions, -61 deletions)

View changed files

📝 scripts/check-discovery-metadata.mjs (+1 -0)
📝 src-tauri/src/commands/storage/admin.rs (+39 -1)
📝 src-tauri/src/commands/storage/commands/entities.rs (+176 -3)
📝 src-tauri/src/commands/storage/commands/media.rs (+18 -0)
📝 src-tauri/src/commands/storage/contracts.rs (+32 -1)
📝 src-tauri/src/commands/storage/shared.rs (+51 -0)
📝 src-tauri/src/http_dispatch.rs (+20 -0)
📝 src-tauri/src/lib.rs (+2 -0)
📝 src/app/shell/PanelNavButtons.tsx (+10 -2)
📝 src/app/shell/RightPanel.tsx (+6 -1)
📝 src/engine/capabilities/storage.ts (+3 -0)
📝 src/features/catalog/characters/components/CharacterGalleryTab.tsx (+6 -0)
📝 src/features/catalog/characters/hooks/use-characters.ts (+3 -20)
➕ src/features/catalog/gallery/components/GlobalGalleryPanel.tsx (+604 -0)
📝 src/features/catalog/gallery/hooks/use-gallery.ts (+4 -31)
➕ src/features/catalog/gallery/hooks/use-global-gallery.ts (+149 -0)
📝 src/features/catalog/gallery/index.ts (+1 -0)
📝 src/features/catalog/gallery/query-keys.ts (+6 -0)
➕ src/features/catalog/gallery/shell.ts (+1 -0)
📝 src/features/catalog/personas/components/editor/PersonaEditor.tsx (+5 -0)

...and 13 more files

📄 Description

Linked issue

Closes #2360 (partially).

This is the first PR in a planned series implementing that feature request. It delivers the gallery foundations only (persona galleries + a global gallery panel) — the management surface the rest of the feature builds on. Emoji/sticker tagging, the Conversation-mode selectors, and AI reactions follow in later PRs, so this PR intentionally does not close the request.

Why this change

  • The emoji/sticker system needs image libraries to draw from, so this PR builds those libraries first as a self-contained, management-only change.
  • Personas had no gallery, unlike characters — this closes that parity gap.
  • A profile-wide image library gives users one place to collect and organize reusable images instead of scattering them across chats.

What changed

  • Persona gallery: a new Gallery tab on the persona editor, mirroring the character gallery. New persona-gallery storage collection + persona_gallery_upload command, with cascade-delete when a persona is removed, plus expunge, profile-export, and remote-runtime wiring.
  • Global gallery panel: a new top-level Gallery panel in the right-panel nav (alongside Characters/Personas/Lorebooks). New global-gallery collection plus a flat gallery-folders collection. Supports sorting (newest/oldest/name asc/desc), create/rename/delete folders (deleting a folder re-files its images to the root rather than deleting them), uploading into a folder, and moving images by dragging onto a folder chip or via a lightbox picker.
  • Storage plumbing so both new image collections behave like the existing galleries: managed-file cleanup on delete, gallery default fields on create, inline-data-url persistence, and managed-asset cache invalidation.
  • Registered both upload commands in src-tauri/src/lib.rs, the HTTP dispatcher, and the remote-runtime allowlist.
  • Added a discovery entry for the new Gallery panel.

Refactor impact

Primary owner: catalog (galleries) and Rust storage.

Impact areas reviewed:

  • catalog/gallery and catalog/personas (new panel, tab, hooks)
  • Rust storage (contracts.rs collections + cleanup enum, entities.rs cleanup wiring, shared.rs upload helper, media.rs commands, admin.rs expunge scopes)
  • shared API (storage-api.ts invalidation, image-generation-api.ts upload surface)
  • app shell (RightPanel.tsx, PanelNavButtons.tsx) — added the Gallery panel entry
  • engine capabilities (storage.ts entity-name union)
  • discovery registry (+ the metadata check script's panel allowlist)

Boundary notes:

  • engine: only the storage entity-name union (src/engine/capabilities/storage.ts) gained the new collection names.
  • shared API: gallery write/delete invalidation kinds extended to the new collections; new uploadPersona/uploadGlobal surfaces.
  • feature: new components/hooks are confined to catalog/gallery and catalog/personas.
  • Rust: new collections, DeletePersonaGallery/ClearGalleryFolder cleanups, and a global-gallery upload helper.
  • remote runtime: added persona_gallery_upload and global_gallery_upload to the allowlist + HTTP dispatch.

Pressure points touched:

  • src-tauri/src/lib.rs command registration — added the two upload commands. ModeSurface, GameSurface, shared mode UI, and import modules are untouched; nothing touches the RP/Game/Conversation runtime.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

Ran individually (the local check:line-endings step trips on pre-existing CRLF in unrelated files, so the chained pnpm check bails early; the committed versions of those files are LF, so CI is unaffected):

  • pnpm check:frontend (tsc -b) — passes
  • pnpm check:rust (cargo check --workspace) — passes
  • pnpm check:architecture — passes (no dependency violations)
  • pnpm check:unused (knip) — clean
  • pnpm check:discovery — passes
  • Added two Rust regression tests (cargo test green): deleting a persona removes its gallery rows + managed files; deleting a gallery folder re-files its images to the root.

Manual Tauri verification: uploaded images to the global gallery, created/selected/renamed/deleted folders, sorted, and moved images both by dragging onto a folder chip and via the lightbox picker; verified the persona Gallery tab uploads and displays. Confirmed in both dark and light themes.

Feature Discoverability

Check exactly one:

  • Updated src/features/shell/discovery/ because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.
  • N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find.

Reason:

  • The first box applies: this PR adds a new top-level Gallery panel, so src/features/shell/discovery/discovery-entries.json gained a global-gallery entry and the panel-target allowlists were extended.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

UI evidence

image image image

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/2361 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 6/5/2026 **Status:** ✅ Merged **Merged:** 6/7/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `refactor` ← **Head:** `feat/persona-global-galleries` --- ### 📝 Commits (10+) - [`d33a2c7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d33a2c7a8a6e0cf7f08f4097b427d2905eebad75) Add persona and global image galleries - [`8d1ca46`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8d1ca46b8e347d36749bf1d875be1944457d03ac) Validate global gallery folder refs and roll back failed lightbox moves - [`38efb0f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/38efb0f4848c58872279aeed26bb25eaefd3e720) Guard lightbox move rollback against superseding moves - [`7ea7825`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7ea7825f3b84a7098114b59aa561d75ebe1e0e27) Document intentional partial-success-as-failure in gallery uploads - [`c409dcc`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c409dcc7ec569cba18a5d86f06c917b4f47a9619) Address gallery review feedback - [`ba86773`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ba8677309e7576f4ad8390087078e42541fdf85c) Clear gallery rows before deleting their files on purge - [`9dd00ba`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9dd00bad1bda6be13d1844d65b309ed2e2a8e425) Name the files and reasons when gallery uploads partially fail - [`696f0d9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/696f0d9dfead98e86c0362125e7b6a0558863dec) Stop exporting RIGHT_PANEL_BUTTONS - [`0467ed5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0467ed53cffada07c5ce284a7f12689bf9fff5ff) Add Gallery to the mobile tools nav - [`ad511de`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ad511dea447b3bf0ef9e092a4b17aae42305a89e) Resolve gallery upload folder before persisting bytes ### 📊 Changes **33 files changed** (+1560 additions, -61 deletions) <details> <summary>View changed files</summary> 📝 `scripts/check-discovery-metadata.mjs` (+1 -0) 📝 `src-tauri/src/commands/storage/admin.rs` (+39 -1) 📝 `src-tauri/src/commands/storage/commands/entities.rs` (+176 -3) 📝 `src-tauri/src/commands/storage/commands/media.rs` (+18 -0) 📝 `src-tauri/src/commands/storage/contracts.rs` (+32 -1) 📝 `src-tauri/src/commands/storage/shared.rs` (+51 -0) 📝 `src-tauri/src/http_dispatch.rs` (+20 -0) 📝 `src-tauri/src/lib.rs` (+2 -0) 📝 `src/app/shell/PanelNavButtons.tsx` (+10 -2) 📝 `src/app/shell/RightPanel.tsx` (+6 -1) 📝 `src/engine/capabilities/storage.ts` (+3 -0) 📝 `src/features/catalog/characters/components/CharacterGalleryTab.tsx` (+6 -0) 📝 `src/features/catalog/characters/hooks/use-characters.ts` (+3 -20) ➕ `src/features/catalog/gallery/components/GlobalGalleryPanel.tsx` (+604 -0) 📝 `src/features/catalog/gallery/hooks/use-gallery.ts` (+4 -31) ➕ `src/features/catalog/gallery/hooks/use-global-gallery.ts` (+149 -0) 📝 `src/features/catalog/gallery/index.ts` (+1 -0) 📝 `src/features/catalog/gallery/query-keys.ts` (+6 -0) ➕ `src/features/catalog/gallery/shell.ts` (+1 -0) 📝 `src/features/catalog/personas/components/editor/PersonaEditor.tsx` (+5 -0) _...and 13 more files_ </details> ### 📄 Description ## Linked issue Closes #2360 (partially). This is the first PR in a planned series implementing that feature request. It delivers the gallery foundations only (persona galleries + a global gallery panel) — the management surface the rest of the feature builds on. Emoji/sticker tagging, the Conversation-mode selectors, and AI reactions follow in later PRs, so this PR intentionally does not close the request. ## Why this change - The emoji/sticker system needs image libraries to draw from, so this PR builds those libraries first as a self-contained, management-only change. - Personas had no gallery, unlike characters — this closes that parity gap. - A profile-wide image library gives users one place to collect and organize reusable images instead of scattering them across chats. ## What changed - **Persona gallery**: a new Gallery tab on the persona editor, mirroring the character gallery. New `persona-gallery` storage collection + `persona_gallery_upload` command, with cascade-delete when a persona is removed, plus expunge, profile-export, and remote-runtime wiring. - **Global gallery panel**: a new top-level Gallery panel in the right-panel nav (alongside Characters/Personas/Lorebooks). New `global-gallery` collection plus a flat `gallery-folders` collection. Supports sorting (newest/oldest/name asc/desc), create/rename/delete folders (deleting a folder re-files its images to the root rather than deleting them), uploading into a folder, and moving images by dragging onto a folder chip or via a lightbox picker. - Storage plumbing so both new image collections behave like the existing galleries: managed-file cleanup on delete, gallery default fields on create, inline-data-url persistence, and managed-asset cache invalidation. - Registered both upload commands in `src-tauri/src/lib.rs`, the HTTP dispatcher, and the remote-runtime allowlist. - Added a discovery entry for the new Gallery panel. ## Refactor impact Primary owner: catalog (galleries) and Rust storage. Impact areas reviewed: - catalog/gallery and catalog/personas (new panel, tab, hooks) - Rust storage (`contracts.rs` collections + cleanup enum, `entities.rs` cleanup wiring, `shared.rs` upload helper, `media.rs` commands, `admin.rs` expunge scopes) - shared API (`storage-api.ts` invalidation, `image-generation-api.ts` upload surface) - app shell (`RightPanel.tsx`, `PanelNavButtons.tsx`) — added the Gallery panel entry - engine capabilities (`storage.ts` entity-name union) - discovery registry (+ the metadata check script's panel allowlist) Boundary notes: - engine: only the storage entity-name union (`src/engine/capabilities/storage.ts`) gained the new collection names. - shared API: gallery write/delete invalidation kinds extended to the new collections; new `uploadPersona`/`uploadGlobal` surfaces. - feature: new components/hooks are confined to `catalog/gallery` and `catalog/personas`. - Rust: new collections, `DeletePersonaGallery`/`ClearGalleryFolder` cleanups, and a global-gallery upload helper. - remote runtime: added `persona_gallery_upload` and `global_gallery_upload` to the allowlist + HTTP dispatch. Pressure points touched: - `src-tauri/src/lib.rs` command registration — added the two upload commands. ModeSurface, GameSurface, shared mode UI, and import modules are untouched; nothing touches the RP/Game/Conversation runtime. ## Validation - [x] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [x] Full `pnpm check` passes before PR push/handoff - [x] Human/manual validation completed by contributor or reviewer ### Manual verification notes Ran individually (the local `check:line-endings` step trips on pre-existing CRLF in unrelated files, so the chained `pnpm check` bails early; the committed versions of those files are LF, so CI is unaffected): - `pnpm check:frontend` (tsc -b) — passes - `pnpm check:rust` (cargo check --workspace) — passes - `pnpm check:architecture` — passes (no dependency violations) - `pnpm check:unused` (knip) — clean - `pnpm check:discovery` — passes - Added two Rust regression tests (cargo test green): deleting a persona removes its gallery rows + managed files; deleting a gallery folder re-files its images to the root. Manual Tauri verification: uploaded images to the global gallery, created/selected/renamed/deleted folders, sorted, and moved images both by dragging onto a folder chip and via the lightbox picker; verified the persona Gallery tab uploads and displays. Confirmed in both dark and light themes. ## Feature Discoverability Check exactly one: - [x] Updated `src/features/shell/discovery/` because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool. - [ ] N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find. Reason: - The first box applies: this PR adds a new top-level Gallery panel, so `src/features/shell/discovery/discovery-entries.json` gained a `global-gallery` entry and the panel-target allowlists were extended. ## Docs and release impact - [x] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [x] Confirmed this PR does not restore old staging/package-workspace/release claims ## UI evidence <img width="736" height="1364" alt="image" src="https://github.com/user-attachments/assets/93791769-b0d9-4894-8824-cad93ef29a52" /> <img width="777" height="1354" alt="image" src="https://github.com/user-attachments/assets/0594e18a-e366-4436-b52f-5208ad04d10e" /> <img width="2000" height="1066" alt="image" src="https://github.com/user-attachments/assets/a19c2319-e6bd-4c9f-89d2-38fc6139ff56" /> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:17:24 +07:00
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#5564
No description provided.