morpheus-cli 0.4.14 → 0.5.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.
- package/README.md +275 -1116
- package/dist/channels/telegram.js +210 -73
- package/dist/cli/commands/doctor.js +34 -0
- package/dist/cli/commands/init.js +128 -0
- package/dist/cli/commands/restart.js +17 -0
- package/dist/cli/commands/start.js +15 -0
- package/dist/config/manager.js +51 -0
- package/dist/config/schemas.js +7 -0
- package/dist/devkit/tools/network.js +1 -1
- package/dist/http/api.js +177 -10
- package/dist/runtime/apoc.js +139 -32
- package/dist/runtime/memory/sati/repository.js +30 -2
- package/dist/runtime/memory/sati/service.js +46 -15
- package/dist/runtime/memory/sati/system-prompts.js +71 -29
- package/dist/runtime/memory/sqlite.js +24 -0
- package/dist/runtime/neo.js +134 -0
- package/dist/runtime/oracle.js +244 -133
- package/dist/runtime/providers/factory.js +1 -12
- package/dist/runtime/tasks/context.js +53 -0
- package/dist/runtime/tasks/dispatcher.js +70 -0
- package/dist/runtime/tasks/notifier.js +68 -0
- package/dist/runtime/tasks/repository.js +370 -0
- package/dist/runtime/tasks/types.js +1 -0
- package/dist/runtime/tasks/worker.js +96 -0
- package/dist/runtime/tools/apoc-tool.js +61 -8
- package/dist/runtime/tools/delegation-guard.js +29 -0
- package/dist/runtime/tools/index.js +1 -0
- package/dist/runtime/tools/neo-tool.js +99 -0
- package/dist/runtime/tools/task-query-tool.js +76 -0
- package/dist/runtime/webhooks/dispatcher.js +10 -19
- package/dist/types/config.js +10 -0
- package/dist/ui/assets/index-20lLB1sM.js +112 -0
- package/dist/ui/assets/index-BJ56bRfs.css +1 -0
- package/dist/ui/index.html +2 -2
- package/dist/ui/sw.js +1 -1
- package/package.json +1 -1
- package/dist/ui/assets/index-LemKVRjC.js +0 -112
- package/dist/ui/assets/index-TCQ7VNYO.css +0 -1
package/README.md
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
|
-
<div align="center">
|
|
1
|
+
<div align="center">
|
|
2
2
|
<img src="./assets/logo.png" alt="Morpheus Logo" width="220" />
|
|
3
3
|
</div>
|
|
4
4
|
|
|
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
9
|
|
|
9
|
-
|
|
10
|
+
## Why Morpheus
|
|
11
|
+
- Local-first persistence (sessions, messages, usage, tasks).
|
|
12
|
+
- Multi-agent architecture (Oracle, Neo, Apoc, Sati).
|
|
13
|
+
- Async task execution with queue + worker + notifier.
|
|
14
|
+
- Rich operational visibility in UI (chat traces, tasks, usage, logs).
|
|
10
15
|
|
|
11
|
-
##
|
|
16
|
+
## Multi-Agent Roles
|
|
17
|
+
- `Oracle`: orchestration and routing. Decides direct answer vs async delegation.
|
|
18
|
+
- `Neo`: MCP and internal operational tools (config, diagnostics, analytics).
|
|
19
|
+
- `Apoc`: DevTools/browser execution (filesystem, shell, git, network, packages, processes, system, browser automation).
|
|
20
|
+
- `Sati`: long-term memory retrieval/evaluation.
|
|
12
21
|
|
|
13
|
-
|
|
22
|
+
## Installation
|
|
14
23
|
|
|
15
24
|
```bash
|
|
16
25
|
npm install -g morpheus-cli
|
|
@@ -20,1206 +29,356 @@ npm install -g morpheus-cli
|
|
|
20
29
|
|
|
21
30
|
### 1. Initialize
|
|
22
31
|
|
|
23
|
-
Set up your configuration (API keys, preferences):
|
|
24
|
-
|
|
25
32
|
```bash
|
|
26
33
|
morpheus init
|
|
27
34
|
```
|
|
28
35
|
|
|
29
|
-
|
|
36
|
+
Creates:
|
|
37
|
+
- `~/.morpheus/zaion.yaml`
|
|
38
|
+
- `~/.morpheus/mcps.json`
|
|
39
|
+
- local memory/log folders
|
|
30
40
|
|
|
31
|
-
|
|
41
|
+
### 2. Start
|
|
32
42
|
|
|
33
43
|
```bash
|
|
34
44
|
morpheus start
|
|
35
45
|
```
|
|
36
46
|
|
|
37
|
-
|
|
38
|
-
- Start the agent process
|
|
39
|
-
- Launch the Web UI at http://localhost:3333
|
|
40
|
-
- If an instance is already running, prompt whether to stop it and start a new one
|
|
41
|
-
|
|
42
|
-
#### Auto-approve restart
|
|
43
|
-
|
|
44
|
-
If you want to automatically stop any running instance and start a new one without prompting:
|
|
47
|
+
Useful flags:
|
|
45
48
|
|
|
46
49
|
```bash
|
|
47
|
-
morpheus start -y
|
|
48
|
-
#
|
|
49
|
-
morpheus start --
|
|
50
|
+
morpheus start -y # auto-restart if another instance is running
|
|
51
|
+
morpheus start --no-ui # disable web UI
|
|
52
|
+
morpheus start --port 3333 # override UI port
|
|
50
53
|
```
|
|
51
54
|
|
|
52
|
-
###
|
|
55
|
+
### 3. Control Commands
|
|
53
56
|
|
|
54
57
|
```bash
|
|
55
|
-
# Check if Morpheus is running
|
|
56
58
|
morpheus status
|
|
57
|
-
|
|
58
|
-
# Stop the agent
|
|
59
59
|
morpheus stop
|
|
60
|
-
|
|
61
|
-
# Restart the agent
|
|
62
60
|
morpheus restart
|
|
63
|
-
|
|
64
|
-
# Diagnose issues
|
|
65
61
|
morpheus doctor
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
morpheus session new # Archive current and start new
|
|
69
|
-
morpheus session status # Check current session info
|
|
62
|
+
morpheus session new
|
|
63
|
+
morpheus session status
|
|
70
64
|
```
|
|
71
65
|
|
|
72
|
-
##
|
|
73
|
-
|
|
74
|
-
### Command not found
|
|
75
|
-
|
|
76
|
-
If you installed successfully but can't run the `morpheus` command:
|
|
77
|
-
|
|
78
|
-
1. **Check your PATH**: Ensure your global npm bin directory is in your system PATH.
|
|
79
|
-
- Run `npm bin -g` to see the folder.
|
|
80
|
-
- On Windows, this is usually `%APPDATA%\npm`.
|
|
81
|
-
- On Linux/Mac, verify `echo $PATH`.
|
|
82
|
-
2. **Restart Terminal**: New installations might not be visible until you restart your shell.
|
|
66
|
+
## Async Task Execution
|
|
83
67
|
|
|
84
|
-
|
|
85
|
-
You can run Morpheus without installing it globally using `npx`:
|
|
68
|
+
Morpheus uses asynchronous delegation by default:
|
|
86
69
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
70
|
+
1. Oracle receives user request.
|
|
71
|
+
2. If execution is needed, Oracle calls `neo_delegate` or `apoc_delegate`.
|
|
72
|
+
3. Delegate tool creates a row in `tasks` table with origin metadata (`channel`, `session`, `message`, `user`).
|
|
73
|
+
4. Oracle immediately acknowledges task creation.
|
|
74
|
+
5. `TaskWorker` executes pending tasks.
|
|
75
|
+
6. `TaskNotifier` sends completion/failure through `TaskDispatcher`.
|
|
90
76
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
77
|
+
Important behavior:
|
|
78
|
+
- Oracle stays responsive while tasks run.
|
|
79
|
+
- Delegations must be atomic (single objective per task).
|
|
80
|
+
- Duplicate/fabricated task acknowledgements are blocked by validation against DB.
|
|
81
|
+
- Status follow-ups are handled by Oracle through `task_query` (no delegation required).
|
|
94
82
|
|
|
95
|
-
##
|
|
96
|
-
|
|
97
|
-
Morpheus is built with **Node.js** and **TypeScript**, using **LangChain** as the orchestration engine. It runs as a background daemon process, managing connections to LLM providers (OpenAI, Anthropic, Ollama) and external channels (Telegram, Discord).
|
|
98
|
-
|
|
99
|
-
### Core Components
|
|
100
|
-
|
|
101
|
-
- **Runtime (`src/runtime/`)**: The heart of the application. Manages the Oracle (agent) lifecycle, provider instantiation, and command execution.
|
|
102
|
-
- **CLI (`src/cli/`)**: Built with `commander`, handles user interaction, configuration, and daemon control (`start`, `stop`, `status`).
|
|
103
|
-
- **Configuration (`src/config/`)**: Singleton-based configuration manager using `zod` for validation and `js-yaml` for persistence (`~/.morpheus/zaion.yaml`).
|
|
104
|
-
- **Channels (`src/channels/`)**: Adapters for external communication. Currently supports Telegram (`telegraf`) with strict user whitelisting.
|
|
105
|
-
|
|
106
|
-
## Features
|
|
107
|
-
|
|
108
|
-
### 🖥️ Web Dashboard
|
|
109
|
-
Local React-based UI to manage recordings, chat history, and system status across your agent instances.
|
|
110
|
-
|
|
111
|
-
**New: Interactive Web Chat**
|
|
112
|
-
- Full-featured chat interface accessible from the browser
|
|
113
|
-
- Session management: create, archive, delete, and rename sessions
|
|
114
|
-
- Cross-channel visibility: view and interact with sessions started on any channel (Telegram, Web, etc.)
|
|
115
|
-
- Real-time messaging with the Oracle agent
|
|
116
|
-
- Responsive design with collapsible sidebar
|
|
117
|
-
- Full support for Light and Dark (Matrix) themes
|
|
118
|
-
|
|
119
|
-
#### 🔒 UI Authentication
|
|
120
|
-
To protect your Web UI, use the `THE_ARCHITECT_PASS` environment variable. This ensures only authorized users can access the dashboard and API.
|
|
121
|
-
|
|
122
|
-
Additionally, you can use environment variables for API keys instead of storing them in the configuration file:
|
|
123
|
-
|
|
124
|
-
| Variable | Description | Required |
|
|
125
|
-
|----------|-------------|----------|
|
|
126
|
-
| `OPENAI_API_KEY` | OpenAI API key (if using GPT) | No |
|
|
127
|
-
| `ANTHROPIC_API_KEY` | Anthropic API key (if using Claude) | No |
|
|
128
|
-
| `GOOGLE_API_KEY` | Google AI key (for Gemini LLM/Audio) | No |
|
|
129
|
-
| `OPENROUTER_API_KEY` | OpenRouter API key (if using OpenRouter) | No |
|
|
130
|
-
| `THE_ARCHITECT_PASS` | Web Dashboard access password | Recommended |
|
|
131
|
-
| `TELEGRAM_BOT_TOKEN` | Telegram BotFather token | No |
|
|
132
|
-
|
|
133
|
-
If these environment variables are set, they will take precedence over values stored in the configuration file.
|
|
134
|
-
|
|
135
|
-
The system also supports generic environment variables that apply to all providers:
|
|
136
|
-
|
|
137
|
-
| Variable | Description | Applies To |
|
|
138
|
-
|----------|-------------|------------|
|
|
139
|
-
| `MORPHEUS_AGENT_NAME` | Name of the agent | agent.name |
|
|
140
|
-
| `MORPHEUS_AGENT_PERSONALITY` | Personality of the agent | agent.personality |
|
|
141
|
-
| `MORPHEUS_LLM_PROVIDER` | LLM provider to use | llm.provider |
|
|
142
|
-
| `MORPHEUS_LLM_MODEL` | Model name for LLM | llm.model |
|
|
143
|
-
| `MORPHEUS_LLM_TEMPERATURE` | Temperature setting for LLM | llm.temperature |
|
|
144
|
-
| `MORPHEUS_LLM_MAX_TOKENS` | Maximum tokens for LLM | llm.max_tokens |
|
|
145
|
-
| `MORPHEUS_LLM_CONTEXT_WINDOW` | Context window size for LLM | llm.context_window |
|
|
146
|
-
| `MORPHEUS_LLM_API_KEY` | Generic API key for LLM (lower precedence than provider-specific keys) | llm.api_key |
|
|
147
|
-
| `MORPHEUS_SATI_PROVIDER` | Sati provider to use | santi.provider |
|
|
148
|
-
| `MORPHEUS_SATI_MODEL` | Model name for Sati | santi.model |
|
|
149
|
-
| `MORPHEUS_SATI_TEMPERATURE` | Temperature setting for Sati | santi.temperature |
|
|
150
|
-
| `MORPHEUS_SATI_MAX_TOKENS` | Maximum tokens for Sati | santi.max_tokens |
|
|
151
|
-
| `MORPHEUS_SATI_CONTEXT_WINDOW` | Context window size for Sati | santi.context_window |
|
|
152
|
-
| `MORPHEUS_SATI_API_KEY` | Generic API key for Sati (lower precedence than provider-specific keys) | santi.api_key |
|
|
153
|
-
| `MORPHEUS_SATI_MEMORY_LIMIT` | Memory retrieval limit for Sati | santi.memory_limit |
|
|
154
|
-
| `MORPHEUS_SATI_MEMORY_LIMIT` | Memory retrieval limit for Sati | santi.memory_limit |
|
|
155
|
-
| `MORPHEUS_SATI_ENABLED_ARCHIVED_SESSIONS`| Enable/disable retrieval of archived sessions in Sati | santi.enableArchivedSessions |
|
|
156
|
-
| `MORPHEUS_APOC_PROVIDER` | Apoc LLM provider | apoc.provider |
|
|
157
|
-
| `MORPHEUS_APOC_MODEL` | Model name for Apoc | apoc.model |
|
|
158
|
-
| `MORPHEUS_APOC_TEMPERATURE` | Temperature for Apoc | apoc.temperature |
|
|
159
|
-
| `MORPHEUS_APOC_MAX_TOKENS` | Maximum tokens for Apoc | apoc.max_tokens |
|
|
160
|
-
| `MORPHEUS_APOC_API_KEY` | API key for Apoc (falls back to provider-specific key) | apoc.api_key |
|
|
161
|
-
| `MORPHEUS_APOC_WORKING_DIR` | Working directory for Apoc file/shell operations | apoc.working_dir |
|
|
162
|
-
| `MORPHEUS_APOC_TIMEOUT_MS` | Timeout in ms for Apoc shell operations (default: 30000) | apoc.timeout_ms |
|
|
163
|
-
| `MORPHEUS_AUDIO_MODEL` | Model name for audio processing | audio.model |
|
|
164
|
-
| `MORPHEUS_AUDIO_ENABLED` | Enable/disable audio processing | audio.enabled |
|
|
165
|
-
| `MORPHEUS_AUDIO_API_KEY` | Generic API key for audio (lower precedence than provider-specific keys) | audio.apiKey |
|
|
166
|
-
| `MORPHEUS_AUDIO_MAX_DURATION` | Max duration for audio processing | audio.maxDurationSeconds |
|
|
167
|
-
| `MORPHEUS_TELEGRAM_ENABLED` | Enable/disable Telegram channel | channels.telegram.enabled |
|
|
168
|
-
| `MORPHEUS_TELEGRAM_TOKEN` | Telegram bot token | channels.telegram.token |
|
|
169
|
-
| `MORPHEUS_TELEGRAM_ALLOWED_USERS` | Comma-separated list of allowed Telegram user IDs | channels.telegram.allowedUsers |
|
|
170
|
-
| `MORPHEUS_UI_ENABLED` | Enable/disable Web UI | ui.enabled |
|
|
171
|
-
| `MORPHEUS_UI_PORT` | Port for Web UI | ui.port |
|
|
172
|
-
| `MORPHEUS_LOGGING_ENABLED` | Enable/disable logging | logging.enabled |
|
|
173
|
-
| `MORPHEUS_LOGGING_LEVEL` | Logging level | logging.level |
|
|
174
|
-
| `MORPHEUS_LOGGING_RETENTION` | Log retention period | logging.retention |
|
|
175
|
-
|
|
176
|
-
**Precedence Order**: The system follows this order of precedence when resolving configuration values:
|
|
177
|
-
1. Provider-specific environment variable (e.g., `OPENAI_API_KEY`) - Highest priority
|
|
178
|
-
2. Generic environment variable (e.g., `MORPHEUS_LLM_API_KEY`) - Medium priority
|
|
179
|
-
3. Configuration file value (e.g., `config.llm.api_key`) - Lower priority
|
|
180
|
-
4. Default value - Lowest priority
|
|
181
|
-
|
|
182
|
-
> **Note**: If `THE_ARCHITECT_PASS` is not set, the system will use the default password `iamthearchitect`. This is less secure and it's recommended to set your own password in production environments.
|
|
183
|
-
|
|
184
|
-
**Option 1: Using a `.env` file**
|
|
185
|
-
Create a `.env` file in the root of your project:
|
|
186
|
-
|
|
187
|
-
```env
|
|
188
|
-
OPENAI_API_KEY="your-openai-api-key"
|
|
189
|
-
ANTHROPIC_API_KEY="your-anthropic-api-key"
|
|
190
|
-
GOOGLE_API_KEY="your-google-api-key"
|
|
191
|
-
THE_ARCHITECT_PASS="your-secure-password"
|
|
192
|
-
TELEGRAM_BOT_TOKEN="your-telegram-bot-token"
|
|
193
|
-
OPENROUTER_API_KEY="your-openrouter-api-key"
|
|
194
|
-
```
|
|
83
|
+
## Telegram Experience
|
|
195
84
|
|
|
196
|
-
|
|
85
|
+
Telegram responses use rich HTML formatting conversion with:
|
|
86
|
+
- bold/italic/list rendering from markdown-like text
|
|
87
|
+
- inline code and fenced code blocks
|
|
88
|
+
- auto-wrapped UUIDs in `<code>` for easier copy
|
|
197
89
|
|
|
198
|
-
|
|
199
|
-
export OPENAI_API_KEY="your-openai-api-key"
|
|
200
|
-
export ANTHROPIC_API_KEY="your-anthropic-api-key"
|
|
201
|
-
export GOOGLE_API_KEY="your-google-api-key"
|
|
202
|
-
export OPENROUTER_API_KEY="your-openrouter-api-key"
|
|
203
|
-
export THE_ARCHITECT_PASS="your-secure-password"
|
|
204
|
-
export TELEGRAM_BOT_TOKEN="your-telegram-bot-token"
|
|
205
|
-
morpheus start
|
|
206
|
-
```
|
|
90
|
+
Task results are delivered proactively with metadata (task id, agent, status) and output/error body.
|
|
207
91
|
|
|
208
|
-
|
|
209
|
-
- The Web UI will redirect to a Login page.
|
|
210
|
-
- API requests require the `x-architect-pass` header.
|
|
211
|
-
- The session is persisted locally in your browser.
|
|
92
|
+
## Web UI
|
|
212
93
|
|
|
213
|
-
|
|
214
|
-
|
|
94
|
+
The dashboard includes:
|
|
95
|
+
- Chat with session management
|
|
96
|
+
- Tasks page (stats, filters, details, retry)
|
|
97
|
+
- Agent settings (Oracle/Sati/Neo/Apoc)
|
|
98
|
+
- MCP manager
|
|
99
|
+
- Sati memories
|
|
100
|
+
- Usage stats and model pricing
|
|
101
|
+
- Webhooks and notification inbox
|
|
215
102
|
|
|
216
|
-
|
|
103
|
+
Chat-specific rendering:
|
|
104
|
+
- AI messages rendered as markdown
|
|
105
|
+
- Tool payloads shown in collapsible blocks
|
|
106
|
+
- SATI-related tool content grouped under `SATI Memory`
|
|
107
|
+
- per-message token badge (`input/output`)
|
|
217
108
|
|
|
218
|
-
|
|
109
|
+
## Configuration (`~/.morpheus/zaion.yaml`)
|
|
219
110
|
|
|
220
|
-
| Tool Group | Capabilities |
|
|
221
|
-
|---|---|
|
|
222
|
-
| **Filesystem** | Read, write, append, delete files and directories |
|
|
223
|
-
| **Shell** | Execute shell commands and scripts with timeout control |
|
|
224
|
-
| **Git** | status, log, diff, commit, push, pull, clone, branch |
|
|
225
|
-
| **Packages** | npm/yarn install, update, audit, package.json inspection |
|
|
226
|
-
| **Processes** | List running processes, check ports, terminate processes |
|
|
227
|
-
| **Network** | curl, ping, DNS lookups, HTTP requests |
|
|
228
|
-
| **System** | Environment variables, OS info, disk space, memory usage |
|
|
229
|
-
|
|
230
|
-
Oracle delegates to Apoc via the `apoc_delegate` tool when you ask things like:
|
|
231
|
-
- *"Run npm install and show me any errors"*
|
|
232
|
-
- *"What's the git status of this repo?"*
|
|
233
|
-
- *"Read the contents of config.json"*
|
|
234
|
-
- *"Execute the build script and tell me what happened"*
|
|
235
|
-
|
|
236
|
-
Apoc is independently configurable — use a different (e.g., faster, cheaper) model than Oracle for tool execution tasks.
|
|
237
|
-
|
|
238
|
-
### 🧠 Sati (Long-Term Memory)
|
|
239
|
-
Morpheus features a dedicated middleware system called **Sati** (Mindfulness) that provides long-term memory capabilities.
|
|
240
|
-
- **Automated Storage**: Automatically extracts and saves preferences, project details, and facts from conversations.
|
|
241
|
-
- **Contextual Retrieval**: Injects relevant memories into the context based on your current query.
|
|
242
|
-
- **Data Privacy**: Stored in a local, independent SQLite database (`santi-memory.db`), ensuring sensitive data is handled securely and reducing context window usage.
|
|
243
|
-
- **Memory Management**: View and manage your long-term memories through the Web UI or via API endpoints.
|
|
244
|
-
|
|
245
|
-
### 🪝 Webhooks & Notifications
|
|
246
|
-
|
|
247
|
-
Morpheus includes a **Webhook System** that lets any external service (GitHub Actions, CI/CD pipelines, monitoring tools, etc.) trigger Oracle and receive the result asynchronously.
|
|
248
|
-
|
|
249
|
-
**How it works:**
|
|
250
|
-
1. Create a webhook via the Web UI or API — give it a name (slug) and a prompt.
|
|
251
|
-
2. You receive a unique `api_key` for that webhook.
|
|
252
|
-
3. Trigger it from anywhere by posting JSON to `POST /api/webhooks/trigger/<name>` with the `x-api-key` header.
|
|
253
|
-
4. Morpheus runs Oracle with your prompt + the received payload in the background.
|
|
254
|
-
5. The result is saved as a **Notification** and optionally pushed to Telegram.
|
|
255
|
-
|
|
256
|
-
**Example — trigger from GitHub Actions:**
|
|
257
111
|
```yaml
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
-H "x-api-key: ${{ secrets.MORPHEUS_WEBHOOK_KEY }}" \
|
|
262
|
-
-H "Content-Type: application/json" \
|
|
263
|
-
-d '{"workflow":"${{ github.workflow }}","status":"success","ref":"${{ github.ref }}"}'
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
**Security:** Each webhook has its own `api_key` (UUID). The key is sent in the `x-api-key` header — never in the URL — to prevent leakage in server logs. Management endpoints remain protected by `THE_ARCHITECT_PASS`.
|
|
267
|
-
|
|
268
|
-
**Notification channels:** `ui` (Web UI inbox with unread badge) and/or `telegram` (proactive push message).
|
|
269
|
-
|
|
270
|
-
### 📊 Usage Analytics
|
|
271
|
-
Track your token usage across different providers and models directly from the Web UI. View detailed breakdowns of input/output tokens and message counts to monitor costs and activity.
|
|
272
|
-
|
|
273
|
-
### 🎙️ Audio Transcription (Telegram)
|
|
274
|
-
Send voice messages directly to the Telegram bot. Morpheus will:
|
|
275
|
-
1. Transcribe the audio using the configured provider.
|
|
276
|
-
2. Process the text as a standard prompt.
|
|
277
|
-
3. Reply with the answer.
|
|
278
|
-
|
|
279
|
-
Supported audio providers:
|
|
280
|
-
|
|
281
|
-
| Provider | Method | Model example |
|
|
282
|
-
|---|---|---|
|
|
283
|
-
| **Google Gemini** | Native audio file upload | `gemini-2.5-flash-lite` |
|
|
284
|
-
| **OpenAI** | Whisper API (`/audio/transcriptions`) | `whisper-1` |
|
|
285
|
-
| **OpenRouter** | `input_audio` via `@openrouter/sdk` (multimodal models) | `google/gemini-2.5-flash` |
|
|
286
|
-
| **Ollama** | Whisper local via OpenAI-compatible endpoint | `whisper` |
|
|
287
|
-
|
|
288
|
-
> Ollama requires a Whisper model loaded: `ollama pull whisper`
|
|
289
|
-
|
|
290
|
-
*Configure `audio.provider` and `audio.apiKey` in Settings or `config.yaml`.*
|
|
291
|
-
|
|
292
|
-
### 🤖 Telegram Commands
|
|
293
|
-
The Morpheus Telegram bot supports several commands for interacting with the agent:
|
|
294
|
-
|
|
295
|
-
- `/start` - Show welcome message and available commands
|
|
296
|
-
- `/status` - Check the status of the Morpheus agent
|
|
297
|
-
- `/doctor` - Diagnose environment and configuration issues
|
|
298
|
-
- `/stats` - Show token usage statistics
|
|
299
|
-
- `/help` - Show available commands
|
|
300
|
-
- `/zaion` - Show system configurations
|
|
301
|
-
- `/sati <qnt>` - Show specific memories
|
|
302
|
-
- `/newsession` - Archive current session and start fresh
|
|
303
|
-
- `/sessions` - List all sessions with options to switch, archive, or delete
|
|
304
|
-
- `/restart` - Restart the Morpheus agent
|
|
305
|
-
- `/mcp` or `/mcps` - List registered MCP servers
|
|
306
|
-
|
|
307
|
-
## Development Setup
|
|
308
|
-
|
|
309
|
-
This guide is for developers contributing to the Morpheus codebase.
|
|
310
|
-
|
|
311
|
-
### Prerequisites
|
|
312
|
-
|
|
313
|
-
- **Node.js**: >= 18.x
|
|
314
|
-
- **npm**: >= 9.x
|
|
315
|
-
- **TypeScript**: >= 5.x
|
|
316
|
-
|
|
317
|
-
### 1. Clone & Install
|
|
318
|
-
|
|
319
|
-
```bash
|
|
320
|
-
git clone https://github.com/your-org/morpheus.git
|
|
321
|
-
cd morpheus
|
|
322
|
-
npm install
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
### 2. Build
|
|
326
|
-
|
|
327
|
-
Compile TypeScript source to `dist/` and build the Web UI.
|
|
328
|
-
|
|
329
|
-
```bash
|
|
330
|
-
npm run build
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
### 3. Run the CLI
|
|
334
|
-
|
|
335
|
-
You can run the CLI directly from the source using `npm start`.
|
|
336
|
-
|
|
337
|
-
```bash
|
|
338
|
-
# Initialize configuration (creates ~/.morpheus)
|
|
339
|
-
npm start -- init
|
|
340
|
-
|
|
341
|
-
# Start the daemon
|
|
342
|
-
npm start -- start
|
|
112
|
+
agent:
|
|
113
|
+
name: morpheus
|
|
114
|
+
personality: helpful_dev
|
|
343
115
|
|
|
344
|
-
#
|
|
345
|
-
|
|
346
|
-
|
|
116
|
+
llm: # Oracle
|
|
117
|
+
provider: openai
|
|
118
|
+
model: gpt-4o
|
|
119
|
+
temperature: 0.7
|
|
120
|
+
context_window: 100
|
|
121
|
+
api_key: env:OPENAI_API_KEY
|
|
122
|
+
|
|
123
|
+
sati:
|
|
124
|
+
provider: openai
|
|
125
|
+
model: gpt-4o-mini
|
|
126
|
+
temperature: 0.3
|
|
127
|
+
memory_limit: 100
|
|
128
|
+
enabled_archived_sessions: true
|
|
129
|
+
|
|
130
|
+
neo:
|
|
131
|
+
provider: openai
|
|
132
|
+
model: gpt-4o-mini
|
|
133
|
+
temperature: 0.2
|
|
134
|
+
context_window: 100
|
|
347
135
|
|
|
348
|
-
|
|
136
|
+
apoc:
|
|
137
|
+
provider: openai
|
|
138
|
+
model: gpt-4o-mini
|
|
139
|
+
temperature: 0.2
|
|
140
|
+
working_dir: /home/user/projects
|
|
141
|
+
timeout_ms: 30000
|
|
349
142
|
|
|
350
|
-
|
|
143
|
+
runtime:
|
|
144
|
+
async_tasks:
|
|
145
|
+
enabled: true
|
|
351
146
|
|
|
352
|
-
```yaml
|
|
353
|
-
agent:
|
|
354
|
-
name: "Morpheus"
|
|
355
|
-
personality: "stoic, wise, and helpful"
|
|
356
|
-
llm:
|
|
357
|
-
provider: "openai" # options: openai, anthropic, ollama, gemini
|
|
358
|
-
model: "gpt-4-turbo"
|
|
359
|
-
temperature: 0.7
|
|
360
|
-
context_window: 100 # Number of messages to load into LLM context
|
|
361
|
-
api_key: "sk-..."
|
|
362
|
-
santi: # Optional: Sati (Long-Term Memory) specific settings
|
|
363
|
-
provider: "openai" # defaults to llm.provider
|
|
364
|
-
model: "gpt-4o"
|
|
365
|
-
memory_limit: 1000 # Number of messages/items to retrieve
|
|
366
|
-
apoc: # Optional: Apoc DevTools subagent settings
|
|
367
|
-
provider: "openai" # defaults to llm.provider (can use a cheaper/faster model)
|
|
368
|
-
model: "gpt-4o-mini"
|
|
369
|
-
temperature: 0.2
|
|
370
|
-
working_dir: "/home/user/projects" # root dir for file/shell ops (defaults to process cwd)
|
|
371
|
-
timeout_ms: 30000 # shell command timeout in ms
|
|
372
147
|
channels:
|
|
373
148
|
telegram:
|
|
374
|
-
enabled:
|
|
375
|
-
token:
|
|
376
|
-
allowedUsers: ["123456789"]
|
|
149
|
+
enabled: false
|
|
150
|
+
token: env:TELEGRAM_BOT_TOKEN
|
|
151
|
+
allowedUsers: ["123456789"]
|
|
377
152
|
discord:
|
|
378
|
-
enabled: false
|
|
153
|
+
enabled: false
|
|
379
154
|
|
|
380
|
-
# Web UI Dashboard
|
|
381
155
|
ui:
|
|
382
156
|
enabled: true
|
|
383
157
|
port: 3333
|
|
384
158
|
|
|
385
|
-
# Audio Transcription Support
|
|
386
159
|
audio:
|
|
387
160
|
enabled: true
|
|
388
|
-
provider:
|
|
389
|
-
model:
|
|
390
|
-
apiKey: "YOUR_API_KEY" # Optional if using same provider as LLM
|
|
391
|
-
base_url: "" # Required for openrouter/ollama
|
|
161
|
+
provider: google
|
|
162
|
+
model: gemini-2.5-flash-lite
|
|
392
163
|
maxDurationSeconds: 300
|
|
164
|
+
|
|
165
|
+
logging:
|
|
166
|
+
enabled: true
|
|
167
|
+
level: info
|
|
168
|
+
retention: 14d
|
|
393
169
|
```
|
|
394
170
|
|
|
395
|
-
|
|
171
|
+
## Environment Variables
|
|
172
|
+
|
|
173
|
+
Provider-specific keys:
|
|
174
|
+
- `OPENAI_API_KEY`
|
|
175
|
+
- `ANTHROPIC_API_KEY`
|
|
176
|
+
- `GOOGLE_API_KEY`
|
|
177
|
+
- `OPENROUTER_API_KEY`
|
|
178
|
+
- `TELEGRAM_BOT_TOKEN`
|
|
179
|
+
- `THE_ARCHITECT_PASS`
|
|
180
|
+
|
|
181
|
+
Generic Morpheus overrides (selected):
|
|
396
182
|
|
|
397
|
-
|
|
183
|
+
| Variable | Target |
|
|
184
|
+
|---|---|
|
|
185
|
+
| `MORPHEUS_AGENT_NAME` | `agent.name` |
|
|
186
|
+
| `MORPHEUS_AGENT_PERSONALITY` | `agent.personality` |
|
|
187
|
+
| `MORPHEUS_LLM_PROVIDER` | `llm.provider` |
|
|
188
|
+
| `MORPHEUS_LLM_MODEL` | `llm.model` |
|
|
189
|
+
| `MORPHEUS_LLM_TEMPERATURE` | `llm.temperature` |
|
|
190
|
+
| `MORPHEUS_LLM_MAX_TOKENS` | `llm.max_tokens` |
|
|
191
|
+
| `MORPHEUS_LLM_CONTEXT_WINDOW` | `llm.context_window` |
|
|
192
|
+
| `MORPHEUS_LLM_API_KEY` | `llm.api_key` |
|
|
193
|
+
| `MORPHEUS_SATI_PROVIDER` | `sati.provider` |
|
|
194
|
+
| `MORPHEUS_SATI_MODEL` | `sati.model` |
|
|
195
|
+
| `MORPHEUS_SATI_TEMPERATURE` | `sati.temperature` |
|
|
196
|
+
| `MORPHEUS_SATI_MAX_TOKENS` | `sati.max_tokens` |
|
|
197
|
+
| `MORPHEUS_SATI_CONTEXT_WINDOW` | `sati.context_window` |
|
|
198
|
+
| `MORPHEUS_SATI_API_KEY` | `sati.api_key` |
|
|
199
|
+
| `MORPHEUS_SATI_MEMORY_LIMIT` | `sati.memory_limit` |
|
|
200
|
+
| `MORPHEUS_SATI_ENABLED_ARCHIVED_SESSIONS` | `sati.enabled_archived_sessions` |
|
|
201
|
+
| `MORPHEUS_NEO_PROVIDER` | `neo.provider` |
|
|
202
|
+
| `MORPHEUS_NEO_MODEL` | `neo.model` |
|
|
203
|
+
| `MORPHEUS_NEO_TEMPERATURE` | `neo.temperature` |
|
|
204
|
+
| `MORPHEUS_NEO_MAX_TOKENS` | `neo.max_tokens` |
|
|
205
|
+
| `MORPHEUS_NEO_CONTEXT_WINDOW` | `neo.context_window` |
|
|
206
|
+
| `MORPHEUS_NEO_API_KEY` | `neo.api_key` |
|
|
207
|
+
| `MORPHEUS_NEO_BASE_URL` | `neo.base_url` |
|
|
208
|
+
| `MORPHEUS_APOC_PROVIDER` | `apoc.provider` |
|
|
209
|
+
| `MORPHEUS_APOC_MODEL` | `apoc.model` |
|
|
210
|
+
| `MORPHEUS_APOC_TEMPERATURE` | `apoc.temperature` |
|
|
211
|
+
| `MORPHEUS_APOC_MAX_TOKENS` | `apoc.max_tokens` |
|
|
212
|
+
| `MORPHEUS_APOC_CONTEXT_WINDOW` | `apoc.context_window` |
|
|
213
|
+
| `MORPHEUS_APOC_API_KEY` | `apoc.api_key` |
|
|
214
|
+
| `MORPHEUS_APOC_WORKING_DIR` | `apoc.working_dir` |
|
|
215
|
+
| `MORPHEUS_APOC_TIMEOUT_MS` | `apoc.timeout_ms` |
|
|
216
|
+
| `MORPHEUS_AUDIO_PROVIDER` | `audio.provider` |
|
|
217
|
+
| `MORPHEUS_AUDIO_MODEL` | `audio.model` |
|
|
218
|
+
| `MORPHEUS_AUDIO_ENABLED` | `audio.enabled` |
|
|
219
|
+
| `MORPHEUS_AUDIO_API_KEY` | `audio.apiKey` |
|
|
220
|
+
| `MORPHEUS_AUDIO_MAX_DURATION` | `audio.maxDurationSeconds` |
|
|
221
|
+
| `MORPHEUS_TELEGRAM_ENABLED` | `channels.telegram.enabled` |
|
|
222
|
+
| `MORPHEUS_TELEGRAM_TOKEN` | `channels.telegram.token` |
|
|
223
|
+
| `MORPHEUS_TELEGRAM_ALLOWED_USERS` | `channels.telegram.allowedUsers` |
|
|
224
|
+
| `MORPHEUS_UI_ENABLED` | `ui.enabled` |
|
|
225
|
+
| `MORPHEUS_UI_PORT` | `ui.port` |
|
|
226
|
+
| `MORPHEUS_LOGGING_ENABLED` | `logging.enabled` |
|
|
227
|
+
| `MORPHEUS_LOGGING_LEVEL` | `logging.level` |
|
|
228
|
+
| `MORPHEUS_LOGGING_RETENTION` | `logging.retention` |
|
|
229
|
+
|
|
230
|
+
Precedence order:
|
|
231
|
+
1. Provider-specific environment variable
|
|
232
|
+
2. Generic `MORPHEUS_*` variable
|
|
233
|
+
3. `zaion.yaml`
|
|
234
|
+
4. Defaults
|
|
235
|
+
|
|
236
|
+
## MCP Configuration
|
|
237
|
+
|
|
238
|
+
Configure MCP servers in `~/.morpheus/mcps.json`.
|
|
398
239
|
|
|
399
240
|
```json
|
|
400
241
|
{
|
|
401
|
-
"coolify": {
|
|
402
|
-
"transport": "stdio",
|
|
403
|
-
"command": "npx",
|
|
404
|
-
"args": ["-y", "@coolify/mcp-server"],
|
|
405
|
-
"env": {
|
|
406
|
-
"COOLIFY_URL": "https://app.coolify.io",
|
|
407
|
-
"COOLIFY_TOKEN": "your-token"
|
|
408
|
-
}
|
|
409
|
-
},
|
|
410
242
|
"coingecko": {
|
|
411
243
|
"transport": "http",
|
|
412
|
-
"url": "https://mcps.
|
|
244
|
+
"url": "https://mcps.example.com/coingecko/mcp"
|
|
245
|
+
},
|
|
246
|
+
"filesystem": {
|
|
247
|
+
"transport": "stdio",
|
|
248
|
+
"command": "npx",
|
|
249
|
+
"args": ["-y", "@modelcontextprotocol/server-filesystem", "./"]
|
|
413
250
|
}
|
|
414
251
|
}
|
|
415
252
|
```
|
|
416
253
|
|
|
417
|
-
## API
|
|
418
|
-
|
|
419
|
-
Morpheus exposes several API endpoints for programmatic access to its features:
|
|
420
|
-
|
|
421
|
-
### Health Check Endpoints
|
|
422
|
-
|
|
423
|
-
#### GET `/health`
|
|
424
|
-
Public health check endpoint without authentication.
|
|
425
|
-
|
|
426
|
-
* **Response:**
|
|
427
|
-
```json
|
|
428
|
-
{
|
|
429
|
-
"status": "healthy",
|
|
430
|
-
"timestamp": "2026-02-05T21:30:00.000Z",
|
|
431
|
-
"uptime": 123.45
|
|
432
|
-
}
|
|
433
|
-
```
|
|
434
|
-
|
|
435
|
-
#### GET `/api/health`
|
|
436
|
-
Health check endpoint for the API (requires authentication).
|
|
437
|
-
|
|
438
|
-
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
439
|
-
* **Response:**
|
|
440
|
-
```json
|
|
441
|
-
{
|
|
442
|
-
"status": "healthy",
|
|
443
|
-
"timestamp": "2026-02-05T21:30:00.000Z",
|
|
444
|
-
"uptime": 123.45
|
|
445
|
-
}
|
|
446
|
-
```
|
|
447
|
-
|
|
448
|
-
### Status Endpoint
|
|
449
|
-
|
|
450
|
-
#### GET `/api/status`
|
|
451
|
-
Get the current status of the Morpheus agent.
|
|
452
|
-
|
|
453
|
-
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
454
|
-
* **Response:**
|
|
455
|
-
```json
|
|
456
|
-
{
|
|
457
|
-
"status": "online",
|
|
458
|
-
"uptimeSeconds": 1234.56,
|
|
459
|
-
"pid": 12345,
|
|
460
|
-
"projectVersion": "1.0.0",
|
|
461
|
-
"nodeVersion": "v18.17.0",
|
|
462
|
-
"agentName": "Morpheus",
|
|
463
|
-
"llmProvider": "openai",
|
|
464
|
-
"llmModel": "gpt-4-turbo"
|
|
465
|
-
}
|
|
466
|
-
```
|
|
467
|
-
|
|
468
|
-
### Session Endpoints
|
|
469
|
-
|
|
470
|
-
#### POST `/api/session/reset`
|
|
471
|
-
Archive the current session and start a new one.
|
|
472
|
-
|
|
473
|
-
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
474
|
-
* **Response:**
|
|
475
|
-
```json
|
|
476
|
-
{
|
|
477
|
-
"success": true,
|
|
478
|
-
"message": "New session started"
|
|
479
|
-
}
|
|
480
|
-
```
|
|
481
|
-
|
|
482
|
-
#### POST `/api/session/status`
|
|
483
|
-
Get the status of the current session.
|
|
484
|
-
|
|
485
|
-
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
486
|
-
* **Response:**
|
|
487
|
-
```json
|
|
488
|
-
{
|
|
489
|
-
"id": "uuid-...",
|
|
490
|
-
"messageCount": 42,
|
|
491
|
-
"embedding_status": "pending"
|
|
492
|
-
}
|
|
493
|
-
```
|
|
494
|
-
|
|
495
|
-
### Configuration Endpoints
|
|
496
|
-
|
|
497
|
-
#### GET `/api/config`
|
|
498
|
-
Retrieve the current configuration.
|
|
499
|
-
|
|
500
|
-
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
501
|
-
* **Response:**
|
|
502
|
-
```json
|
|
503
|
-
{
|
|
504
|
-
"agent": {
|
|
505
|
-
"name": "Morpheus",
|
|
506
|
-
"personality": "stoic, wise, and helpful"
|
|
507
|
-
},
|
|
508
|
-
"llm": {
|
|
509
|
-
"provider": "openai",
|
|
510
|
-
"model": "gpt-4-turbo",
|
|
511
|
-
"temperature": 0.7,
|
|
512
|
-
"context_window": 100,
|
|
513
|
-
"api_key": "***"
|
|
514
|
-
},
|
|
515
|
-
"santi": {
|
|
516
|
-
"provider": "openai",
|
|
517
|
-
"model": "gpt-4o",
|
|
518
|
-
"memory_limit": 1000
|
|
519
|
-
},
|
|
520
|
-
"channels": {
|
|
521
|
-
"telegram": {
|
|
522
|
-
"enabled": true,
|
|
523
|
-
"token": "***",
|
|
524
|
-
"allowedUsers": ["123456789"]
|
|
525
|
-
},
|
|
526
|
-
"discord": {
|
|
527
|
-
"enabled": false
|
|
528
|
-
}
|
|
529
|
-
},
|
|
530
|
-
"ui": {
|
|
531
|
-
"enabled": true,
|
|
532
|
-
"port": 3333
|
|
533
|
-
},
|
|
534
|
-
"audio": {
|
|
535
|
-
"enabled": true,
|
|
536
|
-
"apiKey": "***",
|
|
537
|
-
"maxDurationSeconds": 300
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
```
|
|
541
|
-
|
|
542
|
-
#### POST `/api/config`
|
|
543
|
-
Update the configuration.
|
|
544
|
-
|
|
545
|
-
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
546
|
-
* **Body:** Complete configuration object (same structure as GET response).
|
|
547
|
-
* **Response:**
|
|
548
|
-
```json
|
|
549
|
-
{
|
|
550
|
-
"agent": {
|
|
551
|
-
"name": "Morpheus",
|
|
552
|
-
"personality": "stoic, wise, and helpful"
|
|
553
|
-
},
|
|
554
|
-
"llm": {
|
|
555
|
-
"provider": "openai",
|
|
556
|
-
"model": "gpt-4-turbo",
|
|
557
|
-
"temperature": 0.7,
|
|
558
|
-
"context_window": 100,
|
|
559
|
-
"api_key": "***"
|
|
560
|
-
},
|
|
561
|
-
"santi": {
|
|
562
|
-
"provider": "openai",
|
|
563
|
-
"model": "gpt-4o",
|
|
564
|
-
"memory_limit": 1000
|
|
565
|
-
},
|
|
566
|
-
"channels": {
|
|
567
|
-
"telegram": {
|
|
568
|
-
"enabled": true,
|
|
569
|
-
"token": "***",
|
|
570
|
-
"allowedUsers": ["123456789"]
|
|
571
|
-
},
|
|
572
|
-
"discord": {
|
|
573
|
-
"enabled": false
|
|
574
|
-
}
|
|
575
|
-
},
|
|
576
|
-
"ui": {
|
|
577
|
-
"enabled": true,
|
|
578
|
-
"port": 3333
|
|
579
|
-
},
|
|
580
|
-
"audio": {
|
|
581
|
-
"enabled": true,
|
|
582
|
-
"apiKey": "***",
|
|
583
|
-
"maxDurationSeconds": 300
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
```
|
|
587
|
-
|
|
588
|
-
#### GET `/api/config/sati`
|
|
589
|
-
Retrieve the Sati (long-term memory) configuration.
|
|
590
|
-
|
|
591
|
-
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
592
|
-
* **Response:**
|
|
593
|
-
```json
|
|
594
|
-
{
|
|
595
|
-
"provider": "openai",
|
|
596
|
-
"model": "gpt-4o",
|
|
597
|
-
"memory_limit": 1000
|
|
598
|
-
}
|
|
599
|
-
```
|
|
600
|
-
|
|
601
|
-
#### POST `/api/config/sati`
|
|
602
|
-
Update the Sati (long-term memory) configuration.
|
|
603
|
-
|
|
604
|
-
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
605
|
-
* **Body:**
|
|
606
|
-
```json
|
|
607
|
-
{
|
|
608
|
-
"provider": "openai",
|
|
609
|
-
"model": "gpt-4o",
|
|
610
|
-
"memory_limit": 1000
|
|
611
|
-
}
|
|
612
|
-
```
|
|
613
|
-
* **Response:**
|
|
614
|
-
```json
|
|
615
|
-
{
|
|
616
|
-
"success": true
|
|
617
|
-
}
|
|
618
|
-
```
|
|
619
|
-
|
|
620
|
-
#### DELETE `/api/config/sati`
|
|
621
|
-
Remove the Sati (long-term memory) configuration (falls back to Oracle config).
|
|
622
|
-
|
|
623
|
-
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
624
|
-
* **Response:**
|
|
625
|
-
```json
|
|
626
|
-
{
|
|
627
|
-
"success": true
|
|
628
|
-
}
|
|
629
|
-
```
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
#### GET `/api/config/apoc`
|
|
633
|
-
Retrieve the Apoc (DevTools subagent) configuration. Falls back to Oracle (LLM) config if not explicitly set.
|
|
634
|
-
|
|
635
|
-
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
636
|
-
* **Response:**
|
|
637
|
-
```json
|
|
638
|
-
{
|
|
639
|
-
"provider": "openai",
|
|
640
|
-
"model": "gpt-4o-mini",
|
|
641
|
-
"temperature": 0.2,
|
|
642
|
-
"api_key": "***",
|
|
643
|
-
"working_dir": "/home/user/projects",
|
|
644
|
-
"timeout_ms": 30000
|
|
645
|
-
}
|
|
646
|
-
```
|
|
647
|
-
|
|
648
|
-
#### POST `/api/config/apoc`
|
|
649
|
-
Update the Apoc (DevTools subagent) configuration.
|
|
650
|
-
|
|
651
|
-
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
652
|
-
* **Body:**
|
|
653
|
-
```json
|
|
654
|
-
{
|
|
655
|
-
"provider": "openai",
|
|
656
|
-
"model": "gpt-4o-mini",
|
|
657
|
-
"temperature": 0.2,
|
|
658
|
-
"working_dir": "/home/user/projects",
|
|
659
|
-
"timeout_ms": 30000
|
|
660
|
-
}
|
|
661
|
-
```
|
|
662
|
-
* **Response:**
|
|
663
|
-
```json
|
|
664
|
-
{
|
|
665
|
-
"success": true
|
|
666
|
-
}
|
|
667
|
-
```
|
|
668
|
-
|
|
669
|
-
#### DELETE `/api/config/apoc`
|
|
670
|
-
Remove the Apoc configuration (falls back to Oracle config).
|
|
671
|
-
|
|
672
|
-
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
673
|
-
* **Response:**
|
|
674
|
-
```json
|
|
675
|
-
{
|
|
676
|
-
"success": true
|
|
677
|
-
}
|
|
678
|
-
```
|
|
679
|
-
|
|
680
|
-
### Statistics Endpoints
|
|
681
|
-
|
|
682
|
-
#### GET `/api/stats/usage`
|
|
683
|
-
Get global token usage statistics.
|
|
684
|
-
|
|
685
|
-
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
686
|
-
* **Response:**
|
|
687
|
-
```json
|
|
688
|
-
{
|
|
689
|
-
"totalInputTokens": 12345,
|
|
690
|
-
"totalOutputTokens": 6789,
|
|
691
|
-
"totalTokens": 19134
|
|
692
|
-
}
|
|
693
|
-
```
|
|
694
|
-
|
|
695
|
-
#### GET `/api/stats/usage/grouped`
|
|
696
|
-
Get token usage statistics grouped by provider and model.
|
|
697
|
-
|
|
698
|
-
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
699
|
-
* **Response:**
|
|
700
|
-
```json
|
|
701
|
-
[
|
|
702
|
-
{
|
|
703
|
-
"provider": "openai",
|
|
704
|
-
"model": "gpt-4-turbo",
|
|
705
|
-
"totalTokens": 12345,
|
|
706
|
-
"inputTokens": 10000,
|
|
707
|
-
"outputTokens": 2345,
|
|
708
|
-
"messageCount": 100
|
|
709
|
-
},
|
|
710
|
-
{
|
|
711
|
-
"provider": "anthropic",
|
|
712
|
-
"model": "claude-3-opus",
|
|
713
|
-
"totalTokens": 6789,
|
|
714
|
-
"inputTokens": 5000,
|
|
715
|
-
"outputTokens": 1789,
|
|
716
|
-
"messageCount": 50
|
|
717
|
-
}
|
|
718
|
-
]
|
|
719
|
-
```
|
|
720
|
-
|
|
721
|
-
### Sati Memories Endpoints
|
|
722
|
-
|
|
723
|
-
#### GET `/api/sati/memories`
|
|
724
|
-
Retrieve all memories stored by the Sati agent (long-term memory).
|
|
725
|
-
|
|
726
|
-
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
727
|
-
* **Response:**
|
|
728
|
-
```json
|
|
729
|
-
[
|
|
730
|
-
{
|
|
731
|
-
"id": "unique-id",
|
|
732
|
-
"category": "work",
|
|
733
|
-
"importance": "high",
|
|
734
|
-
"summary": "Memory summary",
|
|
735
|
-
"details": "Additional details of the memory",
|
|
736
|
-
"hash": "unique-hash",
|
|
737
|
-
"source": "source",
|
|
738
|
-
"created_at": "2023-01-01T00:00:00.000Z",
|
|
739
|
-
"updated_at": "2023-01-01T00:00:00.000Z",
|
|
740
|
-
"last_accessed_at": "2023-01-01T00:00:00.000Z",
|
|
741
|
-
"access_count": 5,
|
|
742
|
-
"version": 1,
|
|
743
|
-
"archived": false
|
|
744
|
-
}
|
|
745
|
-
]
|
|
746
|
-
```
|
|
747
|
-
|
|
748
|
-
#### DELETE `/api/sati/memories/:id`
|
|
749
|
-
Archive (soft delete) a specific memory from the Sati agent.
|
|
750
|
-
|
|
751
|
-
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
752
|
-
* **Parameters:** `id` - ID of the memory to archive.
|
|
753
|
-
* **Response:**
|
|
754
|
-
```json
|
|
755
|
-
{
|
|
756
|
-
"success": true,
|
|
757
|
-
"message": "Memory archived successfully"
|
|
758
|
-
}
|
|
759
|
-
```
|
|
760
|
-
|
|
761
|
-
#### POST `/api/sati/memories/bulk-delete`
|
|
762
|
-
Archive (soft delete) multiple memories from the Sati agent at once.
|
|
763
|
-
|
|
764
|
-
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
765
|
-
* **Body:**
|
|
766
|
-
```json
|
|
767
|
-
{
|
|
768
|
-
"ids": ["id1", "id2", "id3"]
|
|
769
|
-
}
|
|
770
|
-
```
|
|
771
|
-
* **Response:**
|
|
772
|
-
```json
|
|
773
|
-
{
|
|
774
|
-
"success": true,
|
|
775
|
-
"message": "X memories archived successfully",
|
|
776
|
-
"deletedCount": X
|
|
777
|
-
}
|
|
778
|
-
```
|
|
779
|
-
|
|
780
|
-
### MCP Server Endpoints
|
|
781
|
-
|
|
782
|
-
#### GET `/api/mcp/servers`
|
|
783
|
-
List all registered MCP servers.
|
|
784
|
-
|
|
785
|
-
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
786
|
-
* **Response:**
|
|
787
|
-
```json
|
|
788
|
-
{
|
|
789
|
-
"servers": [
|
|
790
|
-
{
|
|
791
|
-
"name": "coolify",
|
|
792
|
-
"config": {
|
|
793
|
-
"transport": "stdio",
|
|
794
|
-
"command": "npx",
|
|
795
|
-
"args": ["-y", "@coolify/mcp-server"],
|
|
796
|
-
"env": {
|
|
797
|
-
"COOLIFY_URL": "https://app.coolify.io",
|
|
798
|
-
"COOLIFY_TOKEN": "your-token"
|
|
799
|
-
}
|
|
800
|
-
},
|
|
801
|
-
"enabled": true
|
|
802
|
-
},
|
|
803
|
-
{
|
|
804
|
-
"name": "coingecko",
|
|
805
|
-
"config": {
|
|
806
|
-
"transport": "http",
|
|
807
|
-
"url": "https://mcps.mnunes.xyz/coingecko/mcp"
|
|
808
|
-
},
|
|
809
|
-
"enabled": false
|
|
810
|
-
}
|
|
811
|
-
]
|
|
812
|
-
}
|
|
813
|
-
```
|
|
814
|
-
|
|
815
|
-
#### POST `/api/mcp/servers`
|
|
816
|
-
Add a new MCP server.
|
|
817
|
-
|
|
818
|
-
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
819
|
-
* **Body:**
|
|
820
|
-
```json
|
|
821
|
-
{
|
|
822
|
-
"name": "new-server",
|
|
823
|
-
"config": {
|
|
824
|
-
"transport": "stdio",
|
|
825
|
-
"command": "npx",
|
|
826
|
-
"args": ["-y", "@new-mcp-server"],
|
|
827
|
-
"env": {
|
|
828
|
-
"NEW_SERVER_URL": "https://example.com",
|
|
829
|
-
"NEW_SERVER_TOKEN": "your-token"
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
```
|
|
834
|
-
* **Response:**
|
|
835
|
-
```json
|
|
836
|
-
{
|
|
837
|
-
"ok": true
|
|
838
|
-
}
|
|
839
|
-
```
|
|
840
|
-
|
|
841
|
-
#### PUT `/api/mcp/servers/:name`
|
|
842
|
-
Update an existing MCP server.
|
|
843
|
-
|
|
844
|
-
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
845
|
-
* **Parameters:** `name` - Name of the server to update.
|
|
846
|
-
* **Body:**
|
|
847
|
-
```json
|
|
848
|
-
{
|
|
849
|
-
"transport": "stdio",
|
|
850
|
-
"command": "npx",
|
|
851
|
-
"args": ["-y", "@updated-mcp-server"],
|
|
852
|
-
"env": {
|
|
853
|
-
"UPDATED_SERVER_URL": "https://example.com",
|
|
854
|
-
"UPDATED_SERVER_TOKEN": "your-updated-token"
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
```
|
|
858
|
-
* **Response:**
|
|
859
|
-
```json
|
|
860
|
-
{
|
|
861
|
-
"ok": true
|
|
862
|
-
}
|
|
863
|
-
```
|
|
864
|
-
|
|
865
|
-
#### DELETE `/api/mcp/servers/:name`
|
|
866
|
-
Delete an MCP server.
|
|
867
|
-
|
|
868
|
-
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
869
|
-
* **Parameters:** `name` - Name of the server to delete.
|
|
870
|
-
* **Response:**
|
|
871
|
-
```json
|
|
872
|
-
{
|
|
873
|
-
"ok": true
|
|
874
|
-
}
|
|
875
|
-
```
|
|
876
|
-
|
|
877
|
-
#### PATCH `/api/mcp/servers/:name/toggle`
|
|
878
|
-
Enable or disable an MCP server.
|
|
879
|
-
|
|
880
|
-
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
881
|
-
* **Parameters:** `name` - Name of the server to toggle.
|
|
882
|
-
* **Body:**
|
|
883
|
-
```json
|
|
884
|
-
{
|
|
885
|
-
"enabled": true
|
|
886
|
-
}
|
|
887
|
-
```
|
|
888
|
-
* **Response:**
|
|
889
|
-
```json
|
|
890
|
-
{
|
|
891
|
-
"ok": true
|
|
892
|
-
}
|
|
893
|
-
```
|
|
894
|
-
|
|
895
|
-
### Logging Endpoints
|
|
896
|
-
|
|
897
|
-
#### GET `/api/logs`
|
|
898
|
-
List all log files.
|
|
899
|
-
|
|
900
|
-
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
901
|
-
* **Response:**
|
|
902
|
-
```json
|
|
903
|
-
[
|
|
904
|
-
{
|
|
905
|
-
"name": "morpheus.log",
|
|
906
|
-
"size": 10240,
|
|
907
|
-
"modified": "2026-02-05T21:30:00.000Z"
|
|
908
|
-
},
|
|
909
|
-
{
|
|
910
|
-
"name": "morpheus-2026-02-04.log",
|
|
911
|
-
"size": 20480,
|
|
912
|
-
"modified": "2026-02-04T21:30:00.000Z"
|
|
913
|
-
}
|
|
914
|
-
]
|
|
915
|
-
```
|
|
916
|
-
|
|
917
|
-
#### GET `/api/logs/:filename`
|
|
918
|
-
Get the last lines of a specific log file.
|
|
919
|
-
|
|
920
|
-
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
921
|
-
* **Parameters:** `filename` - Name of the log file to read.
|
|
922
|
-
* **Query Parameters:** `limit` - Number of lines to return (default: 50).
|
|
923
|
-
* **Response:**
|
|
924
|
-
```json
|
|
925
|
-
{
|
|
926
|
-
"lines": [
|
|
927
|
-
"2026-02-05T21:30:00.000Z INFO: Starting Morpheus agent...",
|
|
928
|
-
"2026-02-05T21:30:01.000Z DEBUG: Connected to OpenAI API",
|
|
929
|
-
"2026-02-05T21:30:02.000Z INFO: Telegram bot initialized"
|
|
930
|
-
]
|
|
931
|
-
}
|
|
932
|
-
```
|
|
933
|
-
|
|
934
|
-
### Control Endpoints
|
|
935
|
-
|
|
936
|
-
#### POST `/api/restart`
|
|
937
|
-
Restart the Morpheus agent.
|
|
938
|
-
|
|
939
|
-
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
940
|
-
* **Response:**
|
|
941
|
-
```json
|
|
942
|
-
{
|
|
943
|
-
"success": true,
|
|
944
|
-
"message": "Restart initiated. Process will shut down and restart shortly."
|
|
945
|
-
}
|
|
946
|
-
```
|
|
947
|
-
|
|
948
|
-
### Webhook Endpoints
|
|
949
|
-
|
|
950
|
-
All management endpoints require `x-architect-pass` authentication. The trigger endpoint is **public** — authenticated only by the per-webhook `x-api-key` header.
|
|
951
|
-
|
|
952
|
-
#### POST `/api/webhooks/trigger/:webhook_name`
|
|
953
|
-
Trigger a webhook and queue an Oracle agent execution in the background.
|
|
954
|
-
|
|
955
|
-
* **Authentication:** `x-api-key: <webhook_api_key>` header (no `x-architect-pass` required).
|
|
956
|
-
* **Parameters:** `webhook_name` — the slug of the webhook to trigger.
|
|
957
|
-
* **Body:** Any JSON payload (forwarded to the agent as context).
|
|
958
|
-
* **Response (202 Accepted):**
|
|
959
|
-
```json
|
|
960
|
-
{
|
|
961
|
-
"accepted": true,
|
|
962
|
-
"notification_id": "uuid-..."
|
|
963
|
-
}
|
|
964
|
-
```
|
|
965
|
-
* **Errors:** `401` for missing/invalid api_key; `404` for webhook not found or disabled.
|
|
966
|
-
|
|
967
|
-
#### GET `/api/webhooks`
|
|
968
|
-
List all configured webhooks.
|
|
969
|
-
|
|
970
|
-
* **Authentication:** `x-architect-pass` header.
|
|
971
|
-
* **Response:**
|
|
972
|
-
```json
|
|
973
|
-
[
|
|
974
|
-
{
|
|
975
|
-
"id": "uuid",
|
|
976
|
-
"name": "deploy-done",
|
|
977
|
-
"api_key": "uuid",
|
|
978
|
-
"prompt": "Analyze the deployment result...",
|
|
979
|
-
"enabled": true,
|
|
980
|
-
"notification_channels": ["ui", "telegram"],
|
|
981
|
-
"created_at": 1700000000000,
|
|
982
|
-
"last_triggered_at": 1700001000000,
|
|
983
|
-
"trigger_count": 42
|
|
984
|
-
}
|
|
985
|
-
]
|
|
986
|
-
```
|
|
987
|
-
|
|
988
|
-
#### POST `/api/webhooks`
|
|
989
|
-
Create a new webhook.
|
|
990
|
-
|
|
991
|
-
* **Authentication:** `x-architect-pass` header.
|
|
992
|
-
* **Body:**
|
|
993
|
-
```json
|
|
994
|
-
{
|
|
995
|
-
"name": "deploy-done",
|
|
996
|
-
"prompt": "A deployment just finished. Analyze the payload and summarize what happened.",
|
|
997
|
-
"notification_channels": ["ui", "telegram"],
|
|
998
|
-
"enabled": true
|
|
999
|
-
}
|
|
1000
|
-
```
|
|
1001
|
-
* **Response (201):** The created webhook object including the generated `api_key`.
|
|
1002
|
-
|
|
1003
|
-
#### PUT `/api/webhooks/:id`
|
|
1004
|
-
Update an existing webhook (prompt, channels, enabled status).
|
|
1005
|
-
|
|
1006
|
-
* **Authentication:** `x-architect-pass` header.
|
|
1007
|
-
* **Note:** The `name` (slug) and `api_key` fields are immutable via this endpoint.
|
|
1008
|
-
|
|
1009
|
-
#### DELETE `/api/webhooks/:id`
|
|
1010
|
-
Delete a webhook and all its associated notifications.
|
|
1011
|
-
|
|
1012
|
-
* **Authentication:** `x-architect-pass` header.
|
|
1013
|
-
|
|
1014
|
-
#### GET `/api/webhooks/notifications`
|
|
1015
|
-
List webhook execution notifications.
|
|
1016
|
-
|
|
1017
|
-
* **Authentication:** `x-architect-pass` header.
|
|
1018
|
-
* **Query Parameters:** `unreadOnly=true` to filter unread notifications.
|
|
1019
|
-
* **Response:**
|
|
1020
|
-
```json
|
|
1021
|
-
[
|
|
1022
|
-
{
|
|
1023
|
-
"id": "uuid",
|
|
1024
|
-
"webhook_id": "uuid",
|
|
1025
|
-
"webhook_name": "deploy-done",
|
|
1026
|
-
"status": "completed",
|
|
1027
|
-
"payload": "{\"ref\":\"main\"}",
|
|
1028
|
-
"result": "Deployment of main to production succeeded...",
|
|
1029
|
-
"read": false,
|
|
1030
|
-
"created_at": 1700001000000,
|
|
1031
|
-
"completed_at": 1700001005000
|
|
1032
|
-
}
|
|
1033
|
-
]
|
|
1034
|
-
```
|
|
1035
|
-
|
|
1036
|
-
#### POST `/api/webhooks/notifications/read`
|
|
1037
|
-
Mark notifications as read.
|
|
1038
|
-
|
|
1039
|
-
* **Authentication:** `x-architect-pass` header.
|
|
1040
|
-
* **Body:** `{ "ids": ["uuid1", "uuid2"] }`
|
|
1041
|
-
|
|
1042
|
-
#### GET `/api/webhooks/notifications/unread-count`
|
|
1043
|
-
Get the count of unread notifications (used by the sidebar badge).
|
|
1044
|
-
|
|
1045
|
-
* **Authentication:** `x-architect-pass` header.
|
|
1046
|
-
* **Response:** `{ "count": 3 }`
|
|
1047
|
-
|
|
1048
|
-
## Testing
|
|
1049
|
-
|
|
1050
|
-
We use **Vitest** for testing.
|
|
1051
|
-
|
|
1052
|
-
```bash
|
|
1053
|
-
# Run unit tests
|
|
1054
|
-
npm test
|
|
1055
|
-
|
|
1056
|
-
# Run tests in watch mode
|
|
1057
|
-
npm run test:watch
|
|
1058
|
-
```
|
|
1059
|
-
|
|
1060
|
-
## Project Structure
|
|
1061
|
-
|
|
1062
|
-
```text
|
|
1063
|
-
.
|
|
1064
|
-
├── assets/ # Static assets
|
|
1065
|
-
├── bin/ # CLI entry point (morpheus.js)
|
|
1066
|
-
├── specs/ # Technical specifications & documentation
|
|
1067
|
-
├── src/
|
|
1068
|
-
│ ├── channels/ # Communication adapters (Telegram, etc.)
|
|
1069
|
-
│ ├── cli/ # CLI commands and logic
|
|
1070
|
-
│ ├── config/ # Configuration management
|
|
1071
|
-
│ ├── runtime/ # Core agent logic, lifecycle, and providers
|
|
1072
|
-
│ ├── apoc.ts # Apoc DevTools subagent (filesystem, shell, git, etc.)
|
|
1073
|
-
│ ├── oracle.ts # Oracle main agent (LangChain ReactAgent)
|
|
1074
|
-
│ └── providers/ # LLM provider factory (createBare for subagents)
|
|
1075
|
-
├── devkit/ # DevKit tool factories (filesystem, shell, git, network, packages, processes, system)
|
|
1076
|
-
│ ├── types/ # Shared TypeScript definitions
|
|
1077
|
-
│ └── ui/ # React Web UI Dashboard
|
|
1078
|
-
└── package.json
|
|
1079
|
-
```
|
|
1080
|
-
|
|
1081
|
-
## Roadmap
|
|
1082
|
-
|
|
1083
|
-
- [x] **Web Dashboard**: Local UI for management and logs.
|
|
1084
|
-
- [x] **MCP Support**: Full integration with Model Context Protocol.
|
|
1085
|
-
- [x] **Webhook System**: External triggers with Oracle execution and multi-channel notifications.
|
|
1086
|
-
- [ ] **Discord Adapter**: Support for Discord interactions.
|
|
1087
|
-
- [ ] **Plugin System**: Extend functionality via external modules.
|
|
1088
|
-
- [ ] **Webhook Retry Logic**: Exponential backoff for failed Oracle executions.
|
|
1089
|
-
|
|
1090
|
-
## 🕵️ Privacy Protection
|
|
254
|
+
## API Highlights
|
|
1091
255
|
|
|
1092
|
-
|
|
1093
|
-
-
|
|
1094
|
-
-
|
|
256
|
+
Public endpoints:
|
|
257
|
+
- `GET /health`
|
|
258
|
+
- `GET /api/health`
|
|
259
|
+
- `POST /api/webhooks/trigger/:webhook_name` (auth via `x-api-key`)
|
|
1095
260
|
|
|
1096
|
-
|
|
261
|
+
Authenticated endpoints (`x-architect-pass`):
|
|
262
|
+
- Sessions: `/api/sessions*`
|
|
263
|
+
- Chat: `POST /api/chat`
|
|
264
|
+
- Tasks: `GET /api/tasks`, `GET /api/tasks/stats`, `GET /api/tasks/:id`, `POST /api/tasks/:id/retry`
|
|
265
|
+
- Config: `/api/config`, `/api/config/sati`, `/api/config/neo`, `/api/config/apoc`
|
|
266
|
+
- MCP: `/api/mcp/*`
|
|
267
|
+
- Sati memories: `/api/sati/memories*`
|
|
268
|
+
- Usage/model pricing/logs/restart
|
|
269
|
+
- Webhook management and webhook notifications
|
|
1097
270
|
|
|
1098
|
-
##
|
|
271
|
+
## API Payload/Response Examples
|
|
1099
272
|
|
|
1100
|
-
|
|
1101
|
-
The Docker image is publicly available at [Docker Hub](https://hub.docker.com/r/marcosnunesmbs/morpheus).
|
|
273
|
+
Auth header for protected endpoints:
|
|
1102
274
|
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
- Docker Engine
|
|
1106
|
-
- Docker Compose
|
|
1107
|
-
|
|
1108
|
-
### Quick Start
|
|
1109
|
-
|
|
1110
|
-
1. Create a `.env` file with your configuration:
|
|
1111
|
-
|
|
1112
|
-
```bash
|
|
1113
|
-
cp .env.example .env
|
|
1114
|
-
# Edit .env with your actual API keys and settings
|
|
275
|
+
```http
|
|
276
|
+
x-architect-pass: <THE_ARCHITECT_PASS>
|
|
1115
277
|
```
|
|
1116
278
|
|
|
1117
|
-
|
|
279
|
+
Example `POST /api/chat` payload:
|
|
1118
280
|
|
|
1119
|
-
```
|
|
1120
|
-
|
|
281
|
+
```json
|
|
282
|
+
{
|
|
283
|
+
"sessionId": "d18e23e6-67db-4ec1-b614-95eeaf399827",
|
|
284
|
+
"message": "faça um ping em 8.8.8.8"
|
|
285
|
+
}
|
|
1121
286
|
```
|
|
1122
287
|
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
### Docker Compose Example
|
|
288
|
+
Example `POST /api/chat` response:
|
|
1126
289
|
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
services:
|
|
1133
|
-
morpheus:
|
|
1134
|
-
image: marcosnunesmbs/morpheus:latest
|
|
1135
|
-
container_name: morpheus-agent
|
|
1136
|
-
ports:
|
|
1137
|
-
- "3333:3333"
|
|
1138
|
-
volumes:
|
|
1139
|
-
- morpheus_data:/root/.morpheus
|
|
1140
|
-
environment:
|
|
1141
|
-
# LLM Configuration
|
|
1142
|
-
- MORPHEUS_LLM_PROVIDER=openai
|
|
1143
|
-
- MORPHEUS_LLM_MODEL=gpt-4o
|
|
1144
|
-
- MORPHEUS_LLM_TEMPERATURE=0.7
|
|
1145
|
-
|
|
1146
|
-
# API Keys
|
|
1147
|
-
- OPENAI_API_KEY=your-openai-api-key
|
|
1148
|
-
- ANTHROPIC_API_KEY=your-anthropic-api-key
|
|
1149
|
-
- GOOGLE_API_KEY=your-google-api-key
|
|
1150
|
-
- OPENROUTER_API_KEY=your-openrouter-api-key
|
|
1151
|
-
|
|
1152
|
-
# Security
|
|
1153
|
-
- THE_ARCHITECT_PASS=your-secure-password
|
|
1154
|
-
|
|
1155
|
-
# Agent Configuration
|
|
1156
|
-
- MORPHEUS_AGENT_NAME=morpheus
|
|
1157
|
-
- MORPHEUS_AGENT_PERSONALITY=helpful_dev
|
|
1158
|
-
|
|
1159
|
-
# UI Configuration
|
|
1160
|
-
- MORPHEUS_UI_ENABLED=true
|
|
1161
|
-
- MORPHEUS_UI_PORT=3333
|
|
1162
|
-
restart: unless-stopped
|
|
290
|
+
```json
|
|
291
|
+
{
|
|
292
|
+
"response": "Task created: 477fddfc-fab8-49e8-ac00-84b110e7f4ba (apoc)."
|
|
293
|
+
}
|
|
1163
294
|
```
|
|
1164
295
|
|
|
1165
|
-
|
|
296
|
+
Example `GET /api/tasks/:id` response:
|
|
1166
297
|
|
|
1167
|
-
```
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
298
|
+
```json
|
|
299
|
+
{
|
|
300
|
+
"id": "477fddfc-fab8-49e8-ac00-84b110e7f4ba",
|
|
301
|
+
"agent": "apoc",
|
|
302
|
+
"status": "completed",
|
|
303
|
+
"input": "Ping 8.8.8.8 and report packet stats",
|
|
304
|
+
"context": "User asked from Telegram",
|
|
305
|
+
"output": "Host reachable. 0% loss.",
|
|
306
|
+
"error": null,
|
|
307
|
+
"origin_channel": "telegram",
|
|
308
|
+
"session_id": "d18e23e6-67db-4ec1-b614-95eeaf399827",
|
|
309
|
+
"origin_message_id": "727",
|
|
310
|
+
"origin_user_id": "5852279085",
|
|
311
|
+
"attempt_count": 1,
|
|
312
|
+
"max_attempts": 3,
|
|
313
|
+
"available_at": 1771558600000,
|
|
314
|
+
"created_at": 1771558600000,
|
|
315
|
+
"started_at": 1771558601050,
|
|
316
|
+
"finished_at": 1771558603030,
|
|
317
|
+
"updated_at": 1771558603030,
|
|
318
|
+
"worker_id": "task-worker-b16cb906",
|
|
319
|
+
"notify_status": "sent",
|
|
320
|
+
"notify_attempts": 0,
|
|
321
|
+
"notify_last_error": null,
|
|
322
|
+
"notified_at": 1771558604210
|
|
323
|
+
}
|
|
1180
324
|
```
|
|
1181
325
|
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
All environment variables described above work in Docker. The precedence order remains the same:
|
|
1185
|
-
1. Container environment variables
|
|
1186
|
-
2. Configuration file values
|
|
1187
|
-
3. Default values
|
|
326
|
+
Example webhook trigger payload (`POST /api/webhooks/trigger/:webhook_name`):
|
|
1188
327
|
|
|
1189
|
-
|
|
328
|
+
```json
|
|
329
|
+
{
|
|
330
|
+
"event": "deploy_finished",
|
|
331
|
+
"environment": "production",
|
|
332
|
+
"status": "success",
|
|
333
|
+
"sha": "b8a6d4f"
|
|
334
|
+
}
|
|
335
|
+
```
|
|
1190
336
|
|
|
1191
|
-
|
|
337
|
+
Example webhook trigger response:
|
|
1192
338
|
|
|
1193
|
-
```
|
|
1194
|
-
|
|
1195
|
-
|
|
339
|
+
```json
|
|
340
|
+
{
|
|
341
|
+
"accepted": true,
|
|
342
|
+
"notification_id": "17ce970d-cde0-4f06-9c9f-5ef92c48aa48"
|
|
343
|
+
}
|
|
1196
344
|
```
|
|
1197
345
|
|
|
1198
|
-
|
|
346
|
+
Complete payload and response examples for **all** endpoints are in `DOCUMENTATION.md` (Section `8. API Reference (Complete Payloads and Response Examples)`).
|
|
1199
347
|
|
|
1200
|
-
|
|
348
|
+
## Development
|
|
1201
349
|
|
|
1202
350
|
```bash
|
|
1203
|
-
|
|
351
|
+
npm install
|
|
352
|
+
npm run build
|
|
353
|
+
npm run dev:cli
|
|
354
|
+
npm run dev:ui
|
|
355
|
+
npm test
|
|
1204
356
|
```
|
|
1205
357
|
|
|
1206
|
-
|
|
1207
|
-
```json
|
|
1208
|
-
{
|
|
1209
|
-
"status": "healthy",
|
|
1210
|
-
"timestamp": "2026-02-05T21:30:00.000Z",
|
|
1211
|
-
"uptime": 123.45
|
|
1212
|
-
}
|
|
1213
|
-
```
|
|
358
|
+
## Project Structure
|
|
1214
359
|
|
|
1215
|
-
|
|
360
|
+
```text
|
|
361
|
+
src/
|
|
362
|
+
channels/ # Telegram adapter
|
|
363
|
+
cli/ # start/stop/restart/status/doctor
|
|
364
|
+
config/ # config loading, precedence, schemas
|
|
365
|
+
devkit/ # Apoc tool factories
|
|
366
|
+
http/ # API, auth, webhooks, server
|
|
367
|
+
runtime/
|
|
368
|
+
apoc.ts
|
|
369
|
+
neo.ts
|
|
370
|
+
oracle.ts
|
|
371
|
+
memory/
|
|
372
|
+
tasks/
|
|
373
|
+
tools/
|
|
374
|
+
webhooks/
|
|
375
|
+
ui/ # React dashboard
|
|
376
|
+
```
|
|
1216
377
|
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
5. Open a Pull Request.
|
|
378
|
+
## Related Docs
|
|
379
|
+
- `ARCHITECTURE.md`
|
|
380
|
+
- `PRODUCT.md`
|
|
381
|
+
- `DOCUMENTATION.md`
|
|
1222
382
|
|
|
1223
383
|
## License
|
|
1224
|
-
|
|
1225
384
|
MIT
|