@elizaos/cli 1.1.6 → 1.1.7-beta.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.
Files changed (45) hide show
  1. package/dist/{chunk-77IXJDDC.js → chunk-ECNPEB5D.js} +1 -1
  2. package/dist/{chunk-GILK2M6Z.js → chunk-RTC6IT4U.js} +1 -33
  3. package/dist/{chunk-KFGXZCQP.js → chunk-XJVXRHX2.js} +2 -2
  4. package/dist/{chunk-OHXCCMDW.js → chunk-ZVDUENTN.js} +6 -6
  5. package/dist/commands/agent/actions/index.js +1 -1
  6. package/dist/commands/agent/index.js +1 -1
  7. package/dist/commands/create/actions/index.js +3 -3
  8. package/dist/commands/create/index.js +4 -4
  9. package/dist/index.js +31 -8
  10. package/dist/{registry-FOS35FQH.js → registry-WE56QM2V.js} +1 -1
  11. package/dist/{setup-6XRSST5O.js → setup-R6L5JN2R.js} +2 -2
  12. package/dist/templates/plugin-starter/dist/index.js +381 -0
  13. package/dist/templates/plugin-starter/dist/index.js.map +1 -0
  14. package/dist/templates/project-starter/package.json +4 -4
  15. package/dist/templates/project-tee-starter/package.json +3 -3
  16. package/dist/{utils-QBGEZZ4I.js → utils-SLAKQOI6.js} +1 -3
  17. package/package.json +6 -6
  18. package/templates/plugin-starter/dist/.vite/manifest.json +11 -0
  19. package/templates/plugin-starter/dist/index.d.ts +14 -0
  20. package/templates/plugin-starter/dist/index.js +381 -0
  21. package/templates/plugin-starter/dist/index.js.map +1 -0
  22. package/templates/project-starter/package.json +4 -4
  23. package/templates/project-tee-starter/package.json +3 -3
  24. package/dist/assets/index-BXWgVSUO.css +0 -1
  25. package/dist/assets/index-BXWgVSUO.css.br +0 -0
  26. package/dist/assets/index-CkUr-lz0.js +0 -161648
  27. package/dist/assets/index-CkUr-lz0.js.br +0 -0
  28. package/dist/assets/index-CkUr-lz0.js.map +0 -1
  29. package/dist/assets/index-DA8nGyvG.js +0 -7484
  30. package/dist/assets/index-DA8nGyvG.js.br +0 -0
  31. package/dist/assets/index-DA8nGyvG.js.map +0 -1
  32. package/dist/assets/vendor-Dp9Dttv5.js +0 -5887
  33. package/dist/assets/vendor-Dp9Dttv5.js.br +0 -0
  34. package/dist/assets/vendor-Dp9Dttv5.js.map +0 -1
  35. package/dist/elizaos-avatar.png +0 -0
  36. package/dist/elizaos-icon.png +0 -0
  37. package/dist/elizaos-logo-light.png +0 -0
  38. package/dist/elizaos.webp +0 -0
  39. package/dist/favicon.ico +0 -0
  40. package/dist/images/agents/agent1.png +0 -0
  41. package/dist/images/agents/agent2.png +0 -0
  42. package/dist/images/agents/agent3.png +0 -0
  43. package/dist/images/agents/agent4.png +0 -0
  44. package/dist/images/agents/agent5.png +0 -0
  45. package/dist/index.html +0 -24
@@ -13,7 +13,7 @@ import {
13
13
  promptAndStoreOpenRouterKey,
14
14
  promptAndStorePostgresUrl,
15
15
  setupPgLite
16
- } from "./chunk-GILK2M6Z.js";
16
+ } from "./chunk-RTC6IT4U.js";
17
17
 
18
18
  // src/commands/create/actions/setup.ts
19
19
  import { existsSync } from "fs";
@@ -1166,37 +1166,6 @@ async function replacePluginNameInFiles(targetDir, pluginName) {
1166
1166
  });
1167
1167
  await Promise.all(promises2);
1168
1168
  }
1169
- async function copyClientDist() {
1170
- logger7.debug("Copying client dist files to CLI package");
1171
- const srcClientDist = path6.resolve(process.cwd(), "../client/dist");
1172
- const destClientDist = path6.resolve(process.cwd(), "./dist");
1173
- const indexSrc = path6.join(srcClientDist, "index.html");
1174
- const indexDest = path6.join(destClientDist, "index.html");
1175
- await fs5.mkdir(destClientDist, { recursive: true });
1176
- let retries = 0;
1177
- const maxRetries = 10;
1178
- const retryDelay = 1e3;
1179
- while (retries < maxRetries) {
1180
- if (existsSync5(indexSrc)) {
1181
- break;
1182
- }
1183
- logger7.info(`Waiting for client index.html (attempt ${retries + 1}/${maxRetries})\u2026`);
1184
- await new Promise((r) => setTimeout(r, retryDelay));
1185
- retries++;
1186
- }
1187
- if (!existsSync5(indexSrc)) {
1188
- logger7.error(`index.html not found at ${indexSrc} after ${maxRetries} attempts`);
1189
- logger7.error("Client package must be built before CLI package. Run: bun run build:client");
1190
- throw new Error("Client dist files not found - build the client package first");
1191
- }
1192
- await copyDir(srcClientDist, destClientDist);
1193
- if (!existsSync5(indexDest)) {
1194
- logger7.error(`index.html missing in CLI dist at ${indexDest}`);
1195
- throw new Error("Failed to copy client files to CLI dist directory");
1196
- }
1197
- logger7.info("\u2705 Client files successfully copied to CLI package");
1198
- logger7.success("Client dist files copied successfully");
1199
- }
1200
1169
 
1201
1170
  // src/utils/display-banner.ts
1202
1171
  import { existsSync as existsSync6, readFileSync as readFileSync4 } from "fs";
@@ -2788,7 +2757,7 @@ async function getGitHubCredentials() {
2788
2757
  }
2789
2758
  logger10.warn("Invalid GitHub token found in environment variables");
2790
2759
  }
2791
- const { getGitHubToken: getGitHubToken2 } = await import("./registry-FOS35FQH.js");
2760
+ const { getGitHubToken: getGitHubToken2 } = await import("./registry-WE56QM2V.js");
2792
2761
  const token = await getGitHubToken2() || void 0;
2793
2762
  if (token) {
2794
2763
  const isValid2 = await validateGitHubToken(token);
@@ -5386,7 +5355,6 @@ export {
5386
5355
  saveConfig,
5387
5356
  copyDir,
5388
5357
  copyTemplate,
5389
- copyClientDist,
5390
5358
  isRunningFromNodeModules,
5391
5359
  getVersion,
5392
5360
  getCliInstallTag,
@@ -12,11 +12,11 @@ import {
12
12
  selectEmbeddingModel,
13
13
  validateCreateOptions,
14
14
  validateProjectName
15
- } from "./chunk-OHXCCMDW.js";
15
+ } from "./chunk-ZVDUENTN.js";
16
16
  import {
17
17
  displayBanner,
18
18
  handleError
19
- } from "./chunk-GILK2M6Z.js";
19
+ } from "./chunk-RTC6IT4U.js";
20
20
 
21
21
  // src/commands/create/index.ts
22
22
  import { Command } from "commander";
@@ -4,7 +4,7 @@ const require = createRequire(import.meta.url);
4
4
 
5
5
  import {
6
6
  setupProjectEnvironment
7
- } from "./chunk-77IXJDDC.js";
7
+ } from "./chunk-ECNPEB5D.js";
8
8
  import {
9
9
  buildProjectWithSpinner,
10
10
  copyTemplate,
@@ -12,7 +12,7 @@ import {
12
12
  getDisplayDirectory,
13
13
  installDependenciesWithSpinner,
14
14
  runTasks
15
- } from "./chunk-GILK2M6Z.js";
15
+ } from "./chunk-RTC6IT4U.js";
16
16
 
17
17
  // src/characters/eliza.ts
18
18
  var baseCharacter = {
@@ -605,8 +605,8 @@ async function createTEEProject(projectName, targetDir, database, aiModel, embed
605
605
  await withCleanupOnInterrupt(teeTargetDir, projectName, async () => {
606
606
  await fs2.mkdir(teeTargetDir, { recursive: true });
607
607
  if (!isNonInteractive) {
608
- const { setupAIModelConfig, setupEmbeddingModelConfig } = await import("./setup-6XRSST5O.js");
609
- const { promptAndStorePostgresUrl } = await import("./utils-QBGEZZ4I.js");
608
+ const { setupAIModelConfig, setupEmbeddingModelConfig } = await import("./setup-R6L5JN2R.js");
609
+ const { promptAndStorePostgresUrl } = await import("./utils-SLAKQOI6.js");
610
610
  const envFilePath = `${teeTargetDir}/.env`;
611
611
  if (database === "postgres") {
612
612
  await promptAndStorePostgresUrl(envFilePath);
@@ -666,8 +666,8 @@ async function createProject(projectName, targetDir, database, aiModel, embeddin
666
666
  await fs2.mkdir(projectTargetDir, { recursive: true });
667
667
  }
668
668
  if (!isNonInteractive) {
669
- const { setupAIModelConfig, setupEmbeddingModelConfig } = await import("./setup-6XRSST5O.js");
670
- const { promptAndStorePostgresUrl } = await import("./utils-QBGEZZ4I.js");
669
+ const { setupAIModelConfig, setupEmbeddingModelConfig } = await import("./setup-R6L5JN2R.js");
670
+ const { promptAndStorePostgresUrl } = await import("./utils-SLAKQOI6.js");
671
671
  const envFilePath = `${projectTargetDir}/.env`;
672
672
  if (database === "postgres") {
673
673
  await promptAndStorePostgresUrl(envFilePath);
@@ -9,7 +9,7 @@ import {
9
9
  setAgentConfig,
10
10
  startAgent,
11
11
  stopAgent
12
- } from "../../../chunk-GILK2M6Z.js";
12
+ } from "../../../chunk-RTC6IT4U.js";
13
13
  import "../../../chunk-7PPBVSWE.js";
14
14
  import "../../../chunk-F24MS2YR.js";
15
15
  import "../../../chunk-AQ6OMR2A.js";
@@ -6,7 +6,7 @@ import {
6
6
  agent,
7
7
  getAgents,
8
8
  resolveAgentId
9
- } from "../../chunk-GILK2M6Z.js";
9
+ } from "../../chunk-RTC6IT4U.js";
10
10
  import "../../chunk-7PPBVSWE.js";
11
11
  import {
12
12
  getAgentRuntimeUrl,
@@ -7,14 +7,14 @@ import {
7
7
  createPlugin,
8
8
  createProject,
9
9
  createTEEProject
10
- } from "../../../chunk-OHXCCMDW.js";
10
+ } from "../../../chunk-ZVDUENTN.js";
11
11
  import {
12
12
  createProjectDirectories,
13
13
  setupAIModelConfig,
14
14
  setupEmbeddingModelConfig,
15
15
  setupProjectEnvironment
16
- } from "../../../chunk-77IXJDDC.js";
17
- import "../../../chunk-GILK2M6Z.js";
16
+ } from "../../../chunk-ECNPEB5D.js";
17
+ import "../../../chunk-RTC6IT4U.js";
18
18
  import "../../../chunk-7PPBVSWE.js";
19
19
  import "../../../chunk-F24MS2YR.js";
20
20
  import "../../../chunk-AQ6OMR2A.js";
@@ -4,10 +4,10 @@ const require = createRequire(import.meta.url);
4
4
 
5
5
  import {
6
6
  create
7
- } from "../../chunk-KFGXZCQP.js";
8
- import "../../chunk-OHXCCMDW.js";
9
- import "../../chunk-77IXJDDC.js";
10
- import "../../chunk-GILK2M6Z.js";
7
+ } from "../../chunk-XJVXRHX2.js";
8
+ import "../../chunk-ZVDUENTN.js";
9
+ import "../../chunk-ECNPEB5D.js";
10
+ import "../../chunk-RTC6IT4U.js";
11
11
  import "../../chunk-7PPBVSWE.js";
12
12
  import "../../chunk-F24MS2YR.js";
13
13
  import "../../chunk-AQ6OMR2A.js";
package/dist/index.js CHANGED
@@ -5,11 +5,11 @@ const require = createRequire(import.meta.url);
5
5
 
6
6
  import {
7
7
  create
8
- } from "./chunk-KFGXZCQP.js";
8
+ } from "./chunk-XJVXRHX2.js";
9
9
  import {
10
10
  getElizaCharacter
11
- } from "./chunk-OHXCCMDW.js";
12
- import "./chunk-77IXJDDC.js";
11
+ } from "./chunk-ZVDUENTN.js";
12
+ import "./chunk-ECNPEB5D.js";
13
13
  import {
14
14
  TestRunner,
15
15
  UserEnvironment,
@@ -46,7 +46,7 @@ import {
46
46
  testPublishToGitHub,
47
47
  testPublishToNpm,
48
48
  validateDataDir
49
- } from "./chunk-GILK2M6Z.js";
49
+ } from "./chunk-RTC6IT4U.js";
50
50
  import {
51
51
  configureEmojis,
52
52
  emoji,
@@ -4569,13 +4569,36 @@ async function stopAgent(runtime, server) {
4569
4569
  // src/commands/start/actions/server-start.ts
4570
4570
  import path22 from "path";
4571
4571
  import { fileURLToPath as fileURLToPath4 } from "url";
4572
+ import { existsSync as existsSync14, readFileSync as readFileSync6 } from "fs";
4572
4573
  async function startAgents(options) {
4573
4574
  const postgresUrl = await configureDatabaseSettings(options.configure);
4574
4575
  if (postgresUrl) process.env.POSTGRES_URL = postgresUrl;
4575
4576
  const pgliteDataDir = postgresUrl ? void 0 : await resolvePgliteDir();
4576
4577
  const __filename = fileURLToPath4(import.meta.url);
4577
4578
  const __dirname = path22.dirname(__filename);
4578
- const cliDistPath = path22.resolve(__dirname, "../../../");
4579
+ let cliDistPath = path22.resolve(__dirname, "../../../");
4580
+ const indexPath = path22.join(cliDistPath, "index.html");
4581
+ if (!existsSync14(indexPath)) {
4582
+ let currentDir = __dirname;
4583
+ while (currentDir !== path22.dirname(currentDir)) {
4584
+ const packageJsonPath = path22.join(currentDir, "package.json");
4585
+ if (existsSync14(packageJsonPath)) {
4586
+ try {
4587
+ const packageJson = JSON.parse(readFileSync6(packageJsonPath, "utf-8"));
4588
+ if (packageJson.name === "@elizaos/cli") {
4589
+ const distPath = path22.join(currentDir, "dist");
4590
+ if (existsSync14(path22.join(distPath, "index.html"))) {
4591
+ cliDistPath = distPath;
4592
+ break;
4593
+ }
4594
+ }
4595
+ } catch {
4596
+ }
4597
+ }
4598
+ currentDir = path22.dirname(currentDir);
4599
+ }
4600
+ }
4601
+ logger18.debug(`[CLI] Resolved client dist path: ${cliDistPath}`);
4579
4602
  const server = new AgentServer();
4580
4603
  await server.initialize({
4581
4604
  dataDir: pgliteDataDir,
@@ -4791,7 +4814,7 @@ async function installPluginDependencies(projectInfo) {
4791
4814
  };
4792
4815
  await fs11.promises.writeFile(packageJsonPath, JSON.stringify(packageJsonContent, null, 2));
4793
4816
  }
4794
- const { installPlugin: installPlugin2 } = await import("./utils-QBGEZZ4I.js");
4817
+ const { installPlugin: installPlugin2 } = await import("./utils-SLAKQOI6.js");
4795
4818
  for (const dependency of project.pluginModule.dependencies) {
4796
4819
  await installPlugin2(dependency, pluginsDir);
4797
4820
  const dependencyPath = path24.join(pluginsDir, "node_modules", dependency);
@@ -4817,10 +4840,10 @@ import path26 from "path";
4817
4840
  import { logger as logger21 } from "@elizaos/core";
4818
4841
  import { execa as execa9 } from "execa";
4819
4842
  import path25 from "path";
4820
- import { existsSync as existsSync16 } from "fs";
4843
+ import { existsSync as existsSync17 } from "fs";
4821
4844
  async function runTypeCheck(projectPath, strict = true) {
4822
4845
  const tsconfigPath = path25.join(projectPath, "tsconfig.json");
4823
- if (!existsSync16(tsconfigPath)) {
4846
+ if (!existsSync17(tsconfigPath)) {
4824
4847
  return {
4825
4848
  success: false,
4826
4849
  errors: [`No tsconfig.json found at ${tsconfigPath}`],
@@ -28,7 +28,7 @@ import {
28
28
  setEnvVar,
29
29
  setGitHubToken,
30
30
  validateDataDir
31
- } from "./chunk-GILK2M6Z.js";
31
+ } from "./chunk-RTC6IT4U.js";
32
32
  import "./chunk-7PPBVSWE.js";
33
33
  import "./chunk-F24MS2YR.js";
34
34
  import "./chunk-AQ6OMR2A.js";
@@ -7,8 +7,8 @@ import {
7
7
  setupAIModelConfig,
8
8
  setupEmbeddingModelConfig,
9
9
  setupProjectEnvironment
10
- } from "./chunk-77IXJDDC.js";
11
- import "./chunk-GILK2M6Z.js";
10
+ } from "./chunk-ECNPEB5D.js";
11
+ import "./chunk-RTC6IT4U.js";
12
12
  import "./chunk-7PPBVSWE.js";
13
13
  import "./chunk-F24MS2YR.js";
14
14
  import "./chunk-AQ6OMR2A.js";
@@ -0,0 +1,381 @@
1
+ // src/plugin.ts
2
+ import {
3
+ ModelType,
4
+ Service,
5
+ logger
6
+ } from "@elizaos/core";
7
+ import { z } from "zod";
8
+
9
+ // src/__tests__/e2e/starter-plugin.ts
10
+ var StarterPluginTestSuite = {
11
+ name: "plugin_starter_test_suite",
12
+ description: "E2E tests for the starter plugin",
13
+ tests: [
14
+ /**
15
+ * Basic Plugin Verification Test
16
+ * ------------------------------
17
+ * This test verifies that the plugin is properly loaded and initialized
18
+ * within the runtime environment.
19
+ */
20
+ {
21
+ name: "example_test",
22
+ fn: async (runtime) => {
23
+ if (runtime.character.name !== "Eliza") {
24
+ throw new Error(
25
+ `Expected character name to be "Eliza" but got "${runtime.character.name}"`
26
+ );
27
+ }
28
+ const service = runtime.getService("starter");
29
+ if (!service) {
30
+ throw new Error("Starter service not found");
31
+ }
32
+ }
33
+ },
34
+ /**
35
+ * Action Registration Test
36
+ * ------------------------
37
+ * Verifies that custom actions are properly registered with the runtime.
38
+ * This is important to ensure actions are available for the agent to use.
39
+ */
40
+ {
41
+ name: "should_have_hello_world_action",
42
+ fn: async (runtime) => {
43
+ const actionExists = runtime.actions?.some((a) => a.name === "HELLO_WORLD");
44
+ if (!actionExists) {
45
+ throw new Error("Hello world action not found in runtime actions");
46
+ }
47
+ }
48
+ },
49
+ /**
50
+ * Hello World Action Response Test
51
+ * ---------------------------------
52
+ * This test demonstrates a complete scenario where:
53
+ * 1. The agent is asked to say "hello"
54
+ * 2. The HELLO_WORLD action is triggered
55
+ * 3. The agent responds with text containing "hello world"
56
+ *
57
+ * This is a key pattern for testing agent behaviors - you simulate
58
+ * a user message and verify the agent's response.
59
+ */
60
+ {
61
+ name: "hello_world_action_test",
62
+ fn: async (runtime) => {
63
+ const testMessage = {
64
+ entityId: "12345678-1234-1234-1234-123456789012",
65
+ roomId: "12345678-1234-1234-1234-123456789012",
66
+ content: {
67
+ text: "Can you say hello?",
68
+ source: "test",
69
+ actions: ["HELLO_WORLD"]
70
+ // Specify which action we expect to trigger
71
+ }
72
+ };
73
+ const testState = {
74
+ values: {},
75
+ data: {},
76
+ text: ""
77
+ };
78
+ let responseText = "";
79
+ let responseReceived = false;
80
+ const helloWorldAction2 = runtime.actions?.find((a) => a.name === "HELLO_WORLD");
81
+ if (!helloWorldAction2) {
82
+ throw new Error("Hello world action not found in runtime actions");
83
+ }
84
+ const callback = async (response) => {
85
+ responseReceived = true;
86
+ responseText = response.text || "";
87
+ if (!response.actions?.includes("HELLO_WORLD")) {
88
+ throw new Error("Response did not include HELLO_WORLD action");
89
+ }
90
+ return Promise.resolve([]);
91
+ };
92
+ await helloWorldAction2.handler(runtime, testMessage, testState, {}, callback);
93
+ if (!responseReceived) {
94
+ throw new Error("Hello world action did not produce a response");
95
+ }
96
+ if (!responseText.toLowerCase().includes("hello world")) {
97
+ throw new Error(`Expected response to contain "hello world" but got: "${responseText}"`);
98
+ }
99
+ }
100
+ },
101
+ /**
102
+ * Provider Functionality Test
103
+ * ---------------------------
104
+ * Tests that providers can supply data to the agent when needed.
105
+ * Providers are used to fetch external data or compute values.
106
+ */
107
+ {
108
+ name: "hello_world_provider_test",
109
+ fn: async (runtime) => {
110
+ const testMessage = {
111
+ entityId: "12345678-1234-1234-1234-123456789012",
112
+ roomId: "12345678-1234-1234-1234-123456789012",
113
+ content: {
114
+ text: "What can you provide?",
115
+ source: "test"
116
+ }
117
+ };
118
+ const testState = {
119
+ values: {},
120
+ data: {},
121
+ text: ""
122
+ };
123
+ const helloWorldProvider2 = runtime.providers?.find(
124
+ (p) => p.name === "HELLO_WORLD_PROVIDER"
125
+ );
126
+ if (!helloWorldProvider2) {
127
+ throw new Error("Hello world provider not found in runtime providers");
128
+ }
129
+ const result = await helloWorldProvider2.get(runtime, testMessage, testState);
130
+ if (result.text !== "I am a provider") {
131
+ throw new Error(`Expected provider to return "I am a provider", got "${result.text}"`);
132
+ }
133
+ }
134
+ },
135
+ /**
136
+ * Service Lifecycle Test
137
+ * ----------------------
138
+ * Verifies that services can be started, accessed, and stopped properly.
139
+ * Services run background tasks or manage long-lived resources.
140
+ */
141
+ {
142
+ name: "starter_service_test",
143
+ fn: async (runtime) => {
144
+ const service = runtime.getService("starter");
145
+ if (!service) {
146
+ throw new Error("Starter service not found");
147
+ }
148
+ if (service.capabilityDescription !== "This is a starter service which is attached to the agent through the starter plugin.") {
149
+ throw new Error("Incorrect service capability description");
150
+ }
151
+ await service.stop();
152
+ }
153
+ }
154
+ /**
155
+ * ADD YOUR CUSTOM TESTS HERE
156
+ * --------------------------
157
+ * To add a new test:
158
+ *
159
+ * 1. Copy this template:
160
+ * ```typescript
161
+ * {
162
+ * name: 'your_test_name',
163
+ * fn: async (runtime) => {
164
+ * // Setup: Create any test data needed
165
+ *
166
+ * // Action: Perform the operation you want to test
167
+ *
168
+ * // Assert: Check the results
169
+ * if (result !== expected) {
170
+ * throw new Error(`Expected ${expected} but got ${result}`);
171
+ * }
172
+ * }
173
+ * }
174
+ * ```
175
+ *
176
+ * 2. Common test patterns:
177
+ * - Test action responses to specific prompts
178
+ * - Verify provider data under different conditions
179
+ * - Check service behavior during lifecycle events
180
+ * - Validate plugin configuration handling
181
+ * - Test error cases and edge conditions
182
+ *
183
+ * 3. Tips:
184
+ * - Use meaningful variable names
185
+ * - Include helpful error messages
186
+ * - Test one thing per test
187
+ * - Consider both success and failure scenarios
188
+ */
189
+ ]
190
+ };
191
+
192
+ // src/plugin.ts
193
+ var configSchema = z.object({
194
+ EXAMPLE_PLUGIN_VARIABLE: z.string().min(1, "Example plugin variable is not provided").optional().transform((val) => {
195
+ if (!val) {
196
+ logger.warn("Example plugin variable is not provided (this is expected)");
197
+ }
198
+ return val;
199
+ })
200
+ });
201
+ var helloWorldAction = {
202
+ name: "HELLO_WORLD",
203
+ similes: ["GREET", "SAY_HELLO"],
204
+ description: "Responds with a simple hello world message",
205
+ validate: async (_runtime, _message, _state) => {
206
+ return true;
207
+ },
208
+ handler: async (_runtime, message, _state, _options, callback, _responses) => {
209
+ try {
210
+ logger.info("Handling HELLO_WORLD action");
211
+ const responseContent = {
212
+ text: "hello world!",
213
+ actions: ["HELLO_WORLD"],
214
+ source: message.content.source
215
+ };
216
+ if (callback) {
217
+ await callback(responseContent);
218
+ }
219
+ return responseContent;
220
+ } catch (error) {
221
+ logger.error("Error in HELLO_WORLD action:", error);
222
+ throw error;
223
+ }
224
+ },
225
+ examples: [
226
+ [
227
+ {
228
+ name: "{{name1}}",
229
+ content: {
230
+ text: "Can you say hello?"
231
+ }
232
+ },
233
+ {
234
+ name: "{{name2}}",
235
+ content: {
236
+ text: "hello world!",
237
+ actions: ["HELLO_WORLD"]
238
+ }
239
+ }
240
+ ]
241
+ ]
242
+ };
243
+ var helloWorldProvider = {
244
+ name: "HELLO_WORLD_PROVIDER",
245
+ description: "A simple example provider",
246
+ get: async (_runtime, _message, _state) => {
247
+ return {
248
+ text: "I am a provider",
249
+ values: {},
250
+ data: {}
251
+ };
252
+ }
253
+ };
254
+ var StarterService = class _StarterService extends Service {
255
+ constructor(runtime) {
256
+ super(runtime);
257
+ this.runtime = runtime;
258
+ }
259
+ static serviceType = "starter";
260
+ capabilityDescription = "This is a starter service which is attached to the agent through the starter plugin.";
261
+ static async start(runtime) {
262
+ logger.info(`*** Starting starter service - MODIFIED: ${(/* @__PURE__ */ new Date()).toISOString()} ***`);
263
+ const service = new _StarterService(runtime);
264
+ return service;
265
+ }
266
+ static async stop(runtime) {
267
+ logger.info("*** TESTING DEV MODE - STOP MESSAGE CHANGED! ***");
268
+ const service = runtime.getService(_StarterService.serviceType);
269
+ if (!service) {
270
+ throw new Error("Starter service not found");
271
+ }
272
+ service.stop();
273
+ }
274
+ async stop() {
275
+ logger.info("*** THIRD CHANGE - TESTING FILE WATCHING! ***");
276
+ }
277
+ };
278
+ var starterPlugin = {
279
+ name: "plugin-starter",
280
+ description: "Plugin starter for elizaOS",
281
+ config: {
282
+ EXAMPLE_PLUGIN_VARIABLE: process.env.EXAMPLE_PLUGIN_VARIABLE
283
+ },
284
+ async init(config) {
285
+ logger.info("*** TESTING DEV MODE - PLUGIN MODIFIED AND RELOADED! ***");
286
+ try {
287
+ const validatedConfig = await configSchema.parseAsync(config);
288
+ for (const [key, value] of Object.entries(validatedConfig)) {
289
+ if (value) process.env[key] = value;
290
+ }
291
+ } catch (error) {
292
+ if (error instanceof z.ZodError) {
293
+ throw new Error(
294
+ `Invalid plugin configuration: ${error.errors.map((e) => e.message).join(", ")}`
295
+ );
296
+ }
297
+ throw error;
298
+ }
299
+ },
300
+ models: {
301
+ [ModelType.TEXT_SMALL]: async (_runtime, { prompt, stopSequences = [] }) => {
302
+ return "Never gonna give you up, never gonna let you down, never gonna run around and desert you...";
303
+ },
304
+ [ModelType.TEXT_LARGE]: async (_runtime, {
305
+ prompt,
306
+ stopSequences = [],
307
+ maxTokens = 8192,
308
+ temperature = 0.7,
309
+ frequencyPenalty = 0.7,
310
+ presencePenalty = 0.7
311
+ }) => {
312
+ return "Never gonna make you cry, never gonna say goodbye, never gonna tell a lie and hurt you...";
313
+ }
314
+ },
315
+ routes: [
316
+ {
317
+ name: "hello-world-route",
318
+ path: "/helloworld",
319
+ type: "GET",
320
+ handler: async (_req, res) => {
321
+ res.json({
322
+ message: "Hello World!"
323
+ });
324
+ }
325
+ },
326
+ {
327
+ name: "current-time-route",
328
+ path: "/api/time",
329
+ type: "GET",
330
+ handler: async (_req, res) => {
331
+ const now = /* @__PURE__ */ new Date();
332
+ res.json({
333
+ timestamp: now.toISOString(),
334
+ unix: Math.floor(now.getTime() / 1e3),
335
+ formatted: now.toLocaleString(),
336
+ timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
337
+ });
338
+ }
339
+ }
340
+ ],
341
+ events: {
342
+ MESSAGE_RECEIVED: [
343
+ async (params) => {
344
+ logger.debug("MESSAGE_RECEIVED event received");
345
+ logger.debug(Object.keys(params));
346
+ }
347
+ ],
348
+ VOICE_MESSAGE_RECEIVED: [
349
+ async (params) => {
350
+ logger.debug("VOICE_MESSAGE_RECEIVED event received");
351
+ logger.debug(Object.keys(params));
352
+ }
353
+ ],
354
+ WORLD_CONNECTED: [
355
+ async (params) => {
356
+ logger.debug("WORLD_CONNECTED event received");
357
+ logger.debug(Object.keys(params));
358
+ }
359
+ ],
360
+ WORLD_JOINED: [
361
+ async (params) => {
362
+ logger.debug("WORLD_JOINED event received");
363
+ logger.debug(Object.keys(params));
364
+ }
365
+ ]
366
+ },
367
+ services: [StarterService],
368
+ actions: [helloWorldAction],
369
+ providers: [helloWorldProvider],
370
+ tests: [StarterPluginTestSuite]
371
+ // dependencies: ['@elizaos/plugin-knowledge'], <--- plugin dependecies go here (if requires another plugin)
372
+ };
373
+
374
+ // src/index.ts
375
+ var index_default = starterPlugin;
376
+ export {
377
+ StarterService,
378
+ index_default as default,
379
+ starterPlugin
380
+ };
381
+ //# sourceMappingURL=index.js.map