$ show thunderbird/thunderbolt
Thunderbolt is a full-stack, cross-platform AI chat and agent client built by Mozilla Thunderbird. It ships as a React/Vite web app, a Tauri desktop shell (macOS/Windows/Linux), native iOS/Android apps, and a Bun-based CLI. The system provides chat with multiple LLM providers (OpenAI-compatible, Anthropic, custom Tinfoil enclave), a skills system for user-defined slash-command instructions, voice mode with STT/TTS, MCP tool integration, ACP (Agent Client Protocol) remote agent support, and a widget system for rich chat outputs (weather, maps, citations, document previews, link previews). The backend is an Elysia/Bun server handling OIDC/SAML/OTP auth, an inference usage ledger with signed receipts, a CORS-bypassing proxy with streaming, and PowerSync sync coordination. Data flows from local SQLite (wa-sqlite/bun-sqlite) through an E2E-encrypted PowerSync pipeline to PostgreSQL, with device registration, envelope key storage, and canary proof-of-possession for recovery. The CLI provides a separate agent harness with iroh P2P transport, device-grant auth, and a workspace jail for safe file operations. The repo also contains a substantial AI evaluation framework (scenario-based scoring with Wilson confidence intervals), a Pulumi/K8s/Docker deployment stack, and a marketing/docs site in Astro. While the dominant character is clearly an application, it has a notable data-engineering flavor in its inference usage tracking, eval harness, and telemetry pipelines.
The LLM identified 6 files worth highlighting for reuse:
A pure, dependency-injected implementation of the RFC 8628 device authorization grant flow. Models the poll loop as a deterministic state machine with timeout, cancellation, and error transitions, making it trivially testable and reusable in any CLI or headless client that needs device-code auth against an OAuth 2.0 provider.
Statistical scoring for LLM evaluation runs, computing Wilson score intervals and comparing model performance against stored baselines. Self-contained math that can be extracted to evaluate any AI system's output quality, not just Thunderbolt's scenarios.
Path traversal protection for agent file operations, validating that all file reads/writes stay within a designated workspace root. Implements canonicalization, symlink awareness, and boundary checks in a way that is directly reusable for any agent tooling that grants LLMs filesystem access.
Energy-based voice activity detection with barge-in support for interrupting TTS playback. A self-contained audio signal processing component that can be dropped into any voice-enabled application needing endpoint detection without ML dependencies.
Streaming text chunk detector that groups tokens into natural word boundaries with a bounded fallback for CJK text and URLs. Solves the common problem of choppy streaming LLM output rendering; the algorithm is language-aware and framework-agnostic.
AES-GCM encryption codec with a cached content-key store and broadcast-channel invalidation across execution contexts (main thread, workers, tabs). Demonstrates a clean envelope-encryption pattern with key rotation support that could be reused in any local-first application requiring transparent field-level encryption.