@pixelbyte-software/pixcode 1.49.2 → 1.49.4

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/dist/index.html CHANGED
@@ -35,11 +35,11 @@
35
35
 
36
36
  <!-- Prevent zoom on iOS -->
37
37
  <meta name="format-detection" content="telephone=no" />
38
- <script type="module" crossorigin src="/assets/index-BsQAPOnf.js"></script>
38
+ <script type="module" crossorigin src="/assets/index-u5D2ObPr.js"></script>
39
39
  <link rel="modulepreload" crossorigin href="/assets/vendor-react-DB6V5Fl1.js">
40
40
  <link rel="modulepreload" crossorigin href="/assets/vendor-codemirror-CIYNS698.js">
41
41
  <link rel="modulepreload" crossorigin href="/assets/vendor-xterm-C7tpxJl7.js">
42
- <link rel="stylesheet" crossorigin href="/assets/index-B8TbMftk.css">
42
+ <link rel="stylesheet" crossorigin href="/assets/index-ntmmehps.css">
43
43
  </head>
44
44
  <body>
45
45
  <div id="root"></div>
@@ -77,6 +77,7 @@ import { restoreBotFromConfig } from './services/telegram/bot.js';
77
77
  import { ensurePortOpen } from './utils/port-access.js';
78
78
  import { applyAllStoredCredentialsToEnv, } from './services/provider-credentials.js';
79
79
  import { primeCliBinPath } from './services/install-jobs.js';
80
+ import { buildHermesPathEnv, primeHermesPath } from './services/hermes-install-jobs.js';
80
81
  import { startEnabledPluginServers, stopAllPlugins, getPluginPort } from './utils/plugin-process-manager.js';
81
82
  import { initializeDatabase, sessionNamesDb, applyCustomSessionNames, apiKeysDb } from './database/db.js';
82
83
  import { setNotificationWebSocketServer } from './services/notification-orchestrator.js';
@@ -356,16 +357,32 @@ function buildHermesShellCommand(kind, env) {
356
357
  `$env:PIXCODE_APP_ROOT=${quote(env.PIXCODE_APP_ROOT)}`,
357
358
  ].join('; ');
358
359
  const resolveHermesCommand = [
360
+ 'function Test-HermesCommand($candidate) {',
361
+ 'if (-not $candidate) { return $false; }',
362
+ 'try {',
363
+ '& $candidate --version *> $null;',
364
+ 'return $LASTEXITCODE -eq 0;',
365
+ '} catch { return $false; }',
366
+ '}',
359
367
  'function Resolve-HermesCommand {',
360
- '$cmd = Get-Command hermes -ErrorAction SilentlyContinue;',
361
- 'if ($cmd) { return $cmd.Source; }',
362
368
  '$candidates = @(',
363
369
  '$env:HERMES_CLI_PATH,',
370
+ '(Join-Path $env:LOCALAPPDATA "hermes\\bin\\hermes.cmd"),',
371
+ '(Join-Path $env:LOCALAPPDATA "hermes\\bin\\hermes.bat"),',
372
+ '(Join-Path $env:LOCALAPPDATA "hermes\\bin\\hermes.exe"),',
373
+ '(Join-Path $env:LOCALAPPDATA "hermes\\hermes-agent\\venv\\Scripts\\hermes.cmd"),',
374
+ '(Join-Path $env:LOCALAPPDATA "hermes\\hermes-agent\\venv\\Scripts\\hermes.bat"),',
364
375
  '(Join-Path $env:LOCALAPPDATA "hermes\\hermes-agent\\venv\\Scripts\\hermes.exe"),',
376
+ '(Join-Path $env:LOCALAPPDATA "hermes\\hermes-agent\\.venv\\Scripts\\hermes.cmd"),',
377
+ '(Join-Path $env:LOCALAPPDATA "hermes\\hermes-agent\\.venv\\Scripts\\hermes.bat"),',
365
378
  '(Join-Path $env:LOCALAPPDATA "hermes\\hermes-agent\\.venv\\Scripts\\hermes.exe"),',
379
+ '(Join-Path $env:LOCALAPPDATA "hermes\\hermes-agent\\hermes.cmd"),',
380
+ '(Join-Path $env:LOCALAPPDATA "hermes\\hermes-agent\\hermes.bat"),',
366
381
  '(Join-Path $env:LOCALAPPDATA "hermes\\hermes-agent\\hermes.exe")',
367
382
  ');',
368
- 'foreach ($candidate in $candidates) { if ($candidate -and (Test-Path $candidate)) { return $candidate; } }',
383
+ 'foreach ($candidate in $candidates) { if ($candidate -and (Test-Path $candidate) -and (Test-HermesCommand $candidate)) { return $candidate; } }',
384
+ '$cmd = Get-Command hermes -ErrorAction SilentlyContinue;',
385
+ 'if ($cmd -and (Test-HermesCommand $cmd.Source)) { return $cmd.Source; }',
369
386
  'return $null;',
370
387
  '}',
371
388
  ].join(' ');
@@ -393,23 +410,24 @@ function buildHermesShellCommand(kind, env) {
393
410
  `PIXCODE_APP_ROOT=${quote(env.PIXCODE_APP_ROOT)}`,
394
411
  ].join(' ');
395
412
  const resolveHermesCommand = [
413
+ 'testHermesCommand() {',
414
+ '[ -n "$1" ] && [ -x "$1" ] && "$1" --version >/dev/null 2>&1;',
415
+ '}',
396
416
  'resolveHermesCommand() {',
397
- 'if command -v hermes >/dev/null 2>&1; then command -v hermes; return 0; fi;',
398
- 'if [ -n "${HERMES_CLI_PATH:-}" ] && [ -x "$HERMES_CLI_PATH" ]; then printf "%s\\n" "$HERMES_CLI_PATH"; return 0; fi;',
399
- 'if [ -x "$HOME/.local/bin/hermes" ]; then printf "%s\\n" "$HOME/.local/bin/hermes"; return 0; fi;',
400
- 'if [ -x "$HOME/.hermes/hermes-agent/venv/bin/hermes" ]; then printf "%s\\n" "$HOME/.hermes/hermes-agent/venv/bin/hermes"; return 0; fi;',
401
- 'if [ -x "/usr/local/bin/hermes" ]; then printf "%s\\n" "/usr/local/bin/hermes"; return 0; fi;',
417
+ 'for candidate in "${HERMES_CLI_PATH:-}" "$HOME/.local/bin/hermes" "$HOME/.hermes/hermes-agent/venv/bin/hermes" "$HOME/.hermes/hermes-agent/.venv/bin/hermes" "/usr/local/bin/hermes" "/usr/local/lib/hermes-agent/venv/bin/hermes"; do',
418
+ 'if testHermesCommand "$candidate"; then printf "%s\\n" "$candidate"; return 0; fi;',
419
+ 'done;',
420
+ 'candidate="$(command -v hermes 2>/dev/null || true)";',
421
+ 'if testHermesCommand "$candidate"; then printf "%s\\n" "$candidate"; return 0; fi;',
402
422
  'return 1;',
403
423
  '}',
404
424
  ].join(' ');
405
- const install = 'curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash';
406
425
  const installHermesIfMissing = [
407
426
  'installHermesIfMissing() {',
408
427
  'HERMES_CMD="$(resolveHermesCommand 2>/dev/null || true)";',
409
428
  'if [ -n "$HERMES_CMD" ]; then echo "Hermes already installed:"; "$HERMES_CMD" --version 2>/dev/null || true; return 0; fi;',
410
- `${install};`,
411
- 'HERMES_CMD="$(resolveHermesCommand 2>/dev/null || true)";',
412
- 'if [ -z "$HERMES_CMD" ]; then echo "Hermes installed, but the hermes command could not be found. Reload PATH and retry." >&2; exit 127; fi;',
429
+ 'echo "Hermes is not installed. Use Pixcode Settings > Hermes Agent > Install or repair, then start again." >&2;',
430
+ 'exit 127;',
413
431
  '}',
414
432
  ].join(' ');
415
433
  if (kind === 'pixcode:hermes:install') {
@@ -2347,17 +2365,17 @@ function handleShellConnection(ws, request) {
2347
2365
  const termCols = data.cols || 80;
2348
2366
  const termRows = data.rows || 24;
2349
2367
  console.log('📐 Using terminal dimensions:', termCols, 'x', termRows);
2368
+ const shellEnv = buildHermesPathEnv(process.env, {
2369
+ TERM: 'xterm-256color',
2370
+ COLORTERM: 'truecolor',
2371
+ FORCE_COLOR: '3',
2372
+ });
2350
2373
  shellProcess = pty.spawn(shell, shellArgs, {
2351
2374
  name: 'xterm-256color',
2352
2375
  cols: termCols,
2353
2376
  rows: termRows,
2354
2377
  cwd: resolvedProjectPath,
2355
- env: {
2356
- ...process.env,
2357
- TERM: 'xterm-256color',
2358
- COLORTERM: 'truecolor',
2359
- FORCE_COLOR: '3'
2360
- }
2378
+ env: shellEnv,
2361
2379
  });
2362
2380
  console.log('🟢 Shell process started with PTY, PID:', shellProcess.pid);
2363
2381
  ptySessionsMap.set(ptySessionKey, {
@@ -3087,6 +3105,15 @@ async function startServer() {
3087
3105
  catch (err) {
3088
3106
  console.warn('[install-jobs] Failed to prime CLI bin path:', err?.message || err);
3089
3107
  }
3108
+ // Prime Hermes' known install locations separately so the project
3109
+ // terminal can resolve `hermes` even when Windows has not refreshed the
3110
+ // user's PATH for the current Pixcode process.
3111
+ try {
3112
+ primeHermesPath();
3113
+ }
3114
+ catch (err) {
3115
+ console.warn('[install-jobs] Failed to prime Hermes bin path:', err?.message || err);
3116
+ }
3090
3117
  // Restore any previously-configured Telegram bot. This is best-effort:
3091
3118
  // a bad token or network blip should warn, not crash the server.
3092
3119
  restoreBotFromConfig().catch((err) => {