Skip to content

feat(devtools): simplify tracing + professional dark theme#40

Open
cpluss wants to merge 22 commits intomainfrom
cpluss/devtools-spec
Open

feat(devtools): simplify tracing + professional dark theme#40
cpluss wants to merge 22 commits intomainfrom
cpluss/devtools-spec

Conversation

@cpluss
Copy link
Contributor

@cpluss cpluss commented Feb 2, 2026

Summary

This PR includes two improvements to DevTools:

1. Simplified Tracing Setup (NEW)

Reduces devtools tracing from ~20 lines of OpenTelemetry boilerplate to one line:

// Before: imports, TracerProvider, SpanProcessor, Exporter setup...
// After:
cria.devtools();
await prompt.render({ budget: 2000 });

Changes:

  • Add src/devtools.ts with enableDevtools(), shutdownDevtools(), getGlobalDevtoolsHooks()
  • Add devtools property to cria namespace
  • Auto-inject hooks in render() when devtools is enabled
  • Add OpenTelemetry as optional peer dependencies
  • Update docs and examples

2. Professional Dark Theme (Previous)

Simplifies the Cria DevTools UI: black background, white text, yellow accent.

  • Remove branding header and "LIVE" indicator
  • Remove redundant summary grid
  • Simplify colors: pure black (#000) and white (#fff)
  • Default to Payload tab
  • Reduce CSS by 38%

Test Plan

  • npm exec -- ultracite check passes
  • npm test passes (111/111)
  • Manual: run cria-devtools and devtools-smoke example

@cpluss cpluss force-pushed the cpluss/devtools-spec branch from f63c8c6 to b0a0de9 Compare February 2, 2026 13:39
cpluss added 17 commits February 3, 2026 10:06
Adds a Chrome DevTools-style inspector for Cria prompts that leverages
OpenTelemetry traces to provide visibility into prompt composition,
token budgeting, and the fitting process.

- New @fastpaca/cria-devtools package with OTLP receiver and React UI
- Session list with status filtering (All/Ok/Error)
- Detail view with Headers/Payload/Fit Loop/Timing/Raw tabs
- Live SSE streaming for real-time session updates
- Before/after message snapshots showing fit transformations
- Updated hello-world example with OTel instrumentation
- Tighter spacing and smaller font sizes for data-dense display
- Side-by-side layout with fixed-width details panel
- Added 🦙 alpaca emoji to header for brand identity
- System fonts for better performance
- Subtle pulse animation on live indicator
- Improved responsive breakpoints
- Chrome DevTools-inspired dark theme (#0d0d0d background)
- Larger font sizes for readability (12-16px range)
- Resizable split panel with drag handle
- Yellow accent color from fastpaca brand
- Sharp edges, no rounded corners
- Prevent flash of white on page load
- Extract SessionDetails component for maintainability
- Default to "Sent" (after) view in Payload tab
- Remove duplicate Headers/Raw tabs (keeping Raw only)
- Remove topbar branding and LIVE indicator
- Remove redundant summary grid in detail panel
- Simplify color palette from 7 grays to pure black/white
- Default to Payload tab instead of Headers
- Fix truncated "SUCCESS" badge
- Reduce CSS from 796 to 496 lines

The new design follows fastpaca's principle: show the content, not the chrome.
- Group assistant messages with their tool invocations visually
- Add timeline connectors showing message flow
- Deep JSON parsing for nested stringified data
- Brutalist design matching fastpaca.com aesthetic (sharp edges)
- Add rich example for testing complex conversations
Refresh all devtools screenshots with the current UI state showing
the professional dark theme with weather-assistant example data.
- Rename "Fit Loop" tab to "Diff" for clarity
- Remove Timing tab (duration already shown in session header)
- Clean up unused timing CSS (~1KB reduction)
- Remove 60 lines of dead CSS (unused tool-calls-list, pill classes)
- Consolidate useResizablePanel and useResizableColumn into single useResizable hook
- Replace 80-line custom LCS diff algorithm with fast-diff library
- Replace manual validation with Zod schema for session imports
- Simplify stableKeyForValue function

Total: 168 lines removed (247 deletions - 79 insertions)
- Consolidate formatTime/formatDateTime into single formatDate function
- Add reusable ToggleGroup and MetaItem components
- Add cx() helper for className construction
- Simplify deepParseJson using Object.fromEntries
- Remove hashString function, use stable index keys for diff ops
- Replace all toggle-group patterns with ToggleGroup component
- Replace all meta-item patterns with MetaItem component

Net reduction of 35 lines while improving component reusability.
Split the 1800-line app.tsx into focused modules:
- app.tsx (456 lines): Main app with sessions table
- components/common.tsx: Shared UI (ToggleGroup, MetaItem, etc.)
- components/diff.tsx: Diff view components
- components/json-viewer.tsx: JSON tree viewer
- components/messages.tsx: Message/timeline components
- components/session.tsx: Session detail panels
- hooks/: useResizable, useSessionStream
- utils/: cx, format, json, download utilities

Total: ~1860 lines across 12 files (no barrel files per lint rules)
@cpluss cpluss force-pushed the cpluss/devtools-spec branch from ab540cd to bb1ca1f Compare February 3, 2026 10:14
Reduces devtools tracing setup from ~20 lines of OpenTelemetry boilerplate
to a single line: `cria.devtools()`.

- Add src/devtools.ts with enableDevtools(), shutdownDevtools(), and
  getGlobalDevtoolsHooks() for auto-injection
- Add devtools property to cria namespace object
- Auto-inject devtools hooks in render() when enabled
- Add OpenTelemetry as optional peer dependencies
- Update docs and examples with simplified API
@cpluss cpluss changed the title style: professional dark theme for devtools UI feat(devtools): simplify tracing + professional dark theme Feb 3, 2026
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