sessioncast-cli 2.0.7 → 2.0.8

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.
@@ -105,23 +105,34 @@ class AgentRunner {
105
105
  console.log(`Machine ID: ${this.config.machineId}`);
106
106
  console.log(`Relay: ${this.config.relay}`);
107
107
  console.log(`Token: ${this.config.token ? 'present' : 'none'}`);
108
- // Check tmux availability before starting
108
+ // Check tmux/itmux availability before starting
109
109
  if (!tmux.isAvailable()) {
110
110
  const platform = os.platform();
111
111
  let installHint;
112
- if (platform === 'darwin') {
112
+ if (platform === 'win32') {
113
+ installHint = ' itmux required for Windows\n\n' +
114
+ ' Download: https://github.com/itefixnet/itmux/releases/latest\n' +
115
+ ' Or set ITMUX_HOME environment variable\n\n' +
116
+ ' Quick install (PowerShell):\n' +
117
+ ' Invoke-WebRequest -Uri "https://github.com/itefixnet/itmux/releases/download/v1.1.0/itmux_1.1.0_x64_free.zip" -OutFile "$env:TEMP\\itmux.zip"\n' +
118
+ ' Expand-Archive -Path "$env:TEMP\\itmux.zip" -DestinationPath "C:\\itmux" -Force\n\n' +
119
+ ' Or with Chocolatey:\n' +
120
+ ' choco install itmux';
121
+ }
122
+ else if (platform === 'darwin') {
113
123
  installHint = ' Install: brew install tmux';
114
124
  }
115
125
  else {
116
126
  installHint = ' Install: sudo apt install tmux (Debian/Ubuntu)\n' +
117
127
  ' sudo yum install tmux (RHEL/CentOS)';
118
128
  }
129
+ const binaryName = platform === 'win32' ? 'itmux' : 'tmux';
119
130
  throw new Error('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n' +
120
- ' tmux not found - required for SessionCast Agent\n' +
131
+ ` ${binaryName} not found - required for SessionCast Agent\n` +
121
132
  '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n' +
122
133
  `${installHint}\n\n` +
123
- ' After installing, start a tmux session:\n' +
124
- ' tmux new -s main\n\n' +
134
+ ` After installing, start a ${binaryName} session:\n` +
135
+ ` ${binaryName} new -s main\n\n` +
125
136
  ' Then run the agent:\n' +
126
137
  ' sessioncast agent\n\n' +
127
138
  '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
@@ -436,12 +436,31 @@ class WindowsTmuxExecutor {
436
436
  * Find itmux installation path on Windows.
437
437
  */
438
438
  static findItmuxPath() {
439
- // 1. Check environment variable
439
+ const checkBashPath = (basePath) => {
440
+ return fs.existsSync(path.join(basePath, 'bin', 'bash.exe'));
441
+ };
442
+ // 1. Check environment variable (highest priority)
440
443
  const envPath = process.env.ITMUX_HOME;
441
- if (envPath && fs.existsSync(path.join(envPath, 'bin', 'bash.exe'))) {
444
+ if (envPath && checkBashPath(envPath)) {
442
445
  return envPath;
443
446
  }
444
- // 2. Check common locations
447
+ // 2. Check PATH (covers Chocolatey, manual installs, etc.)
448
+ const pathEnv = process.env.PATH || '';
449
+ const pathSep = pathEnv.includes(';') ? ';' : ':';
450
+ const dirs = pathEnv.split(pathSep);
451
+ for (const dir of dirs) {
452
+ const normalizedDir = dir.toLowerCase();
453
+ if (normalizedDir.includes('itmux') || normalizedDir.includes('cygwin')) {
454
+ let checkPath = dir;
455
+ if (dir.endsWith('\\bin') || dir.endsWith('/bin')) {
456
+ checkPath = path.dirname(dir);
457
+ }
458
+ if (checkBashPath(checkPath)) {
459
+ return checkPath;
460
+ }
461
+ }
462
+ }
463
+ // 3. Check hardcoded paths as fallback
445
464
  const locations = [
446
465
  path.join(os.homedir(), 'itmux'),
447
466
  'C:\\itmux',
@@ -451,7 +470,7 @@ class WindowsTmuxExecutor {
451
470
  path.join(process.env.ProgramFiles || '', 'itmux'),
452
471
  ];
453
472
  for (const loc of locations) {
454
- if (loc && fs.existsSync(path.join(loc, 'bin', 'bash.exe'))) {
473
+ if (loc && checkBashPath(loc)) {
455
474
  return loc;
456
475
  }
457
476
  }
@@ -127,7 +127,12 @@ function isAvailable() {
127
127
  try {
128
128
  return getExecutor().isAvailable();
129
129
  }
130
- catch {
130
+ catch (error) {
131
+ // If it's the itmux not found error, re-throw to preserve Windows context
132
+ // so the user gets the detailed Windows instructions from runner.ts
133
+ if (error instanceof Error && error.message.includes('itmux not found')) {
134
+ throw error;
135
+ }
131
136
  return false;
132
137
  }
133
138
  }
package/dist/index.js CHANGED
@@ -65,20 +65,57 @@ process.on('unhandledRejection', async (reason) => {
65
65
  function checkTmux() {
66
66
  const isWindows = os.platform() === 'win32';
67
67
  if (isWindows) {
68
- // Check for itmux on Windows
68
+ // Helper function to check if bash.exe exists in a path
69
+ function checkBashPath(basePath) {
70
+ try {
71
+ const fs = require('fs');
72
+ const path = require('path');
73
+ return fs.existsSync(path.join(basePath, 'bin', 'bash.exe'));
74
+ }
75
+ catch {
76
+ return false;
77
+ }
78
+ }
79
+ // Check PATH for itmux (covers Chocolatey, manual PATH additions, etc.)
80
+ function checkItmuxInPath() {
81
+ const pathEnv = process.env.PATH || '';
82
+ const pathSep = pathEnv.includes(';') ? ';' : ':';
83
+ const dirs = pathEnv.split(pathSep);
84
+ const path = require('path');
85
+ for (const dir of dirs) {
86
+ const normalizedDir = dir.toLowerCase();
87
+ if (normalizedDir.includes('itmux') || normalizedDir.includes('cygwin')) {
88
+ let checkPath = dir;
89
+ // If we're in the bin folder, go up one level
90
+ if (dir.endsWith('\\bin') || dir.endsWith('/bin')) {
91
+ checkPath = path.dirname(dir);
92
+ }
93
+ if (checkBashPath(checkPath)) {
94
+ return checkPath;
95
+ }
96
+ }
97
+ }
98
+ return null;
99
+ }
100
+ // 1. Check environment variable first (highest priority)
101
+ if (process.env.ITMUX_HOME && checkBashPath(process.env.ITMUX_HOME)) {
102
+ return { available: true, isWindows: true };
103
+ }
104
+ // 2. Check PATH (covers Chocolatey, manual PATH additions, etc.)
105
+ if (checkItmuxInPath()) {
106
+ return { available: true, isWindows: true };
107
+ }
108
+ // 3. Check hardcoded paths as fallback
69
109
  const paths = [
70
- process.env.ITMUX_HOME,
71
110
  `${os.homedir()}/itmux`,
72
111
  'C:\\itmux',
73
112
  `${os.homedir()}\\itmux`,
74
113
  'C:\\Program Files\\itmux',
75
114
  ].filter(Boolean);
76
115
  for (const p of paths) {
77
- try {
78
- require('fs').accessSync(p);
116
+ if (checkBashPath(p)) {
79
117
  return { available: true, isWindows: true };
80
118
  }
81
- catch { }
82
119
  }
83
120
  return { available: false, isWindows: true };
84
121
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sessioncast-cli",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "description": "SessionCast CLI - Control your agents from anywhere",
5
5
  "main": "dist/index.js",
6
6
  "bin": {