myaiforone 1.1.40 → 1.1.41

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.
package/bin/cli.js CHANGED
@@ -509,15 +509,25 @@ function startAndOpen() {
509
509
  console.log(' ✅ Menu bar indicator installed (xbar)');
510
510
  }
511
511
  } else if (IS_WIN) {
512
- // Launch PowerShell tray app hidden
512
+ // Copy tray script to a stable data-dir location so it survives npx cache
513
+ // updates, then register it in the Windows registry auto-start so it
514
+ // comes back after every reboot.
513
515
  const trayScript = join(PROJECT_ROOT, 'scripts', 'tray-indicator.ps1');
514
516
  if (existsSync(trayScript)) {
515
- const tray = spawn('powershell', ['-WindowStyle', 'Hidden', '-ExecutionPolicy', 'Bypass', '-File', trayScript], {
517
+ mkdirSync(DATA_DIR, { recursive: true });
518
+ const stableTray = join(DATA_DIR, 'tray-indicator.ps1');
519
+ try { copyFileSync(trayScript, stableTray); } catch { /* non-critical */ }
520
+ const launchPath = existsSync(stableTray) ? stableTray : trayScript;
521
+ const launchPathEsc = launchPath.replace(/\\/g, '\\\\');
522
+ // Register in auto-start so it persists across reboots
523
+ run(`powershell -Command "Set-ItemProperty -Path 'HKCU:\\\\Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Run' -Name 'MyAIforOneTray' -Value 'powershell -WindowStyle Hidden -ExecutionPolicy Bypass -File \\"${launchPathEsc}\\"'"`, { silent: true });
524
+ // Launch now
525
+ const tray = spawn('powershell', ['-WindowStyle', 'Hidden', '-ExecutionPolicy', 'Bypass', '-File', launchPath], {
516
526
  detached: true,
517
527
  stdio: 'ignore',
518
528
  });
519
529
  tray.unref();
520
- console.log(' ✅ System tray indicator launched');
530
+ console.log(' ✅ System tray indicator launched (auto-starts on login)');
521
531
  }
522
532
  }
523
533
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myaiforone",
3
- "version": "1.1.40",
3
+ "version": "1.1.41",
4
4
  "type": "module",
5
5
  "description": "Routes messages from phone channels to project-specific Claude Code agents",
6
6
  "bin": {
@@ -42,31 +42,17 @@ function Get-ServiceRunning {
42
42
  }
43
43
 
44
44
  function Start-ServiceProcess {
45
- # Try scheduled task first
45
+ # Try scheduled task first (for users who ran install-service-windows.ps1)
46
46
  schtasks /Run /TN $taskName 2>$null | Out-Null
47
47
  if ($LASTEXITCODE -eq 0) { return }
48
48
 
49
- # Fallback: direct spawn via node
49
+ # Fallback: launch via npx — always fetches the right version regardless of
50
+ # cache location (works for all npx-based installs and after updates)
50
51
  $dataDir = Join-Path $env:APPDATA "MyAIforOneGateway"
51
-
52
- # Check for dev install (project dist/index.js)
53
- $scriptDir = Split-Path -Parent $PSCommandPath
54
- $projectIndex = Join-Path (Split-Path -Parent $scriptDir) "dist\index.js"
55
- if (Test-Path $projectIndex) {
56
- $env:MYAGENT_DATA_DIR = $dataDir
57
- Start-Process -FilePath "node" -ArgumentList "`"$projectIndex`"" -WorkingDirectory (Split-Path -Parent $scriptDir) -WindowStyle Hidden
58
- return
59
- }
60
-
61
- # Check for npx install
62
- $npxCache = Get-ChildItem "$env:LOCALAPPDATA\npm-cache\_npx" -Directory -ErrorAction SilentlyContinue |
63
- Where-Object { Test-Path (Join-Path $_.FullName "node_modules\myaiforone\dist\index.js") } |
64
- Select-Object -First 1
65
- if ($npxCache) {
66
- $indexJs = Join-Path $npxCache.FullName "node_modules\myaiforone\dist\index.js"
67
- $env:MYAGENT_DATA_DIR = $dataDir
68
- Start-Process -FilePath "node" -ArgumentList "`"$indexJs`"" -WindowStyle Hidden
69
- }
52
+ $env:MYAGENT_DATA_DIR = $dataDir
53
+ Start-Process -FilePath "powershell" `
54
+ -ArgumentList "-WindowStyle Hidden -ExecutionPolicy Bypass -Command `"npx myaiforone@latest`"" `
55
+ -WindowStyle Hidden
70
56
  }
71
57
 
72
58
  function Stop-ServiceProcess {