sequenceDiagram
    participant U as 管理员
    participant FE as frontend-admin
    participant API as /api/admin/configs/{key}
    participant SVC as admin_service
    participant DB as PostgreSQL

    U->>FE: 切换应急模式开关
    FE->>API: PUT /api/admin/configs/emergency_mode
    API->>API: require_admin 校验权限
    API->>SVC: update_config(key, value, agent_id)
    SVC->>DB: SELECT SystemConfig WHERE key=emergency_mode
    DB-->>SVC: 当前值 "false"
    SVC->>DB: INSERT ConfigChangeLog(old="false", new="true", by=agent_id)
    SVC->>DB: UPDATE SystemConfig SET value="true"
    DB-->>SVC: 更新成功
    SVC-->>API: {key, old_value, new_value, changed_at}
    API-->>FE: 返回变更结果
    FE->>FE: 显示变更成功提示
