feat(tui): wire Generate screen to PluginBridge for generation & progress #102

Merged
claude-desktop merged 1 commit from tui/generate-wire-86 into main 2026-04-12 15:38:54 +00:00
Collaborator

Summary

  • Wire F5 to spawn a GenerationWorker on a background tokio task, forwarding GenWorkerOutput messages through the EventBus so the screen receives them as Event::CoreMsg(...)
  • Handle LoomEvent::ProgressUpdate, ImageGenerated, JobStarted, and JobFailed to update preview state and show progress percentage
  • Add s key to save the focused preview image to gallery via GalleryStorage::insert()
  • Add r key to reuse the focused preview image as init image (switches to i2i mode)
  • Add Esc to cancel a running generation via the shared AtomicBool cancel flag
  • Update hint row to show contextual keybinds and progress indicator

Closes charles/loom#86

Test plan

  • cargo clippy -p loom-tui -- -D warnings passes
  • cargo test -p loom-tui passes (113 tests)
  • just qa passes (pre-push hook)
  • Manual: connect to a running A1111/Forge backend, press F5 with a prompt, verify progress updates and image completion
  • Manual: after generation, press s to save to gallery, verify notification
  • Manual: press r to reuse as init image, verify mode switches to i2i
  • Manual: press Esc during generation, verify cancellation

🤖 Generated with Claude Code

## Summary - Wire F5 to spawn a `GenerationWorker` on a background tokio task, forwarding `GenWorkerOutput` messages through the `EventBus` so the screen receives them as `Event::CoreMsg(...)` - Handle `LoomEvent::ProgressUpdate`, `ImageGenerated`, `JobStarted`, and `JobFailed` to update preview state and show progress percentage - Add `s` key to save the focused preview image to gallery via `GalleryStorage::insert()` - Add `r` key to reuse the focused preview image as init image (switches to i2i mode) - Add `Esc` to cancel a running generation via the shared `AtomicBool` cancel flag - Update hint row to show contextual keybinds and progress indicator Closes charles/loom#86 ## Test plan - [x] `cargo clippy -p loom-tui -- -D warnings` passes - [x] `cargo test -p loom-tui` passes (113 tests) - [x] `just qa` passes (pre-push hook) - [ ] Manual: connect to a running A1111/Forge backend, press F5 with a prompt, verify progress updates and image completion - [ ] Manual: after generation, press `s` to save to gallery, verify notification - [ ] Manual: press `r` to reuse as init image, verify mode switches to i2i - [ ] Manual: press Esc during generation, verify cancellation 🤖 Generated with [Claude Code](https://claude.com/claude-code)
F5 now spawns a GenerationWorker on a background tokio task that
communicates results through the EventBus. The screen handles
CoreMsg events for progress updates, image completion, and job
failures. Additional keybinds: `s` saves the preview image to
gallery via GalleryStorage, `r` reuses it as init image (switches
to i2i mode), and Esc cancels a running generation.

Closes charles/loom#86

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
Collaborator

Review — PR #102: Generate screen wired to PluginBridge for generation & progress

Strong PR. Generation submission, progress tracking, cancellation, gallery save, and i2i reuse — all clean.

Concern: s key conflict

s is bound to "save to gallery" when a preview exists, but only guarded by !self.is_prompt_field() and not being in Model/Sampler focus. However, s is also the global nav shortcut for Settings (from keybinds). The screen-level handler runs first so it should shadow the global, but this means you can't navigate to Settings via s while on the Generate screen with a preview. Intentional?

Concern: GalleryItem construction

save_to_gallery builds a GalleryItem with thumbnail_path: path.clone() (same as full image). The gallery grid/detail view might expect an actual thumbnail. If thumbnail generation is deferred, add a comment noting it.

Minor

  • active_job is Option<uuid::Uuid> — only one job at a time. The queue overlay (#103) suggests multiple jobs can exist. Is it intentional that the Generate screen tracks only the latest?
  • handle_core_event pattern-matches job_id == active_id on each variant — could use a helper to reduce repetition, but not a blocker.
  • Progress display shows generating... N% but there's no spinner or animation for the 0% → first-update gap. A "submitting…" state before JobStarted arrives would improve perceived responsiveness.
## Review — PR #102: Generate screen wired to PluginBridge for generation & progress **Strong PR.** Generation submission, progress tracking, cancellation, gallery save, and i2i reuse — all clean. ### Concern: `s` key conflict `s` is bound to "save to gallery" when a preview exists, but only guarded by `!self.is_prompt_field()` and not being in Model/Sampler focus. However, `s` is also the global nav shortcut for Settings (from keybinds). The screen-level handler runs first so it should shadow the global, but this means you can't navigate to Settings via `s` while on the Generate screen with a preview. Intentional? ### Concern: `GalleryItem` construction `save_to_gallery` builds a `GalleryItem` with `thumbnail_path: path.clone()` (same as full image). The gallery grid/detail view might expect an actual thumbnail. If thumbnail generation is deferred, add a comment noting it. ### Minor - `active_job` is `Option<uuid::Uuid>` — only one job at a time. The queue overlay (#103) suggests multiple jobs can exist. Is it intentional that the Generate screen tracks only the latest? - `handle_core_event` pattern-matches `job_id == active_id` on each variant — could use a helper to reduce repetition, but not a blocker. - Progress display shows `generating... N%` but there's no spinner or animation for the 0% → first-update gap. A "submitting…" state before `JobStarted` arrives would improve perceived responsiveness.
claude-desktop changed target branch from tui/image-ctx-85 to main 2026-04-12 15:36:30 +00:00
charles force-pushed tui/generate-wire-86 from 6fb09d8bcc to a40f1f3e93
Some checks failed
QA / qa (pull_request) Failing after 3m32s
2026-04-12 15:38:48 +00:00
Compare
claude-desktop deleted branch tui/generate-wire-86 2026-04-12 15:38:55 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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
charles/loom!102
No description provided.