@elizaos/plugin-starter 1.0.0-alpha.2 → 1.0.0-alpha.21
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 +7 -7
- package/dist/index.js.map +1 -1
- package/package.json +9 -6
- package/dist/index.d.ts +0 -14
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
|
-
|
|
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:
|
|
11
|
+
console.warn("Warning: Example plugin variable is not provided");
|
|
12
12
|
}
|
|
13
13
|
return val;
|
|
14
14
|
})
|
|
@@ -92,7 +92,7 @@ var starterPlugin = {
|
|
|
92
92
|
name: "plugin-starter",
|
|
93
93
|
description: "Plugin starter for elizaOS",
|
|
94
94
|
config: {
|
|
95
|
-
|
|
95
|
+
EXAMPLE_PLUGIN_VARIABLE: process.env.EXAMPLE_PLUGIN_VARIABLE
|
|
96
96
|
},
|
|
97
97
|
async init(config) {
|
|
98
98
|
logger.info("*** Initializing starter plugin ***");
|
|
@@ -162,15 +162,15 @@ var starterPlugin = {
|
|
|
162
162
|
console.log(Object.keys(params));
|
|
163
163
|
}
|
|
164
164
|
],
|
|
165
|
-
|
|
165
|
+
WORLD_CONNECTED: [
|
|
166
166
|
async (params) => {
|
|
167
|
-
console.log("
|
|
167
|
+
console.log("WORLD_CONNECTED event received");
|
|
168
168
|
console.log(Object.keys(params));
|
|
169
169
|
}
|
|
170
170
|
],
|
|
171
|
-
|
|
171
|
+
WORLD_JOINED: [
|
|
172
172
|
async (params) => {
|
|
173
|
-
console.log("
|
|
173
|
+
console.log("WORLD_JOINED event received");
|
|
174
174
|
console.log(Object.keys(params));
|
|
175
175
|
}
|
|
176
176
|
]
|
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,OAAO;AAAA,EAC7B,aAAa,EACX,OAAO,EACP,IAAI,GAAG,6BAA6B,EACpC,SAAS,EACT,UAAU,CAAC,QAAQ;AACnB,QAAI,CAAC,KAAK;AACT,cAAQ,KAAK,mCAAmC;AAAA,IACjD;AACA,WAAO;AAAA,EACR,CAAC;AACH,CAAC;AAMD,IAAM,mBAA2B;AAAA,EAChC,MAAM;AAAA,EACN,SAAS,CAAC,SAAS,WAAW;AAAA,EAC9B,aAAa;AAAA,EAEb,UAAU,OACT,UACA,UACA,WACsB;AAEtB,WAA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AAQ;AAAA,IACP;AAAA,MACC,MAAM;AAAA,MACN,MAAM;AAAA,MACN,SAAS,OAAO,MAAW,QAAa;AAEvC,YAAI,KAAK;AAAA,UACR,SAAS;AAAA,QACV,CAAC;AAAA,MACF;AAAA,IACD;AAAA,EACD;AAAA,EACA,QAAQ;AAAA,IACP,kBAAkB;AAAA,MACjB,OAAO,WAAW;AACjB,gBAAQ,IAAI,iCAAiC;AAE7C,gBAAQ,IAAI,OAAO,KAAK,MAAM,CAAC;AAAA,MAChC;AAAA,IACD;AAAA,IACA,wBAAwB;AAAA,MACvB,OAAO,WAAW;AACjB,gBAAQ,IAAI,uCAAuC;AAEnD,gBAAQ,IAAI,OAAO,KAAK,MAAM,CAAC;AAAA,MAChC;AAAA,IACD;AAAA,IACA,kBAAkB;AAAA,MACjB,OAAO,WAAW;AACjB,gBAAQ,IAAI,iCAAiC;AAE7C,gBAAQ,IAAI,OAAO,KAAK,MAAM,CAAC;AAAA,MAChC;AAAA,IACD;AAAA,IACA,eAAe;AAAA,MACd,OAAO,WAAW;AACjB,gBAAQ,IAAI,8BAA8B;AAE1C,gBAAQ,IAAI,OAAO,KAAK,MAAM,CAAC;AAAA,MAChC;AAAA,IACD;AAAA,EACD;AAAA,EACA,UAAU,CAAC,cAAc;AAAA,EACzB,SAAS,CAAC,gBAAgB;AAAA,EAC1B,WAAW,CAAC,kBAAkB;AAC/B;AACA,IAAO,gBAAQ;","names":[]}
|
|
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\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\tconsole.warn(\"Warning: Example plugin variable is 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 */\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 ***\");\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\tEXAMPLE_PLUGIN_VARIABLE: process.env.EXAMPLE_PLUGIN_VARIABLE,\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\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};\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,cAAQ,KAAK,kDAAkD;AAAA,IAChE;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,E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AA,MACC,MAAM;AAAA,MACN,MAAM;AAAA,MACN,SAAS,OAAO,MAAW,QAAa;AAEvC,YAAI,KAAK;AAAA,UACR,SAAS;AAAA,QACV,CAAC;AAAA,MACF;AAAA,IACD;AAAA,EACD;AAAA,EACA,QAAQ;AAAA,IACP,kBAAkB;AAAA,MACjB,OAAO,WAAW;AACjB,gBAAQ,IAAI,iCAAiC;AAE7C,gBAAQ,IAAI,OAAO,KAAK,MAAM,CAAC;AAAA,MAChC;AAAA,IACD;AAAA,IACA,wBAAwB;AAAA,MACvB,OAAO,WAAW;AACjB,gBAAQ,IAAI,uCAAuC;AAEnD,gBAAQ,IAAI,OAAO,KAAK,MAAM,CAAC;AAAA,MAChC;AAAA,IACD;AAAA,IACA,iBAAiB;AAAA,MAChB,OAAO,WAAW;AACjB,gBAAQ,IAAI,gCAAgC;AAE5C,gBAAQ,IAAI,OAAO,KAAK,MAAM,CAAC;AAAA,MAChC;AAAA,IACD;AAAA,IACA,cAAc;AAAA,MACb,OAAO,WAAW;AACjB,gBAAQ,IAAI,6BAA6B;AAEzC,gBAAQ,IAAI,OAAO,KAAK,MAAM,CAAC;AAAA,MAChC;AAAA,IACD;AAAA,EACD;AAAA,EACA,UAAU,CAAC,cAAc;AAAA,EACzB,SAAS,CAAC,gBAAgB;AAAA,EAC1B,WAAW,CAAC,kBAAkB;AAC/B;AACA,IAAO,gBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elizaos/plugin-starter",
|
|
3
3
|
"description": "Plugin starter for elizaOS",
|
|
4
|
-
"version": "1.0.0-alpha.
|
|
4
|
+
"version": "1.0.0-alpha.21",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -19,16 +19,19 @@
|
|
|
19
19
|
"dist"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@elizaos/core": "^1.0.0-alpha.
|
|
22
|
+
"@elizaos/core": "^1.0.0-alpha.21",
|
|
23
23
|
"zod": "3.21.4"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"tsup": "8.4.0"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
|
-
"build": "tsup
|
|
30
|
-
"dev": "tsup --
|
|
31
|
-
"test": "
|
|
29
|
+
"build": "tsup",
|
|
30
|
+
"dev": "tsup --watch",
|
|
31
|
+
"test": "cd ../cli && bun run build && cd ../plugin-starter && node ../cli/dist/index.js test",
|
|
32
|
+
"publish": "cd ../cli && bun run build && cd ../plugin-starter && node ../cli/dist/index.js plugins publish --test",
|
|
33
|
+
"lint": "biome check ./src --config-path=./ --apply-unsafe && biome format ./ --config-path=./ --write",
|
|
34
|
+
"clean": "rm -rf dist .turbo node_modules .turbo-tsconfig.json tsconfig.tsbuildinfo"
|
|
32
35
|
},
|
|
33
36
|
"publishConfig": {
|
|
34
37
|
"access": "public"
|
|
@@ -36,5 +39,5 @@
|
|
|
36
39
|
"resolutions": {
|
|
37
40
|
"zod": "3.24.1"
|
|
38
41
|
},
|
|
39
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "a1bb2c8ab6805f9585540a9a9e6b6ae39bfd4ed1"
|
|
40
43
|
}
|
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 };
|