@radnine/claude-session-daemon 0.2.6 → 0.2.7
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 +119 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# @radnine/claude-session-daemon
|
|
2
|
+
|
|
3
|
+
Node.js daemon that manages Claude CLI sessions over WebSocket. Pairs with [@radnine/storybook-addon-claude](https://www.npmjs.com/package/@radnine/storybook-addon-claude) to give designers and developers an AI chat panel inside Storybook.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @radnine/storybook-addon-claude @radnine/claude-session-daemon
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Configure Storybook
|
|
12
|
+
|
|
13
|
+
In your `.storybook/main.js`:
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
export default {
|
|
17
|
+
addons: [
|
|
18
|
+
'@radnine/storybook-addon-claude',
|
|
19
|
+
// ... other addons
|
|
20
|
+
],
|
|
21
|
+
};
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Run the Daemon
|
|
25
|
+
|
|
26
|
+
### Option A: Docker (recommended)
|
|
27
|
+
|
|
28
|
+
Docker runs Claude inside a container with filesystem isolation. Claude can only access your mounted project directory, so file edits happen automatically without permission prompts.
|
|
29
|
+
|
|
30
|
+
1. Create a `docker-compose.yml` in your project root:
|
|
31
|
+
|
|
32
|
+
```yaml
|
|
33
|
+
services:
|
|
34
|
+
claude-daemon:
|
|
35
|
+
image: ghcr.io/radixhound/claude-daemon:latest
|
|
36
|
+
build:
|
|
37
|
+
context: ./node_modules/@radnine/claude-session-daemon
|
|
38
|
+
ports:
|
|
39
|
+
- "${CLAUDE_DAEMON_PORT:-3001}:3001"
|
|
40
|
+
volumes:
|
|
41
|
+
- .:/workspace
|
|
42
|
+
environment:
|
|
43
|
+
- ANTHROPIC_API_KEY
|
|
44
|
+
- CLAUDE_DAEMON_MODE=standalone
|
|
45
|
+
- CLAUDE_WORKING_DIR=/workspace
|
|
46
|
+
- CLAUDE_DAEMON_PORT=3001
|
|
47
|
+
- CLAUDE_SKIP_PERMISSIONS=true
|
|
48
|
+
- CLAUDE_DISABLE_AUTH=true
|
|
49
|
+
stop_grace_period: 10s
|
|
50
|
+
restart: unless-stopped
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
2. Add your API key to a `.env` file:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
ANTHROPIC_API_KEY=sk-ant-...
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Get an API key from https://console.anthropic.com/settings/keys
|
|
60
|
+
|
|
61
|
+
3. Start it:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
docker compose up -d
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Stop with `docker compose down`.
|
|
68
|
+
|
|
69
|
+
### Option B: Host mode
|
|
70
|
+
|
|
71
|
+
Runs the daemon directly on your machine. Claude will prompt for permission on each file edit since there's no filesystem isolation.
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npx @radnine/claude-session-daemon start
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Or add to your `package.json` scripts:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"scripts": {
|
|
82
|
+
"claude-daemon": "claude-session-daemon start",
|
|
83
|
+
"claude-daemon:stop": "claude-session-daemon stop",
|
|
84
|
+
"claude-daemon:restart": "claude-session-daemon restart",
|
|
85
|
+
"claude-daemon:status": "claude-session-daemon status"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The daemon manages a `.claude-daemon.pid` file in your project root. Add it to your `.gitignore`.
|
|
91
|
+
|
|
92
|
+
### Authentication (host mode only)
|
|
93
|
+
|
|
94
|
+
Docker mode uses the `ANTHROPIC_API_KEY` environment variable. For host mode, choose one:
|
|
95
|
+
|
|
96
|
+
**API Key** — Set `ANTHROPIC_API_KEY` before starting the daemon, or add it to a `.env` file.
|
|
97
|
+
|
|
98
|
+
**Claude Login** — If you have a Claude Pro, Team, or Enterprise subscription:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
npx @anthropic-ai/claude-code login
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
This authenticates via your browser. Credentials are stored locally and the daemon uses them automatically.
|
|
105
|
+
|
|
106
|
+
## Environment Variables
|
|
107
|
+
|
|
108
|
+
| Variable | Default | Description |
|
|
109
|
+
|---|---|---|
|
|
110
|
+
| `ANTHROPIC_API_KEY` | — | Required for Docker mode |
|
|
111
|
+
| `CLAUDE_DAEMON_PORT` | `3001` | WebSocket server port |
|
|
112
|
+
| `CLAUDE_MAX_SESSIONS` | `10` | Max concurrent Claude sessions |
|
|
113
|
+
| `CLAUDE_LOG_LEVEL` | `info` | Log level (`debug`, `info`, `warn`, `error`) |
|
|
114
|
+
| `CLAUDE_SKIP_PERMISSIONS` | `false` | Skip Claude CLI permission prompts (Docker only) |
|
|
115
|
+
| `CLAUDE_DISABLE_AUTH` | `false` | Disable WebSocket auth (Docker only) |
|
|
116
|
+
|
|
117
|
+
## License
|
|
118
|
+
|
|
119
|
+
Proprietary. See [LICENSE](./LICENSE) for terms.
|