@agent-relay/dashboard-server 2.0.56 → 2.0.58

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.
Files changed (61) hide show
  1. package/dist/server.d.ts.map +1 -1
  2. package/dist/server.js +56 -21
  3. package/dist/server.js.map +1 -1
  4. package/dist/start.js +1 -0
  5. package/dist/start.js.map +1 -1
  6. package/dist/types/index.d.ts +2 -0
  7. package/dist/types/index.d.ts.map +1 -1
  8. package/out/404.html +1 -1
  9. package/out/about.html +1 -1
  10. package/out/about.txt +1 -1
  11. package/out/app/onboarding.html +1 -1
  12. package/out/app/onboarding.txt +1 -1
  13. package/out/app.html +1 -1
  14. package/out/app.txt +1 -1
  15. package/out/blog/go-to-bed-wake-up-to-a-finished-product.html +1 -1
  16. package/out/blog/go-to-bed-wake-up-to-a-finished-product.txt +1 -1
  17. package/out/blog.html +1 -1
  18. package/out/blog.txt +1 -1
  19. package/out/careers.html +1 -1
  20. package/out/careers.txt +1 -1
  21. package/out/changelog.html +1 -1
  22. package/out/changelog.txt +1 -1
  23. package/out/cloud/link.html +1 -1
  24. package/out/cloud/link.txt +1 -1
  25. package/out/complete-profile.html +1 -1
  26. package/out/complete-profile.txt +1 -1
  27. package/out/connect-repos.html +1 -1
  28. package/out/connect-repos.txt +1 -1
  29. package/out/contact.html +1 -1
  30. package/out/contact.txt +1 -1
  31. package/out/docs.html +1 -1
  32. package/out/docs.txt +1 -1
  33. package/out/history.html +1 -1
  34. package/out/history.txt +1 -1
  35. package/out/index.html +1 -1
  36. package/out/index.txt +1 -1
  37. package/out/login.html +1 -1
  38. package/out/login.txt +1 -1
  39. package/out/metrics.html +1 -1
  40. package/out/metrics.txt +1 -1
  41. package/out/pricing.html +1 -1
  42. package/out/pricing.txt +1 -1
  43. package/out/privacy.html +1 -1
  44. package/out/privacy.txt +1 -1
  45. package/out/providers/setup/claude.html +1 -1
  46. package/out/providers/setup/claude.txt +1 -1
  47. package/out/providers/setup/codex.html +1 -1
  48. package/out/providers/setup/codex.txt +1 -1
  49. package/out/providers/setup/cursor.html +1 -1
  50. package/out/providers/setup/cursor.txt +1 -1
  51. package/out/providers.html +1 -1
  52. package/out/providers.txt +1 -1
  53. package/out/security.html +1 -1
  54. package/out/security.txt +1 -1
  55. package/out/signup.html +1 -1
  56. package/out/signup.txt +1 -1
  57. package/out/terms.html +1 -1
  58. package/out/terms.txt +1 -1
  59. package/package.json +10 -10
  60. /package/out/_next/static/{QqNSu80FdJe5TgWiKSby_ → NUzHPcppjsjp8vNZEuf2A}/_buildManifest.js +0 -0
  61. /package/out/_next/static/{QqNSu80FdJe5TgWiKSby_ → NUzHPcppjsjp8vNZEuf2A}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAgEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAgYzD,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AACvH,wBAAsB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AA8DA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAgYzD,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AACvH,wBAAsB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC"}
package/dist/server.js CHANGED
@@ -53,8 +53,6 @@ function findDashboardDir() {
53
53
  // Return null with flag indicating bundled mode (for quieter error handling)
54
54
  return null;
55
55
  }
56
- // Check if running in bundled binary mode
57
- const IS_BUNDLED_BINARY = path.dirname(fileURLToPath(import.meta.url)).startsWith('/$bunfs/');
58
56
  import { startCLIAuth, getAuthSession, cancelAuthSession, submitAuthCode, completeAuthSession, getSupportedProviders, } from '@agent-relay/daemon';
59
57
  import { HealthWorkerManager, getHealthPort } from './services/health-worker-manager.js';
60
58
  /**
@@ -320,8 +318,15 @@ export async function startDashboard(portOrOptions, dataDirArg, teamDirArg, dbPa
320
318
  const options = typeof portOrOptions === 'number'
321
319
  ? { port: portOrOptions, dataDir: dataDirArg, teamDir: teamDirArg, dbPath: dbPathArg }
322
320
  : portOrOptions;
323
- const { port, dataDir, teamDir, dbPath, enableSpawner, projectRoot, tmuxSession, onMarkSpawning, onClearSpawning } = options;
324
- console.log('Starting dashboard...');
321
+ const { port, dataDir, teamDir, dbPath, enableSpawner, projectRoot, tmuxSession, onMarkSpawning, onClearSpawning, verbose } = options;
322
+ // Debug logging helper - only logs when verbose is true or VERBOSE env var is set
323
+ const isVerbose = verbose || process.env.VERBOSE === 'true';
324
+ const debug = (message) => {
325
+ if (isVerbose) {
326
+ console.log(message);
327
+ }
328
+ };
329
+ console.log('[dashboard] Starting dashboard...');
325
330
  const disableStorage = process.env.RELAY_DISABLE_STORAGE === 'true';
326
331
  // Use createStorageAdapter to match daemon's storage type (JSONL by default)
327
332
  // This ensures dashboard reads from the same storage as daemon writes to
@@ -578,7 +583,7 @@ export async function startDashboard(portOrOptions, dataDirArg, teamDirArg, dbPa
578
583
  wss.clients.forEach((ws) => {
579
584
  if (mainClientAlive.get(ws) === false) {
580
585
  // Client didn't respond to last ping - close gracefully
581
- console.log('[dashboard] Main WebSocket client unresponsive, closing gracefully');
586
+ debug('[dashboard] Main WebSocket client unresponsive, closing gracefully');
582
587
  ws.close(1000, 'unresponsive');
583
588
  return;
584
589
  }
@@ -592,7 +597,7 @@ export async function startDashboard(portOrOptions, dataDirArg, teamDirArg, dbPa
592
597
  const bridgePingInterval = setInterval(() => {
593
598
  wssBridge.clients.forEach((ws) => {
594
599
  if (bridgeClientAlive.get(ws) === false) {
595
- console.log('[dashboard] Bridge WebSocket client unresponsive, closing gracefully');
600
+ debug('[dashboard] Bridge WebSocket client unresponsive, closing gracefully');
596
601
  ws.close(1000, 'unresponsive');
597
602
  return;
598
603
  }
@@ -782,10 +787,40 @@ export async function startDashboard(portOrOptions, dataDirArg, teamDirArg, dbPa
782
787
  app.get('/app', (req, res) => {
783
788
  res.sendFile(path.join(dashboardDir, 'app.html'));
784
789
  });
790
+ // Catch-all for /app/* routes - serve app.html and let client-side routing handle it
791
+ app.get('/app/*', (req, res) => {
792
+ res.sendFile(path.join(dashboardDir, 'app.html'));
793
+ });
785
794
  }
786
- else if (!IS_BUNDLED_BINARY) {
787
- // Only show error for non-bundled mode - bundled binaries are expected to not have embedded UI
788
- console.error('[dashboard] Dashboard not found - searched from:', __dirname);
795
+ else {
796
+ // Serve a fallback page when dashboard UI files aren't available
797
+ const fallbackHtml = `<!DOCTYPE html>
798
+ <html>
799
+ <head>
800
+ <title>Agent Relay Dashboard</title>
801
+ <style>
802
+ body { font-family: system-ui, sans-serif; max-width: 600px; margin: 100px auto; padding: 20px; }
803
+ h1 { color: #333; }
804
+ code { background: #f4f4f4; padding: 2px 6px; border-radius: 3px; }
805
+ pre { background: #f4f4f4; padding: 12px; border-radius: 5px; overflow-x: auto; }
806
+ .api-status { margin-top: 30px; padding: 15px; background: #e8f5e9; border-radius: 5px; }
807
+ </style>
808
+ </head>
809
+ <body>
810
+ <h1>Agent Relay Dashboard</h1>
811
+ <p>The dashboard API is running, but the UI files are not available.</p>
812
+ <p>To get the full dashboard UI, reinstall using the official installer:</p>
813
+ <pre><code>curl -fsSL https://raw.githubusercontent.com/AgentWorkforce/relay/main/install.sh | bash</code></pre>
814
+ <div class="api-status">
815
+ <strong>API Status:</strong> Running<br>
816
+ <a href="/api/agents">View connected agents</a> |
817
+ <a href="/api/messages">View messages</a>
818
+ </div>
819
+ </body>
820
+ </html>`;
821
+ app.get('/', (req, res) => {
822
+ res.type('html').send(fallbackHtml);
823
+ });
789
824
  }
790
825
  // Relay clients for sending messages from dashboard
791
826
  // Map of senderName -> RelayClient for per-user connections
@@ -1947,7 +1982,7 @@ export async function startDashboard(portOrOptions, dataDirArg, teamDirArg, dbPa
1947
1982
  };
1948
1983
  // Handle new WebSocket connections - send initial data immediately
1949
1984
  wss.on('connection', async (ws, req) => {
1950
- console.log('[dashboard] WebSocket client connected from:', req.socket.remoteAddress);
1985
+ debug(`[dashboard] WebSocket client connected from: ${req.socket.remoteAddress}`);
1951
1986
  // Mark client as alive initially for ping/pong keepalive
1952
1987
  mainClientAlive.set(ws, true);
1953
1988
  // Handle pong responses (keep connection alive)
@@ -1965,9 +2000,9 @@ export async function startDashboard(portOrOptions, dataDirArg, teamDirArg, dbPa
1965
2000
  return;
1966
2001
  }
1967
2002
  if (ws.readyState === WebSocket.OPEN) {
1968
- console.log('[dashboard] Sending initial data, size:', payload.length, 'first 200 chars:', payload.substring(0, 200));
2003
+ debug(`[dashboard] Sending initial data, size: ${payload.length}, first 200 chars: ${payload.substring(0, 200)}`);
1969
2004
  ws.send(payload);
1970
- console.log('[dashboard] Initial data sent successfully');
2005
+ debug('[dashboard] Initial data sent successfully');
1971
2006
  }
1972
2007
  else {
1973
2008
  console.warn('[dashboard] WebSocket not open, state:', ws.readyState);
@@ -1984,12 +2019,12 @@ export async function startDashboard(portOrOptions, dataDirArg, teamDirArg, dbPa
1984
2019
  console.error('[dashboard] WebSocket client error:', err);
1985
2020
  });
1986
2021
  ws.on('close', (code, reason) => {
1987
- console.log('[dashboard] WebSocket client disconnected, code:', code, 'reason:', reason?.toString() || 'none');
2022
+ debug(`[dashboard] WebSocket client disconnected, code: ${code}, reason: ${reason?.toString() || 'none'}`);
1988
2023
  });
1989
2024
  });
1990
2025
  // Handle bridge WebSocket connections
1991
2026
  wssBridge.on('connection', async (ws) => {
1992
- console.log('[dashboard] Bridge WebSocket client connected');
2027
+ debug('[dashboard] Bridge WebSocket client connected');
1993
2028
  // Mark client as alive initially for ping/pong keepalive
1994
2029
  bridgeClientAlive.set(ws, true);
1995
2030
  // Handle pong responses (keep connection alive)
@@ -2010,7 +2045,7 @@ export async function startDashboard(portOrOptions, dataDirArg, teamDirArg, dbPa
2010
2045
  console.error('[dashboard] Bridge WebSocket client error:', err);
2011
2046
  });
2012
2047
  ws.on('close', (code, reason) => {
2013
- console.log('[dashboard] Bridge WebSocket client disconnected, code:', code, 'reason:', reason?.toString() || 'none');
2048
+ debug(`[dashboard] Bridge WebSocket client disconnected, code: ${code}, reason: ${reason?.toString() || 'none'}`);
2014
2049
  });
2015
2050
  });
2016
2051
  // Track alive status for ping/pong keepalive on log connections
@@ -2022,7 +2057,7 @@ export async function startDashboard(portOrOptions, dataDirArg, teamDirArg, dbPa
2022
2057
  wssLogs.clients.forEach((ws) => {
2023
2058
  if (logClientAlive.get(ws) === false) {
2024
2059
  // Client didn't respond to last ping - close gracefully
2025
- console.log('[dashboard] Logs WebSocket client unresponsive, closing gracefully');
2060
+ debug('[dashboard] Logs WebSocket client unresponsive, closing gracefully');
2026
2061
  ws.close(1000, 'unresponsive');
2027
2062
  return;
2028
2063
  }
@@ -2037,7 +2072,7 @@ export async function startDashboard(portOrOptions, dataDirArg, teamDirArg, dbPa
2037
2072
  });
2038
2073
  // Handle logs WebSocket connections for live log streaming
2039
2074
  wssLogs.on('connection', (ws, req) => {
2040
- console.log('[dashboard] Logs WebSocket client connected');
2075
+ debug('[dashboard] Logs WebSocket client connected');
2041
2076
  const clientSubscriptions = new Set();
2042
2077
  // Mark client as alive initially
2043
2078
  logClientAlive.set(ws, true);
@@ -2184,7 +2219,7 @@ export async function startDashboard(portOrOptions, dataDirArg, teamDirArg, dbPa
2184
2219
  logSubscriptions.set(agentName, new Set());
2185
2220
  }
2186
2221
  logSubscriptions.get(agentName).add(ws);
2187
- console.log(`[dashboard] Client subscribed to logs for: ${agentName} (spawned: ${isSpawned}, daemon: ${isDaemon})`);
2222
+ debug(`[dashboard] Client subscribed to logs for: ${agentName} (spawned: ${isSpawned}, daemon: ${isDaemon})`);
2188
2223
  if (isSpawned && spawner) {
2189
2224
  // Send initial log history for spawned agents (5000 lines to match xterm scrollback capacity)
2190
2225
  const lines = spawner.getWorkerOutput(agentName, 5000);
@@ -2265,7 +2300,7 @@ export async function startDashboard(portOrOptions, dataDirArg, teamDirArg, dbPa
2265
2300
  fileLastSize.delete(agentName);
2266
2301
  }
2267
2302
  }
2268
- console.log(`[dashboard] Client unsubscribed from logs for: ${agentName}`);
2303
+ debug(`[dashboard] Client unsubscribed from logs for: ${agentName}`);
2269
2304
  ws.send(JSON.stringify({
2270
2305
  type: 'unsubscribed',
2271
2306
  agent: agentName,
@@ -2412,7 +2447,7 @@ export async function startDashboard(portOrOptions, dataDirArg, teamDirArg, dbPa
2412
2447
  const payload = JSON.stringify(message);
2413
2448
  // Broadcast to main WebSocket clients (local mode)
2414
2449
  const mainClients = Array.from(wss.clients).filter(c => c.readyState === WebSocket.OPEN);
2415
- console.log(`[dashboard] Broadcasting direct_message to ${mainClients.length} main clients`);
2450
+ debug(`[dashboard] Broadcasting direct_message to ${mainClients.length} main clients`);
2416
2451
  wss.clients.forEach((client) => {
2417
2452
  if (client.readyState === WebSocket.OPEN) {
2418
2453
  client.send(payload);
@@ -2421,7 +2456,7 @@ export async function startDashboard(portOrOptions, dataDirArg, teamDirArg, dbPa
2421
2456
  // Also broadcast to presence WebSocket clients (cloud mode)
2422
2457
  const presenceClients = Array.from(wssPresence.clients).filter(c => c.readyState === WebSocket.OPEN);
2423
2458
  if (presenceClients.length > 0) {
2424
- console.log(`[dashboard] Broadcasting direct_message to ${presenceClients.length} presence clients`);
2459
+ debug(`[dashboard] Broadcasting direct_message to ${presenceClients.length} presence clients`);
2425
2460
  wssPresence.clients.forEach((client) => {
2426
2461
  if (client.readyState === WebSocket.OPEN) {
2427
2462
  client.send(payload);