fix(slides): unbreak handle_folder_pick, collapse generator.rs to single builder path, port first_slide field #56

Closed
mik-tf wants to merge 1 commit from development_mik into development
Owner

Fixes the hero_slides_server compile break on origin/development (duplicate handle_folder_pick left by the 7c3c42a merge), simplifies the image-generation path per the "not clean" feedback, and ports the first_slide field from development_kristof.

Why this is needed

origin/development does not currently compile for hero_slides_server:

error[E0428]: the name `handle_folder_pick` is defined multiple times
  --> crates/hero_slides_server/src/rpc.rs:2978:1
error[E0308]: `match` arms have incompatible types
  --> crates/hero_slides_server/src/rpc.rs:441:26

The 7c3c42a merge brought together two sources that both defined folder.pick:

  • async allowlist version from 808c4f5 (consults hero_proc secret folder_pick_allowed_roots in context hero_slides, falls back to ~/Documents) — the D-09-aligned keeper.
  • sync $HOME placeholder from PR #55 — superseded.

Fix: drop the sync placeholder, .await the async caller.

Generator.rs refactor — single builder path

Three former branches (text-only / multimodal / fallback) all hit ai.chat upstream — herolib_ai::generate_image_with routes any call with aspect_ratio + image_size set through the same chat path (hero_lib/crates/ai/src/client.rs:505). The builder is the superset; zero attachments degenerates to a plain text request.

Prompt framing stays conditional on attachment count so we don't tell the model "images attached" when none are present.

Matches the OpenRouter image-generation flow (chat-completions with images[] response).

Ported from development_kristof fb3b622

  • first_slide: Option<String> on DeckInfodiscovery.rs populates it from the first slide with a generated PNG; serialized into deck.list + deck_summary_value for UI thumbnail display.
  • --info JSON cleanup — hero_slides CLI binds no sockets, drop the rpc.sock entry; hero_slides_admin only binds admin.sock, drop the stale rpc.sock entry.

Skipped from fb3b622: the duplicate rpc.rs collection-handler block (already on development via #48/#50/#52/#53/#55); the narrower dependencies: ["hero_db_server"] (HEAD already has the more accurate ["hero_db_server", "hero_aibroker_server"]); the Cargo.toml dep pins (already on development via 1122aa7).

Skipped from development_casper: stale WIP, fully superseded.

Verification — end-to-end locally

  • hero_slides_server compiles + starts clean
  • folder.pick returns ~/Documents fallback (allowlist secret unset on local)
  • slide.generate via CLI on 04_sacha produced 4.8 MB PNG (2752×1536) in 20 s via Gemini Flash Image / OpenRouter
  • slide.getStaleness returns is_stale=false post-generate; fires content_edited=true on subsequent .md edit (ADR-0007 closed loop intact)
  • deck.list JSON now carries first_slide for both example decks (01_title for hero_slides_intro, 01_intro for sample_deck)
  • Browser UI confirmed working via admin dashboard

Diff stat

6 files, +110 / -177. Net code reduction from the generator.rs collapse.

Signed-off-by: mik-tf

Fixes the hero_slides_server compile break on `origin/development` (duplicate `handle_folder_pick` left by the `7c3c42a` merge), simplifies the image-generation path per the "not clean" feedback, and ports the `first_slide` field from `development_kristof`. ## Why this is needed `origin/development` does not currently compile for `hero_slides_server`: ``` error[E0428]: the name `handle_folder_pick` is defined multiple times --> crates/hero_slides_server/src/rpc.rs:2978:1 error[E0308]: `match` arms have incompatible types --> crates/hero_slides_server/src/rpc.rs:441:26 ``` The `7c3c42a` merge brought together two sources that both defined `folder.pick`: - async allowlist version from `808c4f5` (consults `hero_proc` secret `folder_pick_allowed_roots` in context `hero_slides`, falls back to `~/Documents`) — the **D-09**-aligned keeper. - sync `$HOME` placeholder from PR #55 — superseded. Fix: drop the sync placeholder, `.await` the async caller. ## Generator.rs refactor — single builder path Three former branches (text-only / multimodal / fallback) all hit `ai.chat` upstream — `herolib_ai::generate_image_with` routes any call with `aspect_ratio` + `image_size` set through the same chat path (`hero_lib/crates/ai/src/client.rs:505`). The builder is the superset; zero attachments degenerates to a plain text request. Prompt framing stays conditional on attachment count so we don't tell the model "images attached" when none are present. Matches the OpenRouter image-generation flow (chat-completions with `images[]` response). ## Ported from `development_kristof` `fb3b622` - `first_slide: Option<String>` on `DeckInfo` — `discovery.rs` populates it from the first slide with a generated PNG; serialized into `deck.list` + `deck_summary_value` for UI thumbnail display. - `--info` JSON cleanup — `hero_slides` CLI binds no sockets, drop the `rpc.sock` entry; `hero_slides_admin` only binds `admin.sock`, drop the stale `rpc.sock` entry. Skipped from `fb3b622`: the duplicate `rpc.rs` collection-handler block (already on `development` via #48/#50/#52/#53/#55); the narrower `dependencies: ["hero_db_server"]` (HEAD already has the more accurate `["hero_db_server", "hero_aibroker_server"]`); the Cargo.toml dep pins (already on `development` via `1122aa7`). Skipped from `development_casper`: stale WIP, fully superseded. ## Verification — end-to-end locally - `hero_slides_server` compiles + starts clean - `folder.pick` returns `~/Documents` fallback (allowlist secret unset on local) - `slide.generate` via CLI on `04_sacha` produced 4.8 MB PNG (2752×1536) in 20 s via Gemini Flash Image / OpenRouter - `slide.getStaleness` returns `is_stale=false` post-generate; fires `content_edited=true` on subsequent `.md` edit (ADR-0007 closed loop intact) - `deck.list` JSON now carries `first_slide` for both example decks (`01_title` for `hero_slides_intro`, `01_intro` for `sample_deck`) - Browser UI confirmed working via admin dashboard ## Diff stat 6 files, +110 / -177. Net code reduction from the generator.rs collapse. Signed-off-by: mik-tf
fix(slides): unbreak handle_folder_pick, collapse generator.rs to single builder path, port first_slide field
Some checks failed
Test / test (push) Failing after 3s
Test / test (pull_request) Failing after 3s
0afbde8ec5
hero_slides_server failed to compile on origin/development after the
7c3c42a merge left two handle_folder_pick definitions — the async
allowlist version added by 808c4f5 and the sync $HOME placeholder
from PR #55. The async version is the keeper per D-09; drop the sync
placeholder and add .await to the match-arm caller.

Collapse generator.rs to a single client.image_request().execute()
path. The three former branches (text-only, multimodal, fallback) all
resolved to ai.chat upstream — hero_lib client.rs:505 routes any
generate_image_with call with aspect_ratio + image_size set through
the same chat path. Builder is the superset: zero attachments
degenerates to a plain text request. Prompt framing stays conditional
on attachment count so we don't lie to the model about images that
aren't there.

Port the first_slide: Option<String> field on DeckInfo from
development_kristof fb3b622 — discovery.rs populates it from the
first slide with a generated PNG; expose it through deck_summary_value
and the deck.list handler for UI thumbnail display.

Clean up --info JSON: hero_slides CLI binds no sockets (drop the
rpc.sock entry); hero_slides_admin only binds admin.sock (drop the
stale rpc.sock entry).

Verified end-to-end locally:
- hero_slides_server compiles + starts clean
- folder.pick returns ~/Documents fallback (allowlist secret unset)
- slide.generate via CLI on 04_sacha produced 4.8 MB PNG in 20 s
- slide.getStaleness returns is_stale=false post-generate, fires
  content_edited=true on subsequent slide.md edit
- deck.list JSON now carries first_slide for both example decks

Signed-off-by: mik-tf
Author
Owner

Closing as superseded by upstream: despiegk pushed a83ffff (folder.pick async fix) and 3b89ec2 (generator.rs collapse) on origin/development while this PR was open, covering the same scope. Will follow up with a smaller PR for the still-unique parts (first_slide field on DeckInfo + --info JSON cleanup).

Closing as superseded by upstream: despiegk pushed a83ffff (folder.pick async fix) and 3b89ec2 (generator.rs collapse) on origin/development while this PR was open, covering the same scope. Will follow up with a smaller PR for the still-unique parts (first_slide field on DeckInfo + --info JSON cleanup).
mik-tf closed this pull request 2026-05-10 23:10:45 +00:00
Some checks failed
Test / test (push) Failing after 3s
Test / test (pull_request) Failing after 3s

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
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
lhumina_code/hero_slides!56
No description provided.