# 审计 — 快捷命令回车修复 + 离线告警 Telegram 分流

**Changelog**:
- `docs/changelog/2026-06-13-terminal-quick-cmd-enter-fix.md`
- `docs/changelog/2026-06-13-offline-alert-telegram-split.md`

**设计/计划**:
- `docs/design/specs/2026-06-13-offline-alert-telegram-split-design.md`
- `docs/design/plans/2026-06-13-offline-alert-telegram-split.md`

## 审计范围

| 文件 | 变更 | 状态 |
|------|------|------|
| `frontend/src/composables/useTerminalQuickCommands.ts` | `formatQuickCmdForSend` | ☑ |
| `frontend/src/composables/terminal/useTerminalSessions.ts` | `execQuickCmd` | ☑ |
| `frontend/src/components/TerminalQuickCommandsSettings.vue` | 保存不再 append `\r` | ☑ |
| `frontend/src/pages/SettingsPage.vue` | 离线专用 Bot UI | ☑ |
| `frontend/src/types/api.ts` | 离线开关文案 | ☑ |
| `frontend/src/utils/auditLabels.ts` | reveal 审计标签 | ☑ |
| `server/infrastructure/telegram/__init__.py` | 离线路由 | ☑ |
| `server/api/settings.py` | offline API + `_telegram_fetch_chats` | ☑ |
| `server/config.py` | `TELEGRAM_OFFLINE_*` | ☑ |
| `tests/test_telegram_offline_channel.py` | 新 | ☑ |
| `tests/test_terminal_quick_commands.py` | 新 | ☑ |

## Step 3 规则扫描

| H | 规则 | 结论 |
|---|------|------|
| H1 | 离线 Token 敏感掩码 | SAFE — `SENSITIVE_KEYS` |
| H2 | reveal 审计 | SAFE — `reveal_offline_telegram_token` |
| H3 | 半配离线回退默认 Bot | SAFE — `resolve_offline_telegram_credentials` |
| H4 | 资源告警不走离线 Bot | SAFE — `send_telegram_alert` 未改 |
| H5 | 快捷命令 `\r` 与 `trim()` | SAFE — 发送时 `formatQuickCmdForSend` |
| H6 | Layer3 不同步离线 Bot | SAFE — 设计 intentional |

## Closure

| H | 判定 | 依据 |
|---|------|------|
| H1–H6 | SAFE | 代码 + pytest 10/10 + `test_ops_patrol_sync` 未破坏 |

## DoD

- [x] `pytest tests/test_telegram_offline_channel.py tests/test_terminal_quick_commands.py` passed
- [x] `bash scripts/local_verify.sh` 26/26
- [x] changelog / design / audit
- [x] 无 SECRET_KEY/API_KEY/ENCRYPTION_KEY/DATABASE_URL 变更
- [x] 前端 `vite build` 待部署脚本执行
