mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-26 02:05:31 +00:00
* feat(providers): let providers report session and turn metrics Providers know things about a session and a turn that Paseo cannot derive: timing, token flow, cache use, cost, the model that answered. They can now report them as label/value rows that Paseo carries to clients unchanged, so each provider decides which metrics make sense and how they read. Session metrics live on the agent record and snapshot. Turn metrics are stamped on the turn's footer row (last assistant message, else last tool call) so they survive reload, pagination and a daemon restart, and so the live turn_completed event and a later timeline fetch agree. Provider history replay restores both. Metrics are sanitized once where they enter the agent manager. The wire schemas validate whole messages, so one malformed row from a provider would otherwise make clients drop an entire snapshot, turn event or timeline page. A live completed turn with no Model metric gets the agent's model, so every provider shows model attribution before it is instrumented. Replayed turns do not: they may have run on a different model than the agent has now. Plugin providers publish session metrics behind a negotiated `session.metrics` capability because an older daemon closes a connection that sends an event type it does not know. Turn metrics ride an existing event that older daemons strip, so they need no gate. The wire additions are optional fields on existing schemas only. * feat(providers): report session and turn metrics from OpenCode, OMP, Pi and Claude Each provider now attaches metrics to turn_completed and emits session_metrics_updated, live and when history is replayed. - Live turns end on the adapter's clock. A provider's message timestamps can come from another clock. - Tool time merges overlapping runs, so parallel tools count once. - A total that is missing any part is hidden, so a partial total is never shown. - Replayed history reports metrics only for turns that finished, which matches live, where failed and interrupted turns report none. - Claude reports cost as a running total for each query(). A resumed query starts that total from a saved one, so a turn's cost is the change since the previous result of the same query. The first turn of a query shows no cost. - Claude transcripts do not record result messages, so replayed Claude history has no turn metrics. - Session metrics come from each provider's own cumulative counters. The cache hit is the last reply's or the last turn's, because a session-wide figure blends prompts from before and after compactions. * feat(app): show provider session and turn metrics Session metrics appear in the context window details, between the context summary and the account usage cards. A provider-reported Cost row replaces the app's own session cost line. Each completed turn with metrics gets a stats button in its footer: a hover card on web, a press-opened tooltip on native wide screens, and a sheet on compact screens. The context window sheet becomes a shared DetailsSheet so both use the same content-sized sheet. Metrics ride on the row that hosts the turn's footer (the turn's last assistant message, else its last tool call), the same row the daemon stamps. Live turn_completed events and timeline pages both stamp that row, so a refetch agrees with what the live event showed. The daemon updates session metrics without bumping updatedAt, like usage, so a stale buffered upsert may still carry the newest metrics and is accepted for that field. * fix(app): keep a turn's stats after the cached timeline reloads The local timeline cache dropped turnMetrics when it saved a turn's footer row. After a page reload the cached rows painted without the stats icon, and the catch-up fetch had no new entries to stamp them from. * fix(providers): keep imported session stats and never count a steered turn short Importing a Pi, Oh My Pi or OpenCode v2 session dropped the stats the provider returned with its history, so imported chats showed none until a forced replay. Import now carries them the way replay does. Replaying a Pi or Oh My Pi transcript read a prompt that steered a running turn as the start of a new turn, so the steered turn's stats counted only the steps after the steer. A turn that follows one ending on tools now reports no total, because the transcript reads the same as a stop and a new prompt. * fix(providers): keep stats through merged messages and plugin imports, start Pi first-token timing at the request A message the timeline merges from several chunks keeps the stats stamped on its last chunk. Plugin session imports carry the stats the plugin replayed, through the same history reader the other providers use. Steers queued together after an unclear turn stay unclear instead of attributing the final reply to the wrong turn. Pi measures time to first token from the request, not the first reply header. * fix(providers): carry a turn's stats onto the message the timeline merges from text chunks The previous change put the carry-over in the reasoning merge. The assistant message merge dropped the stats of its last chunk, so an imported reply of two text blocks lost its Turn stats button. * fix(providers): carry a turn's stats onto the tool card the timeline merges from updates An imported turn that ends on a tool call stamps the stats on the tool's last update. The tool merge kept the first update's fields, so the stats were lost. * fix(opencode): replay no session stats for a session that has none An empty OpenCode session replayed a session stats event with no metrics, which broke the empty-history check in the versioned runtime test.
Voice Assistant
A voice-controlled terminal assistant that runs as a single local service.
Quick Start
# Install dependencies
npm install
# Copy environment variables
cp .env.example .env
# Edit .env and add your API keys (OpenAI, Deepgram)
# Run development servers
npm run dev
# Open browser to http://localhost:5173
Architecture
- Express Server (port 3000) - Serves API and built UI in production
- Vite Dev Server (port 5173) - Hot-reload React UI in development
- WebSocket (
/ws) - Real-time bidirectional communication - Agent - STT → LLM → TTS pipeline with terminal control
- Daemon - tmux-based terminal management (in-process)
Development
# Run both servers (recommended)
npm run dev
# Or run separately:
npm run dev:server # Express on port 3000
npm run dev:ui # Vite on port 5173
# Type checking
npm run typecheck
# Build for production
npm run build
# Start production server
npm start
Project Status
✅ Completed (Phases 1-2):
- Package setup and configuration
- Express server with WebSocket
- React UI with Vite
- WebSocket client with ping/pong testing
⏳ In Progress (Phase 3):
- Terminal control (tmux integration)
📋 Planned (Phases 4-9):
- LLM integration (OpenAI GPT-4)
- Agent orchestrator
- Speech-to-Text (Deepgram)
- Text-to-Speech (OpenAI)
- Audio streaming
- UI polish
See IMPLEMENTATION_PLAN.md for complete details.
Environment Variables
OPENAI_API_KEY=your-openai-key-here # GPT-4 and TTS
DEEPGRAM_API_KEY=your-deepgram-key-here # Streaming STT
STT_MODEL=whisper-1 # Optional: override to gpt-4o-transcribe, etc.
STT_CONFIDENCE_THRESHOLD=-3.0 # Optional: reject low-confidence clips
STT_DEBUG_AUDIO_DIR=.stt-debug # Optional: persist raw dictation audio for debugging
PASEO_HOME=~/.paseo # Runtime state directory (agents/, etc.)
PASEO_LISTEN=127.0.0.1:6767 # Listen address (host:port or /path/to/socket)
PASEO_HOME defaults to ~/.paseo and isolates runtime artifacts like agents/. PASEO_LISTEN controls the daemon listen address. For blue/green testing you can run a parallel server without touching production state:
PASEO_HOME=~/.paseo-blue PASEO_LISTEN=127.0.0.1:7777 npm run dev
Tech Stack
- Server: Express, TypeScript, ws (WebSocket)
- Client: React 18, Vite, TypeScript
- Terminal: tmux (via child_process)
- AI: OpenAI (LLM + TTS), Deepgram (STT)
Testing
Currently manual testing via:
- Start servers:
npm run dev - Open http://localhost:5173
- Test WebSocket connection (green status indicator)
- Click "Send Ping" button to test communication
More testing guidance as features are implemented.
License
MIT