@elizaos/server 1.1.4 → 1.1.5

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.js CHANGED
@@ -392,6 +392,7 @@ import express31 from "express";
392
392
  import helmet2 from "helmet";
393
393
  import * as fs9 from "fs";
394
394
  import http from "http";
395
+ import os2 from "os";
395
396
  import path9, { basename, dirname, extname, join } from "path";
396
397
  import { fileURLToPath as fileURLToPath2 } from "url";
397
398
 
@@ -3816,7 +3817,7 @@ import express28 from "express";
3816
3817
  // package.json
3817
3818
  var package_default = {
3818
3819
  name: "@elizaos/server",
3819
- version: "1.1.4",
3820
+ version: "1.1.5",
3820
3821
  description: "ElizaOS Server - Core server infrastructure for ElizaOS agents",
3821
3822
  publishConfig: {
3822
3823
  access: "public",
@@ -3868,10 +3869,10 @@ var package_default = {
3868
3869
  which: "^4.0.0",
3869
3870
  ws: "^8.18.0"
3870
3871
  },
3871
- gitHead: "06db8f7642156822f010efef3377af4c6161f2c8",
3872
+ gitHead: "4d7e96cd1335e2764cc913b40d31abe18a6c8400",
3872
3873
  dependencies: {
3873
- "@elizaos/core": "1.1.4",
3874
- "@elizaos/plugin-sql": "1.1.4",
3874
+ "@elizaos/core": "1.1.5",
3875
+ "@elizaos/plugin-sql": "1.1.5",
3875
3876
  "@types/express": "^5.0.2",
3876
3877
  "@types/helmet": "^4.0.0",
3877
3878
  "@types/multer": "^1.4.13",
@@ -5942,11 +5943,12 @@ var AgentServer = class {
5942
5943
  }
5943
5944
  }
5944
5945
  };
5946
+ let clientPath = null;
5945
5947
  if (this.isWebUIEnabled) {
5946
5948
  const possiblePaths = [
5947
- // Development: relative to server package
5949
+ // Development: relative to server package (monorepo)
5948
5950
  path9.resolve(__dirname2, "../../cli/dist"),
5949
- // Production: using require.resolve to find CLI package
5951
+ // Production: using require.resolve to find CLI package (if installed as dependency)
5950
5952
  (() => {
5951
5953
  try {
5952
5954
  return path9.resolve(
@@ -5956,19 +5958,76 @@ var AgentServer = class {
5956
5958
  } catch {
5957
5959
  return null;
5958
5960
  }
5959
- })()
5961
+ })(),
5962
+ // Global bun install: check global node_modules locations
5963
+ (() => {
5964
+ try {
5965
+ const { execSync } = __require("child_process");
5966
+ const bunGlobalPath = path9.join(
5967
+ os2.homedir(),
5968
+ ".bun/install/global/node_modules/@elizaos/cli/dist"
5969
+ );
5970
+ if (existsSync3(path9.join(bunGlobalPath, "index.html"))) {
5971
+ return bunGlobalPath;
5972
+ }
5973
+ try {
5974
+ const npmRoot = execSync("npm root -g", { encoding: "utf8" }).trim();
5975
+ const globalCliPath = path9.join(npmRoot, "@elizaos/cli/dist");
5976
+ if (existsSync3(path9.join(globalCliPath, "index.html"))) {
5977
+ return globalCliPath;
5978
+ }
5979
+ } catch {
5980
+ }
5981
+ } catch {
5982
+ }
5983
+ return null;
5984
+ })(),
5985
+ // Alternative global locations (common paths)
5986
+ ...[
5987
+ "/usr/local/lib/node_modules/@elizaos/cli/dist",
5988
+ "/usr/lib/node_modules/@elizaos/cli/dist",
5989
+ path9.join(os2.homedir(), ".npm-global/lib/node_modules/@elizaos/cli/dist"),
5990
+ // Check nvm installations
5991
+ (() => {
5992
+ try {
5993
+ const nvmPath = path9.join(os2.homedir(), ".nvm/versions/node");
5994
+ if (existsSync3(nvmPath)) {
5995
+ const versions = fs9.readdirSync(nvmPath);
5996
+ for (const version of versions) {
5997
+ const cliPath = path9.join(
5998
+ nvmPath,
5999
+ version,
6000
+ "lib/node_modules/@elizaos/cli/dist"
6001
+ );
6002
+ if (existsSync3(path9.join(cliPath, "index.html"))) {
6003
+ return cliPath;
6004
+ }
6005
+ }
6006
+ }
6007
+ } catch {
6008
+ }
6009
+ return null;
6010
+ })()
6011
+ ].filter(Boolean)
5960
6012
  ].filter(Boolean);
5961
- let clientPath = null;
5962
6013
  for (const possiblePath of possiblePaths) {
5963
6014
  if (possiblePath && existsSync3(path9.join(possiblePath, "index.html"))) {
5964
6015
  clientPath = possiblePath;
6016
+ logger29.info(`[STATIC] Found client files at: ${clientPath}`);
5965
6017
  break;
5966
6018
  }
5967
6019
  }
5968
6020
  if (clientPath) {
5969
6021
  this.app.use(express31.static(clientPath, staticOptions));
5970
6022
  } else {
5971
- logger29.warn("[STATIC] Client dist path not found");
6023
+ logger29.warn("[STATIC] Client dist path not found. Searched locations:");
6024
+ possiblePaths.forEach((p) => {
6025
+ if (p) logger29.warn(`[STATIC] - ${p}`);
6026
+ });
6027
+ logger29.warn("[STATIC] The web UI will not be available.");
6028
+ logger29.warn(
6029
+ "[STATIC] To fix this, ensure @elizaos/cli is installed globally: bun install -g @elizaos/cli"
6030
+ );
5972
6031
  }
5973
6032
  }
5974
6033
  const pluginRouteHandler = createPluginRouteHandler(this.agents);
@@ -6013,31 +6072,8 @@ var AgentServer = class {
6013
6072
  res.setHeader("Content-Type", "application/javascript");
6014
6073
  return res.status(404).send(`// JavaScript module not found: ${req.path}`);
6015
6074
  }
6016
- const possiblePaths = [
6017
- // Development: relative to server package
6018
- path9.resolve(__dirname2, "../../cli/dist"),
6019
- // Production: using require.resolve to find CLI package
6020
- (() => {
6021
- try {
6022
- return path9.resolve(
6023
- path9.dirname(__require.resolve("@elizaos/cli/package.json")),
6024
- "dist"
6025
- );
6026
- } catch {
6027
- return null;
6028
- }
6029
- })()
6030
- ].filter((p) => p !== null);
6031
- let indexPath = null;
6032
- for (const possiblePath of possiblePaths) {
6033
- const testPath = path9.join(possiblePath, "index.html");
6034
- if (possiblePath && existsSync3(testPath)) {
6035
- indexPath = testPath;
6036
- break;
6037
- }
6038
- }
6039
- if (indexPath) {
6040
- const indexFilePath = indexPath;
6075
+ if (clientPath) {
6076
+ const indexFilePath = path9.join(clientPath, "index.html");
6041
6077
  res.sendFile(indexFilePath, (err) => {
6042
6078
  if (err) {
6043
6079
  logger29.warn(`[STATIC] Failed to serve index.html: ${err.message}`);
@@ -6045,6 +6081,7 @@ var AgentServer = class {
6045
6081
  }
6046
6082
  });
6047
6083
  } else {
6084
+ logger29.warn("[STATIC] Client dist path not found in SPA fallback");
6048
6085
  res.status(404).send("Client application not found");
6049
6086
  }
6050
6087
  });