Third revision: web search, MCP sign-in, exams, intelligent UI, clarifying questions
All checks were successful
Verify and publish V2 container / build-and-push (push) Successful in 1m0s

- Built-in Parallel web search (keyless; optional sign-in for higher limits and research)
  with its own settings page; OAuth sign-in (RFC 9728/8414/7591, PKCE, RFC 8707) for any
  MCP server, with token refresh and pre-registered client support
- Friendly tool steps (icon, name, status; details on click) and ids stripped from results;
  per-chat tool switches; taller thinking box
- Exams within classes: exam tabs, scoped lists, uploads, imports and Generate; exam-only
  material for generation; class setting for what the groups are called
- Assistant can ask clarifying questions in an inline form before generating
- OpenUI blocks (charts, questions, flashcards, inputs) in assistant, Explain and share chats
- Explain beside the quiz on wide screens, grounded in the cited source pages
- Quiz results: percentage ring coloured by score band, rainbow at 100
- Share links: assistant button like the owner's, hidden during quizzes; documents readable
  in the browser
- Live draft and library updates over server-sent events

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Elijah 2026-11-15 20:30:00 -07:00
parent 60cf2322f7
commit c595e0ff2c
54 changed files with 4710 additions and 387 deletions

View file

@ -103,6 +103,72 @@ generation the model may make up to four rounds of tool calls before it must sub
answer; the quiz check allows four external calls. Tool output is treated as data, not
instructions. On share links only servers with "Share links" switched on are offered.
### Signing in to MCP servers (OAuth)
Any server that answers 401 with a `WWW-Authenticate: Bearer resource_metadata=…` challenge
shows **Sign in** in its row. The app follows the MCP authorization spec (2025-06-18):
1. Reads the protected-resource metadata (RFC 9728), then the authorization server's
metadata (RFC 8414, falling back to OpenID discovery).
2. Registers itself by dynamic client registration (RFC 7591), unless a client ID (and
optional secret) is entered under the server's advanced settings. Registrations are kept
and reused.
3. Sends the browser to the sign-in page with PKCE S256, `state` and the `resource`
indicator (RFC 8707). The callback (`GET /api/ai/mcp/oauth/callback`) exchanges the code
and returns to the page that started it.
Tokens are encrypted like API keys, refreshed when within a minute of expiry, and retried
once after a 401. **Sign out** forgets the tokens. Pending sign-ins expire after 15 minutes.
### Built-in web search
Settings → Web search is a built-in entry backed by Parallel's MCP server
(`https://mcp.parallel.ai/mcp`, override with `WEB_SEARCH_URL`). It works without an account
on Parallel's free tier; **Sign in with Parallel** uses the same OAuth flow against
`/mcp?login` for higher limits, and then offers deep research (`web_research`) when switched
on. Only `web_search` and `web_fetch` (plus research) are offered; Parallel's bookkeeping
arguments (`session_id`, `client_model`) are hidden from the model, and ids, usage and
warnings are stripped from results. It is on for chat and Explain by default (off in tests),
with its own instructions and area switches like any server.
### Tool steps
Every tool call shows as one line: an icon for the kind of tool, a friendly name ("Searched
the web for: …", "Read pubmed.ncbi.nlm.nih.gov", "Drug reference: Lookup drug") and a
spinner, check or cross. Clicking it shows the pages found, the request and a clipped result.
More than three finished steps fold into "N steps". The model is told never to mention tool
names or internal ids. In a chat, the sliders button left of + turns individual servers (and
web search) off for that conversation; the choice is saved with it.
## Clarifying questions
The assistant's `ask_user` tool shows up to four questions as an inline form (choices, several
choices, text or a number, with defaults) and ends the turn. The answers are sent as the
user's next message, and the stored tool result travels with that message, so the model sees
question and answer together. The prompt tells the model to ask before generating when the
exam, materials or count are missing and not clear from the page in view, to ask at most once
per request, and to use defaults when the user says to go ahead.
## Exams within a class
A class is divided into exams (or units, modules, weeks, topics or folders: Class settings →
"Divided into"). Exams are the existing folders; `classes.group_label` holds the name. The class
page shows one tab per exam plus "Not in an exam" and "All", opening on the last exam (the
choice is remembered per class). Uploads, pasted text, imports, new items and Generate default to
the exam in view. Generating for an exam uses only that exam's documents (also for weak areas
and searches), and the draft is saved in that exam; an exam from another class is refused. The
assistant is told the class's exams with their ids, which exam is in view, and passes `exam_id`
to its generate and search tools.
## Intelligent UI in chats
Assistant replies (owner, Explain and share-link chats) can include interactive blocks written
in OpenUI Lang inside ```` ```openui-lang ```` fences, rendered with `@openuidev/react-lang`
against the app's own component library (`shared/genui.ts` lists it; `web/src/genui/` renders
it): layout, callouts, stats, tables, steps, bar/line/pie charts with a table view, sliders and
inputs bound to variables, practice questions, flashcards and follow-up buttons that send a
message. Library telemetry is off (`OPENUI_TELEMETRY_DISABLED=1`, `DO_NOT_TRACK=1`).
## AI on share links
Each share link has two switches, both off by default: