feat(hwpod): 补齐拓扑与节点接入控制台

This commit is contained in:
root
2026-07-13 04:09:31 +02:00
parent 63a5cfff4a
commit 652f1f9c6b
14 changed files with 1369 additions and 122 deletions
+24 -1
View File
@@ -1,5 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# SPEC: PJ2026-010104 AI网关; PJ2026-010405 云端控制台。
# Implementation reference: draft-2026-07-13-p0-cloud-console.
"""面向 Windows HWPOD 的单文件 HWLAB 图形节点。
用户入口不接受命令行参数,也不依赖 HWLAB_* 环境变量。
@@ -742,7 +744,28 @@ class WebSocketNodeClient:
self.sock = ssl.create_default_context().wrap_socket(raw, server_hostname=host) if parsed.scheme == "wss" else raw
self._handshake(parsed, host, port)
self.bus.emit("log", f"WebSocket 已打开: {ws_url}")
self._send_json({"type": "register", "nodeId": self.executor.node_id, "name": self.executor.node_id, "capabilities": self.executor.capabilities(), "labels": {"platform": sys.platform, "hostname": socket.gethostname(), "version": NODE_VERSION, "startedAt": utc_now(), "allowedWorkspaceRootCount": len(self.executor.allowed_workspace_roots()), "diagnostics": DIAGNOSTICS.summary()}})
self._send_json({
"type": "register",
"nodeId": self.executor.node_id,
"name": self.executor.node_id,
"capabilities": self.executor.capabilities(),
"maxInFlight": 1,
"runtime": {
"kind": "python-tkinter-gui",
"installed": True,
"desktopVisible": True,
"currentVersion": APP_VERSION,
"updateChannel": str(self.config.get("update", {}).get("channel") or "stable"),
},
"labels": {
"platform": sys.platform,
"hostname": socket.gethostname(),
"version": NODE_VERSION,
"startedAt": utc_now(),
"allowedWorkspaceRootCount": len(self.executor.allowed_workspace_roots()),
"diagnostics": DIAGNOSTICS.summary(),
},
})
last_heartbeat = 0.0
last_diagnostic_flush = 0.0
while not self.stop_event.is_set():