feat: live shelf ingest progress + import gate for non-ready books

Draft
CU
5mo ago
+929-8

Summary

Two UX improvements from a full user walkthrough of the Kinora desktop app:

1. Live shelf ingest progress (large improvement)

The backend already exposes GET /api/books/events (SSE) for ingest_progress, but the shelf never subscribed — import status chips froze until manual refresh.

  • Added LibraryEventStream in @kinora/core with cache patching helpers
  • Desktop shelf subscribes via EventSource + polls every 3s while any book is importing
  • Mobile shelf polls while importing (no EventSource on RN)
  • Status chips now show stage + percent (e.g. Canon · 42%)

2. Import gate for non-ready books (from testing feedback)

Walkthrough found that books with IMPORT FAILED opened into a normal reading room with no error — users couldn't tell anything was wrong.

  • Block opening importing / failed books from the shelf with a clear dialog (desktop + mobile)
  • Reading room route also shows a gate if navigated directly
  • Shared copy in @kinora/core (importGateMessage)

Bonus

  • Added Little Red Riding Hood as a second bundled public-domain demo PDF (assets/books/little_red_riding_hood.pdf)
  • Fixed Linux Electron startup crash by loading electron-liquid-glass via dynamic require (graceful skip when native module unavailable)

Verification

make demo-pdf
pnpm --filter @kinora/core test
pnpm --filter @kinora/desktop typecheck
make stack-up && make seed-demo && make app-desktop-dev

Manual walkthrough: login as e2e@kinora.test, confirm live import chips, tap failed Little Red Riding Hood → import gate dialog instead of reading room.

New book

Public-domain Grimm tale built with assets/books/build_little_red_cap_pdf.py (5 pages, 3 characters for canon lock).

Open in Web View Automation 

Summary by cubic

Adds live import progress to the shelf and blocks opening books that aren’t ready. Users see real-time stage and percent, and get a clear gate for importing or failed books.

  • New Features

    • Live shelf progress: desktop subscribes to GET /api/books/events via LibraryEventStream in @kinora/core with a 3s poll fallback; mobile polls while importing. Status chips show “Stage · %”.
    • Import gate: block opening importing/failed books on the shelf and in the reading room. Desktop dialog and mobile sheet use shared copy via importGateMessage in @kinora/core.
    • Demo content: adds “Little Red Riding Hood” PDF; make demo-pdf now builds it.
  • Bug Fixes

    • Prevent Linux Electron startup crash by loading electron-liquid-glass with dynamic require when the native module isn’t available.