@myassis/gateway 1.0.42 → 1.0.43

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.
@@ -56,13 +56,9 @@ function getNssmPath() {
56
56
  }
57
57
  // ─── Windows 实现 ───────────────────────────────────────────
58
58
  async function queryServiceWindows() {
59
- try {
60
- const { stdout } = await execAsync(`sc.exe query ${exports.SERVICE_NAME}`, { timeout: 5000 });
61
- return { installed: true, running: stdout.includes('RUNNING') };
62
- }
63
- catch {
64
- return { installed: false, running: false };
65
- }
59
+ const inRunKey = isRegisteredInRunKey();
60
+ const running = isGatewayRunning();
61
+ return { installed: inRunKey, running };
66
62
  }
67
63
  // ─── 用户级进程管理 ─────────────────────────────────────────
68
64
  /**
@@ -137,18 +133,11 @@ function writeGatewayLauncherScript(exePath, scriptPath, workDir) {
137
133
  "$exe = '" + exePath.replace(/\\/g, '\\\\') + "'",
138
134
  "$workDir = '" + workDir.replace(/\\/g, '\\\\') + "'",
139
135
  "$pidFile = '" + GATEWAY_PID_FILE.replace(/\\/g, '\\\\') + "'",
140
- "$port = 19090",
141
- "$svcPort = 19091",
142
- "",
143
- "# 防止重复启动(检查端口)",
144
- "$listener = [System.Net.Sockets.TcpListener]::Start($port)",
145
- "$listener.Stop()",
146
136
  "",
147
- "# 启动 Gateway 进程(后台、无窗口)",
137
+ "# 启动 Gateway(使用 CLI start 命令,监听默认端口 3001)",
148
138
  "$psi = New-Object System.Diagnostics.ProcessStartInfo",
149
139
  "$psi.FileName = $exe",
150
140
  "$psi.WorkingDirectory = $workDir",
151
- "$psi.Arguments = '--gateway --port ' + $port + ' --service-port ' + $svcPort",
152
141
  "$psi.UseShellExecute = $false",
153
142
  "$psi.RedirectStandardOutput = $true",
154
143
  "$psi.RedirectStandardError = $true",
@@ -299,21 +288,21 @@ async function installLinux() {
299
288
  if (installed)
300
289
  await stopService();
301
290
  const execStart = isPkg ? exe : `${exe} ${script}`;
302
- const unitContent = `[Unit]
303
- Description=${exports.SERVICE_DISPLAY_NAME}
304
- After=network.target
305
-
306
- [Service]
307
- Type=simple
308
- User=${process.env.USER || 'root'}
309
- WorkingDirectory=${workDir}
310
- ExecStart=${execStart}
311
- Restart=always
312
- RestartSec=5
313
- Environment=NODE_ENV=production
314
-
315
- [Install]
316
- WantedBy=multi-user.target
291
+ const unitContent = `[Unit]
292
+ Description=${exports.SERVICE_DISPLAY_NAME}
293
+ After=network.target
294
+
295
+ [Service]
296
+ Type=simple
297
+ User=${process.env.USER || 'root'}
298
+ WorkingDirectory=${workDir}
299
+ ExecStart=${execStart}
300
+ Restart=always
301
+ RestartSec=5
302
+ Environment=NODE_ENV=production
303
+
304
+ [Install]
305
+ WantedBy=multi-user.target
317
306
  `;
318
307
  await fs_1.default.promises.writeFile('/tmp/myassis-gateway.service', unitContent, 'utf8');
319
308
  await execAsync('cp /tmp/myassis-gateway.service /etc/systemd/system/myassis-gateway.service', { timeout: 10000 });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myassis/gateway",
3
- "version": "1.0.42",
3
+ "version": "1.0.43",
4
4
  "description": "我的助手 Gateway Service - 本地 AI 网关服务,支持认证、WebSocket 实时通信和任务调度",
5
5
  "main": "dist/index.js",
6
6
  "bin": {