@elizaos/cli 1.3.0 → 1.3.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.
Files changed (148) hide show
  1. package/README.md +1 -1
  2. package/dist/{chunk-2CUIHNPL.js → chunk-5GUS4CFO.js} +7 -2
  3. package/dist/{chunk-2ALAPQLV.js → chunk-E6XYTE3A.js} +296 -311
  4. package/dist/chunk-GXWWPFBO.js +39 -0
  5. package/dist/{chunk-I77ZRNYO.js → chunk-T2QDIXGU.js} +2 -2
  6. package/dist/commands/agent/actions/index.d.ts +5 -0
  7. package/dist/commands/agent/actions/index.js +2 -2
  8. package/dist/commands/agent/index.d.ts +2 -2
  9. package/dist/commands/agent/index.js +2 -2
  10. package/dist/commands/create/actions/index.js +3 -3
  11. package/dist/commands/create/index.js +4 -4
  12. package/dist/commands/shared/index.d.ts +11 -28
  13. package/dist/commands/shared/index.js +7 -3
  14. package/dist/index.js +541 -450
  15. package/dist/{registry-N626N4VG.js → registry-433S5F3Y.js} +2 -2
  16. package/dist/templates/plugin-quick-starter/.gitignore +66 -0
  17. package/dist/templates/plugin-quick-starter/.npmignore +5 -0
  18. package/dist/templates/plugin-quick-starter/package.json +11 -3
  19. package/dist/templates/plugin-quick-starter/src/__tests__/plugin.test.ts +499 -146
  20. package/dist/templates/plugin-quick-starter/src/__tests__/test-utils.ts +316 -115
  21. package/dist/templates/plugin-quick-starter/src/plugin.ts +7 -13
  22. package/dist/templates/plugin-starter/.gitignore +66 -0
  23. package/dist/templates/plugin-starter/.npmignore +5 -0
  24. package/dist/templates/plugin-starter/README.md +1 -1
  25. package/dist/templates/plugin-starter/package.json +11 -3
  26. package/dist/templates/plugin-starter/src/__tests__/integration.test.ts +13 -13
  27. package/dist/templates/plugin-starter/src/__tests__/plugin.test.ts +556 -129
  28. package/dist/templates/plugin-starter/src/__tests__/test-utils.ts +347 -115
  29. package/dist/templates/plugin-starter/src/plugin.ts +18 -22
  30. package/dist/templates/project-starter/.gitignore +57 -0
  31. package/dist/templates/project-starter/.npmignore +11 -0
  32. package/dist/templates/project-starter/README.md +1 -1
  33. package/dist/templates/project-starter/package.json +4 -4
  34. package/dist/templates/project-starter/src/__tests__/env.test.ts +3 -1
  35. package/dist/templates/project-starter/src/__tests__/file-structure.test.ts +3 -2
  36. package/dist/templates/project-starter/src/__tests__/integration.test.ts +1 -1
  37. package/dist/templates/project-starter/tsup.config.ts +2 -1
  38. package/dist/templates/project-tee-starter/.dockerignore +64 -14
  39. package/dist/templates/project-tee-starter/.gitignore +57 -0
  40. package/dist/templates/project-tee-starter/.npmignore +6 -0
  41. package/dist/templates/project-tee-starter/Dockerfile +9 -5
  42. package/dist/templates/project-tee-starter/GUIDE.md +103 -42
  43. package/dist/templates/project-tee-starter/README.md +39 -19
  44. package/dist/templates/project-tee-starter/__tests__/build-order.test.ts +62 -0
  45. package/dist/templates/project-tee-starter/__tests__/character.test.ts +19 -17
  46. package/dist/templates/project-tee-starter/__tests__/config.test.ts +10 -3
  47. package/dist/templates/project-tee-starter/__tests__/env.test.ts +2 -1
  48. package/dist/templates/project-tee-starter/__tests__/file-structure.test.ts +14 -3
  49. package/dist/templates/project-tee-starter/__tests__/frontend.test.ts +459 -0
  50. package/dist/templates/project-tee-starter/__tests__/plugin.test.ts +4 -2
  51. package/dist/templates/project-tee-starter/__tests__/routes.test.ts +15 -6
  52. package/dist/templates/project-tee-starter/__tests__/tee-validation.test.ts +295 -0
  53. package/dist/templates/project-tee-starter/__tests__/vite-config-utils.ts +39 -0
  54. package/dist/templates/project-tee-starter/docker-compose.yaml +5 -2
  55. package/dist/templates/{plugin-starter/dist → project-tee-starter}/index.html +3 -3
  56. package/dist/templates/project-tee-starter/package.json +34 -14
  57. package/dist/templates/project-tee-starter/postcss.config.js +3 -0
  58. package/dist/templates/project-tee-starter/scripts/install-test-deps.js +52 -0
  59. package/dist/templates/project-tee-starter/scripts/test-all.sh +82 -0
  60. package/dist/templates/project-tee-starter/src/frontend/index.css +106 -0
  61. package/dist/templates/project-tee-starter/src/frontend/index.html +20 -0
  62. package/dist/templates/project-tee-starter/src/frontend/index.tsx +370 -0
  63. package/dist/templates/project-tee-starter/src/frontend/panels.tsx +17 -0
  64. package/dist/templates/project-tee-starter/src/frontend/utils.ts +6 -0
  65. package/dist/templates/project-tee-starter/src/index.ts +6 -6
  66. package/dist/templates/project-tee-starter/src/plugin.ts +209 -59
  67. package/dist/templates/project-tee-starter/tailwind.config.js +62 -0
  68. package/dist/templates/project-tee-starter/tsconfig.build.json +2 -2
  69. package/dist/templates/project-tee-starter/tsconfig.json +8 -5
  70. package/dist/templates/project-tee-starter/tsup.config.ts +3 -2
  71. package/dist/templates/project-tee-starter/vite.config.ts +39 -0
  72. package/dist/url-utils-CKc_Ebt_.d.ts +35 -0
  73. package/dist/{utils-H66532NB.js → utils-DBLSDYBF.js} +2 -2
  74. package/package.json +12 -7
  75. package/templates/plugin-quick-starter/.gitignore +66 -0
  76. package/templates/plugin-quick-starter/.npmignore +5 -0
  77. package/templates/plugin-quick-starter/package.json +11 -3
  78. package/templates/plugin-quick-starter/src/__tests__/plugin.test.ts +499 -146
  79. package/templates/plugin-quick-starter/src/__tests__/test-utils.ts +316 -115
  80. package/templates/plugin-quick-starter/src/plugin.ts +7 -13
  81. package/templates/plugin-starter/.gitignore +66 -0
  82. package/templates/plugin-starter/.npmignore +5 -0
  83. package/templates/plugin-starter/README.md +1 -1
  84. package/templates/plugin-starter/package.json +11 -3
  85. package/templates/plugin-starter/src/__tests__/integration.test.ts +13 -13
  86. package/templates/plugin-starter/src/__tests__/plugin.test.ts +556 -129
  87. package/templates/plugin-starter/src/__tests__/test-utils.ts +347 -115
  88. package/templates/plugin-starter/src/plugin.ts +18 -22
  89. package/templates/project-starter/.gitignore +57 -0
  90. package/templates/project-starter/.npmignore +11 -0
  91. package/templates/project-starter/README.md +1 -1
  92. package/templates/project-starter/package.json +4 -4
  93. package/templates/project-starter/src/__tests__/env.test.ts +3 -1
  94. package/templates/project-starter/src/__tests__/file-structure.test.ts +3 -2
  95. package/templates/project-starter/src/__tests__/integration.test.ts +1 -1
  96. package/templates/project-starter/tsup.config.ts +2 -1
  97. package/templates/project-tee-starter/.dockerignore +64 -14
  98. package/templates/project-tee-starter/.gitignore +57 -0
  99. package/templates/project-tee-starter/.npmignore +6 -0
  100. package/templates/project-tee-starter/Dockerfile +9 -5
  101. package/templates/project-tee-starter/GUIDE.md +103 -42
  102. package/templates/project-tee-starter/README.md +39 -19
  103. package/templates/project-tee-starter/__tests__/build-order.test.ts +62 -0
  104. package/templates/project-tee-starter/__tests__/character.test.ts +19 -17
  105. package/templates/project-tee-starter/__tests__/config.test.ts +10 -3
  106. package/templates/project-tee-starter/__tests__/env.test.ts +2 -1
  107. package/templates/project-tee-starter/__tests__/file-structure.test.ts +14 -3
  108. package/templates/project-tee-starter/__tests__/frontend.test.ts +459 -0
  109. package/templates/project-tee-starter/__tests__/plugin.test.ts +4 -2
  110. package/templates/project-tee-starter/__tests__/routes.test.ts +15 -6
  111. package/templates/project-tee-starter/__tests__/tee-validation.test.ts +295 -0
  112. package/templates/project-tee-starter/__tests__/vite-config-utils.ts +39 -0
  113. package/templates/project-tee-starter/docker-compose.yaml +5 -2
  114. package/templates/{plugin-starter/dist → project-tee-starter}/index.html +3 -3
  115. package/templates/project-tee-starter/package.json +34 -14
  116. package/templates/project-tee-starter/postcss.config.js +3 -0
  117. package/templates/project-tee-starter/scripts/install-test-deps.js +52 -0
  118. package/templates/project-tee-starter/scripts/test-all.sh +82 -0
  119. package/templates/project-tee-starter/src/frontend/index.css +106 -0
  120. package/templates/project-tee-starter/src/frontend/index.html +20 -0
  121. package/templates/project-tee-starter/src/frontend/index.tsx +370 -0
  122. package/templates/project-tee-starter/src/frontend/panels.tsx +17 -0
  123. package/templates/project-tee-starter/src/frontend/utils.ts +6 -0
  124. package/templates/project-tee-starter/src/index.ts +6 -6
  125. package/templates/project-tee-starter/src/plugin.ts +209 -59
  126. package/templates/project-tee-starter/tailwind.config.js +62 -0
  127. package/templates/project-tee-starter/tsconfig.build.json +2 -2
  128. package/templates/project-tee-starter/tsconfig.json +8 -5
  129. package/templates/project-tee-starter/tsup.config.ts +3 -2
  130. package/templates/project-tee-starter/vite.config.ts +39 -0
  131. package/dist/chunk-4O6EZU37.js +0 -14
  132. package/dist/migration-guides/advanced-migration-guide.md +0 -459
  133. package/dist/migration-guides/completion-requirements.md +0 -379
  134. package/dist/migration-guides/integrated-migration-loop.md +0 -392
  135. package/dist/migration-guides/migration-guide.md +0 -712
  136. package/dist/migration-guides/prompt-and-generation-guide.md +0 -702
  137. package/dist/migration-guides/state-and-providers-guide.md +0 -544
  138. package/dist/migration-guides/testing-guide.md +0 -1021
  139. package/dist/templates/plugin-starter/dist/assets/index-CgkejLs_.css +0 -1
  140. package/dist/templates/plugin-starter/dist/assets/index-D1cHX53P.js +0 -49
  141. package/dist/templates/plugin-starter/dist/index.js +0 -387
  142. package/dist/templates/plugin-starter/dist/index.js.map +0 -1
  143. package/templates/plugin-starter/dist/.vite/manifest.json +0 -11
  144. package/templates/plugin-starter/dist/assets/index-CgkejLs_.css +0 -1
  145. package/templates/plugin-starter/dist/assets/index-D1cHX53P.js +0 -49
  146. package/templates/plugin-starter/dist/index.d.ts +0 -14
  147. package/templates/plugin-starter/dist/index.js +0 -387
  148. package/templates/plugin-starter/dist/index.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env bun
2
2
  import {
3
3
  create
4
- } from "./chunk-I77ZRNYO.js";
4
+ } from "./chunk-T2QDIXGU.js";
5
5
  import {
6
6
  getElizaCharacter
7
- } from "./chunk-2CUIHNPL.js";
7
+ } from "./chunk-5GUS4CFO.js";
8
8
  import {
9
9
  TestRunner,
10
10
  UserEnvironment,
@@ -38,18 +38,19 @@ import {
38
38
  provideLocalPluginGuidance,
39
39
  publishToGitHub,
40
40
  resolvePgliteDir,
41
+ runBunWithSpinner,
41
42
  saveRegistrySettings,
42
43
  testPublishToGitHub,
43
44
  testPublishToNpm,
44
45
  tryDelegateToLocalCli,
45
46
  validateDataDir
46
- } from "./chunk-2ALAPQLV.js";
47
+ } from "./chunk-E6XYTE3A.js";
47
48
  import {
48
49
  configureEmojis,
49
50
  emoji,
50
51
  runBunCommand
51
52
  } from "./chunk-FDEDLANP.js";
52
- import "./chunk-4O6EZU37.js";
53
+ import "./chunk-GXWWPFBO.js";
53
54
  import {
54
55
  bunExec,
55
56
  bunExecInherit,
@@ -263,8 +264,8 @@ async function getLocalCliPath() {
263
264
  "index.js"
264
265
  );
265
266
  try {
266
- const fs14 = await import("fs");
267
- return fs14.existsSync(localCliPath) ? localCliPath : null;
267
+ const fs15 = await import("fs");
268
+ return fs15.existsSync(localCliPath) ? localCliPath : null;
268
269
  } catch {
269
270
  return null;
270
271
  }
@@ -410,10 +411,95 @@ async function stopServer() {
410
411
  return stopServerProcess();
411
412
  }
412
413
 
413
- // src/commands/dev/actions/dev-server.ts
414
+ // src/utils/dependency-manager.ts
415
+ import * as fs from "fs";
416
+ import * as path4 from "path";
414
417
  import { logger } from "@elizaos/core";
418
+ function hasElizaOSCli(packageJsonPath) {
419
+ try {
420
+ if (!fs.existsSync(packageJsonPath)) {
421
+ return false;
422
+ }
423
+ let packageJson;
424
+ try {
425
+ packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
426
+ } catch (parseError) {
427
+ logger.debug(`Error parsing JSON in package.json at ${packageJsonPath}:`, parseError);
428
+ return false;
429
+ }
430
+ const dependencies = packageJson.dependencies || {};
431
+ const devDependencies = packageJson.devDependencies || {};
432
+ return "@elizaos/cli" in dependencies || "@elizaos/cli" in devDependencies;
433
+ } catch (error) {
434
+ logger.debug(`Error reading package.json at ${packageJsonPath}:`, error);
435
+ return false;
436
+ }
437
+ }
438
+ function shouldAutoInstallCli(cwd = process.cwd()) {
439
+ if (process.env.ELIZA_NO_AUTO_INSTALL === "true") {
440
+ logger.debug("Auto-install disabled via ELIZA_NO_AUTO_INSTALL");
441
+ return false;
442
+ }
443
+ if (process.env.CI === "true" || process.env.ELIZA_TEST_MODE === "true") {
444
+ logger.debug("Skipping auto-install in CI/test environment");
445
+ return false;
446
+ }
447
+ const dirInfo = detectDirectoryType(cwd);
448
+ if (dirInfo.type === "elizaos-monorepo" || dirInfo.monorepoRoot) {
449
+ logger.debug("Skipping auto-install in monorepo");
450
+ return false;
451
+ }
452
+ if (!dirInfo.hasPackageJson) {
453
+ logger.debug("No package.json found, skipping auto-install");
454
+ return false;
455
+ }
456
+ const packageJsonPath = path4.join(cwd, "package.json");
457
+ if (hasElizaOSCli(packageJsonPath)) {
458
+ logger.debug("@elizaos/cli already present, skipping auto-install");
459
+ return false;
460
+ }
461
+ return true;
462
+ }
463
+ async function installElizaOSCli(cwd = process.cwd()) {
464
+ try {
465
+ logger.info("Adding @elizaos/cli as dev dependency for enhanced development experience...");
466
+ const result = await runBunWithSpinner(["add", "--dev", "@elizaos/cli"], cwd, {
467
+ spinnerText: "Installing @elizaos/cli with bun...",
468
+ successText: "\u2713 @elizaos/cli installed successfully",
469
+ errorText: "Failed to install @elizaos/cli",
470
+ showOutputOnError: false
471
+ // Don't show verbose output for this
472
+ });
473
+ if (result.success) {
474
+ logger.info("\u2713 @elizaos/cli added as dev dependency");
475
+ return true;
476
+ } else {
477
+ logger.warn("\u26A0 Failed to install @elizaos/cli as dev dependency (optional)");
478
+ logger.debug("Installation error:", result.error);
479
+ return false;
480
+ }
481
+ } catch (error) {
482
+ logger.warn("\u26A0 Failed to install @elizaos/cli as dev dependency (optional)");
483
+ logger.debug("Installation error:", error);
484
+ return false;
485
+ }
486
+ }
487
+ async function ensureElizaOSCli(cwd = process.cwd()) {
488
+ if (!shouldAutoInstallCli(cwd)) {
489
+ return;
490
+ }
491
+ logger.debug("Auto-installing @elizaos/cli for enhanced development experience");
492
+ const success = await installElizaOSCli(cwd);
493
+ if (success) {
494
+ logger.info("Next time you can use the local CLI for better performance and consistency");
495
+ }
496
+ }
497
+
498
+ // src/commands/dev/actions/dev-server.ts
499
+ import { logger as logger2 } from "@elizaos/core";
415
500
  async function startDevMode(options) {
416
501
  const cwd = process.cwd();
502
+ await ensureElizaOSCli(cwd);
417
503
  const context = createDevContext(cwd);
418
504
  const serverManager2 = getServerManager();
419
505
  const { directoryType } = context;
@@ -444,13 +530,13 @@ async function startDevMode(options) {
444
530
  try {
445
531
  availablePort = await findNextAvailablePort(desiredPort);
446
532
  if (availablePort !== desiredPort) {
447
- logger.warn(`Port ${desiredPort} is in use, using port ${availablePort} instead`);
533
+ logger2.warn(`Port ${desiredPort} is in use, using port ${availablePort} instead`);
448
534
  }
449
535
  } catch (error) {
450
- logger.error(
536
+ logger2.error(
451
537
  `Failed to find available port starting from ${desiredPort}: ${error instanceof Error ? error.message : String(error)}`
452
538
  );
453
- logger.error("Please specify a different port using --port option");
539
+ logger2.error("Please specify a different port using --port option");
454
540
  throw new Error(`No available ports found starting from ${desiredPort}`);
455
541
  }
456
542
  cliArgs.push("--port", availablePort.toString());
@@ -524,15 +610,15 @@ import colors3 from "yoctocolors";
524
610
 
525
611
  // src/commands/env/actions/edit.ts
526
612
  import * as clack from "@clack/prompts";
527
- import { existsSync as existsSync4 } from "fs";
528
- import path5 from "path";
613
+ import { existsSync as existsSync5 } from "fs";
614
+ import path6 from "path";
529
615
 
530
616
  // src/commands/env/utils/file-operations.ts
531
- import { existsSync as existsSync3 } from "fs";
532
- import path4 from "path";
617
+ import { existsSync as existsSync4 } from "fs";
618
+ import path5 from "path";
533
619
  async function getLocalEnvPath() {
534
- const localEnvPath = path4.join(process.cwd(), ".env");
535
- return existsSync3(localEnvPath) ? localEnvPath : null;
620
+ const localEnvPath = path5.join(process.cwd(), ".env");
621
+ return existsSync4(localEnvPath) ? localEnvPath : null;
536
622
  }
537
623
  async function parseEnvFile(filePath) {
538
624
  const service = createEnvFileService(filePath);
@@ -547,7 +633,7 @@ async function writeEnvFile(filePath, envVars) {
547
633
  }
548
634
  async function resetEnvFile(filePath) {
549
635
  try {
550
- if (!existsSync3(filePath)) {
636
+ if (!existsSync4(filePath)) {
551
637
  return false;
552
638
  }
553
639
  const service = createEnvFileService(filePath);
@@ -586,9 +672,9 @@ function maskedValue(value) {
586
672
  async function editEnvVars(options, fromMainMenu = false) {
587
673
  const { yes } = options;
588
674
  const localEnvPath = await getLocalEnvPath();
589
- if (!localEnvPath || !existsSync4(localEnvPath)) {
590
- const exampleEnvPath = path5.join(process.cwd(), ".env.example");
591
- const hasExample = existsSync4(exampleEnvPath);
675
+ if (!localEnvPath || !existsSync5(localEnvPath)) {
676
+ const exampleEnvPath = path6.join(process.cwd(), ".env.example");
677
+ const hasExample = existsSync5(exampleEnvPath);
592
678
  if (hasExample) {
593
679
  console.log("No local .env file found. Create one with:");
594
680
  console.log(" cp .env.example .env");
@@ -739,8 +825,8 @@ async function addNewVariable(envPath, envVars, yes = false) {
739
825
  import * as clack3 from "@clack/prompts";
740
826
 
741
827
  // src/commands/env/actions/list.ts
742
- import { existsSync as existsSync5 } from "fs";
743
- import path6 from "path";
828
+ import { existsSync as existsSync6 } from "fs";
829
+ import path7 from "path";
744
830
  import colors from "yoctocolors";
745
831
  async function listEnvVars() {
746
832
  const envInfo = await UserEnvironment.getInstanceInfo();
@@ -753,11 +839,11 @@ async function listEnvVars() {
753
839
  );
754
840
  console.info(colors.bold("\nLocal Environment Variables:"));
755
841
  const localEnvFilePath = await getLocalEnvPath();
756
- console.info(`Path: ${localEnvFilePath ?? path6.join(process.cwd(), ".env")}`);
757
- if (!localEnvFilePath || !existsSync5(localEnvFilePath)) {
842
+ console.info(`Path: ${localEnvFilePath ?? path7.join(process.cwd(), ".env")}`);
843
+ if (!localEnvFilePath || !existsSync6(localEnvFilePath)) {
758
844
  console.info(colors.yellow(" No local .env file found"));
759
- const exampleEnvPath = path6.join(process.cwd(), ".env.example");
760
- if (existsSync5(exampleEnvPath)) {
845
+ const exampleEnvPath = path7.join(process.cwd(), ".env.example");
846
+ if (existsSync6(exampleEnvPath)) {
761
847
  console.info(colors.red(" [X] Missing .env file. Create one with:"));
762
848
  console.info(` ${colors.bold(colors.green("cp .env.example .env"))}`);
763
849
  } else {
@@ -797,7 +883,7 @@ async function handleListCommand(options) {
797
883
  } else if (options.local) {
798
884
  console.info(colors.bold("\nLocal Environment Variables:"));
799
885
  const localEnvPath = await getLocalEnvPath();
800
- if (!localEnvPath || !existsSync5(localEnvPath)) {
886
+ if (!localEnvPath || !existsSync6(localEnvPath)) {
801
887
  console.info(" No local .env file found in the current directory");
802
888
  return;
803
889
  }
@@ -816,21 +902,21 @@ async function handleListCommand(options) {
816
902
 
817
903
  // src/commands/env/actions/reset.ts
818
904
  import * as clack2 from "@clack/prompts";
819
- import { existsSync as existsSync7 } from "fs";
820
- import path7 from "path";
905
+ import { existsSync as existsSync8 } from "fs";
906
+ import path8 from "path";
821
907
  import colors2 from "yoctocolors";
822
908
 
823
909
  // src/commands/env/utils/directory-operations.ts
824
- import { existsSync as existsSync6 } from "fs";
910
+ import { existsSync as existsSync7 } from "fs";
825
911
  import { rimraf } from "rimraf";
826
912
  async function safeDeleteDirectory(dir, actions, label) {
827
- if (!existsSync6(dir)) {
913
+ if (!existsSync7(dir)) {
828
914
  actions.skipped.push(`${label} (not found)`);
829
915
  return false;
830
916
  }
831
917
  try {
832
918
  await rimraf(dir);
833
- if (!existsSync6(dir)) {
919
+ if (!existsSync7(dir)) {
834
920
  actions.deleted.push(label);
835
921
  return true;
836
922
  } else {
@@ -845,36 +931,36 @@ async function safeDeleteDirectory(dir, actions, label) {
845
931
 
846
932
  // src/commands/env/actions/reset.ts
847
933
  async function resolvePgliteDir2() {
848
- return path7.join(process.cwd(), ".eliza", "db");
934
+ return path8.join(process.cwd(), ".eliza", "db");
849
935
  }
850
936
  async function resetEnv(options) {
851
937
  const { yes } = options;
852
- const elizaDir = path7.join(process.cwd(), ".eliza");
853
- const cacheDir = path7.join(elizaDir, "cache");
854
- const localEnvPath = await getLocalEnvPath() ?? path7.join(process.cwd(), ".env");
938
+ const elizaDir = path8.join(process.cwd(), ".eliza");
939
+ const cacheDir = path8.join(elizaDir, "cache");
940
+ const localEnvPath = await getLocalEnvPath() ?? path8.join(process.cwd(), ".env");
855
941
  const localDbDir = await resolvePgliteDir2();
856
942
  const resetItems = [
857
943
  {
858
944
  title: "Local environment variables",
859
945
  value: "localEnv",
860
- description: existsSync7(localEnvPath) ? "Reset values in local .env file" : "Local .env file not found, nothing to reset",
861
- selected: existsSync7(localEnvPath)
946
+ description: existsSync8(localEnvPath) ? "Reset values in local .env file" : "Local .env file not found, nothing to reset",
947
+ selected: existsSync8(localEnvPath)
862
948
  },
863
949
  {
864
950
  title: "Cache folder",
865
951
  value: "cache",
866
- description: existsSync7(cacheDir) ? "Delete the cache folder" : "Cache folder not found, nothing to delete",
867
- selected: existsSync7(cacheDir)
952
+ description: existsSync8(cacheDir) ? "Delete the cache folder" : "Cache folder not found, nothing to delete",
953
+ selected: existsSync8(cacheDir)
868
954
  },
869
955
  {
870
956
  title: "Local database files",
871
957
  value: "localDb",
872
- description: existsSync7(localDbDir) ? "Delete local database files" : "Local database folder not found, nothing to delete",
873
- selected: existsSync7(localDbDir)
958
+ description: existsSync8(localDbDir) ? "Delete local database files" : "Local database folder not found, nothing to delete",
959
+ selected: existsSync8(localDbDir)
874
960
  }
875
961
  ];
876
962
  const validResetItems = resetItems.filter(
877
- (item) => item.value === "localEnv" && existsSync7(localEnvPath) || item.value === "cache" && existsSync7(cacheDir) || item.value === "localDb" && existsSync7(localDbDir)
963
+ (item) => item.value === "localEnv" && existsSync8(localEnvPath) || item.value === "cache" && existsSync8(cacheDir) || item.value === "localDb" && existsSync8(localDbDir)
878
964
  );
879
965
  let selectedValues = [];
880
966
  if (yes) {
@@ -1052,7 +1138,7 @@ env.action(() => {
1052
1138
  import { Command as Command3 } from "commander";
1053
1139
 
1054
1140
  // src/commands/plugins/actions/install.ts
1055
- import { logger as logger4 } from "@elizaos/core";
1141
+ import { logger as logger5 } from "@elizaos/core";
1056
1142
 
1057
1143
  // src/commands/plugins/utils/naming.ts
1058
1144
  var findPluginPackageName = (pluginInput, allDependencies) => {
@@ -1094,55 +1180,55 @@ var extractPackageName = (pluginInput) => {
1094
1180
  };
1095
1181
 
1096
1182
  // src/commands/plugins/utils/env-vars.ts
1097
- import { logger as logger2 } from "@elizaos/core";
1098
- import { existsSync as existsSync8, readFileSync, readdirSync as readdirSync2 } from "fs";
1099
- import path8 from "path";
1183
+ import { logger as logger3 } from "@elizaos/core";
1184
+ import { existsSync as existsSync9, readFileSync as readFileSync2, readdirSync as readdirSync2 } from "fs";
1185
+ import path9 from "path";
1100
1186
  import * as clack4 from "@clack/prompts";
1101
1187
  var extractPluginEnvRequirements = async (packageName, cwd) => {
1102
1188
  try {
1103
1189
  const possiblePaths = [
1104
1190
  // Direct path
1105
- path8.join(cwd, "node_modules", packageName, "package.json"),
1191
+ path9.join(cwd, "node_modules", packageName, "package.json"),
1106
1192
  // Scoped package path (e.g., @elizaos/plugin-discord)
1107
- path8.join(cwd, "node_modules", packageName.replace("/", path8.sep), "package.json")
1193
+ path9.join(cwd, "node_modules", packageName.replace("/", path9.sep), "package.json")
1108
1194
  ];
1109
1195
  if (!packageName.startsWith("@elizaos/")) {
1110
1196
  possiblePaths.push(
1111
- path8.join(cwd, "node_modules", "@elizaos", packageName, "package.json"),
1112
- path8.join(cwd, "node_modules", "@elizaos", `plugin-${packageName}`, "package.json")
1197
+ path9.join(cwd, "node_modules", "@elizaos", packageName, "package.json"),
1198
+ path9.join(cwd, "node_modules", "@elizaos", `plugin-${packageName}`, "package.json")
1113
1199
  );
1114
1200
  }
1115
1201
  let currentDir = cwd;
1116
1202
  for (let i = 0; i < 5; i++) {
1117
- const parentNodeModules = path8.join(currentDir, "node_modules");
1118
- if (existsSync8(parentNodeModules)) {
1203
+ const parentNodeModules = path9.join(currentDir, "node_modules");
1204
+ if (existsSync9(parentNodeModules)) {
1119
1205
  possiblePaths.push(
1120
- path8.join(parentNodeModules, packageName, "package.json"),
1121
- path8.join(parentNodeModules, packageName.replace("/", path8.sep), "package.json")
1206
+ path9.join(parentNodeModules, packageName, "package.json"),
1207
+ path9.join(parentNodeModules, packageName.replace("/", path9.sep), "package.json")
1122
1208
  );
1123
1209
  }
1124
- const parentDir = path8.dirname(currentDir);
1210
+ const parentDir = path9.dirname(currentDir);
1125
1211
  if (parentDir === currentDir) break;
1126
1212
  currentDir = parentDir;
1127
1213
  }
1128
1214
  let packageJsonPath = null;
1129
1215
  for (const possiblePath of possiblePaths) {
1130
- if (existsSync8(possiblePath)) {
1216
+ if (existsSync9(possiblePath)) {
1131
1217
  packageJsonPath = possiblePath;
1132
- logger2.debug(`Found plugin package.json at: ${packageJsonPath}`);
1218
+ logger3.debug(`Found plugin package.json at: ${packageJsonPath}`);
1133
1219
  break;
1134
1220
  }
1135
1221
  }
1136
1222
  if (!packageJsonPath) {
1137
- const nodeModulesPath = path8.join(cwd, "node_modules");
1138
- if (existsSync8(nodeModulesPath)) {
1223
+ const nodeModulesPath = path9.join(cwd, "node_modules");
1224
+ if (existsSync9(nodeModulesPath)) {
1139
1225
  const packages = readdirSync2(nodeModulesPath);
1140
1226
  for (const pkg of packages) {
1141
1227
  if (pkg.includes(packageName.replace("@elizaos/", "").replace("plugin-", ""))) {
1142
- const pkgJsonPath = path8.join(nodeModulesPath, pkg, "package.json");
1143
- if (existsSync8(pkgJsonPath)) {
1228
+ const pkgJsonPath = path9.join(nodeModulesPath, pkg, "package.json");
1229
+ if (existsSync9(pkgJsonPath)) {
1144
1230
  packageJsonPath = pkgJsonPath;
1145
- logger2.debug(`Found matching plugin package.json at: ${packageJsonPath}`);
1231
+ logger3.debug(`Found matching plugin package.json at: ${packageJsonPath}`);
1146
1232
  break;
1147
1233
  }
1148
1234
  }
@@ -1150,30 +1236,30 @@ var extractPluginEnvRequirements = async (packageName, cwd) => {
1150
1236
  }
1151
1237
  }
1152
1238
  if (!packageJsonPath) {
1153
- logger2.debug(`Plugin package.json not found for: ${packageName}`);
1154
- logger2.debug(`Searched paths: ${possiblePaths.join(", ")}`);
1239
+ logger3.debug(`Plugin package.json not found for: ${packageName}`);
1240
+ logger3.debug(`Searched paths: ${possiblePaths.join(", ")}`);
1155
1241
  return {};
1156
1242
  }
1157
- const packageJsonContent = readFileSync(packageJsonPath, "utf-8");
1243
+ const packageJsonContent = readFileSync2(packageJsonPath, "utf-8");
1158
1244
  const packageJson = JSON.parse(packageJsonContent);
1159
1245
  const agentConfig = packageJson.agentConfig;
1160
1246
  if (!agentConfig || !agentConfig.pluginParameters) {
1161
- logger2.debug(`No agentConfig.pluginParameters found in ${packageName} at ${packageJsonPath}`);
1247
+ logger3.debug(`No agentConfig.pluginParameters found in ${packageName} at ${packageJsonPath}`);
1162
1248
  return {};
1163
1249
  }
1164
- logger2.debug(
1250
+ logger3.debug(
1165
1251
  `Found environment variables for ${packageName}: ${Object.keys(agentConfig.pluginParameters).join(", ")}`
1166
1252
  );
1167
1253
  return agentConfig.pluginParameters;
1168
1254
  } catch (error) {
1169
- logger2.debug(
1255
+ logger3.debug(
1170
1256
  `Error reading plugin package.json for ${packageName}: ${error instanceof Error ? error.message : String(error)}`
1171
1257
  );
1172
1258
  return {};
1173
1259
  }
1174
1260
  };
1175
1261
  var readEnvFile = async (cwd) => {
1176
- const envPath = path8.join(cwd, ".env");
1262
+ const envPath = path9.join(cwd, ".env");
1177
1263
  const envService = createEnvFileService(envPath);
1178
1264
  return envService.read();
1179
1265
  };
@@ -1360,7 +1446,7 @@ var promptForEnvVar = async (varName, config2) => {
1360
1446
  return finalValue.trim();
1361
1447
  };
1362
1448
  var updateEnvFile = async (cwd, varName, value) => {
1363
- const envPath = path8.join(cwd, ".env");
1449
+ const envPath = path9.join(cwd, ".env");
1364
1450
  const envService = createEnvFileService(envPath);
1365
1451
  await envService.update(varName, value, {
1366
1452
  preserveComments: true,
@@ -1378,7 +1464,7 @@ var promptForPluginEnvVars = async (packageName, cwd) => {
1378
1464
  }
1379
1465
  }
1380
1466
  if (Object.keys(envRequirements).length === 0) {
1381
- const nodeModulesPath = path8.join(cwd, "node_modules");
1467
+ const nodeModulesPath = path9.join(cwd, "node_modules");
1382
1468
  const possiblePackages = [
1383
1469
  packageName,
1384
1470
  `@elizaos/${packageName.replace("plugin-", "")}`,
@@ -1386,17 +1472,17 @@ var promptForPluginEnvVars = async (packageName, cwd) => {
1386
1472
  ];
1387
1473
  let packageFound = false;
1388
1474
  for (const pkg of possiblePackages) {
1389
- const pkgPath = path8.join(nodeModulesPath, ...pkg.split("/"));
1390
- if (existsSync8(path8.join(pkgPath, "package.json"))) {
1475
+ const pkgPath = path9.join(nodeModulesPath, ...pkg.split("/"));
1476
+ if (existsSync9(path9.join(pkgPath, "package.json"))) {
1391
1477
  packageFound = true;
1392
1478
  break;
1393
1479
  }
1394
1480
  }
1395
1481
  if (packageFound) {
1396
- logger2.debug(`Package ${packageName} found but has no environment variables defined`);
1482
+ logger3.debug(`Package ${packageName} found but has no environment variables defined`);
1397
1483
  clack4.log.success(`No environment variables required for ${packageName}`);
1398
1484
  } else {
1399
- logger2.debug(`Package ${packageName} not found in node_modules`);
1485
+ logger3.debug(`Package ${packageName} not found in node_modules`);
1400
1486
  clack4.log.warn(
1401
1487
  `Could not find ${packageName} in node_modules. Environment variables may need to be configured manually.`
1402
1488
  );
@@ -1537,26 +1623,26 @@ Restart your application after adding the variables.`
1537
1623
  };
1538
1624
 
1539
1625
  // src/commands/plugins/utils/directory.ts
1540
- import { logger as logger3 } from "@elizaos/core";
1541
- import { readFileSync as readFileSync2 } from "fs";
1542
- import path9 from "path";
1626
+ import { logger as logger4 } from "@elizaos/core";
1627
+ import { readFileSync as readFileSync3 } from "fs";
1628
+ import path10 from "path";
1543
1629
  var getDependenciesFromDirectory = (cwd) => {
1544
1630
  const directoryInfo = detectDirectoryType(cwd);
1545
1631
  if (!directoryInfo.hasPackageJson) {
1546
1632
  return null;
1547
1633
  }
1548
1634
  try {
1549
- const packageJsonPath = path9.join(cwd, "package.json");
1550
- const packageJsonContent = readFileSync2(packageJsonPath, "utf-8");
1635
+ const packageJsonPath = path10.join(cwd, "package.json");
1636
+ const packageJsonContent = readFileSync3(packageJsonPath, "utf-8");
1551
1637
  const packageJson = JSON.parse(packageJsonContent);
1552
1638
  const dependencies = packageJson.dependencies || {};
1553
1639
  const devDependencies = packageJson.devDependencies || {};
1554
1640
  return { ...dependencies, ...devDependencies };
1555
1641
  } catch (error) {
1556
1642
  if (error instanceof SyntaxError) {
1557
- logger3.warn(`Could not parse package.json: ${error.message}`);
1643
+ logger4.warn(`Could not parse package.json: ${error.message}`);
1558
1644
  } else {
1559
- logger3.warn(
1645
+ logger4.warn(
1560
1646
  `Error reading package.json: ${error instanceof Error ? error.message : String(error)}`
1561
1647
  );
1562
1648
  }
@@ -1591,7 +1677,7 @@ async function installPluginFromGitHub(plugin, cwd, opts) {
1591
1677
  const pluginNameForPostInstall = repo;
1592
1678
  const success = await installPlugin(githubSpecifier, cwd, void 0, opts.skipVerification);
1593
1679
  if (success) {
1594
- logger4.info(`Successfully installed ${pluginNameForPostInstall} from ${githubSpecifier}.`);
1680
+ logger5.info(`Successfully installed ${pluginNameForPostInstall} from ${githubSpecifier}.`);
1595
1681
  const packageName = extractPackageName(plugin);
1596
1682
  if (!opts.skipEnvPrompt) {
1597
1683
  await new Promise((resolve2) => setTimeout(resolve2, 500));
@@ -1600,7 +1686,7 @@ async function installPluginFromGitHub(plugin, cwd, opts) {
1600
1686
  try {
1601
1687
  await promptForPluginEnvVars(packageName, cwd);
1602
1688
  } catch (error) {
1603
- logger4.warn(
1689
+ logger5.warn(
1604
1690
  `Warning: Could not prompt for environment variables: ${error instanceof Error ? error.message : String(error)}`
1605
1691
  );
1606
1692
  }
@@ -1611,14 +1697,14 @@ async function installPluginFromGitHub(plugin, cwd, opts) {
1611
1697
  showInstallationSuccess(packageName);
1612
1698
  process.exit(0);
1613
1699
  } else {
1614
- logger4.error(`Failed to install plugin from ${githubSpecifier}.`);
1700
+ logger5.error(`Failed to install plugin from ${githubSpecifier}.`);
1615
1701
  process.exit(1);
1616
1702
  }
1617
1703
  }
1618
1704
  async function installPluginFromRegistry(plugin, cwd, opts) {
1619
1705
  const cachedRegistry = await fetchPluginRegistry();
1620
1706
  if (!cachedRegistry || !cachedRegistry.registry) {
1621
- logger4.error('Plugin registry cache not found. Please run "elizaos plugins update" first.');
1707
+ logger5.error('Plugin registry cache not found. Please run "elizaos plugins update" first.');
1622
1708
  process.exit(1);
1623
1709
  }
1624
1710
  const possibleNames = normalizePluginName(plugin);
@@ -1641,7 +1727,7 @@ async function installPluginFromRegistry(plugin, cwd, opts) {
1641
1727
  try {
1642
1728
  await promptForPluginEnvVars(actualPackageName, cwd);
1643
1729
  } catch (error) {
1644
- logger4.warn(
1730
+ logger5.warn(
1645
1731
  `Warning: Could not prompt for environment variables: ${error instanceof Error ? error.message : String(error)}`
1646
1732
  );
1647
1733
  }
@@ -1657,8 +1743,8 @@ async function installPluginFromRegistry(plugin, cwd, opts) {
1657
1743
  }
1658
1744
  async function addPlugin(pluginArg, opts) {
1659
1745
  if (!pluginArg || !pluginArg.trim()) {
1660
- logger4.error("Plugin name cannot be empty or whitespace-only.");
1661
- logger4.info(
1746
+ logger5.error("Plugin name cannot be empty or whitespace-only.");
1747
+ logger5.info(
1662
1748
  'Please provide a valid plugin name (e.g., "openai", "plugin-anthropic", "@elizaos/plugin-sql")'
1663
1749
  );
1664
1750
  process.exit(1);
@@ -1666,14 +1752,14 @@ async function addPlugin(pluginArg, opts) {
1666
1752
  const cwd = process.cwd();
1667
1753
  const directoryInfo = detectDirectoryType(cwd);
1668
1754
  if (!directoryInfo || !directoryInfo.hasPackageJson) {
1669
- logger4.error(
1755
+ logger5.error(
1670
1756
  `Command must be run inside an ElizaOS project directory. This directory is: ${directoryInfo?.type || "invalid or inaccessible"}`
1671
1757
  );
1672
1758
  process.exit(1);
1673
1759
  }
1674
1760
  const allDependencies = getDependenciesFromDirectory(cwd);
1675
1761
  if (!allDependencies) {
1676
- logger4.error("Could not read dependencies from package.json");
1762
+ logger5.error("Could not read dependencies from package.json");
1677
1763
  process.exit(1);
1678
1764
  }
1679
1765
  let plugin = pluginArg;
@@ -1688,7 +1774,7 @@ async function addPlugin(pluginArg, opts) {
1688
1774
  }
1689
1775
  const installedPluginName = findPluginPackageName(plugin, allDependencies);
1690
1776
  if (installedPluginName) {
1691
- logger4.info(`Plugin "${installedPluginName}" is already added to this project.`);
1777
+ logger5.info(`Plugin "${installedPluginName}" is already added to this project.`);
1692
1778
  process.exit(0);
1693
1779
  }
1694
1780
  const githubRegex = /^(?:github:)?([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_.-]+)(?:#([a-zA-Z0-9_.-]+))?$/;
@@ -1700,9 +1786,9 @@ async function addPlugin(pluginArg, opts) {
1700
1786
  }
1701
1787
 
1702
1788
  // src/commands/plugins/actions/remove.ts
1703
- import { logger as logger5 } from "@elizaos/core";
1704
- import { existsSync as existsSync9, rmSync } from "fs";
1705
- import path10 from "path";
1789
+ import { logger as logger6 } from "@elizaos/core";
1790
+ import { existsSync as existsSync10, rmSync } from "fs";
1791
+ import path11 from "path";
1706
1792
  async function removePlugin(plugin) {
1707
1793
  const cwd = process.cwd();
1708
1794
  const directoryInfo = detectDirectoryType(cwd);
@@ -1721,7 +1807,7 @@ async function removePlugin(plugin) {
1721
1807
  }
1722
1808
  const packageNameToRemove = findPluginPackageName(plugin, allDependencies);
1723
1809
  if (!packageNameToRemove) {
1724
- logger5.warn(`Plugin matching "${plugin}" not found in project dependencies.`);
1810
+ logger6.warn(`Plugin matching "${plugin}" not found in project dependencies.`);
1725
1811
  console.info("\nCheck installed plugins using: elizaos plugins installed-plugins");
1726
1812
  process.exit(0);
1727
1813
  }
@@ -1731,11 +1817,11 @@ async function removePlugin(plugin) {
1731
1817
  cwd
1732
1818
  });
1733
1819
  } catch (execError) {
1734
- logger5.error(
1820
+ logger6.error(
1735
1821
  `Failed to run 'bun remove ${packageNameToRemove}': ${execError instanceof Error ? execError.message : String(execError)}`
1736
1822
  );
1737
1823
  if (execError && typeof execError === "object" && "stderr" in execError && typeof execError.stderr === "string" && execError.stderr.includes("not found")) {
1738
- logger5.info(
1824
+ logger6.info(
1739
1825
  `'bun remove' indicated package was not found. Continuing with directory removal attempt.`
1740
1826
  );
1741
1827
  } else {
@@ -1750,22 +1836,22 @@ async function removePlugin(plugin) {
1750
1836
  }
1751
1837
  baseName = baseName.replace(/^plugin-/, "");
1752
1838
  const dirNameToRemove = `plugin-${baseName}`;
1753
- const pluginDir = path10.join(cwd, dirNameToRemove);
1754
- if (existsSync9(pluginDir)) {
1839
+ const pluginDir = path11.join(cwd, dirNameToRemove);
1840
+ if (existsSync10(pluginDir)) {
1755
1841
  try {
1756
1842
  rmSync(pluginDir, { recursive: true, force: true });
1757
1843
  } catch (rmError) {
1758
- logger5.error(
1844
+ logger6.error(
1759
1845
  `Failed to remove directory ${pluginDir}: ${rmError instanceof Error ? rmError.message : String(rmError)}`
1760
1846
  );
1761
1847
  }
1762
1848
  } else {
1763
- const nonPrefixedDir = path10.join(cwd, baseName);
1764
- if (existsSync9(nonPrefixedDir)) {
1849
+ const nonPrefixedDir = path11.join(cwd, baseName);
1850
+ if (existsSync10(nonPrefixedDir)) {
1765
1851
  try {
1766
1852
  rmSync(nonPrefixedDir, { recursive: true, force: true });
1767
1853
  } catch (rmError) {
1768
- logger5.error(
1854
+ logger6.error(
1769
1855
  `Failed to remove directory ${nonPrefixedDir}: ${rmError instanceof Error ? rmError.message : String(rmError)}`
1770
1856
  );
1771
1857
  }
@@ -1775,11 +1861,11 @@ async function removePlugin(plugin) {
1775
1861
  }
1776
1862
 
1777
1863
  // src/commands/plugins/actions/list.ts
1778
- import { logger as logger6 } from "@elizaos/core";
1864
+ import { logger as logger7 } from "@elizaos/core";
1779
1865
  async function listAvailablePlugins(opts) {
1780
1866
  const cachedRegistry = await fetchPluginRegistry();
1781
1867
  if (!cachedRegistry || !cachedRegistry.registry || Object.keys(cachedRegistry.registry).length === 0) {
1782
- logger6.info("Plugin cache is empty or not found.");
1868
+ logger7.info("Plugin cache is empty or not found.");
1783
1869
  console.log('\nPlease run "elizaos plugins update" to fetch the latest plugin registry.');
1784
1870
  return;
1785
1871
  }
@@ -1857,20 +1943,20 @@ async function listInstalledPlugins() {
1857
1943
  }
1858
1944
 
1859
1945
  // src/commands/plugins/actions/upgrade.ts
1860
- import { logger as logger9 } from "@elizaos/core";
1861
- import path12 from "path";
1862
- import { existsSync as existsSync11 } from "fs";
1946
+ import { logger as logger10 } from "@elizaos/core";
1947
+ import path13 from "path";
1948
+ import { existsSync as existsSync12 } from "fs";
1863
1949
  import { fileURLToPath as fileURLToPath2 } from "url";
1864
- import fs from "fs-extra";
1950
+ import fs2 from "fs-extra";
1865
1951
 
1866
1952
  // src/utils/upgrade/simple-migration-agent.ts
1867
1953
  import { query } from "@anthropic-ai/claude-code";
1868
1954
 
1869
1955
  // src/utils/upgrade/migration-guide-loader.ts
1870
- import { existsSync as existsSync10, readFileSync as readFileSync3 } from "fs";
1871
- import path11 from "path";
1956
+ import { existsSync as existsSync11, readFileSync as readFileSync4 } from "fs";
1957
+ import path12 from "path";
1872
1958
  import { fileURLToPath } from "url";
1873
- import { logger as logger7 } from "@elizaos/core";
1959
+ import { logger as logger8 } from "@elizaos/core";
1874
1960
  var MigrationGuideLoader = class {
1875
1961
  guides = [];
1876
1962
  guidesDir;
@@ -1880,33 +1966,33 @@ var MigrationGuideLoader = class {
1880
1966
  }
1881
1967
  findGuidesDirectory(projectRoot) {
1882
1968
  if (projectRoot) {
1883
- const guidesPath = path11.join(projectRoot, "packages/docs/docs/plugins/migration/claude-code");
1884
- if (existsSync10(guidesPath)) {
1969
+ const guidesPath = path12.join(projectRoot, "packages/docs/docs/plugins/migration/claude-code");
1970
+ if (existsSync11(guidesPath)) {
1885
1971
  return guidesPath;
1886
1972
  }
1887
1973
  }
1888
1974
  let currentRoot = process.cwd();
1889
1975
  let previousRoot = "";
1890
- while (currentRoot !== previousRoot && !existsSync10(path11.join(currentRoot, "packages/docs"))) {
1976
+ while (currentRoot !== previousRoot && !existsSync11(path12.join(currentRoot, "packages/docs"))) {
1891
1977
  previousRoot = currentRoot;
1892
- currentRoot = path11.dirname(currentRoot);
1978
+ currentRoot = path12.dirname(currentRoot);
1893
1979
  }
1894
- const monorepoGuidesPath = path11.join(
1980
+ const monorepoGuidesPath = path12.join(
1895
1981
  currentRoot,
1896
1982
  "packages/docs/docs/plugins/migration/claude-code"
1897
1983
  );
1898
- if (existsSync10(monorepoGuidesPath)) {
1984
+ if (existsSync11(monorepoGuidesPath)) {
1899
1985
  return monorepoGuidesPath;
1900
1986
  }
1901
- const workingDirGuides = path11.join(process.cwd(), "migration-guides");
1902
- if (existsSync10(workingDirGuides)) {
1987
+ const workingDirGuides = path12.join(process.cwd(), "migration-guides");
1988
+ if (existsSync11(workingDirGuides)) {
1903
1989
  return workingDirGuides;
1904
1990
  }
1905
1991
  const currentFileUrl = import.meta.url;
1906
1992
  const currentFilePath = fileURLToPath(currentFileUrl);
1907
- const cliPackageRoot = path11.dirname(path11.dirname(path11.dirname(path11.dirname(currentFilePath))));
1908
- const bundledGuidesPath = path11.join(cliPackageRoot, "migration-guides");
1909
- if (existsSync10(bundledGuidesPath)) {
1993
+ const cliPackageRoot = path12.dirname(path12.dirname(path12.dirname(path12.dirname(currentFilePath))));
1994
+ const bundledGuidesPath = path12.join(cliPackageRoot, "migration-guides");
1995
+ if (existsSync11(bundledGuidesPath)) {
1910
1996
  return bundledGuidesPath;
1911
1997
  }
1912
1998
  return "";
@@ -2019,16 +2105,16 @@ var MigrationGuideLoader = class {
2019
2105
  ]
2020
2106
  }
2021
2107
  ];
2022
- if (!this.guidesDir || !existsSync10(this.guidesDir)) {
2023
- logger7.info("Using embedded migration guidance (external CLI mode)");
2108
+ if (!this.guidesDir || !existsSync11(this.guidesDir)) {
2109
+ logger8.info("Using embedded migration guidance (external CLI mode)");
2024
2110
  this.createEmbeddedGuides(guideConfigs);
2025
2111
  return;
2026
2112
  }
2027
2113
  for (const config2 of guideConfigs) {
2028
- const guidePath = path11.join(this.guidesDir, config2.name);
2029
- if (existsSync10(guidePath)) {
2114
+ const guidePath = path12.join(this.guidesDir, config2.name);
2115
+ if (existsSync11(guidePath)) {
2030
2116
  try {
2031
- const content = readFileSync3(guidePath, "utf-8");
2117
+ const content = readFileSync4(guidePath, "utf-8");
2032
2118
  this.guides.push({
2033
2119
  name: config2.name,
2034
2120
  path: guidePath,
@@ -2037,13 +2123,13 @@ var MigrationGuideLoader = class {
2037
2123
  keywords: config2.keywords
2038
2124
  });
2039
2125
  } catch (error) {
2040
- logger7.warn(`Failed to load migration guide: ${config2.name}`, error);
2126
+ logger8.warn(`Failed to load migration guide: ${config2.name}`, error);
2041
2127
  }
2042
2128
  } else {
2043
- logger7.warn(`Migration guide not found: ${guidePath}`);
2129
+ logger8.warn(`Migration guide not found: ${guidePath}`);
2044
2130
  }
2045
2131
  }
2046
- logger7.info(`Loaded ${this.guides.length} migration guides from ${this.guidesDir}`);
2132
+ logger8.info(`Loaded ${this.guides.length} migration guides from ${this.guidesDir}`);
2047
2133
  }
2048
2134
  createEmbeddedGuides(guideConfigs) {
2049
2135
  const embeddedGuides = {
@@ -2291,7 +2377,7 @@ function createMigrationGuideLoader(projectRoot) {
2291
2377
  }
2292
2378
 
2293
2379
  // src/utils/upgrade/simple-migration-agent.ts
2294
- import { logger as logger8 } from "@elizaos/core";
2380
+ import { logger as logger9 } from "@elizaos/core";
2295
2381
  var SimpleMigrationAgent = class extends EventTarget {
2296
2382
  handlers = /* @__PURE__ */ new Map();
2297
2383
  repoPath;
@@ -2315,10 +2401,10 @@ var SimpleMigrationAgent = class extends EventTarget {
2315
2401
  try {
2316
2402
  this.guideLoader = createMigrationGuideLoader();
2317
2403
  if (this.verbose) {
2318
- logger8.info("Migration guide loader initialized successfully");
2404
+ logger9.info("Migration guide loader initialized successfully");
2319
2405
  }
2320
2406
  } catch (error) {
2321
- logger8.warn("Failed to initialize migration guide loader", error);
2407
+ logger9.warn("Failed to initialize migration guide loader", error);
2322
2408
  throw new Error("Cannot initialize migration system without guide access");
2323
2409
  }
2324
2410
  }
@@ -2926,13 +3012,13 @@ async function upgradePlugin(pluginPath, opts) {
2926
3012
  process.env.ANTHROPIC_API_KEY = opts.apiKey;
2927
3013
  }
2928
3014
  if (!process.env.ANTHROPIC_API_KEY) {
2929
- logger9.error("ANTHROPIC_API_KEY is required for plugin upgrade.");
3015
+ logger10.error("ANTHROPIC_API_KEY is required for plugin upgrade.");
2930
3016
  console.log("\nPlease set ANTHROPIC_API_KEY environment variable or use --api-key option.");
2931
3017
  console.log("Get your API key from: https://console.anthropic.com/");
2932
3018
  process.exit(1);
2933
3019
  }
2934
3020
  if (!process.env.ANTHROPIC_API_KEY.startsWith("sk-ant-")) {
2935
- logger9.error("Invalid ANTHROPIC_API_KEY format.");
3021
+ logger10.error("Invalid ANTHROPIC_API_KEY format.");
2936
3022
  console.log('\nThe API key should start with "sk-ant-"');
2937
3023
  console.log("Get your API key from: https://console.anthropic.com/");
2938
3024
  process.exit(1);
@@ -2952,41 +3038,41 @@ async function upgradePlugin(pluginPath, opts) {
2952
3038
  console.log("\nInstall the SDK: bun add @anthropic-ai/claude-code");
2953
3039
  process.exit(1);
2954
3040
  }
2955
- const workingDir = path12.resolve(pluginPath);
2956
- if (!existsSync11(workingDir)) {
3041
+ const workingDir = path13.resolve(pluginPath);
3042
+ if (!existsSync12(workingDir)) {
2957
3043
  throw new Error(`Plugin directory not found: ${workingDir}`);
2958
3044
  }
2959
3045
  console.log(chalk.cyan("\u{1F527} Setting up migration environment..."));
2960
3046
  let projectRoot = process.cwd();
2961
3047
  let guidesSource;
2962
3048
  let previousRoot = "";
2963
- while (projectRoot !== previousRoot && !existsSync11(path12.join(projectRoot, "packages/docs"))) {
3049
+ while (projectRoot !== previousRoot && !existsSync12(path13.join(projectRoot, "packages/docs"))) {
2964
3050
  previousRoot = projectRoot;
2965
- projectRoot = path12.dirname(projectRoot);
3051
+ projectRoot = path13.dirname(projectRoot);
2966
3052
  }
2967
- const monorepoGuidesPath = path12.join(
3053
+ const monorepoGuidesPath = path13.join(
2968
3054
  projectRoot,
2969
3055
  "packages/docs/docs/plugins/migration/claude-code"
2970
3056
  );
2971
- if (existsSync11(monorepoGuidesPath)) {
3057
+ if (existsSync12(monorepoGuidesPath)) {
2972
3058
  guidesSource = monorepoGuidesPath;
2973
3059
  } else {
2974
3060
  const currentFileUrl = import.meta.url;
2975
3061
  const currentFilePath = fileURLToPath2(currentFileUrl);
2976
- const cliPackageRoot = path12.dirname(
2977
- path12.dirname(path12.dirname(path12.dirname(currentFilePath)))
3062
+ const cliPackageRoot = path13.dirname(
3063
+ path13.dirname(path13.dirname(path13.dirname(currentFilePath)))
2978
3064
  );
2979
- const bundledGuidesPath = path12.join(cliPackageRoot, "migration-guides");
2980
- if (existsSync11(bundledGuidesPath)) {
3065
+ const bundledGuidesPath = path13.join(cliPackageRoot, "migration-guides");
3066
+ if (existsSync12(bundledGuidesPath)) {
2981
3067
  guidesSource = bundledGuidesPath;
2982
3068
  } else {
2983
3069
  guidesSource = "";
2984
3070
  }
2985
3071
  }
2986
- const guidesTarget = path12.join(workingDir, "migration-guides");
2987
- await fs.ensureDir(guidesTarget);
2988
- if (guidesSource && existsSync11(guidesSource)) {
2989
- await fs.copy(guidesSource, guidesTarget, { overwrite: true });
3072
+ const guidesTarget = path13.join(workingDir, "migration-guides");
3073
+ await fs2.ensureDir(guidesTarget);
3074
+ if (guidesSource && existsSync12(guidesSource)) {
3075
+ await fs2.copy(guidesSource, guidesTarget, { overwrite: true });
2990
3076
  if (opts.debug) {
2991
3077
  console.log(chalk.gray(`Copied guides from: ${guidesSource}`));
2992
3078
  }
@@ -3022,8 +3108,8 @@ Plugin: ${pluginPath}`));
3022
3108
  });
3023
3109
  const result = await agent2.migrate();
3024
3110
  try {
3025
- if (existsSync11(guidesTarget)) {
3026
- await fs.remove(guidesTarget);
3111
+ if (existsSync12(guidesTarget)) {
3112
+ await fs2.remove(guidesTarget);
3027
3113
  if (opts.debug) {
3028
3114
  console.log(chalk.gray("Cleaned up migration guides"));
3029
3115
  }
@@ -3036,7 +3122,7 @@ Plugin: ${pluginPath}`));
3036
3122
  if (result.success) {
3037
3123
  console.log(chalk.green("\nMigration completed successfully!"));
3038
3124
  console.log(chalk.gray("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
3039
- console.log(`Location: ${chalk.cyan(path12.basename(result.repoPath))}`);
3125
+ console.log(`Location: ${chalk.cyan(path13.basename(result.repoPath))}`);
3040
3126
  console.log(`Duration: ${chalk.yellow(Math.round(result.duration / 1e3) + "s")}`);
3041
3127
  console.log(`AI Operations: ${chalk.blue(result.messageCount)}`);
3042
3128
  if (result.guidesUsed && result.guidesUsed.length > 0) {
@@ -3046,7 +3132,7 @@ Plugin: ${pluginPath}`));
3046
3132
  }
3047
3133
  }
3048
3134
  console.log(chalk.bold("\nNext Steps:"));
3049
- console.log(`${chalk.gray("1.")} cd ${chalk.cyan(path12.basename(result.repoPath))}`);
3135
+ console.log(`${chalk.gray("1.")} cd ${chalk.cyan(path13.basename(result.repoPath))}`);
3050
3136
  console.log(
3051
3137
  `${chalk.gray("2.")} git checkout 1.x ${chalk.gray("# Review the migrated code")}`
3052
3138
  );
@@ -3075,9 +3161,9 @@ Plugin: ${pluginPath}`));
3075
3161
  }
3076
3162
  } catch (error) {
3077
3163
  try {
3078
- const guidesTarget = path12.join(path12.resolve(pluginPath), "migration-guides");
3079
- if (existsSync11(guidesTarget)) {
3080
- await fs.remove(guidesTarget);
3164
+ const guidesTarget = path13.join(path13.resolve(pluginPath), "migration-guides");
3165
+ if (existsSync12(guidesTarget)) {
3166
+ await fs2.remove(guidesTarget);
3081
3167
  if (opts.debug) {
3082
3168
  console.log(chalk.gray("Cleaned up migration guides after error"));
3083
3169
  }
@@ -3103,9 +3189,9 @@ Error: ${error instanceof Error ? error.message : String(error)}`));
3103
3189
  }
3104
3190
 
3105
3191
  // src/commands/plugins/actions/generate.ts
3106
- import { logger as logger10 } from "@elizaos/core";
3107
- import { readFileSync as readFileSync4 } from "fs";
3108
- import path13 from "path";
3192
+ import { logger as logger11 } from "@elizaos/core";
3193
+ import { readFileSync as readFileSync5 } from "fs";
3194
+ import path14 from "path";
3109
3195
  async function generatePlugin(opts) {
3110
3196
  try {
3111
3197
  const { PluginCreator } = await import("./plugin-creator-H26ZLR6H.js");
@@ -3113,23 +3199,23 @@ async function generatePlugin(opts) {
3113
3199
  process.env.ANTHROPIC_API_KEY = opts.apiKey;
3114
3200
  }
3115
3201
  if (!process.env.ANTHROPIC_API_KEY) {
3116
- logger10.error("ANTHROPIC_API_KEY is required for plugin generation.");
3202
+ logger11.error("ANTHROPIC_API_KEY is required for plugin generation.");
3117
3203
  console.log("\nPlease set ANTHROPIC_API_KEY environment variable or use --api-key option.");
3118
3204
  process.exit(1);
3119
3205
  }
3120
3206
  let spec = void 0;
3121
3207
  if (opts.specFile) {
3122
3208
  try {
3123
- const specContent = readFileSync4(opts.specFile, "utf-8");
3209
+ const specContent = readFileSync5(opts.specFile, "utf-8");
3124
3210
  spec = JSON.parse(specContent);
3125
3211
  } catch (error) {
3126
- logger10.error(
3212
+ logger11.error(
3127
3213
  `Failed to read or parse spec file: ${error instanceof Error ? error.message : String(error)}`
3128
3214
  );
3129
3215
  process.exit(1);
3130
3216
  }
3131
3217
  } else if (opts.skipPrompts) {
3132
- logger10.error("--skip-prompts requires --spec-file to be provided");
3218
+ logger11.error("--skip-prompts requires --spec-file to be provided");
3133
3219
  process.exit(1);
3134
3220
  }
3135
3221
  const creator = new PluginCreator({
@@ -3151,12 +3237,12 @@ ${emoji.success("Plugin successfully generated!")}`);
3151
3237
  The plugin has been created in your current directory.`);
3152
3238
  console.log(`
3153
3239
  Next steps:`);
3154
- console.log(`1. cd ${path13.basename(result.pluginPath ?? "")}`);
3240
+ console.log(`1. cd ${path14.basename(result.pluginPath ?? "")}`);
3155
3241
  console.log(`2. Review the generated code`);
3156
3242
  console.log(`3. Test the plugin: bun test`);
3157
3243
  console.log(`4. Add to your ElizaOS project`);
3158
3244
  } else {
3159
- logger10.error(`Plugin generation failed: ${result.error?.message}`);
3245
+ logger11.error(`Plugin generation failed: ${result.error?.message}`);
3160
3246
  process.exit(1);
3161
3247
  }
3162
3248
  } catch (error) {
@@ -3214,20 +3300,20 @@ plugins.command("generate").description("Generate a new plugin using AI-powered
3214
3300
 
3215
3301
  // src/commands/publish/index.ts
3216
3302
  import { Command as Command5 } from "commander";
3217
- import { promises as fs8 } from "fs";
3218
- import path19 from "path";
3303
+ import { promises as fs9 } from "fs";
3304
+ import path20 from "path";
3219
3305
  import * as clack10 from "@clack/prompts";
3220
3306
 
3221
3307
  // src/commands/publish/actions/npm-publish.ts
3222
- import { promises as fs2 } from "fs";
3223
- import path14 from "path";
3308
+ import { promises as fs3 } from "fs";
3309
+ import path15 from "path";
3224
3310
  async function publishToNpm(cwd, packageJson, npmUsername) {
3225
3311
  console.info(`Publishing as npm user: ${npmUsername}`);
3226
3312
  if (!packageJson.npmPackage || packageJson.npmPackage === "${NPM_PACKAGE}") {
3227
3313
  packageJson.npmPackage = packageJson.name;
3228
3314
  console.info(`Set npmPackage to: ${packageJson.npmPackage}`);
3229
- const packageJsonPath = path14.join(cwd, "package.json");
3230
- await fs2.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2), "utf-8");
3315
+ const packageJsonPath = path15.join(cwd, "package.json");
3316
+ await fs3.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2), "utf-8");
3231
3317
  }
3232
3318
  console.info("Building package...");
3233
3319
  await bunExecInherit("npm", ["run", "build"], { cwd });
@@ -3256,21 +3342,21 @@ async function publishToGitHubAction(cwd, packageJson, credentials, skipRegistry
3256
3342
  }
3257
3343
 
3258
3344
  // src/commands/publish/actions/registry-publish.ts
3259
- import { promises as fs3 } from "fs";
3260
- import path15 from "path";
3345
+ import { promises as fs4 } from "fs";
3346
+ import path16 from "path";
3261
3347
  var REGISTRY_PACKAGES_PATH = "packages";
3262
3348
  var LOCAL_REGISTRY_PATH = "packages/registry";
3263
3349
  async function updateRegistryIndex(packageMetadata, dryRun = false) {
3264
3350
  try {
3265
- const indexPath = dryRun ? path15.join(process.cwd(), LOCAL_REGISTRY_PATH, "index.json") : path15.join(process.cwd(), "temp-registry", "index.json");
3351
+ const indexPath = dryRun ? path16.join(process.cwd(), LOCAL_REGISTRY_PATH, "index.json") : path16.join(process.cwd(), "temp-registry", "index.json");
3266
3352
  try {
3267
- await fs3.access(path15.dirname(indexPath));
3353
+ await fs4.access(path16.dirname(indexPath));
3268
3354
  } catch {
3269
- await fs3.mkdir(path15.dirname(indexPath), { recursive: true });
3355
+ await fs4.mkdir(path16.dirname(indexPath), { recursive: true });
3270
3356
  try {
3271
- await fs3.access(indexPath);
3357
+ await fs4.access(indexPath);
3272
3358
  } catch {
3273
- await fs3.writeFile(
3359
+ await fs4.writeFile(
3274
3360
  indexPath,
3275
3361
  JSON.stringify(
3276
3362
  {
@@ -3285,7 +3371,7 @@ async function updateRegistryIndex(packageMetadata, dryRun = false) {
3285
3371
  }
3286
3372
  let indexContent;
3287
3373
  try {
3288
- indexContent = await fs3.readFile(indexPath, "utf-8");
3374
+ indexContent = await fs4.readFile(indexPath, "utf-8");
3289
3375
  } catch (error) {
3290
3376
  indexContent = JSON.stringify({
3291
3377
  v1: { packages: {} },
@@ -3317,7 +3403,7 @@ async function updateRegistryIndex(packageMetadata, dryRun = false) {
3317
3403
  publishedAt: packageMetadata.publishedAt,
3318
3404
  published: !dryRun
3319
3405
  };
3320
- await fs3.writeFile(indexPath, JSON.stringify(index, null, 2));
3406
+ await fs4.writeFile(indexPath, JSON.stringify(index, null, 2));
3321
3407
  console.info(
3322
3408
  `Registry index ${dryRun ? "(dry run) " : ""}updated with ${packageMetadata.name}@${packageMetadata.version}`
3323
3409
  );
@@ -3331,10 +3417,10 @@ async function updateRegistryIndex(packageMetadata, dryRun = false) {
3331
3417
  }
3332
3418
  async function savePackageToRegistry(packageMetadata, dryRun = false) {
3333
3419
  try {
3334
- const packageDir = dryRun ? path15.join(process.cwd(), LOCAL_REGISTRY_PATH, REGISTRY_PACKAGES_PATH, packageMetadata.name) : path15.join(process.cwd(), "temp-registry", REGISTRY_PACKAGES_PATH, packageMetadata.name);
3335
- const metadataPath = path15.join(packageDir, `${packageMetadata.version}.json`);
3336
- await fs3.mkdir(packageDir, { recursive: true });
3337
- await fs3.writeFile(metadataPath, JSON.stringify(packageMetadata, null, 2));
3420
+ const packageDir = dryRun ? path16.join(process.cwd(), LOCAL_REGISTRY_PATH, REGISTRY_PACKAGES_PATH, packageMetadata.name) : path16.join(process.cwd(), "temp-registry", REGISTRY_PACKAGES_PATH, packageMetadata.name);
3421
+ const metadataPath = path16.join(packageDir, `${packageMetadata.version}.json`);
3422
+ await fs4.mkdir(packageDir, { recursive: true });
3423
+ await fs4.writeFile(metadataPath, JSON.stringify(packageMetadata, null, 2));
3338
3424
  console.info(`Package metadata ${dryRun ? "(dry run) " : ""}saved to ${metadataPath}`);
3339
3425
  await updateRegistryIndex(packageMetadata, dryRun);
3340
3426
  return true;
@@ -3347,8 +3433,8 @@ async function savePackageToRegistry(packageMetadata, dryRun = false) {
3347
3433
  }
3348
3434
 
3349
3435
  // src/commands/publish/utils/validation.ts
3350
- import { promises as fs4 } from "fs";
3351
- import path16 from "path";
3436
+ import { promises as fs5 } from "fs";
3437
+ import path17 from "path";
3352
3438
  import * as clack6 from "@clack/prompts";
3353
3439
  async function validatePluginRequirements(cwd, packageJson) {
3354
3440
  const errors = [];
@@ -3359,23 +3445,23 @@ async function validatePluginRequirements(cwd, packageJson) {
3359
3445
  'Plugin name must start with "plugin-". Please update your package name and try again.'
3360
3446
  );
3361
3447
  }
3362
- const pluginDirName = path16.basename(cwd);
3448
+ const pluginDirName = path17.basename(cwd);
3363
3449
  const expectedDefaultDesc = `ElizaOS plugin for ${pluginDirName.replace("plugin-", "")}`;
3364
3450
  if (packageJson.description === expectedDefaultDesc || packageJson.description === "${PLUGINDESCRIPTION}") {
3365
3451
  warnings.push(
3366
3452
  "Description appears to be the default generated description. Consider writing a custom description."
3367
3453
  );
3368
3454
  }
3369
- const imagesDir = path16.join(cwd, "images");
3370
- const logoPath = path16.join(imagesDir, "logo.jpg");
3371
- const bannerPath = path16.join(imagesDir, "banner.jpg");
3455
+ const imagesDir = path17.join(cwd, "images");
3456
+ const logoPath = path17.join(imagesDir, "logo.jpg");
3457
+ const bannerPath = path17.join(imagesDir, "banner.jpg");
3372
3458
  try {
3373
- await fs4.access(logoPath);
3459
+ await fs5.access(logoPath);
3374
3460
  } catch {
3375
3461
  warnings.push("Missing required logo.jpg in images/ directory (400x400px, max 500KB).");
3376
3462
  }
3377
3463
  try {
3378
- await fs4.access(bannerPath);
3464
+ await fs5.access(bannerPath);
3379
3465
  } catch {
3380
3466
  warnings.push("Missing required banner.jpg in images/ directory (1280x640px, max 1MB).");
3381
3467
  }
@@ -3513,20 +3599,20 @@ async function getNpmUsername() {
3513
3599
  }
3514
3600
 
3515
3601
  // src/commands/publish/utils/version-check.ts
3516
- import { promises as fs7 } from "fs";
3517
- import path18 from "path";
3602
+ import { promises as fs8 } from "fs";
3603
+ import path19 from "path";
3518
3604
  import { fileURLToPath as fileURLToPath3 } from "url";
3519
3605
  import * as clack9 from "@clack/prompts";
3520
3606
 
3521
3607
  // src/commands/update/index.ts
3522
- import { logger as logger14 } from "@elizaos/core";
3608
+ import { logger as logger15 } from "@elizaos/core";
3523
3609
  import { Command as Command4 } from "commander";
3524
3610
 
3525
3611
  // src/commands/update/actions/cli-update.ts
3526
- import { logger as logger12 } from "@elizaos/core";
3612
+ import { logger as logger13 } from "@elizaos/core";
3527
3613
 
3528
3614
  // src/commands/update/utils/version-utils.ts
3529
- import { logger as logger11 } from "@elizaos/core";
3615
+ import { logger as logger12 } from "@elizaos/core";
3530
3616
  import * as semver from "semver";
3531
3617
  var SPECIAL_VERSION_TAGS = ["latest", "next", "canary", "rc", "dev", "nightly", "alpha"];
3532
3618
  var ELIZAOS_ORG = "@elizaos";
@@ -3536,7 +3622,7 @@ async function getVersion2() {
3536
3622
  const envInfo = await UserEnvironment.getInstance().getInfo();
3537
3623
  return envInfo.cli.version;
3538
3624
  } catch (error) {
3539
- logger11.error("Error getting CLI version:", error);
3625
+ logger12.error("Error getting CLI version:", error);
3540
3626
  return FALLBACK_VERSION;
3541
3627
  }
3542
3628
  }
@@ -3576,10 +3662,10 @@ async function fetchLatestVersion(packageName) {
3576
3662
  env: { NODE_ENV: "production" }
3577
3663
  });
3578
3664
  const version = stdout.trim();
3579
- logger11.debug(`Latest version of ${packageName} from npm: ${version}`);
3665
+ logger12.debug(`Latest version of ${packageName} from npm: ${version}`);
3580
3666
  return version;
3581
3667
  } catch (error) {
3582
- logger11.error(
3668
+ logger12.error(
3583
3669
  `Failed to fetch version for ${packageName}: ${error instanceof Error ? error.message : String(error)}`
3584
3670
  );
3585
3671
  return null;
@@ -3610,14 +3696,14 @@ async function performCliUpdate(options = {}) {
3610
3696
  if (!options.skipBunMigration) {
3611
3697
  const npmInstallation = await isCliInstalledViaNpm();
3612
3698
  if (npmInstallation) {
3613
- logger12.info("Detected npm installation, migrating to bun...");
3699
+ logger13.info("Detected npm installation, migrating to bun...");
3614
3700
  try {
3615
3701
  await migrateCliToBun(latestVersion);
3616
3702
  console.log(`CLI updated successfully to version ${latestVersion} [\u2713]`);
3617
3703
  return true;
3618
3704
  } catch (migrationError) {
3619
- logger12.warn("Migration to bun failed, falling back to npm update...");
3620
- logger12.debug(
3705
+ logger13.warn("Migration to bun failed, falling back to npm update...");
3706
+ logger13.debug(
3621
3707
  "Migration error:",
3622
3708
  migrationError instanceof Error ? migrationError.message : String(migrationError)
3623
3709
  );
@@ -3642,7 +3728,7 @@ async function performCliUpdate(options = {}) {
3642
3728
  console.error(" curl -fsSL https://bun.sh/install | bash");
3643
3729
  console.error(" # or");
3644
3730
  console.error(" npm install -g bun");
3645
- logger12.debug("Bun error:", bunError instanceof Error ? bunError.message : String(bunError));
3731
+ logger13.debug("Bun error:", bunError instanceof Error ? bunError.message : String(bunError));
3646
3732
  return false;
3647
3733
  }
3648
3734
  } catch (error) {
@@ -3653,12 +3739,12 @@ async function performCliUpdate(options = {}) {
3653
3739
 
3654
3740
  // src/commands/update/actions/dependency-update.ts
3655
3741
  import * as clack8 from "@clack/prompts";
3656
- import { promises as fs6 } from "fs";
3657
- import * as path17 from "path";
3742
+ import { promises as fs7 } from "fs";
3743
+ import * as path18 from "path";
3658
3744
 
3659
3745
  // src/commands/update/utils/package-utils.ts
3660
- import fs5 from "fs/promises";
3661
- import { logger as logger13 } from "@elizaos/core";
3746
+ import fs6 from "fs/promises";
3747
+ import { logger as logger14 } from "@elizaos/core";
3662
3748
  async function checkForUpdates(dependencies) {
3663
3749
  const updates = {};
3664
3750
  const elizaPackages = Object.entries(dependencies).filter(([pkg]) => pkg.startsWith(ELIZAOS_ORG)).filter(([, version]) => !isWorkspaceVersion(version));
@@ -3669,7 +3755,7 @@ async function checkForUpdates(dependencies) {
3669
3755
  if (needsUpdate) {
3670
3756
  updates[pkg] = { current: currentVersion, latest: latestVersion };
3671
3757
  } else if (error) {
3672
- logger13.debug(`${pkg}: ${error}`);
3758
+ logger14.debug(`${pkg}: ${error}`);
3673
3759
  }
3674
3760
  }
3675
3761
  return { hasUpdates: Object.keys(updates).length > 0, updates };
@@ -3683,7 +3769,7 @@ function displayUpdateSummary(updates) {
3683
3769
  });
3684
3770
  }
3685
3771
  async function updatePackageJson(packageJsonPath, updates) {
3686
- const content = await fs5.readFile(packageJsonPath, "utf8");
3772
+ const content = await fs6.readFile(packageJsonPath, "utf8");
3687
3773
  const packageJson = JSON.parse(content);
3688
3774
  let modified = false;
3689
3775
  for (const [pkg, { latest }] of Object.entries(updates)) {
@@ -3697,7 +3783,7 @@ async function updatePackageJson(packageJsonPath, updates) {
3697
3783
  }
3698
3784
  }
3699
3785
  if (modified) {
3700
- await fs5.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n");
3786
+ await fs6.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n");
3701
3787
  console.log("Updated package.json with new versions");
3702
3788
  }
3703
3789
  }
@@ -3717,8 +3803,8 @@ async function installDependencies(cwd) {
3717
3803
  // src/commands/update/actions/dependency-update.ts
3718
3804
  async function updateDependencies(cwd, isPlugin2, options = {}) {
3719
3805
  const { dryRun = false, skipBuild = false } = options;
3720
- const packageJsonPath = path17.join(cwd, "package.json");
3721
- const content = await fs6.readFile(packageJsonPath, "utf8");
3806
+ const packageJsonPath = path18.join(cwd, "package.json");
3807
+ const content = await fs7.readFile(packageJsonPath, "utf8");
3722
3808
  const packageJson = JSON.parse(content);
3723
3809
  const allDependencies = {
3724
3810
  ...packageJson.dependencies,
@@ -3788,7 +3874,7 @@ var update = new Command4().name("update").description("Update ElizaOS CLI and p
3788
3874
  try {
3789
3875
  await displayBanner(true);
3790
3876
  } catch {
3791
- logger14.debug("Banner display failed, continuing with update");
3877
+ logger15.debug("Banner display failed, continuing with update");
3792
3878
  }
3793
3879
  }).action(async (options) => {
3794
3880
  try {
@@ -3820,7 +3906,7 @@ var update = new Command4().name("update").description("Update ElizaOS CLI and p
3820
3906
  console.info("To create a new ElizaOS project, use: elizaos create <project-name>");
3821
3907
  return;
3822
3908
  }
3823
- logger14.debug(`Detected ${directoryInfo.type}`);
3909
+ logger15.debug(`Detected ${directoryInfo.type}`);
3824
3910
  if (!isInProject) {
3825
3911
  handleInvalidDirectory(directoryInfo);
3826
3912
  return;
@@ -3857,11 +3943,11 @@ var update = new Command4().name("update").description("Update ElizaOS CLI and p
3857
3943
  // src/commands/publish/utils/version-check.ts
3858
3944
  async function checkCliVersion() {
3859
3945
  try {
3860
- const cliPackageJsonPath = path18.resolve(
3861
- path18.dirname(fileURLToPath3(import.meta.url)),
3946
+ const cliPackageJsonPath = path19.resolve(
3947
+ path19.dirname(fileURLToPath3(import.meta.url)),
3862
3948
  "../package.json"
3863
3949
  );
3864
- const cliPackageJsonContent = await fs7.readFile(cliPackageJsonPath, "utf-8");
3950
+ const cliPackageJsonContent = await fs8.readFile(cliPackageJsonPath, "utf-8");
3865
3951
  const cliPackageJson = JSON.parse(cliPackageJsonContent);
3866
3952
  const currentVersion = cliPackageJson.version || "0.0.0";
3867
3953
  const { stdout } = await bunExecSimple("npm", ["view", "@elizaos/cli", "time", "--json"]);
@@ -3919,7 +4005,7 @@ var publish = new Command5().name("publish").description("Publish a plugin to np
3919
4005
  process.exit(1);
3920
4006
  }
3921
4007
  const cliVersion = await checkCliVersion();
3922
- const pluginDirName = path19.basename(process.cwd());
4008
+ const pluginDirName = path20.basename(process.cwd());
3923
4009
  if (!pluginDirName.startsWith("plugin-")) {
3924
4010
  console.error("This command must be run from a plugin directory (plugin-*)");
3925
4011
  process.exit(1);
@@ -3945,8 +4031,8 @@ var publish = new Command5().name("publish").description("Publish a plugin to np
3945
4031
  }
3946
4032
  }
3947
4033
  }
3948
- const packageJsonPath = path19.join(cwd, "package.json");
3949
- const packageJsonContent = await fs8.readFile(packageJsonPath, "utf-8");
4034
+ const packageJsonPath = path20.join(cwd, "package.json");
4035
+ const packageJsonContent = await fs9.readFile(packageJsonPath, "utf-8");
3950
4036
  const packageJson = JSON.parse(packageJsonContent);
3951
4037
  if (!packageJson.name || !packageJson.version) {
3952
4038
  console.error("Invalid package.json: missing name or version.");
@@ -4087,7 +4173,7 @@ var publish = new Command5().name("publish").description("Publish a plugin to np
4087
4173
  }
4088
4174
  });
4089
4175
  const finalPluginName = packageJson.name.startsWith("@") ? packageJson.name.split("/")[1] : packageJson.name;
4090
- await fs8.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2), "utf-8");
4176
+ await fs9.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2), "utf-8");
4091
4177
  await validatePluginRequirements(cwd, packageJson);
4092
4178
  const settings = await getRegistrySettings();
4093
4179
  const publishUsername = credentials ? credentials.username : npmUsername;
@@ -4211,8 +4297,8 @@ var publish = new Command5().name("publish").description("Publish a plugin to np
4211
4297
  import { Command as Command6 } from "commander";
4212
4298
 
4213
4299
  // src/commands/monorepo/actions/clone.ts
4214
- import { existsSync as existsSync12, readdirSync as readdirSync3, mkdirSync } from "fs";
4215
- import path20 from "path";
4300
+ import { existsSync as existsSync13, readdirSync as readdirSync3, mkdirSync } from "fs";
4301
+ import path21 from "path";
4216
4302
  async function cloneRepository(repo, branch, destination) {
4217
4303
  try {
4218
4304
  const repoUrl = `https://github.com/${repo}`;
@@ -4236,8 +4322,8 @@ For a complete list of branches, visit: https://github.com/elizaOS/eliza/branche
4236
4322
  }
4237
4323
  }
4238
4324
  function prepareDestination(dir) {
4239
- const destinationDir = path20.resolve(process.cwd(), dir);
4240
- if (existsSync12(destinationDir)) {
4325
+ const destinationDir = path21.resolve(process.cwd(), dir);
4326
+ if (existsSync13(destinationDir)) {
4241
4327
  const files = readdirSync3(destinationDir);
4242
4328
  if (files.length > 0) {
4243
4329
  throw new Error(`Destination directory ${destinationDir} already exists and is not empty`);
@@ -4255,7 +4341,7 @@ async function cloneMonorepo(cloneInfo) {
4255
4341
  }
4256
4342
 
4257
4343
  // src/commands/monorepo/utils/setup-instructions.ts
4258
- import path21 from "path";
4344
+ import path22 from "path";
4259
4345
  function getBunInstallInstructions() {
4260
4346
  const platform = process.platform;
4261
4347
  if (platform === "win32") {
@@ -4310,7 +4396,7 @@ ${emoji.rocket("If you don't have Bun installed:")}`);
4310
4396
  console.log(" After installation, restart your terminal");
4311
4397
  }
4312
4398
  function displayNextSteps(targetDir) {
4313
- const cdPath = path21.relative(process.cwd(), targetDir);
4399
+ const cdPath = path22.relative(process.cwd(), targetDir);
4314
4400
  displayBasicSteps(cdPath);
4315
4401
  displayPrerequisites();
4316
4402
  displayBunInstructions();
@@ -4337,11 +4423,11 @@ var monorepo = new Command6().name("monorepo").description("Clone ElizaOS monore
4337
4423
 
4338
4424
  // src/project.ts
4339
4425
  import {
4340
- logger as logger15
4426
+ logger as logger16
4341
4427
  } from "@elizaos/core";
4342
4428
  import { stringToUuid } from "@elizaos/core";
4343
- import * as fs9 from "fs";
4344
- import path22 from "path";
4429
+ import * as fs10 from "fs";
4430
+ import path23 from "path";
4345
4431
  function isPlugin(module) {
4346
4432
  if (module && typeof module === "object" && typeof module.name === "string" && typeof module.description === "string") {
4347
4433
  return true;
@@ -4376,10 +4462,10 @@ async function loadProject(dir) {
4376
4462
  if (!dirInfo.hasPackageJson) {
4377
4463
  throw new Error(`No package.json found in ${dir}`);
4378
4464
  }
4379
- const packageJson = JSON.parse(fs9.readFileSync(path22.join(dir, "package.json"), "utf8"));
4465
+ const packageJson = JSON.parse(fs10.readFileSync(path23.join(dir, "package.json"), "utf8"));
4380
4466
  const main2 = packageJson.main;
4381
4467
  if (!main2) {
4382
- logger15.warn("No main field found in package.json, using default character");
4468
+ logger16.warn("No main field found in package.json, using default character");
4383
4469
  const defaultCharacterName = "Eliza (Default)";
4384
4470
  const elizaCharacter = getElizaCharacter();
4385
4471
  const defaultAgent = {
@@ -4389,7 +4475,7 @@ async function loadProject(dir) {
4389
4475
  name: defaultCharacterName
4390
4476
  },
4391
4477
  init: async () => {
4392
- logger15.info("Initializing default Eliza character");
4478
+ logger16.info("Initializing default Eliza character");
4393
4479
  }
4394
4480
  };
4395
4481
  return {
@@ -4398,32 +4484,32 @@ async function loadProject(dir) {
4398
4484
  };
4399
4485
  }
4400
4486
  const entryPoints = [
4401
- path22.join(dir, main2),
4402
- path22.join(dir, "dist/index.js"),
4403
- path22.join(dir, "src/index.ts"),
4404
- path22.join(dir, "src/index.js"),
4405
- path22.join(dir, "index.ts"),
4406
- path22.join(dir, "index.js")
4487
+ path23.join(dir, main2),
4488
+ path23.join(dir, "dist/index.js"),
4489
+ path23.join(dir, "src/index.ts"),
4490
+ path23.join(dir, "src/index.js"),
4491
+ path23.join(dir, "index.ts"),
4492
+ path23.join(dir, "index.js")
4407
4493
  ];
4408
4494
  let projectModule = null;
4409
4495
  for (const entryPoint of entryPoints) {
4410
- if (fs9.existsSync(entryPoint)) {
4496
+ if (fs10.existsSync(entryPoint)) {
4411
4497
  try {
4412
- const importPath = path22.resolve(entryPoint);
4498
+ const importPath = path23.resolve(entryPoint);
4413
4499
  const importUrl = process.platform === "win32" ? "file:///" + importPath.replace(/\\/g, "/") : "file://" + importPath;
4414
4500
  projectModule = await import(importUrl);
4415
- logger15.info(`Loaded project from ${entryPoint}`);
4501
+ logger16.info(`Loaded project from ${entryPoint}`);
4416
4502
  const exportKeys = Object.keys(projectModule);
4417
- logger15.debug(`Module exports: ${exportKeys.join(", ")}`);
4503
+ logger16.debug(`Module exports: ${exportKeys.join(", ")}`);
4418
4504
  if (exportKeys.includes("default")) {
4419
- logger15.debug(`Default export type: ${typeof projectModule.default}`);
4505
+ logger16.debug(`Default export type: ${typeof projectModule.default}`);
4420
4506
  if (typeof projectModule.default === "object" && projectModule.default !== null) {
4421
- logger15.debug(`Default export keys: ${Object.keys(projectModule.default).join(", ")}`);
4507
+ logger16.debug(`Default export keys: ${Object.keys(projectModule.default).join(", ")}`);
4422
4508
  }
4423
4509
  }
4424
4510
  break;
4425
4511
  } catch (error) {
4426
- logger15.warn(`Failed to import project from ${entryPoint}:`, error);
4512
+ logger16.warn(`Failed to import project from ${entryPoint}:`, error);
4427
4513
  }
4428
4514
  }
4429
4515
  }
@@ -4431,13 +4517,13 @@ async function loadProject(dir) {
4431
4517
  throw new Error("Could not find project entry point");
4432
4518
  }
4433
4519
  const moduleIsPlugin = isPlugin(projectModule);
4434
- logger15.debug(`Is this a plugin? ${moduleIsPlugin}`);
4520
+ logger16.debug(`Is this a plugin? ${moduleIsPlugin}`);
4435
4521
  if (moduleIsPlugin) {
4436
- logger15.info("Detected plugin module instead of project");
4522
+ logger16.info("Detected plugin module instead of project");
4437
4523
  try {
4438
4524
  const plugin = extractPlugin(projectModule);
4439
- logger15.debug(`Found plugin: ${plugin.name} - ${plugin.description}`);
4440
- logger15.debug(`Plugin has the following properties: ${Object.keys(plugin).join(", ")}`);
4525
+ logger16.debug(`Found plugin: ${plugin.name} - ${plugin.description}`);
4526
+ logger16.debug(`Plugin has the following properties: ${Object.keys(plugin).join(", ")}`);
4441
4527
  const completePlugin = {
4442
4528
  // Copy all other properties from the original plugin first
4443
4529
  ...plugin,
@@ -4445,7 +4531,7 @@ async function loadProject(dir) {
4445
4531
  name: plugin.name || "unknown-plugin",
4446
4532
  description: plugin.description || "No description",
4447
4533
  init: plugin.init || (async () => {
4448
- logger15.info(`Dummy init for plugin: ${plugin.name}`);
4534
+ logger16.info(`Dummy init for plugin: ${plugin.name}`);
4449
4535
  })
4450
4536
  };
4451
4537
  const characterName = "Eliza (Test Mode)";
@@ -4456,13 +4542,13 @@ async function loadProject(dir) {
4456
4542
  name: characterName,
4457
4543
  system: `${elizaCharacter.system} Testing the plugin: ${completePlugin.name}.`
4458
4544
  };
4459
- logger15.info(`Using Eliza character as test agent for plugin: ${completePlugin.name}`);
4545
+ logger16.info(`Using Eliza character as test agent for plugin: ${completePlugin.name}`);
4460
4546
  const testAgent = {
4461
4547
  character: testCharacter,
4462
4548
  plugins: [completePlugin],
4463
4549
  // Only include the plugin being tested
4464
4550
  init: async () => {
4465
- logger15.info(`Initializing Eliza test agent for plugin: ${completePlugin.name}`);
4551
+ logger16.info(`Initializing Eliza test agent for plugin: ${completePlugin.name}`);
4466
4552
  }
4467
4553
  };
4468
4554
  return {
@@ -4472,24 +4558,24 @@ async function loadProject(dir) {
4472
4558
  pluginModule: completePlugin
4473
4559
  };
4474
4560
  } catch (error) {
4475
- logger15.error("Error extracting plugin from module:", error);
4561
+ logger16.error("Error extracting plugin from module:", error);
4476
4562
  throw error;
4477
4563
  }
4478
4564
  }
4479
4565
  const agents = [];
4480
4566
  if (projectModule.default && typeof projectModule.default === "object" && Array.isArray(projectModule.default.agents)) {
4481
4567
  agents.push(...projectModule.default.agents);
4482
- logger15.debug(`Found ${agents.length} agents in default export's agents array`);
4568
+ logger16.debug(`Found ${agents.length} agents in default export's agents array`);
4483
4569
  } else {
4484
4570
  for (const [key, value] of Object.entries(projectModule)) {
4485
4571
  if (key === "default" && value && typeof value === "object") {
4486
4572
  if (value.character && value.init) {
4487
4573
  agents.push(value);
4488
- logger15.debug(`Found agent in default export (single agent)`);
4574
+ logger16.debug(`Found agent in default export (single agent)`);
4489
4575
  }
4490
4576
  } else if (value && typeof value === "object" && value.character && value.init) {
4491
4577
  agents.push(value);
4492
- logger15.debug(`Found agent in named export: ${key}`);
4578
+ logger16.debug(`Found agent in named export: ${key}`);
4493
4579
  }
4494
4580
  }
4495
4581
  }
@@ -4502,7 +4588,7 @@ async function loadProject(dir) {
4502
4588
  };
4503
4589
  return project;
4504
4590
  } catch (error) {
4505
- logger15.error("Error loading project:", error);
4591
+ logger16.error("Error loading project:", error);
4506
4592
  throw error;
4507
4593
  }
4508
4594
  }
@@ -4517,19 +4603,19 @@ function validatePort(value) {
4517
4603
  }
4518
4604
 
4519
4605
  // src/commands/start/index.ts
4520
- import { logger as logger20 } from "@elizaos/core";
4606
+ import { logger as logger21 } from "@elizaos/core";
4521
4607
  import { Command as Command7 } from "commander";
4522
- import * as fs10 from "fs";
4523
- import * as path24 from "path";
4608
+ import * as fs11 from "fs";
4609
+ import * as path25 from "path";
4524
4610
 
4525
4611
  // src/commands/start/actions/server-start.ts
4526
- import { logger as logger19 } from "@elizaos/core";
4612
+ import { logger as logger20 } from "@elizaos/core";
4527
4613
 
4528
4614
  // src/commands/start/actions/agent-start.ts
4529
4615
  import {
4530
4616
  AgentRuntime as AgentRuntime2,
4531
4617
  encryptedCharacter,
4532
- logger as logger18,
4618
+ logger as logger19,
4533
4619
  stringToUuid as stringToUuid2
4534
4620
  } from "@elizaos/core";
4535
4621
  import { plugin as sqlPlugin } from "@elizaos/plugin-sql";
@@ -4572,19 +4658,19 @@ async function setDefaultSecretsFromEnv(character) {
4572
4658
  }
4573
4659
 
4574
4660
  // src/commands/start/utils/dependency-resolver.ts
4575
- import { logger as logger16 } from "@elizaos/core";
4661
+ import { logger as logger17 } from "@elizaos/core";
4576
4662
  function resolvePluginDependencies(availablePlugins, isTestMode = false) {
4577
4663
  const resolutionOrder = [];
4578
4664
  const visited = /* @__PURE__ */ new Set();
4579
4665
  const visiting = /* @__PURE__ */ new Set();
4580
4666
  function visit(pluginName) {
4581
4667
  if (!availablePlugins.has(pluginName)) {
4582
- logger16.warn(`Plugin dependency "${pluginName}" not found and will be skipped.`);
4668
+ logger17.warn(`Plugin dependency "${pluginName}" not found and will be skipped.`);
4583
4669
  return;
4584
4670
  }
4585
4671
  if (visited.has(pluginName)) return;
4586
4672
  if (visiting.has(pluginName)) {
4587
- logger16.error(`Circular dependency detected involving plugin: ${pluginName}`);
4673
+ logger17.error(`Circular dependency detected involving plugin: ${pluginName}`);
4588
4674
  return;
4589
4675
  }
4590
4676
  visiting.add(pluginName);
@@ -4608,12 +4694,12 @@ function resolvePluginDependencies(availablePlugins, isTestMode = false) {
4608
4694
  }
4609
4695
  }
4610
4696
  const finalPlugins = resolutionOrder.map((name) => availablePlugins.get(name)).filter((p) => p);
4611
- logger16.info(`Final plugins being loaded: ${finalPlugins.map((p) => p.name).join(", ")}`);
4697
+ logger17.info(`Final plugins being loaded: ${finalPlugins.map((p) => p.name).join(", ")}`);
4612
4698
  return finalPlugins;
4613
4699
  }
4614
4700
 
4615
4701
  // src/commands/start/utils/plugin-utils.ts
4616
- import { logger as logger17 } from "@elizaos/core";
4702
+ import { logger as logger18 } from "@elizaos/core";
4617
4703
  function isValidPluginShape(obj) {
4618
4704
  if (!obj || typeof obj !== "object" || !obj.name) {
4619
4705
  return false;
@@ -4628,12 +4714,12 @@ async function loadAndPreparePlugin(pluginName) {
4628
4714
  try {
4629
4715
  pluginModule = await loadPluginModule(pluginName);
4630
4716
  if (!pluginModule) {
4631
- logger17.error(`Failed to load local plugin ${pluginName}.`);
4717
+ logger18.error(`Failed to load local plugin ${pluginName}.`);
4632
4718
  provideLocalPluginGuidance(pluginName, context);
4633
4719
  return null;
4634
4720
  }
4635
4721
  } catch (error) {
4636
- logger17.error(`Error loading local plugin ${pluginName}: ${error}`);
4722
+ logger18.error(`Error loading local plugin ${pluginName}: ${error}`);
4637
4723
  provideLocalPluginGuidance(pluginName, context);
4638
4724
  return null;
4639
4725
  }
@@ -4641,17 +4727,17 @@ async function loadAndPreparePlugin(pluginName) {
4641
4727
  try {
4642
4728
  pluginModule = await loadPluginModule(pluginName);
4643
4729
  if (!pluginModule) {
4644
- logger17.info(`Plugin ${pluginName} not available, installing...`);
4730
+ logger18.info(`Plugin ${pluginName} not available, installing...`);
4645
4731
  await installPlugin(pluginName, process.cwd(), version);
4646
4732
  pluginModule = await loadPluginModule(pluginName);
4647
4733
  }
4648
4734
  } catch (error) {
4649
- logger17.error(`Failed to process plugin ${pluginName}: ${error}`);
4735
+ logger18.error(`Failed to process plugin ${pluginName}: ${error}`);
4650
4736
  return null;
4651
4737
  }
4652
4738
  }
4653
4739
  if (!pluginModule) {
4654
- logger17.error(`Failed to load module for plugin ${pluginName}.`);
4740
+ logger18.error(`Failed to load module for plugin ${pluginName}.`);
4655
4741
  return null;
4656
4742
  }
4657
4743
  const expectedFunctionName = `${pluginName.replace(/^@elizaos\/plugin-/, "").replace(/^@elizaos\//, "").replace(/-./g, (match) => match[1].toUpperCase())}Plugin`;
@@ -4665,7 +4751,7 @@ async function loadAndPreparePlugin(pluginName) {
4665
4751
  return potentialPlugin;
4666
4752
  }
4667
4753
  }
4668
- logger17.warn(`Could not find a valid plugin export in ${pluginName}.`);
4754
+ logger18.warn(`Could not find a valid plugin export in ${pluginName}.`);
4669
4755
  return null;
4670
4756
  }
4671
4757
 
@@ -4717,32 +4803,32 @@ async function startAgent(character, server, init, plugins2 = [], options = {})
4717
4803
  try {
4718
4804
  const migrationService = runtime.getService("database_migration");
4719
4805
  if (migrationService) {
4720
- logger18.info("Discovering plugin schemas for dynamic migration...");
4806
+ logger19.info("Discovering plugin schemas for dynamic migration...");
4721
4807
  migrationService.discoverAndRegisterPluginSchemas(finalPlugins);
4722
- logger18.info("Running all plugin migrations...");
4808
+ logger19.info("Running all plugin migrations...");
4723
4809
  await migrationService.runAllPluginMigrations();
4724
- logger18.info("All plugin migrations completed successfully");
4810
+ logger19.info("All plugin migrations completed successfully");
4725
4811
  } else {
4726
- logger18.warn("DatabaseMigrationService not found - plugin schema migrations skipped");
4812
+ logger19.warn("DatabaseMigrationService not found - plugin schema migrations skipped");
4727
4813
  }
4728
4814
  } catch (error) {
4729
- logger18.error("Failed to run plugin migrations:", error);
4815
+ logger19.error("Failed to run plugin migrations:", error);
4730
4816
  throw error;
4731
4817
  }
4732
4818
  server.registerAgent(runtime);
4733
- logger18.log(`Started ${runtime.character.name} as ${runtime.agentId}`);
4819
+ logger19.log(`Started ${runtime.character.name} as ${runtime.agentId}`);
4734
4820
  return runtime;
4735
4821
  }
4736
4822
  async function stopAgent(runtime, server) {
4737
4823
  await runtime.close();
4738
4824
  server.unregisterAgent(runtime.agentId);
4739
- logger18.success(`Agent ${runtime.character.name} stopped successfully!`);
4825
+ logger19.success(`Agent ${runtime.character.name} stopped successfully!`);
4740
4826
  }
4741
4827
 
4742
4828
  // src/commands/start/actions/server-start.ts
4743
- import path23 from "path";
4829
+ import path24 from "path";
4744
4830
  import { fileURLToPath as fileURLToPath4 } from "url";
4745
- import { existsSync as existsSync14, readFileSync as readFileSync6 } from "fs";
4831
+ import { existsSync as existsSync15, readFileSync as readFileSync7 } from "fs";
4746
4832
  async function startAgents(options) {
4747
4833
  const postgresUrl = await configureDatabaseSettings(options.configure);
4748
4834
  if (postgresUrl) process.env.POSTGRES_URL = postgresUrl;
@@ -4751,19 +4837,19 @@ async function startAgents(options) {
4751
4837
  const serverModule = await moduleLoader.load("@elizaos/server");
4752
4838
  const { AgentServer, jsonToCharacter, loadCharacterTryPath } = serverModule;
4753
4839
  const __filename = fileURLToPath4(import.meta.url);
4754
- const __dirname = path23.dirname(__filename);
4755
- let cliDistPath = path23.resolve(__dirname, "../../../");
4756
- const indexPath = path23.join(cliDistPath, "index.html");
4757
- if (!existsSync14(indexPath)) {
4840
+ const __dirname = path24.dirname(__filename);
4841
+ let cliDistPath = path24.resolve(__dirname, "../../../");
4842
+ const indexPath = path24.join(cliDistPath, "index.html");
4843
+ if (!existsSync15(indexPath)) {
4758
4844
  let currentDir = __dirname;
4759
- while (currentDir !== path23.dirname(currentDir)) {
4760
- const packageJsonPath = path23.join(currentDir, "package.json");
4761
- if (existsSync14(packageJsonPath)) {
4845
+ while (currentDir !== path24.dirname(currentDir)) {
4846
+ const packageJsonPath = path24.join(currentDir, "package.json");
4847
+ if (existsSync15(packageJsonPath)) {
4762
4848
  try {
4763
- const packageJson = JSON.parse(readFileSync6(packageJsonPath, "utf-8"));
4849
+ const packageJson = JSON.parse(readFileSync7(packageJsonPath, "utf-8"));
4764
4850
  if (packageJson.name === "@elizaos/cli") {
4765
- const distPath = path23.join(currentDir, "dist");
4766
- if (existsSync14(path23.join(distPath, "index.html"))) {
4851
+ const distPath = path24.join(currentDir, "dist");
4852
+ if (existsSync15(path24.join(distPath, "index.html"))) {
4767
4853
  cliDistPath = distPath;
4768
4854
  break;
4769
4855
  }
@@ -4771,7 +4857,7 @@ async function startAgents(options) {
4771
4857
  } catch {
4772
4858
  }
4773
4859
  }
4774
- currentDir = path23.dirname(currentDir);
4860
+ currentDir = path24.dirname(currentDir);
4775
4861
  }
4776
4862
  }
4777
4863
  const server = new AgentServer();
@@ -4786,13 +4872,13 @@ async function startAgents(options) {
4786
4872
  const desiredPort = options.port || Number.parseInt(process.env.SERVER_PORT || "3000");
4787
4873
  const serverPort = await findNextAvailablePort(desiredPort);
4788
4874
  if (serverPort !== desiredPort) {
4789
- logger19.warn(`Port ${desiredPort} is in use, using port ${serverPort} instead`);
4875
+ logger20.warn(`Port ${desiredPort} is in use, using port ${serverPort} instead`);
4790
4876
  }
4791
4877
  process.env.SERVER_PORT = serverPort.toString();
4792
4878
  try {
4793
4879
  await server.start(serverPort);
4794
4880
  } catch (error) {
4795
- logger19.error(`Failed to start server on port ${serverPort}:`, error);
4881
+ logger20.error(`Failed to start server on port ${serverPort}:`, error);
4796
4882
  throw error;
4797
4883
  }
4798
4884
  if (options.projectAgents && options.projectAgents.length > 0) {
@@ -4820,15 +4906,16 @@ var start = new Command7().name("start").description("Build and start the Eliza
4820
4906
  }).action(async (options) => {
4821
4907
  try {
4822
4908
  await loadEnvConfig();
4823
- const localModulesPath = path24.join(process.cwd(), "node_modules");
4909
+ await ensureElizaOSCli();
4910
+ const localModulesPath = path25.join(process.cwd(), "node_modules");
4824
4911
  if (process.env.NODE_PATH) {
4825
- process.env.NODE_PATH = `${localModulesPath}${path24.delimiter}${process.env.NODE_PATH}`;
4912
+ process.env.NODE_PATH = `${localModulesPath}${path25.delimiter}${process.env.NODE_PATH}`;
4826
4913
  } else {
4827
4914
  process.env.NODE_PATH = localModulesPath;
4828
4915
  }
4829
- const localBinPath = path24.join(process.cwd(), "node_modules", ".bin");
4916
+ const localBinPath = path25.join(process.cwd(), "node_modules", ".bin");
4830
4917
  if (process.env.PATH) {
4831
- process.env.PATH = `${localBinPath}${path24.delimiter}${process.env.PATH}`;
4918
+ process.env.PATH = `${localBinPath}${path25.delimiter}${process.env.PATH}`;
4832
4919
  } else {
4833
4920
  process.env.PATH = localBinPath;
4834
4921
  }
@@ -4839,8 +4926,8 @@ var start = new Command7().name("start").description("Build and start the Eliza
4839
4926
  try {
4840
4927
  await buildProject(cwd, false);
4841
4928
  } catch (error) {
4842
- logger20.error(`Build error: ${error instanceof Error ? error.message : String(error)}`);
4843
- logger20.warn(
4929
+ logger21.error(`Build error: ${error instanceof Error ? error.message : String(error)}`);
4930
+ logger21.warn(
4844
4931
  "Build failed, but continuing with start. Some features may not work correctly."
4845
4932
  );
4846
4933
  }
@@ -4852,24 +4939,24 @@ var start = new Command7().name("start").description("Build and start the Eliza
4852
4939
  const serverModule = await moduleLoader.load("@elizaos/server");
4853
4940
  const { loadCharacterTryPath } = serverModule;
4854
4941
  for (const charPath of options.character) {
4855
- const resolvedPath = path24.resolve(charPath);
4856
- if (!fs10.existsSync(resolvedPath)) {
4857
- logger20.error(`Character file not found: ${resolvedPath}`);
4942
+ const resolvedPath = path25.resolve(charPath);
4943
+ if (!fs11.existsSync(resolvedPath)) {
4944
+ logger21.error(`Character file not found: ${resolvedPath}`);
4858
4945
  throw new Error(`Character file not found: ${resolvedPath}`);
4859
4946
  }
4860
4947
  try {
4861
4948
  const character = await loadCharacterTryPath(resolvedPath);
4862
4949
  if (character) {
4863
4950
  characters.push(character);
4864
- logger20.info(`Successfully loaded character: ${character.name}`);
4951
+ logger21.info(`Successfully loaded character: ${character.name}`);
4865
4952
  } else {
4866
- logger20.error(
4953
+ logger21.error(
4867
4954
  `Failed to load character from ${resolvedPath}: Invalid or empty character file`
4868
4955
  );
4869
4956
  throw new Error(`Invalid character file: ${resolvedPath}`);
4870
4957
  }
4871
4958
  } catch (e) {
4872
- logger20.error(`Failed to load character from ${resolvedPath}:`, e);
4959
+ logger21.error(`Failed to load character from ${resolvedPath}:`, e);
4873
4960
  throw new Error(`Invalid character file: ${resolvedPath}`);
4874
4961
  }
4875
4962
  }
@@ -4878,20 +4965,20 @@ var start = new Command7().name("start").description("Build and start the Eliza
4878
4965
  const cwd2 = process.cwd();
4879
4966
  const dirInfo2 = detectDirectoryType(cwd2);
4880
4967
  if (dirInfo2.hasPackageJson && dirInfo2.type !== "non-elizaos-dir") {
4881
- logger20.info("No character files specified, attempting to load project agents...");
4968
+ logger21.info("No character files specified, attempting to load project agents...");
4882
4969
  const project = await loadProject(cwd2);
4883
4970
  if (project.agents && project.agents.length > 0) {
4884
- logger20.info(`Found ${project.agents.length} agent(s) in project configuration`);
4971
+ logger21.info(`Found ${project.agents.length} agent(s) in project configuration`);
4885
4972
  projectAgents = project.agents;
4886
4973
  for (const agent2 of project.agents) {
4887
4974
  if (agent2.character) {
4888
- logger20.info(`Loaded character: ${agent2.character.name}`);
4975
+ logger21.info(`Loaded character: ${agent2.character.name}`);
4889
4976
  }
4890
4977
  }
4891
4978
  }
4892
4979
  }
4893
4980
  } catch (e) {
4894
- logger20.debug("Failed to load project agents, will use default character:", e);
4981
+ logger21.debug("Failed to load project agents, will use default character:", e);
4895
4982
  }
4896
4983
  }
4897
4984
  await startAgents({ ...options, characters, projectAgents });
@@ -4970,18 +5057,18 @@ ${emoji.error("Error: Failed to run Phala CLI")}`);
4970
5057
  var teeCommand = new Command9("tee").description("Manage TEE deployments").addCommand(phalaCliCommand);
4971
5058
 
4972
5059
  // src/commands/test/index.ts
4973
- import { logger as logger27 } from "@elizaos/core";
5060
+ import { logger as logger28 } from "@elizaos/core";
4974
5061
  import { Command as Command10, Option as Option2 } from "commander";
4975
5062
 
4976
5063
  // src/commands/test/actions/run-all-tests.ts
4977
- import { logger as logger25 } from "@elizaos/core";
5064
+ import { logger as logger26 } from "@elizaos/core";
4978
5065
 
4979
5066
  // src/commands/test/utils/project-utils.ts
4980
- import { logger as logger21 } from "@elizaos/core";
4981
- import * as fs11 from "fs";
4982
- import path25 from "path";
5067
+ import { logger as logger22 } from "@elizaos/core";
5068
+ import * as fs12 from "fs";
5069
+ import path26 from "path";
4983
5070
  function getProjectType(testPath) {
4984
- const targetPath = testPath ? path25.resolve(process.cwd(), testPath) : process.cwd();
5071
+ const targetPath = testPath ? path26.resolve(process.cwd(), testPath) : process.cwd();
4985
5072
  return detectDirectoryType(targetPath);
4986
5073
  }
4987
5074
  function processFilterName(name) {
@@ -5000,29 +5087,29 @@ async function installPluginDependencies(projectInfo) {
5000
5087
  }
5001
5088
  const project = await loadProject(process.cwd());
5002
5089
  if (project.isPlugin && project.pluginModule?.dependencies && project.pluginModule.dependencies.length > 0) {
5003
- const pluginsDir = path25.join(process.cwd(), ".eliza", "plugins");
5004
- if (!fs11.existsSync(pluginsDir)) {
5005
- await fs11.promises.mkdir(pluginsDir, { recursive: true });
5090
+ const pluginsDir = path26.join(process.cwd(), ".eliza", "plugins");
5091
+ if (!fs12.existsSync(pluginsDir)) {
5092
+ await fs12.promises.mkdir(pluginsDir, { recursive: true });
5006
5093
  }
5007
- const packageJsonPath = path25.join(pluginsDir, "package.json");
5008
- if (!fs11.existsSync(packageJsonPath)) {
5094
+ const packageJsonPath = path26.join(pluginsDir, "package.json");
5095
+ if (!fs12.existsSync(packageJsonPath)) {
5009
5096
  const packageJsonContent = {
5010
5097
  name: "test-plugin-dependencies",
5011
5098
  version: "1.0.0",
5012
5099
  description: "A temporary package for installing test plugin dependencies",
5013
5100
  dependencies: {}
5014
5101
  };
5015
- await fs11.promises.writeFile(packageJsonPath, JSON.stringify(packageJsonContent, null, 2));
5102
+ await fs12.promises.writeFile(packageJsonPath, JSON.stringify(packageJsonContent, null, 2));
5016
5103
  }
5017
- const { installPlugin: installPlugin2 } = await import("./utils-H66532NB.js");
5104
+ const { installPlugin: installPlugin2 } = await import("./utils-DBLSDYBF.js");
5018
5105
  for (const dependency of project.pluginModule.dependencies) {
5019
5106
  await installPlugin2(dependency, pluginsDir);
5020
- const dependencyPath = path25.join(pluginsDir, "node_modules", dependency);
5021
- if (fs11.existsSync(dependencyPath)) {
5107
+ const dependencyPath = path26.join(pluginsDir, "node_modules", dependency);
5108
+ if (fs12.existsSync(dependencyPath)) {
5022
5109
  try {
5023
5110
  await runBunCommand(["install"], dependencyPath);
5024
5111
  } catch (error) {
5025
- logger21.warn(
5112
+ logger22.warn(
5026
5113
  `[Test Command] Failed to install devDependencies for ${dependency}: ${error}`
5027
5114
  );
5028
5115
  }
@@ -5032,17 +5119,17 @@ async function installPluginDependencies(projectInfo) {
5032
5119
  }
5033
5120
 
5034
5121
  // src/commands/test/actions/component-tests.ts
5035
- import { logger as logger23 } from "@elizaos/core";
5122
+ import { logger as logger24 } from "@elizaos/core";
5036
5123
  import { spawn as spawn2 } from "child_process";
5037
- import path27 from "path";
5124
+ import path28 from "path";
5038
5125
 
5039
5126
  // src/utils/testing/tsc-validator.ts
5040
- import { logger as logger22 } from "@elizaos/core";
5041
- import path26 from "path";
5042
- import { existsSync as existsSync17 } from "fs";
5127
+ import { logger as logger23 } from "@elizaos/core";
5128
+ import path27 from "path";
5129
+ import { existsSync as existsSync18 } from "fs";
5043
5130
  async function runTypeCheck(projectPath, strict = true) {
5044
- const tsconfigPath = path26.join(projectPath, "tsconfig.json");
5045
- if (!existsSync17(tsconfigPath)) {
5131
+ const tsconfigPath = path27.join(projectPath, "tsconfig.json");
5132
+ if (!existsSync18(tsconfigPath)) {
5046
5133
  return {
5047
5134
  success: false,
5048
5135
  errors: [`No tsconfig.json found at ${tsconfigPath}`],
@@ -5054,7 +5141,7 @@ async function runTypeCheck(projectPath, strict = true) {
5054
5141
  if (strict) {
5055
5142
  args.push("--strict");
5056
5143
  }
5057
- const result = await bunExec("tsc", args, {
5144
+ const result = await bunExec("bun", ["x", "tsc", ...args], {
5058
5145
  cwd: projectPath
5059
5146
  });
5060
5147
  const { stdout, stderr } = result;
@@ -5065,7 +5152,7 @@ async function runTypeCheck(projectPath, strict = true) {
5065
5152
  warnings: stderr.includes("warning") ? [stderr] : []
5066
5153
  };
5067
5154
  } catch (error) {
5068
- logger22.error("TypeScript validation failed:", error);
5155
+ logger23.error("TypeScript validation failed:", error);
5069
5156
  return {
5070
5157
  success: false,
5071
5158
  errors: [`TypeScript validation error: ${error.message}`],
@@ -5079,39 +5166,39 @@ async function runComponentTests(testPath, options, projectInfo) {
5079
5166
  const cwd = process.cwd();
5080
5167
  const isPlugin2 = projectInfo.type === "elizaos-plugin";
5081
5168
  if (!options.skipTypeCheck) {
5082
- logger23.info("Running TypeScript validation...");
5169
+ logger24.info("Running TypeScript validation...");
5083
5170
  const typeCheckResult = await runTypeCheck(cwd, true);
5084
5171
  if (!typeCheckResult.success) {
5085
- logger23.error("TypeScript validation failed:");
5086
- typeCheckResult.errors.forEach((error) => logger23.error(error));
5172
+ logger24.error("TypeScript validation failed:");
5173
+ typeCheckResult.errors.forEach((error) => logger24.error(error));
5087
5174
  return { failed: true };
5088
5175
  }
5089
- logger23.success("TypeScript validation passed");
5176
+ logger24.success("TypeScript validation passed");
5090
5177
  }
5091
5178
  if (!options.skipBuild) {
5092
5179
  try {
5093
- logger23.info(`Building ${isPlugin2 ? "plugin" : "project"}...`);
5180
+ logger24.info(`Building ${isPlugin2 ? "plugin" : "project"}...`);
5094
5181
  await buildProject(cwd, isPlugin2);
5095
- logger23.success(`Build completed successfully`);
5182
+ logger24.success(`Build completed successfully`);
5096
5183
  } catch (buildError) {
5097
- logger23.error(`Build failed: ${buildError}`);
5184
+ logger24.error(`Build failed: ${buildError}`);
5098
5185
  return { failed: true };
5099
5186
  }
5100
5187
  }
5101
- logger23.info("Running component tests...");
5188
+ logger24.info("Running component tests...");
5102
5189
  return new Promise((resolve2) => {
5103
5190
  const args = ["test", "--passWithNoTests"];
5104
5191
  if (options.name) {
5105
5192
  const baseName = processFilterName(options.name);
5106
5193
  if (baseName) {
5107
- logger23.info(`Using test filter: ${baseName}`);
5194
+ logger24.info(`Using test filter: ${baseName}`);
5108
5195
  args.push("-t", baseName);
5109
5196
  }
5110
5197
  }
5111
5198
  const monorepoRoot = UserEnvironment.getInstance().findMonorepoRoot(process.cwd());
5112
5199
  const baseDir = monorepoRoot ?? process.cwd();
5113
- const targetPath = testPath ? path27.resolve(baseDir, testPath) : process.cwd();
5114
- logger23.info(`Executing: bun ${args.join(" ")} in ${targetPath}`);
5200
+ const targetPath = testPath ? path28.resolve(baseDir, testPath) : process.cwd();
5201
+ logger24.info(`Executing: bun ${args.join(" ")} in ${targetPath}`);
5115
5202
  const child = spawn2("bun", args, {
5116
5203
  stdio: "inherit",
5117
5204
  shell: false,
@@ -5120,37 +5207,37 @@ async function runComponentTests(testPath, options, projectInfo) {
5120
5207
  ...process.env,
5121
5208
  FORCE_COLOR: "1",
5122
5209
  // Force color output
5123
- CI: "false"
5124
- // Ensure we're not in CI mode which might buffer
5210
+ CI: ""
5211
+ // Override CI to empty string (some tools check existence, but most check truthiness)
5125
5212
  }
5126
5213
  });
5127
5214
  child.on("close", (code) => {
5128
- logger23.info("Component tests completed");
5215
+ logger24.info("Component tests completed");
5129
5216
  resolve2({ failed: code !== 0 });
5130
5217
  });
5131
5218
  child.on("error", (error) => {
5132
- logger23.error("Error running component tests:", error);
5219
+ logger24.error("Error running component tests:", error);
5133
5220
  resolve2({ failed: true });
5134
5221
  });
5135
5222
  });
5136
5223
  }
5137
5224
 
5138
5225
  // src/commands/test/actions/e2e-tests.ts
5139
- import { logger as logger24 } from "@elizaos/core";
5226
+ import { logger as logger25 } from "@elizaos/core";
5140
5227
  import * as dotenv2 from "dotenv";
5141
- import * as fs12 from "fs";
5142
- import path28 from "path";
5228
+ import * as fs13 from "fs";
5229
+ import path29 from "path";
5143
5230
  async function runE2eTests(testPath, options, projectInfo) {
5144
5231
  if (!options.skipBuild) {
5145
5232
  try {
5146
5233
  const cwd = process.cwd();
5147
5234
  const isPlugin2 = projectInfo.type === "elizaos-plugin";
5148
- logger24.info(`Building ${isPlugin2 ? "plugin" : "project"}...`);
5235
+ logger25.info(`Building ${isPlugin2 ? "plugin" : "project"}...`);
5149
5236
  await buildProject(cwd, isPlugin2);
5150
- logger24.info(`Build completed successfully`);
5237
+ logger25.info(`Build completed successfully`);
5151
5238
  } catch (buildError) {
5152
- logger24.error(`Build error: ${buildError}`);
5153
- logger24.warn(`Attempting to continue with tests despite build error`);
5239
+ logger25.error(`Build error: ${buildError}`);
5240
+ logger25.warn(`Attempting to continue with tests despite build error`);
5154
5241
  }
5155
5242
  }
5156
5243
  let server;
@@ -5160,10 +5247,10 @@ async function runE2eTests(testPath, options, projectInfo) {
5160
5247
  const moduleLoader = getModuleLoader();
5161
5248
  const serverModule = await moduleLoader.load("@elizaos/server");
5162
5249
  const { AgentServer, jsonToCharacter, loadCharacterTryPath } = serverModule;
5163
- const elizaDir = path28.join(process.cwd(), ".eliza");
5164
- const packageName = path28.basename(process.cwd());
5250
+ const elizaDir = path29.join(process.cwd(), ".eliza");
5251
+ const packageName = path29.basename(process.cwd());
5165
5252
  const timestamp = Date.now();
5166
- const uniqueDbDir = path28.join(process.cwd(), ".elizadb-test", `${packageName}-${timestamp}`);
5253
+ const uniqueDbDir = path29.join(process.cwd(), ".elizadb-test", `${packageName}-${timestamp}`);
5167
5254
  const elizaDbDir = uniqueDbDir;
5168
5255
  const envInfo = await UserEnvironment.getInstanceInfo();
5169
5256
  const envFilePath = envInfo.paths.envFilePath;
@@ -5172,88 +5259,88 @@ async function runE2eTests(testPath, options, projectInfo) {
5172
5259
  console.info(`Database directory: ${elizaDbDir}`);
5173
5260
  console.info(`Environment file: ${envFilePath}`);
5174
5261
  console.info(`Package name: ${packageName}, Timestamp: ${timestamp}`);
5175
- if (fs12.existsSync(elizaDbDir)) {
5262
+ if (fs13.existsSync(elizaDbDir)) {
5176
5263
  console.info(`Cleaning up existing database directory: ${elizaDbDir}`);
5177
5264
  try {
5178
- fs12.rmSync(elizaDbDir, { recursive: true, force: true });
5265
+ fs13.rmSync(elizaDbDir, { recursive: true, force: true });
5179
5266
  console.info(`Successfully cleaned up existing database directory`);
5180
5267
  } catch (error) {
5181
5268
  console.warn(`Failed to clean up existing database directory: ${error}`);
5182
5269
  }
5183
5270
  }
5184
5271
  console.info(`Creating fresh database directory: ${elizaDbDir}`);
5185
- fs12.mkdirSync(elizaDbDir, { recursive: true });
5272
+ fs13.mkdirSync(elizaDbDir, { recursive: true });
5186
5273
  console.info(`Created database directory: ${elizaDbDir}`);
5187
5274
  process.env.PGLITE_DATA_DIR = elizaDbDir;
5188
5275
  console.info(`Set PGLITE_DATA_DIR to: ${elizaDbDir}`);
5189
- if (fs12.existsSync(envFilePath)) {
5190
- logger24.info(`Loading environment variables from: ${envFilePath}`);
5276
+ if (fs13.existsSync(envFilePath)) {
5277
+ logger25.info(`Loading environment variables from: ${envFilePath}`);
5191
5278
  dotenv2.config({ path: envFilePath });
5192
- logger24.info("Environment variables loaded");
5279
+ logger25.info("Environment variables loaded");
5193
5280
  } else {
5194
- logger24.warn(`Environment file not found: ${envFilePath}`);
5281
+ logger25.warn(`Environment file not found: ${envFilePath}`);
5195
5282
  }
5196
5283
  const postgresUrl = process.env.POSTGRES_URL;
5197
- logger24.info(
5284
+ logger25.info(
5198
5285
  `PostgreSQL URL for e2e tests: ${postgresUrl ? "found" : "not found (will use PGlite)"}`
5199
5286
  );
5200
- logger24.info("Creating server instance...");
5287
+ logger25.info("Creating server instance...");
5201
5288
  server = new AgentServer();
5202
- logger24.info("Server instance created");
5203
- logger24.info("Initializing server...");
5289
+ logger25.info("Server instance created");
5290
+ logger25.info("Initializing server...");
5204
5291
  try {
5205
5292
  await server.initialize({
5206
5293
  dataDir: elizaDbDir,
5207
5294
  postgresUrl
5208
5295
  });
5209
- logger24.info("Server initialized successfully");
5296
+ logger25.info("Server initialized successfully");
5210
5297
  } catch (initError) {
5211
- logger24.error("Server initialization failed:", initError);
5298
+ logger25.error("Server initialization failed:", initError);
5212
5299
  throw initError;
5213
5300
  }
5214
5301
  let project;
5215
5302
  try {
5216
- logger24.info("Attempting to load project or plugin...");
5303
+ logger25.info("Attempting to load project or plugin...");
5217
5304
  const monorepoRoot = UserEnvironment.getInstance().findMonorepoRoot(process.cwd());
5218
5305
  const baseDir = monorepoRoot ?? process.cwd();
5219
- const targetPath = testPath ? path28.resolve(baseDir, testPath) : process.cwd();
5306
+ const targetPath = testPath ? path29.resolve(baseDir, testPath) : process.cwd();
5220
5307
  project = await loadProject(targetPath);
5221
5308
  if (!project || !project.agents || project.agents.length === 0) {
5222
5309
  throw new Error("No agents found in project configuration");
5223
5310
  }
5224
- logger24.info(`Found ${project.agents.length} agents`);
5225
- logger24.info("Setting up server properties...");
5311
+ logger25.info(`Found ${project.agents.length} agents`);
5312
+ logger25.info("Setting up server properties...");
5226
5313
  server.startAgent = async (character) => {
5227
- logger24.info(`Starting agent for character ${character.name}`);
5314
+ logger25.info(`Starting agent for character ${character.name}`);
5228
5315
  return startAgent(character, server, void 0, [], { isTestMode: true });
5229
5316
  };
5230
5317
  server.loadCharacterTryPath = loadCharacterTryPath;
5231
5318
  server.jsonToCharacter = jsonToCharacter;
5232
- logger24.info("Server properties set up");
5319
+ logger25.info("Server properties set up");
5233
5320
  const desiredPort = options.port || Number.parseInt(process.env.SERVER_PORT || "3000");
5234
5321
  const serverPort = await findNextAvailablePort(desiredPort);
5235
5322
  if (serverPort !== desiredPort) {
5236
- logger24.warn(`Port ${desiredPort} is in use for testing, using port ${serverPort} instead.`);
5323
+ logger25.warn(`Port ${desiredPort} is in use for testing, using port ${serverPort} instead.`);
5237
5324
  }
5238
- logger24.info("Starting server...");
5325
+ logger25.info("Starting server...");
5239
5326
  try {
5240
5327
  await server.start(serverPort);
5241
- logger24.info("Server started successfully on port", serverPort);
5328
+ logger25.info("Server started successfully on port", serverPort);
5242
5329
  } catch (error) {
5243
- logger24.error("Error starting server:", error);
5330
+ logger25.error("Error starting server:", error);
5244
5331
  if (error instanceof Error) {
5245
- logger24.error("Error details:", error.message);
5246
- logger24.error("Stack trace:", error.stack);
5332
+ logger25.error("Error details:", error.message);
5333
+ logger25.error("Stack trace:", error.stack);
5247
5334
  }
5248
5335
  throw error;
5249
5336
  }
5250
5337
  try {
5251
- logger24.info(
5338
+ logger25.info(
5252
5339
  `Found ${project.agents.length} agents in ${project.isPlugin ? "plugin" : "project"}`
5253
5340
  );
5254
5341
  if (project.isPlugin || project.agents.length === 0) {
5255
5342
  process.env.ELIZA_TESTING_PLUGIN = "true";
5256
- logger24.info("Using default Eliza character as test agent");
5343
+ logger25.info("Using default Eliza character as test agent");
5257
5344
  try {
5258
5345
  const pluginUnderTest = project.pluginModule;
5259
5346
  if (!pluginUnderTest) {
@@ -5276,16 +5363,16 @@ async function runE2eTests(testPath, options, projectInfo) {
5276
5363
  plugins: runtime.plugins
5277
5364
  // Pass all plugins, not just the one under test
5278
5365
  });
5279
- logger24.info("Default test agent started successfully");
5366
+ logger25.info("Default test agent started successfully");
5280
5367
  } catch (pluginError) {
5281
- logger24.error(`Error starting plugin test agent: ${pluginError}`);
5368
+ logger25.error(`Error starting plugin test agent: ${pluginError}`);
5282
5369
  throw pluginError;
5283
5370
  }
5284
5371
  } else {
5285
5372
  for (const agent2 of project.agents) {
5286
5373
  try {
5287
5374
  const originalCharacter = { ...agent2.character };
5288
- logger24.debug(`Starting agent: ${originalCharacter.name}`);
5375
+ logger25.debug(`Starting agent: ${originalCharacter.name}`);
5289
5376
  const runtime = await startAgent(
5290
5377
  originalCharacter,
5291
5378
  server,
@@ -5298,28 +5385,28 @@ async function runE2eTests(testPath, options, projectInfo) {
5298
5385
  projectAgents.push(agent2);
5299
5386
  await new Promise((resolve2) => setTimeout(resolve2, 1e3));
5300
5387
  } catch (agentError) {
5301
- logger24.error(`Error starting agent ${agent2.character.name}:`, agentError);
5388
+ logger25.error(`Error starting agent ${agent2.character.name}:`, agentError);
5302
5389
  if (agentError instanceof Error) {
5303
- logger24.error("Error details:", agentError.message);
5304
- logger24.error("Stack trace:", agentError.stack);
5390
+ logger25.error("Error details:", agentError.message);
5391
+ logger25.error("Stack trace:", agentError.stack);
5305
5392
  }
5306
- logger24.warn(`Skipping agent ${agent2.character.name} due to startup error`);
5393
+ logger25.warn(`Skipping agent ${agent2.character.name} due to startup error`);
5307
5394
  }
5308
5395
  }
5309
5396
  }
5310
5397
  if (runtimes.length === 0) {
5311
5398
  throw new Error("Failed to start any agents from project");
5312
5399
  }
5313
- logger24.debug(`Successfully started ${runtimes.length} agents for testing`);
5400
+ logger25.debug(`Successfully started ${runtimes.length} agents for testing`);
5314
5401
  let totalFailed = 0;
5315
5402
  let anyTestsFound = false;
5316
5403
  for (let i = 0; i < runtimes.length; i++) {
5317
5404
  const runtime = runtimes[i];
5318
5405
  const projectAgent = projectAgents[i];
5319
5406
  if (project.isPlugin) {
5320
- logger24.debug(`Running tests for plugin: ${project.pluginModule?.name}`);
5407
+ logger25.debug(`Running tests for plugin: ${project.pluginModule?.name}`);
5321
5408
  } else {
5322
- logger24.debug(`Running tests for agent: ${runtime.character.name}`);
5409
+ logger25.debug(`Running tests for agent: ${runtime.character.name}`);
5323
5410
  }
5324
5411
  const testRunner = new TestRunner(runtime, projectAgent);
5325
5412
  const currentDirInfo = projectInfo;
@@ -5340,17 +5427,17 @@ async function runE2eTests(testPath, options, projectInfo) {
5340
5427
  }
5341
5428
  return { failed: anyTestsFound ? totalFailed > 0 : false };
5342
5429
  } catch (error) {
5343
- logger24.error("Error in runE2eTests:", error);
5430
+ logger25.error("Error in runE2eTests:", error);
5344
5431
  if (error instanceof Error) {
5345
- logger24.error("Error details:", error.message);
5346
- logger24.error("Stack trace:", error.stack);
5432
+ logger25.error("Error details:", error.message);
5433
+ logger25.error("Stack trace:", error.stack);
5347
5434
  } else {
5348
- logger24.error("Unknown error type:", typeof error);
5349
- logger24.error("Error value:", error);
5435
+ logger25.error("Unknown error type:", typeof error);
5436
+ logger25.error("Error value:", error);
5350
5437
  try {
5351
- logger24.error("Stringified error:", JSON.stringify(error, null, 2));
5438
+ logger25.error("Stringified error:", JSON.stringify(error, null, 2));
5352
5439
  } catch (e) {
5353
- logger24.error("Could not stringify error:", e);
5440
+ logger25.error("Could not stringify error:", e);
5354
5441
  }
5355
5442
  }
5356
5443
  return { failed: true };
@@ -5359,47 +5446,47 @@ async function runE2eTests(testPath, options, projectInfo) {
5359
5446
  delete process.env.ELIZA_TESTING_PLUGIN;
5360
5447
  }
5361
5448
  try {
5362
- if (fs12.existsSync(elizaDbDir)) {
5449
+ if (fs13.existsSync(elizaDbDir)) {
5363
5450
  console.info(`Cleaning up test database directory: ${elizaDbDir}`);
5364
- fs12.rmSync(elizaDbDir, { recursive: true, force: true });
5451
+ fs13.rmSync(elizaDbDir, { recursive: true, force: true });
5365
5452
  console.info(`Successfully cleaned up test database directory`);
5366
5453
  }
5367
- const testDir = path28.dirname(elizaDbDir);
5368
- if (fs12.existsSync(testDir) && fs12.readdirSync(testDir).length === 0) {
5369
- fs12.rmSync(testDir, { recursive: true, force: true });
5454
+ const testDir = path29.dirname(elizaDbDir);
5455
+ if (fs13.existsSync(testDir) && fs13.readdirSync(testDir).length === 0) {
5456
+ fs13.rmSync(testDir, { recursive: true, force: true });
5370
5457
  }
5371
5458
  } catch (cleanupError) {
5372
5459
  console.warn(`Failed to clean up test database directory: ${cleanupError}`);
5373
5460
  }
5374
5461
  }
5375
5462
  } catch (error) {
5376
- logger24.error("Error in runE2eTests:", error);
5463
+ logger25.error("Error in runE2eTests:", error);
5377
5464
  if (error instanceof Error) {
5378
- logger24.error("Error details:", error.message);
5379
- logger24.error("Stack trace:", error.stack);
5465
+ logger25.error("Error details:", error.message);
5466
+ logger25.error("Stack trace:", error.stack);
5380
5467
  } else {
5381
- logger24.error("Unknown error type:", typeof error);
5382
- logger24.error("Error value:", error);
5468
+ logger25.error("Unknown error type:", typeof error);
5469
+ logger25.error("Error value:", error);
5383
5470
  try {
5384
- logger24.error("Stringified error:", JSON.stringify(error, null, 2));
5471
+ logger25.error("Stringified error:", JSON.stringify(error, null, 2));
5385
5472
  } catch (e) {
5386
- logger24.error("Could not stringify error:", e);
5473
+ logger25.error("Could not stringify error:", e);
5387
5474
  }
5388
5475
  }
5389
5476
  return { failed: true };
5390
5477
  }
5391
5478
  } catch (error) {
5392
- logger24.error("Error in runE2eTests:", error);
5479
+ logger25.error("Error in runE2eTests:", error);
5393
5480
  if (error instanceof Error) {
5394
- logger24.error("Error details:", error.message);
5395
- logger24.error("Stack trace:", error.stack);
5481
+ logger25.error("Error details:", error.message);
5482
+ logger25.error("Stack trace:", error.stack);
5396
5483
  } else {
5397
- logger24.error("Unknown error type:", typeof error);
5398
- logger24.error("Error value:", error);
5484
+ logger25.error("Unknown error type:", typeof error);
5485
+ logger25.error("Error value:", error);
5399
5486
  try {
5400
- logger24.error("Stringified error:", JSON.stringify(error, null, 2));
5487
+ logger25.error("Stringified error:", JSON.stringify(error, null, 2));
5401
5488
  } catch (e) {
5402
- logger24.error("Could not stringify error:", e);
5489
+ logger25.error("Could not stringify error:", e);
5403
5490
  }
5404
5491
  }
5405
5492
  return { failed: true };
@@ -5412,15 +5499,15 @@ async function runAllTests(testPath, options) {
5412
5499
  if (!options.skipBuild) {
5413
5500
  const componentResult = await runComponentTests(testPath, options, projectInfo);
5414
5501
  if (componentResult.failed) {
5415
- logger25.error("Component tests failed. Continuing to e2e tests...");
5502
+ logger26.error("Component tests failed. Continuing to e2e tests...");
5416
5503
  }
5417
5504
  }
5418
5505
  const e2eResult = await runE2eTests(testPath, options, projectInfo);
5419
5506
  if (e2eResult.failed) {
5420
- logger25.error("E2E tests failed.");
5507
+ logger26.error("E2E tests failed.");
5421
5508
  process.exit(1);
5422
5509
  }
5423
- logger25.success("All tests passed successfully!");
5510
+ logger26.success("All tests passed successfully!");
5424
5511
  process.exit(0);
5425
5512
  }
5426
5513
 
@@ -5428,43 +5515,47 @@ async function runAllTests(testPath, options) {
5428
5515
  import * as net from "net";
5429
5516
 
5430
5517
  // src/commands/test/utils/plugin-utils.ts
5431
- import { logger as logger26 } from "@elizaos/core";
5432
- import * as fs13 from "fs";
5433
- import path29 from "path";
5518
+ import { logger as logger27 } from "@elizaos/core";
5519
+ import * as fs14 from "fs";
5520
+ import path30 from "path";
5434
5521
 
5435
5522
  // src/commands/test/index.ts
5436
5523
  var test = new Command10().name("test").description("Run tests for the current project or a specified plugin").argument("[path]", "Optional path to the project or plugin to test").addOption(
5437
5524
  new Option2("-t, --type <type>", "the type of test to run").choices(["component", "e2e", "all"]).default("all")
5438
5525
  ).option("--port <port>", "The port to run e2e tests on", validatePort).option("--name <name>", "Filter tests by name").option("--skip-build", "Skip building before running tests").option("--skip-type-check", "Skip TypeScript validation before running tests").hook("preAction", async (thisCommand) => {
5439
5526
  const testPath = thisCommand.args[0];
5527
+ const options = thisCommand.opts();
5528
+ if (options.type === "component") {
5529
+ return;
5530
+ }
5440
5531
  const projectInfo = getProjectType(testPath);
5441
5532
  await installPluginDependencies(projectInfo);
5442
5533
  }).action(async (testPath, options) => {
5443
- logger27.info("Starting tests...");
5534
+ logger28.info("Starting tests...");
5444
5535
  try {
5445
5536
  const projectInfo = getProjectType(testPath);
5446
5537
  switch (options.type) {
5447
5538
  case "component":
5448
- logger27.info("Running component tests only...");
5539
+ logger28.info("Running component tests only...");
5449
5540
  const componentResult = await runComponentTests(testPath, options, projectInfo);
5450
5541
  if (componentResult.failed) {
5451
- logger27.error("Component tests failed.");
5542
+ logger28.error("Component tests failed.");
5452
5543
  process.exit(1);
5453
5544
  }
5454
- logger27.success("Component tests passed successfully!");
5545
+ logger28.success("Component tests passed successfully!");
5455
5546
  break;
5456
5547
  case "e2e":
5457
- logger27.info("Running e2e tests only...");
5548
+ logger28.info("Running e2e tests only...");
5458
5549
  const e2eResult = await runE2eTests(testPath, options, projectInfo);
5459
5550
  if (e2eResult.failed) {
5460
- logger27.error("E2E tests failed.");
5551
+ logger28.error("E2E tests failed.");
5461
5552
  process.exit(1);
5462
5553
  }
5463
- logger27.success("E2E tests passed successfully!");
5554
+ logger28.success("E2E tests passed successfully!");
5464
5555
  break;
5465
5556
  case "all":
5466
5557
  default:
5467
- logger27.info("Running all tests...");
5558
+ logger28.info("Running all tests...");
5468
5559
  await runAllTests(testPath, options);
5469
5560
  break;
5470
5561
  }
@@ -5475,7 +5566,7 @@ var test = new Command10().name("test").description("Run tests for the current p
5475
5566
  });
5476
5567
 
5477
5568
  // src/index.ts
5478
- import { logger as logger28 } from "@elizaos/core";
5569
+ import { logger as logger29 } from "@elizaos/core";
5479
5570
  import { Command as Command11 } from "commander";
5480
5571
  process.env.NODE_OPTIONS = "--no-deprecation";
5481
5572
  process.env.NODE_NO_WARNINGS = "1";
@@ -5496,19 +5587,19 @@ var shutdownState = {
5496
5587
  };
5497
5588
  async function gracefulShutdown(signal) {
5498
5589
  if (!shutdownState.tryInitiateShutdown()) {
5499
- logger28.debug(`Ignoring ${signal} - shutdown already in progress`);
5590
+ logger29.debug(`Ignoring ${signal} - shutdown already in progress`);
5500
5591
  return;
5501
5592
  }
5502
- logger28.info(`Received ${signal}, shutting down gracefully...`);
5593
+ logger29.info(`Received ${signal}, shutting down gracefully...`);
5503
5594
  try {
5504
5595
  const serverWasStopped = await stopServer();
5505
5596
  if (serverWasStopped) {
5506
- logger28.info("Server stopped successfully");
5597
+ logger29.info("Server stopped successfully");
5507
5598
  }
5508
5599
  } catch (error) {
5509
5600
  const errorMessage = error instanceof Error ? error.message : String(error);
5510
- logger28.error(`Error stopping server: ${errorMessage}`);
5511
- logger28.debug("Full error details:", error);
5601
+ logger29.error(`Error stopping server: ${errorMessage}`);
5602
+ logger29.debug("Full error details:", error);
5512
5603
  }
5513
5604
  const exitCode = signal === "SIGINT" ? 130 : signal === "SIGTERM" ? 143 : 0;
5514
5605
  process.exit(exitCode);
@@ -5542,6 +5633,6 @@ async function main() {
5542
5633
  await program.parseAsync();
5543
5634
  }
5544
5635
  main().catch((error) => {
5545
- logger28.error("An error occurred:", error);
5636
+ logger29.error("An error occurred:", error);
5546
5637
  process.exit(1);
5547
5638
  });