Commit graph

69 commits

Author SHA1 Message Date
31340fe0a8
Fix async terminal.write() causing garbled dashboard output
The terminal.write() method from @xterm/headless is async - the data
isn't in the buffer yet when we call serializeAsHTML() immediately
after. This caused empty or partially rendered output in the browser.

Now using the callback form of terminal.write(data, callback) to wait
for the write to complete before serializing and broadcasting to SSE
clients. This ensures the terminal buffer is fully updated before we
generate HTML from it.
2026-01-31 11:06:37 -05:00
130f01a19f
Clean up deprecated ANSI processing code (Phase 4)
Removed the ansiCarryovers Map from server.ts since terminal emulation
now handles all ANSI sequence buffering internally. Marked ansi.ts and
ansi-carryover.ts as deprecated with JSDoc comments, but kept them for
backward compatibility and potential rollback.
2026-01-31 09:53:22 -05:00
43648f7d60
Add initial_state SSE event for reconnect sync (Phase 3)
When a dashboard connects via SSE, it now receives the current terminal
state for all active sessions. This allows dashboards to immediately
display the full terminal content without waiting for new output.
2026-01-31 09:51:13 -05:00
88afb7249d
Replace ansiToHtml with terminal serialization (Phase 2)
The output handler now:
- Writes raw data to terminal emulator
- Stores raw data in DB (unchanged)
- Serializes terminal state as HTML
- Broadcasts serialized HTML via SSE

This replaces the ansiToHtml() + splitAnsiCarryover() approach with
proper terminal emulation. The terminal emulator handles all ANSI
sequences internally, including incomplete sequences across chunks.
2026-01-31 09:49:53 -05:00
6c7de2332b
Add terminal.test.ts unit tests 2026-01-31 09:47:54 -05:00
0366e459f5
Integrate terminal emulator in server.ts (Phase 1) 2026-01-31 09:45:38 -05:00
c9908c87c3
Add terminal.ts module for headless terminal emulation
Creates new module providing terminal session management using @xterm/headless:
- createTerminal(): spawn headless terminal emulator instances
- serializeAsHTML(): export terminal state as HTML
- disposeTerminal(): clean up resources

This replaces stateless ANSI processing with proper VT emulation that tracks
cursor position, screen buffer, and terminal attributes across output chunks.
2026-01-31 09:43:46 -05:00
3e5afbd5a8
Clean up ansiCarryovers on WebSocket close 2026-01-31 09:12:05 -05:00
42ba893ea5
Add tests for splitAnsiCarryover function 2026-01-31 09:11:49 -05:00
0a3bfa6092
Add debug logging for ANSI carryover events 2026-01-31 09:10:19 -05:00
c09654c6c7
Add JSDoc to splitAnsiCarryover function 2026-01-31 09:10:07 -05:00
a8eea4e694
Add SSE cleanup 2026-01-31 09:06:16 -05:00
f2c3f6f067
Avoid stray control characters 2026-01-31 09:05:33 -05:00
423fa8375d
End all sessions on server startup 2026-01-30 09:12:40 -05:00
2dfe420555
Rename project from claude-remote to clarc
Updated all references across documentation, config files, and source code.
2026-01-30 08:32:34 -05:00
f9c521286b
Add --yolo alias for --dangerously-skip-permissions 2026-01-30 08:20:22 -05:00
5948dcaed1
Add viewport-based PTY resize from dashboard 2026-01-30 08:19:09 -05:00
21b8caeb67
Fix carriage return handling to emulate line overwrite 2026-01-30 08:06:36 -05:00
350c352989
Safely kill processes 2026-01-30 07:51:09 -05:00
364e3d909e
Restore terminal to cooked before suspending 2026-01-30 07:47:22 -05:00
766ae27fee
Resume the child process first 2026-01-30 07:46:41 -05:00
d5194ede9e
Send a redraw 2026-01-30 07:44:53 -05:00
fd9ec777a3
Try out suspension 2026-01-30 07:40:52 -05:00
f42052d6d8
Add visual separation before Remote help section 2026-01-30 05:19:01 -05:00
b6d670deac
Add backoff reconnecting 2026-01-28 18:41:26 -05:00
4ab2078afd
Handle when claude isnt installed 2026-01-28 17:51:55 -05:00
8c5c9f99f0
Append our help to the end of claude help 2026-01-28 17:49:43 -05:00
eb3bad289a
Add light build requiring bun installed 2026-01-28 17:34:02 -05:00
aa50c550b7
Auto-seed device from CLAUDE_REMOTE_SECRET env var 2026-01-28 17:21:12 -05:00
86951e5e94
Format code with biome 2026-01-28 17:08:59 -05:00
3d192cf8b5
Add DB_PATH env var for configurable database location 2026-01-28 17:05:30 -05:00
2a41a3302b
Add compiled binary support with env var config
- Read CLAUDE_REMOTE_SECRET and CLAUDE_REMOTE_SERVER from env
- Make -- separator optional (all args pass through to claude)
- Add --help support (shows wrapper info, passes to claude if configured)
- Update README with binary build/install instructions
- Add binary to .gitignore
2026-01-28 16:59:36 -05:00
45b232bcc7
Handle OSC and ascii 2026-01-28 16:38:25 -05:00
9fff95e786
Add a seed script 2026-01-28 16:25:48 -05:00
1a7e93d74d
Disable idle timeout 2026-01-28 15:38:29 -05:00
43f7574e4e
Change default port from 3000 to 7200 2026-01-28 15:37:25 -05:00
c0387ff0d3
Add unit tests for git persistence 2026-01-28 15:02:40 -05:00
599f911964
Handle git WebSocket messages and persist to database 2026-01-28 14:56:53 -05:00
3b5e636730
Add git event types to ClientMessage and SSEEvent 2026-01-28 14:55:47 -05:00
0489864652
Refactor trimLineEndPreserveAnsi to simpler regex approach 2026-01-28 14:26:22 -05:00
a90da23cbc
Add unit tests for ANSI-to-HTML converter 2026-01-28 14:23:49 -05:00
11e72b1025
Parse ANSI codes in output before SSE broadcast 2026-01-28 14:17:13 -05:00
3f226996e7
Add ANSI-to-HTML converter module 2026-01-28 14:15:55 -05:00
7f3ce24099
Format code with biome 2026-01-28 13:59:55 -05:00
d30a092df5
Validate state values in WebSocket message handler 2026-01-28 13:59:38 -05:00
5df3392ad9
Use union types for state and mode in Session interface 2026-01-28 13:59:17 -05:00
7bf04ed184
Add prompt_json column to migration for upgrade path 2026-01-28 13:59:02 -05:00
a93475f3ab
Handle state and stats WebSocket messages in server 2026-01-28 13:50:35 -05:00
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