Repository navigation
Description
Goal
People ask questions about their workspace in plain language. The answer comes back as something they can read and work with: a table of the entities in question, a ranked list of which sources produce duplicates, a run summary with its counts, a review pair with its evidence. All of it renders in our own components rather than as a paragraph of prose.
OpenUI (MIT) is the renderer. The model writes OpenUI Lang, a compact DSL that renders while it streams. The browser renders it with a component library that we register and control, and nothing outside that library can render.
Owner decision (2026-12-02)
The owner asked for this feature on 2026-12-02. It reverses part of the 2026-11-26 board prune, which put "AI and MCP" out of scope (#1008).
The pruned epics stay closed, and this epic needs none of them:
- E26 — LLM provider layer, BYOM, AI off #536, E26, the Rust provider layer;
- E25 — AI authoring and recommendations #537, E25, AI authoring;
- E28 — In-app agent and published MCP server #538, E28, the in-app agent and the MCP server.
What this builds on: the assistant already exists
Verified in the code at 71a493d5:
- The screen.
/[org]/[ds]/assistantandfrontend/src/components/assistant/assistant-chat.tsxare a streamed chat with expandable tool citations (design §5.8, "talk with your data"). - The loop.
frontend/src/app/api/orgs/[org]/datasets/[ds]/assistant/route.tsis a Messages API tool loop in the BFF (@anthropic-ai/sdk). It runs up to 8 rounds and emits SSEtext,tool,actions,doneanderrorevents. - The tools.
frontend/src/lib/assistant/tools.tsdefines 8 read-only tools. They run with the dataset's viewer credential throughforward(), so erserver enforces tenant isolation and read-only access; the prompt does not. - The controls.
- Per-org AI settings, with a bring-your-own key and an off switch (
lib/ai/config.ts,org_ai_settings). - Per-round metering through
meter(org, "ai_assistant", …). - V9 steward proposals, which become confirm cards and never execute on the model's say-so.
- Per-org AI settings, with a bring-your-own key and an off switch (
- The tests. The functional tier scripts the model:
tests/mock-erserver/server.mjsserves/anthropic/v1/messages, andtests/functional/grow.spec.tsdrives the real loop through it.
So the new work is the answer surface and the data reach. The chat stack itself already exists.
Decisions (recommended here; the spike confirms or overturns them)
- Use only
@openuidev/react-lang, which providesRenderer,defineComponentandcreateLibrary. Version 1.2.0 is MIT, and its peers (react ≥19, zod^3.25 || ^4) are already met. Not the other packages:@openuidev/react-uiships its own unlayered CSS, d3-scale and d3-shape charts, react-markdown and katex. That contradicts the hand-rolled-charts decision (frontend-data-ui) and the closed token set (frontend-design-system).@openuidev/servercalls Thesys's hosted Gateway withTHESYS_API_KEYfor its autofix and conversation features.@openuidev/react-headlesspulls in@ag-ui/coreand a Vercel AI SDK peer to parse a stream we already parse.
- The loop stays in the BFF.
library.prompt()generates the system prompt from the same library the browser renders. There is no generated artifact to drift, and nothing for Rust to carry. Tools keep going throughforward()with the viewer credential. - Keep our SSE protocol. Feed the accumulated
textinto<Renderer response isStreaming>. There is no translation into AG-UI or OpenAI-shaped streams. - Bind, don't transcribe. The model never copies rows or numbers into the UI. A data component names the tool result it shows, and the browser resolves it from the results the same stream delivered. Every rendered value traces to a cited tool call in the same turn.
- A closed library of our own components.
- No
Mutation()and no@OpenUrl. - Links resolve to in-app routes only.
- V9 proposals stay on their own
actionschannel.
- No
Facts found while planning that shape the tickets
@openuidev/lang-coreships telemetry.- It declares
"postinstall": "node ./postinstall.cjs", which sends pseudonymous install telemetry to PostHog. - Runtime telemetry on
library.prompt()is opt-in throughOPENUI_RUNTIME_TELEMETRY_ENABLED. - pnpm runs no dependency lifecycle script that isn't in
onlyBuiltDependencies, so the postinstall is blocked today. Adopt @openuidev/react-lang: exact pin, supply-chain gates, telemetry provably off #1530 keeps it that way and asserts it.
- It declares
- No
eval(ornew Function(appears in the published tarballs of react-lang 1.2.0, lang-core 1.2.0, devtools 0.3.1 or observability 0.0.4 (grep). The CSP should hold:script-src 'self' 'unsafe-inline'(nounsafe-eval) andconnect-src 'self'. Spike: OpenUI react-lang inside the assistant (streaming, result binding, prompt size) #1529 proves it in a browser. max_tokens: 1500in the route is too small for a program that lays out a table and a chart (The assistant route speaks OpenUI Lang: result events, binding rules, prompt caching, stop reasons #1532).tokensFrom()sums onlyinput_tokens + output_tokens. Turning on prompt caching moves tokens intocache_read_input_tokens, so metered usage would silently drop (The assistant route speaks OpenUI Lang: result events, binding rules, prompt caching, stop reasons #1532).- Prod's
ANTHROPIC_API_KEYis set out of band.infra/terraform/envs/prod/secrets.tfseeds it as empty, and whether prod has a key today is unverified (Release: generated answers on in dev, then prod #1538).
Children
| # | Ticket | Est. (wk) |
|---|---|---|
| 1 | #1529 Spike: OpenUI react-lang inside the assistant | 0.5 |
| 2 | #1530 Adopt @openuidev/react-lang: pin, supply-chain gates, telemetry provably off |
0.5 |
| 3 | #1531 The answer component library | 2.0 |
| 4 | #1532 The assistant route speaks OpenUI Lang | 1.0 |
| 5 | #1533 The assistant renders generated answers | 1.0 |
| 6 | #1534 Widen the read-only toolbox to the analytics the API already serves | 1.0 |
| 7 | #1535 Generated-UI threat model | 0.5 |
| 8 | #1536 Live eval set for generated answers | 1.0 |
| 9 | #1537 Ask from where you are: explain this run, this score, this entity | 1.0 |
| 10 | #1538 Release: generated answers on in dev, then prod | 0.5 |
The total is about 9 engineer-weeks. Estimate the children only; the parent isn't summed.
Sequencing
- Spike: OpenUI react-lang inside the assistant (streaming, result binding, prompt size) #1529 first. Its write-up amends §5.8 and confirms or overturns the decisions above.
- Adopt @openuidev/react-lang: exact pin, supply-chain gates, telemetry provably off #1530 is the first merged code PR.
- Then, in parallel:
- The answer component library: a closed OpenUI library built from our primitives and hand-rolled charts #1531, the library;
- The assistant route speaks OpenUI Lang: result events, binding rules, prompt caching, stop reasons #1532, the route;
- Widen the assistant's read-only toolbox to the analytics the API already serves #1534, the tools.
- The assistant renders generated answers: Renderer per turn, citations per component #1533 once The answer component library: a closed OpenUI library built from our primitives and hand-rolled charts #1531 and The assistant route speaks OpenUI Lang: result events, binding rules, prompt caching, stop reasons #1532 land.
- Generated-UI threat model: injection through record values, links, size caps, no write path #1535 reviews The answer component library: a closed OpenUI library built from our primitives and hand-rolled charts #1531 through The assistant renders generated answers: Renderer per turn, citations per component #1533 and gates the release. Live eval set for generated answers: parse rate, grounding, correctness, cost per answer #1536 can start as soon as The assistant route speaks OpenUI Lang: result events, binding rules, prompt caching, stop reasons #1532 lands.
- Ask from where you are: explain this run, this score, this entity #1537 after The assistant renders generated answers: Renderer per turn, citations per component #1533.
- Release: generated answers on in dev, then prod #1538 last.
Adjacent work: #1520 surfaces per-task counters and output, the same data #1534's get_job_tasks tool reads. #1523 adds phase read routes, which become tool candidates once they land.
Not in this epic
- Text-to-SQL over the lake. SQL the model writes against a tenant's catalog falls in the "config-as-code raw SQL" class the
securityskill names, and it bypasses the declared-statement rule (entity-framework). Live eval set for generated answers: parse rate, grounding, correctness, cost per answer #1536 may show questions the read routes cannot answer. If it does, the follow-up is a governed aggregate endpoint in er-server with declared dimensions and measures. That would be a separate decision. - Persisted conversation history. Threads would store tool results, including golden-record PII, in erweb Postgres. That needs a retention decision first.
- An API or MCP surface for chat. E28 (E28 — In-app agent and published MCP server #538) stays pruned.
- Write actions from generated UI. V9 proposals remain the only path, unchanged.
Rollout
There is one flag, ERWEB_ASSISTANT_GENUI_ENABLED. With it off, the assistant answers in text exactly as it does today. It turns on in dev first, then in prod (#1538).
Risks
- Model output is untrusted input. Record values come from customers' source systems. They reach the model through tool results and can carry instructions (Generated-UI threat model: injection through record values, links, size caps, no write path #1535).
- Cost. A generated answer spends more output tokens than prose, and the OpenUI system prompt is large. Prompt caching (The assistant route speaks OpenUI Lang: result events, binding rules, prompt caching, stop reasons #1532) and the per-answer cost measured in Live eval set for generated answers: parse rate, grounding, correctness, cost per answer #1536 set the model and effort defaults.
- Dependency maturity. react-lang 1.2.0 was published on 2026-11-24. The repo shows about 16k stars, with 85 open issues and 130 open PRs. It is pinned exactly, and only
frontend/src/lib/genui/imports it (Adopt @openuidev/react-lang: exact pin, supply-chain gates, telemetry provably off #1530), so replacing the renderer touches one directory. - Motion. Rendering while streaming must respect
.claude/skills/frontend-design-system/references/motion.md. Motion explains a state change, and nothing animates its layout on mount.
Design references
.claude/skills/frontend-design-system/references/frontend-design.md§5.8.- Skills:
frontend-bff,frontend-data-ui,frontend-design-system,frontend-testing,security,ci-and-supply-chain,observability.
Activity