Hermes Agent commited on
Commit
5faa251
·
1 Parent(s): 55b91e3

fix(hermes): enable Telegram user authorization (allow_all_users: true) so bot responds to chat messages

Browse files
Files changed (2) hide show
  1. HERMES_ARCHITECTURE.md +19 -0
  2. entrypoint.sh +14 -3
HERMES_ARCHITECTURE.md CHANGED
@@ -56,6 +56,25 @@ This document serves as the **locked, definitive reference** for the Hermes Agen
56
  - **Sync Daemon**: Background 15-second rsync daemon in `entrypoint.sh` syncs memories (`MEMORY.md`, `USER.md`), custom skills (`skills/`), and SQLite chat history (`sessions/`) to `/data/hermes/`.
57
  - **Boot Restoration**: Restores persistent data from `/data/hermes/` into `/root/.hermes/` on startup.
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  ---
60
 
61
  ## 🔒 Mandatory Locking Rules for AI Assistants
 
56
  - **Sync Daemon**: Background 15-second rsync daemon in `entrypoint.sh` syncs memories (`MEMORY.md`, `USER.md`), custom skills (`skills/`), and SQLite chat history (`sessions/`) to `/data/hermes/`.
57
  - **Boot Restoration**: Restores persistent data from `/data/hermes/` into `/root/.hermes/` on startup.
58
 
59
+ ### 5. Telegram Bot Authorization & Messaging Setup
60
+ - **Authorization Requirement**: `hermes-agent` requires user authorization flags (`allow_all_users: true` / `allowed_users: ["*"]`) to process and reply to incoming Telegram messages.
61
+ - **Environment Injections in [`entrypoint.sh`](file:///c:/Users/JISHNU%20PG/Music/InstaFlow/Opencode-Cli/entrypoint.sh)**:
62
+ ```env
63
+ TELEGRAM_ENABLED=true
64
+ TELEGRAM_BOT_TOKEN=<token>
65
+ TELEGRAM_ALLOW_ALL_USERS=true
66
+ TELEGRAM_ALLOWED_USERS=*
67
+ ```
68
+ - **Config Injections**:
69
+ ```json
70
+ "telegram": {
71
+ "enabled": true,
72
+ "token": "<token>",
73
+ "allow_all_users": true,
74
+ "allowed_users": ["*"]
75
+ }
76
+ ```
77
+
78
  ---
79
 
80
  ## 🔒 Mandatory Locking Rules for AI Assistants
entrypoint.sh CHANGED
@@ -524,6 +524,10 @@ API_SERVER_KEY=${API_SERVER_KEY}
524
  OPENAI_API_BASE=http://127.0.0.1:20129/v1
525
  OPENAI_API_KEY=omniroute
526
  DEFAULT_MODEL=${HERMES_MODEL:-claude-sonnet-4-6}
 
 
 
 
527
  HERMES_ENV
528
 
529
  # Pre-create Hermes config.json pointing to OmniRoute so no interactive setup is needed
@@ -563,17 +567,24 @@ HERMES_CFG
563
  if [ -n "$TELEGRAM_BOT_TOKEN" ]; then
564
  export HERMES_TELEGRAM_TOKEN="$TELEGRAM_BOT_TOKEN"
565
  export HERMES_TELEGRAM_ENABLED=true
 
 
566
  python3 -c "
567
  import json
568
  try:
569
  cfg = json.load(open('/root/.hermes/config.json'))
570
- cfg['telegram'] = {'enabled': True, 'token': '${TELEGRAM_BOT_TOKEN}'}
 
 
 
 
 
571
  json.dump(cfg, open('/root/.hermes/config.json', 'w'), indent=2)
572
- print('[HERMES] Telegram bot injected into config')
573
  except Exception as e:
574
  print(f'[HERMES] Telegram config inject warning: {e}')
575
  " 2>/dev/null || true
576
- echo "[HERMES] Telegram bot integration enabled"
577
  fi
578
 
579
  # Detect the correct hermes CLI command for the installed version
 
524
  OPENAI_API_BASE=http://127.0.0.1:20129/v1
525
  OPENAI_API_KEY=omniroute
526
  DEFAULT_MODEL=${HERMES_MODEL:-claude-sonnet-4-6}
527
+ TELEGRAM_ENABLED=${TELEGRAM_BOT_TOKEN:+true}
528
+ TELEGRAM_BOT_TOKEN=${TELEGRAM_BOT_TOKEN}
529
+ TELEGRAM_ALLOW_ALL_USERS=true
530
+ TELEGRAM_ALLOWED_USERS=${TELEGRAM_ALLOWED_USERS:-*}
531
  HERMES_ENV
532
 
533
  # Pre-create Hermes config.json pointing to OmniRoute so no interactive setup is needed
 
567
  if [ -n "$TELEGRAM_BOT_TOKEN" ]; then
568
  export HERMES_TELEGRAM_TOKEN="$TELEGRAM_BOT_TOKEN"
569
  export HERMES_TELEGRAM_ENABLED=true
570
+ export TELEGRAM_ALLOW_ALL_USERS=true
571
+ export TELEGRAM_ALLOWED_USERS="${TELEGRAM_ALLOWED_USERS:-*}"
572
  python3 -c "
573
  import json
574
  try:
575
  cfg = json.load(open('/root/.hermes/config.json'))
576
+ cfg['telegram'] = {
577
+ 'enabled': True,
578
+ 'token': '${TELEGRAM_BOT_TOKEN}',
579
+ 'allow_all_users': True,
580
+ 'allowed_users': ['*']
581
+ }
582
  json.dump(cfg, open('/root/.hermes/config.json', 'w'), indent=2)
583
+ print('[HERMES] Telegram bot & user authorization injected into config')
584
  except Exception as e:
585
  print(f'[HERMES] Telegram config inject warning: {e}')
586
  " 2>/dev/null || true
587
+ echo "[HERMES] Telegram bot integration & user authorization enabled"
588
  fi
589
 
590
  # Detect the correct hermes CLI command for the installed version