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:
@@ -4606,6 +4606,32 @@ class TelegramGateway:
|
||||
|
||||
return await self._send_request("sendMessage", payload)
|
||||
|
||||
# =========================================================================
|
||||
# 2026-04-24 Claude Sonnet 4.6 (ADR-095 WS4): Hermes NL 回覆
|
||||
# =========================================================================
|
||||
|
||||
async def send_hermes_reply(
|
||||
self,
|
||||
text: str,
|
||||
chat_id: str | int,
|
||||
reply_to_message_id: int | None = None,
|
||||
) -> dict:
|
||||
"""
|
||||
傳送 Hermes NL 回覆(長文,最多 4096 字元,純文字模式)。
|
||||
|
||||
Args:
|
||||
text: 回覆內容(由 nl_gateway 已截斷至 4000 字以內)
|
||||
chat_id: 目標 chat ID
|
||||
reply_to_message_id: 回覆哪則訊息(可選)
|
||||
"""
|
||||
payload: dict = {
|
||||
"chat_id": chat_id,
|
||||
"text": text[:4096],
|
||||
}
|
||||
if reply_to_message_id:
|
||||
payload["reply_to_message_id"] = reply_to_message_id
|
||||
return await self._send_request("sendMessage", payload)
|
||||
|
||||
# =========================================================================
|
||||
# 2026-04-03 ogt: SRE 戰情室群組三頭政治 (Triumvirate) — ADR-053
|
||||
# @tsenyangbot 發告警卡片到群組,OpenClaw/NemoClaw Bot 各自回覆分析
|
||||
|
||||
Reference in New Issue
Block a user