morpheus-cli 0.6.2 → 0.6.4

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 CHANGED
@@ -5,13 +5,14 @@
5
5
  # Morpheus
6
6
 
7
7
  Morpheus is a local-first AI operator for developers.
8
- It runs as a daemon and orchestrates LLMs, MCP tools, DevKit tools, memory, and channels (Web UI, Telegram, API, webhooks).
8
+ It runs as a daemon and orchestrates LLMs, MCP tools, DevKit tools, memory, and channels (Web UI, Telegram, Discord, API, webhooks).
9
9
 
10
10
  ## Why Morpheus
11
11
  - Local-first persistence (sessions, messages, usage, tasks).
12
12
  - Multi-agent architecture (Oracle, Neo, Apoc, Sati, Trinity).
13
13
  - Async task execution with queue + worker + notifier.
14
14
  - Chronos temporal scheduler for recurring and one-time Oracle executions.
15
+ - Multi-channel output via ChannelRegistry (Telegram, Discord) with per-job routing.
15
16
  - Rich operational visibility in UI (chat traces, tasks, usage, logs).
16
17
 
17
18
  ## Multi-Agent Roles
@@ -139,6 +140,21 @@ docker run -d \
139
140
  morpheus
140
141
  ```
141
142
 
143
+ **With Discord:**
144
+
145
+ ```bash
146
+ docker run -d \
147
+ --name morpheus-agent \
148
+ -p 3333:3333 \
149
+ -e OPENAI_API_KEY=sk-... \
150
+ -e THE_ARCHITECT_PASS=changeme \
151
+ -e MORPHEUS_DISCORD_ENABLED=true \
152
+ -e MORPHEUS_DISCORD_TOKEN=<bot-token> \
153
+ -e MORPHEUS_DISCORD_ALLOWED_USERS=987654321 \
154
+ -v morpheus_data:/root/.morpheus \
155
+ morpheus
156
+ ```
157
+
142
158
  **Health check:** the container exposes `GET /health` and Docker will probe it every 30s (60s start period, 3 retries before marking unhealthy).
143
159
 
144
160
  ## Async Task Execution
@@ -170,7 +186,8 @@ Chronos lets you schedule any Oracle prompt to run at a fixed time or on a recur
170
186
  **Execution model:**
171
187
  - Jobs run inside the currently active Oracle session — no isolated sessions are created per job.
172
188
  - Chronos injects context as an AI message before invoking `oracle.chat()`, keeping conversation history clean.
173
- - Delegated tasks spawned during Chronos execution carry `origin_channel: 'telegram'` when a Telegram notify function is registered, so task results are delivered to you.
189
+ - Each job has a `notify_channels` field: empty = broadcast to all active channels, `["telegram"]` = Telegram only, `["discord"]` = Discord only.
190
+ - When creating jobs via Oracle chat, the channel is auto-detected from the conversation origin. You can override it explicitly: *"lembre no Discord"*, *"em todos os canais"*.
174
191
 
175
192
  **Oracle tools:** `chronos_schedule`, `chronos_list`, `chronos_cancel`, `chronos_preview`
176
193
 
@@ -180,6 +197,11 @@ Chronos lets you schedule any Oracle prompt to run at a fixed time or on a recur
180
197
  - `/chronos_view <id>` — view job details and last 5 executions
181
198
  - `/chronos_enable <id>` / `/chronos_disable <id>` / `/chronos_delete <id>`
182
199
 
200
+ **Discord slash commands:**
201
+ - `/chronos prompt: time:` — create a job (prompt and time as separate fields)
202
+ - `/chronos_list` — list all jobs
203
+ - `/chronos_view id:` / `/chronos_disable id:` / `/chronos_enable id:` / `/chronos_delete id:`
204
+
183
205
  **API endpoints (protected):**
184
206
  - `GET/POST /api/chronos` — list / create jobs
185
207
  - `GET/PUT/DELETE /api/chronos/:id` — read / update / delete
@@ -197,6 +219,47 @@ Telegram responses use rich HTML formatting conversion with:
197
219
 
198
220
  Task results are delivered proactively with metadata (task id, agent, status) and output/error body.
199
221
 
222
+ **Voice messages:** Telegram voice messages are automatically transcribed (Gemini / Whisper / OpenRouter) and processed as text through the Oracle.
223
+
224
+ ## Discord Experience
225
+
226
+ Discord bot responds to **DMs only** from authorized user IDs (`allowedUsers`).
227
+
228
+ **Slash commands** (registered automatically on startup):
229
+
230
+ | Command | Description |
231
+ |---|---|
232
+ | `/help` | Show available commands |
233
+ | `/status` | Check Morpheus status |
234
+ | `/stats` | Token usage statistics |
235
+ | `/newsession` | Start a new session |
236
+ | `/chronos prompt: time:` | Schedule a job |
237
+ | `/chronos_list` | List all scheduled jobs |
238
+ | `/chronos_view id:` | View job + executions |
239
+ | `/chronos_disable id:` | Disable a job |
240
+ | `/chronos_enable id:` | Enable a job |
241
+ | `/chronos_delete id:` | Delete a job |
242
+
243
+ **Voice messages:** Discord voice messages and audio file attachments are transcribed and processed identically to Telegram.
244
+
245
+ **Setup:**
246
+ 1. Create an application at [discord.com/developers](https://discord.com/developers/applications).
247
+ 2. Under **Bot**, enable **Message Content Intent** (Privileged Gateway Intents).
248
+ 3. Copy the Bot Token and add it to Settings → Channels → Discord.
249
+ 4. Add your Discord user ID to **Allowed Users**.
250
+ 5. Invite the bot to a server via OAuth2 URL Generator (`bot` scope). The bot must share a server with you for DMs to work.
251
+
252
+ ## Channel Routing
253
+
254
+ Morpheus uses a central `ChannelRegistry` so every adapter (Telegram, Discord) registers itself at startup. Task notifications and Chronos job results are routed through the registry:
255
+
256
+ - `notify_channels: []` → broadcast to all active channels
257
+ - `notify_channels: ["telegram"]` → Telegram only
258
+ - `notify_channels: ["discord"]` → Discord only
259
+ - `origin_channel: 'chronos'` (on tasks) → broadcast
260
+
261
+ Adding a new channel requires only implementing `IChannelAdapter` (`channel`, `sendMessage`, `sendMessageToUser`, `disconnect`) and calling `ChannelRegistry.register()` in `start.ts`.
262
+
200
263
  ## Web UI
201
264
 
202
265
  The dashboard includes:
@@ -271,6 +334,8 @@ channels:
271
334
  allowedUsers: ["123456789"]
272
335
  discord:
273
336
  enabled: false
337
+ token: env:DISCORD_BOT_TOKEN
338
+ allowedUsers: ["987654321"]
274
339
 
275
340
  ui:
276
341
  enabled: true
@@ -296,6 +361,7 @@ Provider-specific keys:
296
361
  - `GOOGLE_API_KEY`
297
362
  - `OPENROUTER_API_KEY`
298
363
  - `TELEGRAM_BOT_TOKEN`
364
+ - `DISCORD_BOT_TOKEN`
299
365
  - `THE_ARCHITECT_PASS`
300
366
 
301
367
  Security:
@@ -348,6 +414,9 @@ Generic Morpheus overrides (selected):
348
414
  | `MORPHEUS_TELEGRAM_ENABLED` | `channels.telegram.enabled` |
349
415
  | `MORPHEUS_TELEGRAM_TOKEN` | `channels.telegram.token` |
350
416
  | `MORPHEUS_TELEGRAM_ALLOWED_USERS` | `channels.telegram.allowedUsers` |
417
+ | `MORPHEUS_DISCORD_ENABLED` | `channels.discord.enabled` |
418
+ | `MORPHEUS_DISCORD_TOKEN` | `channels.discord.token` |
419
+ | `MORPHEUS_DISCORD_ALLOWED_USERS` | `channels.discord.allowedUsers` |
351
420
  | `MORPHEUS_UI_ENABLED` | `ui.enabled` |
352
421
  | `MORPHEUS_UI_PORT` | `ui.port` |
353
422
  | `MORPHEUS_LOGGING_ENABLED` | `logging.enabled` |
@@ -488,7 +557,10 @@ npm test
488
557
 
489
558
  ```text
490
559
  src/
491
- channels/ # Telegram adapter
560
+ channels/
561
+ telegram.ts # Telegram adapter (commands, voice, inline buttons)
562
+ discord.ts # Discord adapter (slash commands, voice, DM-only)
563
+ registry.ts # ChannelRegistry — central adapter router
492
564
  cli/ # start/stop/restart/status/doctor
493
565
  config/ # config loading, precedence, schemas
494
566
  devkit/ # Apoc tool factories