@elizaos/plugin-starter 1.0.0-alpha.3 → 1.0.0-alpha.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6,9 +6,9 @@ import {
6
6
  } from "@elizaos/core";
7
7
  import { z } from "zod";
8
8
  var configSchema = z.object({
9
- PLUGIN_NAME: z.string().min(1, "Plugin name is not provided").optional().transform((val) => {
9
+ EXAMPLE_PLUGIN_VARIABLE: z.string().min(1, "Example plugin variable is not provided").optional().transform((val) => {
10
10
  if (!val) {
11
- console.warn("Warning: Plugin name not provided");
11
+ logger.warn("Example plugin variable is not provided (this is expected)");
12
12
  }
13
13
  return val;
14
14
  })
@@ -72,12 +72,12 @@ var StarterService = class _StarterService extends Service {
72
72
  static serviceType = "starter";
73
73
  capabilityDescription = "This is a starter service which is attached to the agent through the starter plugin.";
74
74
  static async start(runtime) {
75
- logger.info("*** Starting starter service ***");
75
+ logger.info(`*** Starting starter service - MODIFIED: ${(/* @__PURE__ */ new Date()).toISOString()} ***`);
76
76
  const service = new _StarterService(runtime);
77
77
  return service;
78
78
  }
79
79
  static async stop(runtime) {
80
- logger.info("*** Stopping starter service ***");
80
+ logger.info("*** TESTING DEV MODE - STOP MESSAGE CHANGED! ***");
81
81
  const service = runtime.getService(_StarterService.serviceType);
82
82
  if (!service) {
83
83
  throw new Error("Starter service not found");
@@ -85,17 +85,17 @@ var StarterService = class _StarterService extends Service {
85
85
  service.stop();
86
86
  }
87
87
  async stop() {
88
- logger.info("*** Stopping starter service instance ***");
88
+ logger.info("*** THIRD CHANGE - TESTING FILE WATCHING! ***");
89
89
  }
90
90
  };
91
91
  var starterPlugin = {
92
92
  name: "plugin-starter",
93
93
  description: "Plugin starter for elizaOS",
94
94
  config: {
95
- PLUGIN_NAME: process.env.PLUGIN_NAME
95
+ EXAMPLE_PLUGIN_VARIABLE: process.env.EXAMPLE_PLUGIN_VARIABLE
96
96
  },
97
97
  async init(config) {
98
- logger.info("*** Initializing starter plugin ***");
98
+ logger.info("*** TESTING DEV MODE - PLUGIN MODIFIED AND RELOADED! ***");
99
99
  try {
100
100
  const validatedConfig = await configSchema.parseAsync(config);
101
101
  for (const [key, value] of Object.entries(validatedConfig)) {
@@ -133,6 +133,22 @@ var starterPlugin = {
133
133
  name: "example_test",
134
134
  fn: async (runtime) => {
135
135
  console.log("example_test run by ", runtime.character.name);
136
+ if (runtime.character.name !== "Eliza") {
137
+ throw new Error(`Expected character name to be "Eliza" but got "${runtime.character.name}"`);
138
+ }
139
+ const service = runtime.getService("starter");
140
+ if (!service) {
141
+ throw new Error("Starter service not found");
142
+ }
143
+ }
144
+ },
145
+ {
146
+ name: "should_have_hello_world_action",
147
+ fn: async (runtime) => {
148
+ const actionExists = starterPlugin.actions.some((a) => a.name === "HELLO_WORLD");
149
+ if (!actionExists) {
150
+ throw new Error("Hello world action not found in plugin");
151
+ }
136
152
  }
137
153
  }
138
154
  ]
@@ -162,15 +178,15 @@ var starterPlugin = {
162
178
  console.log(Object.keys(params));
163
179
  }
164
180
  ],
165
- SERVER_CONNECTED: [
181
+ WORLD_CONNECTED: [
166
182
  async (params) => {
167
- console.log("SERVER_CONNECTED event received");
183
+ console.log("WORLD_CONNECTED event received");
168
184
  console.log(Object.keys(params));
169
185
  }
170
186
  ],
171
- SERVER_JOINED: [
187
+ WORLD_JOINED: [
172
188
  async (params) => {
173
- console.log("SERVER_JOINED event received");
189
+ console.log("WORLD_JOINED event received");
174
190
  console.log(Object.keys(params));
175
191
  }
176
192
  ]
@@ -179,6 +195,24 @@ var starterPlugin = {
179
195
  actions: [helloWorldAction],
180
196
  providers: [helloWorldProvider]
181
197
  };
198
+ {
199
+ const debugPlugin = () => {
200
+ console.log("DEBUG: PLUGIN STRUCTURE:");
201
+ console.log("Plugin name:", starterPlugin.name);
202
+ console.log("Tests array exists:", !!starterPlugin.tests);
203
+ console.log("Tests array length:", starterPlugin.tests?.length);
204
+ if (starterPlugin.tests && starterPlugin.tests.length > 0) {
205
+ console.log("First test suite name:", starterPlugin.tests[0].name);
206
+ console.log("First test suite has tests array:", !!starterPlugin.tests[0].tests);
207
+ console.log("First test suite tests length:", starterPlugin.tests[0].tests?.length);
208
+ if (starterPlugin.tests[0].tests && starterPlugin.tests[0].tests.length > 0) {
209
+ console.log("First test name:", starterPlugin.tests[0].tests[0].name);
210
+ console.log("First test has fn:", !!starterPlugin.tests[0].tests[0].fn);
211
+ }
212
+ }
213
+ };
214
+ debugPlugin();
215
+ }
182
216
  var index_default = starterPlugin;
183
217
  export {
184
218
  StarterService,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Plugin } from \"@elizaos/core\";\nimport {\n\ttype Action,\n\ttype Content,\n\ttype GenerateTextParams,\n\ttype HandlerCallback,\n\ttype IAgentRuntime,\n\ttype Memory,\n\tModelTypes,\n\tService,\n\ttype State,\n\ttype Provider,\n\ttype ProviderResult,\n\tlogger,\n} from \"@elizaos/core\";\nimport { z } from \"zod\";\n\nconst configSchema = z.object({\n\tPLUGIN_NAME: z\n\t\t.string()\n\t\t.min(1, \"Plugin name is not provided\")\n\t\t.optional()\n\t\t.transform((val) => {\n\t\t\tif (!val) {\n\t\t\t\tconsole.warn(\"Warning: Plugin name not provided\");\n\t\t\t}\n\t\t\treturn val;\n\t\t}),\n});\n\n/**\n * Example HelloWorld action\n * This demonstrates the simplest possible action structure\n */\nconst helloWorldAction: Action = {\n\tname: \"HELLO_WORLD\",\n\tsimiles: [\"GREET\", \"SAY_HELLO\"],\n\tdescription: \"Responds with a simple hello world message\",\n\n\tvalidate: async (\n\t\t_runtime: IAgentRuntime,\n\t\t_message: Memory,\n\t\t_state: State,\n\t): Promise<boolean> => {\n\t\t// Always valid\n\t\treturn true;\n\t},\n\n\thandler: async (\n\t\t_runtime: IAgentRuntime,\n\t\tmessage: Memory,\n\t\t_state: State,\n\t\t_options: any,\n\t\tcallback: HandlerCallback,\n\t\t_responses: Memory[],\n\t) => {\n\t\ttry {\n\t\t\tlogger.info(\"Handling HELLO_WORLD action\");\n\n\t\t\t// Simple response content\n\t\t\tconst responseContent: Content = {\n\t\t\t\ttext: \"hello world!\",\n\t\t\t\tactions: [\"HELLO_WORLD\"],\n\t\t\t\tsource: message.content.source,\n\t\t\t};\n\n\t\t\t// Call back with the hello world message\n\t\t\tawait callback(responseContent);\n\n\t\t\treturn responseContent;\n\t\t} catch (error) {\n\t\t\tlogger.error(\"Error in HELLO_WORLD action:\", error);\n\t\t\tthrow error;\n\t\t}\n\t},\n\n\texamples: [\n\t\t[\n\t\t\t{\n\t\t\t\tname: \"{{name1}}\",\n\t\t\t\tcontent: {\n\t\t\t\t\ttext: \"Can you say hello?\",\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"{{name2}}\",\n\t\t\t\tcontent: {\n\t\t\t\t\ttext: \"hello world!\",\n\t\t\t\t\tactions: [\"HELLO_WORLD\"],\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t],\n};\n\n/**\n * Example Hello World Provider\n * This demonstrates the simplest possible provider implementation\n */\nconst helloWorldProvider: Provider = {\n\tname: \"HELLO_WORLD_PROVIDER\",\n\tdescription: \"A simple example provider\",\n\n\tget: async (\n\t\t_runtime: IAgentRuntime,\n\t\t_message: Memory,\n\t\t_state: State,\n\t): Promise<ProviderResult> => {\n\t\treturn {\n\t\t\ttext: \"I am a provider\",\n\t\t\tvalues: {},\n\t\t\tdata: {},\n\t\t};\n\t},\n};\n\nexport class StarterService extends Service {\n\tstatic serviceType = \"starter\";\n\tcapabilityDescription =\n\t\t\"This is a starter service which is attached to the agent through the starter plugin.\";\n\tconstructor(protected runtime: IAgentRuntime) {\n\t\tsuper(runtime);\n\t}\n\n\tstatic async start(runtime: IAgentRuntime) {\n\t\tlogger.info(\"*** Starting starter service ***\");\n\t\tconst service = new StarterService(runtime);\n\t\treturn service;\n\t}\n\n\tstatic async stop(runtime: IAgentRuntime) {\n\t\tlogger.info(\"*** Stopping starter service ***\");\n\t\t// get the service from the runtime\n\t\tconst service = runtime.getService(StarterService.serviceType);\n\t\tif (!service) {\n\t\t\tthrow new Error(\"Starter service not found\");\n\t\t}\n\t\tservice.stop();\n\t}\n\n\tasync stop() {\n\t\tlogger.info(\"*** Stopping starter service instance ***\");\n\t}\n}\n\nexport const starterPlugin: Plugin = {\n\tname: \"plugin-starter\",\n\tdescription: \"Plugin starter for elizaOS\",\n\tconfig: {\n\t\tPLUGIN_NAME: process.env.PLUGIN_NAME,\n\t},\n\tasync init(config: Record<string, string>) {\n\t\tlogger.info(\"*** Initializing starter plugin ***\");\n\t\ttry {\n\t\t\tconst validatedConfig = await configSchema.parseAsync(config);\n\n\t\t\t// Set all environment variables at once\n\t\t\tfor (const [key, value] of Object.entries(validatedConfig)) {\n\t\t\t\tif (value) process.env[key] = value;\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (error instanceof z.ZodError) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Invalid plugin configuration: ${error.errors\n\t\t\t\t\t\t.map((e) => e.message)\n\t\t\t\t\t\t.join(\", \")}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t},\n\tmodels: {\n\t\t[ModelTypes.TEXT_SMALL]: async (\n\t\t\t_runtime,\n\t\t\t{ prompt, stopSequences = [] }: GenerateTextParams,\n\t\t) => {\n\t\t\treturn \"Never gonna give you up, never gonna let you down, never gonna run around and desert you...\";\n\t\t},\n\t\t[ModelTypes.TEXT_LARGE]: async (\n\t\t\t_runtime,\n\t\t\t{\n\t\t\t\tprompt,\n\t\t\t\tstopSequences = [],\n\t\t\t\tmaxTokens = 8192,\n\t\t\t\ttemperature = 0.7,\n\t\t\t\tfrequencyPenalty = 0.7,\n\t\t\t\tpresencePenalty = 0.7,\n\t\t\t}: GenerateTextParams,\n\t\t) => {\n\t\t\treturn \"Never gonna make you cry, never gonna say goodbye, never gonna tell a lie and hurt you...\";\n\t\t},\n\t},\n\ttests: [\n\t\t{\n\t\t\tname: \"plugin_starter_test_suite\",\n\t\t\ttests: [\n\t\t\t\t{\n\t\t\t\t\tname: \"example_test\",\n\t\t\t\t\tfn: async (runtime) => {\n\t\t\t\t\t\tconsole.log(\"example_test run by \", runtime.character.name);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t],\n\troutes: [\n\t\t{\n\t\t\tpath: \"/helloworld\",\n\t\t\ttype: \"GET\",\n\t\t\thandler: async (_req: any, res: any) => {\n\t\t\t\t// send a response\n\t\t\t\tres.json({\n\t\t\t\t\tmessage: \"Hello World!\",\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t],\n\tevents: {\n\t\tMESSAGE_RECEIVED: [\n\t\t\tasync (params) => {\n\t\t\t\tconsole.log(\"MESSAGE_RECEIVED event received\");\n\t\t\t\t// print the keys\n\t\t\t\tconsole.log(Object.keys(params));\n\t\t\t},\n\t\t],\n\t\tVOICE_MESSAGE_RECEIVED: [\n\t\t\tasync (params) => {\n\t\t\t\tconsole.log(\"VOICE_MESSAGE_RECEIVED event received\");\n\t\t\t\t// print the keys\n\t\t\t\tconsole.log(Object.keys(params));\n\t\t\t},\n\t\t],\n\t\tSERVER_CONNECTED: [\n\t\t\tasync (params) => {\n\t\t\t\tconsole.log(\"SERVER_CONNECTED event received\");\n\t\t\t\t// print the keys\n\t\t\t\tconsole.log(Object.keys(params));\n\t\t\t},\n\t\t],\n\t\tSERVER_JOINED: [\n\t\t\tasync (params) => {\n\t\t\t\tconsole.log(\"SERVER_JOINED event received\");\n\t\t\t\t// print the keys\n\t\t\t\tconsole.log(Object.keys(params));\n\t\t\t},\n\t\t],\n\t},\n\tservices: [StarterService],\n\tactions: [helloWorldAction],\n\tproviders: [helloWorldProvider],\n};\nexport default starterPlugin;\n"],"mappings":";AACA;AAAA,EAOC;AAAA,EACA;AAAA,EAIA;AAAA,OACM;AACP,SAAS,SAAS;AAElB,IAAM,eAAe,EAAE,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+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Plugin } from \"@elizaos/core\";\nimport {\n\ttype Action,\n\ttype Content,\n\ttype GenerateTextParams,\n\ttype HandlerCallback,\n\ttype IAgentRuntime,\n\ttype Memory,\n\tModelTypes,\n\ttype Provider,\n\ttype ProviderResult,\n\tService,\n\ttype State,\n\tlogger,\n} from \"@elizaos/core\";\nimport { z } from \"zod\";\n\n/**\n * Defines the configuration schema for a plugin, including the validation rules for the plugin name.\n *\n * @type {import('zod').ZodObject<{ EXAMPLE_PLUGIN_VARIABLE: import('zod').ZodString }>}\n */\nconst configSchema = z.object({\n\tEXAMPLE_PLUGIN_VARIABLE: z\n\t\t.string()\n\t\t.min(1, \"Example plugin variable is not provided\")\n\t\t.optional()\n\t\t.transform((val) => {\n\t\t\tif (!val) {\n\t\t\t\tlogger.warn(\"Example plugin variable is not provided (this is expected)\");\n\t\t\t}\n\t\t\treturn val;\n\t\t}),\n});\n\n/**\n * Example HelloWorld action\n * This demonstrates the simplest possible action structure\n */\n/**\n * Action representing a hello world message.\n * @typedef {Object} Action\n * @property {string} name - The name of the action.\n * @property {string[]} similes - An array of related actions.\n * @property {string} description - A brief description of the action.\n * @property {Function} validate - Asynchronous function to validate the action.\n * @property {Function} handler - Asynchronous function to handle the action and generate a response.\n * @property {Object[]} examples - An array of example inputs and expected outputs for the action.\n */\nconst helloWorldAction: Action = {\n\tname: \"HELLO_WORLD\",\n\tsimiles: [\"GREET\", \"SAY_HELLO\"],\n\tdescription: \"Responds with a simple hello world message\",\n\n\tvalidate: async (\n\t\t_runtime: IAgentRuntime,\n\t\t_message: Memory,\n\t\t_state: State,\n\t): Promise<boolean> => {\n\t\t// Always valid\n\t\treturn true;\n\t},\n\n\thandler: async (\n\t\t_runtime: IAgentRuntime,\n\t\tmessage: Memory,\n\t\t_state: State,\n\t\t_options: any,\n\t\tcallback: HandlerCallback,\n\t\t_responses: Memory[],\n\t) => {\n\t\ttry {\n\t\t\tlogger.info(\"Handling HELLO_WORLD action\");\n\n\t\t\t// Simple response content\n\t\t\tconst responseContent: Content = {\n\t\t\t\ttext: \"hello world!\",\n\t\t\t\tactions: [\"HELLO_WORLD\"],\n\t\t\t\tsource: message.content.source,\n\t\t\t};\n\n\t\t\t// Call back with the hello world message\n\t\t\tawait callback(responseContent);\n\n\t\t\treturn responseContent;\n\t\t} catch (error) {\n\t\t\tlogger.error(\"Error in HELLO_WORLD action:\", error);\n\t\t\tthrow error;\n\t\t}\n\t},\n\n\texamples: [\n\t\t[\n\t\t\t{\n\t\t\t\tname: \"{{name1}}\",\n\t\t\t\tcontent: {\n\t\t\t\t\ttext: \"Can you say hello?\",\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"{{name2}}\",\n\t\t\t\tcontent: {\n\t\t\t\t\ttext: \"hello world!\",\n\t\t\t\t\tactions: [\"HELLO_WORLD\"],\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t],\n};\n\n/**\n * Example Hello World Provider\n * This demonstrates the simplest possible provider implementation\n */\nconst helloWorldProvider: Provider = {\n\tname: \"HELLO_WORLD_PROVIDER\",\n\tdescription: \"A simple example provider\",\n\n\tget: async (\n\t\t_runtime: IAgentRuntime,\n\t\t_message: Memory,\n\t\t_state: State,\n\t): Promise<ProviderResult> => {\n\t\treturn {\n\t\t\ttext: \"I am a provider\",\n\t\t\tvalues: {},\n\t\t\tdata: {},\n\t\t};\n\t},\n};\n\nexport class StarterService extends Service {\n\tstatic serviceType = \"starter\";\n\tcapabilityDescription =\n\t\t\"This is a starter service which is attached to the agent through the starter plugin.\";\n\tconstructor(protected runtime: IAgentRuntime) {\n\t\tsuper(runtime);\n\t}\n\n\tstatic async start(runtime: IAgentRuntime) {\n\t\tlogger.info(`*** Starting starter service - MODIFIED: ${new Date().toISOString()} ***`);\n\t\tconst service = new StarterService(runtime);\n\t\treturn service;\n\t}\n\n\tstatic async stop(runtime: IAgentRuntime) {\n\t\tlogger.info(\"*** TESTING DEV MODE - STOP MESSAGE CHANGED! ***\");\n\t\t// get the service from the runtime\n\t\tconst service = runtime.getService(StarterService.serviceType);\n\t\tif (!service) {\n\t\t\tthrow new Error(\"Starter service not found\");\n\t\t}\n\t\tservice.stop();\n\t}\n\n\tasync stop() {\n\t\tlogger.info(\"*** THIRD CHANGE - TESTING FILE WATCHING! ***\");\n\t}\n}\n\nexport const starterPlugin: Plugin = {\n\tname: \"plugin-starter\",\n\tdescription: \"Plugin starter for elizaOS\",\n\tconfig: {\n\t\tEXAMPLE_PLUGIN_VARIABLE: process.env.EXAMPLE_PLUGIN_VARIABLE,\n\t},\n\tasync init(config: Record<string, string>) {\n\t\tlogger.info(\"*** TESTING DEV MODE - PLUGIN MODIFIED AND RELOADED! ***\");\n\t\ttry {\n\t\t\tconst validatedConfig = await configSchema.parseAsync(config);\n\n\t\t\t// Set all environment variables at once\n\t\t\tfor (const [key, value] of Object.entries(validatedConfig)) {\n\t\t\t\tif (value) process.env[key] = value;\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (error instanceof z.ZodError) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Invalid plugin configuration: ${error.errors\n\t\t\t\t\t\t.map((e) => e.message)\n\t\t\t\t\t\t.join(\", \")}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t},\n\tmodels: {\n\t\t[ModelTypes.TEXT_SMALL]: async (\n\t\t\t_runtime,\n\t\t\t{ prompt, stopSequences = [] }: GenerateTextParams,\n\t\t) => {\n\t\t\treturn \"Never gonna give you up, never gonna let you down, never gonna run around and desert you...\";\n\t\t},\n\t\t[ModelTypes.TEXT_LARGE]: async (\n\t\t\t_runtime,\n\t\t\t{\n\t\t\t\tprompt,\n\t\t\t\tstopSequences = [],\n\t\t\t\tmaxTokens = 8192,\n\t\t\t\ttemperature = 0.7,\n\t\t\t\tfrequencyPenalty = 0.7,\n\t\t\t\tpresencePenalty = 0.7,\n\t\t\t}: GenerateTextParams,\n\t\t) => {\n\t\t\treturn \"Never gonna make you cry, never gonna say goodbye, never gonna tell a lie and hurt you...\";\n\t\t},\n\t},\n\ttests: [\n\t\t{\n\t\t\tname: \"plugin_starter_test_suite\",\n\t\t\ttests: [\n\t\t\t\t{\n\t\t\t\t\tname: \"example_test\",\n\t\t\t\t\tfn: async (runtime) => {\n\t\t\t\t\t\tconsole.log(\"example_test run by \", runtime.character.name);\n\t\t\t\t\t\t// Add a proper assertion that will pass\n\t\t\t\t\t\tif (runtime.character.name !== \"Eliza\") {\n\t\t\t\t\t\t\tthrow new Error(`Expected character name to be \"Eliza\" but got \"${runtime.character.name}\"`);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Verify the plugin is loaded properly\n\t\t\t\t\t\tconst service = runtime.getService(\"starter\");\n\t\t\t\t\t\tif (!service) {\n\t\t\t\t\t\t\tthrow new Error(\"Starter service not found\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Don't return anything to match the void return type\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: \"should_have_hello_world_action\",\n\t\t\t\t\tfn: async (runtime) => {\n\t\t\t\t\t\t// Check if the hello world action is registered\n\t\t\t\t\t\t// Look for the action in our plugin's actions\n\t\t\t\t\t\t// The actual action name in this plugin is \"helloWorld\", not \"hello\"\n\t\t\t\t\t\tconst actionExists = starterPlugin.actions.some(a => a.name === \"HELLO_WORLD\");\n\t\t\t\t\t\tif (!actionExists) {\n\t\t\t\t\t\t\tthrow new Error(\"Hello world action not found in plugin\");\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t],\n\troutes: [\n\t\t{\n\t\t\tpath: \"/helloworld\",\n\t\t\ttype: \"GET\",\n\t\t\thandler: async (_req: any, res: any) => {\n\t\t\t\t// send a response\n\t\t\t\tres.json({\n\t\t\t\t\tmessage: \"Hello World!\",\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t],\n\tevents: {\n\t\tMESSAGE_RECEIVED: [\n\t\t\tasync (params) => {\n\t\t\t\tconsole.log(\"MESSAGE_RECEIVED event received\");\n\t\t\t\t// print the keys\n\t\t\t\tconsole.log(Object.keys(params));\n\t\t\t},\n\t\t],\n\t\tVOICE_MESSAGE_RECEIVED: [\n\t\t\tasync (params) => {\n\t\t\t\tconsole.log(\"VOICE_MESSAGE_RECEIVED event received\");\n\t\t\t\t// print the keys\n\t\t\t\tconsole.log(Object.keys(params));\n\t\t\t},\n\t\t],\n\t\tWORLD_CONNECTED: [\n\t\t\tasync (params) => {\n\t\t\t\tconsole.log(\"WORLD_CONNECTED event received\");\n\t\t\t\t// print the keys\n\t\t\t\tconsole.log(Object.keys(params));\n\t\t\t},\n\t\t],\n\t\tWORLD_JOINED: [\n\t\t\tasync (params) => {\n\t\t\t\tconsole.log(\"WORLD_JOINED event received\");\n\t\t\t\t// print the keys\n\t\t\t\tconsole.log(Object.keys(params));\n\t\t\t},\n\t\t],\n\t},\n\tservices: [StarterService],\n\tactions: [helloWorldAction],\n\tproviders: [helloWorldProvider],\n};\n\n// Add debugging info to help understand why tests aren't running\n{\n\tconst debugPlugin = () => {\n\t\t// Add this temporary code to print info about the tests\n\t\t// Will be removed after debugging\n\t\tconsole.log(\"DEBUG: PLUGIN STRUCTURE:\");\n\t\tconsole.log(\"Plugin name:\", starterPlugin.name);\n\t\tconsole.log(\"Tests array exists:\", !!starterPlugin.tests);\n\t\tconsole.log(\"Tests array length:\", starterPlugin.tests?.length);\n\t\tif (starterPlugin.tests && starterPlugin.tests.length > 0) {\n\t\t\tconsole.log(\"First test suite name:\", starterPlugin.tests[0].name);\n\t\t\tconsole.log(\"First test suite has tests array:\", !!starterPlugin.tests[0].tests);\n\t\t\tconsole.log(\"First test suite tests length:\", starterPlugin.tests[0].tests?.length);\n\t\t\tif (starterPlugin.tests[0].tests && starterPlugin.tests[0].tests.length > 0) {\n\t\t\t\tconsole.log(\"First test name:\", starterPlugin.tests[0].tests[0].name);\n\t\t\t\tconsole.log(\"First test has fn:\", !!starterPlugin.tests[0].tests[0].fn);\n\t\t\t}\n\t\t}\n\t};\n\t// Call function but don't display in IDE completion\n\tdebugPlugin();\n}\n\nexport default starterPlugin;\n"],"mappings":";AACA;AAAA,EAOC;AAAA,EAGA;AAAA,EAEA;AAAA,OACM;AACP,SAAS,SAAS;AAOlB,IAAM,eAAe,EAAE,OAAO;AAAA,EAC7B,yBAAyB,EACvB,OAAO,EACP,IAAI,GAAG,yCAAyC,EAChD,SAAS,EACT,UAAU,CAAC,QAAQ;AACnB,QAAI,CAAC,KAAK;AACT,aAAO,KAAK,4DAA4D;AAAA,IACzE;AACA,WAAO;AAAA,EACR,CAAC;AACH,CAAC;AAgBD,IAAM,mBAA2B;AAAA,EAChC,MAAM;AAAA,EACN,SAAS,CAAC,SAAS,WAAW;AAAA,EAC9B,aAAa;AAAA,EAEb,UAAU,OACT,UACA,UACA,WACsB;AAEtB,WAAO;AAAA,EACR;AAAA,EAEA,SAAS,OACR,UACA,SACA,QACA,UACA,UACA,eACI;AACJ,QAAI;AACH,aAAO,KAAK,6BAA6B;AAGzC,YAAM,kBAA2B;AAAA,QAChC,MAAM;AAAA,QACN,SAAS,CAAC,aAAa;AAAA,QACvB,QAAQ,QAAQ,QAAQ;AAAA,MACzB;AAGA,YAAM,SAAS,eAAe;AAE9B,aAAO;AAAA,IACR,SAAS,OAAO;AACf,aAAO,MAAM,gCAAgC,KAAK;AAClD,YAAM;AAAA,IACP;AAAA,EACD;AAAA,EAEA,UAAU;AAAA,IACT;AAAA,MACC;AAAA,QACC,MAAM;AAAA,QACN,SAAS;AAAA,UACR,MAAM;AAAA,QACP;AAAA,MACD;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,SAAS;AAAA,UACR,MAAM;AAAA,UACN,SAAS,CAAC,aAAa;AAAA,QACxB;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;AAMA,IAAM,qBAA+B;AAAA,EACpC,MAAM;AAAA,EACN,aAAa;AAAA,EAEb,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MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,IAAI;AACpE,gBAAQ,IAAI,sBAAsB,CAAC,CAAC,cAAc,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,EAAE;AAAA,MACvE;AAAA,IACD;AAAA,EACD;AAEA,cAAY;AACb;AAEA,IAAO,gBAAQ;","names":[]}
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@elizaos/plugin-starter",
3
3
  "description": "Plugin starter for elizaOS",
4
- "version": "1.0.0-alpha.3",
4
+ "version": "1.0.0-alpha.30",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/elizaos-plugins/plugin-starter"
12
+ },
9
13
  "exports": {
10
14
  "./package.json": "./package.json",
11
15
  ".": {
@@ -19,16 +23,21 @@
19
23
  "dist"
20
24
  ],
21
25
  "dependencies": {
22
- "@elizaos/core": "^1.0.0-alpha.3",
26
+ "@elizaos/cli": "^1.0.0-alpha.30",
27
+ "@elizaos/core": "1.0.0-alpha.30",
23
28
  "zod": "3.21.4"
24
29
  },
25
30
  "devDependencies": {
26
31
  "tsup": "8.4.0"
27
32
  },
28
33
  "scripts": {
29
- "build": "tsup --format esm --dts",
30
- "dev": "tsup --format esm --dts --watch",
31
- "test": "vitest run"
34
+ "start": "npx @elizaos/cli start",
35
+ "test-with-cli": "cd ../cli && bun run build && cd ../plugin-starter && elizaos test",
36
+ "dev": "npx @elizaos/cli dev",
37
+ "build": "tsup",
38
+ "lint": "biome check --config-path=./ --write",
39
+ "test": "npx @elizaos/cli test",
40
+ "deploy": "npx @elizaos/cli deploy"
32
41
  },
33
42
  "publishConfig": {
34
43
  "access": "public"
@@ -36,5 +45,5 @@
36
45
  "resolutions": {
37
46
  "zod": "3.24.1"
38
47
  },
39
- "gitHead": "5e5fcaed92381cef9797be833ab5d43609dbdcf4"
48
+ "gitHead": "e75838cc4419928965fa959d16aeb013f09e5486"
40
49
  }
package/dist/index.d.ts DELETED
@@ -1,14 +0,0 @@
1
- import { Plugin, Service, IAgentRuntime } from '@elizaos/core';
2
-
3
- declare class StarterService extends Service {
4
- protected runtime: IAgentRuntime;
5
- static serviceType: string;
6
- capabilityDescription: string;
7
- constructor(runtime: IAgentRuntime);
8
- static start(runtime: IAgentRuntime): Promise<StarterService>;
9
- static stop(runtime: IAgentRuntime): Promise<void>;
10
- stop(): Promise<void>;
11
- }
12
- declare const starterPlugin: Plugin;
13
-
14
- export { StarterService, starterPlugin as default, starterPlugin };