@elizaos/cli 1.2.4 → 1.2.7

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 (82) hide show
  1. package/dist/bun-exec-KJOLGZOL.js +21 -0
  2. package/dist/{chunk-2XI6N7KN.js → chunk-2ZF5OAMV.js} +322 -69
  3. package/dist/chunk-3YTIOEFK.js +202 -0
  4. package/dist/chunk-AQ6OMR2A.js +14 -0
  5. package/dist/{chunk-JZG5QBNT.js → chunk-E54G6FI7.js} +32 -6
  6. package/dist/{chunk-PSSTO76B.js → chunk-KKAK7OQA.js} +100 -104
  7. package/dist/chunk-Y5IA2UZ2.js +154 -0
  8. package/dist/commands/agent/actions/index.js +4 -3
  9. package/dist/commands/agent/index.js +4 -3
  10. package/dist/commands/create/actions/index.d.ts +6 -2
  11. package/dist/commands/create/actions/index.js +8 -7
  12. package/dist/commands/create/index.js +6 -6
  13. package/dist/commands/shared/index.js +1 -1
  14. package/dist/index.js +323 -258
  15. package/dist/{plugin-creator-5CER524N.js → plugin-creator-Y2NWASXI.js} +16 -15
  16. package/dist/{registry-SN5V2VXR.js → registry-K2OCCRXO.js} +4 -3
  17. package/dist/templates/plugin-quick-starter/README.md +214 -0
  18. package/dist/templates/plugin-quick-starter/bunfig.toml +10 -0
  19. package/dist/templates/plugin-quick-starter/package.json +76 -0
  20. package/dist/templates/plugin-quick-starter/scripts/install-test-deps.js +53 -0
  21. package/dist/templates/plugin-quick-starter/src/__tests__/plugin.test.ts +209 -0
  22. package/dist/templates/plugin-quick-starter/src/__tests__/test-utils.ts +162 -0
  23. package/dist/templates/plugin-quick-starter/src/index.ts +4 -0
  24. package/dist/templates/plugin-quick-starter/src/plugin.ts +272 -0
  25. package/dist/templates/plugin-quick-starter/tsconfig.build.json +11 -0
  26. package/dist/templates/plugin-quick-starter/tsconfig.json +28 -0
  27. package/dist/templates/plugin-quick-starter/tsup.config.ts +20 -0
  28. package/dist/templates/plugin-starter/package.json +2 -2
  29. package/dist/templates/plugin-starter/scripts/install-test-deps.js +7 -3
  30. package/dist/templates/plugin-starter/src/__tests__/build-order.test.ts +51 -0
  31. package/dist/templates/plugin-starter/src/__tests__/vite-config-utils.ts +33 -0
  32. package/dist/templates/plugin-starter/src/plugin.ts +13 -15
  33. package/dist/templates/plugin-starter/tsup.config.ts +1 -1
  34. package/dist/templates/plugin-starter/vite.config.ts +1 -1
  35. package/dist/templates/project-starter/package.json +4 -4
  36. package/dist/templates/project-starter/scripts/install-test-deps.js +7 -3
  37. package/dist/templates/project-starter/src/__tests__/build-order.test.ts +59 -0
  38. package/dist/templates/project-starter/src/__tests__/character-plugin-ordering.test.ts +11 -110
  39. package/dist/templates/project-starter/src/__tests__/vite-config-utils.ts +33 -0
  40. package/dist/templates/project-starter/src/character.ts +14 -17
  41. package/dist/templates/project-starter/tsup.config.ts +1 -1
  42. package/dist/templates/project-tee-starter/package.json +3 -3
  43. package/dist/templates/project-tee-starter/src/character.ts +3 -0
  44. package/dist/{utils-DTW3XU6O.js → utils-QSRUVLAT.js} +4 -3
  45. package/package.json +6 -6
  46. package/templates/plugin-quick-starter/README.md +214 -0
  47. package/templates/plugin-quick-starter/bunfig.toml +10 -0
  48. package/templates/plugin-quick-starter/package.json +76 -0
  49. package/templates/plugin-quick-starter/scripts/install-test-deps.js +53 -0
  50. package/templates/plugin-quick-starter/src/__tests__/plugin.test.ts +209 -0
  51. package/templates/plugin-quick-starter/src/__tests__/test-utils.ts +162 -0
  52. package/templates/plugin-quick-starter/src/index.ts +4 -0
  53. package/templates/plugin-quick-starter/src/plugin.ts +272 -0
  54. package/templates/plugin-quick-starter/tsconfig.build.json +11 -0
  55. package/templates/plugin-quick-starter/tsconfig.json +28 -0
  56. package/templates/plugin-quick-starter/tsup.config.ts +20 -0
  57. package/templates/plugin-starter/package.json +2 -2
  58. package/templates/plugin-starter/scripts/install-test-deps.js +7 -3
  59. package/templates/plugin-starter/src/__tests__/build-order.test.ts +51 -0
  60. package/templates/plugin-starter/src/__tests__/vite-config-utils.ts +33 -0
  61. package/templates/plugin-starter/src/plugin.ts +13 -15
  62. package/templates/plugin-starter/tsup.config.ts +1 -1
  63. package/templates/plugin-starter/vite.config.ts +1 -1
  64. package/templates/project-starter/package.json +4 -4
  65. package/templates/project-starter/scripts/install-test-deps.js +7 -3
  66. package/templates/project-starter/src/__tests__/build-order.test.ts +59 -0
  67. package/templates/project-starter/src/__tests__/character-plugin-ordering.test.ts +11 -110
  68. package/templates/project-starter/src/__tests__/vite-config-utils.ts +33 -0
  69. package/templates/project-starter/src/character.ts +14 -17
  70. package/templates/project-starter/tsup.config.ts +1 -1
  71. package/templates/project-tee-starter/package.json +3 -3
  72. package/templates/project-tee-starter/src/character.ts +3 -0
  73. package/dist/chunk-5DYKNYEY.js +0 -2262
  74. package/dist/chunk-XB5JBFO6.js +0 -41
  75. package/dist/chunk-ZWDXDKSA.js +0 -281
  76. package/dist/setup-UQOWDHFN.js +0 -20
  77. package/dist/templates/plugin-starter/dist/index.js +0 -391
  78. package/dist/templates/plugin-starter/dist/index.js.map +0 -1
  79. package/templates/plugin-starter/dist/.vite/manifest.json +0 -11
  80. package/templates/plugin-starter/dist/index.d.ts +0 -14
  81. package/templates/plugin-starter/dist/index.js +0 -391
  82. package/templates/plugin-starter/dist/index.js.map +0 -1
@@ -0,0 +1,21 @@
1
+
2
+ import { createRequire } from 'module';
3
+ const require = createRequire(import.meta.url);
4
+
5
+ import {
6
+ ProcessExecutionError,
7
+ ProcessTimeoutError,
8
+ bunExec,
9
+ bunExecInherit,
10
+ bunExecSimple,
11
+ commandExists
12
+ } from "./chunk-3YTIOEFK.js";
13
+ import "./chunk-AQ6OMR2A.js";
14
+ export {
15
+ ProcessExecutionError,
16
+ ProcessTimeoutError,
17
+ bunExec,
18
+ bunExecInherit,
19
+ bunExecSimple,
20
+ commandExists
21
+ };
@@ -2,17 +2,24 @@
2
2
  import { createRequire } from 'module';
3
3
  const require = createRequire(import.meta.url);
4
4
 
5
- import {
6
- setupProjectEnvironment
7
- } from "./chunk-ZWDXDKSA.js";
8
5
  import {
9
6
  buildProjectWithSpinner,
10
7
  copyTemplate,
11
8
  createTask,
9
+ ensureElizaDir,
12
10
  getDisplayDirectory,
13
11
  installDependenciesWithSpinner,
14
- runTasks
15
- } from "./chunk-PSSTO76B.js";
12
+ installPluginWithSpinner,
13
+ promptAndStoreAnthropicKey,
14
+ promptAndStoreGoogleKey,
15
+ promptAndStoreOllamaConfig,
16
+ promptAndStoreOllamaEmbeddingConfig,
17
+ promptAndStoreOpenAIKey,
18
+ promptAndStoreOpenRouterKey,
19
+ promptAndStorePostgresUrl,
20
+ runTasks,
21
+ setupPgLite
22
+ } from "./chunk-KKAK7OQA.js";
16
23
 
17
24
  // src/characters/eliza.ts
18
25
  var baseCharacter = {
@@ -199,19 +206,19 @@ function getElizaCharacter() {
199
206
  // Core plugins first
200
207
  "@elizaos/plugin-sql",
201
208
  // Text-only plugins (no embedding support)
202
- ...!!process.env.ANTHROPIC_API_KEY ? ["@elizaos/plugin-anthropic"] : [],
203
- ...!!process.env.OPENROUTER_API_KEY ? ["@elizaos/plugin-openrouter"] : [],
204
- // Embedding-capable plugins last (lowest priority for embedding fallback)
205
- ...!!process.env.OPENAI_API_KEY ? ["@elizaos/plugin-openai"] : [],
206
- ...!!process.env.OLLAMA_API_ENDPOINT ? ["@elizaos/plugin-ollama"] : [],
207
- ...!!process.env.GOOGLE_GENERATIVE_AI_API_KEY ? ["@elizaos/plugin-google-genai"] : [],
208
- ...!process.env.GOOGLE_GENERATIVE_AI_API_KEY && !process.env.OLLAMA_API_ENDPOINT && !process.env.OPENAI_API_KEY ? ["@elizaos/plugin-local-ai"] : [],
209
+ ...process.env.ANTHROPIC_API_KEY?.trim() ? ["@elizaos/plugin-anthropic"] : [],
210
+ ...process.env.OPENROUTER_API_KEY?.trim() ? ["@elizaos/plugin-openrouter"] : [],
211
+ // Embedding-capable plugins (before platform plugins per documented order)
212
+ ...process.env.OPENAI_API_KEY?.trim() ? ["@elizaos/plugin-openai"] : [],
213
+ ...process.env.GOOGLE_GENERATIVE_AI_API_KEY?.trim() ? ["@elizaos/plugin-google-genai"] : [],
209
214
  // Platform plugins
210
- ...process.env.DISCORD_API_TOKEN ? ["@elizaos/plugin-discord"] : [],
211
- ...process.env.TWITTER_API_KEY && process.env.TWITTER_API_SECRET_KEY && process.env.TWITTER_ACCESS_TOKEN && process.env.TWITTER_ACCESS_TOKEN_SECRET ? ["@elizaos/plugin-twitter"] : [],
212
- ...process.env.TELEGRAM_BOT_TOKEN ? ["@elizaos/plugin-telegram"] : [],
215
+ ...process.env.DISCORD_API_TOKEN?.trim() ? ["@elizaos/plugin-discord"] : [],
216
+ ...process.env.TWITTER_API_KEY?.trim() && process.env.TWITTER_API_SECRET_KEY?.trim() && process.env.TWITTER_ACCESS_TOKEN?.trim() && process.env.TWITTER_ACCESS_TOKEN_SECRET?.trim() ? ["@elizaos/plugin-twitter"] : [],
217
+ ...process.env.TELEGRAM_BOT_TOKEN?.trim() ? ["@elizaos/plugin-telegram"] : [],
213
218
  // Bootstrap plugin
214
- ...!process.env.IGNORE_BOOTSTRAP ? ["@elizaos/plugin-bootstrap"] : []
219
+ ...!process.env.IGNORE_BOOTSTRAP ? ["@elizaos/plugin-bootstrap"] : [],
220
+ // Only include Ollama as fallback if no other LLM providers are configured
221
+ ...!process.env.ANTHROPIC_API_KEY?.trim() && !process.env.OPENROUTER_API_KEY?.trim() && !process.env.OPENAI_API_KEY?.trim() && !process.env.GOOGLE_GENERATIVE_AI_API_KEY?.trim() ? ["@elizaos/plugin-ollama"] : []
215
222
  ];
216
223
  return {
217
224
  ...baseCharacter,
@@ -221,7 +228,7 @@ function getElizaCharacter() {
221
228
 
222
229
  // src/commands/create/actions/creators.ts
223
230
  import { join } from "path";
224
- import fs2 from "fs/promises";
231
+ import fs3 from "fs/promises";
225
232
  import * as clack2 from "@clack/prompts";
226
233
  import colors from "yoctocolors";
227
234
 
@@ -331,9 +338,9 @@ import * as clack from "@clack/prompts";
331
338
  function getAvailableAIModels() {
332
339
  return [
333
340
  {
334
- title: "Local AI",
341
+ title: "Local AI (Ollama)",
335
342
  value: "local",
336
- description: "Local models, no API required"
343
+ description: "Local models via Ollama, no API required"
337
344
  },
338
345
  {
339
346
  title: "OpenAI",
@@ -350,11 +357,6 @@ function getAvailableAIModels() {
350
357
  value: "openrouter",
351
358
  description: "Access multiple AI models"
352
359
  },
353
- {
354
- title: "Ollama",
355
- value: "ollama",
356
- description: "Self-hosted models"
357
- },
358
360
  {
359
361
  title: "Google Generative AI",
360
362
  value: "google",
@@ -362,6 +364,10 @@ function getAvailableAIModels() {
362
364
  }
363
365
  ];
364
366
  }
367
+ function hasEmbeddingSupport(aiModel) {
368
+ const modelsWithEmbeddings = ["local", "openai", "google"];
369
+ return modelsWithEmbeddings.includes(aiModel);
370
+ }
365
371
  function getAvailableDatabases() {
366
372
  return [
367
373
  {
@@ -413,20 +419,15 @@ async function selectAIModel() {
413
419
  function getAvailableEmbeddingModels() {
414
420
  return [
415
421
  {
416
- title: "Local AI",
422
+ title: "Local AI (Ollama)",
417
423
  value: "local",
418
- description: "Local embeddings, no API required"
424
+ description: "Local embeddings via Ollama, no API required"
419
425
  },
420
426
  {
421
427
  title: "OpenAI",
422
428
  value: "openai",
423
429
  description: "OpenAI text-embedding-ada-002"
424
430
  },
425
- {
426
- title: "Ollama",
427
- value: "ollama",
428
- description: "Self-hosted embedding models"
429
- },
430
431
  {
431
432
  title: "Google Generative AI",
432
433
  value: "google",
@@ -452,12 +453,280 @@ async function selectEmbeddingModel() {
452
453
  return embeddingModel;
453
454
  }
454
455
 
456
+ // src/commands/create/actions/setup.ts
457
+ import { existsSync as existsSync2 } from "fs";
458
+ import fs2 from "fs/promises";
459
+ async function createProjectDirectories(targetDir) {
460
+ await ensureElizaDir(targetDir);
461
+ }
462
+ async function setupAIModelConfig(aiModel, envFilePath, isNonInteractive = false) {
463
+ try {
464
+ switch (aiModel) {
465
+ case "local": {
466
+ if (isNonInteractive) {
467
+ let content = "";
468
+ if (existsSync2(envFilePath)) {
469
+ content = await fs2.readFile(envFilePath, "utf8");
470
+ }
471
+ if (content && !content.endsWith("\n")) {
472
+ content += "\n";
473
+ }
474
+ content += "\n# Local AI Configuration (using Ollama)\n";
475
+ content += "OLLAMA_API_ENDPOINT=http://localhost:11434\n";
476
+ content += "OLLAMA_MODEL=gemma3\n";
477
+ content += "OLLAMA_EMBEDDING_MODEL=nomic-embed-text\n";
478
+ content += "USE_OLLAMA_TEXT_MODELS=true\n";
479
+ content += "# Make sure Ollama is installed and running: https://ollama.ai/\n";
480
+ content += "# Pull models with: ollama pull gemma3 && ollama pull nomic-embed-text\n";
481
+ await fs2.writeFile(envFilePath, content, "utf8");
482
+ } else {
483
+ await promptAndStoreOllamaConfig(envFilePath);
484
+ await promptAndStoreOllamaEmbeddingConfig(envFilePath);
485
+ }
486
+ break;
487
+ }
488
+ case "openai": {
489
+ if (isNonInteractive) {
490
+ let content = "";
491
+ if (existsSync2(envFilePath)) {
492
+ content = await fs2.readFile(envFilePath, "utf8");
493
+ }
494
+ if (content && !content.endsWith("\n")) {
495
+ content += "\n";
496
+ }
497
+ content += "\n# AI Model Configuration\n";
498
+ content += "# OpenAI Configuration\n";
499
+ content += "OPENAI_API_KEY=your_openai_api_key_here\n";
500
+ content += "# Get your API key from: https://platform.openai.com/api-keys\n";
501
+ await fs2.writeFile(envFilePath, content, "utf8");
502
+ } else {
503
+ await promptAndStoreOpenAIKey(envFilePath);
504
+ }
505
+ break;
506
+ }
507
+ case "claude": {
508
+ if (isNonInteractive) {
509
+ let content = "";
510
+ if (existsSync2(envFilePath)) {
511
+ content = await fs2.readFile(envFilePath, "utf8");
512
+ }
513
+ if (content && !content.endsWith("\n")) {
514
+ content += "\n";
515
+ }
516
+ content += "\n# AI Model Configuration\n";
517
+ content += "# Anthropic API Configuration\n";
518
+ content += "ANTHROPIC_API_KEY=your_anthropic_api_key_here\n";
519
+ content += "# Get your API key from: https://console.anthropic.com/\n";
520
+ await fs2.writeFile(envFilePath, content, "utf8");
521
+ } else {
522
+ await promptAndStoreAnthropicKey(envFilePath);
523
+ }
524
+ break;
525
+ }
526
+ case "openrouter": {
527
+ if (isNonInteractive) {
528
+ let content = "";
529
+ if (existsSync2(envFilePath)) {
530
+ content = await fs2.readFile(envFilePath, "utf8");
531
+ }
532
+ if (content && !content.endsWith("\n")) {
533
+ content += "\n";
534
+ }
535
+ content += "\n# AI Model Configuration\n";
536
+ content += "# OpenRouter Configuration\n";
537
+ content += "OPENROUTER_API_KEY=your_openrouter_api_key_here\n";
538
+ content += "# Get your API key from: https://openrouter.ai/keys\n";
539
+ await fs2.writeFile(envFilePath, content, "utf8");
540
+ } else {
541
+ await promptAndStoreOpenRouterKey(envFilePath);
542
+ }
543
+ break;
544
+ }
545
+ case "google": {
546
+ if (isNonInteractive) {
547
+ let content = "";
548
+ if (existsSync2(envFilePath)) {
549
+ content = await fs2.readFile(envFilePath, "utf8");
550
+ }
551
+ if (content && !content.endsWith("\n")) {
552
+ content += "\n";
553
+ }
554
+ content += "\n# AI Model Configuration\n";
555
+ content += "# Google Generative AI Configuration\n";
556
+ content += "GOOGLE_GENERATIVE_AI_API_KEY=your_google_api_key_here\n";
557
+ content += "# Get your API key from: https://aistudio.google.com/apikey\n";
558
+ await fs2.writeFile(envFilePath, content, "utf8");
559
+ } else {
560
+ await promptAndStoreGoogleKey(envFilePath);
561
+ }
562
+ break;
563
+ }
564
+ default:
565
+ console.warn(`Unknown AI model: ${aiModel}, skipping configuration`);
566
+ return;
567
+ }
568
+ } catch (error) {
569
+ const errorMessage = error instanceof Error ? error.message : "Unknown error";
570
+ console.error(`Failed to set up AI model configuration: ${errorMessage}`);
571
+ }
572
+ }
573
+ function hasValidApiKey(content, keyName) {
574
+ const regex = new RegExp(`^${keyName}=(.+)$`, "m");
575
+ const match = content.match(regex);
576
+ if (!match) return false;
577
+ const value = match[1].trim();
578
+ return value !== "" && !value.includes("your_") && !value.includes("_here") && !value.includes("PLACEHOLDER") && !value.includes("placeholder");
579
+ }
580
+ async function setupEmbeddingModelConfig(embeddingModel, envFilePath, isNonInteractive = false) {
581
+ try {
582
+ let content = "";
583
+ if (existsSync2(envFilePath)) {
584
+ content = await fs2.readFile(envFilePath, "utf8");
585
+ }
586
+ if (content && !content.endsWith("\n")) {
587
+ content += "\n";
588
+ }
589
+ switch (embeddingModel) {
590
+ case "local": {
591
+ if (!hasValidApiKey(content, "OLLAMA_API_ENDPOINT")) {
592
+ if (isNonInteractive) {
593
+ if (!content.includes("OLLAMA_API_ENDPOINT=")) {
594
+ content += "\n# Embedding Model Configuration (Fallback)\n";
595
+ content += "# Ollama Embeddings Configuration\n";
596
+ content += "OLLAMA_API_ENDPOINT=http://localhost:11434\n";
597
+ content += "OLLAMA_EMBEDDING_MODEL=nomic-embed-text\n";
598
+ content += "USE_OLLAMA_EMBEDDINGS=true\n";
599
+ content += "# Make sure Ollama is installed and running: https://ollama.ai/\n";
600
+ }
601
+ await fs2.writeFile(envFilePath, content, "utf8");
602
+ } else {
603
+ await promptAndStoreOllamaEmbeddingConfig(envFilePath);
604
+ }
605
+ } else {
606
+ if (isNonInteractive) {
607
+ if (!content.includes("OLLAMA_EMBEDDING_MODEL")) {
608
+ content += "OLLAMA_EMBEDDING_MODEL=nomic-embed-text\n";
609
+ }
610
+ if (!content.includes("USE_OLLAMA_EMBEDDINGS")) {
611
+ content += "USE_OLLAMA_EMBEDDINGS=true\n";
612
+ }
613
+ await fs2.writeFile(envFilePath, content, "utf8");
614
+ } else {
615
+ await promptAndStoreOllamaEmbeddingConfig(envFilePath);
616
+ }
617
+ }
618
+ break;
619
+ }
620
+ case "openai": {
621
+ if (!hasValidApiKey(content, "OPENAI_API_KEY")) {
622
+ if (isNonInteractive) {
623
+ if (!content.includes("OPENAI_API_KEY=")) {
624
+ content += "\n# Embedding Model Configuration (Fallback)\n";
625
+ content += "# OpenAI Embeddings Configuration\n";
626
+ content += "OPENAI_API_KEY=your_openai_api_key_here\n";
627
+ content += "# Get your API key from: https://platform.openai.com/api-keys\n";
628
+ }
629
+ await fs2.writeFile(envFilePath, content, "utf8");
630
+ } else {
631
+ await promptAndStoreOpenAIKey(envFilePath);
632
+ }
633
+ }
634
+ break;
635
+ }
636
+ case "google": {
637
+ if (!hasValidApiKey(content, "GOOGLE_GENERATIVE_AI_API_KEY")) {
638
+ if (isNonInteractive) {
639
+ if (!content.includes("GOOGLE_GENERATIVE_AI_API_KEY=")) {
640
+ content += "\n# Embedding Model Configuration (Fallback)\n";
641
+ content += "# Google Generative AI Embeddings Configuration\n";
642
+ content += "GOOGLE_GENERATIVE_AI_API_KEY=your_google_api_key_here\n";
643
+ content += "# Get your API key from: https://aistudio.google.com/apikey\n";
644
+ }
645
+ await fs2.writeFile(envFilePath, content, "utf8");
646
+ } else {
647
+ await promptAndStoreGoogleKey(envFilePath);
648
+ }
649
+ }
650
+ break;
651
+ }
652
+ default:
653
+ console.warn(`Unknown embedding model: ${embeddingModel}, skipping configuration`);
654
+ return;
655
+ }
656
+ } catch (error) {
657
+ const errorMessage = error instanceof Error ? error.message : "Unknown error";
658
+ console.error(`Failed to set up embedding model configuration: ${errorMessage}`);
659
+ }
660
+ }
661
+ function resolveModelToPlugin(modelName) {
662
+ const modelToPlugin = {
663
+ openai: "openai",
664
+ claude: "anthropic",
665
+ anthropic: "anthropic",
666
+ openrouter: "openrouter",
667
+ local: "ollama",
668
+ // 'local' maps to ollama plugin
669
+ google: "google-genai"
670
+ };
671
+ return modelToPlugin[modelName] || null;
672
+ }
673
+ async function installModelPlugin(modelName, targetDir, purpose = "") {
674
+ const pluginName = resolveModelToPlugin(modelName);
675
+ if (!pluginName) {
676
+ return;
677
+ }
678
+ await installPluginWithSpinner(pluginName, targetDir, purpose);
679
+ }
680
+ async function setupProjectEnvironment(targetDir, database, aiModel, embeddingModel, isNonInteractive = false) {
681
+ await createProjectDirectories(targetDir);
682
+ const envFilePath = `${targetDir}/.env`;
683
+ if (database === "postgres") {
684
+ if (!isNonInteractive) {
685
+ await promptAndStorePostgresUrl(envFilePath);
686
+ }
687
+ } else if (database === "pglite") {
688
+ await setupPgLite(void 0, `${targetDir}/.env`, targetDir);
689
+ }
690
+ if (!isNonInteractive) {
691
+ await setupAIModelConfig(aiModel, envFilePath, isNonInteractive);
692
+ if (embeddingModel) {
693
+ await setupEmbeddingModelConfig(embeddingModel, envFilePath, isNonInteractive);
694
+ }
695
+ }
696
+ await installModelPlugin(aiModel, targetDir, aiModel === "local" ? "for local AI" : "");
697
+ if (embeddingModel && embeddingModel !== "local") {
698
+ const aiPluginName = resolveModelToPlugin(aiModel);
699
+ const embeddingPluginName = resolveModelToPlugin(embeddingModel);
700
+ if (embeddingPluginName && embeddingPluginName !== aiPluginName) {
701
+ await installModelPlugin(embeddingModel, targetDir, "for embeddings");
702
+ }
703
+ } else if (embeddingModel === "local") {
704
+ if (aiModel !== "local") {
705
+ await installModelPlugin(embeddingModel, targetDir, "for embeddings");
706
+ }
707
+ }
708
+ }
709
+
455
710
  // src/commands/create/actions/creators.ts
456
- import { existsSync as existsSync2, rmSync } from "fs";
711
+ import { existsSync as existsSync3, rmSync } from "fs";
712
+ async function handleInteractiveConfiguration(targetDir, database, aiModel, embeddingModel) {
713
+ const envFilePath = `${targetDir}/.env`;
714
+ if (database === "postgres") {
715
+ await promptAndStorePostgresUrl(envFilePath);
716
+ }
717
+ if (aiModel !== "local" || embeddingModel) {
718
+ if (aiModel !== "local") {
719
+ await setupAIModelConfig(aiModel, envFilePath, false);
720
+ }
721
+ if (embeddingModel) {
722
+ await setupEmbeddingModelConfig(embeddingModel, envFilePath, false);
723
+ }
724
+ }
725
+ }
457
726
  async function withCleanupOnInterrupt(targetDir, displayName, fn) {
458
- const directoryExistedBefore = existsSync2(targetDir);
727
+ const directoryExistedBefore = existsSync3(targetDir);
459
728
  const cleanup = () => {
460
- if (!directoryExistedBefore && existsSync2(targetDir)) {
729
+ if (!directoryExistedBefore && existsSync3(targetDir)) {
461
730
  console.info(colors.red(`
462
731
 
463
732
  Interrupted! Cleaning up ${displayName}...`));
@@ -488,7 +757,7 @@ Interrupted! Cleaning up ${displayName}...`));
488
757
  process.removeListener("exit", cleanup);
489
758
  process.removeListener("SIGINT", sigintHandler);
490
759
  process.removeListener("SIGTERM", sigtermHandler);
491
- if (!directoryExistedBefore && existsSync2(targetDir)) {
760
+ if (!directoryExistedBefore && existsSync3(targetDir)) {
492
761
  try {
493
762
  console.info(colors.red(`
494
763
  Cleaning up due to error...`));
@@ -499,7 +768,7 @@ Cleaning up due to error...`));
499
768
  throw error;
500
769
  }
501
770
  }
502
- async function createPlugin(pluginName, targetDir, isNonInteractive = false) {
771
+ async function createPlugin(pluginName, targetDir, pluginType = "full", isNonInteractive = false) {
503
772
  const nameResult = processPluginName(pluginName);
504
773
  if (!nameResult.isValid) {
505
774
  throw new Error(nameResult.error || "Invalid plugin name");
@@ -529,8 +798,12 @@ Warning: changing "${pluginName}" to "${pluginDirName}" to conform to plugin nam
529
798
  }
530
799
  }
531
800
  await withCleanupOnInterrupt(pluginTargetDir, pluginDirName, async () => {
801
+ const templateName = pluginType === "quick" ? "plugin-quick" : "plugin";
532
802
  await runTasks([
533
- createTask("Copying plugin template", () => copyTemplate("plugin", pluginTargetDir)),
803
+ createTask(
804
+ "Copying plugin template",
805
+ () => copyTemplate(templateName, pluginTargetDir)
806
+ ),
534
807
  createTask("Installing dependencies", () => installDependenciesWithSpinner(pluginTargetDir))
535
808
  ]);
536
809
  console.info(`
@@ -549,7 +822,7 @@ Next steps:`);
549
822
  async function createAgent(agentName, targetDir, isNonInteractive = false) {
550
823
  const agentFilePath = join(targetDir, `${agentName}.json`);
551
824
  try {
552
- await fs2.access(agentFilePath);
825
+ await fs3.access(agentFilePath);
553
826
  throw new Error(`Agent file ${agentFilePath} already exists`);
554
827
  } catch (error) {
555
828
  if (error.code !== "ENOENT") {
@@ -574,7 +847,7 @@ async function createAgent(agentName, targetDir, isNonInteractive = false) {
574
847
  `${agentName} is knowledgeable, creative, and always eager to help users with their questions and tasks.`
575
848
  ]
576
849
  };
577
- await fs2.writeFile(agentFilePath, JSON.stringify(agentCharacter, null, 2));
850
+ await fs3.writeFile(agentFilePath, JSON.stringify(agentCharacter, null, 2));
578
851
  console.info(`
579
852
  ${colors.green("\u2713")} Agent "${agentName}" created successfully!`);
580
853
  console.info(`Agent character created successfully at: ${agentFilePath}`);
@@ -603,22 +876,9 @@ async function createTEEProject(projectName, targetDir, database, aiModel, embed
603
876
  }
604
877
  }
605
878
  await withCleanupOnInterrupt(teeTargetDir, projectName, async () => {
606
- await fs2.mkdir(teeTargetDir, { recursive: true });
879
+ await fs3.mkdir(teeTargetDir, { recursive: true });
607
880
  if (!isNonInteractive) {
608
- const { setupAIModelConfig, setupEmbeddingModelConfig } = await import("./setup-UQOWDHFN.js");
609
- const { promptAndStorePostgresUrl } = await import("./utils-DTW3XU6O.js");
610
- const envFilePath = `${teeTargetDir}/.env`;
611
- if (database === "postgres") {
612
- await promptAndStorePostgresUrl(envFilePath);
613
- }
614
- if (aiModel !== "local" || embeddingModel) {
615
- if (aiModel !== "local") {
616
- await setupAIModelConfig(aiModel, envFilePath, false);
617
- }
618
- if (embeddingModel) {
619
- await setupEmbeddingModelConfig(embeddingModel, envFilePath, false);
620
- }
621
- }
881
+ await handleInteractiveConfiguration(teeTargetDir, database, aiModel, embeddingModel);
622
882
  }
623
883
  await runTasks([
624
884
  createTask(
@@ -663,23 +923,10 @@ async function createProject(projectName, targetDir, database, aiModel, embeddin
663
923
  }
664
924
  const createFn = async () => {
665
925
  if (projectName !== ".") {
666
- await fs2.mkdir(projectTargetDir, { recursive: true });
926
+ await fs3.mkdir(projectTargetDir, { recursive: true });
667
927
  }
668
928
  if (!isNonInteractive) {
669
- const { setupAIModelConfig, setupEmbeddingModelConfig } = await import("./setup-UQOWDHFN.js");
670
- const { promptAndStorePostgresUrl } = await import("./utils-DTW3XU6O.js");
671
- const envFilePath = `${projectTargetDir}/.env`;
672
- if (database === "postgres") {
673
- await promptAndStorePostgresUrl(envFilePath);
674
- }
675
- if (aiModel !== "local" || embeddingModel) {
676
- if (aiModel !== "local") {
677
- await setupAIModelConfig(aiModel, envFilePath, false);
678
- }
679
- if (embeddingModel) {
680
- await setupEmbeddingModelConfig(embeddingModel, envFilePath, false);
681
- }
682
- }
929
+ await handleInteractiveConfiguration(projectTargetDir, database, aiModel, embeddingModel);
683
930
  }
684
931
  await runTasks([
685
932
  createTask(
@@ -717,10 +964,16 @@ Next steps:`);
717
964
  export {
718
965
  validateCreateOptions,
719
966
  validateProjectName,
967
+ hasEmbeddingSupport,
720
968
  selectDatabase,
721
969
  selectAIModel,
722
970
  selectEmbeddingModel,
723
971
  getElizaCharacter,
972
+ createProjectDirectories,
973
+ setupAIModelConfig,
974
+ hasValidApiKey,
975
+ setupEmbeddingModelConfig,
976
+ setupProjectEnvironment,
724
977
  createPlugin,
725
978
  createAgent,
726
979
  createTEEProject,