@elizaos/plugin-admin 1.5.2

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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,179 @@
1
+ # @elizaos/plugin-admin
2
+
3
+ > āš ļø **Secure by default** – The plugin is a no-op until admin privileges are explicitly unlocked by providing the correct `ADMIN_PASSWORD`.
4
+
5
+ A privileged plugin for ElizaOS that allows power-users to inspect and query **global** agent data that is normally sandboxed to the active room/channel.
6
+
7
+ ## Features
8
+
9
+ | Capability | Action | Description |
10
+ |------------|--------|-------------|
11
+ | Elevate privileges | `ELEVATE_PRIVILEGE` | Validate the admin password and unlock all other actions/providers |
12
+ | Daily activity report | `GLOBAL_REPORT` | Aggregate message counts per room for a given day |
13
+ | List all users | `LIST_ALL_USERS` | Returns every user the agent knows about |
14
+ | List all rooms | `LIST_ALL_ROOMS` | Returns all chat rooms/channels |
15
+ | Global message search | `SEARCH_MESSAGES` | Search across **all** messages globally |
16
+ | User audit | `USER_AUDIT` | Generate detailed activity report for a specific user |
17
+
18
+ Once unlocked, the `GLOBAL_CONTEXT` provider injects a rolling summary of the last 50 messages across every room into the LLM prompt, enabling holistic responses like "Summarise everything that happened today".
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ bun install @elizaos/plugin-admin
24
+ ```
25
+
26
+ Add the plugin to your agent's character file:
27
+
28
+ ```json
29
+ {
30
+ "name": "MyAgent",
31
+ "plugins": [
32
+ "@elizaos/plugin-bootstrap",
33
+ "@elizaos/plugin-admin"
34
+ ]
35
+ }
36
+ ```
37
+
38
+ ## Configuration
39
+
40
+ | Env Var | Required | Description |
41
+ |---------|----------|-------------|
42
+ | `ADMIN_PASSWORD` | **Yes** | The plaintext password that will grant admin privileges |
43
+
44
+ **Never** commit the password – store it in your project‐local `.env`.
45
+
46
+ ```env
47
+ ADMIN_PASSWORD=super-secret-value
48
+ ```
49
+
50
+ ## Usage
51
+
52
+ ### 1. Elevate privileges
53
+
54
+ When chatting with the agent:
55
+
56
+ ```
57
+ User → "Elevate my privileges to admin. Password: super-secret-value"
58
+ ```
59
+
60
+ The plugin will execute `ELEVATE_PRIVILEGE` automatically when it detects the pattern:
61
+
62
+ ```json
63
+ {
64
+ "action": "ELEVATE_PRIVILEGE",
65
+ "options": { "password": "super-secret-value" }
66
+ }
67
+ ```
68
+
69
+ On success, the agent responds:
70
+
71
+ ```
72
+ āœ… Admin privileges granted. You now have access to global commands.
73
+ ```
74
+
75
+ All subsequent admin actions & providers become available for the session's lifetime.
76
+
77
+ ### 2. Example queries
78
+
79
+ ```text
80
+ "Give me a global report for today." → GLOBAL_REPORT
81
+ "List all users." → LIST_ALL_USERS
82
+ "List all rooms." → LIST_ALL_ROOMS
83
+ "Search all messages for 'production outage'." → SEARCH_MESSAGES { query: "production outage" }
84
+ "Audit user abc123." → USER_AUDIT { userId: "abc123" }
85
+ ```
86
+
87
+ ## Actions
88
+
89
+ ### ELEVATE_PRIVILEGE
90
+ Unlock admin functionality by providing the correct password.
91
+ - Validates against `ADMIN_PASSWORD` environment variable
92
+ - Uses SHA-256 hashing for security
93
+ - Unlocks all other admin actions once validated
94
+
95
+ ### GLOBAL_REPORT
96
+ Generate a summary of all activity across rooms for a specific day.
97
+ - Shows total message count
98
+ - Lists activity per room
99
+ - Defaults to current day, or specify date in format YYYY-MM-DD
100
+
101
+ ### LIST_ALL_USERS
102
+ Returns all entities/users known to the agent.
103
+ - Shows entity IDs and names
104
+ - Limited to 20 in chat response (full data in response object)
105
+
106
+ ### LIST_ALL_ROOMS
107
+ Lists all rooms/channels the agent has participated in.
108
+ - Shows room names and IDs
109
+ - Includes source platform information
110
+
111
+ ### SEARCH_MESSAGES
112
+ Search for messages containing specific text across all rooms.
113
+ - Case-insensitive search
114
+ - Returns up to 10 matching messages with context
115
+ - Shows timestamp, room, and entity information
116
+
117
+ ### USER_AUDIT
118
+ Generate a detailed audit report for a specific user.
119
+ - Total message count and date range
120
+ - Room activity breakdown
121
+ - Recent message samples
122
+ - Requires user/entity ID
123
+
124
+ ## Global Context Provider
125
+
126
+ When admin privileges are unlocked, the `GLOBAL_CONTEXT` provider automatically injects:
127
+ - Summary of last 50 messages across all rooms
128
+ - Message counts per room
129
+ - Formatted for LLM context understanding
130
+
131
+ This enables the agent to answer questions like:
132
+ - "What happened across all chats today?"
133
+ - "Summarize the key discussions from all rooms"
134
+ - "Who has been most active today?"
135
+
136
+ ## Security Considerations
137
+
138
+ 1. **Password Hashing** – The plugin only stores a SHA-256 hash in memory. The plaintext password never leaves `process.env`.
139
+ 2. **Session-based** – Admin privileges are granted per runtime session. Restarting the agent requires re-authentication.
140
+ 3. **Read-only** – Current actions are *read* queries. If you add write operations, double-check permissions.
141
+ 4. **Audit logs** – Consider emitting events whenever an admin action runs to keep an audit trail.
142
+
143
+ ## Database Schema
144
+
145
+ The plugin uses ElizaOS's standard database interface and expects:
146
+ - `memories` table for messages
147
+ - `entities` table for users
148
+ - `rooms` table for channels/rooms
149
+
150
+ No custom SQL or schema modifications are required.
151
+
152
+ ## Development
153
+
154
+ ```bash
155
+ # Install dependencies
156
+ bun install
157
+
158
+ # Build the plugin
159
+ bun run build
160
+
161
+ # Run tests
162
+ bun run test
163
+
164
+ # Development mode with watch
165
+ bun run dev
166
+ ```
167
+
168
+ ## Contributing
169
+
170
+ When adding new admin actions:
171
+ 1. Create action in `src/actions/`
172
+ 2. Check admin privileges in validate & handler
173
+ 3. Use proper ElizaOS database methods (not raw SQL)
174
+ 4. Add comprehensive examples
175
+ 5. Update this README
176
+
177
+ ## License
178
+
179
+ Apache-2.0
@@ -0,0 +1,31 @@
1
+ import { Service, IAgentRuntime, Plugin } from '@elizaos/core';
2
+
3
+ /**
4
+ * AdminService manages the unlocked state for admin privileges once the correct
5
+ * password is provided via the `ELEVATE_PRIVILEGE` action.
6
+ */
7
+ declare class AdminService extends Service {
8
+ static serviceType: string;
9
+ private unlocked;
10
+ private readonly passwordHash;
11
+ capabilityDescription: string;
12
+ constructor(runtime?: IAgentRuntime);
13
+ /**
14
+ * Static method to start the service
15
+ */
16
+ static start(runtime: IAgentRuntime): Promise<Service>;
17
+ /**
18
+ * Stop the service
19
+ */
20
+ stop(): Promise<void>;
21
+ /**
22
+ * Attempt to unlock with the provided password.
23
+ * Returns true on success, false otherwise.
24
+ */
25
+ unlock(password: string): boolean;
26
+ isUnlocked(): boolean;
27
+ }
28
+
29
+ declare const adminPlugin: Plugin;
30
+
31
+ export { AdminService, adminPlugin };
package/dist/index.mjs ADDED
@@ -0,0 +1,718 @@
1
+ // src/services/admin.ts
2
+ import { Service } from "@elizaos/core";
3
+ import crypto from "crypto";
4
+ var _AdminService = class _AdminService extends Service {
5
+ constructor(runtime) {
6
+ super(runtime);
7
+ this.unlocked = false;
8
+ this.capabilityDescription = "Admin privilege management service";
9
+ if (!runtime) {
10
+ throw new Error("AdminService requires runtime");
11
+ }
12
+ const pwd = runtime.getSetting("ADMIN_PASSWORD");
13
+ if (!pwd) {
14
+ runtime.logger.warn(
15
+ "[plugin-admin] ADMIN_PASSWORD environment variable is not set. Elevation will always fail."
16
+ );
17
+ }
18
+ this.passwordHash = pwd ? crypto.createHash("sha256").update(pwd).digest("hex") : "";
19
+ }
20
+ /**
21
+ * Static method to start the service
22
+ */
23
+ static async start(runtime) {
24
+ return new _AdminService(runtime);
25
+ }
26
+ /**
27
+ * Stop the service
28
+ */
29
+ async stop() {
30
+ this.unlocked = false;
31
+ }
32
+ /**
33
+ * Attempt to unlock with the provided password.
34
+ * Returns true on success, false otherwise.
35
+ */
36
+ unlock(password) {
37
+ if (this.unlocked) return true;
38
+ const hash = crypto.createHash("sha256").update(password).digest("hex");
39
+ if (hash === this.passwordHash && this.passwordHash) {
40
+ this.unlocked = true;
41
+ this.runtime.logger.info("[plugin-admin] Admin privileges unlocked.");
42
+ return true;
43
+ }
44
+ return false;
45
+ }
46
+ isUnlocked() {
47
+ return this.unlocked;
48
+ }
49
+ };
50
+ _AdminService.serviceType = "ADMIN_SERVICE";
51
+ var AdminService = _AdminService;
52
+
53
+ // src/actions/elevatePrivilege.ts
54
+ import { z } from "zod";
55
+ var paramsSchema = z.object({
56
+ password: z.string().describe("The admin password")
57
+ });
58
+ var elevatePrivilegeAction = {
59
+ name: "ELEVATE_PRIVILEGE",
60
+ description: "Elevate your privileges to admin by providing the admin password.",
61
+ examples: [
62
+ [
63
+ {
64
+ name: "user",
65
+ content: { text: "Elevate my privileges to admin. Password: super-secret-123" }
66
+ },
67
+ {
68
+ name: "assistant",
69
+ content: { text: "Admin privileges granted." }
70
+ }
71
+ ]
72
+ ],
73
+ validate: async (runtime, message, state) => {
74
+ const text = message.content?.text?.toLowerCase() || "";
75
+ return text.includes("elevate") && (text.includes("admin") || text.includes("privilege"));
76
+ },
77
+ handler: async (runtime, message, state) => {
78
+ const text = message.content?.text || "";
79
+ const passwordMatch = text.match(/password:\s*(\S+)/i);
80
+ if (!passwordMatch) {
81
+ return {
82
+ text: 'Please provide the admin password in the format: "password: YOUR_PASSWORD"',
83
+ success: false
84
+ };
85
+ }
86
+ const password = passwordMatch[1];
87
+ const service = runtime.getService("ADMIN_SERVICE");
88
+ if (!service) {
89
+ return {
90
+ text: "Admin service not available.",
91
+ success: false
92
+ };
93
+ }
94
+ const success = service.unlock(password);
95
+ return {
96
+ text: success ? "\u2705 Admin privileges granted. You now have access to global commands." : "\u274C Invalid password. Admin privileges denied.",
97
+ success
98
+ };
99
+ }
100
+ };
101
+
102
+ // src/actions/globalReport.ts
103
+ var globalReportAction = {
104
+ name: "GLOBAL_REPORT",
105
+ description: "Generate a summary report of activity across all rooms for a given day",
106
+ examples: [
107
+ [
108
+ {
109
+ name: "user",
110
+ content: { text: "Give me a global report for today" }
111
+ },
112
+ {
113
+ name: "assistant",
114
+ content: {
115
+ text: "Daily Report:\n\u{1F4CA} Total Messages: 142\n\u{1F3E0} Active Rooms: 5\n\nTop Rooms:\n1. general (45 messages)\n2. dev-chat (38 messages)\n3. support (25 messages)"
116
+ }
117
+ }
118
+ ]
119
+ ],
120
+ validate: async (runtime, message, state) => {
121
+ const admin = runtime.getService("ADMIN_SERVICE");
122
+ if (!admin || !admin.isUnlocked()) return false;
123
+ const text = message.content?.text?.toLowerCase() || "";
124
+ return text.includes("report") && (text.includes("global") || text.includes("daily") || text.includes("today"));
125
+ },
126
+ handler: async (runtime, message, state) => {
127
+ const admin = runtime.getService("ADMIN_SERVICE");
128
+ if (!admin || !admin.isUnlocked()) {
129
+ return {
130
+ text: "\u274C Admin privileges required for global reports.",
131
+ success: false
132
+ };
133
+ }
134
+ try {
135
+ const text = message.content?.text || "";
136
+ let date = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
137
+ const dateMatch = text.match(/(\d{4}-\d{2}-\d{2})/);
138
+ if (dateMatch) {
139
+ date = dateMatch[1];
140
+ }
141
+ const startTime = new Date(date).getTime();
142
+ const endTime = startTime + 24 * 60 * 60 * 1e3;
143
+ const memories = await runtime.getMemories({
144
+ tableName: "memories",
145
+ agentId: runtime.agentId,
146
+ start: startTime,
147
+ end: endTime
148
+ });
149
+ const roomStats = /* @__PURE__ */ new Map();
150
+ for (const memory of memories) {
151
+ roomStats.set(memory.roomId, (roomStats.get(memory.roomId) || 0) + 1);
152
+ }
153
+ const roomIds = Array.from(roomStats.keys());
154
+ const rooms = await runtime.getRoomsByIds(roomIds);
155
+ const roomMap = new Map(rooms?.map((r) => [r.id, r]) || []);
156
+ const topRooms = Array.from(roomStats.entries()).map(([roomId, count]) => ({
157
+ roomId,
158
+ roomName: roomMap.get(roomId)?.name || `Room ${roomId.slice(0, 8)}`,
159
+ count
160
+ })).sort((a, b) => b.count - a.count).slice(0, 5);
161
+ let reportText = `\u{1F4CA} **Daily Report for ${date}**
162
+
163
+ `;
164
+ reportText += `**Summary:**
165
+ `;
166
+ reportText += `\u2022 Total Messages: ${memories.length}
167
+ `;
168
+ reportText += `\u2022 Active Rooms: ${roomStats.size}
169
+
170
+ `;
171
+ if (topRooms.length > 0) {
172
+ reportText += `**Top ${topRooms.length} Most Active Rooms:**
173
+ `;
174
+ topRooms.forEach((room, idx) => {
175
+ reportText += `${idx + 1}. ${room.roomName} (${room.count} messages)
176
+ `;
177
+ });
178
+ } else {
179
+ reportText += `No activity found for this date.
180
+ `;
181
+ }
182
+ return {
183
+ text: reportText,
184
+ data: {
185
+ date,
186
+ totalMessages: memories.length,
187
+ totalRooms: roomStats.size,
188
+ topRooms
189
+ },
190
+ success: true
191
+ };
192
+ } catch (error) {
193
+ runtime.logger.error("[plugin-admin] Error in globalReport:", error);
194
+ return {
195
+ text: "\u274C Error generating report. Please check the logs.",
196
+ success: false
197
+ };
198
+ }
199
+ }
200
+ };
201
+
202
+ // src/actions/listAllUsers.ts
203
+ var listAllUsersAction = {
204
+ name: "LIST_ALL_USERS",
205
+ description: "Return a list of all users/entities known to the agent globally.",
206
+ examples: [
207
+ [
208
+ {
209
+ name: "user",
210
+ content: { text: "List all users" }
211
+ },
212
+ {
213
+ name: "assistant",
214
+ content: {
215
+ text: "Found 12 users:\n\n1. Alice - ID: abc123...\n2. Bob - ID: def456...\n3. Charlie - ID: ghi789..."
216
+ }
217
+ }
218
+ ]
219
+ ],
220
+ validate: async (runtime, message, state) => {
221
+ const admin = runtime.getService("ADMIN_SERVICE");
222
+ if (!admin || !admin.isUnlocked()) return false;
223
+ const text = message.content?.text?.toLowerCase() || "";
224
+ return (text.includes("list") || text.includes("show")) && (text.includes("users") || text.includes("entities") || text.includes("everyone"));
225
+ },
226
+ handler: async (runtime, message, state) => {
227
+ const admin = runtime.getService("ADMIN_SERVICE");
228
+ if (!admin || !admin.isUnlocked()) {
229
+ return {
230
+ text: "\u274C Admin privileges required to list users.",
231
+ success: false
232
+ };
233
+ }
234
+ try {
235
+ const memories = await runtime.getMemories({
236
+ tableName: "memories",
237
+ agentId: runtime.agentId,
238
+ count: 1e3
239
+ // Get more to ensure we capture all unique users
240
+ });
241
+ const entityIds = /* @__PURE__ */ new Set();
242
+ for (const memory of memories) {
243
+ if (memory.entityId && memory.entityId !== runtime.agentId) {
244
+ entityIds.add(memory.entityId);
245
+ }
246
+ }
247
+ const entities = await runtime.getEntitiesByIds(Array.from(entityIds));
248
+ if (!entities || entities.length === 0) {
249
+ return {
250
+ text: "No users found in the system.",
251
+ success: true
252
+ };
253
+ }
254
+ let responseText = `\u{1F465} **Found ${entities.length} users:**
255
+
256
+ `;
257
+ entities.slice(0, 20).forEach((entity, idx) => {
258
+ const primaryName = entity.names?.[0] || "Unknown";
259
+ const id = entity.id || "no-id";
260
+ responseText += `${idx + 1}. **${primaryName}** - ID: ${id.slice(0, 8)}...
261
+ `;
262
+ });
263
+ if (entities.length > 20) {
264
+ responseText += `
265
+ ... and ${entities.length - 20} more users.`;
266
+ }
267
+ return {
268
+ text: responseText,
269
+ data: {
270
+ totalUsers: entities.length,
271
+ users: entities.map((e) => ({
272
+ id: e.id,
273
+ names: e.names || [],
274
+ metadata: e.metadata || {}
275
+ }))
276
+ },
277
+ success: true
278
+ };
279
+ } catch (error) {
280
+ runtime.logger.error("[plugin-admin] Error in listAllUsers:", error);
281
+ return {
282
+ text: "\u274C Error fetching users. Please check the logs.",
283
+ success: false
284
+ };
285
+ }
286
+ }
287
+ };
288
+
289
+ // src/actions/listAllRooms.ts
290
+ var listAllRoomsAction = {
291
+ name: "LIST_ALL_ROOMS",
292
+ description: "Return a list of all chat rooms/channels known to the agent globally.",
293
+ examples: [
294
+ [
295
+ {
296
+ name: "user",
297
+ content: { text: "List all rooms" }
298
+ },
299
+ {
300
+ name: "assistant",
301
+ content: {
302
+ text: "Found 5 rooms:\n\n1. general - ID: abc123...\n2. dev-chat - ID: def456...\n3. support - ID: ghi789..."
303
+ }
304
+ }
305
+ ]
306
+ ],
307
+ validate: async (runtime, message, state) => {
308
+ const admin = runtime.getService("ADMIN_SERVICE");
309
+ if (!admin || !admin.isUnlocked()) return false;
310
+ const text = message.content?.text?.toLowerCase() || "";
311
+ return (text.includes("list") || text.includes("show")) && (text.includes("rooms") || text.includes("channels"));
312
+ },
313
+ handler: async (runtime, message, state) => {
314
+ const admin = runtime.getService("ADMIN_SERVICE");
315
+ if (!admin || !admin.isUnlocked()) {
316
+ return {
317
+ text: "\u274C Admin privileges required to list rooms.",
318
+ success: false
319
+ };
320
+ }
321
+ try {
322
+ const memories = await runtime.getMemories({
323
+ tableName: "memories",
324
+ agentId: runtime.agentId,
325
+ count: 1e3
326
+ });
327
+ const roomIds = /* @__PURE__ */ new Set();
328
+ for (const memory of memories) {
329
+ if (memory.roomId) {
330
+ roomIds.add(memory.roomId);
331
+ }
332
+ }
333
+ const rooms = await runtime.getRoomsByIds(Array.from(roomIds));
334
+ if (!rooms || rooms.length === 0) {
335
+ return {
336
+ text: "No rooms found in the system.",
337
+ success: true
338
+ };
339
+ }
340
+ let responseText = `\u{1F3E0} **Found ${rooms.length} rooms:**
341
+
342
+ `;
343
+ rooms.slice(0, 20).forEach((room, idx) => {
344
+ const roomName = room.name || `Room ${room.id.slice(0, 8)}`;
345
+ responseText += `${idx + 1}. **${roomName}** - ID: ${room.id.slice(0, 8)}...
346
+ `;
347
+ if (room.source) {
348
+ responseText += ` Source: ${room.source}
349
+ `;
350
+ }
351
+ });
352
+ if (rooms.length > 20) {
353
+ responseText += `
354
+ ... and ${rooms.length - 20} more rooms.`;
355
+ }
356
+ return {
357
+ text: responseText,
358
+ data: {
359
+ totalRooms: rooms.length,
360
+ rooms: rooms.map((r) => ({
361
+ id: r.id,
362
+ name: r.name || null,
363
+ source: r.source,
364
+ type: r.type,
365
+ metadata: r.metadata || {}
366
+ }))
367
+ },
368
+ success: true
369
+ };
370
+ } catch (error) {
371
+ runtime.logger.error("[plugin-admin] Error in listAllRooms:", error);
372
+ return {
373
+ text: "\u274C Error fetching rooms. Please check the logs.",
374
+ success: false
375
+ };
376
+ }
377
+ }
378
+ };
379
+
380
+ // src/actions/searchMessages.ts
381
+ var searchMessagesAction = {
382
+ name: "SEARCH_MESSAGES",
383
+ description: "Search for messages across all rooms globally.",
384
+ examples: [
385
+ [
386
+ {
387
+ name: "user",
388
+ content: { text: 'Search all messages for "production outage"' }
389
+ },
390
+ {
391
+ name: "assistant",
392
+ content: {
393
+ text: `Found 3 messages matching "production outage":
394
+
395
+ 1. [2024-01-15 14:32] Entity abc123: "We have a production outage affecting the API"
396
+ 2. [2024-01-15 14:35] Entity def456: "I'm investigating the production outage now"`
397
+ }
398
+ }
399
+ ]
400
+ ],
401
+ validate: async (runtime, message, state) => {
402
+ const admin = runtime.getService("ADMIN_SERVICE");
403
+ if (!admin || !admin.isUnlocked()) return false;
404
+ const text = message.content?.text?.toLowerCase() || "";
405
+ return text.includes("search") && (text.includes("message") || text.includes("all"));
406
+ },
407
+ handler: async (runtime, message, state) => {
408
+ const admin = runtime.getService("ADMIN_SERVICE");
409
+ if (!admin || !admin.isUnlocked()) {
410
+ return {
411
+ text: "\u274C Admin privileges required for global search.",
412
+ success: false
413
+ };
414
+ }
415
+ try {
416
+ const text = message.content?.text || "";
417
+ const queryMatch = text.match(/search\s+(?:all\s+)?(?:messages?\s+)?(?:for\s+)?["']?([^"']+)["']?/i);
418
+ if (!queryMatch) {
419
+ return {
420
+ text: 'Please specify what to search for. Example: "Search all messages for production issue"',
421
+ success: false
422
+ };
423
+ }
424
+ const searchQuery = queryMatch[1].trim();
425
+ const memories = await runtime.getMemories({
426
+ tableName: "memories",
427
+ agentId: runtime.agentId,
428
+ count: 500
429
+ });
430
+ const searchLower = searchQuery.toLowerCase();
431
+ const matches = memories.filter(
432
+ (mem) => mem.content?.text?.toLowerCase().includes(searchLower)
433
+ );
434
+ if (matches.length === 0) {
435
+ return {
436
+ text: `No messages found containing "${searchQuery}"`,
437
+ success: true
438
+ };
439
+ }
440
+ matches.sort((a, b) => (b.createdAt || 0) - (a.createdAt || 0));
441
+ const roomIds = [...new Set(matches.map((m) => m.roomId))];
442
+ const rooms = await runtime.getRoomsByIds(roomIds);
443
+ const roomMap = new Map(rooms?.map((r) => [r.id, r]) || []);
444
+ let responseText = `\u{1F50D} **Found ${matches.length} messages matching "${searchQuery}":**
445
+
446
+ `;
447
+ matches.slice(0, 10).forEach((match, idx) => {
448
+ const timestamp = match.createdAt ? new Date(match.createdAt).toISOString().replace("T", " ").slice(0, 16) : "Unknown time";
449
+ const roomName = roomMap.get(match.roomId)?.name || `Room ${match.roomId.slice(0, 8)}`;
450
+ const text2 = match.content?.text || "[No text]";
451
+ const preview = text2.length > 100 ? text2.slice(0, 100) + "..." : text2;
452
+ responseText += `${idx + 1}. **[${timestamp}]** in ${roomName}
453
+ `;
454
+ responseText += ` Entity ${match.entityId.slice(0, 8)}: "${preview}"
455
+
456
+ `;
457
+ });
458
+ if (matches.length > 10) {
459
+ responseText += `... and ${matches.length - 10} more messages.`;
460
+ }
461
+ return {
462
+ text: responseText,
463
+ data: {
464
+ query: searchQuery,
465
+ totalResults: matches.length,
466
+ results: matches.slice(0, 20).map((m) => ({
467
+ id: m.id,
468
+ roomId: m.roomId,
469
+ entityId: m.entityId,
470
+ content: m.content,
471
+ createdAt: m.createdAt
472
+ }))
473
+ },
474
+ success: true
475
+ };
476
+ } catch (error) {
477
+ runtime.logger.error("[plugin-admin] Error in searchMessages:", error);
478
+ return {
479
+ text: "\u274C Error searching messages. Please check the logs.",
480
+ success: false
481
+ };
482
+ }
483
+ }
484
+ };
485
+
486
+ // src/actions/userAudit.ts
487
+ var userAuditAction = {
488
+ name: "USER_AUDIT",
489
+ description: "Generate a detailed audit report for a specific user/entity.",
490
+ examples: [
491
+ [
492
+ {
493
+ name: "user",
494
+ content: { text: "Audit user abc123" }
495
+ },
496
+ {
497
+ name: "assistant",
498
+ content: {
499
+ text: "User Audit Report:\n\n**Entity ID:** abc123...\n**First Seen:** 2024-01-15 10:30\n**Total Messages:** 45\n**Active Rooms:** 3\n**Most Active:** general (25 messages)"
500
+ }
501
+ }
502
+ ]
503
+ ],
504
+ validate: async (runtime, message, state) => {
505
+ const admin = runtime.getService("ADMIN_SERVICE");
506
+ if (!admin || !admin.isUnlocked()) return false;
507
+ const text = message.content?.text?.toLowerCase() || "";
508
+ return text.includes("audit") && (text.includes("user") || text.includes("entity"));
509
+ },
510
+ handler: async (runtime, message, state) => {
511
+ const admin = runtime.getService("ADMIN_SERVICE");
512
+ if (!admin || !admin.isUnlocked()) {
513
+ return {
514
+ text: "\u274C Admin privileges required for user audits.",
515
+ success: false
516
+ };
517
+ }
518
+ try {
519
+ const text = message.content?.text || "";
520
+ const idMatch = text.match(/(?:audit\s+(?:user|entity)\s+)?([a-f0-9-]{8,})/i);
521
+ if (!idMatch) {
522
+ return {
523
+ text: 'Please specify a user ID to audit. Example: "Audit user abc123"',
524
+ success: false
525
+ };
526
+ }
527
+ const userId = idMatch[1];
528
+ const allMemories = await runtime.getMemories({
529
+ tableName: "memories",
530
+ agentId: runtime.agentId,
531
+ count: 1e3
532
+ });
533
+ const memories = allMemories.filter((m) => m.entityId === userId);
534
+ if (!memories.length) {
535
+ return {
536
+ text: `No activity found for user ${userId}`,
537
+ success: true
538
+ };
539
+ }
540
+ const entities = await runtime.getEntitiesByIds([userId]);
541
+ const entity = entities?.[0];
542
+ const roomActivity = /* @__PURE__ */ new Map();
543
+ let firstSeen = Infinity;
544
+ let lastSeen = 0;
545
+ for (const memory of memories) {
546
+ const timestamp = memory.createdAt || 0;
547
+ if (timestamp < firstSeen) firstSeen = timestamp;
548
+ if (timestamp > lastSeen) lastSeen = timestamp;
549
+ roomActivity.set(memory.roomId, (roomActivity.get(memory.roomId) || 0) + 1);
550
+ }
551
+ const roomIds = Array.from(roomActivity.keys());
552
+ const rooms = await runtime.getRoomsByIds(roomIds);
553
+ const roomMap = new Map(rooms?.map((r) => [r.id, r]) || []);
554
+ const topRooms = Array.from(roomActivity.entries()).map(([roomId, count]) => ({
555
+ roomId,
556
+ roomName: roomMap.get(roomId)?.name || `Room ${roomId.slice(0, 8)}`,
557
+ count
558
+ })).sort((a, b) => b.count - a.count);
559
+ let reportText = `\u{1F4CA} **User Audit Report**
560
+
561
+ `;
562
+ reportText += `**Entity ID:** ${userId}
563
+ `;
564
+ reportText += `**Name(s):** ${entity?.names?.join(", ") || "Unknown"}
565
+ `;
566
+ reportText += `**First Seen:** ${new Date(firstSeen).toISOString()}
567
+ `;
568
+ reportText += `**Last Seen:** ${new Date(lastSeen).toISOString()}
569
+ `;
570
+ reportText += `**Total Messages:** ${memories.length}
571
+ `;
572
+ reportText += `**Active Rooms:** ${roomActivity.size}
573
+
574
+ `;
575
+ reportText += `**Room Activity:**
576
+ `;
577
+ topRooms.slice(0, 5).forEach((room, idx) => {
578
+ reportText += `${idx + 1}. ${room.roomName} (${room.count} messages)
579
+ `;
580
+ });
581
+ reportText += `
582
+ **Recent Messages:**
583
+ `;
584
+ memories.slice(0, 5).forEach((msg, idx) => {
585
+ const timestamp = new Date(msg.createdAt || 0).toISOString().slice(0, 16);
586
+ const text2 = msg.content?.text || "[No text]";
587
+ const preview = text2.length > 80 ? text2.slice(0, 80) + "..." : text2;
588
+ reportText += `${idx + 1}. [${timestamp}] "${preview}"
589
+ `;
590
+ });
591
+ return {
592
+ text: reportText,
593
+ data: {
594
+ userId,
595
+ entity,
596
+ totalMessages: memories.length,
597
+ firstSeen: new Date(firstSeen).toISOString(),
598
+ lastSeen: new Date(lastSeen).toISOString(),
599
+ roomActivity: topRooms
600
+ },
601
+ success: true
602
+ };
603
+ } catch (error) {
604
+ runtime.logger.error("[plugin-admin] Error in userAudit:", error);
605
+ return {
606
+ text: "\u274C Error generating user audit. Please check the logs.",
607
+ success: false
608
+ };
609
+ }
610
+ }
611
+ };
612
+
613
+ // src/providers/globalContext.ts
614
+ var globalContextProvider = {
615
+ name: "GLOBAL_CONTEXT",
616
+ description: "Provides a high-level summary of all recent events across all rooms when admin is unlocked.",
617
+ dynamic: true,
618
+ private: true,
619
+ // Only accessible when admin is unlocked
620
+ get: async (runtime, message, state) => {
621
+ const admin = runtime.getService("ADMIN_SERVICE");
622
+ if (!admin || !admin.isUnlocked()) {
623
+ return {
624
+ values: {},
625
+ data: {},
626
+ text: ""
627
+ };
628
+ }
629
+ try {
630
+ const memories = await runtime.getMemories({
631
+ tableName: "memories",
632
+ count: 50,
633
+ agentId: runtime.agentId
634
+ });
635
+ if (!memories.length) {
636
+ return {
637
+ values: {
638
+ globalMessageCount: 0,
639
+ globalRoomCount: 0
640
+ },
641
+ data: {
642
+ messages: []
643
+ },
644
+ text: "No recent messages found across all rooms."
645
+ };
646
+ }
647
+ const roomMessages = /* @__PURE__ */ new Map();
648
+ for (const msg of memories) {
649
+ if (!roomMessages.has(msg.roomId)) {
650
+ roomMessages.set(msg.roomId, []);
651
+ }
652
+ roomMessages.get(msg.roomId).push(msg);
653
+ }
654
+ let summary = `Global Activity Summary (${memories.length} recent messages across ${roomMessages.size} rooms):
655
+
656
+ `;
657
+ for (const [roomId, msgs] of roomMessages) {
658
+ const roomInfo = await runtime.getRoomsByIds([roomId]);
659
+ const roomName = roomInfo?.[0]?.name || `Room ${roomId.slice(0, 8)}`;
660
+ summary += `=== ${roomName} (${msgs.length} messages) ===
661
+ `;
662
+ for (const msg of msgs.slice(0, 5)) {
663
+ const timestamp = new Date(msg.createdAt || 0).toISOString();
664
+ const text = msg.content?.text || "[No text]";
665
+ summary += `[${timestamp}] Entity ${msg.entityId.slice(0, 8)}: ${text.slice(0, 100)}${text.length > 100 ? "..." : ""}
666
+ `;
667
+ }
668
+ if (msgs.length > 5) {
669
+ summary += `... and ${msgs.length - 5} more messages
670
+ `;
671
+ }
672
+ summary += "\n";
673
+ }
674
+ return {
675
+ values: {
676
+ globalMessageCount: memories.length,
677
+ globalRoomCount: roomMessages.size
678
+ },
679
+ data: {
680
+ recentGlobalMessages: memories.slice(0, 10),
681
+ roomsSummary: Array.from(roomMessages.entries()).map(([roomId, msgs]) => ({
682
+ roomId,
683
+ messageCount: msgs.length
684
+ }))
685
+ },
686
+ text: summary
687
+ };
688
+ } catch (error) {
689
+ runtime.logger.error("[plugin-admin] Error in globalContextProvider:", error);
690
+ return {
691
+ values: {},
692
+ data: {},
693
+ text: "Error fetching global context."
694
+ };
695
+ }
696
+ }
697
+ };
698
+
699
+ // src/index.ts
700
+ var adminPlugin = {
701
+ name: "@elizaos/plugin-admin",
702
+ description: "Provides privileged administrative actions and global context providers once unlocked via an admin password.",
703
+ services: [AdminService],
704
+ actions: [
705
+ elevatePrivilegeAction,
706
+ globalReportAction,
707
+ listAllUsersAction,
708
+ listAllRoomsAction,
709
+ searchMessagesAction,
710
+ userAuditAction
711
+ ],
712
+ providers: [globalContextProvider]
713
+ };
714
+ export {
715
+ AdminService,
716
+ adminPlugin
717
+ };
718
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/services/admin.ts","../src/actions/elevatePrivilege.ts","../src/actions/globalReport.ts","../src/actions/listAllUsers.ts","../src/actions/listAllRooms.ts","../src/actions/searchMessages.ts","../src/actions/userAudit.ts","../src/providers/globalContext.ts","../src/index.ts"],"sourcesContent":["import { IAgentRuntime, Service } from '@elizaos/core';\nimport crypto from 'crypto';\n\n/**\n * AdminService manages the unlocked state for admin privileges once the correct\n * password is provided via the `ELEVATE_PRIVILEGE` action.\n */\nexport class AdminService extends Service {\n static serviceType = 'ADMIN_SERVICE';\n \n private unlocked = false;\n private readonly passwordHash: string;\n\n capabilityDescription = 'Admin privilege management service';\n\n constructor(runtime?: IAgentRuntime) {\n super(runtime);\n if (!runtime) {\n throw new Error('AdminService requires runtime');\n }\n \n const pwd = runtime.getSetting('ADMIN_PASSWORD');\n if (!pwd) {\n runtime.logger.warn(\n '[plugin-admin] ADMIN_PASSWORD environment variable is not set. Elevation will always fail.'\n );\n }\n // Store SHA-256 hash for comparison\n this.passwordHash = pwd ? crypto.createHash('sha256').update(pwd).digest('hex') : '';\n }\n\n /**\n * Static method to start the service\n */\n static async start(runtime: IAgentRuntime): Promise<Service> {\n return new AdminService(runtime);\n }\n\n /**\n * Stop the service\n */\n async stop(): Promise<void> {\n this.unlocked = false;\n }\n\n /**\n * Attempt to unlock with the provided password.\n * Returns true on success, false otherwise.\n */\n public unlock(password: string): boolean {\n if (this.unlocked) return true;\n const hash = crypto.createHash('sha256').update(password).digest('hex');\n if (hash === this.passwordHash && this.passwordHash) {\n this.unlocked = true;\n this.runtime.logger.info('[plugin-admin] Admin privileges unlocked.');\n return true;\n }\n return false;\n }\n\n public isUnlocked(): boolean {\n return this.unlocked;\n }\n} ","import { Action, Memory, State } from '@elizaos/core';\nimport { AdminService } from '../services/admin';\nimport { z } from 'zod';\n\nconst paramsSchema = z.object({\n password: z.string().describe('The admin password'),\n});\n\n/**\n * Elevate privileges by providing the ADMIN_PASSWORD value. If successful, the\n * AdminService is unlocked enabling all other admin actions & providers.\n */\nexport const elevatePrivilegeAction: Action = {\n name: 'ELEVATE_PRIVILEGE',\n description: 'Elevate your privileges to admin by providing the admin password.',\n examples: [\n [\n { \n name: 'user', \n content: { text: 'Elevate my privileges to admin. Password: super-secret-123' } \n },\n { \n name: 'assistant', \n content: { text: 'Admin privileges granted.' } \n }\n ]\n ],\n validate: async (runtime, message: Memory, state?: State) => {\n // Check if message contains \"elevate\" and \"admin\" keywords\n const text = message.content?.text?.toLowerCase() || '';\n return text.includes('elevate') && (text.includes('admin') || text.includes('privilege'));\n },\n handler: async (runtime, message: Memory, state?: State) => {\n const text = message.content?.text || '';\n \n // Extract password from message - look for \"password:\" pattern\n const passwordMatch = text.match(/password:\\s*(\\S+)/i);\n if (!passwordMatch) {\n return {\n text: 'Please provide the admin password in the format: \"password: YOUR_PASSWORD\"',\n success: false\n };\n }\n\n const password = passwordMatch[1];\n const service = runtime.getService<AdminService>('ADMIN_SERVICE');\n \n if (!service) {\n return {\n text: 'Admin service not available.',\n success: false\n };\n }\n\n const success = service.unlock(password);\n \n return {\n text: success \n ? 'āœ… Admin privileges granted. You now have access to global commands.' \n : 'āŒ Invalid password. Admin privileges denied.',\n success\n };\n },\n}; ","import { Action, Memory, State, UUID } from '@elizaos/core';\nimport { AdminService } from '../services/admin';\n\nexport const globalReportAction: Action = {\n name: 'GLOBAL_REPORT',\n description: 'Generate a summary report of activity across all rooms for a given day',\n examples: [\n [\n { \n name: 'user', \n content: { text: 'Give me a global report for today' } \n },\n { \n name: 'assistant', \n content: { \n text: 'Daily Report:\\nšŸ“Š Total Messages: 142\\nšŸ  Active Rooms: 5\\n\\nTop Rooms:\\n1. general (45 messages)\\n2. dev-chat (38 messages)\\n3. support (25 messages)'\n } \n }\n ]\n ],\n validate: async (runtime, message: Memory, state?: State) => {\n const admin = runtime.getService<AdminService>('ADMIN_SERVICE');\n if (!admin || !admin.isUnlocked()) return false;\n \n const text = message.content?.text?.toLowerCase() || '';\n return text.includes('report') && (text.includes('global') || text.includes('daily') || text.includes('today'));\n },\n handler: async (runtime, message: Memory, state?: State) => {\n const admin = runtime.getService<AdminService>('ADMIN_SERVICE');\n if (!admin || !admin.isUnlocked()) {\n return {\n text: 'āŒ Admin privileges required for global reports.',\n success: false\n };\n }\n\n try {\n const text = message.content?.text || '';\n \n // Extract date if specified, otherwise use today\n let date = new Date().toISOString().slice(0, 10);\n const dateMatch = text.match(/(\\d{4}-\\d{2}-\\d{2})/);\n if (dateMatch) {\n date = dateMatch[1];\n }\n \n const startTime = new Date(date).getTime();\n const endTime = startTime + 24 * 60 * 60 * 1000;\n\n // Get all memories for the date range\n const memories = await runtime.getMemories({\n tableName: 'memories',\n agentId: runtime.agentId,\n start: startTime,\n end: endTime\n });\n\n // Group by room\n const roomStats = new Map<string, number>();\n for (const memory of memories) {\n roomStats.set(memory.roomId, (roomStats.get(memory.roomId) || 0) + 1);\n }\n\n // Get room details\n const roomIds = Array.from(roomStats.keys()) as UUID[];\n const rooms = await runtime.getRoomsByIds(roomIds);\n const roomMap = new Map(rooms?.map(r => [r.id, r]) || []);\n\n const topRooms = Array.from(roomStats.entries())\n .map(([roomId, count]) => ({\n roomId,\n roomName: roomMap.get(roomId as UUID)?.name || `Room ${roomId.slice(0, 8)}`,\n count\n }))\n .sort((a, b) => b.count - a.count)\n .slice(0, 5);\n\n // Build report text\n let reportText = `šŸ“Š **Daily Report for ${date}**\\n\\n`;\n reportText += `**Summary:**\\n`;\n reportText += `• Total Messages: ${memories.length}\\n`;\n reportText += `• Active Rooms: ${roomStats.size}\\n\\n`;\n \n if (topRooms.length > 0) {\n reportText += `**Top ${topRooms.length} Most Active Rooms:**\\n`;\n topRooms.forEach((room, idx) => {\n reportText += `${idx + 1}. ${room.roomName} (${room.count} messages)\\n`;\n });\n } else {\n reportText += `No activity found for this date.\\n`;\n }\n\n return {\n text: reportText,\n data: {\n date,\n totalMessages: memories.length,\n totalRooms: roomStats.size,\n topRooms\n },\n success: true\n };\n } catch (error) {\n runtime.logger.error('[plugin-admin] Error in globalReport:', error);\n return {\n text: 'āŒ Error generating report. Please check the logs.',\n success: false\n };\n }\n },\n}; ","import { Action, Memory, State, UUID } from '@elizaos/core';\nimport { AdminService } from '../services/admin';\n\nexport const listAllUsersAction: Action = {\n name: 'LIST_ALL_USERS',\n description: 'Return a list of all users/entities known to the agent globally.',\n examples: [\n [\n { \n name: 'user', \n content: { text: 'List all users' } \n },\n { \n name: 'assistant', \n content: { \n text: 'Found 12 users:\\n\\n1. Alice - ID: abc123...\\n2. Bob - ID: def456...\\n3. Charlie - ID: ghi789...' \n } \n }\n ]\n ],\n validate: async (runtime, message: Memory, state?: State) => {\n const admin = runtime.getService<AdminService>('ADMIN_SERVICE');\n if (!admin || !admin.isUnlocked()) return false;\n \n const text = message.content?.text?.toLowerCase() || '';\n return (text.includes('list') || text.includes('show')) && \n (text.includes('users') || text.includes('entities') || text.includes('everyone'));\n },\n handler: async (runtime, message: Memory, state?: State) => {\n const admin = runtime.getService<AdminService>('ADMIN_SERVICE');\n if (!admin || !admin.isUnlocked()) {\n return {\n text: 'āŒ Admin privileges required to list users.',\n success: false\n };\n }\n\n try {\n // Get all unique entity IDs from memories\n const memories = await runtime.getMemories({\n tableName: 'memories',\n agentId: runtime.agentId,\n count: 1000 // Get more to ensure we capture all unique users\n });\n\n // Extract unique entity IDs\n const entityIds = new Set<string>();\n for (const memory of memories) {\n if (memory.entityId && memory.entityId !== runtime.agentId) {\n entityIds.add(memory.entityId);\n }\n }\n\n // Get entity details\n const entities = await runtime.getEntitiesByIds(Array.from(entityIds) as UUID[]);\n\n if (!entities || entities.length === 0) {\n return {\n text: 'No users found in the system.',\n success: true\n };\n }\n\n // Build response text\n let responseText = `šŸ‘„ **Found ${entities.length} users:**\\n\\n`;\n \n entities.slice(0, 20).forEach((entity, idx) => {\n const primaryName = entity.names?.[0] || 'Unknown';\n const id = entity.id || 'no-id';\n responseText += `${idx + 1}. **${primaryName}** - ID: ${id.slice(0, 8)}...\\n`;\n });\n\n if (entities.length > 20) {\n responseText += `\\n... and ${entities.length - 20} more users.`;\n }\n\n return {\n text: responseText,\n data: {\n totalUsers: entities.length,\n users: entities.map(e => ({\n id: e.id,\n names: e.names || [],\n metadata: e.metadata || {}\n }))\n },\n success: true\n };\n } catch (error) {\n runtime.logger.error('[plugin-admin] Error in listAllUsers:', error);\n return {\n text: 'āŒ Error fetching users. Please check the logs.',\n success: false\n };\n }\n },\n}; ","import { Action, Memory, State, UUID } from '@elizaos/core';\nimport { AdminService } from '../services/admin';\n\nexport const listAllRoomsAction: Action = {\n name: 'LIST_ALL_ROOMS',\n description: 'Return a list of all chat rooms/channels known to the agent globally.',\n examples: [\n [\n { \n name: 'user', \n content: { text: 'List all rooms' } \n },\n { \n name: 'assistant', \n content: { \n text: 'Found 5 rooms:\\n\\n1. general - ID: abc123...\\n2. dev-chat - ID: def456...\\n3. support - ID: ghi789...' \n } \n }\n ]\n ],\n validate: async (runtime, message: Memory, state?: State) => {\n const admin = runtime.getService<AdminService>('ADMIN_SERVICE');\n if (!admin || !admin.isUnlocked()) return false;\n \n const text = message.content?.text?.toLowerCase() || '';\n return (text.includes('list') || text.includes('show')) && \n (text.includes('rooms') || text.includes('channels'));\n },\n handler: async (runtime, message: Memory, state?: State) => {\n const admin = runtime.getService<AdminService>('ADMIN_SERVICE');\n if (!admin || !admin.isUnlocked()) {\n return {\n text: 'āŒ Admin privileges required to list rooms.',\n success: false\n };\n }\n\n try {\n // Get unique room IDs from memories\n const memories = await runtime.getMemories({\n tableName: 'memories',\n agentId: runtime.agentId,\n count: 1000\n });\n\n // Extract unique room IDs\n const roomIds = new Set<string>();\n for (const memory of memories) {\n if (memory.roomId) {\n roomIds.add(memory.roomId);\n }\n }\n\n // Get room details\n const rooms = await runtime.getRoomsByIds(Array.from(roomIds) as UUID[]);\n\n if (!rooms || rooms.length === 0) {\n return {\n text: 'No rooms found in the system.',\n success: true\n };\n }\n\n // Build response text\n let responseText = `šŸ  **Found ${rooms.length} rooms:**\\n\\n`;\n \n rooms.slice(0, 20).forEach((room, idx) => {\n const roomName = room.name || `Room ${room.id.slice(0, 8)}`;\n responseText += `${idx + 1}. **${roomName}** - ID: ${room.id.slice(0, 8)}...\\n`;\n if (room.source) {\n responseText += ` Source: ${room.source}\\n`;\n }\n });\n\n if (rooms.length > 20) {\n responseText += `\\n... and ${rooms.length - 20} more rooms.`;\n }\n\n return {\n text: responseText,\n data: {\n totalRooms: rooms.length,\n rooms: rooms.map(r => ({\n id: r.id,\n name: r.name || null,\n source: r.source,\n type: r.type,\n metadata: r.metadata || {}\n }))\n },\n success: true\n };\n } catch (error) {\n runtime.logger.error('[plugin-admin] Error in listAllRooms:', error);\n return {\n text: 'āŒ Error fetching rooms. Please check the logs.',\n success: false\n };\n }\n },\n}; ","import { Action, Memory, State } from '@elizaos/core';\nimport { AdminService } from '../services/admin';\n\nexport const searchMessagesAction: Action = {\n name: 'SEARCH_MESSAGES',\n description: 'Search for messages across all rooms globally.',\n examples: [\n [\n { \n name: 'user', \n content: { text: 'Search all messages for \"production outage\"' } \n },\n { \n name: 'assistant', \n content: { \n text: 'Found 3 messages matching \"production outage\":\\n\\n1. [2024-01-15 14:32] Entity abc123: \"We have a production outage affecting the API\"\\n2. [2024-01-15 14:35] Entity def456: \"I\\'m investigating the production outage now\"' \n } \n }\n ]\n ],\n validate: async (runtime, message: Memory, state?: State) => {\n const admin = runtime.getService<AdminService>('ADMIN_SERVICE');\n if (!admin || !admin.isUnlocked()) return false;\n \n const text = message.content?.text?.toLowerCase() || '';\n return text.includes('search') && (text.includes('message') || text.includes('all'));\n },\n handler: async (runtime, message: Memory, state?: State) => {\n const admin = runtime.getService<AdminService>('ADMIN_SERVICE');\n if (!admin || !admin.isUnlocked()) {\n return {\n text: 'āŒ Admin privileges required for global search.',\n success: false\n };\n }\n\n try {\n const text = message.content?.text || '';\n \n // Extract search query from message\n const queryMatch = text.match(/search\\s+(?:all\\s+)?(?:messages?\\s+)?(?:for\\s+)?[\"']?([^\"']+)[\"']?/i);\n if (!queryMatch) {\n return {\n text: 'Please specify what to search for. Example: \"Search all messages for production issue\"',\n success: false\n };\n }\n\n const searchQuery = queryMatch[1].trim();\n \n // Get all memories (with a reasonable limit)\n const memories = await runtime.getMemories({\n tableName: 'memories',\n agentId: runtime.agentId,\n count: 500\n });\n\n // Filter memories that contain the search query\n const searchLower = searchQuery.toLowerCase();\n const matches = memories.filter(mem => \n mem.content?.text?.toLowerCase().includes(searchLower)\n );\n\n if (matches.length === 0) {\n return {\n text: `No messages found containing \"${searchQuery}\"`,\n success: true\n };\n }\n\n // Sort by timestamp (newest first)\n matches.sort((a, b) => (b.createdAt || 0) - (a.createdAt || 0));\n\n // Get room details for context\n const roomIds = [...new Set(matches.map(m => m.roomId))];\n const rooms = await runtime.getRoomsByIds(roomIds);\n const roomMap = new Map(rooms?.map(r => [r.id, r]) || []);\n\n // Build response text\n let responseText = `šŸ” **Found ${matches.length} messages matching \"${searchQuery}\":**\\n\\n`;\n \n matches.slice(0, 10).forEach((match, idx) => {\n const timestamp = match.createdAt \n ? new Date(match.createdAt).toISOString().replace('T', ' ').slice(0, 16)\n : 'Unknown time';\n const roomName = roomMap.get(match.roomId)?.name || `Room ${match.roomId.slice(0, 8)}`;\n const text = match.content?.text || '[No text]';\n const preview = text.length > 100 ? text.slice(0, 100) + '...' : text;\n \n responseText += `${idx + 1}. **[${timestamp}]** in ${roomName}\\n`;\n responseText += ` Entity ${match.entityId.slice(0, 8)}: \"${preview}\"\\n\\n`;\n });\n\n if (matches.length > 10) {\n responseText += `... and ${matches.length - 10} more messages.`;\n }\n\n return {\n text: responseText,\n data: {\n query: searchQuery,\n totalResults: matches.length,\n results: matches.slice(0, 20).map(m => ({\n id: m.id,\n roomId: m.roomId,\n entityId: m.entityId,\n content: m.content,\n createdAt: m.createdAt\n }))\n },\n success: true\n };\n } catch (error) {\n runtime.logger.error('[plugin-admin] Error in searchMessages:', error);\n return {\n text: 'āŒ Error searching messages. Please check the logs.',\n success: false\n };\n }\n },\n}; ","import { Action, Memory, State, UUID } from '@elizaos/core';\nimport { AdminService } from '../services/admin';\n\nexport const userAuditAction: Action = {\n name: 'USER_AUDIT',\n description: 'Generate a detailed audit report for a specific user/entity.',\n examples: [\n [\n { \n name: 'user', \n content: { text: 'Audit user abc123' } \n },\n { \n name: 'assistant', \n content: { \n text: 'User Audit Report:\\n\\n**Entity ID:** abc123...\\n**First Seen:** 2024-01-15 10:30\\n**Total Messages:** 45\\n**Active Rooms:** 3\\n**Most Active:** general (25 messages)' \n } \n }\n ]\n ],\n validate: async (runtime, message: Memory, state?: State) => {\n const admin = runtime.getService<AdminService>('ADMIN_SERVICE');\n if (!admin || !admin.isUnlocked()) return false;\n \n const text = message.content?.text?.toLowerCase() || '';\n return text.includes('audit') && (text.includes('user') || text.includes('entity'));\n },\n handler: async (runtime, message: Memory, state?: State) => {\n const admin = runtime.getService<AdminService>('ADMIN_SERVICE');\n if (!admin || !admin.isUnlocked()) {\n return {\n text: 'āŒ Admin privileges required for user audits.',\n success: false\n };\n }\n\n try {\n const text = message.content?.text || '';\n \n // Extract user ID from message\n const idMatch = text.match(/(?:audit\\s+(?:user|entity)\\s+)?([a-f0-9-]{8,})/i);\n if (!idMatch) {\n return {\n text: 'Please specify a user ID to audit. Example: \"Audit user abc123\"',\n success: false\n };\n }\n\n const userId = idMatch[1];\n \n // Get all messages from this user using getMemories instead\n const allMemories = await runtime.getMemories({\n tableName: 'memories',\n agentId: runtime.agentId,\n count: 1000\n });\n\n // Filter for the specific user\n const memories = allMemories.filter(m => m.entityId === userId);\n\n if (!memories.length) {\n return {\n text: `No activity found for user ${userId}`,\n success: true\n };\n }\n\n // Get entity details\n const entities = await runtime.getEntitiesByIds([userId as UUID]);\n const entity = entities?.[0];\n\n // Analyze activity\n const roomActivity = new Map<string, number>();\n let firstSeen = Infinity;\n let lastSeen = 0;\n\n for (const memory of memories) {\n const timestamp = memory.createdAt || 0;\n if (timestamp < firstSeen) firstSeen = timestamp;\n if (timestamp > lastSeen) lastSeen = timestamp;\n \n roomActivity.set(memory.roomId, (roomActivity.get(memory.roomId) || 0) + 1);\n }\n\n // Get room details\n const roomIds = Array.from(roomActivity.keys()) as UUID[];\n const rooms = await runtime.getRoomsByIds(roomIds);\n const roomMap = new Map(rooms?.map(r => [r.id, r]) || []);\n\n // Sort rooms by activity\n const topRooms = Array.from(roomActivity.entries())\n .map(([roomId, count]) => ({\n roomId,\n roomName: roomMap.get(roomId as UUID)?.name || `Room ${roomId.slice(0, 8)}`,\n count\n }))\n .sort((a, b) => b.count - a.count);\n\n // Build audit report\n let reportText = `šŸ“Š **User Audit Report**\\n\\n`;\n reportText += `**Entity ID:** ${userId}\\n`;\n reportText += `**Name(s):** ${entity?.names?.join(', ') || 'Unknown'}\\n`;\n reportText += `**First Seen:** ${new Date(firstSeen).toISOString()}\\n`;\n reportText += `**Last Seen:** ${new Date(lastSeen).toISOString()}\\n`;\n reportText += `**Total Messages:** ${memories.length}\\n`;\n reportText += `**Active Rooms:** ${roomActivity.size}\\n\\n`;\n \n reportText += `**Room Activity:**\\n`;\n topRooms.slice(0, 5).forEach((room, idx) => {\n reportText += `${idx + 1}. ${room.roomName} (${room.count} messages)\\n`;\n });\n\n // Add recent messages sample\n reportText += `\\n**Recent Messages:**\\n`;\n memories.slice(0, 5).forEach((msg, idx) => {\n const timestamp = new Date(msg.createdAt || 0).toISOString().slice(0, 16);\n const text = msg.content?.text || '[No text]';\n const preview = text.length > 80 ? text.slice(0, 80) + '...' : text;\n reportText += `${idx + 1}. [${timestamp}] \"${preview}\"\\n`;\n });\n\n return {\n text: reportText,\n data: {\n userId,\n entity,\n totalMessages: memories.length,\n firstSeen: new Date(firstSeen).toISOString(),\n lastSeen: new Date(lastSeen).toISOString(),\n roomActivity: topRooms\n },\n success: true\n };\n } catch (error) {\n runtime.logger.error('[plugin-admin] Error in userAudit:', error);\n return {\n text: 'āŒ Error generating user audit. Please check the logs.',\n success: false\n };\n }\n },\n}; ","import { Provider, ProviderResult, Memory, State, UUID } from '@elizaos/core';\nimport { AdminService } from '../services/admin';\n\n/**\n * Injects a summary of global events and messages across all rooms/channels\n * into the LLM prompt when admin privileges are unlocked.\n */\nexport const globalContextProvider: Provider = {\n name: 'GLOBAL_CONTEXT',\n description: 'Provides a high-level summary of all recent events across all rooms when admin is unlocked.',\n dynamic: true,\n private: true, // Only accessible when admin is unlocked\n get: async (runtime, message: Memory, state: State): Promise<ProviderResult> => {\n const admin = runtime.getService<AdminService>('ADMIN_SERVICE');\n if (!admin || !admin.isUnlocked()) {\n return {\n values: {},\n data: {},\n text: ''\n };\n }\n\n try {\n // Fetch last 50 messages across all rooms from memories table\n const memories = await runtime.getMemories({\n tableName: 'memories',\n count: 50,\n agentId: runtime.agentId\n });\n\n if (!memories.length) {\n return {\n values: {\n globalMessageCount: 0,\n globalRoomCount: 0\n },\n data: {\n messages: []\n },\n text: 'No recent messages found across all rooms.'\n };\n }\n\n // Group messages by room\n const roomMessages = new Map<string, any[]>();\n for (const msg of memories) {\n if (!roomMessages.has(msg.roomId)) {\n roomMessages.set(msg.roomId, []);\n }\n roomMessages.get(msg.roomId)!.push(msg);\n }\n\n // Build summary\n let summary = `Global Activity Summary (${memories.length} recent messages across ${roomMessages.size} rooms):\\n\\n`;\n \n for (const [roomId, msgs] of roomMessages) {\n const roomInfo = await runtime.getRoomsByIds([roomId as UUID]);\n const roomName = roomInfo?.[0]?.name || `Room ${roomId.slice(0, 8)}`;\n \n summary += `=== ${roomName} (${msgs.length} messages) ===\\n`;\n for (const msg of msgs.slice(0, 5)) { // Show max 5 messages per room\n const timestamp = new Date(msg.createdAt || 0).toISOString();\n const text = msg.content?.text || '[No text]';\n summary += `[${timestamp}] Entity ${msg.entityId.slice(0, 8)}: ${text.slice(0, 100)}${text.length > 100 ? '...' : ''}\\n`;\n }\n if (msgs.length > 5) {\n summary += `... and ${msgs.length - 5} more messages\\n`;\n }\n summary += '\\n';\n }\n\n return {\n values: {\n globalMessageCount: memories.length,\n globalRoomCount: roomMessages.size\n },\n data: {\n recentGlobalMessages: memories.slice(0, 10),\n roomsSummary: Array.from(roomMessages.entries()).map(([roomId, msgs]) => ({\n roomId,\n messageCount: msgs.length\n }))\n },\n text: summary\n };\n } catch (error) {\n runtime.logger.error('[plugin-admin] Error in globalContextProvider:', error);\n return {\n values: {},\n data: {},\n text: 'Error fetching global context.'\n };\n }\n },\n}; ","import { Plugin } from '@elizaos/core';\nimport { AdminService } from './services/admin';\n\nimport { elevatePrivilegeAction } from './actions/elevatePrivilege';\nimport { globalReportAction } from './actions/globalReport';\nimport { listAllUsersAction } from './actions/listAllUsers';\nimport { listAllRoomsAction } from './actions/listAllRooms';\nimport { searchMessagesAction } from './actions/searchMessages';\nimport { userAuditAction } from './actions/userAudit';\n\nimport { globalContextProvider } from './providers/globalContext';\n\nexport const adminPlugin: Plugin = {\n name: '@elizaos/plugin-admin',\n description:\n 'Provides privileged administrative actions and global context providers once unlocked via an admin password.',\n services: [AdminService],\n actions: [\n elevatePrivilegeAction, \n globalReportAction, \n listAllUsersAction, \n listAllRoomsAction,\n searchMessagesAction,\n userAuditAction\n ],\n providers: [globalContextProvider],\n};\n\nexport { AdminService } from './services/admin'; "],"mappings":";AAAA,SAAwB,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AAAA,EACF;AAAA,EACA,WAAW,CAAC,qBAAqB;AACnC;","names":["text","text"]}
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@elizaos/plugin-admin",
3
+ "version": "1.5.2",
4
+ "description": "Admin plugin for elevating privileges and performing global queries across the ElizaOS agent runtime.",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "scripts": {
15
+ "build": "tsup",
16
+ "dev": "tsup --watch",
17
+ "clean": "rimraf dist",
18
+ "test": "vitest"
19
+ },
20
+ "keywords": [
21
+ "elizaos",
22
+ "plugin",
23
+ "admin",
24
+ "privileges"
25
+ ],
26
+ "author": "elizaOS",
27
+ "license": "MIT",
28
+ "dependencies": {
29
+ "@elizaos/core": "latest",
30
+ "zod": "^4.0.5"
31
+ },
32
+ "devDependencies": {
33
+ "@types/node": "^24.0.15",
34
+ "tsup": "^8.5.0",
35
+ "typescript": "^5.3.1",
36
+ "rimraf": "^6.0.1",
37
+ "vitest": "^3.2.4"
38
+ }
39
+ }