@geekbeer/minion 2.43.1 → 2.43.3

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/win/minion-cli.ps1 +41 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geekbeer/minion",
3
- "version": "2.43.1",
3
+ "version": "2.43.3",
4
4
  "description": "AI Agent runtime for Minion - manages status and skill deployment on VPS",
5
5
  "main": "linux/server.js",
6
6
  "bin": {
@@ -421,23 +421,45 @@ if (Test-Path `$EnvFile) {
421
421
 
422
422
  New-Item -Path `$LogDir -ItemType Directory -Force | Out-Null
423
423
 
424
+ # Startup log for debugging VNC/websockify/cloudflared launch
425
+ `$StartupLog = Join-Path `$LogDir 'startup.log'
426
+ function Write-StartupLog {
427
+ param([string]`$Message)
428
+ `$ts = Get-Date -Format 'yyyy-MM-dd HH:mm:ss'
429
+ Add-Content -Path `$StartupLog -Value "[`$ts] `$Message"
430
+ }
431
+ Write-StartupLog "=== start-agent.ps1 starting (PID: `$PID) ==="
432
+ Write-StartupLog "DataDir: `$DataDir"
433
+ Write-StartupLog "ServerJs: `$ServerJs"
434
+
424
435
  # Write PID of this watchdog process
425
436
  Set-Content -Path `$PidFile -Value `$PID
426
437
 
427
438
  # Helper: find websockify executable
428
439
  function Get-WebsockifyCommand {
429
440
  if (Get-Command websockify -ErrorAction SilentlyContinue) {
430
- return @((Get-Command websockify).Source)
441
+ `$found = (Get-Command websockify).Source
442
+ Write-StartupLog "websockify found on PATH: `$found"
443
+ return @(`$found)
431
444
  }
445
+ Write-StartupLog "websockify not on PATH, checking Python..."
432
446
  if (Get-Command python -ErrorAction SilentlyContinue) {
447
+ `$pyPath = (Get-Command python).Source
448
+ Write-StartupLog "Python found: `$pyPath"
433
449
  `$scriptsDir = & python -c "import sysconfig; print(sysconfig.get_path('scripts'))" 2>`$null
450
+ Write-StartupLog "Python Scripts dir: `$scriptsDir"
434
451
  if (`$scriptsDir) {
435
452
  `$wsExe = Join-Path `$scriptsDir 'websockify.exe'
453
+ Write-StartupLog "Checking `$wsExe : exists=$(Test-Path `$wsExe)"
436
454
  if (Test-Path `$wsExe) { return @(`$wsExe) }
437
455
  }
438
456
  `$check = & python -c "import websockify" 2>&1
457
+ Write-StartupLog "python -c 'import websockify' exit code: `$LASTEXITCODE"
439
458
  if (`$LASTEXITCODE -eq 0) { return @('python', '-m', 'websockify') }
459
+ } else {
460
+ Write-StartupLog "Python not found"
440
461
  }
462
+ Write-StartupLog "websockify not found by any method"
441
463
  return `$null
442
464
  }
443
465
 
@@ -448,29 +470,43 @@ if (Test-Path 'C:\Program Files\TightVNC\tvnserver.exe') {
448
470
  } elseif (Test-Path (Join-Path `$DataDir 'tightvnc\PFiles\TightVNC\tvnserver.exe')) {
449
471
  `$vncExe = Join-Path `$DataDir 'tightvnc\PFiles\TightVNC\tvnserver.exe'
450
472
  }
473
+ Write-StartupLog "VNC exe: `$vncExe"
451
474
  if (`$vncExe) {
452
475
  # Start VNC server in application mode (no admin, no service registration)
453
476
  `$vncProc = Get-Process -Name tvnserver -ErrorAction SilentlyContinue
454
477
  if (-not `$vncProc) {
478
+ Write-StartupLog "Starting TightVNC server..."
455
479
  Start-Process -FilePath `$vncExe -ArgumentList '-run' -WindowStyle Hidden
456
480
  # Wait for VNC server to bind port 5900 before starting websockify
457
481
  Start-Sleep -Seconds 3
482
+ } else {
483
+ Write-StartupLog "TightVNC already running (PID: `$(`$vncProc.Id))"
458
484
  }
459
485
  # Reload registry config (ensures no-auth settings are applied)
460
486
  & `$vncExe -controlapp -reload 2>`$null
461
- `$wsCmd = Get-WebsockifyCommand
487
+ [array]`$wsCmd = Get-WebsockifyCommand
488
+ Write-StartupLog "websockify command result (count=`$(`$wsCmd.Count)): `$(`$wsCmd -join ' ')"
462
489
  if (`$wsCmd) {
463
490
  `$wsProc = Get-Process -Name websockify -ErrorAction SilentlyContinue
464
491
  if (-not `$wsProc) {
492
+ Write-StartupLog "Starting websockify (count=`$(`$wsCmd.Count))..."
465
493
  if (`$wsCmd.Count -eq 1) {
466
494
  Start-Process -FilePath `$wsCmd[0] -ArgumentList '6080', 'localhost:5900' -WindowStyle Hidden
495
+ Write-StartupLog "websockify started: `$(`$wsCmd[0]) 6080 localhost:5900"
467
496
  } else {
468
497
  # python -m websockify 6080 localhost:5900
469
498
  `$wsArgs = (`$wsCmd[1..(`$wsCmd.Count-1)] + @('6080', 'localhost:5900')) -join ' '
470
499
  Start-Process -FilePath `$wsCmd[0] -ArgumentList `$wsArgs -WindowStyle Hidden
500
+ Write-StartupLog "websockify started: `$(`$wsCmd[0]) `$wsArgs"
471
501
  }
502
+ } else {
503
+ Write-StartupLog "websockify already running (PID: `$(`$wsProc.Id))"
472
504
  }
505
+ } else {
506
+ Write-StartupLog "ERROR: websockify command not found, skipping"
473
507
  }
508
+ } else {
509
+ Write-StartupLog "VNC server not found, skipping VNC+websockify setup"
474
510
  }
475
511
 
476
512
  # Start cloudflared tunnel if configured
@@ -484,9 +520,12 @@ if (Test-Path `$cfConfig) {
484
520
  }
485
521
  if (`$cfExe) {
486
522
  Start-Process -FilePath `$cfExe -ArgumentList 'tunnel', 'run' -WindowStyle Hidden
523
+ Write-StartupLog "cloudflared started: `$cfExe"
487
524
  }
488
525
  }
489
526
 
527
+ Write-StartupLog "=== Startup sequence complete, entering watchdog loop ==="
528
+
490
529
  # Watchdog loop: restart node if it crashes
491
530
  `$nodePath = (Get-Command node).Source
492
531
  while (`$true) {