@geekbeer/minion 2.43.0 → 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 +57 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geekbeer/minion",
3
- "version": "2.43.0",
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,9 +421,48 @@ 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
 
438
+ # Helper: find websockify executable
439
+ function Get-WebsockifyCommand {
440
+ if (Get-Command websockify -ErrorAction SilentlyContinue) {
441
+ `$found = (Get-Command websockify).Source
442
+ Write-StartupLog "websockify found on PATH: `$found"
443
+ return @(`$found)
444
+ }
445
+ Write-StartupLog "websockify not on PATH, checking Python..."
446
+ if (Get-Command python -ErrorAction SilentlyContinue) {
447
+ `$pyPath = (Get-Command python).Source
448
+ Write-StartupLog "Python found: `$pyPath"
449
+ `$scriptsDir = & python -c "import sysconfig; print(sysconfig.get_path('scripts'))" 2>`$null
450
+ Write-StartupLog "Python Scripts dir: `$scriptsDir"
451
+ if (`$scriptsDir) {
452
+ `$wsExe = Join-Path `$scriptsDir 'websockify.exe'
453
+ Write-StartupLog "Checking `$wsExe : exists=$(Test-Path `$wsExe)"
454
+ if (Test-Path `$wsExe) { return @(`$wsExe) }
455
+ }
456
+ `$check = & python -c "import websockify" 2>&1
457
+ Write-StartupLog "python -c 'import websockify' exit code: `$LASTEXITCODE"
458
+ if (`$LASTEXITCODE -eq 0) { return @('python', '-m', 'websockify') }
459
+ } else {
460
+ Write-StartupLog "Python not found"
461
+ }
462
+ Write-StartupLog "websockify not found by any method"
463
+ return `$null
464
+ }
465
+
427
466
  # Start TightVNC + websockify if available
428
467
  `$vncExe = `$null
429
468
  if (Test-Path 'C:\Program Files\TightVNC\tvnserver.exe') {
@@ -431,29 +470,43 @@ if (Test-Path 'C:\Program Files\TightVNC\tvnserver.exe') {
431
470
  } elseif (Test-Path (Join-Path `$DataDir 'tightvnc\PFiles\TightVNC\tvnserver.exe')) {
432
471
  `$vncExe = Join-Path `$DataDir 'tightvnc\PFiles\TightVNC\tvnserver.exe'
433
472
  }
473
+ Write-StartupLog "VNC exe: `$vncExe"
434
474
  if (`$vncExe) {
435
475
  # Start VNC server in application mode (no admin, no service registration)
436
476
  `$vncProc = Get-Process -Name tvnserver -ErrorAction SilentlyContinue
437
477
  if (-not `$vncProc) {
478
+ Write-StartupLog "Starting TightVNC server..."
438
479
  Start-Process -FilePath `$vncExe -ArgumentList '-run' -WindowStyle Hidden
439
480
  # Wait for VNC server to bind port 5900 before starting websockify
440
481
  Start-Sleep -Seconds 3
482
+ } else {
483
+ Write-StartupLog "TightVNC already running (PID: `$(`$vncProc.Id))"
441
484
  }
442
485
  # Reload registry config (ensures no-auth settings are applied)
443
486
  & `$vncExe -controlapp -reload 2>`$null
444
- `$wsCmd = Get-WebsockifyCommand
487
+ [array]`$wsCmd = Get-WebsockifyCommand
488
+ Write-StartupLog "websockify command result (count=`$(`$wsCmd.Count)): `$(`$wsCmd -join ' ')"
445
489
  if (`$wsCmd) {
446
490
  `$wsProc = Get-Process -Name websockify -ErrorAction SilentlyContinue
447
491
  if (-not `$wsProc) {
492
+ Write-StartupLog "Starting websockify (count=`$(`$wsCmd.Count))..."
448
493
  if (`$wsCmd.Count -eq 1) {
449
494
  Start-Process -FilePath `$wsCmd[0] -ArgumentList '6080', 'localhost:5900' -WindowStyle Hidden
495
+ Write-StartupLog "websockify started: `$(`$wsCmd[0]) 6080 localhost:5900"
450
496
  } else {
451
497
  # python -m websockify 6080 localhost:5900
452
498
  `$wsArgs = (`$wsCmd[1..(`$wsCmd.Count-1)] + @('6080', 'localhost:5900')) -join ' '
453
499
  Start-Process -FilePath `$wsCmd[0] -ArgumentList `$wsArgs -WindowStyle Hidden
500
+ Write-StartupLog "websockify started: `$(`$wsCmd[0]) `$wsArgs"
454
501
  }
502
+ } else {
503
+ Write-StartupLog "websockify already running (PID: `$(`$wsProc.Id))"
455
504
  }
505
+ } else {
506
+ Write-StartupLog "ERROR: websockify command not found, skipping"
456
507
  }
508
+ } else {
509
+ Write-StartupLog "VNC server not found, skipping VNC+websockify setup"
457
510
  }
458
511
 
459
512
  # Start cloudflared tunnel if configured
@@ -467,9 +520,12 @@ if (Test-Path `$cfConfig) {
467
520
  }
468
521
  if (`$cfExe) {
469
522
  Start-Process -FilePath `$cfExe -ArgumentList 'tunnel', 'run' -WindowStyle Hidden
523
+ Write-StartupLog "cloudflared started: `$cfExe"
470
524
  }
471
525
  }
472
526
 
527
+ Write-StartupLog "=== Startup sequence complete, entering watchdog loop ==="
528
+
473
529
  # Watchdog loop: restart node if it crashes
474
530
  `$nodePath = (Get-Command node).Source
475
531
  while (`$true) {