kyber-chat 1.0.0__tar.gz

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 (71) hide show
  1. kyber_chat-1.0.0/.gitignore +36 -0
  2. kyber_chat-1.0.0/LICENSE +21 -0
  3. kyber_chat-1.0.0/PKG-INFO +35 -0
  4. kyber_chat-1.0.0/README.md +476 -0
  5. kyber_chat-1.0.0/bridge/package.json +26 -0
  6. kyber_chat-1.0.0/bridge/src/index.ts +50 -0
  7. kyber_chat-1.0.0/bridge/src/server.ts +104 -0
  8. kyber_chat-1.0.0/bridge/src/types.d.ts +3 -0
  9. kyber_chat-1.0.0/bridge/src/whatsapp.ts +185 -0
  10. kyber_chat-1.0.0/bridge/tsconfig.json +16 -0
  11. kyber_chat-1.0.0/kyber/__init__.py +6 -0
  12. kyber_chat-1.0.0/kyber/__main__.py +8 -0
  13. kyber_chat-1.0.0/kyber/agent/__init__.py +8 -0
  14. kyber_chat-1.0.0/kyber/agent/context.py +224 -0
  15. kyber_chat-1.0.0/kyber/agent/loop.py +687 -0
  16. kyber_chat-1.0.0/kyber/agent/memory.py +109 -0
  17. kyber_chat-1.0.0/kyber/agent/skills.py +244 -0
  18. kyber_chat-1.0.0/kyber/agent/subagent.py +379 -0
  19. kyber_chat-1.0.0/kyber/agent/tools/__init__.py +6 -0
  20. kyber_chat-1.0.0/kyber/agent/tools/base.py +102 -0
  21. kyber_chat-1.0.0/kyber/agent/tools/filesystem.py +191 -0
  22. kyber_chat-1.0.0/kyber/agent/tools/message.py +86 -0
  23. kyber_chat-1.0.0/kyber/agent/tools/registry.py +73 -0
  24. kyber_chat-1.0.0/kyber/agent/tools/shell.py +141 -0
  25. kyber_chat-1.0.0/kyber/agent/tools/spawn.py +65 -0
  26. kyber_chat-1.0.0/kyber/agent/tools/task_status.py +53 -0
  27. kyber_chat-1.0.0/kyber/agent/tools/web.py +163 -0
  28. kyber_chat-1.0.0/kyber/bus/__init__.py +6 -0
  29. kyber_chat-1.0.0/kyber/bus/events.py +37 -0
  30. kyber_chat-1.0.0/kyber/bus/queue.py +81 -0
  31. kyber_chat-1.0.0/kyber/channels/__init__.py +6 -0
  32. kyber_chat-1.0.0/kyber/channels/base.py +121 -0
  33. kyber_chat-1.0.0/kyber/channels/discord.py +304 -0
  34. kyber_chat-1.0.0/kyber/channels/feishu.py +263 -0
  35. kyber_chat-1.0.0/kyber/channels/manager.py +161 -0
  36. kyber_chat-1.0.0/kyber/channels/telegram.py +302 -0
  37. kyber_chat-1.0.0/kyber/channels/whatsapp.py +141 -0
  38. kyber_chat-1.0.0/kyber/cli/__init__.py +1 -0
  39. kyber_chat-1.0.0/kyber/cli/commands.py +736 -0
  40. kyber_chat-1.0.0/kyber/config/__init__.py +6 -0
  41. kyber_chat-1.0.0/kyber/config/loader.py +95 -0
  42. kyber_chat-1.0.0/kyber/config/schema.py +205 -0
  43. kyber_chat-1.0.0/kyber/cron/__init__.py +6 -0
  44. kyber_chat-1.0.0/kyber/cron/service.py +346 -0
  45. kyber_chat-1.0.0/kyber/cron/types.py +59 -0
  46. kyber_chat-1.0.0/kyber/dashboard/__init__.py +5 -0
  47. kyber_chat-1.0.0/kyber/dashboard/server.py +122 -0
  48. kyber_chat-1.0.0/kyber/dashboard/static/app.js +458 -0
  49. kyber_chat-1.0.0/kyber/dashboard/static/favicon.png +0 -0
  50. kyber_chat-1.0.0/kyber/dashboard/static/index.html +107 -0
  51. kyber_chat-1.0.0/kyber/dashboard/static/kyber_logo.png +0 -0
  52. kyber_chat-1.0.0/kyber/dashboard/static/styles.css +608 -0
  53. kyber_chat-1.0.0/kyber/heartbeat/__init__.py +5 -0
  54. kyber_chat-1.0.0/kyber/heartbeat/service.py +130 -0
  55. kyber_chat-1.0.0/kyber/providers/__init__.py +6 -0
  56. kyber_chat-1.0.0/kyber/providers/base.py +69 -0
  57. kyber_chat-1.0.0/kyber/providers/litellm_provider.py +227 -0
  58. kyber_chat-1.0.0/kyber/providers/transcription.py +65 -0
  59. kyber_chat-1.0.0/kyber/session/__init__.py +5 -0
  60. kyber_chat-1.0.0/kyber/session/manager.py +202 -0
  61. kyber_chat-1.0.0/kyber/skills/README.md +47 -0
  62. kyber_chat-1.0.0/kyber/skills/github/SKILL.md +48 -0
  63. kyber_chat-1.0.0/kyber/skills/skill-creator/SKILL.md +371 -0
  64. kyber_chat-1.0.0/kyber/skills/summarize/SKILL.md +67 -0
  65. kyber_chat-1.0.0/kyber/skills/tmux/SKILL.md +121 -0
  66. kyber_chat-1.0.0/kyber/skills/tmux/scripts/find-sessions.sh +112 -0
  67. kyber_chat-1.0.0/kyber/skills/tmux/scripts/wait-for-text.sh +83 -0
  68. kyber_chat-1.0.0/kyber/skills/weather/SKILL.md +49 -0
  69. kyber_chat-1.0.0/kyber/utils/__init__.py +5 -0
  70. kyber_chat-1.0.0/kyber/utils/helpers.py +91 -0
  71. kyber_chat-1.0.0/pyproject.toml +90 -0
@@ -0,0 +1,36 @@
1
+ .assets
2
+ .env
3
+ *.pyc
4
+ dist/
5
+ build/
6
+ docs/
7
+ *.egg-info/
8
+ *.egg
9
+ *.pyc
10
+ *.pyo
11
+ *.pyd
12
+ *.pyw
13
+ *.pyz
14
+ *.pywz
15
+ *.pyzz
16
+ .venv/
17
+ __pycache__/
18
+
19
+ # IDE / editor
20
+ .vscode/
21
+ .idea/
22
+ *.swp
23
+ *.swo
24
+ *~
25
+
26
+ # OS
27
+ .DS_Store
28
+ Thumbs.db
29
+
30
+ # Runtime / local
31
+ *.log
32
+ .kyber/
33
+ workspace/memory/*.md
34
+ !workspace/memory/MEMORY.md
35
+ node_modules/
36
+ bridge/node_modules/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 kyber contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,35 @@
1
+ Metadata-Version: 2.4
2
+ Name: kyber-chat
3
+ Version: 1.0.0
4
+ Summary: A lightweight personal AI assistant framework
5
+ Author: kyber contributors
6
+ License: MIT
7
+ License-File: LICENSE
8
+ Keywords: agent,ai,chatbot
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Requires-Python: >=3.11
15
+ Requires-Dist: croniter>=2.0.0
16
+ Requires-Dist: discord-py>=2.4.0
17
+ Requires-Dist: fastapi>=0.115.0
18
+ Requires-Dist: httpx>=0.25.0
19
+ Requires-Dist: litellm>=1.0.0
20
+ Requires-Dist: loguru>=0.7.0
21
+ Requires-Dist: pydantic-settings>=2.0.0
22
+ Requires-Dist: pydantic>=2.0.0
23
+ Requires-Dist: python-telegram-bot>=21.0
24
+ Requires-Dist: readability-lxml>=0.8.0
25
+ Requires-Dist: rich>=13.0.0
26
+ Requires-Dist: typer>=0.9.0
27
+ Requires-Dist: uvicorn>=0.30.0
28
+ Requires-Dist: websocket-client>=1.6.0
29
+ Requires-Dist: websockets>=12.0
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
32
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
33
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
34
+ Provides-Extra: feishu
35
+ Requires-Dist: lark-oapi>=1.0.0; extra == 'feishu'
@@ -0,0 +1,476 @@
1
+ <div align="center">
2
+ <img src="kyber_logo.png" alt="Kyber logo" width="380">
3
+ <h1>Kyber</h1>
4
+ <p>A personal AI assistant that actually works.</p>
5
+ </div>
6
+
7
+ Kyber is a lightweight AI bot you can set up in 60 seconds and talk to from Discord, Telegram, WhatsApp, or the command line. It doesn't get stuck. It doesn't take minutes to respond. It handles multiple conversations at once, runs tasks in the background, and stays out of your way.
8
+
9
+ One install command, pick your provider, and you're chatting. No bloat, no config rabbit holes.
10
+
11
+ **Why Kyber**
12
+
13
+ - 💎 Set up in under a minute — one command installs, configures, and runs
14
+ - Never locks up — concurrent message handling means the bot keeps responding, even during long tasks
15
+ - Background subagents — kick off complex work without blocking the conversation, with live progress
16
+ - Works with the providers you already use (OpenRouter, Anthropic, OpenAI, Gemini, DeepSeek, Groq, Zhipu, vLLM)
17
+ - Chat where you already are — Discord, Telegram, WhatsApp, and Feishu out of the box
18
+ - Built-in tools — web search, shell commands, GitHub, file I/O, and an extensible skills system
19
+ - Runs on anything — your laptop, a VPS, a Raspberry Pi. Optional system service keeps it always on
20
+ - Secure local dashboard for config and monitoring
21
+ - Scheduled tasks and heartbeat for proactive check-ins
22
+
23
+ ---
24
+
25
+ ## Install
26
+
27
+ **One-liner (recommended):**
28
+
29
+ ```bash
30
+ curl -fsSL https://kyber.chat/install.sh | bash
31
+ ```
32
+
33
+ This auto-detects your OS, installs Python/uv/pipx if needed, walks you through provider setup, writes your config, and optionally sets up system services.
34
+
35
+ **Manual install:**
36
+
37
+ ```bash
38
+ pipx install kyber-chat # recommended
39
+ uv tool install kyber-chat # or with uv
40
+ pip install kyber-chat # or plain pip
41
+ ```
42
+
43
+ From source (for development):
44
+
45
+ ```bash
46
+ git clone git@github.com:cyph3rasi/kyber.git
47
+ cd kyber
48
+ pip install -e .
49
+ ```
50
+
51
+ Requires Python 3.11+.
52
+
53
+ ---
54
+
55
+ ## Quick start
56
+
57
+ **1. Initialize**
58
+
59
+ ```bash
60
+ kyber onboard
61
+ ```
62
+
63
+ This creates `~/.kyber/config.json` and the workspace at `~/.kyber/workspace/`.
64
+
65
+ **2. Add your API key**
66
+
67
+ Edit `~/.kyber/config.json`:
68
+
69
+ ```json
70
+ {
71
+ "providers": {
72
+ "openrouter": {
73
+ "apiKey": "sk-or-v1-xxx"
74
+ }
75
+ },
76
+ "agents": {
77
+ "defaults": {
78
+ "provider": "openrouter",
79
+ "model": "anthropic/claude-sonnet-4-20250514"
80
+ }
81
+ }
82
+ }
83
+ ```
84
+
85
+ **3. Chat**
86
+
87
+ Single message:
88
+
89
+ ```bash
90
+ kyber agent -m "Hello from Kyber"
91
+ ```
92
+
93
+ Interactive mode:
94
+
95
+ ```bash
96
+ kyber agent
97
+ ```
98
+
99
+ **4. Start the gateway** (for chat channels)
100
+
101
+ ```bash
102
+ kyber gateway
103
+ ```
104
+
105
+ ---
106
+
107
+ ## Providers
108
+
109
+ Kyber supports multiple LLM providers through LiteLLM. You can pin a specific provider so it won't fall back to another key when multiple are configured.
110
+
111
+ Supported providers: `openrouter`, `openai`, `anthropic`, `deepseek`, `gemini`, `groq`, `zhipu`, `vllm`
112
+
113
+ Example — using DeepSeek directly:
114
+
115
+ ```json
116
+ {
117
+ "agents": {
118
+ "defaults": {
119
+ "provider": "deepseek",
120
+ "model": "deepseek-chat"
121
+ }
122
+ },
123
+ "providers": {
124
+ "deepseek": { "apiKey": "sk-xxx" }
125
+ }
126
+ }
127
+ ```
128
+
129
+ Example — using a local vLLM endpoint:
130
+
131
+ ```json
132
+ {
133
+ "agents": {
134
+ "defaults": {
135
+ "provider": "vllm",
136
+ "model": "meta-llama/Llama-3-8b"
137
+ }
138
+ },
139
+ "providers": {
140
+ "vllm": {
141
+ "apiKey": "none",
142
+ "apiBase": "http://localhost:8000/v1"
143
+ }
144
+ }
145
+ }
146
+ ```
147
+
148
+ The provider handles automatic retries with exponential backoff for transient errors (rate limits, timeouts, malformed responses from upstream APIs).
149
+
150
+ ---
151
+
152
+ ## Dashboard
153
+
154
+ Kyber includes a secure local web dashboard for viewing and editing configuration.
155
+
156
+ **Start the dashboard:**
157
+
158
+ ```bash
159
+ kyber dashboard
160
+ ```
161
+
162
+ The dashboard runs at `http://127.0.0.1:18890` by default. On startup it prints a masked version of your auth token:
163
+
164
+ ```
165
+ 💎 Kyber dashboard running at http://127.0.0.1:18890
166
+ Token: abc123…wxyz (run with --show-token to reveal)
167
+ Open: http://127.0.0.1:18890
168
+ ```
169
+
170
+ **Reveal the full token:**
171
+
172
+ ```bash
173
+ kyber dashboard --show-token
174
+ ```
175
+
176
+ If no token exists yet, one is generated automatically and saved to your config.
177
+
178
+ You can also find the token in `~/.kyber/config.json` under `dashboard.authToken`.
179
+
180
+ **Dashboard options:**
181
+
182
+ | Flag | Description |
183
+ |------|-------------|
184
+ | `--host` | Bind address (default: `127.0.0.1`) |
185
+ | `--port` | Port (default: `18890`) |
186
+ | `--show-token` | Print the full auth token on startup |
187
+
188
+ The dashboard UI has a sidebar with sections for Providers, Agent, Channels, Tools, Gateway, Dashboard settings, and a Raw JSON editor. Changes are saved directly to `~/.kyber/config.json` — restart running services after saving to apply.
189
+
190
+ ---
191
+
192
+ ## Chat channels
193
+
194
+ Enable channels in `~/.kyber/config.json` and start the gateway with `kyber gateway`.
195
+
196
+ **Discord:**
197
+
198
+ ```json
199
+ {
200
+ "channels": {
201
+ "discord": {
202
+ "enabled": true,
203
+ "token": "YOUR_BOT_TOKEN",
204
+ "allowFrom": ["YOUR_USER_ID"],
205
+ "requireMentionInGuilds": true,
206
+ "typingIndicator": true
207
+ }
208
+ }
209
+ }
210
+ ```
211
+
212
+ **Telegram:**
213
+
214
+ ```json
215
+ {
216
+ "channels": {
217
+ "telegram": {
218
+ "enabled": true,
219
+ "token": "YOUR_BOT_TOKEN",
220
+ "allowFrom": ["YOUR_USER_ID"]
221
+ }
222
+ }
223
+ }
224
+ ```
225
+
226
+ **WhatsApp:**
227
+
228
+ WhatsApp uses a Node.js bridge. First link your device:
229
+
230
+ ```bash
231
+ kyber channels login
232
+ ```
233
+
234
+ Then enable in config:
235
+
236
+ ```json
237
+ {
238
+ "channels": {
239
+ "whatsapp": {
240
+ "enabled": true,
241
+ "bridgeUrl": "ws://localhost:3001",
242
+ "allowFrom": ["YOUR_PHONE_NUMBER"]
243
+ }
244
+ }
245
+ }
246
+ ```
247
+
248
+ **Feishu/Lark:**
249
+
250
+ ```json
251
+ {
252
+ "channels": {
253
+ "feishu": {
254
+ "enabled": true,
255
+ "appId": "YOUR_APP_ID",
256
+ "appSecret": "YOUR_APP_SECRET"
257
+ }
258
+ }
259
+ }
260
+ ```
261
+
262
+ Use `allowFrom`, `allowGuilds`, and `allowChannels` to restrict who can interact with the bot.
263
+
264
+ Check channel status:
265
+
266
+ ```bash
267
+ kyber channels status
268
+ ```
269
+
270
+ ---
271
+
272
+ ## Background tasks and subagents
273
+
274
+ Kyber handles long-running tasks without blocking the conversation. Every incoming message is processed concurrently — you can keep chatting while the bot works on something complex.
275
+
276
+ **How it works:**
277
+
278
+ - Each message runs in its own async task
279
+ - If a task takes longer than 30 seconds, the bot sends an acknowledgment and keeps working in the background
280
+ - The user can ask for status updates at any time — the bot has a `task_status` tool that returns live progress instantly
281
+ - Subagents can also be spawned explicitly by the LLM for tasks it wants to run in parallel
282
+
283
+ **Status tracking:**
284
+
285
+ All long-running tasks (both auto-promoted and explicitly spawned subagents) are tracked with:
286
+ - Current step and total steps
287
+ - Elapsed time
288
+ - What tool is currently running
289
+ - Recent completed actions
290
+
291
+ Ask the bot "what's the status?" or "how's that task going?" and it will check the tracker and respond immediately.
292
+
293
+ ---
294
+
295
+ ## Tools
296
+
297
+ The agent has access to these built-in tools:
298
+
299
+ | Tool | Description |
300
+ |------|-------------|
301
+ | `read_file` | Read file contents |
302
+ | `write_file` | Write/create files |
303
+ | `edit_file` | Edit existing files |
304
+ | `list_dir` | List directory contents |
305
+ | `exec` | Execute shell commands |
306
+ | `web_search` | Search the web (requires Brave API key) |
307
+ | `web_fetch` | Fetch and extract web page content |
308
+ | `message` | Send messages to chat channels |
309
+ | `spawn` | Spawn a background subagent |
310
+ | `task_status` | Check progress of running tasks |
311
+
312
+ **Web search** requires a Brave Search API key:
313
+
314
+ ```json
315
+ {
316
+ "tools": {
317
+ "web": {
318
+ "search": {
319
+ "apiKey": "YOUR_BRAVE_API_KEY",
320
+ "maxResults": 5
321
+ }
322
+ }
323
+ }
324
+ }
325
+ ```
326
+
327
+ **Shell execution** can be restricted:
328
+
329
+ ```json
330
+ {
331
+ "tools": {
332
+ "exec": {
333
+ "timeout": 60,
334
+ "restrictToWorkspace": false
335
+ }
336
+ }
337
+ }
338
+ ```
339
+
340
+ ---
341
+
342
+ ## Skills
343
+
344
+ Skills extend the agent's capabilities through markdown instruction files. They live in `~/.kyber/workspace/skills/` (or the built-in `kyber/skills/` directory).
345
+
346
+ | Skill | Description |
347
+ |-------|-------------|
348
+ | `github` | Interact with GitHub using the `gh` CLI |
349
+ | `weather` | Get weather info using wttr.in and Open-Meteo |
350
+ | `summarize` | Summarize URLs, files, and YouTube videos |
351
+ | `tmux` | Remote-control tmux sessions |
352
+ | `skill-creator` | Create new skills |
353
+
354
+ Skills are loaded progressively — always-on skills are included in every prompt, while others are loaded on demand when the agent reads their `SKILL.md` file.
355
+
356
+ ---
357
+
358
+ ## Cron
359
+
360
+ Schedule recurring tasks:
361
+
362
+ ```bash
363
+ # Run every 5 minutes
364
+ kyber cron add --name "check-news" --message "Check tech news" --every 300
365
+
366
+ # Run daily at 9am
367
+ kyber cron add --name "morning-brief" --message "Give me a morning briefing" --cron "0 9 * * *"
368
+
369
+ # List jobs
370
+ kyber cron list
371
+
372
+ # Remove a job
373
+ kyber cron remove <job-id>
374
+ ```
375
+
376
+ Jobs can optionally deliver their output to a chat channel with `--deliver --to <chat_id> --channel <channel>`.
377
+
378
+ ---
379
+
380
+ ## CLI reference
381
+
382
+ | Command | Description |
383
+ |---------|-------------|
384
+ | `kyber onboard` | Initialize config and workspace |
385
+ | `kyber agent -m "..."` | Send a single message |
386
+ | `kyber agent` | Interactive chat mode |
387
+ | `kyber gateway` | Start the gateway (channels + agent) |
388
+ | `kyber dashboard` | Start the web dashboard |
389
+ | `kyber dashboard --show-token` | Start dashboard and show auth token |
390
+ | `kyber status` | Show config and provider status |
391
+ | `kyber channels status` | Show channel status |
392
+ | `kyber channels login` | Link WhatsApp via QR code |
393
+ | `kyber cron list` | List scheduled jobs |
394
+ | `kyber cron add` | Add a scheduled job |
395
+ | `kyber cron remove <id>` | Remove a scheduled job |
396
+ | `kyber --version` | Show version |
397
+
398
+ ---
399
+
400
+ ## Project layout
401
+
402
+ ```
403
+ kyber/
404
+ ├── agent/ Core agent loop, context builder, subagent manager
405
+ │ └── tools/ Built-in tools (filesystem, shell, web, message, spawn, task_status)
406
+ ├── bus/ Message bus for routing between channels and agent
407
+ ├── channels/ Chat integrations (Discord, Telegram, WhatsApp, Feishu)
408
+ ├── cli/ Command-line interface
409
+ ├── config/ Configuration schema and loader
410
+ ├── cron/ Scheduled task service
411
+ ├── dashboard/ Secure local web UI
412
+ ├── heartbeat/ Proactive wake-ups
413
+ ├── providers/ LLM provider integration (LiteLLM)
414
+ ├── session/ Conversation state management
415
+ ├── skills/ Built-in skill definitions
416
+ └── utils/ Helpers
417
+ ```
418
+
419
+ ---
420
+
421
+ ## Configuration reference
422
+
423
+ All configuration lives in `~/.kyber/config.json`. The full schema:
424
+
425
+ ```json
426
+ {
427
+ "agents": {
428
+ "defaults": {
429
+ "workspace": "~/.kyber/workspace",
430
+ "model": "anthropic/claude-sonnet-4-20250514",
431
+ "provider": "",
432
+ "maxTokens": 8192,
433
+ "temperature": 0.7,
434
+ "maxToolIterations": 20
435
+ }
436
+ },
437
+ "providers": {
438
+ "openrouter": { "apiKey": "", "apiBase": null },
439
+ "anthropic": { "apiKey": "" },
440
+ "openai": { "apiKey": "" },
441
+ "deepseek": { "apiKey": "" },
442
+ "gemini": { "apiKey": "" },
443
+ "groq": { "apiKey": "" },
444
+ "zhipu": { "apiKey": "" },
445
+ "vllm": { "apiKey": "", "apiBase": null }
446
+ },
447
+ "channels": {
448
+ "discord": { "enabled": false, "token": "", "allowFrom": [], "allowGuilds": [], "allowChannels": [], "requireMentionInGuilds": true },
449
+ "telegram": { "enabled": false, "token": "", "allowFrom": [] },
450
+ "whatsapp": { "enabled": false, "bridgeUrl": "ws://localhost:3001", "allowFrom": [] },
451
+ "feishu": { "enabled": false, "appId": "", "appSecret": "" }
452
+ },
453
+ "gateway": { "host": "0.0.0.0", "port": 18790 },
454
+ "dashboard": { "enabled": false, "host": "127.0.0.1", "port": 18890, "authToken": "" },
455
+ "tools": {
456
+ "web": { "search": { "apiKey": "", "maxResults": 5 } },
457
+ "exec": { "timeout": 60, "restrictToWorkspace": false }
458
+ }
459
+ }
460
+ ```
461
+
462
+ ---
463
+
464
+ ## Security notes
465
+
466
+ - The dashboard is local-only by default and protected with a bearer token
467
+ - Use `allowFrom`, `allowGuilds`, and `allowChannels` to restrict chat access
468
+ - Shell execution can be sandboxed to the workspace with `restrictToWorkspace`
469
+ - Keep API keys out of shared logs and rotate them if exposed
470
+ - The WhatsApp bridge stores session data locally — treat `~/.kyber/` as sensitive
471
+
472
+ ---
473
+
474
+ ## License
475
+
476
+ MIT. See `LICENSE`.
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "kyber-whatsapp-bridge",
3
+ "version": "0.1.0",
4
+ "description": "WhatsApp bridge for kyber using Baileys",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "start": "node dist/index.js",
10
+ "dev": "tsc && node dist/index.js"
11
+ },
12
+ "dependencies": {
13
+ "@whiskeysockets/baileys": "7.0.0-rc.9",
14
+ "ws": "^8.17.0",
15
+ "qrcode-terminal": "^0.12.0",
16
+ "pino": "^9.0.0"
17
+ },
18
+ "devDependencies": {
19
+ "@types/node": "^20.14.0",
20
+ "@types/ws": "^8.5.10",
21
+ "typescript": "^5.4.0"
22
+ },
23
+ "engines": {
24
+ "node": ">=20.0.0"
25
+ }
26
+ }
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * kyber WhatsApp Bridge
4
+ *
5
+ * This bridge connects WhatsApp Web to kyber's Python backend
6
+ * via WebSocket. It handles authentication, message forwarding,
7
+ * and reconnection logic.
8
+ *
9
+ * Usage:
10
+ * npm run build && npm start
11
+ *
12
+ * Or with custom settings:
13
+ * BRIDGE_PORT=3001 AUTH_DIR=~/.kyber/whatsapp npm start
14
+ */
15
+
16
+ // Polyfill crypto for Baileys in ESM
17
+ import { webcrypto } from 'crypto';
18
+ if (!globalThis.crypto) {
19
+ (globalThis as any).crypto = webcrypto;
20
+ }
21
+
22
+ import { BridgeServer } from './server.js';
23
+ import { homedir } from 'os';
24
+ import { join } from 'path';
25
+
26
+ const PORT = parseInt(process.env.BRIDGE_PORT || '3001', 10);
27
+ const AUTH_DIR = process.env.AUTH_DIR || join(homedir(), '.kyber', 'whatsapp-auth');
28
+
29
+ console.log('💎 kyber WhatsApp Bridge');
30
+ console.log('========================\n');
31
+
32
+ const server = new BridgeServer(PORT, AUTH_DIR);
33
+
34
+ // Handle graceful shutdown
35
+ process.on('SIGINT', async () => {
36
+ console.log('\n\nShutting down...');
37
+ await server.stop();
38
+ process.exit(0);
39
+ });
40
+
41
+ process.on('SIGTERM', async () => {
42
+ await server.stop();
43
+ process.exit(0);
44
+ });
45
+
46
+ // Start the server
47
+ server.start().catch((error) => {
48
+ console.error('Failed to start bridge:', error);
49
+ process.exit(1);
50
+ });