clankie 0.2.13 → 0.4.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.
Files changed (44) hide show
  1. package/README.md +40 -223
  2. package/dist/cli.js +12116 -27954
  3. package/package.json +10 -10
  4. package/web-ui-dist/_shell.html +2 -2
  5. package/web-ui-dist/assets/auth-js9k1Rhz.js +1 -0
  6. package/web-ui-dist/assets/badge-BHJdQwRZ.js +1 -0
  7. package/web-ui-dist/assets/circle-alert-DCRgcJjZ.js +1 -0
  8. package/web-ui-dist/assets/connection-C-eUc8pB.js +1 -0
  9. package/web-ui-dist/assets/extensions-CfM4cd1k.js +1 -0
  10. package/web-ui-dist/assets/extensions-VKiAe2xJ.js +1 -0
  11. package/web-ui-dist/assets/field-DEnoPHIp.js +1 -0
  12. package/web-ui-dist/assets/index-QqHwIr0R.js +1 -0
  13. package/web-ui-dist/assets/index-wQYa97UB.js +1 -0
  14. package/web-ui-dist/assets/json-render-renderer-iSQAWNBF.js +94 -0
  15. package/web-ui-dist/assets/main-pUlhQiIA.js +35 -0
  16. package/web-ui-dist/assets/sessions._sessionId-UF84S83t.js +38 -0
  17. package/web-ui-dist/assets/skills-CnPlzEye.js +1 -0
  18. package/web-ui-dist/assets/styles-CEa8RAD6.css +1 -0
  19. package/dist/koffi-216xhpes.node +0 -0
  20. package/dist/koffi-2erktc37.node +0 -0
  21. package/dist/koffi-2rrez93a.node +0 -0
  22. package/dist/koffi-2wv0r22g.node +0 -0
  23. package/dist/koffi-3kae4xj3.node +0 -0
  24. package/dist/koffi-3rkr2zqv.node +0 -0
  25. package/dist/koffi-abxfktv9.node +0 -0
  26. package/dist/koffi-c67c0c5b.node +0 -0
  27. package/dist/koffi-cnf0q0dx.node +0 -0
  28. package/dist/koffi-df38sqz5.node +0 -0
  29. package/dist/koffi-gfbqb3a0.node +0 -0
  30. package/dist/koffi-kjemmmem.node +0 -0
  31. package/dist/koffi-kkrfq9yv.node +0 -0
  32. package/dist/koffi-mzaqwwqy.node +0 -0
  33. package/dist/koffi-q49fgkeq.node +0 -0
  34. package/dist/koffi-q54bk8bf.node +0 -0
  35. package/dist/koffi-x1790w0j.node +0 -0
  36. package/dist/koffi-yxvjwcj6.node +0 -0
  37. package/web-ui-dist/assets/extensions-Ce8R4mF3.js +0 -1
  38. package/web-ui-dist/assets/field-omFPry7c.js +0 -1
  39. package/web-ui-dist/assets/index-CdxpJyJ4.js +0 -1
  40. package/web-ui-dist/assets/loader-circle-DJwIWnWV.js +0 -1
  41. package/web-ui-dist/assets/main-UkFzTTck.js +0 -35
  42. package/web-ui-dist/assets/sessions._sessionId-DA8C51jO.js +0 -131
  43. package/web-ui-dist/assets/settings-Db2CTnq7.js +0 -1
  44. package/web-ui-dist/assets/styles-DAZ1IN1z.css +0 -1
package/README.md CHANGED
@@ -1,14 +1,13 @@
1
1
  # clankie — Personal AI Assistant
2
2
 
3
- A minimal AI assistant that lives in Slack. Built on [pi](https://github.com/badlogic/pi-mono)'s SDK, clankie gives you a personal AI teammate that runs on your machine with your credentials.
3
+ A minimal AI assistant built on [pi](https://github.com/badlogic/pi-mono)'s SDK. clankie runs on your machine with your credentials, with a web channel today and support for additional channels via extensions.
4
4
 
5
5
  ## What Can clankie Do?
6
6
 
7
- - 💬 **Slack conversations** — @mention to start, then chat naturally in threads
8
7
  - 🌐 **Web UI** — Browser-based chat interface with real-time streaming ([web-ui/](./web-ui/))
9
8
  - 📎 **Handle attachments** — Upload images (vision models), documents, code files
10
9
  - 🔄 **Session management** — Switch between conversations with `/switch`, `/sessions`, `/new` commands
11
- - 🔌 **pi ecosystem** — Works with all pi extensions, skills, and prompt templates
10
+ - 🔌 **pi ecosystem** — Works with pi extensions, skills, and prompt templates
12
11
  - 🔒 **Privacy-first** — Runs on your machine, your credentials, your data
13
12
 
14
13
  ## Installation
@@ -27,16 +26,12 @@ curl -fsSL https://bun.sh/install | bash
27
26
  bun --version
28
27
  ```
29
28
 
30
- **Don't have Node.js?** Install via [mise](https://mise.jdx.dev) (recommended) or [nvm](https://github.com/nvm-sh/nvm).
31
-
32
29
  ### 2. Quick Install via npm
33
30
 
34
31
  ```bash
35
32
  npm install -g clankie
36
33
  ```
37
34
 
38
- This installs clankie globally. Now `clankie` is available from anywhere.
39
-
40
35
  ### 3. Or: Install from Source
41
36
 
42
37
  ```bash
@@ -46,158 +41,46 @@ npm install
46
41
  npm link
47
42
  ```
48
43
 
49
- Now `clankie` is available from anywhere. If you skip `npm link`, use `bun src/cli.ts` (dev) or `node dist/cli.js` (built) instead of `clankie`.
50
-
51
- **Note:** Bun bundles TypeScript code into JavaScript that runs on Node.js v18+.
52
-
53
- ## Slack Setup
54
-
55
- ### Step 1: Create Slack App from Manifest
56
-
57
- 1. Go to **https://api.slack.com/apps**
58
- 2. Click **Create New App** → **From an app manifest**
59
- 3. Select your workspace and click **Next**
60
- 4. Choose **YAML** tab and paste the contents of [`slack-app-manifest.yaml`](./slack-app-manifest.yaml)
61
- 5. Click **Next** → Review the summary → Click **Create**
62
-
63
- ### Step 2: Generate App Token (for Socket Mode)
64
-
65
- 1. Go to **Basic Information** (in the sidebar)
66
- 2. Scroll to **App-Level Tokens** → Click **Generate Token and Scopes**
67
- 3. Name: `clankie-socket`
68
- 4. Click **Add Scope** → Select `connections:write`
69
- 5. Click **Generate**
70
- 6. **Copy the token** (starts with `xapp-`) — you'll need this for config
71
-
72
- ### Step 3: Install App to Workspace
73
-
74
- 1. Go to **Install App** (in the sidebar)
75
- 2. Click **Install to Workspace**
76
- 3. Review permissions and click **Allow**
77
- 4. **Copy the Bot Token** (starts with `xoxb-`) — you'll need this for config
78
-
79
- ### Step 4: Get Your Slack User ID
80
-
81
- 1. In Slack, click your profile picture → **View profile**
82
- 2. Click the three dots (**⋯**) → **Copy member ID**
83
- 3. Save this ID (looks like `U01ABC23DEF`)
84
-
85
- ### Step 5: Configure clankie
86
-
87
- ```bash
88
- clankie config set channels.slack.appToken "xapp-1-A0AG6UWU92B-..."
89
- clankie config set channels.slack.botToken "xoxb-10594563095936-..."
90
- clankie config set channels.slack.allowFrom '["U01ABC23DEF"]'
91
- ```
92
-
93
- Replace:
94
- - `xapp-...` with your App Token from Step 2
95
- - `xoxb-...` with your Bot Token from Step 3
96
- - `U01ABC23DEF` with your user ID from Step 4
97
-
98
- ### Step 6: Authenticate with AI Provider
44
+ ## Quick Start
99
45
 
100
46
  ```bash
47
+ clankie init
101
48
  clankie login
102
- ```
103
-
104
- Choose your provider (Anthropic, OpenAI, etc.) and authenticate. Credentials are stored securely in `~/.clankie/auth.json`.
105
-
106
- ### Step 7: Start clankie
107
-
108
- ```bash
109
49
  clankie start
110
50
  ```
111
51
 
112
- You should see:
113
- ```
52
+ You should see output like:
53
+
54
+ ```text
114
55
  [daemon] Starting clankie daemon (pid 12345)...
115
56
  [daemon] Workspace: /Users/you/.clankie/workspace
116
- [daemon] Channels: slack
117
- [slack] Connected as @clankie (U01XYZ...)
57
+ [daemon] Channels: web
58
+ [web] WebSocket server listening on port 3100
118
59
  [daemon] Ready. Waiting for messages...
119
60
  ```
120
61
 
121
- ### Step 8: Test in Slack
122
-
123
- 1. **Invite the bot to a channel**: Type `/invite @clankie` in any channel
124
- 2. **@mention it**: `@clankie hello!`
125
- 3. Bot creates a thread and replies
126
- 4. **Continue the conversation** (no more @mentions needed): `what's 2+2?`
127
- 5. Bot responds in the same thread
128
-
129
- 🎉 **You're all set!**
62
+ Then open the connect URL printed by the daemon.
130
63
 
131
64
  ## Using clankie
132
65
 
133
- ### In Slack
134
-
135
- #### Start a Conversation
136
-
137
- @mention the bot in any channel:
138
- ```
139
- Channel: #general
140
- You: @clankie what files are in my workspace?
141
- Thread 🧵
142
- Bot: Here are the files...
143
- You: can you summarize README.md?
144
- Bot: Here's a summary...
145
- ```
146
-
147
- After the first @mention, the bot responds to all your messages in that thread automatically. Threads remain active across daemon restarts for 7 days.
148
-
149
- #### Direct Messages
150
-
151
- Just message the bot directly — no @mention needed:
152
- ```
153
- DM with @clankie
154
- You: analyze this code [uploads file]
155
- Bot: Sure! Here's what I found...
156
- You: can you summarize it?
157
- Bot: Here's a summary...
158
- ```
159
-
160
- #### Share Files
161
-
162
- Upload files directly in a conversation:
163
- ```
164
- You: @clankie review this screenshot
165
- [uploads image.png]
166
- Bot: I can see... [describes image with vision model]
167
- ```
66
+ ### Web UI
168
67
 
169
- The bot can read images (with vision models), documents, code files, etc.
68
+ 1. Start the daemon: `clankie start`
69
+ 2. Open the connect URL from logs (or use `http://localhost:3100?token=<your-token>`)
70
+ 3. Start chatting
170
71
 
171
- #### Session Management (Slash Commands)
72
+ ### Session Management Commands
172
73
 
173
- Manage multiple conversations in the same channel:
74
+ When chatting through channels, you can use:
174
75
 
175
- ```
76
+ ```text
176
77
  /switch <name> Switch to a different session
177
78
  /sessions List all sessions
178
79
  /new Start a fresh session (clears context)
179
80
  ```
180
81
 
181
- **Example:**
182
- ```
183
- You: /switch coding
184
- Bot: 💬 Switched to session "coding"
185
- Use /sessions to see all sessions.
186
-
187
- You: /sessions
188
- Bot: 📋 Available sessions:
189
- • default
190
- • coding ✓ (active)
191
-
192
- Switch with: /switch <name>
193
- ```
194
-
195
- Each session maintains its own conversation history. Sessions persist across daemon restarts.
196
-
197
82
  ### CLI Commands
198
83
 
199
- Even though clankie lives in Slack, you also have CLI access:
200
-
201
84
  ```bash
202
85
  # Send a one-off message (prints response and exits)
203
86
  clankie send "What files are in the current directory?"
@@ -213,30 +96,21 @@ clankie stop
213
96
 
214
97
  # View configuration
215
98
  clankie config show
216
-
217
- # Get config path
218
- clankie config path
219
-
220
- # Set a config value
221
- clankie config set agent.model.primary "anthropic/claude-sonnet-4-5"
222
99
  ```
223
100
 
224
101
  ## Configuration
225
102
 
226
103
  Config file: `~/.clankie/clankie.json` (JSON5 format — comments and trailing commas allowed)
227
104
 
228
- The daemon watches the config file and automatically restarts when changes are detected.
229
-
230
105
  ### Common Settings
231
106
 
232
107
  ```bash
233
- # Slack credentials
234
- clankie config set channels.slack.appToken "xapp-..."
235
- clankie config set channels.slack.botToken "xoxb-..."
236
- clankie config set channels.slack.allowFrom '["U12345678"]'
108
+ # Web channel
109
+ clankie config set channels.web.authToken "your-secret-token"
110
+ clankie config set channels.web.port 3100
237
111
 
238
- # Restrict to specific channels (optional)
239
- clankie config set channels.slack.allowedChannelIds '["C01ABC123", "C02DEF456"]'
112
+ # Optional: same-origin static hosting from daemon
113
+ clankie config set channels.web.staticDir "/path/to/web-ui/.output/public"
240
114
 
241
115
  # AI model
242
116
  clankie config set agent.model.primary "anthropic/claude-sonnet-4-5"
@@ -251,103 +125,52 @@ clankie config set agent.workspace "~/projects"
251
125
  |------|-------------|---------|
252
126
  | `agent.workspace` | Agent working directory | `"~/projects"` |
253
127
  | `agent.model.primary` | Primary AI model | `"anthropic/claude-sonnet-4-5"` |
254
- | `channels.slack.appToken` | Socket Mode app token | `"xapp-..."` |
255
- | `channels.slack.botToken` | Bot token for API calls | `"xoxb-..."` |
256
- | `channels.slack.allowFrom` | Allowed user IDs (array) | `["U12345678"]` |
257
- | `channels.slack.allowedChannelIds` | Allowed channel IDs (array, empty = all) | `["C01ABC123"]` |
258
- | `channels.slack.enabled` | Enable/disable Slack channel | `true` (default) |
259
-
260
- **Note:** The daemon automatically restarts when you change `~/.clankie/clankie.json`.
128
+ | `channels.web.authToken` | Web auth token | `"your-secret-token"` |
129
+ | `channels.web.port` | Web channel port | `3100` |
130
+ | `channels.web.allowedOrigins` | Allowed origins (optional) | `["https://example.com"]` |
131
+ | `channels.web.staticDir` | Static web-ui directory (optional) | `"/path/to/web-ui-dist"` |
132
+ | `channels.web.enabled` | Enable/disable web channel | `true` (default) |
261
133
 
262
134
  ## Running as a Service
263
135
 
264
- Instead of running `clankie start` manually, you can install clankie as a system service that starts automatically on boot.
265
-
266
- ### Install Service
267
-
268
136
  ```bash
269
137
  clankie daemon install
270
- ```
271
-
272
- This installs:
273
- - **macOS**: launchd agent (`~/Library/LaunchAgents/ai.clankie.daemon.plist`)
274
- - **Linux**: systemd user service (`~/.config/systemd/user/clankie.service`)
275
-
276
- The daemon starts immediately and runs on boot.
277
-
278
- ### Manage Service
279
-
280
- ```bash
281
- # Check service status
282
138
  clankie daemon status
283
-
284
- # View logs
285
139
  clankie daemon logs
286
-
287
- # Uninstall service
288
140
  clankie daemon uninstall
289
141
  ```
290
142
 
291
- Logs are stored in `~/.clankie/logs/daemon.log`.
292
-
293
143
  ## Development
294
144
 
295
145
  ```bash
296
- # Run directly with Bun (no build step)
297
146
  bun src/cli.ts send "hello"
298
-
299
- # Or use bun scripts
300
147
  bun run dev send "hello"
301
-
302
- # Build for production
303
- bun run build # Bundles TypeScript → JavaScript for Node.js
304
-
305
- # Code quality checks
306
- bun run check # Run linter
307
- bun run check:fix # Auto-fix issues
308
- bun run format # Format code
148
+ bun run build
149
+ bun run check
150
+ bun run check:fix
151
+ bun run format
309
152
  ```
310
153
 
311
154
  ## Troubleshooting
312
155
 
313
- ### Bot doesn't respond in threads
314
-
315
- **Problem**: Bot replies to @mentions but ignores subsequent messages in the thread.
316
-
317
- **Solution**: Make sure you added the `message.channels` event subscription and `channels:read` scope to your Slack app. Then reinstall the app to your workspace.
318
-
319
156
  ### "No channels configured" error
320
157
 
321
- **Problem**: `clankie start` fails with "No channels configured".
158
+ Configure the web channel:
322
159
 
323
- **Solution**: Configure Slack credentials:
324
160
  ```bash
325
- clankie config set channels.slack.appToken "xapp-..."
326
- clankie config set channels.slack.botToken "xoxb-..."
327
- clankie config set channels.slack.allowFrom '["U12345678"]'
328
- ```
329
-
330
- ### Bot responds to everyone
331
-
332
- **Problem**: Bot responds to all users, not just you.
333
-
334
- **Solution**: Set `allowFrom` to only include your user ID:
335
- ```bash
336
- clankie config get channels.slack.allowFrom
337
- clankie config set channels.slack.allowFrom '["U12345678"]'
161
+ clankie config set channels.web.authToken "your-secret-token"
162
+ clankie config set channels.web.port 3100
338
163
  ```
339
164
 
340
165
  ### Daemon won't start after reboot
341
166
 
342
- **Problem**: Daemon doesn't auto-start after reboot (when installed as service).
343
-
344
- **Solution**: Check service status:
345
167
  ```bash
346
168
  clankie daemon status
347
169
  clankie daemon logs
348
170
  ```
349
171
 
350
- If the service isn't running, reinstall:
172
+ If needed:
173
+
351
174
  ```bash
352
175
  clankie daemon uninstall
353
176
  clankie daemon install
@@ -355,23 +178,17 @@ clankie daemon install
355
178
 
356
179
  ## How It Works
357
180
 
358
- clankie is a **thin wrapper around pi**, not a replacement. It reuses the entire pi ecosystem:
359
- - Extensions, skills, and prompt templates just work
360
- - Same agent runtime, same resource loaders
361
- - Authentication shared with `pi` CLI
181
+ clankie is a thin wrapper around pi:
362
182
 
363
- The architecture:
364
- 1. **Slack channel** connects via Socket Mode (no public URL needed)
183
+ 1. **Web channel** accepts RPC over WebSocket
365
184
  2. **Daemon** routes messages to persistent agent sessions (one per chat)
366
- 3. **Agent** uses pi's SDK with full tool access (read/write files, run commands, etc.)
367
- 4. **Sessions** persist across restarts, stored in `~/.clankie/sessions/`
185
+ 3. **Agent** uses pi's SDK with full tool access
186
+ 4. **Sessions** persist across restarts in `~/.clankie/sessions/`
368
187
 
369
188
  ## Credits
370
189
 
371
190
  Built on [pi](https://github.com/badlogic/pi-mono) by [@badlogic](https://github.com/badlogic).
372
191
 
373
- Inspired by [OpenClaw](https://github.com/badlogic/openclaw) and [mom](https://github.com/badlogic/pi-mono/tree/main/packages/mom).
374
-
375
192
  ## License
376
193
 
377
194
  MIT