@elizaos/cli 1.0.0-alpha.0

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/package.json ADDED
@@ -0,0 +1,87 @@
1
+ {
2
+ "name": "@elizaos/cli",
3
+ "version": "1.0.0-alpha.0",
4
+ "description": "elizaOS CLI - Manage your AI agents and plugins",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "license": "MIT",
9
+ "author": {
10
+ "name": "elizaOS",
11
+ "url": "https://twitter.com/eliza_OS"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/elizaOS/eliza.git",
16
+ "directory": "packages/cli"
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "templates"
21
+ ],
22
+ "keywords": [],
23
+ "type": "module",
24
+ "exports": {
25
+ ".": "./dist/index.js",
26
+ "./package.json": "./package.json"
27
+ },
28
+ "bin": {
29
+ "elizaos": "./dist/index.js"
30
+ },
31
+ "scripts": {
32
+ "cli": "bun build src/index.ts --outdir dist --watch",
33
+ "build": "tsup --format esm --dts",
34
+ "watch": "tsc --watch",
35
+ "dev": "tsup --format esm --dts --watch",
36
+ "typecheck": "tsc --noEmit",
37
+ "start:cli": "bun run build && node dist/index.js",
38
+ "release": "changeset version",
39
+ "pub:beta": "tsup --format esm && bun publish --no-git-checks --access public --tag beta",
40
+ "pub:next": "tsup --format esm && bun publish --no-git-checks --access public --tag next",
41
+ "pub:release": "tsup --format esm && bun publish --access public",
42
+ "test": "vitest run",
43
+ "test:dev": "REGISTRY_URL=http://localhost:3333 vitest run"
44
+ },
45
+ "dependencies": {
46
+ "@antfu/ni": "^0.21.4",
47
+ "@babel/core": "^7.22.1",
48
+ "@babel/parser": "^7.22.6",
49
+ "@babel/plugin-transform-typescript": "^7.22.5",
50
+ "@elizaos/core": "^0.25.9",
51
+ "@elizaos/plugin-sql": "^0.25.6",
52
+ "@noble/curves": "^1.8.1",
53
+ "axios": "^1.7.9",
54
+ "chalk": "5.2.0",
55
+ "commander": "^10.0.0",
56
+ "cosmiconfig": "^8.1.3",
57
+ "crypto": "^1.0.1",
58
+ "diff": "^5.1.0",
59
+ "dotenv": "^16.4.5",
60
+ "execa": "^7.0.0",
61
+ "fast-glob": "^3.3.2",
62
+ "fs-extra": "^11.1.0",
63
+ "https-proxy-agent": "^6.2.0",
64
+ "lodash": "^4.17.21",
65
+ "node-fetch": "^3.3.0",
66
+ "ora": "^6.1.2",
67
+ "papaparse": "^5.5.1",
68
+ "prompts": "^2.4.2",
69
+ "recast": "^0.23.2",
70
+ "ts-morph": "^18.0.0",
71
+ "tsconfig-paths": "^4.2.0",
72
+ "tsx": "^4.19.2",
73
+ "zod": "^3.20.2"
74
+ },
75
+ "devDependencies": {
76
+ "@types/babel__core": "^7.20.1",
77
+ "@types/diff": "^5.0.3",
78
+ "@types/fs-extra": "^11.0.1",
79
+ "@types/lodash": "^4.17.7",
80
+ "@types/prompts": "^2.4.2",
81
+ "rimraf": "^4.1.3",
82
+ "tsup": "8.4.0",
83
+ "type-fest": "^3.8.0",
84
+ "typescript": "5.8.2"
85
+ },
86
+ "gitHead": "084c3b06c279b85528a81d42fc93ef68ff9f7364"
87
+ }
@@ -0,0 +1,2 @@
1
+ # Plugin Starter
2
+
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
3
+ "extends": ["../../biome.json"],
4
+ "organizeImports": {
5
+ "enabled": false
6
+ },
7
+ "formatter": {
8
+ "enabled": true,
9
+ "indentStyle": "space",
10
+ "indentWidth": 4,
11
+ "lineWidth": 100
12
+ },
13
+ "javascript": {
14
+ "formatter": {
15
+ "quoteStyle": "single"
16
+ }
17
+ },
18
+ "files": {
19
+ "ignore": ["dist/**/*", "extra/**/*", "node_modules/**/*"]
20
+ }
21
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@elizaos/plugin-starter",
3
+ "description": "Plugin starter for elizaOS",
4
+ "version": "1.0.0-alpha.0",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ "./package.json": "./package.json",
11
+ ".": {
12
+ "import": {
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.js"
15
+ }
16
+ }
17
+ },
18
+ "files": ["dist"],
19
+ "dependencies": {
20
+ "@elizaos/core": "workspace:*",
21
+ "zod": "3.21.4"
22
+ },
23
+ "devDependencies": {
24
+ "tsup": "8.4.0"
25
+ },
26
+ "scripts": {
27
+ "build": "tsup --format esm --dts",
28
+ "dev": "tsup --format esm --dts --watch",
29
+ "test": "vitest run"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "resolutions": {
35
+ "zod": "3.24.1"
36
+ }
37
+ }
@@ -0,0 +1,252 @@
1
+ import type { Plugin } from "@elizaos/core";
2
+ import {
3
+ type Action,
4
+ type Content,
5
+ type GenerateTextParams,
6
+ type HandlerCallback,
7
+ type IAgentRuntime,
8
+ type Memory,
9
+ ModelTypes,
10
+ Service,
11
+ type State,
12
+ type Provider,
13
+ type ProviderResult,
14
+ logger,
15
+ } from "@elizaos/core";
16
+ import { z } from "zod";
17
+
18
+ const configSchema = z.object({
19
+ PLUGIN_NAME: z
20
+ .string()
21
+ .min(1, "Plugin name is not provided")
22
+ .optional()
23
+ .transform((val) => {
24
+ if (!val) {
25
+ console.warn("Warning: Plugin name not provided");
26
+ }
27
+ return val;
28
+ }),
29
+ });
30
+
31
+ /**
32
+ * Example HelloWorld action
33
+ * This demonstrates the simplest possible action structure
34
+ */
35
+ const helloWorldAction: Action = {
36
+ name: "HELLO_WORLD",
37
+ similes: ["GREET", "SAY_HELLO"],
38
+ description: "Responds with a simple hello world message",
39
+
40
+ validate: async (
41
+ _runtime: IAgentRuntime,
42
+ _message: Memory,
43
+ _state: State,
44
+ ): Promise<boolean> => {
45
+ // Always valid
46
+ return true;
47
+ },
48
+
49
+ handler: async (
50
+ _runtime: IAgentRuntime,
51
+ message: Memory,
52
+ _state: State,
53
+ _options: any,
54
+ callback: HandlerCallback,
55
+ _responses: Memory[],
56
+ ) => {
57
+ try {
58
+ logger.info("Handling HELLO_WORLD action");
59
+
60
+ // Simple response content
61
+ const responseContent: Content = {
62
+ text: "hello world!",
63
+ actions: ["HELLO_WORLD"],
64
+ source: message.content.source,
65
+ };
66
+
67
+ // Call back with the hello world message
68
+ await callback(responseContent);
69
+
70
+ return responseContent;
71
+ } catch (error) {
72
+ logger.error("Error in HELLO_WORLD action:", error);
73
+ throw error;
74
+ }
75
+ },
76
+
77
+ examples: [
78
+ [
79
+ {
80
+ name: "{{name1}}",
81
+ content: {
82
+ text: "Can you say hello?",
83
+ },
84
+ },
85
+ {
86
+ name: "{{name2}}",
87
+ content: {
88
+ text: "hello world!",
89
+ actions: ["HELLO_WORLD"],
90
+ },
91
+ },
92
+ ],
93
+ ],
94
+ };
95
+
96
+ /**
97
+ * Example Hello World Provider
98
+ * This demonstrates the simplest possible provider implementation
99
+ */
100
+ const helloWorldProvider: Provider = {
101
+ name: "HELLO_WORLD_PROVIDER",
102
+ description: "A simple example provider",
103
+
104
+ get: async (
105
+ _runtime: IAgentRuntime,
106
+ _message: Memory,
107
+ _state: State,
108
+ ): Promise<ProviderResult> => {
109
+ return {
110
+ text: "I am a provider",
111
+ values: {},
112
+ data: {},
113
+ };
114
+ },
115
+ };
116
+
117
+ export class StarterService extends Service {
118
+ static serviceType = "starter";
119
+ capabilityDescription =
120
+ "This is a starter service which is attached to the agent through the starter plugin.";
121
+ constructor(protected runtime: IAgentRuntime) {
122
+ super(runtime);
123
+ }
124
+
125
+ static async start(runtime: IAgentRuntime) {
126
+ logger.info("*** Starting starter service ***");
127
+ const service = new StarterService(runtime);
128
+ return service;
129
+ }
130
+
131
+ static async stop(runtime: IAgentRuntime) {
132
+ logger.info("*** Stopping starter service ***");
133
+ // get the service from the runtime
134
+ const service = runtime.getService(StarterService.serviceType);
135
+ if (!service) {
136
+ throw new Error("Starter service not found");
137
+ }
138
+ service.stop();
139
+ }
140
+
141
+ async stop() {
142
+ logger.info("*** Stopping starter service instance ***");
143
+ }
144
+ }
145
+
146
+ export const starterPlugin: Plugin = {
147
+ name: "plugin-starter",
148
+ description: "Plugin starter for elizaOS",
149
+ config: {
150
+ PLUGIN_NAME: process.env.PLUGIN_NAME,
151
+ },
152
+ async init(config: Record<string, string>) {
153
+ logger.info("*** Initializing starter plugin ***");
154
+ try {
155
+ const validatedConfig = await configSchema.parseAsync(config);
156
+
157
+ // Set all environment variables at once
158
+ for (const [key, value] of Object.entries(validatedConfig)) {
159
+ if (value) process.env[key] = value;
160
+ }
161
+ } catch (error) {
162
+ if (error instanceof z.ZodError) {
163
+ throw new Error(
164
+ `Invalid plugin configuration: ${error.errors
165
+ .map((e) => e.message)
166
+ .join(", ")}`,
167
+ );
168
+ }
169
+ throw error;
170
+ }
171
+ },
172
+ models: {
173
+ [ModelTypes.TEXT_SMALL]: async (
174
+ _runtime,
175
+ { prompt, stopSequences = [] }: GenerateTextParams,
176
+ ) => {
177
+ return "Never gonna give you up, never gonna let you down, never gonna run around and desert you...";
178
+ },
179
+ [ModelTypes.TEXT_LARGE]: async (
180
+ _runtime,
181
+ {
182
+ prompt,
183
+ stopSequences = [],
184
+ maxTokens = 8192,
185
+ temperature = 0.7,
186
+ frequencyPenalty = 0.7,
187
+ presencePenalty = 0.7,
188
+ }: GenerateTextParams,
189
+ ) => {
190
+ return "Never gonna make you cry, never gonna say goodbye, never gonna tell a lie and hurt you...";
191
+ },
192
+ },
193
+ tests: [
194
+ {
195
+ name: "plugin_starter_test_suite",
196
+ tests: [
197
+ {
198
+ name: "example_test",
199
+ fn: async (runtime) => {
200
+ console.log("example_test run by ", runtime.character.name);
201
+ },
202
+ },
203
+ ],
204
+ },
205
+ ],
206
+ routes: [
207
+ {
208
+ path: "/helloworld",
209
+ type: "GET",
210
+ handler: async (_req: any, res: any) => {
211
+ // send a response
212
+ res.json({
213
+ message: "Hello World!",
214
+ });
215
+ },
216
+ },
217
+ ],
218
+ events: {
219
+ MESSAGE_RECEIVED: [
220
+ async (params) => {
221
+ console.log("MESSAGE_RECEIVED event received");
222
+ // print the keys
223
+ console.log(Object.keys(params));
224
+ },
225
+ ],
226
+ VOICE_MESSAGE_RECEIVED: [
227
+ async (params) => {
228
+ console.log("VOICE_MESSAGE_RECEIVED event received");
229
+ // print the keys
230
+ console.log(Object.keys(params));
231
+ },
232
+ ],
233
+ SERVER_CONNECTED: [
234
+ async (params) => {
235
+ console.log("SERVER_CONNECTED event received");
236
+ // print the keys
237
+ console.log(Object.keys(params));
238
+ },
239
+ ],
240
+ SERVER_JOINED: [
241
+ async (params) => {
242
+ console.log("SERVER_JOINED event received");
243
+ // print the keys
244
+ console.log(Object.keys(params));
245
+ },
246
+ ],
247
+ },
248
+ services: [StarterService],
249
+ actions: [helloWorldAction],
250
+ providers: [helloWorldProvider],
251
+ };
252
+ export default starterPlugin;
@@ -0,0 +1,25 @@
1
+ {
2
+ "compilerOptions": {
3
+ "outDir": "dist",
4
+ "rootDir": "src",
5
+ "lib": ["ESNext"],
6
+ "target": "ESNext",
7
+ "module": "Preserve",
8
+ "moduleResolution": "Bundler",
9
+ "strict": false,
10
+ "esModuleInterop": true,
11
+ "skipLibCheck": true,
12
+ "forceConsistentCasingInFileNames": false,
13
+ "allowImportingTsExtensions": true,
14
+ "declaration": true,
15
+ "emitDeclarationOnly": true,
16
+ "resolveJsonModule": true,
17
+ "noImplicitAny": false,
18
+ "allowJs": true,
19
+ "checkJs": false,
20
+ "noEmitOnError": false,
21
+ "moduleDetection": "force",
22
+ "allowArbitraryExtensions": true
23
+ },
24
+ "include": ["src/**/*.ts"]
25
+ }
@@ -0,0 +1,17 @@
1
+ import { defineConfig } from "tsup";
2
+
3
+ export default defineConfig({
4
+ entry: ["src/index.ts"],
5
+ outDir: "dist",
6
+ sourcemap: true,
7
+ clean: true,
8
+ format: ["esm"], // Ensure you're targeting CommonJS
9
+ external: [
10
+ "dotenv", // Externalize dotenv to prevent bundling
11
+ "fs", // Externalize fs to use Node.js built-in module
12
+ "path", // Externalize other built-ins if necessary
13
+ "https",
14
+ "http",
15
+ "@elizaos/core",
16
+ ],
17
+ });
@@ -0,0 +1,8 @@
1
+ import { defineConfig } from "vitest/config";
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ globals: true,
6
+ environment: "node",
7
+ },
8
+ });
@@ -0,0 +1,2 @@
1
+ # Plugin Starter
2
+
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
3
+ "extends": ["../../biome.json"],
4
+ "organizeImports": {
5
+ "enabled": false
6
+ },
7
+ "formatter": {
8
+ "enabled": true,
9
+ "indentStyle": "space",
10
+ "indentWidth": 4,
11
+ "lineWidth": 100
12
+ },
13
+ "javascript": {
14
+ "formatter": {
15
+ "quoteStyle": "single"
16
+ }
17
+ },
18
+ "files": {
19
+ "ignore": ["dist/**/*", "extra/**/*", "node_modules/**/*"]
20
+ }
21
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@elizaos/project-starter",
3
+ "description": "Project starter for elizaOS",
4
+ "version": "1.0.0-alpha.0",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ "./package.json": "./package.json",
11
+ ".": {
12
+ "import": {
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.js"
15
+ }
16
+ }
17
+ },
18
+ "files": ["dist"],
19
+ "dependencies": {
20
+ "@elizaos/core": "workspace:*",
21
+ "zod": "3.21.4"
22
+ },
23
+ "devDependencies": {
24
+ "tsup": "8.4.0"
25
+ },
26
+ "scripts": {
27
+ "build": "tsup --format esm --dts",
28
+ "dev": "tsup --format esm --dts --watch",
29
+ "test": "vitest run"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public"
33
+ }
34
+ }