helix-assistant-cli 0.2.12 → 0.2.14

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.
@@ -16,10 +16,6 @@ export declare function probePort(port: number, host?: string, timeoutMs?: numbe
16
16
  * 'closed': Connection refused / port closed
17
17
  */
18
18
  export declare function probeWebSocketAuth(port?: number, token?: string, host?: string, timeoutMs?: number): Promise<'ready' | 'unauthorized' | 'closed'>;
19
- /**
20
- * Terminates any rogue or orphaned process occupying the specified port.
21
- */
22
- export declare function killProcessOnPort(port?: number): void;
23
19
  /**
24
20
  * Waits until the agent service has completed startup and successfully accepts WebSocket authentication.
25
21
  */
@@ -11,7 +11,6 @@ exports.findPythonAgentScript = findPythonAgentScript;
11
11
  exports.findPythonExecutable = findPythonExecutable;
12
12
  exports.probePort = probePort;
13
13
  exports.probeWebSocketAuth = probeWebSocketAuth;
14
- exports.killProcessOnPort = killProcessOnPort;
15
14
  exports.waitForAgentReady = waitForAgentReady;
16
15
  exports.spawnAgentDaemon = spawnAgentDaemon;
17
16
  const child_process_1 = require("child_process");
@@ -231,24 +230,6 @@ function probeWebSocketAuth(port = 8765, token, host = '127.0.0.1', timeoutMs =
231
230
  });
232
231
  });
233
232
  }
234
- /**
235
- * Terminates any rogue or orphaned process occupying the specified port.
236
- */
237
- function killProcessOnPort(port = 8765) {
238
- try {
239
- if (process.platform === 'win32') {
240
- (0, child_process_1.execSync)(`powershell -NoProfile -Command "$conn = Get-NetTCPConnection -LocalPort ${port} -State Listen -ErrorAction SilentlyContinue; if ($conn) { Stop-Process -Id $conn.OwningProcess -Force -ErrorAction SilentlyContinue }"`, { stdio: 'ignore', windowsHide: true });
241
- }
242
- else {
243
- (0, child_process_1.execSync)(`fuser -k ${port}/tcp || lsof -ti tcp:${port} | xargs kill -9`, {
244
- stdio: 'ignore',
245
- });
246
- }
247
- }
248
- catch {
249
- // Ignore errors
250
- }
251
- }
252
233
  /**
253
234
  * Waits until the agent service has completed startup and successfully accepts WebSocket authentication.
254
235
  */
@@ -289,10 +270,11 @@ async function spawnAgentDaemon(port = 8765) {
289
270
  if (currentStatus === 'ready') {
290
271
  return { success: true };
291
272
  }
292
- // 2. If port is occupied by an unauthorized process, clean it up
293
273
  if (currentStatus === 'unauthorized') {
294
- killProcessOnPort(port);
295
- await new Promise((resolve) => setTimeout(resolve, 500));
274
+ return {
275
+ success: false,
276
+ error: `El puerto ${port} ya lo usa un agente HELIX que requiere otro token. Cierra esa instancia o inicia el CLI con --token.`,
277
+ };
296
278
  }
297
279
  if (isAgentProcessRunning() || isAgentStarting()) {
298
280
  return { success: true };
@@ -310,7 +292,7 @@ async function spawnAgentDaemon(port = 8765) {
310
292
  try {
311
293
  const child = (0, child_process_1.spawn)(pythonExec, ['main.py', '--ws-port', String(port), '--no-camera'], {
312
294
  cwd: agentDir,
313
- detached: true,
295
+ detached: process.platform !== 'win32',
314
296
  stdio: 'ignore', // run completely in background
315
297
  windowsHide: true,
316
298
  env: {
package/dist/index.js CHANGED
@@ -70,7 +70,7 @@ const program = new commander_1.Command();
70
70
  program
71
71
  .name('helix')
72
72
  .description('HELIX - Interactive Terminal CLI for Windows AI Desktop Agent')
73
- .version('0.2.12')
73
+ .version('0.2.14')
74
74
  .option('-u, --ws-url <url>', 'URL del servidor WebSocket del agente', (0, env_1.getWsUrl)())
75
75
  .option('-t, --token <token>', 'Token de autenticación WebSocket de HELIX', (0, env_1.getWsToken)())
76
76
  .option('--plain', 'Desactivar formato enriquecido de Markdown y mostrar texto plano sin asteriscos')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "helix-assistant-cli",
3
- "version": "0.2.12",
3
+ "version": "0.2.14",
4
4
  "description": "HELIX - Interactive Terminal CLI for Windows AI Desktop Agent",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -1,4 +1,4 @@
1
- import { spawn, ChildProcess, execSync } from 'child_process';
1
+ import { spawn, ChildProcess } from 'child_process';
2
2
  import path from 'path';
3
3
  import fs from 'fs';
4
4
  import crypto from 'crypto';
@@ -240,26 +240,6 @@ export function probeWebSocketAuth(
240
240
  });
241
241
  }
242
242
 
243
- /**
244
- * Terminates any rogue or orphaned process occupying the specified port.
245
- */
246
- export function killProcessOnPort(port: number = 8765): void {
247
- try {
248
- if (process.platform === 'win32') {
249
- execSync(
250
- `powershell -NoProfile -Command "$conn = Get-NetTCPConnection -LocalPort ${port} -State Listen -ErrorAction SilentlyContinue; if ($conn) { Stop-Process -Id $conn.OwningProcess -Force -ErrorAction SilentlyContinue }"`,
251
- { stdio: 'ignore', windowsHide: true }
252
- );
253
- } else {
254
- execSync(`fuser -k ${port}/tcp || lsof -ti tcp:${port} | xargs kill -9`, {
255
- stdio: 'ignore',
256
- });
257
- }
258
- } catch {
259
- // Ignore errors
260
- }
261
- }
262
-
263
243
  /**
264
244
  * Waits until the agent service has completed startup and successfully accepts WebSocket authentication.
265
245
  */
@@ -313,10 +293,11 @@ export async function spawnAgentDaemon(port: number = 8765): Promise<{ success:
313
293
  return { success: true };
314
294
  }
315
295
 
316
- // 2. If port is occupied by an unauthorized process, clean it up
317
296
  if (currentStatus === 'unauthorized') {
318
- killProcessOnPort(port);
319
- await new Promise((resolve) => setTimeout(resolve, 500));
297
+ return {
298
+ success: false,
299
+ error: `El puerto ${port} ya lo usa un agente HELIX que requiere otro token. Cierra esa instancia o inicia el CLI con --token.`,
300
+ };
320
301
  }
321
302
 
322
303
  if (isAgentProcessRunning() || isAgentStarting()) {
@@ -341,7 +322,7 @@ export async function spawnAgentDaemon(port: number = 8765): Promise<{ success:
341
322
  ['main.py', '--ws-port', String(port), '--no-camera'],
342
323
  {
343
324
  cwd: agentDir,
344
- detached: true,
325
+ detached: process.platform !== 'win32',
345
326
  stdio: 'ignore', // run completely in background
346
327
  windowsHide: true,
347
328
  env: {
package/src/index.ts CHANGED
@@ -73,7 +73,7 @@ const program = new Command();
73
73
  program
74
74
  .name('helix')
75
75
  .description('HELIX - Interactive Terminal CLI for Windows AI Desktop Agent')
76
- .version('0.2.12')
76
+ .version('0.2.14')
77
77
  .option('-u, --ws-url <url>', 'URL del servidor WebSocket del agente', getWsUrl())
78
78
  .option('-t, --token <token>', 'Token de autenticación WebSocket de HELIX', getWsToken())
79
79
  .option('--plain', 'Desactivar formato enriquecido de Markdown y mostrar texto plano sin asteriscos')