@pixelbyte-software/pixcode 1.49.1 → 1.49.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.
@@ -356,16 +356,32 @@ function buildHermesShellCommand(kind, env) {
356
356
  `$env:PIXCODE_APP_ROOT=${quote(env.PIXCODE_APP_ROOT)}`,
357
357
  ].join('; ');
358
358
  const resolveHermesCommand = [
359
+ 'function Test-HermesCommand($candidate) {',
360
+ 'if (-not $candidate) { return $false; }',
361
+ 'try {',
362
+ '& $candidate --version *> $null;',
363
+ 'return $LASTEXITCODE -eq 0;',
364
+ '} catch { return $false; }',
365
+ '}',
359
366
  'function Resolve-HermesCommand {',
360
- '$cmd = Get-Command hermes -ErrorAction SilentlyContinue;',
361
- 'if ($cmd) { return $cmd.Source; }',
362
367
  '$candidates = @(',
363
368
  '$env:HERMES_CLI_PATH,',
369
+ '(Join-Path $env:LOCALAPPDATA "hermes\\bin\\hermes.cmd"),',
370
+ '(Join-Path $env:LOCALAPPDATA "hermes\\bin\\hermes.bat"),',
371
+ '(Join-Path $env:LOCALAPPDATA "hermes\\bin\\hermes.exe"),',
372
+ '(Join-Path $env:LOCALAPPDATA "hermes\\hermes-agent\\venv\\Scripts\\hermes.cmd"),',
373
+ '(Join-Path $env:LOCALAPPDATA "hermes\\hermes-agent\\venv\\Scripts\\hermes.bat"),',
364
374
  '(Join-Path $env:LOCALAPPDATA "hermes\\hermes-agent\\venv\\Scripts\\hermes.exe"),',
375
+ '(Join-Path $env:LOCALAPPDATA "hermes\\hermes-agent\\.venv\\Scripts\\hermes.cmd"),',
376
+ '(Join-Path $env:LOCALAPPDATA "hermes\\hermes-agent\\.venv\\Scripts\\hermes.bat"),',
365
377
  '(Join-Path $env:LOCALAPPDATA "hermes\\hermes-agent\\.venv\\Scripts\\hermes.exe"),',
378
+ '(Join-Path $env:LOCALAPPDATA "hermes\\hermes-agent\\hermes.cmd"),',
379
+ '(Join-Path $env:LOCALAPPDATA "hermes\\hermes-agent\\hermes.bat"),',
366
380
  '(Join-Path $env:LOCALAPPDATA "hermes\\hermes-agent\\hermes.exe")',
367
381
  ');',
368
- 'foreach ($candidate in $candidates) { if ($candidate -and (Test-Path $candidate)) { return $candidate; } }',
382
+ 'foreach ($candidate in $candidates) { if ($candidate -and (Test-Path $candidate) -and (Test-HermesCommand $candidate)) { return $candidate; } }',
383
+ '$cmd = Get-Command hermes -ErrorAction SilentlyContinue;',
384
+ 'if ($cmd -and (Test-HermesCommand $cmd.Source)) { return $cmd.Source; }',
369
385
  'return $null;',
370
386
  '}',
371
387
  ].join(' ');
@@ -393,23 +409,24 @@ function buildHermesShellCommand(kind, env) {
393
409
  `PIXCODE_APP_ROOT=${quote(env.PIXCODE_APP_ROOT)}`,
394
410
  ].join(' ');
395
411
  const resolveHermesCommand = [
412
+ 'testHermesCommand() {',
413
+ '[ -n "$1" ] && [ -x "$1" ] && "$1" --version >/dev/null 2>&1;',
414
+ '}',
396
415
  '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;',
416
+ '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',
417
+ 'if testHermesCommand "$candidate"; then printf "%s\\n" "$candidate"; return 0; fi;',
418
+ 'done;',
419
+ 'candidate="$(command -v hermes 2>/dev/null || true)";',
420
+ 'if testHermesCommand "$candidate"; then printf "%s\\n" "$candidate"; return 0; fi;',
402
421
  'return 1;',
403
422
  '}',
404
423
  ].join(' ');
405
- const install = 'curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash';
406
424
  const installHermesIfMissing = [
407
425
  'installHermesIfMissing() {',
408
426
  'HERMES_CMD="$(resolveHermesCommand 2>/dev/null || true)";',
409
427
  '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;',
428
+ 'echo "Hermes is not installed. Use Pixcode Settings > Hermes Agent > Install or repair, then start again." >&2;',
429
+ 'exit 127;',
413
430
  '}',
414
431
  ].join(' ');
415
432
  if (kind === 'pixcode:hermes:install') {
@@ -540,7 +557,11 @@ adapterRegistry.register(new OpenCodeA2AAdapter());
540
557
  app.use('/hermes', createHermesTaskRouter());
541
558
  app.use('/preview', authenticateToken, createPreviewProxyRouter());
542
559
  app.use('/api/orchestration', authenticateToken, createOrchestrationTaskRouter());
543
- app.use('/api/orchestration/hermes', authenticateToken, createHermesRouter());
560
+ app.use('/api/orchestration/hermes', authenticateToken, createHermesRouter({
561
+ appRoot: APP_ROOT,
562
+ createHermesApiKey: getOrCreateHermesApiKey,
563
+ resolvePublicBaseUrl,
564
+ }));
544
565
  app.use('/api/orchestration', authenticateToken, createWorkflowRouter());
545
566
  app.use('/live', createLiveViewPublicRouter());
546
567
  // Network discovery / QR endpoints (protected)