Termux 手机救援环境 (2026-08-16)
graph LR
PC[Sozo PC · Hermes Agent] <-->|双向 SSH<br/>PC:22 ⇄ 手机:8022<br/>Tailscale 内网| PH[手机 Termux · 救援 Agent]
PH -->|vault_bridge 8788<br/>只读 API| VB[vault_bridge<br/>schtasks 自启]
PH -->|Drive API 直连<br/>gdrive.py| VAULT[(Obsidian Vault<br/>Google Drive)]
VB --> VAULT
PC -->|重启/删锁命令| VB
PC -->|SSH 22 免密<br/>[email protected]| PH
通道
- SSH 免密已授权 (2026-08-16): [email protected], ed25519 (termux-rescue-agent)
- ⚠️ Windows OpenSSH 会话断开会杀子进程树 → 守护进程必须用 WMI Win32_Process.Create 或计划任务启动
Hermes gateway (Sozo PC)
- 路径 D:\hermes, 监听 localhost:8642
- 进程链: hermes.exe → venv python → .hermes-runtime python(杀最深层, 父自动退)
- 重启标准命令: D:\hermes\hermes-agent\venv\Scripts\hermes.exe gateway run
- 删锁白名单: gateway.lock / gateway.pid / gateway_state.json / gateway-locks* / logs.__gateway.lock
- 禁删: auth.lock / cron.tick.lock / venv*.lock
OpenClaw
- 全局安装 2026.7.1-2 (Roaming\npm\node_modules\openclaw) 才能匹配 config;本地 D:\OpenClaw_Home\node_modules 是 2026.5.28 会拒启
- 启动: node —stack-size=4096 <全局>\dist\index.js gateway —port 18789 (OPENCLAW_HOME=D:\OpenClaw_Home)
- 2026-08-16 默认模型 pro→flash 已生效(openclaw.json, 备份 .bak-20260816)
watchdog (AgentWatchdog 计划任务, 每 1 分钟)
- 脚本: D:\OpenClaw_Home\watchdog\agent_watchdog.ps1 (备份 .bak-20260816 / .bak-20260816-heartbeat)
- 2026-08-16 修复: OpenClaw 判定改查 node 命令行 (原按 18789 端口, 被 tailscaled 占用导致误判); Hermes 判定改读 gateway.pid+state, 启动前杀 stale pid
- 2026-08-16 11:44 心跳盲区闭合:
Test-TickHung(cron.tick.lock 600s 阈值、锁缺失不判挂)+ main 挂死分支;tick.lock 每 60s 由 ticker 刷新
- ⚠️ 改对目标:真正在跑的是 agent_watchdog.ps1(AgentWatchdog 任务);hermes_watchdog.py 属于 Disabled 的 HermesWatchdog 任务(v1 改错目标教训)
vault_bridge (8788, 知识库只读 API)
- 进程: python D:\hermes\scripts\vault_bridge.py 8788 (schtasks 开机自启, 独立于 Hermes)
- 卡死特征: 进程在但 HTTP Empty reply (exit 52) → 杀 PID 重启
- API key: D:\hermes\secrets\vault_api_key.txt(只读 /read, 无写端点)
模型预算红线 (2026-08-16)
- 8/16 DeepSeek 涨价 2.4× → 全局禁 pro, 默认 flash(用户明确)
Drive API 直连通道 (2026-08-16 启用)
- 凭据: ~/.hermes/google_token.json + google_client_secret.json (从 PC 复制, web 类型, 全 drive scope)
- 助手: ~/.hermes/scripts/gdrive.py (纯 stdlib, 无 pip 依赖) — get/meta/list/search/update/create
- 原因: google-workspace skill 的 google_api.py 依赖 cryptography, Termux 上 Rust 扩展与 Python 3.13 不兼容
- 用法: python3 ~/.hermes/scripts/gdrive.py get <FILE_ID> / update <FILE_ID> <本地文件> / search “name contains ‘xx’”
- vault 根目录: 1jR76SbioF1u2H-hqca-TejjJ1_d4KDOI; 读文件也可走 vault_bridge 8788
PC → 手机 逆向救援通道(2026-08-16 双向打通 ✅)
- 实测:
ssh -i ~/.ssh/id_ed25519_rescue_phone -p 8022 [email protected] → PONG ✅
- 手机端:Termux openssh,Port 8022,PasswordAuthentication no,sv-enable sshd(runit 常驻),termux-wake-lock
- PC 公钥已入手机 ~/.ssh/authorized_keys(pc-rescue-phone-20260816,ed25519)
- 手机保活:电池优化白名单(Termux 不受限)+ 建议 Termux:Boot 开机自启
- 救援场景:手机 Hermes 卡死/假活 → PC SSH 进 Termux 杀进程重启 gateway