feat(background+pdf): subfolder context, per-file selection, PDF extraction, and multimodal improvements #21
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "development_link_pdf_extracted_markdown_v2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
This PR covers the full scope of the background-panel and PDF-extraction feature cycle. An earlier PR (#20) was closed as stale — it described only the initial background subfolder work while the branch had grown to include PDF extraction, link support, and context sync fixes. This replacement covers everything at the current commit.
Changes
Background panel
_bgSelectionDeckPathguard indashboard.js)PDF extraction
discovery.rs: detect AI-auto-extracted.mdcompanions for PDFs via the<!-- Auto-extracted frommarker; exposehas_extracted_md/is_extractedflags onBackgroundFile; exclude extracted companions from folder file countstypes.rs: addhas_extracted_mdandis_extractedfields toBackgroundFilerpc.rs/routes.rs: new endpoints wired for PDF extractionMultimodal image improvements
Rhai / generator
deck_module.rs/slide_module.rs: new bindings for link and PDF extraction featuresgenerate_slide.rhai: updated image directive handlinggenerate_job.rs/agent.rs: per-file selection threaded through both create and instruct pipelinesKnown shortcomings (see ADR 0003)
discovery.rs,dashboard.js) had their conflicts resolved in the working tree but were left unstaged — they were staged and committed in a single broad commit rather than as a focused resolution commit.development_link_pdf_extracted_markdown_v2) understates the scope of changes.test/,test2/,examples/dasd/) are present but untracked;.gitignoreshould be updated.PRD: Background Context Transparency & UX
The background context system works correctly under the hood but is opaque to users. This PRD addresses seven distinct failure modes to make the system legible and trustworthy.
Goals
Functional Requirements (selected)
.mdcompanion show a distinct visual state (muted icon + warning badge) in the background panel.localStoragekeyed by deck path.Full requirement list in
docs/prd/0001-background-context-transparency.md.Open questions
encode_image_for_model. Separate PR or bundle?ADR-0001: Generate All Slides respects the active context selection
Problem: "Generate All Slides" bypassed the context selection and sent all background folders to every job. Individual slide generation respected the selection. This asymmetry silently overrode explicit user configuration.
Decision: Single button, respects selection (Option A). "Generate All Slides" uses the same active selection as individual generation. A context summary in the toolbar (FR6) makes the active selection visible before clicking.
Option B (two explicit buttons) was rejected — adds UI complexity for an advanced workflow most users never need. Option C (do nothing) perpetuates a silent override.
ADR-0002: Context selection persists to localStorage per deck path
Problem: The active context selection lived only in JavaScript memory — lost on reload, lost on tab close, reset on deck change.
Decision:
localStorageper deck path with 24-hour expiry (Option A). Covers same-session reload friction without risking stale selections from previous days. Fails silently if storage is unavailable.Storage key:
hero_slides_context_selection_v1__{base64(deck_path)}ADR-0003: PR process shortcomings on this feature branch
Five process mistakes made during this cycle, recorded so they are not repeated:
discovery.rsanddashboard.jshad conflicts resolved in the working tree butgit addwas never run; index remained broken.development_link_pdf_extracted_markdown_v2implies only PDF/link work; actual scope included background subfolders, context sync, select-all UI, and more.test/,test2/,examples/dasd/left as noise in everygit status.Related Issue
Closes #7
Two commits landed since PR open:
eca2050— closes #28 (rename admin Templates tab → Prompts)0251648— phase 1 of #25 (route background images throughImageRef). Requires hero_lib PR 129 which depends on #125. Current local workspace builds green via the../hero_libpath-patch pointing at PR 129's head.Phase 2 of #25 (markdown
parsing, label assignment, per-image intent) is the next thing to land on this branch.🤖 via Claude
Collapses two `if let Some { if ... }` nests into `if let Some && ...` in discovery and slide_ops, replaces a manual splitn(2, ...) with split_once, silences the unused rpc_discover spec in the basic_usage example, and allows too_many_arguments on four fns that legitimately exceed the 7-arg default (generate_slide, generate_slide_content, rhai slide_instruct_content, server submit_instruct_content_job). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>Replace untyped `Theme { raw_content }` with a typed record: name, kind, description, tags, the prompt-facing `style` prose, reference images, and a `source` provenance marker. Add `parse_theme_toml(dir)` for the new `themes/<name>/theme.toml` format; `parse_theme(path)` keeps parsing the legacy `theme.md` into `Theme { source: LegacyMd(..), style: contents }` so existing decks round-trip without migration. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>Pull request closed