Feature: Add get_audit_log MCP tool
Expose the server main-window audit log (host online/offline, operation results, alerts) as a read-only, no-arg, in-memory MCP tool. The log lives in m_CList_Message, a CListCtrl that is only safe to touch on the UI thread, so add a thread-safe mirror m_MessageLog (guarded by m_cs) and keep it in sync at the four item-mutation sites: ShowMessage, OnShowErrMessage, OnMsglogDelete and OnMsglogClear. The tool reads the mirror directly under m_cs and returns up to MAX_MESSAGE_COUNT (1000) entries, newest first. Co-Authored-By: deepseek-v4-pro
This commit is contained in:
@@ -340,6 +340,15 @@ public:
|
||||
std::vector<int> m_PendingOffline; // 存储端口号
|
||||
CListCtrlEx m_CList_Online;
|
||||
CListCtrl m_CList_Message;
|
||||
// 消息/审计日志的线程安全镜像(供 MCP get_audit_log 工具读取)。m_CList_Message 是
|
||||
// CListCtrl、只能在 UI 线程访问,MCP 线程据此镜像读取。受 m_cs 保护,新在前、旧在后,
|
||||
// 与 CListCtrl 显示顺序一致(索引一一对应,便于删除同步)。
|
||||
struct LogMessage {
|
||||
std::string type; // 类型(操作成功/主机上线/主机下线…)
|
||||
std::string time; // 时间戳 "YYYY-MM-DD HH:MM:SS"
|
||||
std::string msg; // 内容
|
||||
};
|
||||
std::vector<LogMessage> m_MessageLog;
|
||||
CSplitterBar m_SplitterBar;
|
||||
int m_nSplitPos = 160; // 消息区高度(像素),可拖动调整
|
||||
std::vector<context*> m_HostList; // 虚拟列表数据源(全部客户端)
|
||||
|
||||
Reference in New Issue
Block a user