The remaining three trust surfaces ship in this commit, completing
Wave 13.C and unlocking MAG.8 (debug-overlay).
──────────────────────────────────────────────────────────────────
<PrivacyBadge> · Wave 13.C.6
──────────────────────────────────────────────────────────────────
packages/ai-ui/src/PrivacyBadge.tsx (new)
- 4 modes: on-device · cloud · hybrid · unknown
- Token-tinted (success/info/accent/neutral) — instant trust
signal without forcing the user into settings
- Optional `detail` line (model id, device name, routing policy)
- `iconOnly` variant for sidebar / tray placements
- role=status + composite aria-label
──────────────────────────────────────────────────────────────────
<ProvenanceDrawer> · Wave 13.C.4
──────────────────────────────────────────────────────────────────
packages/ai-ui/src/ProvenanceDrawer.tsx (new)
- Slide-in right drawer listing every step the model + tools took
- Pure presentation — host passes the event array straight through
- role=dialog + aria-modal + aria-labelledby
- Initial focus on close button; Esc + backdrop both close
- Body scroll lock while open (restores prior overflow value)
- Empty-state copy when events=[]
- Per-row <details> slot for inspecting full payload
──────────────────────────────────────────────────────────────────
<DebugOverlay> · Wave 13.C.5 (MAG.8 magnet)
──────────────────────────────────────────────────────────────────
packages/ai-ui/src/DebugOverlay.tsx (new)
- Wraps any child surface — Shift-click reveals a modal inspector
with the raw JSON payload
- Modifier configurable: shift (default) / alt / meta
- Production toggle: `disabled` short-circuits the wrapper (no
cursor-hint, no click interception)
- role=dialog + aria-modal + Esc to close + focus restore on close
- Stringifies payload safely (catches non-serialisable values)
- Cursor: help on the wrapper to hint discoverability
──────────────────────────────────────────────────────────────────
Quality gates
──────────────────────────────────────────────────────────────────
✓ pnpm -F @bytelyst/ai-ui test → 79/79 passing (was 67/67)
+12 new cases:
- PrivacyBadge (3)
- ProvenanceDrawer (5: closed-state · dialog semantics ·
backdrop · Escape · empty-state)
- DebugOverlay (4: plain-click ignored · Shift opens · disabled
bypass · alt modifier)
✓ Exports wired in src/index.ts (PrivacyBadge, ProvenanceDrawer,
DebugOverlay + all types)
──────────────────────────────────────────────────────────────────
Roadmap tracker (lands in subsequent commit)
──────────────────────────────────────────────────────────────────
13.C.4 ProvenanceDrawer shipped
13.C.5 DebugOverlay shipped
13.C.6 PrivacyBadge shipped
MAG.8 the debug-overlay magnet (showcase lands in paired commit)
Wave 13.C is now complete (7/7). Wave 13 Futurism: 9/39 → 12/39.
|
||
|---|---|---|
| .. | ||
| src | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
| vitest.config.ts | ||
@bytelyst/ai-ui
AI-native UI primitives for ByteLyst products. The flagship deliverable
of Wave 2 in learning_ai_uxui_web/docs/ROADMAP_2026.md.
Status:
0.1.0MVP — 3 components + 1 hook + 1 utility. Subsequent 0.x bumps add<ToolCallCard>,<CitationChip>,<AgentTimeline>,<ModelPicker>,<ToolPalette>, and theuseToolCalls/usePromptHistory/useTokenCounthooks.
Quick start
import { ChatStream } from '@bytelyst/ai-ui';
export function ChatPage() {
return (
<div style={{ height: '70vh' }}>
<ChatStream
endpoint="/api/chat"
placeholder="Ask anything…"
emptyState={<EmptyHint />}
/>
</div>
);
}
Architectural decisions
Per learning_ai_common_plat/docs/ROADMAP_2026_DECISIONS.md:
- §10 hook shape —
useChat()returns the same shape as Vercel AI SDK'suseChat. Drop-in compatible for any engineer who has already written a chat UI with the AI SDK. - Transport is pluggable — products inject
endpoint,streamProtocol,fetcher, orheaders. We are not locked to Vercel's SSE wire format.
Components
<ChatStream>
Opinionated composition of useChat + <MessageBubble> +
<PromptComposer>. Auto-scrolls (sticky-bottom), shows Stop while
streaming, surfaces transport errors inline.
<MessageBubble>
Single chat message atom. Variants by role (user / assistant / system /
tool). Built-in "thinking" indicator while streaming with no content
yet. Honors --bl-* design tokens.
<PromptComposer>
Multi-line input. Enter submits, Shift+Enter newlines, Cmd/Ctrl+Enter
alternates submit. Auto-grows up to maxLines. Slot for leading
actions (slash-commands etc.).
Hooks
useChat(options?)
Vercel-AI-SDK-shaped:
const {
messages, input, setInput, handleInputChange, handleSubmit,
append, isLoading, error, stop, reload, setMessages
} = useChat({
endpoint: '/api/chat',
streamProtocol: 'text', // 'text' | 'sse' | 'data'
initialMessages: [],
onFinish: (msg) => console.log('done', msg),
onError: (err) => console.error(err),
});
streamText(response, protocol?, signal?)
Low-level async generator that yields text deltas from a streaming
HTTP response. Supports 'text', 'sse', and 'data' protocols.
Wire protocols
| Protocol | Body format | Use when |
|---|---|---|
'text' (default) |
Plain text, streamed chunk-by-chunk | Any backend that pipes an LLM stream directly |
'sse' |
Server-Sent Events with data: ... frames |
OpenAI-compatible, Anthropic, most HF inference |
'data' |
Vercel AI SDK "data stream" prefix protocol | Backends using streamText() from ai/server |
For tool calls / citations / images, use 'sse' or 'data' once the
matching components ship in 0.2.x.
Tests
pnpm --filter @bytelyst/ai-ui test
Roadmap
0.2.0—<ToolCallCard>,<CitationChip>,useToolCalls()0.3.0—<AgentTimeline>,<ModelPicker>0.4.0—<ToolPalette>with MCP discovery0.5.0—<Markdown>+<CodeDiff>(Wave 2 stretch)1.0.0— API freeze when 3+ products consume in production