@myassis/gateway 1.0.66 → 1.0.68

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.
@@ -152,6 +152,11 @@ router.post('/update', async (_req, res) => {
152
152
  // 尝试自动更新(有 nssm 时会成功)
153
153
  const result = await (0, ServiceManager_js_1.updateService)();
154
154
  if (result.success) {
155
+ // 广播重启通知给所有已连接的客户端,让 Desktop 做好重连准备
156
+ WebSocketService_js_1.webSocketService.broadcast({
157
+ type: 'gateway_restarting',
158
+ payload: { message: 'Gateway 正在更新,即将重启...' },
159
+ });
155
160
  res.json(result);
156
161
  return;
157
162
  }
@@ -94,7 +94,9 @@ function getStoredPid() {
94
94
  try {
95
95
  if (!fs_1.default.existsSync(GATEWAY_PID_FILE))
96
96
  return null;
97
- const pid = parseInt(fs_1.default.readFileSync(GATEWAY_PID_FILE, 'utf8').trim(), 10);
97
+ // 去除 PowerShell Out-File -Encoding UTF8 写入的 BOM(\uFEFF),否则 parseInt 会得到 NaN
98
+ const raw = fs_1.default.readFileSync(GATEWAY_PID_FILE, 'utf8').replace(/^\uFEFF/, '').trim();
99
+ const pid = parseInt(raw, 10);
98
100
  return isNaN(pid) ? null : pid;
99
101
  }
100
102
  catch {
@@ -149,7 +151,7 @@ async function stopGatewayProcess() {
149
151
  // 同时杀掉守护进程(防止它重新拉起 gateway)
150
152
  if (process.platform === 'win32') {
151
153
  try {
152
- const daemonPidStr = fs_1.default.readFileSync(GATEWAY_DAEMON_PID_FILE, 'utf8').trim();
154
+ const daemonPidStr = fs_1.default.readFileSync(GATEWAY_DAEMON_PID_FILE, 'utf8').replace(/^\uFEFF/, '').trim();
153
155
  const daemonPid = parseInt(daemonPidStr, 10);
154
156
  if (daemonPid && !isNaN(daemonPid)) {
155
157
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myassis/gateway",
3
- "version": "1.0.66",
3
+ "version": "1.0.68",
4
4
  "description": "我的助手 Gateway Service - 本地 AI 网关服务,支持认证、WebSocket 实时通信和任务调度",
5
5
  "main": "dist/index.js",
6
6
  "bin": {