pixelcrew 0.2.1 → 0.2.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.
@@ -4,9 +4,17 @@ import fsSync from 'node:fs';
4
4
  import path from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
6
6
 
7
- export function createServer(engine, options = {}) {
8
- const rootDir = engine.rootDir;
9
- const dashboardDir = path.join(rootDir, '.pixel-dashboard');
7
+ export function createServer(engineOrRootDir, maybeEngine, options = {}) {
8
+ let engine = engineOrRootDir;
9
+ let rootDir = engine?.rootDir || process.cwd();
10
+
11
+ if (typeof engineOrRootDir === 'string') {
12
+ rootDir = engineOrRootDir;
13
+ engine = maybeEngine;
14
+ }
15
+
16
+ const dashboardDir = path.join(rootDir, '.pixel-agents', 'dashboard');
17
+ const legacyDashboardDir = path.join(rootDir, '.pixel-dashboard');
10
18
  const fallbackDashboardDir = fileURLToPath(new URL('../dashboard', import.meta.url));
11
19
 
12
20
  const sseClients = new Set();
@@ -233,9 +241,14 @@ export function createServer(engine, options = {}) {
233
241
  try {
234
242
  await fs.access(filePath);
235
243
  } catch {
236
- res.writeHead(404, { 'Content-Type': 'text/plain' });
237
- res.end('404 Not Found');
238
- return;
244
+ filePath = path.join(legacyDashboardDir, filename);
245
+ try {
246
+ await fs.access(filePath);
247
+ } catch {
248
+ res.writeHead(404, { 'Content-Type': 'text/plain' });
249
+ res.end('404 Not Found');
250
+ return;
251
+ }
239
252
  }
240
253
  }
241
254