feat(ws4): Hermes NL 自然語言介面 — 12-Agent Claude SDK 接入(ADR-094/095)
## hermes/ 套件(5 個新模組) ### display_names.py - 12 agent 視覺識別表(emoji + hashtag + handle + short_name) - format_response_header() 產生 Telegram 前綴 ### agent_loader.py - 解析 .claude/agents/*.md frontmatter → system prompt - lru_cache 避免重複讀檔 ### safety_hooks.py - 移植 awoooi-guard.js 20 條 HARD BLOCK 規則(DENY_PATTERNS) - 5 條 MUTATE_PATTERNS → 須走審批流 ### nl_gateway.py - Layer 1: 關鍵字正則路由(12 條規則,<10ms) - Layer 3: DEFAULT_AGENT = "debugger" - Claude Agent SDK query() 非同步串流,取 ResultMessage.result - 安全降級:SDK error → 友好錯誤訊息 ### telegram_webhook.py - WS4 Hermes NL 接入(@tsenyangbot mention 或私訊觸發) - HERMES_NL_ENABLED=False(feature flag 保護,預設關閉) ## telegram_gateway.py - send_hermes_reply(text, chat_id, reply_to_message_id) 無 500 字截斷,支援 Agent 長回覆 ## config.py - HERMES_NL_ENABLED: bool = False - TELEGRAM_BOT_USERNAME: str = "tsenyangbot" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -461,6 +461,16 @@ class Settings(BaseSettings):
|
||||
default="",
|
||||
description="Telegram Webhook Secret Token(setWebhook 設定的同一值)",
|
||||
)
|
||||
# 2026-04-24 Claude Sonnet 4.6 (ADR-095 WS4): Hermes NL 自然語言閘道
|
||||
# false=不啟用(預設),true=啟用 @mention 問答(需 ANTHROPIC_API_KEY)
|
||||
HERMES_NL_ENABLED: bool = Field(
|
||||
default=False,
|
||||
description="Hermes NL 對話功能開關(ADR-095)",
|
||||
)
|
||||
TELEGRAM_BOT_USERNAME: str = Field(
|
||||
default="tsenyangbot",
|
||||
description="Telegram Bot username(不含 @),用於 @mention 識別",
|
||||
)
|
||||
WEBHOOK_NONCE_TTL: int = Field(
|
||||
default=300,
|
||||
description="Nonce TTL in seconds for replay attack prevention",
|
||||
|
||||
Reference in New Issue
Block a user