morpheus-cli 0.2.6 → 0.2.8
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 +428 -2
- package/dist/channels/telegram.js +169 -19
- package/dist/cli/commands/doctor.js +1 -1
- package/dist/cli/commands/session.js +79 -0
- package/dist/cli/commands/start.js +3 -0
- package/dist/cli/index.js +3 -1
- package/dist/http/api.js +25 -0
- package/dist/runtime/memory/backfill-embeddings.js +54 -0
- package/dist/runtime/memory/embedding.service.js +21 -0
- package/dist/runtime/memory/sati/index.js +5 -5
- package/dist/runtime/memory/sati/repository.js +320 -116
- package/dist/runtime/memory/sati/service.js +48 -25
- package/dist/runtime/memory/sati/system-prompts.js +19 -8
- package/dist/runtime/memory/session-embedding-worker.js +99 -0
- package/dist/runtime/memory/sqlite-vec.js +6 -0
- package/dist/runtime/memory/sqlite.js +415 -3
- package/dist/runtime/oracle.js +13 -1
- package/dist/runtime/session-embedding-scheduler.js +21 -0
- package/dist/ui/assets/{index-BrbyUtJ5.js → index-Dx1lwaMu.js} +2 -2
- package/dist/ui/assets/index-QHZ08tDL.css +1 -0
- package/dist/ui/index.html +2 -2
- package/package.json +10 -3
- package/dist/ui/assets/index-BiXkm8Yr.css +0 -1
package/README.md
CHANGED
|
@@ -52,6 +52,10 @@ morpheus restart
|
|
|
52
52
|
|
|
53
53
|
# Diagnose issues
|
|
54
54
|
morpheus doctor
|
|
55
|
+
|
|
56
|
+
# Manage sessions
|
|
57
|
+
morpheus session new # Archive current and start new
|
|
58
|
+
morpheus session status # Check current session info
|
|
55
59
|
```
|
|
56
60
|
|
|
57
61
|
## Troubleshooting
|
|
@@ -209,7 +213,10 @@ The Morpheus Telegram bot supports several commands for interacting with the age
|
|
|
209
213
|
- `/help` - Show available commands
|
|
210
214
|
- `/zaion` - Show system configurations
|
|
211
215
|
- `/sati <qnt>` - Show specific memories
|
|
212
|
-
- `/
|
|
216
|
+
- `/newsession` - Archive current session and start fresh
|
|
217
|
+
- `/sessions` - List all sessions and switch between them
|
|
218
|
+
- `/restart` - Restart the Morpheus agent
|
|
219
|
+
- `/mcp` or `/mcps` - List registered MCP servers
|
|
213
220
|
|
|
214
221
|
## Development Setup
|
|
215
222
|
|
|
@@ -316,6 +323,257 @@ Morpheus supports external tools via **MCP (Model Context Protocol)**. Configure
|
|
|
316
323
|
|
|
317
324
|
Morpheus exposes several API endpoints for programmatic access to its features:
|
|
318
325
|
|
|
326
|
+
### Health Check Endpoints
|
|
327
|
+
|
|
328
|
+
#### GET `/health`
|
|
329
|
+
Public health check endpoint without authentication.
|
|
330
|
+
|
|
331
|
+
* **Response:**
|
|
332
|
+
```json
|
|
333
|
+
{
|
|
334
|
+
"status": "healthy",
|
|
335
|
+
"timestamp": "2026-02-05T21:30:00.000Z",
|
|
336
|
+
"uptime": 123.45
|
|
337
|
+
}
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
#### GET `/api/health`
|
|
341
|
+
Health check endpoint for the API (requires authentication).
|
|
342
|
+
|
|
343
|
+
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
344
|
+
* **Response:**
|
|
345
|
+
```json
|
|
346
|
+
{
|
|
347
|
+
"status": "healthy",
|
|
348
|
+
"timestamp": "2026-02-05T21:30:00.000Z",
|
|
349
|
+
"uptime": 123.45
|
|
350
|
+
}
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
### Status Endpoint
|
|
354
|
+
|
|
355
|
+
#### GET `/api/status`
|
|
356
|
+
Get the current status of the Morpheus agent.
|
|
357
|
+
|
|
358
|
+
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
359
|
+
* **Response:**
|
|
360
|
+
```json
|
|
361
|
+
{
|
|
362
|
+
"status": "online",
|
|
363
|
+
"uptimeSeconds": 1234.56,
|
|
364
|
+
"pid": 12345,
|
|
365
|
+
"projectVersion": "1.0.0",
|
|
366
|
+
"nodeVersion": "v18.17.0",
|
|
367
|
+
"agentName": "Morpheus",
|
|
368
|
+
"llmProvider": "openai",
|
|
369
|
+
"llmModel": "gpt-4-turbo"
|
|
370
|
+
}
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
### Session Endpoints
|
|
374
|
+
|
|
375
|
+
#### POST `/api/session/reset`
|
|
376
|
+
Archive the current session and start a new one.
|
|
377
|
+
|
|
378
|
+
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
379
|
+
* **Response:**
|
|
380
|
+
```json
|
|
381
|
+
{
|
|
382
|
+
"success": true,
|
|
383
|
+
"message": "New session started"
|
|
384
|
+
}
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
#### POST `/api/session/status`
|
|
388
|
+
Get the status of the current session.
|
|
389
|
+
|
|
390
|
+
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
391
|
+
* **Response:**
|
|
392
|
+
```json
|
|
393
|
+
{
|
|
394
|
+
"id": "uuid-...",
|
|
395
|
+
"messageCount": 42,
|
|
396
|
+
"embedding_status": "pending"
|
|
397
|
+
}
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
### Configuration Endpoints
|
|
401
|
+
|
|
402
|
+
#### GET `/api/config`
|
|
403
|
+
Retrieve the current configuration.
|
|
404
|
+
|
|
405
|
+
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
406
|
+
* **Response:**
|
|
407
|
+
```json
|
|
408
|
+
{
|
|
409
|
+
"agent": {
|
|
410
|
+
"name": "Morpheus",
|
|
411
|
+
"personality": "stoic, wise, and helpful"
|
|
412
|
+
},
|
|
413
|
+
"llm": {
|
|
414
|
+
"provider": "openai",
|
|
415
|
+
"model": "gpt-4-turbo",
|
|
416
|
+
"temperature": 0.7,
|
|
417
|
+
"context_window": 100,
|
|
418
|
+
"api_key": "***"
|
|
419
|
+
},
|
|
420
|
+
"santi": {
|
|
421
|
+
"provider": "openai",
|
|
422
|
+
"model": "gpt-4o",
|
|
423
|
+
"memory_limit": 1000
|
|
424
|
+
},
|
|
425
|
+
"channels": {
|
|
426
|
+
"telegram": {
|
|
427
|
+
"enabled": true,
|
|
428
|
+
"token": "***",
|
|
429
|
+
"allowedUsers": ["123456789"]
|
|
430
|
+
},
|
|
431
|
+
"discord": {
|
|
432
|
+
"enabled": false
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
"ui": {
|
|
436
|
+
"enabled": true,
|
|
437
|
+
"port": 3333
|
|
438
|
+
},
|
|
439
|
+
"audio": {
|
|
440
|
+
"enabled": true,
|
|
441
|
+
"apiKey": "***",
|
|
442
|
+
"maxDurationSeconds": 300
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
#### POST `/api/config`
|
|
448
|
+
Update the configuration.
|
|
449
|
+
|
|
450
|
+
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
451
|
+
* **Body:** Complete configuration object (same structure as GET response).
|
|
452
|
+
* **Response:**
|
|
453
|
+
```json
|
|
454
|
+
{
|
|
455
|
+
"agent": {
|
|
456
|
+
"name": "Morpheus",
|
|
457
|
+
"personality": "stoic, wise, and helpful"
|
|
458
|
+
},
|
|
459
|
+
"llm": {
|
|
460
|
+
"provider": "openai",
|
|
461
|
+
"model": "gpt-4-turbo",
|
|
462
|
+
"temperature": 0.7,
|
|
463
|
+
"context_window": 100,
|
|
464
|
+
"api_key": "***"
|
|
465
|
+
},
|
|
466
|
+
"santi": {
|
|
467
|
+
"provider": "openai",
|
|
468
|
+
"model": "gpt-4o",
|
|
469
|
+
"memory_limit": 1000
|
|
470
|
+
},
|
|
471
|
+
"channels": {
|
|
472
|
+
"telegram": {
|
|
473
|
+
"enabled": true,
|
|
474
|
+
"token": "***",
|
|
475
|
+
"allowedUsers": ["123456789"]
|
|
476
|
+
},
|
|
477
|
+
"discord": {
|
|
478
|
+
"enabled": false
|
|
479
|
+
}
|
|
480
|
+
},
|
|
481
|
+
"ui": {
|
|
482
|
+
"enabled": true,
|
|
483
|
+
"port": 3333
|
|
484
|
+
},
|
|
485
|
+
"audio": {
|
|
486
|
+
"enabled": true,
|
|
487
|
+
"apiKey": "***",
|
|
488
|
+
"maxDurationSeconds": 300
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
#### GET `/api/config/sati`
|
|
494
|
+
Retrieve the Sati (long-term memory) configuration.
|
|
495
|
+
|
|
496
|
+
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
497
|
+
* **Response:**
|
|
498
|
+
```json
|
|
499
|
+
{
|
|
500
|
+
"provider": "openai",
|
|
501
|
+
"model": "gpt-4o",
|
|
502
|
+
"memory_limit": 1000
|
|
503
|
+
}
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
#### POST `/api/config/sati`
|
|
507
|
+
Update the Sati (long-term memory) configuration.
|
|
508
|
+
|
|
509
|
+
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
510
|
+
* **Body:**
|
|
511
|
+
```json
|
|
512
|
+
{
|
|
513
|
+
"provider": "openai",
|
|
514
|
+
"model": "gpt-4o",
|
|
515
|
+
"memory_limit": 1000
|
|
516
|
+
}
|
|
517
|
+
```
|
|
518
|
+
* **Response:**
|
|
519
|
+
```json
|
|
520
|
+
{
|
|
521
|
+
"success": true
|
|
522
|
+
}
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
#### DELETE `/api/config/sati`
|
|
526
|
+
Remove the Sati (long-term memory) configuration (falls back to Oracle config).
|
|
527
|
+
|
|
528
|
+
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
529
|
+
* **Response:**
|
|
530
|
+
```json
|
|
531
|
+
{
|
|
532
|
+
"success": true
|
|
533
|
+
}
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
### Statistics Endpoints
|
|
537
|
+
|
|
538
|
+
#### GET `/api/stats/usage`
|
|
539
|
+
Get global token usage statistics.
|
|
540
|
+
|
|
541
|
+
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
542
|
+
* **Response:**
|
|
543
|
+
```json
|
|
544
|
+
{
|
|
545
|
+
"totalInputTokens": 12345,
|
|
546
|
+
"totalOutputTokens": 6789,
|
|
547
|
+
"totalTokens": 19134
|
|
548
|
+
}
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
#### GET `/api/stats/usage/grouped`
|
|
552
|
+
Get token usage statistics grouped by provider and model.
|
|
553
|
+
|
|
554
|
+
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
555
|
+
* **Response:**
|
|
556
|
+
```json
|
|
557
|
+
[
|
|
558
|
+
{
|
|
559
|
+
"provider": "openai",
|
|
560
|
+
"model": "gpt-4-turbo",
|
|
561
|
+
"totalTokens": 12345,
|
|
562
|
+
"inputTokens": 10000,
|
|
563
|
+
"outputTokens": 2345,
|
|
564
|
+
"messageCount": 100
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
"provider": "anthropic",
|
|
568
|
+
"model": "claude-3-opus",
|
|
569
|
+
"totalTokens": 6789,
|
|
570
|
+
"inputTokens": 5000,
|
|
571
|
+
"outputTokens": 1789,
|
|
572
|
+
"messageCount": 50
|
|
573
|
+
}
|
|
574
|
+
]
|
|
575
|
+
```
|
|
576
|
+
|
|
319
577
|
### Sati Memories Endpoints
|
|
320
578
|
|
|
321
579
|
#### GET `/api/sati/memories`
|
|
@@ -375,6 +633,174 @@ Archive (soft delete) multiple memories from the Sati agent at once.
|
|
|
375
633
|
}
|
|
376
634
|
```
|
|
377
635
|
|
|
636
|
+
### MCP Server Endpoints
|
|
637
|
+
|
|
638
|
+
#### GET `/api/mcp/servers`
|
|
639
|
+
List all registered MCP servers.
|
|
640
|
+
|
|
641
|
+
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
642
|
+
* **Response:**
|
|
643
|
+
```json
|
|
644
|
+
{
|
|
645
|
+
"servers": [
|
|
646
|
+
{
|
|
647
|
+
"name": "coolify",
|
|
648
|
+
"config": {
|
|
649
|
+
"transport": "stdio",
|
|
650
|
+
"command": "npx",
|
|
651
|
+
"args": ["-y", "@coolify/mcp-server"],
|
|
652
|
+
"env": {
|
|
653
|
+
"COOLIFY_URL": "https://app.coolify.io",
|
|
654
|
+
"COOLIFY_TOKEN": "your-token"
|
|
655
|
+
}
|
|
656
|
+
},
|
|
657
|
+
"enabled": true
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
"name": "coingecko",
|
|
661
|
+
"config": {
|
|
662
|
+
"transport": "http",
|
|
663
|
+
"url": "https://mcps.mnunes.xyz/coingecko/mcp"
|
|
664
|
+
},
|
|
665
|
+
"enabled": false
|
|
666
|
+
}
|
|
667
|
+
]
|
|
668
|
+
}
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
#### POST `/api/mcp/servers`
|
|
672
|
+
Add a new MCP server.
|
|
673
|
+
|
|
674
|
+
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
675
|
+
* **Body:**
|
|
676
|
+
```json
|
|
677
|
+
{
|
|
678
|
+
"name": "new-server",
|
|
679
|
+
"config": {
|
|
680
|
+
"transport": "stdio",
|
|
681
|
+
"command": "npx",
|
|
682
|
+
"args": ["-y", "@new-mcp-server"],
|
|
683
|
+
"env": {
|
|
684
|
+
"NEW_SERVER_URL": "https://example.com",
|
|
685
|
+
"NEW_SERVER_TOKEN": "your-token"
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
```
|
|
690
|
+
* **Response:**
|
|
691
|
+
```json
|
|
692
|
+
{
|
|
693
|
+
"ok": true
|
|
694
|
+
}
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
#### PUT `/api/mcp/servers/:name`
|
|
698
|
+
Update an existing MCP server.
|
|
699
|
+
|
|
700
|
+
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
701
|
+
* **Parameters:** `name` - Name of the server to update.
|
|
702
|
+
* **Body:**
|
|
703
|
+
```json
|
|
704
|
+
{
|
|
705
|
+
"transport": "stdio",
|
|
706
|
+
"command": "npx",
|
|
707
|
+
"args": ["-y", "@updated-mcp-server"],
|
|
708
|
+
"env": {
|
|
709
|
+
"UPDATED_SERVER_URL": "https://example.com",
|
|
710
|
+
"UPDATED_SERVER_TOKEN": "your-updated-token"
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
```
|
|
714
|
+
* **Response:**
|
|
715
|
+
```json
|
|
716
|
+
{
|
|
717
|
+
"ok": true
|
|
718
|
+
}
|
|
719
|
+
```
|
|
720
|
+
|
|
721
|
+
#### DELETE `/api/mcp/servers/:name`
|
|
722
|
+
Delete an MCP server.
|
|
723
|
+
|
|
724
|
+
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
725
|
+
* **Parameters:** `name` - Name of the server to delete.
|
|
726
|
+
* **Response:**
|
|
727
|
+
```json
|
|
728
|
+
{
|
|
729
|
+
"ok": true
|
|
730
|
+
}
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
#### PATCH `/api/mcp/servers/:name/toggle`
|
|
734
|
+
Enable or disable an MCP server.
|
|
735
|
+
|
|
736
|
+
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
737
|
+
* **Parameters:** `name` - Name of the server to toggle.
|
|
738
|
+
* **Body:**
|
|
739
|
+
```json
|
|
740
|
+
{
|
|
741
|
+
"enabled": true
|
|
742
|
+
}
|
|
743
|
+
```
|
|
744
|
+
* **Response:**
|
|
745
|
+
```json
|
|
746
|
+
{
|
|
747
|
+
"ok": true
|
|
748
|
+
}
|
|
749
|
+
```
|
|
750
|
+
|
|
751
|
+
### Logging Endpoints
|
|
752
|
+
|
|
753
|
+
#### GET `/api/logs`
|
|
754
|
+
List all log files.
|
|
755
|
+
|
|
756
|
+
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
757
|
+
* **Response:**
|
|
758
|
+
```json
|
|
759
|
+
[
|
|
760
|
+
{
|
|
761
|
+
"name": "morpheus.log",
|
|
762
|
+
"size": 10240,
|
|
763
|
+
"modified": "2026-02-05T21:30:00.000Z"
|
|
764
|
+
},
|
|
765
|
+
{
|
|
766
|
+
"name": "morpheus-2026-02-04.log",
|
|
767
|
+
"size": 20480,
|
|
768
|
+
"modified": "2026-02-04T21:30:00.000Z"
|
|
769
|
+
}
|
|
770
|
+
]
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
#### GET `/api/logs/:filename`
|
|
774
|
+
Get the last lines of a specific log file.
|
|
775
|
+
|
|
776
|
+
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
777
|
+
* **Parameters:** `filename` - Name of the log file to read.
|
|
778
|
+
* **Query Parameters:** `limit` - Number of lines to return (default: 50).
|
|
779
|
+
* **Response:**
|
|
780
|
+
```json
|
|
781
|
+
{
|
|
782
|
+
"lines": [
|
|
783
|
+
"2026-02-05T21:30:00.000Z INFO: Starting Morpheus agent...",
|
|
784
|
+
"2026-02-05T21:30:01.000Z DEBUG: Connected to OpenAI API",
|
|
785
|
+
"2026-02-05T21:30:02.000Z INFO: Telegram bot initialized"
|
|
786
|
+
]
|
|
787
|
+
}
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
### Control Endpoints
|
|
791
|
+
|
|
792
|
+
#### POST `/api/restart`
|
|
793
|
+
Restart the Morpheus agent.
|
|
794
|
+
|
|
795
|
+
* **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
|
|
796
|
+
* **Response:**
|
|
797
|
+
```json
|
|
798
|
+
{
|
|
799
|
+
"success": true,
|
|
800
|
+
"message": "Restart initiated. Process will shut down and restart shortly."
|
|
801
|
+
}
|
|
802
|
+
```
|
|
803
|
+
|
|
378
804
|
## Testing
|
|
379
805
|
|
|
380
806
|
We use **Vitest** for testing.
|
|
@@ -455,7 +881,7 @@ version: '3.8'
|
|
|
455
881
|
|
|
456
882
|
services:
|
|
457
883
|
morpheus:
|
|
458
|
-
image:
|
|
884
|
+
image: marcosnunesmbs/morpheus:latest
|
|
459
885
|
container_name: morpheus-agent
|
|
460
886
|
ports:
|
|
461
887
|
- "3333:3333"
|