Skip to content

feat(ai): Librarian Agent web UI — Ask the librarian (AI-Agent-3)#399

Open
mrviduus wants to merge 1 commit into
mainfrom
feat/librarian-ui
Open

feat(ai): Librarian Agent web UI — Ask the librarian (AI-Agent-3)#399
mrviduus wants to merge 1 commit into
mainfrom
feat/librarian-ui

Conversation

@mrviduus

Copy link
Copy Markdown
Owner

The web UI for the Librarian agent — surfaces a shipped agent that had no UI (architect → frontend → adversarial QA cycle).

What

  • "Ask the librarian" at /:lang/discover (entry from the Discover menu). NL query → POST /me/librarian → the agent's reasoning + ranked recommendation cards (title, authors, per-item why).
  • Library recs → reuse the catalog book card, link to /:lang/books/{slug}. External (open_library) recs → clearly-marked "Suggestion — not in your library yet", no in-app navigation (backend is recommend-only; an external suggestion must never look like a real catalog book). usedExternal note when it reached beyond the catalog.
  • useLibrarian state machine (idle→asking→results|empty|error), client query guard mirroring the backend (≥2 / ≤500).
  • Reuses the Tutor-UI hardening: mounted-guard + AbortController, same-query retry(), line-clamped + React-escaped LLM strings. Auth-gated (signed-out → auth modal), SEO-noindexed.

QA (adversarial) — 0 blockers / 0 should-fixes

The two real risks both guarded + test-covered: a library rec with a null slug → falls back to a non-link card (no /books/undefined); an open_library rec → never renders a link. Only minor/info (pages pluralization matches existing patterns).

Verify

tsc clean · 595 web tests green (11 new) · vite build green · browser-checked (query → reasoning + library link + marked external suggestion + usedExternal + empty / error / min-query-blocked / signed-out, 0 console errors).

Deferred

Mobile Librarian UI, SSE streaming, "add external book to my library"/ingest, pagination.

🤖 Generated with Claude Code

Frontend for the shipped Librarian agent: NL book-discovery at /:lang/discover.
Query -> POST /me/librarian -> the agent's reasoning + ranked recs. Library recs
link to the book page; external (open_library) recs are clearly-marked
suggestions with NO in-app nav (recommend-only — never masquerade as a catalog
book). usedExternal note when it reached beyond the catalog. New DiscoverPage,
useLibrarian state machine, LibrarianResults/Card, librarian.ts client.

Reuses Tutor-UI hardening (mounted-guard/abort, same-query retry, clamped LLM
strings). Auth-gated, noindex. QA: 0 blockers (null-slug -> no broken link;
external -> never a link; both test-covered).

tsc clean; 595 web tests green (11 new); vite build green; browser-checked
(reasoning + library link + marked external + usedExternal + edge states, 0 console errors).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant