feat: 心跳修复 + 接口测试代理命令(GET_APIS/HTTP_PROXY)

- ws_client: start() 连接改为独立线程,修复心跳线程被阻塞导致 B 端'暂无心跳数据'
- dispatcher: 新增 GET_APIS(返回主程序接口清单) + HTTP_PROXY(代理调用前置机接口)
- main_app_client: 新增 get_apis/http_proxy,自动按 path 加鉴权(/order→Basic, /api/admin→X-Admin-Token)
- config: 新增 order_basic 配置项
- process_guard: 看门狗支持 nssm restart 拉起服务(优先于 start.cmd)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-09-02 13:50:01 +08:00
co-authored by Claude
parent f07bbbc49d
commit b572697e17
4 changed files with 93 additions and 5 deletions
+12 -5
View File
@@ -36,11 +36,18 @@ class AgentClient:
# ================= 生命周期 =================
def start(self):
"""启动:连接 + 心跳线程(首次心跳立即发送,避免网关空闲超时在首个周期内掐断连接)。"""
self._connect()
t = threading.Thread(target=self._heartbeat_loop, name="heartbeat", daemon=True)
t.start()
self._threads.append(t)
"""启动:连接线程 + 心跳线程
注意:_connect 内部 run_forever 永久阻塞(断线重连也在其中递归),
必须放独立线程,否则心跳线程永远起不来(B 端会显示"暂无心跳数据")。
首次心跳立即发送,避免网关空闲超时在首个周期内掐断连接。
"""
t_heartbeat = threading.Thread(target=self._heartbeat_loop, name="heartbeat", daemon=True)
t_heartbeat.start()
self._threads.append(t_heartbeat)
t_connect = threading.Thread(target=self._connect, name="ws-connect", daemon=True)
t_connect.start()
self._threads.append(t_connect)
def stop(self):
"""停止并释放资源。"""