panrouter 6.3.7 → 6.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/pool-worker.mjs +10 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "panrouter",
3
- "version": "6.3.7",
3
+ "version": "6.3.8",
4
4
  "description": "让 Claude Code 免费使用 DeepSeek 等模型,无需 API Key",
5
5
  "type": "module",
6
6
  "bin": {
package/pool-worker.mjs CHANGED
@@ -17,7 +17,13 @@ import path from "node:path";
17
17
  import fs from "node:fs";
18
18
  import { fileURLToPath } from "node:url";
19
19
  import crypto from "node:crypto";
20
+ import { createRequire } from "node:module";
20
21
  import WebSocket from "ws";
22
+
23
+ const _require = createRequire(import.meta.url);
24
+ const _pkg = _require("./package.json");
25
+ const NODE_VERSION = _pkg.version;
26
+
21
27
  const ROUTER_PORT = 20128;
22
28
 
23
29
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -109,9 +115,10 @@ function connectToHub() {
109
115
 
110
116
  const registerMsg = JSON.stringify({
111
117
  type: "register",
112
- nodeId: assignedId || FINGERPRINT, // 已有分配 ID 就用它
118
+ nodeId: assignedId || FINGERPRINT,
113
119
  fingerprint: FINGERPRINT,
114
120
  deviceType: DEVICE_TYPE,
121
+ version: NODE_VERSION,
115
122
  secret: AUTH_SECRET,
116
123
  });
117
124
  ws.send(registerMsg);
@@ -577,12 +584,13 @@ export async function start() {
577
584
 
578
585
  log("节点看门狗已启动,等待公网入口...", "ON");
579
586
 
580
- // 等 9router 起来后打开守护
587
+ // 等 9router 起来后打开守护 + 通知主控就绪
581
588
  const checkReady = setInterval(async () => {
582
589
  if (_serverReady || (await isPortOpen(SERVER_PORT))) {
583
590
  _serverReady = true;
584
591
  clearInterval(checkReady);
585
592
  startWatchdog();
593
+ safeSend({ type: "ready" });
586
594
  log("9router 已就绪,节点可正常处理请求", "ON");
587
595
  }
588
596
  }, 3000);