@pixelbyte-software/pixcode 1.50.9 → 1.51.0

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,7 +35,7 @@
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-CXTCtUku.js"></script>
38
+ <script type="module" crossorigin src="/assets/index-DJosGZ59.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">
@@ -536,6 +536,40 @@ function quoteShellArgForPlatform(value) {
536
536
  return os.platform() === 'win32' ? quotePowerShellArg(value) : quoteBashArg(value);
537
537
  }
538
538
  const HERMES_CLI_COMMAND_PATTERN = /^hermes(?:\s+[A-Za-z0-9._:/=@+-]+)*\s*$/;
539
+ const HERMES_AGENT_API_SCOPES = [
540
+ 'auth:read',
541
+ 'auth:write',
542
+ 'diagnostics:read',
543
+ 'files:read',
544
+ 'files:write',
545
+ 'git:read',
546
+ 'git:write',
547
+ 'hermes:mcp',
548
+ 'hermes:gateway',
549
+ 'notifications:read',
550
+ 'notifications:write',
551
+ 'orchestration:read',
552
+ 'orchestration:write',
553
+ 'plugins:read',
554
+ 'plugins:write',
555
+ 'projects:read',
556
+ 'projects:write',
557
+ 'providers:read',
558
+ 'providers:write',
559
+ 'remote:read',
560
+ 'remote:write',
561
+ 'sessions:read',
562
+ 'sessions:write',
563
+ 'settings:read',
564
+ 'settings:write',
565
+ 'telegram:read',
566
+ 'telegram:write',
567
+ 'terminal:launch',
568
+ 'updates:read',
569
+ 'updates:write',
570
+ 'webhooks:read',
571
+ 'webhooks:write',
572
+ ];
539
573
  function isHermesCliCommand(command) {
540
574
  return typeof command === 'string' && HERMES_CLI_COMMAND_PATTERN.test(command.trim());
541
575
  }
@@ -554,15 +588,14 @@ function getOrCreateHermesApiKey(userId) {
554
588
  .getApiKeys(userId)
555
589
  .find((key) => key.key_name === 'Hermes Agent MCP' && key.is_active);
556
590
  if (existing?.api_key) {
591
+ const existingScopes = Array.isArray(existing.scopes) ? existing.scopes : [];
592
+ const missingScopes = HERMES_AGENT_API_SCOPES.filter((scope) => !existingScopes.includes(scope));
593
+ if (missingScopes.length > 0 && existing.id) {
594
+ apiKeysDb.updateApiKeyScopes(userId, existing.id, [...existingScopes, ...missingScopes]);
595
+ }
557
596
  return existing.api_key;
558
597
  }
559
- return apiKeysDb.createApiKey(userId, 'Hermes Agent MCP', [
560
- 'hermes:mcp',
561
- 'hermes:gateway',
562
- 'projects:read',
563
- 'providers:read',
564
- 'terminal:launch',
565
- ]).apiKey;
598
+ return apiKeysDb.createApiKey(userId, 'Hermes Agent MCP', HERMES_AGENT_API_SCOPES).apiKey;
566
599
  }
567
600
  // Single WebSocket server that handles both paths
568
601
  const wss = new WebSocketServer({
@@ -682,6 +715,66 @@ app.get('/api/shell/sessions/provider-output', authenticateToken, (req, res) =>
682
715
  output,
683
716
  });
684
717
  });
718
+ app.post('/api/shell/sessions/provider-input', authenticateToken, (req, res) => {
719
+ const provider = String(req.body?.provider || 'claude');
720
+ const projectPath = typeof req.body?.projectPath === 'string' && req.body.projectPath.trim()
721
+ ? req.body.projectPath.trim()
722
+ : null;
723
+ const launchId = Number.parseInt(String(req.body?.launchId || ''), 10);
724
+ const requestedLaunchId = Number.isFinite(launchId) && launchId > 0 ? launchId : null;
725
+ const input = typeof req.body?.input === 'string' ? req.body.input : '';
726
+ const submit = req.body?.submit !== false;
727
+ if (!SHELL_CLI_PROVIDERS.has(provider)) {
728
+ return res.status(400).json({ error: 'Unsupported provider' });
729
+ }
730
+ const requestedProjectPath = projectPath ? path.resolve(projectPath) : null;
731
+ let matchedSession = null;
732
+ for (const session of ptySessionsMap.values()) {
733
+ if (session?.provider === provider &&
734
+ !session?.isPlainShell &&
735
+ session?.pty &&
736
+ session.lifecycleState === 'running' &&
737
+ (!requestedProjectPath || path.resolve(session.projectPath || os.homedir()) === requestedProjectPath) &&
738
+ (!requestedLaunchId || session.hermesLaunchId === requestedLaunchId)) {
739
+ if (!matchedSession || (session.updatedAt || 0) > (matchedSession.updatedAt || 0)) {
740
+ matchedSession = session;
741
+ }
742
+ }
743
+ }
744
+ if (!matchedSession?.pty) {
745
+ return res.status(404).json({
746
+ ok: false,
747
+ provider,
748
+ projectPath: requestedProjectPath,
749
+ launchId: requestedLaunchId,
750
+ wrote: false,
751
+ message: 'No running provider terminal session found for this project.',
752
+ });
753
+ }
754
+ const data = submit ? normalizeTerminalStartupInput(input) : input;
755
+ try {
756
+ matchedSession.pty.write(data);
757
+ matchedSession.updatedAt = Date.now();
758
+ res.json({
759
+ ok: true,
760
+ provider,
761
+ projectPath: path.resolve(matchedSession.projectPath || os.homedir()),
762
+ sessionId: matchedSession.sessionId || null,
763
+ launchId: matchedSession.hermesLaunchId || null,
764
+ wrote: true,
765
+ submitted: submit,
766
+ bytes: Buffer.byteLength(data),
767
+ });
768
+ }
769
+ catch (error) {
770
+ res.status(500).json({
771
+ ok: false,
772
+ provider,
773
+ wrote: false,
774
+ error: error instanceof Error ? error.message : String(error),
775
+ });
776
+ }
777
+ });
685
778
  // Authentication routes (public)
686
779
  app.use('/api/auth', authRoutes);
687
780
  // Projects API Routes (protected)