Commit graph

88 commits

Author SHA1 Message Date
f31d33f992
Parse state and stats events from Claude Code hooks
Add parsing of structured JSON events from Claude Code hooks in PTY
output. State events track session lifecycle (ready/thinking/permission/
question/complete/interrupted). Stats events provide session metrics
(prompts, completions, tools, thinking time, etc).

Events are detected by parsing each line of PTY output, extracting valid
JSON objects with a type field, and forwarding state/stats events to the
server via WebSocket while preserving all output passthrough.
2026-01-28 13:48:56 -05:00
1827baaf39
Fix answer endpoint to avoid duplicate DB updates 2026-01-28 13:20:47 -05:00
091979390a
Add error handling and loading state to instructions modal 2026-01-28 13:20:10 -05:00
dcc6a89b4d
Format string literals to use double quotes 2026-01-28 13:14:52 -05:00
af8fc5ca88
Add tab instructions modal for permission prompts 2026-01-28 13:14:48 -05:00
acd75b0303
Implement key sequence execution for tab instructions
Execute the tab instruction flow:
- Navigate to target option using arrow keys
- Send Tab to enter instruction mode
- Type the instruction text
- Send Enter to submit

The sequence runs asynchronously with proper delays between steps
(50ms between arrows, 100ms before Tab, 100ms before instruction).
2026-01-28 13:13:51 -05:00
727f3e0e18
Format ternary operators in server.ts 2026-01-28 13:05:41 -05:00
ef3c66f887
Fix exit plan to send option response type
Exit plan responses should use type 'option' not 'text' since they're
selecting from a predefined set of options.
2026-01-28 13:03:07 -05:00
17ba44182b
Fix option value extraction in prompt rendering
Options are objects with value and label fields. Updated exit_plan
rendering to use opt.value and opt.label instead of treating opt as
a string.
2026-01-28 13:02:57 -05:00
419034255a
Fix QuestionPrompt to iterate questions array
QuestionPrompt has a questions array, not flat fields. Updated rendering
to iterate over each question item with its own header, question text,
and options.
2026-01-28 13:02:45 -05:00
caef206d51
Include prompt_json in SSE broadcasts
Both prompt broadcast paths now serialize and send prompt_json so the
dashboard can render rich prompts.
2026-01-28 13:02:25 -05:00
a9e6392649
Fix SSE event type to include prompt_json field
The prompt SSE event now includes prompt_json to transmit structured
prompt data to the dashboard for rich prompt rendering.
2026-01-28 13:02:05 -05:00
d3fac77f6f
Update dashboard to render rich multi-option prompts 2026-01-28 12:59:23 -05:00
5404598a5e
Add /answer endpoint for rich prompt responses
Adds new POST /api/prompts/:id/answer endpoint that handles AnswerResponse types:
- option: sends value + newline to PTY
- text: sends user input + newline to PTY
- tab_instructions: placeholder implementation sends selected_option (TODO: needs key sequences)

Updated /approve and /reject endpoints to use "1\n" and "3\n" instead of "y\n" and "n\n"
for consistency with option-based responses. Marked as legacy endpoints for backward compatibility.
2026-01-28 12:56:53 -05:00
cd7d1c0ea8
Add prompt_json column to store rich prompt data 2026-01-28 12:55:47 -05:00
2aeec48627
Add TypeScript interfaces for rich prompt system 2026-01-28 12:54:51 -05:00
8992b0cc7b
Add phase 2 design document 2026-01-28 12:38:58 -05:00
c1c2a9e802
Add a todo 2026-01-28 12:34:08 -05:00
0417d167a0
Add gitignore for node_modules and SQLite files 2026-01-28 12:28:40 -05:00
5ff684824a
Fix dashboard ID handling and output rendering performance 2026-01-28 12:26:17 -05:00
48a01641c4
Add mobile dashboard with SSE streaming
Replaced placeholder index.html with a fully functional mobile-first dashboard that connects to the server via SSE and provides real-time session monitoring and prompt approval.

Features:
- Mobile-first design with large touch targets (44px min) and readable fonts
- SSE connection to /events with automatic reconnection on disconnect
- Live display of active sessions with collapsible output views
- Pending prompts section with approve/reject buttons
- Real-time updates for session start/end, streaming output, and prompts
- Dark mode by default with light mode support via prefers-color-scheme
- Plain text terminal output (monospace, scrolls to bottom)
- Connection status indicator in header

Implementation is a single HTML file (~300 lines) with inline CSS and vanilla JS, no frameworks or dependencies.
2026-01-28 12:23:46 -05:00
fe3887393d
Add code review workflow to CLAUDE.md 2026-01-28 12:19:07 -05:00
508a1c9837
Fix CLI resource cleanup and auth flow 2026-01-28 11:50:51 -05:00
54bc458b7d
Add PTY CLI wrapper
Wraps claude CLI in PTY and bridges to WebSocket server. Handles:
- Argument parsing (--server, --secret)
- PTY spawn with terminal size detection
- Bidirectional I/O: local stdin/stdout + WebSocket
- Terminal resize events (SIGWINCH)
- Graceful cleanup on exit
- Basic WebSocket reconnection
- Auth and session messages to server
2026-01-28 11:46:47 -05:00
65b8acf5f8
Fix SSE cleanup and add prompt creation endpoint
- Fix SSE cancel handler to properly capture controller in closure
- Remove error JSON messages before WebSocket close (close reason is sufficient)
- Add POST /api/sessions/:sessionId/prompts endpoint for prompt creation
- Add SSE client cleanup on broadcast errors
- Add createPrompt and getSession imports
- Add prompt message type to ClientMessage for CLI prompt reporting
- Add prompt message handler in WebSocket to create and broadcast prompts
2026-01-28 11:41:50 -05:00
b4ac7beead
Add HTTP/WebSocket/SSE server 2026-01-28 11:37:59 -05:00
76a81666a2
Fix prepared statements to prepare once at init 2026-01-28 11:18:44 -05:00
596b0fd013
Add SQLite database layer with tests 2026-01-28 11:15:36 -05:00
59f21cd062
Add HMAC authentication with comprehensive tests
Implements device authentication using HMAC-SHA256 signatures with constant-time comparison for security. Includes timestamp-based auth headers with configurable freshness checking (default 5min) and clock skew tolerance.
2026-01-28 11:14:54 -05:00
e61bcb544d
Add message and entity types 2026-01-28 11:09:44 -05:00
82f3d18117
Add references section for inspiration sources 2026-01-28 11:06:09 -05:00
1db763aa89
Add placeholder test 2026-01-28 11:03:32 -05:00
02be345946
Fix biome config formatting (self-heal) 2026-01-28 11:03:31 -05:00
726190eaa6
Restructure project files into src and public directories
Moved index.ts to src/server.ts and created stub files for types, db, auth,
and cli modules. Added minimal placeholder for dashboard. Removed generated
README.md in favor of CLAUDE.md and docs/plan.md.
2026-01-28 11:00:19 -05:00
350fcf3713
Add implementation plan to docs
Copied from planning phase - full specification for PTY wrapper,
WebSocket protocol, SQLite schema, and deployment setup.
2026-01-28 10:59:48 -05:00
9c6b5f6e59
Update CLAUDE.md with project-specific instructions
Added project description, contribution policy for bun-pty, and standard
workflow notes. Kept Bun API references for development guidance.
2026-01-28 10:59:39 -05:00
62a264c62a
Add npm scripts and justfile for development workflow
Scripts cover linting, type checking, testing, and dev server.
Justfile provides docker commands and unified check command.
2026-01-28 10:59:07 -05:00
0bc0c2fded
Configure biome to use 2 space indentation
Switching from tabs to spaces for consistency with most TypeScript projects.
2026-01-28 10:58:51 -05:00