claude-relay 1.5.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +158 -64
- package/bin/cli.js +1116 -314
- package/lib/config.js +114 -0
- package/lib/daemon.js +237 -0
- package/lib/ipc.js +108 -0
- package/lib/pages.js +47 -1
- package/lib/project.js +725 -0
- package/lib/public/app.js +81 -2
- package/lib/public/css/filebrowser.css +379 -0
- package/lib/public/css/menus.css +81 -0
- package/lib/public/css/sidebar.css +10 -30
- package/lib/public/index.html +51 -7
- package/lib/public/manifest.json +4 -4
- package/lib/public/modules/filebrowser.js +314 -0
- package/lib/public/modules/input.js +13 -0
- package/lib/public/modules/notifications.js +16 -21
- package/lib/public/modules/qrcode.js +55 -0
- package/lib/public/modules/sidebar.js +28 -2
- package/lib/public/modules/terminal.js +178 -0
- package/lib/public/modules/tools.js +2 -0
- package/lib/public/style.css +1 -0
- package/lib/public/sw.js +3 -1
- package/lib/push.js +7 -5
- package/lib/server.js +213 -571
- package/lib/terminal.js +23 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -4,126 +4,220 @@
|
|
|
4
4
|
<img src="media/phone.gif" alt="claude-relay on phone" width="300">
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
|
-
<h3 align="center">Claude Code
|
|
7
|
+
<h3 align="center">Web UI for Claude Code. Any device. Push notifications.</h3>
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Claude Code. Anywhere.
|
|
10
|
+
Same session. Same files. Same machine.
|
|
11
|
+
Your files stay on your computer. Nothing leaves for the cloud.
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
Pick up the same Claude Code session on your phone.
|
|
14
|
+
Start in the terminal, continue on your phone, switch back anytime.
|
|
15
|
+
Same session, same files, now in your pocket.
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
Claude Code is automating more of your editing and execution workflow.
|
|
18
|
+
But when it needs approval or asks a question, it halts in the terminal. If you walk away, it just sits there waiting.
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
claude-relay eliminates this bottleneck.
|
|
21
|
+
It is not a thin wrapper that intercepts input/output. It drives Claude Code via the Claude Agent SDK and relays the stream from your local machine to your browser.
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
Get approval notifications while grabbing a coffee.
|
|
24
|
+
Continue working from the sofa on your iPad.
|
|
25
|
+
Split your browser: claude-relay on one side, your app preview on the other, and watch the code change in real time.
|
|
20
26
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
```bash
|
|
28
|
+
cd ~/your-project
|
|
29
|
+
npx claude-relay
|
|
30
|
+
# First run: Set Port/PIN -> Scan QR -> Connect
|
|
31
|
+
```
|
|
24
32
|
|
|
25
33
|
---
|
|
26
34
|
|
|
27
|
-
##
|
|
28
|
-
|
|
29
|
-
Permission request. Task done. Error. Question. Your phone buzzes. Browser can be closed.
|
|
35
|
+
## Never Miss an Approval
|
|
30
36
|
|
|
31
|
-
|
|
37
|
+
When Claude Code requests permission before executing a tool, you get a notification on your phone.
|
|
38
|
+
One tap, and Claude Code gets back to work.
|
|
32
39
|
|
|
33
40
|
<p align="center">
|
|
34
41
|
<img src="media/push-notification.jpg" alt="push notification" width="300">
|
|
35
42
|
</p>
|
|
36
43
|
|
|
37
|
-
|
|
44
|
+
It works in browser tabs too. When input is awaited, the favicon blinks and the tab title changes to alert you.
|
|
45
|
+
|
|
46
|
+
## Side by Side Workflow
|
|
38
47
|
|
|
39
|
-
|
|
48
|
+
Keep claude-relay on one side and your localhost on the other.
|
|
49
|
+
Watch the results update live while Claude Code fixes your source files.
|
|
40
50
|
|
|
41
|
-
|
|
51
|
+
Mermaid diagrams render as diagrams, and tables appear as actual tables.
|
|
52
|
+
You can explore files in the sidebar and use the built-in terminal to run shell commands.
|
|
42
53
|
|
|
43
|
-
##
|
|
54
|
+
## All in One Place
|
|
55
|
+
|
|
56
|
+
Run `npx claude-relay` in each project to register them to the same server.
|
|
57
|
+
Manage all your active sessions from a single dashboard.
|
|
44
58
|
|
|
45
59
|
```bash
|
|
46
|
-
|
|
47
|
-
npx claude-relay
|
|
60
|
+
cd ~/projects/backend && npx claude-relay # Register project
|
|
61
|
+
cd ~/projects/frontend && npx claude-relay # Adds to the same server
|
|
62
|
+
```
|
|
48
63
|
|
|
49
|
-
|
|
64
|
+
The server runs in the background. Even if you close the terminal window, your sessions and the server remain active.
|
|
65
|
+
|
|
66
|
+
---
|
|
50
67
|
|
|
51
|
-
|
|
68
|
+
## Getting Started
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npx claude-relay
|
|
52
72
|
```
|
|
53
73
|
|
|
54
74
|
<p align="center">
|
|
55
75
|
<img src="media/start.gif" alt="npx claude-relay" width="600">
|
|
56
76
|
</p>
|
|
57
77
|
|
|
58
|
-
|
|
78
|
+
On the first run, you'll set a port and PIN to launch the server.
|
|
79
|
+
Scan the QR code with your phone to connect instantly, or open the URL displayed in your terminal.
|
|
80
|
+
|
|
81
|
+
## Key Features
|
|
82
|
+
|
|
83
|
+
* **Push Approvals** - Approve or reject from your phone while away, so Claude Code does not get stuck waiting.
|
|
84
|
+
* **Multi Project Daemon** - Manage all projects via a single port.
|
|
85
|
+
* **Auto Session Logs (JSONL)** - Conversations and execution history are always saved locally. No data loss on crashes or restarts. Location: `./.claude-relay/sessions/`
|
|
86
|
+
* **File Browser and Terminal** - Inspect files and execute commands directly from the browser.
|
|
87
|
+
|
|
88
|
+
> Note: Session logs may contain prompts, outputs, and commands. Do not share this folder.
|
|
89
|
+
|
|
90
|
+
<details>
|
|
91
|
+
<summary>View Full Feature List</summary>
|
|
92
|
+
|
|
93
|
+
**Notifications**
|
|
94
|
+
|
|
95
|
+
* **Push Notifications** - Approvals, completions, errors, and questions. Add to Home Screen (PWA) to receive notifications without opening the app. Behavior depends on OS and browser. Tested on iPhone (Home Screen PWA) and desktop Chrome.
|
|
96
|
+
* **Favicon and Title Blinking** - Visual cues when input is awaited.
|
|
97
|
+
* **Sound Alerts** - Supports browser notifications, desktop notifications, and audio alerts.
|
|
98
|
+
|
|
99
|
+
**Projects and Sessions**
|
|
59
100
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
- **Mobile-first UI** — big approve/deny buttons, one-handed use
|
|
66
|
-
- **iPad and tablet support** — full Claude Code from any browser. Your actual machine, your tools, your MCP servers, your files.
|
|
67
|
-
- **Setup wizard** — Tailscale, HTTPS, push. Step by step.
|
|
68
|
-
- **Multi-session** — multiple projects, automatic port selection
|
|
69
|
-
- **PIN protection** — access control beyond network security
|
|
70
|
-
- **HTTPS** — automatic certs via mkcert
|
|
71
|
-
- **Slash commands** — with autocomplete
|
|
72
|
-
- **Zero config** — works with your existing Claude Code setup
|
|
101
|
+
* **Multi Project** - Single port management for all projects.
|
|
102
|
+
* **Project Names** - Custom names make it easy to distinguish tabs.
|
|
103
|
+
* **Session Persistence** - Sessions survive server restarts, browser crashes, and network drops.
|
|
104
|
+
* **Session Handoff** - Start in the terminal, continue on your phone, pass back to desktop.
|
|
105
|
+
* **Rewind (Native Claude Code)** - Accessible directly from the browser UI.
|
|
73
106
|
|
|
74
|
-
|
|
107
|
+
**Rendering and Tools**
|
|
75
108
|
|
|
76
|
-
|
|
109
|
+
* **Mermaid and Markdown** - Proper rendering for diagrams, tables, and code blocks.
|
|
110
|
+
* **Syntax Highlighting** - Support for over 180 languages with copy buttons on every block.
|
|
111
|
+
* **File Browser** - Sidebar navigation with file previews and markdown rendering.
|
|
112
|
+
* **Built in Terminal** - Full shell access within the browser.
|
|
113
|
+
* **Slash Commands** - Execute standard Claude Code commands from the browser, with autocomplete.
|
|
77
114
|
|
|
78
|
-
|
|
115
|
+
**UI**
|
|
79
116
|
|
|
80
|
-
|
|
117
|
+
* **Mobile Optimized** - Large approve and reject buttons. Behaves like a native app via PWA.
|
|
118
|
+
* **Real time Sync** - All devices view the exact same session state.
|
|
119
|
+
* **QR Code** - Scan to connect instantly.
|
|
120
|
+
* **Image Paste** - Paste images directly from your clipboard into the input.
|
|
81
121
|
|
|
82
|
-
|
|
122
|
+
**Server and Security**
|
|
83
123
|
|
|
84
|
-
|
|
124
|
+
* **Background Daemon** - Server persists even if the CLI is closed.
|
|
125
|
+
* **Keep Awake** - Prevents macOS sleep to keep sessions alive. Configurable toggle.
|
|
126
|
+
* **PIN Protection** - Restrict access with a 6 digit PIN.
|
|
127
|
+
* **HTTPS** - Automatic certificate generation via mkcert.
|
|
128
|
+
* **Zero Config** - Inherits your existing Claude Code configuration.
|
|
129
|
+
|
|
130
|
+
</details>
|
|
131
|
+
|
|
132
|
+
## Network
|
|
133
|
+
|
|
134
|
+
On the same Wi Fi, it just works. Open the URL shown in the terminal on any device.
|
|
135
|
+
|
|
136
|
+
For remote access, [Tailscale](https://tailscale.com) is recommended. Install it on both devices and log in with the same account to connect via an encrypted tunnel without port forwarding. Free for personal use.
|
|
137
|
+
|
|
138
|
+
## Security
|
|
139
|
+
|
|
140
|
+
claude-relay opens on your local network to allow access from other devices such as phones and tablets on the same Wi Fi.
|
|
141
|
+
Setting a PIN is highly recommended.
|
|
142
|
+
|
|
143
|
+
Anyone on your network with the URL and PIN can access the session. PIN protection can be enabled during the initial setup.
|
|
144
|
+
|
|
145
|
+
Do not expose this directly to the public internet. Usage on public or shared networks is not recommended.
|
|
146
|
+
For remote access, use [Tailscale](https://tailscale.com) or a VPN.
|
|
147
|
+
|
|
148
|
+
Users are responsible for their network configuration and exposure scope.
|
|
149
|
+
|
|
150
|
+
## HTTPS for Push
|
|
151
|
+
|
|
152
|
+
Basic features work out of the box. Only push notifications require HTTPS.
|
|
153
|
+
|
|
154
|
+
Set it up once using [mkcert](https://github.com/FiloSottile/mkcert):
|
|
85
155
|
|
|
86
156
|
```bash
|
|
87
157
|
brew install mkcert
|
|
88
158
|
mkcert -install
|
|
89
159
|
```
|
|
90
160
|
|
|
91
|
-
Certificates
|
|
161
|
+
Certificates are generated automatically. The setup wizard handles the rest.
|
|
162
|
+
|
|
163
|
+
If push registration fails: check whether your browser trusts HTTPS and whether your phone can access the address.
|
|
92
164
|
|
|
93
|
-
## CLI
|
|
165
|
+
## CLI Options
|
|
94
166
|
|
|
95
167
|
```bash
|
|
96
|
-
npx claude-relay #
|
|
97
|
-
npx claude-relay -p 8080 #
|
|
98
|
-
npx claude-relay --no-https #
|
|
99
|
-
npx claude-relay --no-update #
|
|
100
|
-
npx claude-relay --debug # debug panel
|
|
168
|
+
npx claude-relay # Default (port 2633)
|
|
169
|
+
npx claude-relay -p 8080 # Specify port
|
|
170
|
+
npx claude-relay --no-https # Disable HTTPS
|
|
171
|
+
npx claude-relay --no-update # Skip update check
|
|
172
|
+
npx claude-relay --debug # Enable debug panel
|
|
101
173
|
```
|
|
102
174
|
|
|
103
175
|
## Requirements
|
|
104
176
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
##
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
177
|
+
* [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) installed and authenticated
|
|
178
|
+
* Node.js 18+
|
|
179
|
+
* [mkcert](https://github.com/FiloSottile/mkcert) - For push notifications (optional)
|
|
180
|
+
* [Tailscale](https://tailscale.com) - For remote access (optional)
|
|
181
|
+
|
|
182
|
+
## Architecture
|
|
183
|
+
|
|
184
|
+
claude-relay is not a wrapper that intercepts standard input/output.
|
|
185
|
+
It is a local relay server that drives Claude Code execution via the [Claude Agent SDK](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk) and streams data to the browser via WebSocket.
|
|
186
|
+
|
|
187
|
+
```mermaid
|
|
188
|
+
graph LR
|
|
189
|
+
Browser["Browser<br/>(Phone / Desktop)"]
|
|
190
|
+
WS["WebSocket"]
|
|
191
|
+
Server["HTTP Server<br/>lib/server.js"]
|
|
192
|
+
Project["Project Context<br/>lib/project.js"]
|
|
193
|
+
SDK["Claude Agent SDK"]
|
|
194
|
+
Claude["Claude Code<br/>Process"]
|
|
195
|
+
Push["Push Service"]
|
|
196
|
+
|
|
197
|
+
Browser <-->|Real time stream| WS
|
|
198
|
+
WS <--> Server
|
|
199
|
+
Server -->|slug routing| Project
|
|
200
|
+
Project <-->|async iterable| SDK
|
|
201
|
+
SDK <-->|Prompt / Response| Claude
|
|
202
|
+
Project -->|Approval request| Push
|
|
203
|
+
Push -->|Notification| Browser
|
|
204
|
+
```
|
|
115
205
|
|
|
116
|
-
|
|
206
|
+
For a detailed sequence diagram, daemon structure, and design decisions, refer to [docs/architecture.md](docs/architecture.md).
|
|
117
207
|
|
|
118
|
-
|
|
208
|
+
---
|
|
119
209
|
|
|
120
210
|
## Contributing
|
|
121
211
|
|
|
122
|
-
Bug fixes and typos
|
|
212
|
+
Bug fixes and typos are welcome. For feature suggestions, please open an issue first:
|
|
213
|
+
[https://github.com/chadbyte/claude-relay/issues](https://github.com/chadbyte/claude-relay/issues)
|
|
214
|
+
|
|
215
|
+
If you are using claude-relay, let us know how you are using it in Discussions:
|
|
216
|
+
[https://github.com/chadbyte/claude-relay/discussions](https://github.com/chadbyte/claude-relay/discussions)
|
|
123
217
|
|
|
124
218
|
## Disclaimer
|
|
125
219
|
|
|
126
|
-
|
|
220
|
+
This is an independent project and is not affiliated with Anthropic. Claude is a trademark of Anthropic.
|
|
127
221
|
|
|
128
222
|
## License
|
|
129
223
|
|