broodlink 0.1.2

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.

Potentially problematic release.


This version of broodlink might be problematic. Click here for more details.

@@ -0,0 +1,150 @@
1
+ # TLS Deployment Guide
2
+
3
+ BroodLink uses plain WebSocket (`ws://`) by default. **For any deployment beyond localhost, you must add TLS encryption** to protect API keys and messages in transit.
4
+
5
+ ---
6
+
7
+ ## Option 1: Reverse Proxy (Recommended)
8
+
9
+ Use nginx, Caddy, or similar to terminate TLS in front of BroodLink.
10
+
11
+ ### Caddy (Automatic HTTPS)
12
+
13
+ The simplest option — Caddy auto-provisions certificates via Let's Encrypt.
14
+
15
+ ```
16
+ # /etc/caddy/Caddyfile
17
+ broodlink.example.com {
18
+ reverse_proxy 127.0.0.1:18800
19
+ }
20
+ ```
21
+
22
+ Agents connect to `wss://broodlink.example.com`.
23
+
24
+ ### nginx
25
+
26
+ ```nginx
27
+ # /etc/nginx/sites-available/broodlink
28
+ upstream broodlink {
29
+ server 127.0.0.1:18800;
30
+ }
31
+
32
+ server {
33
+ listen 443 ssl;
34
+ server_name broodlink.example.com;
35
+
36
+ ssl_certificate /etc/letsencrypt/live/broodlink.example.com/fullchain.pem;
37
+ ssl_certificate_key /etc/letsencrypt/live/broodlink.example.com/privkey.pem;
38
+
39
+ # Modern TLS configuration
40
+ ssl_protocols TLSv1.2 TLSv1.3;
41
+ ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384;
42
+ ssl_prefer_server_ciphers off;
43
+
44
+ location / {
45
+ proxy_pass http://broodlink;
46
+ proxy_http_version 1.1;
47
+ proxy_set_header Upgrade $http_upgrade;
48
+ proxy_set_header Connection "upgrade";
49
+ proxy_set_header Host $host;
50
+ proxy_set_header X-Real-IP $remote_addr;
51
+ proxy_read_timeout 86400s;
52
+ proxy_send_timeout 86400s;
53
+ }
54
+ }
55
+
56
+ # Redirect HTTP → HTTPS
57
+ server {
58
+ listen 80;
59
+ server_name broodlink.example.com;
60
+ return 301 https://$server_name$request_uri;
61
+ }
62
+ ```
63
+
64
+ Generate certificates with [certbot](https://certbot.eff.org/):
65
+
66
+ ```bash
67
+ sudo certbot certonly --nginx -d broodlink.example.com
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Option 2: Tailscale (Zero-Config Private Network)
73
+
74
+ BroodLink has built-in Tailscale support for private networking without certificate management.
75
+
76
+ ```jsonc
77
+ // broodlink.json
78
+ {
79
+ "host": "127.0.0.1",
80
+ "port": 18800,
81
+ "tailscale": {
82
+ "enabled": true,
83
+ "interfaceName": "tailscale0"
84
+ }
85
+ }
86
+ ```
87
+
88
+ Traffic between Tailscale nodes is encrypted with WireGuard. Agents connect using the Tailscale hostname (e.g., `ws://broodlink-server:18800`).
89
+
90
+ > **Note:** This uses `ws://` (not `wss://`) because WireGuard already encrypts the tunnel. The connection is private to your tailnet.
91
+
92
+ ---
93
+
94
+ ## Configuration for Production
95
+
96
+ When deploying behind a reverse proxy, bind to localhost only:
97
+
98
+ ```jsonc
99
+ // broodlink.json
100
+ {
101
+ "host": "127.0.0.1",
102
+ "port": 18800
103
+ }
104
+ ```
105
+
106
+ This prevents direct access to the unencrypted WebSocket port.
107
+
108
+ ### Checklist
109
+
110
+ - [ ] BroodLink bound to `127.0.0.1` (not `0.0.0.0`)
111
+ - [ ] TLS proxy configured with valid certificate
112
+ - [ ] HTTP → HTTPS redirect enabled
113
+ - [ ] WebSocket upgrade headers (`Upgrade`, `Connection`) forwarded
114
+ - [ ] Proxy timeouts set high enough for long-lived connections (~24h)
115
+ - [ ] Firewall blocks direct access to BroodLink port (18800)
116
+ - [ ] Agents configured to connect via `wss://` endpoint
117
+
118
+ ---
119
+
120
+ ## Agent Connection
121
+
122
+ Agents should connect to the TLS endpoint:
123
+
124
+ ```javascript
125
+ // Instead of:
126
+ const ws = new WebSocket("ws://localhost:18800");
127
+
128
+ // Use:
129
+ const ws = new WebSocket("wss://broodlink.example.com");
130
+ ```
131
+
132
+ No protocol changes — the JSON-RPC API works identically over `ws://` and `wss://`.
133
+
134
+ ---
135
+
136
+ ## Self-Signed Certificates (Development Only)
137
+
138
+ For development environments where you need TLS but don't have a domain:
139
+
140
+ ```bash
141
+ openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
142
+ -keyout broodlink.key -out broodlink.crt \
143
+ -subj "/CN=localhost"
144
+ ```
145
+
146
+ Use these with your reverse proxy. Agents may need to disable certificate verification (development only — never in production).
147
+
148
+ ---
149
+
150
+ *For questions or issues, open a GitHub issue or contact the project maintainer.*
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "broodlink",
3
+ "version": "0.1.2",
4
+ "description": "Standalone WebSocket chat server for AI agent communication",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "bin": {
8
+ "broodlink": "dist/cli.js"
9
+ },
10
+ "files": [
11
+ "dist/",
12
+ "docs/",
13
+ "README.md",
14
+ "INSTALL.md"
15
+ ],
16
+ "scripts": {
17
+ "build": "tsc",
18
+ "prepublishOnly": "npm run build",
19
+ "dev": "tsx src/cli.ts",
20
+ "start": "node dist/cli.js",
21
+ "test": "vitest run",
22
+ "test:watch": "vitest"
23
+ },
24
+ "dependencies": {
25
+ "better-sqlite3": "^11.8.1",
26
+ "commander": "^14.0.3",
27
+ "ws": "^8.19.0"
28
+ },
29
+ "devDependencies": {
30
+ "@types/better-sqlite3": "^7.6.13",
31
+ "@types/node": "^22.12.0",
32
+ "@types/ws": "^8.18.1",
33
+ "tsx": "^4.21.0",
34
+ "typescript": "^5.9.3",
35
+ "vitest": "^4.0.18"
36
+ },
37
+ "engines": {
38
+ "node": ">=22.0.0"
39
+ }
40
+ }