@agenticmail/enterprise 0.5.61 → 0.5.63

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/src/server.ts CHANGED
@@ -319,18 +319,21 @@ export function createServer(config: ServerConfig): ServerInstance {
319
319
 
320
320
  async function serveDashboard(c: any) {
321
321
  let html = getDashboardHtml();
322
- // Inject version
323
- try {
324
- const pkgPath = join(dirname(fileURLToPath(import.meta.url)), '..', 'package.json');
325
- const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
326
- html = html.replace('</head>', `<script>window.__ENTERPRISE_VERSION__="${pkg.version}";</script></head>`);
327
- } catch {
328
- // try from dist root
322
+ // Inject version — try multiple paths
323
+ let _version = '';
324
+ for (const rel of ['../package.json', './package.json', '../../package.json']) {
325
+ if (_version) break;
329
326
  try {
330
- const pkgPath2 = join(dirname(fileURLToPath(import.meta.url)), 'package.json');
331
- const pkg2 = JSON.parse(readFileSync(pkgPath2, 'utf-8'));
332
- html = html.replace('</head>', `<script>window.__ENTERPRISE_VERSION__="${pkg2.version}";</script></head>`);
333
- } catch { /* noop */ }
327
+ const p = join(dirname(fileURLToPath(import.meta.url)), rel);
328
+ _version = JSON.parse(readFileSync(p, 'utf-8')).version;
329
+ } catch { /* try next */ }
330
+ }
331
+ if (!_version) {
332
+ // Fallback: search from cwd
333
+ try { _version = JSON.parse(readFileSync(join(process.cwd(), 'node_modules', '@agenticmail', 'enterprise', 'package.json'), 'utf-8')).version; } catch { /* noop */ }
334
+ }
335
+ if (_version) {
336
+ html = html.replace('</head>', `<script>window.__ENTERPRISE_VERSION__="${_version}";</script></head>`);
334
337
  }
335
338
 
336
339
  if (!_setupComplete) {