BIU UI/Blocks/AI Chat Screen
Live ScreenInset & Flat6 Agent Primitives

AI Chat Screen

Full-page AI agent conversation workspace assembling App Shell with Chat Composer, AI Message & Citations, Thinking State, Tool Call Card, Approval Card, and a live Run Context inspector.

ProAI Chat Screen is a BIU UI Pro block — interactive preview is open; @biudev-pro/ai-chat-screen Registry access coming soon.
MIT open-source core available today
packages/ui/src/components/ai-chat-screen.tsx
Q3 edge caching auditclaude-sonnet
q3-latency-export.csv48 KB

Audit our Q3 edge caching rollout — how much did p95 latency and egress cost improve?

Claude Sonnet 4Cited answer

Enabling stale-while-revalidate across the Tokyo and Frankfurt edge pops cut median API latency by 42% 1, bringing checkout p95 down to 38ms across 1.4M requests with zero 5xx regressions 2.

On the infrastructure side, static asset cache hit ratio reached 96.4%, trimming origin egress spend by $1,480/month 3.

When to use

Good fit

AI copilots, research assistants, internal ops agents, and coding workspaces that combine multi-thread navigation, streamed answers, tool inspections, human approvals, and verifiable citations.

When not to use

Lightweight help popovers or inline comment widgets — compose <ChatComposer /> and <AiMessage /> directly instead of mounting a full 3-pane shell.

Key capabilities

All 6 Agent primitives wired together

Combines ChatComposer, AiMessage, ThinkingState, ToolCallCard, ApprovalCard, and AgentActivity inside AppShellFlat so every interaction flows across panes.

Linked citations & Sources inspector

Clicking any inline [1] citation badge automatically opens the right Run context pane, switches to the Sources tab, and highlights the referenced source card.

Interactive human-in-the-loop approval

Switch to the Staging DB migration thread to approve or reject a high-risk shell.exec tool call with live step plan updates and a follow-up execution turn.

Simulated streaming, Stop & New chat

Send a prompt from any thread or click New chat to pick a starter card — the composer enters streaming mode with an instant Stop generating abort control.

API Reference

Connect your backend with onSendMessage and onApprovalDecision, then publish each conversation update as a new threads array. Set streaming on the active assistant turn and supply onStopGenerating to let users request cancellation.

AiChatScreenProps

PropTypeDefaultDescription
layout'inset' | 'flat''inset'Shell geometry passed to AppShellFlat (inset framed cards or flat hairlines).
workspacestring'Acme AI'Workspace display name shown in the left sidebar header.
userAppShellUser{ name, email }Signed-in user rendered in the sidebar footer menu.
threadsreadonly AiChatThread[]DEFAULT_AI_CHAT_THREADSConversation snapshot with messages, run plan steps, and metering. Pass a new array to publish updates.
defaultThreadIdstring'thread-edge-cache'Initially selected thread ID, or new-chat to start on the welcome screen.
modelsreadonly ChatComposerModel[]DEFAULT_CHAT_MODELSSelectable model entries in the bottom composer.
approvalModesreadonly ChatComposerApprovalMode[]DEFAULT_APPROVAL_MODESApproval mode picker items (Ask, Auto, Read-only).
defaultInspectorOpenbooleantrueWhether the right Run context inspector is expanded initially.
onSendMessage(threadId, payload) => void—Handles prompt submission in place of the demo response. For a new chat, publish the conversation using the provided thread ID.
onStopGenerating(threadId) => void—Handles Stop generating for a host-managed response. Publish the settled turn through threads.
onApprovalDecision(threadId, msgId, decision, reason?) => void—Handles an ApprovalCard decision in place of the demo execution. Publish the resulting approval status and plan through threads.

AiChatThread

FieldTypeDefaultDescription
id / titlestring—Unique thread identifier and sidebar label.
badgestring | number—Optional counter pill shown on the thread row (for example pending approvals).
modelId / tokens / coststring—Run metadata rendered in the Run Context header and meter footer.
stepsreadonly AgentActivityStep[]—Live execution plan rendered by AgentActivity in the right inspector.
messagesreadonly AiChatTurn[][]Ordered user and assistant turns with optional thinking, tools, approval, citations, and followUps.

Included Primitives

Installing ai-chat-screen automatically pulls these BIU UI primitives through the shadcn Registry: