@elizaos/server 1.1.1 → 1.1.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.
package/dist/index.js CHANGED
@@ -4,7 +4,13 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __commonJS = (cb, mod) => function __require() {
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
+ });
13
+ var __commonJS = (cb, mod) => function __require2() {
8
14
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
15
  };
10
16
  var __copyProps = (to, from, except, desc) => {
@@ -3810,7 +3816,7 @@ import express28 from "express";
3810
3816
  // package.json
3811
3817
  var package_default = {
3812
3818
  name: "@elizaos/server",
3813
- version: "1.1.1",
3819
+ version: "1.1.3",
3814
3820
  description: "ElizaOS Server - Core server infrastructure for ElizaOS agents",
3815
3821
  publishConfig: {
3816
3822
  access: "public",
@@ -3862,10 +3868,10 @@ var package_default = {
3862
3868
  which: "^4.0.0",
3863
3869
  ws: "^8.18.0"
3864
3870
  },
3865
- gitHead: "d5bd5c43bfebeb7ac02f9e029f924cb6cd5c2ec7",
3871
+ gitHead: "90c477c53a184c0e33a58b862958b88a200296d6",
3866
3872
  dependencies: {
3867
- "@elizaos/core": "workspace:*",
3868
- "@elizaos/plugin-sql": "workspace:*",
3873
+ "@elizaos/core": "1.1.3",
3874
+ "@elizaos/plugin-sql": "1.1.3",
3869
3875
  "@types/express": "^5.0.2",
3870
3876
  "@types/helmet": "^4.0.0",
3871
3877
  "@types/multer": "^1.4.13",
@@ -5904,6 +5910,8 @@ var AgentServer = class {
5904
5910
  const staticOptions = {
5905
5911
  etag: true,
5906
5912
  lastModified: true,
5913
+ fallthrough: true,
5914
+ // Allow non-existent files to pass through to the catch-all route
5907
5915
  setHeaders: (res, filePath) => {
5908
5916
  const ext = extname(filePath).toLowerCase();
5909
5917
  if (ext === ".css") {
@@ -5922,8 +5930,33 @@ var AgentServer = class {
5922
5930
  }
5923
5931
  };
5924
5932
  if (this.isWebUIEnabled) {
5925
- const clientPath = path9.resolve(__dirname2, "../../cli/dist");
5926
- this.app.use(express31.static(clientPath, staticOptions));
5933
+ const possiblePaths = [
5934
+ // Development: relative to server package
5935
+ path9.resolve(__dirname2, "../../cli/dist"),
5936
+ // Production: using require.resolve to find CLI package
5937
+ (() => {
5938
+ try {
5939
+ return path9.resolve(
5940
+ path9.dirname(__require.resolve("@elizaos/cli/package.json")),
5941
+ "dist"
5942
+ );
5943
+ } catch {
5944
+ return null;
5945
+ }
5946
+ })()
5947
+ ].filter(Boolean);
5948
+ let clientPath = null;
5949
+ for (const possiblePath of possiblePaths) {
5950
+ if (possiblePath && existsSync3(path9.join(possiblePath, "index.html"))) {
5951
+ clientPath = possiblePath;
5952
+ break;
5953
+ }
5954
+ }
5955
+ if (clientPath) {
5956
+ this.app.use(express31.static(clientPath, staticOptions));
5957
+ } else {
5958
+ logger29.warn("[STATIC] Client dist path not found");
5959
+ }
5927
5960
  }
5928
5961
  const pluginRouteHandler = createPluginRouteHandler(this.agents);
5929
5962
  this.app.use(pluginRouteHandler);
@@ -5967,8 +6000,40 @@ var AgentServer = class {
5967
6000
  res.setHeader("Content-Type", "application/javascript");
5968
6001
  return res.status(404).send(`// JavaScript module not found: ${req.path}`);
5969
6002
  }
5970
- const cliDistPath = path9.resolve(__dirname2, "../../cli/dist");
5971
- res.sendFile(path9.join(cliDistPath, "index.html"));
6003
+ const possiblePaths = [
6004
+ // Development: relative to server package
6005
+ path9.resolve(__dirname2, "../../cli/dist"),
6006
+ // Production: using require.resolve to find CLI package
6007
+ (() => {
6008
+ try {
6009
+ return path9.resolve(
6010
+ path9.dirname(__require.resolve("@elizaos/cli/package.json")),
6011
+ "dist"
6012
+ );
6013
+ } catch {
6014
+ return null;
6015
+ }
6016
+ })()
6017
+ ].filter((p) => p !== null);
6018
+ let indexPath = null;
6019
+ for (const possiblePath of possiblePaths) {
6020
+ const testPath = path9.join(possiblePath, "index.html");
6021
+ if (possiblePath && existsSync3(testPath)) {
6022
+ indexPath = testPath;
6023
+ break;
6024
+ }
6025
+ }
6026
+ if (indexPath) {
6027
+ const indexFilePath = indexPath;
6028
+ res.sendFile(indexFilePath, (err) => {
6029
+ if (err) {
6030
+ logger29.warn(`[STATIC] Failed to serve index.html: ${err.message}`);
6031
+ res.status(404).send("Client application not found");
6032
+ }
6033
+ });
6034
+ } else {
6035
+ res.status(404).send("Client application not found");
6036
+ }
5972
6037
  });
5973
6038
  } else {
5974
6039
  this.app.use((_req, res) => {