@elizaos/server 1.4.2 → 1.4.3-alpha.1

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 (127) hide show
  1. package/dist/api/agents/crud.d.ts +8 -0
  2. package/dist/api/agents/crud.d.ts.map +1 -0
  3. package/dist/api/agents/index.d.ts +8 -0
  4. package/dist/api/agents/index.d.ts.map +1 -0
  5. package/dist/api/agents/lifecycle.d.ts +8 -0
  6. package/dist/api/agents/lifecycle.d.ts.map +1 -0
  7. package/dist/api/agents/logs.d.ts +7 -0
  8. package/dist/api/agents/logs.d.ts.map +1 -0
  9. package/dist/api/agents/panels.d.ts +7 -0
  10. package/dist/api/agents/panels.d.ts.map +1 -0
  11. package/dist/api/agents/worlds.d.ts +7 -0
  12. package/dist/api/agents/worlds.d.ts.map +1 -0
  13. package/dist/api/audio/audioBuffer.d.ts +18 -0
  14. package/dist/api/audio/audioBuffer.d.ts.map +1 -0
  15. package/dist/api/audio/conversation.d.ts +7 -0
  16. package/dist/api/audio/conversation.d.ts.map +1 -0
  17. package/dist/api/audio/index.d.ts +7 -0
  18. package/dist/api/audio/index.d.ts.map +1 -0
  19. package/dist/api/audio/processing.d.ts +10 -0
  20. package/dist/api/audio/processing.d.ts.map +1 -0
  21. package/dist/api/audio/synthesis.d.ts +7 -0
  22. package/dist/api/audio/synthesis.d.ts.map +1 -0
  23. package/dist/api/index.d.ts +20 -0
  24. package/dist/api/index.d.ts.map +1 -0
  25. package/dist/api/media/agents.d.ts +6 -0
  26. package/dist/api/media/agents.d.ts.map +1 -0
  27. package/dist/api/media/channels.d.ts +6 -0
  28. package/dist/api/media/channels.d.ts.map +1 -0
  29. package/dist/api/media/index.d.ts +6 -0
  30. package/dist/api/media/index.d.ts.map +1 -0
  31. package/dist/api/memory/agents.d.ts +7 -0
  32. package/dist/api/memory/agents.d.ts.map +1 -0
  33. package/dist/api/memory/groups.d.ts +8 -0
  34. package/dist/api/memory/groups.d.ts.map +1 -0
  35. package/dist/api/memory/index.d.ts +8 -0
  36. package/dist/api/memory/index.d.ts.map +1 -0
  37. package/dist/api/memory/rooms.d.ts +7 -0
  38. package/dist/api/memory/rooms.d.ts.map +1 -0
  39. package/dist/api/messaging/channels.d.ts +8 -0
  40. package/dist/api/messaging/channels.d.ts.map +1 -0
  41. package/dist/api/messaging/core.d.ts +7 -0
  42. package/dist/api/messaging/core.d.ts.map +1 -0
  43. package/dist/api/messaging/errors/SessionErrors.d.ts +149 -0
  44. package/dist/api/messaging/errors/SessionErrors.d.ts.map +1 -0
  45. package/dist/api/messaging/index.d.ts +8 -0
  46. package/dist/api/messaging/index.d.ts.map +1 -0
  47. package/dist/api/messaging/servers.d.ts +7 -0
  48. package/dist/api/messaging/servers.d.ts.map +1 -0
  49. package/dist/api/messaging/sessions.d.ts +23 -0
  50. package/dist/api/messaging/sessions.d.ts.map +1 -0
  51. package/dist/api/runtime/debug.d.ts +7 -0
  52. package/dist/api/runtime/debug.d.ts.map +1 -0
  53. package/dist/api/runtime/health.d.ts +8 -0
  54. package/dist/api/runtime/health.d.ts.map +1 -0
  55. package/dist/api/runtime/index.d.ts +8 -0
  56. package/dist/api/runtime/index.d.ts.map +1 -0
  57. package/dist/api/runtime/logging.d.ts +6 -0
  58. package/dist/api/runtime/logging.d.ts.map +1 -0
  59. package/dist/api/shared/constants.d.ts +22 -0
  60. package/dist/api/shared/constants.d.ts.map +1 -0
  61. package/dist/api/shared/file-utils.d.ts +21 -0
  62. package/dist/api/shared/file-utils.d.ts.map +1 -0
  63. package/dist/api/shared/index.d.ts +7 -0
  64. package/dist/api/shared/index.d.ts.map +1 -0
  65. package/dist/api/shared/middleware.d.ts +40 -0
  66. package/dist/api/shared/middleware.d.ts.map +1 -0
  67. package/dist/api/shared/response-utils.d.ts +10 -0
  68. package/dist/api/shared/response-utils.d.ts.map +1 -0
  69. package/dist/api/shared/uploads/index.d.ts +2 -0
  70. package/dist/api/shared/uploads/index.d.ts.map +1 -0
  71. package/dist/api/shared/validation.d.ts +27 -0
  72. package/dist/api/shared/validation.d.ts.map +1 -0
  73. package/dist/api/system/environment.d.ts +24 -0
  74. package/dist/api/system/environment.d.ts.map +1 -0
  75. package/dist/api/system/index.d.ts +6 -0
  76. package/dist/api/system/index.d.ts.map +1 -0
  77. package/dist/api/system/version.d.ts +6 -0
  78. package/dist/api/system/version.d.ts.map +1 -0
  79. package/dist/api/tee/index.d.ts +6 -0
  80. package/dist/api/tee/index.d.ts.map +1 -0
  81. package/dist/api/tee/tee.d.ts +1 -0
  82. package/dist/api/tee/tee.d.ts.map +1 -0
  83. package/dist/authMiddleware.d.ts +16 -0
  84. package/dist/authMiddleware.d.ts.map +1 -0
  85. package/dist/bus.d.ts +31 -0
  86. package/dist/bus.d.ts.map +1 -0
  87. package/dist/index.d.ts +21 -211
  88. package/dist/index.d.ts.map +1 -0
  89. package/dist/index.js +3986 -2722
  90. package/dist/loader.d.ts +49 -0
  91. package/dist/loader.d.ts.map +1 -0
  92. package/dist/scripts/copy-client-dist.d.ts +2 -0
  93. package/dist/scripts/copy-client-dist.d.ts.map +1 -0
  94. package/dist/services/message.d.ts +51 -0
  95. package/dist/services/message.d.ts.map +1 -0
  96. package/dist/socketio/index.d.ts +23 -0
  97. package/dist/socketio/index.d.ts.map +1 -0
  98. package/dist/types/sessions.d.ts +153 -0
  99. package/dist/types/sessions.d.ts.map +1 -0
  100. package/dist/types.d.ts +52 -0
  101. package/dist/types.d.ts.map +1 -0
  102. package/dist/upload.d.ts +16 -0
  103. package/dist/upload.d.ts.map +1 -0
  104. package/package.json +8 -8
  105. package/dist/client/assets/index-BgxiIYf2.js +0 -7487
  106. package/dist/client/assets/index-BgxiIYf2.js.br +0 -0
  107. package/dist/client/assets/index-BgxiIYf2.js.map +0 -1
  108. package/dist/client/assets/index-CuhlDCnv.css +0 -1
  109. package/dist/client/assets/index-CuhlDCnv.css.br +0 -0
  110. package/dist/client/assets/index-ofROTcnX.js +0 -157130
  111. package/dist/client/assets/index-ofROTcnX.js.br +0 -0
  112. package/dist/client/assets/index-ofROTcnX.js.map +0 -1
  113. package/dist/client/assets/vendor-BDSOQlwO.js +0 -5644
  114. package/dist/client/assets/vendor-BDSOQlwO.js.br +0 -0
  115. package/dist/client/assets/vendor-BDSOQlwO.js.map +0 -1
  116. package/dist/client/elizaos-avatar.png +0 -0
  117. package/dist/client/elizaos-icon.png +0 -0
  118. package/dist/client/elizaos-logo-light.png +0 -0
  119. package/dist/client/elizaos.webp +0 -0
  120. package/dist/client/favicon.ico +0 -0
  121. package/dist/client/images/agents/agent1.png +0 -0
  122. package/dist/client/images/agents/agent2.png +0 -0
  123. package/dist/client/images/agents/agent3.png +0 -0
  124. package/dist/client/images/agents/agent4.png +0 -0
  125. package/dist/client/images/agents/agent5.png +0 -0
  126. package/dist/client/index.html +0 -24
  127. package/dist/index.js.map +0 -1
@@ -0,0 +1,7 @@
1
+ export * from './response-utils';
2
+ export * from './validation';
3
+ export * from './file-utils';
4
+ export * from './middleware';
5
+ export * from './uploads';
6
+ export * from './constants';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/shared/index.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,40 @@
1
+ import type { IAgentRuntime, UUID } from '@elizaos/core';
2
+ import express from 'express';
3
+ /**
4
+ * Middleware to validate that an agent exists
5
+ */
6
+ export declare const agentExistsMiddleware: (agents: Map<UUID, IAgentRuntime>) => (req: express.Request, res: express.Response, next: express.NextFunction) => void;
7
+ /**
8
+ * Middleware to validate UUID parameters
9
+ */
10
+ export declare const validateUuidMiddleware: (paramName: string) => (req: express.Request, res: express.Response, next: express.NextFunction) => void;
11
+ /**
12
+ * Enhanced channel ID validation middleware with additional security
13
+ */
14
+ export declare const validateChannelIdMiddleware: () => (req: express.Request, res: express.Response, next: express.NextFunction) => void;
15
+ /**
16
+ * Security middleware to add additional API protection
17
+ */
18
+ export declare const securityMiddleware: () => (req: express.Request, res: express.Response, next: express.NextFunction) => void;
19
+ /**
20
+ * Middleware to validate request content type for POST/PUT/PATCH requests
21
+ */
22
+ export declare const validateContentTypeMiddleware: () => (req: express.Request, res: express.Response, next: express.NextFunction) => void;
23
+ /**
24
+ * General API rate limiting middleware
25
+ */
26
+ export declare const createApiRateLimit: () => import("express-rate-limit").RateLimitRequestHandler;
27
+ /**
28
+ * Strict rate limiting for file system operations
29
+ */
30
+ export declare const createFileSystemRateLimit: () => import("express-rate-limit").RateLimitRequestHandler;
31
+ /**
32
+ * Very strict rate limiting for upload operations
33
+ */
34
+ export declare const createUploadRateLimit: () => import("express-rate-limit").RateLimitRequestHandler;
35
+ /**
36
+ * Rate limiting specifically for channel validation attempts
37
+ * Prevents brute force attacks on channel IDs
38
+ */
39
+ export declare const createChannelValidationRateLimit: () => import("express-rate-limit").RateLimitRequestHandler;
40
+ //# sourceMappingURL=middleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../../src/api/shared/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,OAAO,MAAM,SAAS,CAAC;AAM9B;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAI,QAAQ,GAAG,CAAC,IAAI,EAAE,aAAa,CAAC,MAC5D,KAAK,OAAO,CAAC,OAAO,EAAE,KAAK,OAAO,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,YAAY,SAgBhF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,GAAI,WAAW,MAAM,MAC9C,KAAK,OAAO,CAAC,OAAO,EAAE,KAAK,OAAO,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,YAAY,SAuBhF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B,SAC9B,KAAK,OAAO,CAAC,OAAO,EAAE,KAAK,OAAO,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,YAAY,SAoBhF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,SACrB,KAAK,OAAO,CAAC,OAAO,EAAE,KAAK,OAAO,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,YAAY,SAqEhF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,6BAA6B,SAChC,KAAK,OAAO,CAAC,OAAO,EAAE,KAAK,OAAO,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,YAAY,SA8BhF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,4DAyB9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,4DA2BrC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,4DA2BjC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gCAAgC,4DAqC5C,CAAC"}
@@ -0,0 +1,10 @@
1
+ import express from 'express';
2
+ /**
3
+ * Sends a standardized error response
4
+ */
5
+ export declare const sendError: (res: express.Response, status: number, code: string, message: string, details?: string) => void;
6
+ /**
7
+ * Sends a standardized success response
8
+ */
9
+ export declare const sendSuccess: (res: express.Response, data: any, status?: number) => void;
10
+ //# sourceMappingURL=response-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response-utils.d.ts","sourceRoot":"","sources":["../../../src/api/shared/response-utils.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B;;GAEG;AACH,eAAO,MAAM,SAAS,GACpB,KAAK,OAAO,CAAC,QAAQ,EACrB,QAAQ,MAAM,EACd,MAAM,MAAM,EACZ,SAAS,MAAM,EACf,UAAU,MAAM,SAUjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,GAAI,KAAK,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,EAAE,eAAY,SAKzE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { agentAudioUpload, agentMediaUpload, channelUpload, validateAudioFile, validateMediaFile, processUploadedFile, generateSecureFilename, ensureUploadDir, } from '../../../upload';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/shared/uploads/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,GAChB,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { IAgentRuntime, UUID } from '@elizaos/core';
2
+ /**
3
+ * Validates and retrieves an agent runtime from the agents map
4
+ */
5
+ export declare const getRuntime: (agents: Map<UUID, IAgentRuntime>, agentId: UUID) => IAgentRuntime;
6
+ /**
7
+ * Validates a UUID parameter and returns it as UUID type or null if invalid
8
+ */
9
+ export declare const validateAgentId: (agentId: string) => UUID | null;
10
+ /**
11
+ * Validates a room ID parameter
12
+ */
13
+ export declare const validateRoomId: (roomId: string) => UUID | null;
14
+ /**
15
+ * Enhanced channel ID validation with security logging
16
+ * Validates a channel ID parameter with additional security checks
17
+ */
18
+ export declare const validateChannelId: (channelId: string, clientIp?: string) => UUID | null;
19
+ /**
20
+ * Validates a memory ID parameter
21
+ */
22
+ export declare const validateMemoryId: (memoryId: string) => UUID | null;
23
+ /**
24
+ * Validates a world ID parameter
25
+ */
26
+ export declare const validateWorldId: (worldId: string) => UUID | null;
27
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/api/shared/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAGzD;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,QAAQ,GAAG,CAAC,IAAI,EAAE,aAAa,CAAC,EAAE,SAAS,IAAI,kBAMzE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,SAAS,MAAM,KAAG,IAAI,GAAG,IAExD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,IAAI,GAAG,IAEtD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,WAAW,MAAM,EAAE,WAAW,MAAM,KAAG,IAAI,GAAG,IAwB/E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,UAAU,MAAM,KAAG,IAAI,GAAG,IAE1D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,SAAS,MAAM,KAAG,IAAI,GAAG,IAExD,CAAC"}
@@ -0,0 +1,24 @@
1
+ import express from 'express';
2
+ export type EnvVars = Record<string, string>;
3
+ /**
4
+ * Parse an .env file and return the key-value pairs
5
+ * @param filePath Path to the .env file
6
+ * @returns Object containing the key-value pairs
7
+ */
8
+ export declare function parseEnvFile(filePath: string): Promise<EnvVars>;
9
+ /**
10
+ * Resolves the path to the nearest `.env` file.
11
+ *
12
+ * If no `.env` file is found when traversing up from the starting directory,
13
+ * a path to `.env` in the starting directory is returned.
14
+ *
15
+ * @param startDir - The directory to start searching from. Defaults to the
16
+ * current working directory.
17
+ * @returns The resolved path to the `.env` file.
18
+ */
19
+ export declare function resolveEnvFile(startDir?: string): string;
20
+ /**
21
+ * Environment configuration management
22
+ */
23
+ export declare function createEnvironmentRouter(): express.Router;
24
+ //# sourceMappingURL=environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../src/api/system/environment.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAM9B,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE7C;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAgBrE;AAaD;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,QAAQ,GAAE,MAAsB,GAAG,MAAM,CAiBvE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAgFxD"}
@@ -0,0 +1,6 @@
1
+ import express from 'express';
2
+ /**
3
+ * Creates the system router for configuration and environment management
4
+ */
5
+ export declare function systemRouter(): express.Router;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/system/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAI9B;;GAEG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAAC,MAAM,CAU7C"}
@@ -0,0 +1,6 @@
1
+ import express from 'express';
2
+ /**
3
+ * Creates the version router for system version information
4
+ */
5
+ export declare function createVersionRouter(): express.Router;
6
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/api/system/version.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAwC9B;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAYpD"}
@@ -0,0 +1,6 @@
1
+ import express from 'express';
2
+ /**
3
+ * Creates the security router for TEE and security operations
4
+ */
5
+ export declare function teeRouter(): express.Router;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/tee/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAG9B;;GAEG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAAC,MAAM,CAO1C"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=tee.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tee.d.ts","sourceRoot":"","sources":["../../../src/api/tee/tee.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { type Request, type Response, type NextFunction } from 'express';
2
+ /**
3
+ * Express middleware for validating API Key authentication based on an environment variable.
4
+ *
5
+ * If the ELIZA_SERVER_AUTH_TOKEN environment variable is set, this middleware
6
+ * checks for a matching 'X-API-KEY' header in incoming requests.
7
+ *
8
+ * If the environment variable is *not* set, the middleware allows all requests
9
+ * to pass through without authentication checks.
10
+ *
11
+ * @param req - Express request object.
12
+ * @param res - Express response object.
13
+ * @param next - Express next function.
14
+ */
15
+ export declare function apiKeyAuthMiddleware(req: Request, res: Response, next: NextFunction): void | Response<any, Record<string, any>>;
16
+ //# sourceMappingURL=authMiddleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authMiddleware.d.ts","sourceRoot":"","sources":["../src/authMiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAGzE;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,6CAsBnF"}
package/dist/bus.d.ts ADDED
@@ -0,0 +1,31 @@
1
+ /**
2
+ * A simple in-memory message bus for distributing messages from the server
3
+ * to subscribed MessageBusService instances within the same process.
4
+ *
5
+ * For multi-process or multi-server deployments, this would need to be replaced
6
+ * with a more robust solution like Redis Pub/Sub, Kafka, RabbitMQ, etc.
7
+ *
8
+ * Uses Bun-native EventTarget internally but maintains EventEmitter-like API.
9
+ *
10
+ * NOTE: This implementation uses a class extending EventTarget rather than functional
11
+ * patterns because EventTarget is a native browser/Bun API that requires class inheritance.
12
+ * This is an intentional architectural decision to leverage Bun's native capabilities
13
+ * instead of Node.js EventEmitter for better compatibility.
14
+ *
15
+ * NOTE: Unlike standard EventEmitter, this implementation prevents duplicate handler
16
+ * registration. This is an intentional design choice to prevent memory leaks and
17
+ * unintended multiple executions of the same handler.
18
+ */
19
+ declare class InternalMessageBus extends EventTarget {
20
+ private _maxListeners;
21
+ private handlers;
22
+ emit(event: string, data: unknown): boolean;
23
+ on(event: string, handler: (data: unknown) => void): this;
24
+ off(event: string, handler: (data: unknown) => void): void;
25
+ getMaxListeners(): number;
26
+ setMaxListeners(n: number): void;
27
+ removeAllListeners(event?: string): void;
28
+ }
29
+ declare const internalMessageBus: InternalMessageBus;
30
+ export default internalMessageBus;
31
+ //# sourceMappingURL=bus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bus.d.ts","sourceRoot":"","sources":["../src/bus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,cAAM,kBAAmB,SAAQ,WAAW;IAC1C,OAAO,CAAC,aAAa,CAAc;IACnC,OAAO,CAAC,QAAQ,CAAkE;IAElF,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO;IAI3C,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;IA6BzD,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI;IAenD,eAAe,IAAI,MAAM;IAIzB,eAAe,CAAC,CAAC,EAAE,MAAM;IAMzB,kBAAkB,CAAC,KAAK,CAAC,EAAE,MAAM;CAoBlC;AAED,QAAA,MAAM,kBAAkB,oBAA2B,CAAC;AAKpD,eAAe,kBAAkB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,215 +1,16 @@
1
- import { UUID, ChannelType, Character, DatabaseAdapter, IAgentRuntime } from '@elizaos/core';
1
+ import { type Character, DatabaseAdapter, type IAgentRuntime, type UUID } from '@elizaos/core';
2
2
  import express from 'express';
3
3
  import http from 'node:http';
4
- import { Server } from 'socket.io';
5
-
6
- /**
7
- * Metadata associated with a session
8
- */
9
- interface SessionMetadata {
10
- platform?: string;
11
- username?: string;
12
- discriminator?: string;
13
- avatar?: string;
14
- [key: string]: string | number | boolean | undefined;
15
- }
16
- /**
17
- * Represents a messaging session between a user and an agent
18
- */
19
- interface Session {
20
- id: string;
21
- agentId: UUID;
22
- channelId: UUID;
23
- userId: UUID;
24
- metadata: SessionMetadata;
25
- createdAt: Date;
26
- lastActivity: Date;
27
- }
28
- /**
29
- * Request body for creating a session
30
- */
31
- interface CreateSessionRequest {
32
- agentId: string;
33
- userId: string;
34
- metadata?: SessionMetadata;
35
- }
36
- /**
37
- * Response for session creation
38
- */
39
- interface CreateSessionResponse {
40
- sessionId: string;
41
- agentId: UUID;
42
- userId: UUID;
43
- createdAt: Date;
44
- metadata: SessionMetadata;
45
- }
46
- /**
47
- * Request body for sending a message
48
- */
49
- interface SendMessageRequest {
50
- content: string;
51
- attachments?: Array<{
52
- type: string;
53
- url: string;
54
- name?: string;
55
- }>;
56
- metadata?: Record<string, any>;
57
- }
58
- /**
59
- * Query parameters for retrieving messages
60
- */
61
- interface GetMessagesQuery {
62
- limit?: string;
63
- before?: string;
64
- after?: string;
65
- }
66
- /**
67
- * Simplified message format for API responses
68
- */
69
- interface SimplifiedMessage {
70
- id: string;
71
- content: string;
72
- authorId: string;
73
- isAgent: boolean;
74
- createdAt: Date;
75
- metadata: {
76
- thought?: string;
77
- actions?: string[];
78
- [key: string]: any;
79
- };
80
- }
81
- /**
82
- * Response for message retrieval
83
- */
84
- interface GetMessagesResponse {
85
- messages: SimplifiedMessage[];
86
- hasMore: boolean;
87
- }
88
- /**
89
- * Session info response
90
- */
91
- interface SessionInfoResponse {
92
- sessionId: string;
93
- agentId: UUID;
94
- userId: UUID;
95
- createdAt: Date;
96
- lastActivity: Date;
97
- metadata: SessionMetadata;
98
- }
99
- /**
100
- * Health check response
101
- */
102
- interface HealthCheckResponse {
103
- status: 'healthy' | 'unhealthy';
104
- activeSessions: number;
105
- timestamp: string;
106
- }
107
-
108
- interface MessageServer {
109
- id: UUID;
110
- name: string;
111
- sourceType: string;
112
- sourceId?: string;
113
- metadata?: Record<string, any>;
114
- createdAt: Date;
115
- updatedAt: Date;
116
- }
117
- interface MessageChannel {
118
- id: UUID;
119
- messageServerId: UUID;
120
- name: string;
121
- type: ChannelType;
122
- sourceType?: string;
123
- sourceId?: string;
124
- topic?: string;
125
- metadata?: Record<string, any>;
126
- createdAt: Date;
127
- updatedAt: Date;
128
- }
129
- interface CentralRootMessage {
130
- id: UUID;
131
- channelId: UUID;
132
- authorId: UUID;
133
- content: string;
134
- rawMessage?: any;
135
- inReplyToRootMessageId?: UUID;
136
- sourceType?: string;
137
- sourceId?: string;
138
- createdAt: Date;
139
- updatedAt: Date;
140
- metadata?: Record<string, any>;
141
- }
142
- interface MessageServiceStructure {
143
- id: UUID;
144
- channel_id: UUID;
145
- server_id: UUID;
146
- author_id: UUID;
147
- author_display_name?: string;
148
- content: string;
149
- raw_message?: any;
150
- source_id?: string;
151
- source_type?: string;
152
- in_reply_to_message_id?: UUID;
153
- created_at: number;
154
- metadata?: any;
155
- }
156
-
157
- /**
158
- * Attempts to load a file from the given file path.
159
- *
160
- * @param {string} filePath - The path to the file to load.
161
- * @returns {string | null} The contents of the file as a string, or null if an error occurred.
162
- * @throws {Error} If an error occurs while loading the file.
163
- */
164
- declare function tryLoadFile(filePath: string): string | null;
165
- /**
166
- * Load characters from a specified URL and return them as an array of Character objects.
167
- * @param {string} url - The URL from which to load character data.
168
- * @returns {Promise<Character[]>} - A promise that resolves with an array of Character objects.
169
- */
170
- declare function loadCharactersFromUrl(url: string): Promise<Character[]>;
171
- /**
172
- * Converts a JSON object representing a character into a validated Character object with additional settings and secrets.
173
- *
174
- * @param {unknown} character - The input data representing a character.
175
- * @returns {Promise<Character>} - A Promise that resolves to a validated Character object.
176
- * @throws {Error} If character validation fails.
177
- */
178
- declare function jsonToCharacter(character: unknown): Promise<Character>;
179
- /**
180
- * Loads a character from the specified file path with safe JSON parsing and validation.
181
- *
182
- * @param {string} filePath - The path to the character file.
183
- * @returns {Promise<Character>} A Promise that resolves to the validated Character object.
184
- * @throws {Error} If the character file is not found, has invalid JSON, or fails validation.
185
- */
186
- declare function loadCharacter(filePath: string): Promise<Character>;
187
- /**
188
- * Asynchronously loads a character from the specified path.
189
- * If the path is a URL, it loads the character from the URL.
190
- * If the path is a local file path, it tries multiple possible locations and
191
- * loads the character from the first valid location found.
192
- *
193
- * @param {string} characterPath - The path to load the character from.
194
- * @returns {Promise<Character>} A Promise that resolves to the loaded character.
195
- */
196
- declare function loadCharacterTryPath(characterPath: string): Promise<Character>;
197
- declare const hasValidRemoteUrls: () => boolean | "" | undefined;
198
- /**
199
- * Load characters from local paths or remote URLs based on configuration.
200
- * @param charactersArg - A comma-separated list of local file paths or remote URLs to load characters from.
201
- * @returns A promise that resolves to an array of loaded characters.
202
- */
203
- declare function loadCharacters(charactersArg: string): Promise<Character[]>;
204
-
4
+ import { Server as SocketIOServer } from 'socket.io';
5
+ import type { CentralRootMessage, MessageChannel, MessageServer } from './types.js';
205
6
  /**
206
7
  * Expands a file path starting with `~` to the project directory.
207
8
  *
208
9
  * @param filepath - The path to expand.
209
10
  * @returns The expanded path.
210
11
  */
211
- declare function expandTildePath(filepath: string): string;
212
- declare function resolvePgliteDir(dir?: string, fallbackDir?: string): string;
12
+ export declare function expandTildePath(filepath: string): string;
13
+ export declare function resolvePgliteDir(dir?: string, fallbackDir?: string): string;
213
14
  /**
214
15
  * Represents a function that acts as a server middleware.
215
16
  * @param {express.Request} req - The request object.
@@ -217,7 +18,7 @@ declare function resolvePgliteDir(dir?: string, fallbackDir?: string): string;
217
18
  * @param {express.NextFunction} next - The next function to be called in the middleware chain.
218
19
  * @returns {void}
219
20
  */
220
- type ServerMiddleware = (req: express.Request, res: express.Response, next: express.NextFunction) => void;
21
+ export type ServerMiddleware = (req: express.Request, res: express.Response, next: express.NextFunction) => void;
221
22
  /**
222
23
  * Interface for defining server configuration options.
223
24
  * @typedef {Object} ServerOptions
@@ -225,7 +26,7 @@ type ServerMiddleware = (req: express.Request, res: express.Response, next: expr
225
26
  * @property {string} [dataDir] - Optional directory for storing server data.
226
27
  * @property {string} [postgresUrl] - Optional URL for connecting to a PostgreSQL database.
227
28
  */
228
- interface ServerOptions {
29
+ export interface ServerOptions {
229
30
  middlewares?: ServerMiddleware[];
230
31
  dataDir?: string;
231
32
  postgresUrl?: string;
@@ -236,17 +37,17 @@ interface ServerOptions {
236
37
  *
237
38
  * @returns {boolean} - Returns true if UI should be enabled, false otherwise
238
39
  */
239
- declare function isWebUIEnabled(): boolean;
40
+ export declare function isWebUIEnabled(): boolean;
240
41
  /**
241
42
  * Class representing an agent server.
242
43
  */ /**
243
44
  * Represents an agent server which handles agents, database, and server functionalities.
244
45
  */
245
- declare class AgentServer {
46
+ export declare class AgentServer {
246
47
  app: express.Application;
247
48
  private agents;
248
49
  server: http.Server;
249
- socketIO: Server;
50
+ socketIO: SocketIOServer;
250
51
  isInitialized: boolean;
251
52
  private isWebUIEnabled;
252
53
  private clientPath?;
@@ -331,6 +132,14 @@ declare class AgentServer {
331
132
  findOrCreateCentralDmChannel(user1Id: UUID, user2Id: UUID, messageServerId: UUID): Promise<MessageChannel>;
332
133
  createMessage(data: Omit<CentralRootMessage, 'id' | 'createdAt' | 'updatedAt'>): Promise<CentralRootMessage>;
333
134
  getMessagesForChannel(channelId: UUID, limit?: number, beforeTimestamp?: Date): Promise<CentralRootMessage[]>;
135
+ updateMessage(messageId: UUID, patch: {
136
+ content?: string;
137
+ rawMessage?: any;
138
+ sourceType?: string;
139
+ sourceId?: string;
140
+ metadata?: any;
141
+ inReplyToRootMessageId?: UUID;
142
+ }): Promise<CentralRootMessage | null>;
334
143
  removeParticipantFromChannel(): Promise<void>;
335
144
  /**
336
145
  * Add an agent to a server
@@ -362,5 +171,6 @@ declare class AgentServer {
362
171
  */
363
172
  private registerSignalHandlers;
364
173
  }
365
-
366
- export { AgentServer, type CentralRootMessage, type CreateSessionRequest, type CreateSessionResponse, type GetMessagesQuery, type GetMessagesResponse, type HealthCheckResponse, type MessageChannel, type MessageServer, type MessageServiceStructure, type SendMessageRequest, type ServerMiddleware, type ServerOptions, type Session, type SessionInfoResponse, type SessionMetadata, type SimplifiedMessage, expandTildePath, hasValidRemoteUrls, isWebUIEnabled, jsonToCharacter, loadCharacter, loadCharacterTryPath, loadCharacters, loadCharactersFromUrl, resolvePgliteDir, tryLoadFile };
174
+ export { tryLoadFile, loadCharactersFromUrl, jsonToCharacter, loadCharacter, loadCharacterTryPath, hasValidRemoteUrls, loadCharacters, } from './loader';
175
+ export * from './types';
176
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EACd,eAAe,EACf,KAAK,aAAa,EAElB,KAAK,IAAI,EAEV,MAAM,eAAe,CAAC;AAEvB,OAAO,OAA8B,MAAM,SAAS,CAAC;AAGrD,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,WAAW,CAAC;AAYrD,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,aAAa,EAEd,MAAM,YAAY,CAAC;AAKpB;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAoBxD;AAED,wBAAgB,gBAAgB,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAqB3E;AAMD;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,C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