How abdullah61305/bruno works
Purpose and Entry Points
Bruno is a Windows tray-resident voice companion: push-to-talk or hands-free speech is transcribed locally, sent to an LLM, optionally augmented with screen/browser tools, then spoken as streamed sentences. Runtime entry is bruno/__main__.py, which delegates application composition and CLI behavior to bruno/app.py; the packaged Windows build is produced by scripts/build.py.
Application Composition and Lifecycle
bruno/app.py is the composition root: it selects concrete implementations for protocol-defined stages, initializes UI and persistent services, and coordinates startup/shutdown. bruno/pipeline.py owns the request lifecycle across capture, transcription, model response, tool execution, and speech. Shared lifecycle/state contracts live in bruno/core/protocols.py and bruno/core/state.py. A single-instance guard prevents competing tray processes in bruno/core/single_instance.py.
User Interaction and UI State
Global keyboard capture turns Alt+Space into press-to-record/release-to-send and interruption behavior through bruno/input/hotkey.py and Windows bindings in bruno/input/win32.py. Hands-free mode is coordinated in bruno/hands_free.py, using speech endpointing rather than key release. The tray UI and visual state indicators are implemented by bruno/ui/tray.py, bruno/ui/orb/window.py, and the embedded WebGL orb at bruno/ui/orb/index.html.
Audio and Local Speech Runtime
The microphone remains open and records with pre-roll buffering via bruno/audio/recorder.py; device discovery is in bruno/audio/devices.py. Hands-free end-of-speech detection uses Silero VAD in bruno/audio/endpointing.py. Local STT is encapsulated by bruno/stt/runtime.py and bruno/stt/whisper.py (faster-whisper). Responses are segmented for low time-to-first-word in bruno/tts/chunker.py, synthesized by Piper in bruno/tts/piper.py, and output through bruno/audio/player.py.
LLM Conversation and Provider Failover
Conversation history, prompts, and streaming/tool-call orchestration are centered in bruno/llm/conversation.py, bruno/llm/prompt.py, and bruno/llm/chain.py. bruno/llm/factory.py instantiates configured backends; bruno/llm/providers.py, bruno/llm/groq.py, and bruno/llm/openai_compatible.py support multiple hosted providers and failover when quota or provider failures occur. Text—and screenshots only when requested—crosses this external-service boundary; audio transcription stays local.
Explicit Capabilities: Screen and Browser
LLM tool calls are registered and dispatched through bruno/tools/registry.py. Screen capture is an on-demand tool in bruno/tools/screen.py; browser control of the user’s existing browser is in bruno/tools/browser.py. This isolates privileged desktop actions from the audio/LLM pipeline and makes tools the extension boundary for new actions.
Persistence, Onboarding, and Runtime Infrastructure
First-run setup and provider/key collection are handled by bruno/onboarding.py. Configuration and user profile persist under %LOCALAPPDATA%\Bruno through bruno/core/config.py, bruno/core/profile.py, and bruno/core/paths.py; API credentials are encrypted with the Windows account via bruno/core/credentials.py and bruno/core/secrets.py. Logging—including screen-capture records—uses bruno/core/logging.py. Runtime assets such as Whisper/Piper models are managed by bruno/core/assets.py.
Main entry points: app.py App composition · pipeline.py Request pipeline · conversation.py Conversation orchestration · runtime.py Local transcription
Components 23
Application
- Runtime entry
bruno/__main__.py - App composition · Selects implementations and coordinates lifecycle.
bruno/app.py - Request pipeline · Coordinates capture, STT, LLM/tools, and speech.
bruno/pipeline.py - Lifecycle contracts
bruno/core/protocols.py - Single-instance guard
bruno/core/single_instance.py
Interaction & Audio
- Hotkey & hands-free · Alt+Space recording and VAD-driven hands-free control.
bruno/input/hotkey.py - Tray and orb UI · Shows tray controls and visual voice state.
bruno/ui/tray.py - Microphone recorder · Keeps microphone open with pre-roll buffering.
bruno/audio/recorder.py - Speech endpointing
bruno/audio/endpointing.py - Audio player
bruno/audio/player.py
Speech & LLM
- Local transcription · Audio remains local for transcription.
bruno/stt/runtime.py - Conversation orchestration · Manages history, prompts, streaming, and tool calls.
bruno/llm/conversation.py - Provider factory & failover · Selects hosted providers and handles provider/quota failures.
bruno/llm/factory.py - Hosted LLM providers · Receives text and requested screenshots only.
bruno/llm/providers.py - Response chunker · Segments responses for low time-to-first-word.
bruno/tts/chunker.py - Local speech synthesis
bruno/tts/piper.py
Privileged Tools
- Tool registry · Extension boundary for LLM-invoked actions.
bruno/tools/registry.py - Screen capture
bruno/tools/screen.py - Browser control · Controls the user's existing browser.
bruno/tools/browser.py
Persistence & Runtime
- Onboarding · Collects provider and key configuration.
bruno/onboarding.py - Profile & config store · Persists configuration and user profile under %LOCALAPPDATA%\Bruno.
bruno/core/config.py - Encrypted credentials
bruno/core/credentials.py - Speech model assets · Manages Whisper and Piper models.
bruno/core/assets.py
Connections 26
- Runtime entry → App composition: starts
- App composition → Single-instance guard: enforces
- App composition → Request pipeline: composes
- App composition → Tray and orb UI: initializes
- App composition → Onboarding: runs first-run
- App composition → Lifecycle contracts: uses
- Hotkey & hands-free → Request pipeline: record/send control
- Hotkey & hands-free → Speech endpointing: hands-free endpointing
- Microphone recorder → Request pipeline: captured audio
- Speech endpointing → Request pipeline: speech end
- Request pipeline → Local transcription: audio
- Local transcription → Conversation orchestration: transcript
- Conversation orchestration → Provider factory & failover: model request
- Provider factory & failover → Hosted LLM providers: text / requested screenshot
- Conversation orchestration → Tool registry: tool calls
- Tool registry → Screen capture: dispatches
- Tool registry → Browser control: dispatches
- Conversation orchestration → Response chunker: streamed response
- Response chunker → Local speech synthesis: sentences
- Local speech synthesis → Audio player: speech audio
- Request pipeline → Tray and orb UI: state updates
- Onboarding → Profile & config store: writes setup
- App composition → Profile & config store: loads settings
- Profile & config store → Encrypted credentials: references secrets
- Local transcription → Speech model assets: loads models
- Local speech synthesis → Speech model assets: loads voice model