@elizaos/cli 1.5.11-alpha.1 → 1.5.11-alpha.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.
- package/dist/characters/eliza.d.ts.map +1 -1
- package/dist/commands/create/actions/setup.d.ts.map +1 -1
- package/dist/commands/scenario/src/plugin-parser.d.ts +6 -31
- package/dist/commands/scenario/src/plugin-parser.d.ts.map +1 -1
- package/dist/commands/scenario/src/runtime-factory.d.ts.map +1 -1
- package/dist/commands/start/index.d.ts +0 -5
- package/dist/commands/start/index.d.ts.map +1 -1
- package/dist/commands/test/actions/e2e-tests.d.ts.map +1 -1
- package/dist/index.js +1313 -1679
- package/dist/index.js.map +16 -22
- package/dist/templates/plugin-quick-starter/package.json +2 -2
- package/dist/templates/plugin-starter/package.json +2 -2
- package/dist/templates/project-starter/package.json +6 -6
- package/dist/templates/project-tee-starter/package.json +4 -4
- package/dist/utils/local-cli-delegation.d.ts.map +1 -1
- package/dist/version.d.ts +2 -2
- package/dist/version.js +2 -2
- package/package.json +8 -7
- package/templates/plugin-quick-starter/package.json +2 -2
- package/templates/plugin-starter/package.json +2 -2
- package/templates/project-starter/package.json +6 -6
- package/templates/project-tee-starter/package.json +4 -4
- package/dist/commands/start/actions/agent-start.d.ts +0 -14
- package/dist/commands/start/actions/agent-start.d.ts.map +0 -1
- package/dist/commands/start/actions/server-start.d.ts +0 -17
- package/dist/commands/start/actions/server-start.d.ts.map +0 -1
- package/dist/commands/start/utils/config-utils.d.ts +0 -30
- package/dist/commands/start/utils/config-utils.d.ts.map +0 -1
- package/dist/commands/start/utils/dependency-resolver.d.ts +0 -8
- package/dist/commands/start/utils/dependency-resolver.d.ts.map +0 -1
- package/dist/commands/start/utils/loader.d.ts +0 -68
- package/dist/commands/start/utils/loader.d.ts.map +0 -1
- package/dist/commands/start/utils/plugin-utils.d.ts +0 -17
- package/dist/commands/start/utils/plugin-utils.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -4688,7 +4688,7 @@ __export(exports_version, {
|
|
|
4688
4688
|
BUILD_TIME: () => BUILD_TIME,
|
|
4689
4689
|
BUILD_ENV: () => BUILD_ENV
|
|
4690
4690
|
});
|
|
4691
|
-
var CLI_VERSION = "1.5.11-alpha.
|
|
4691
|
+
var CLI_VERSION = "1.5.11-alpha.2", CLI_NAME = "@elizaos/cli", CLI_DESCRIPTION = "elizaOS CLI - Manage your AI agents and plugins", BUILD_TIME = "2025-09-19T22:32:25.791Z", BUILD_ENV = "production", version_default;
|
|
4692
4692
|
var init_version = __esm(() => {
|
|
4693
4693
|
version_default = {
|
|
4694
4694
|
version: CLI_VERSION,
|
|
@@ -14954,7 +14954,6 @@ var init_install_plugin = __esm(() => {
|
|
|
14954
14954
|
});
|
|
14955
14955
|
|
|
14956
14956
|
// src/utils/local-cli-delegation.ts
|
|
14957
|
-
import { spawn } from "child_process";
|
|
14958
14957
|
import { existsSync as existsSync15 } from "fs";
|
|
14959
14958
|
import path17 from "path";
|
|
14960
14959
|
import { logger as logger21 } from "@elizaos/core";
|
|
@@ -15002,39 +15001,37 @@ function setupLocalEnvironment() {
|
|
|
15002
15001
|
return env;
|
|
15003
15002
|
}
|
|
15004
15003
|
async function delegateToLocalCli(localCliPath) {
|
|
15005
|
-
|
|
15006
|
-
|
|
15007
|
-
|
|
15008
|
-
|
|
15009
|
-
|
|
15010
|
-
|
|
15011
|
-
|
|
15012
|
-
|
|
15013
|
-
|
|
15014
|
-
|
|
15015
|
-
childProcess.on("exit", (code, signal) => {
|
|
15016
|
-
if (code !== null) {
|
|
15017
|
-
process.exit(code);
|
|
15018
|
-
} else if (signal) {
|
|
15019
|
-
const exitCode = signal === "SIGINT" ? 130 : signal === "SIGTERM" ? 143 : 1;
|
|
15020
|
-
process.exit(exitCode);
|
|
15021
|
-
}
|
|
15022
|
-
resolve2();
|
|
15023
|
-
});
|
|
15024
|
-
childProcess.on("error", (error) => {
|
|
15025
|
-
logger21.error(`Failed to start local CLI:`, error instanceof Error ? error.message : String(error));
|
|
15026
|
-
reject(error);
|
|
15027
|
-
});
|
|
15028
|
-
const forwardSignal = (signal) => {
|
|
15029
|
-
process.on(signal, () => {
|
|
15030
|
-
if (childProcess.killed === false) {
|
|
15031
|
-
childProcess.kill(signal);
|
|
15032
|
-
}
|
|
15033
|
-
});
|
|
15034
|
-
};
|
|
15035
|
-
forwardSignal("SIGINT");
|
|
15036
|
-
forwardSignal("SIGTERM");
|
|
15004
|
+
logger21.info("Using local @elizaos/cli installation");
|
|
15005
|
+
const nodeExecutable = process.execPath;
|
|
15006
|
+
const args = process.argv.slice(2);
|
|
15007
|
+
const env = setupLocalEnvironment();
|
|
15008
|
+
const childProcess = Bun.spawn([nodeExecutable, localCliPath, ...args], {
|
|
15009
|
+
stdin: "inherit",
|
|
15010
|
+
stdout: "inherit",
|
|
15011
|
+
stderr: "inherit",
|
|
15012
|
+
env,
|
|
15013
|
+
cwd: process.cwd()
|
|
15037
15014
|
});
|
|
15015
|
+
const forwardSignal = (signal) => {
|
|
15016
|
+
const handler = () => {
|
|
15017
|
+
childProcess.kill(signal);
|
|
15018
|
+
};
|
|
15019
|
+
process.once(signal, handler);
|
|
15020
|
+
};
|
|
15021
|
+
forwardSignal("SIGINT");
|
|
15022
|
+
forwardSignal("SIGTERM");
|
|
15023
|
+
try {
|
|
15024
|
+
const exitCode = await childProcess.exited;
|
|
15025
|
+
if (childProcess.signalCode) {
|
|
15026
|
+
const signalExitCode = childProcess.signalCode === "SIGINT" ? 130 : childProcess.signalCode === "SIGTERM" ? 143 : 128;
|
|
15027
|
+
process.exit(signalExitCode);
|
|
15028
|
+
} else {
|
|
15029
|
+
process.exit(exitCode);
|
|
15030
|
+
}
|
|
15031
|
+
} catch (error) {
|
|
15032
|
+
logger21.error(`Failed to start local CLI:`, error instanceof Error ? error.message : String(error));
|
|
15033
|
+
throw error;
|
|
15034
|
+
}
|
|
15038
15035
|
}
|
|
15039
15036
|
function isTestOrCiEnvironment() {
|
|
15040
15037
|
const testAndCiIndicators = [
|
|
@@ -18466,327 +18463,6 @@ Required configuration:
|
|
|
18466
18463
|
agent.command("clear-memories").alias("clear").description("Clear all memories for an agent").requiredOption("-n, --name <name>", "agent id, name, or index number from list").option("-r, --remote-url <url>", "URL of the remote agent runtime").option("-p, --port <port>", "Port to listen on", (val) => Number.parseInt(val)).option("--auth-token <token>", "API authentication token").action(clearAgentMemories);
|
|
18467
18464
|
});
|
|
18468
18465
|
|
|
18469
|
-
// src/characters/eliza.ts
|
|
18470
|
-
function getElizaCharacter() {
|
|
18471
|
-
const plugins = [
|
|
18472
|
-
"@elizaos/plugin-sql",
|
|
18473
|
-
...process.env.ANTHROPIC_API_KEY?.trim() ? ["@elizaos/plugin-anthropic"] : [],
|
|
18474
|
-
...process.env.OPENROUTER_API_KEY?.trim() ? ["@elizaos/plugin-openrouter"] : [],
|
|
18475
|
-
...process.env.OPENAI_API_KEY?.trim() ? ["@elizaos/plugin-openai"] : [],
|
|
18476
|
-
...process.env.GOOGLE_GENERATIVE_AI_API_KEY?.trim() ? ["@elizaos/plugin-google-genai"] : [],
|
|
18477
|
-
...process.env.DISCORD_API_TOKEN?.trim() ? ["@elizaos/plugin-discord"] : [],
|
|
18478
|
-
...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"] : [],
|
|
18479
|
-
...process.env.TELEGRAM_BOT_TOKEN?.trim() ? ["@elizaos/plugin-telegram"] : [],
|
|
18480
|
-
...!process.env.IGNORE_BOOTSTRAP ? ["@elizaos/plugin-bootstrap"] : [],
|
|
18481
|
-
...!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"] : []
|
|
18482
|
-
];
|
|
18483
|
-
return {
|
|
18484
|
-
...baseCharacter,
|
|
18485
|
-
plugins
|
|
18486
|
-
};
|
|
18487
|
-
}
|
|
18488
|
-
var baseCharacter;
|
|
18489
|
-
var init_eliza = __esm(() => {
|
|
18490
|
-
baseCharacter = {
|
|
18491
|
-
name: "Eliza",
|
|
18492
|
-
plugins: ["@elizaos/plugin-sql", "@elizaos/plugin-bootstrap"],
|
|
18493
|
-
secrets: {},
|
|
18494
|
-
settings: {
|
|
18495
|
-
avatar: "https://elizaos.github.io/eliza-avatars/Eliza/portrait.png"
|
|
18496
|
-
},
|
|
18497
|
-
system: "Respond to all messages in a helpful, conversational manner. Provide assistance on a wide range of topics, using knowledge when needed. Be concise but thorough, friendly but professional. Use humor when appropriate and be empathetic to user needs. Provide valuable information and insights when questions are asked.",
|
|
18498
|
-
bio: [
|
|
18499
|
-
"Engages with all types of questions and conversations",
|
|
18500
|
-
"Provides helpful, concise responses",
|
|
18501
|
-
"Uses knowledge resources effectively when needed",
|
|
18502
|
-
"Balances brevity with completeness",
|
|
18503
|
-
"Uses humor and empathy appropriately",
|
|
18504
|
-
"Adapts tone to match the conversation context",
|
|
18505
|
-
"Offers assistance proactively",
|
|
18506
|
-
"Communicates clearly and directly"
|
|
18507
|
-
],
|
|
18508
|
-
topics: [
|
|
18509
|
-
"general knowledge and information",
|
|
18510
|
-
"problem solving and troubleshooting",
|
|
18511
|
-
"technology and software",
|
|
18512
|
-
"community building and management",
|
|
18513
|
-
"business and productivity",
|
|
18514
|
-
"creativity and innovation",
|
|
18515
|
-
"personal development",
|
|
18516
|
-
"communication and collaboration",
|
|
18517
|
-
"education and learning",
|
|
18518
|
-
"entertainment and media"
|
|
18519
|
-
],
|
|
18520
|
-
messageExamples: [
|
|
18521
|
-
[
|
|
18522
|
-
{
|
|
18523
|
-
name: "{{name1}}",
|
|
18524
|
-
content: {
|
|
18525
|
-
text: "This user keeps derailing technical discussions with personal problems."
|
|
18526
|
-
}
|
|
18527
|
-
},
|
|
18528
|
-
{
|
|
18529
|
-
name: "Eliza",
|
|
18530
|
-
content: {
|
|
18531
|
-
text: "DM them. Sounds like they need to talk about something else."
|
|
18532
|
-
}
|
|
18533
|
-
},
|
|
18534
|
-
{
|
|
18535
|
-
name: "{{name1}}",
|
|
18536
|
-
content: {
|
|
18537
|
-
text: "I tried, they just keep bringing drama back to the main channel."
|
|
18538
|
-
}
|
|
18539
|
-
},
|
|
18540
|
-
{
|
|
18541
|
-
name: "Eliza",
|
|
18542
|
-
content: {
|
|
18543
|
-
text: "Send them my way. I've got time today."
|
|
18544
|
-
}
|
|
18545
|
-
}
|
|
18546
|
-
],
|
|
18547
|
-
[
|
|
18548
|
-
{
|
|
18549
|
-
name: "{{name1}}",
|
|
18550
|
-
content: {
|
|
18551
|
-
text: "I can't handle being a mod anymore. It's affecting my mental health."
|
|
18552
|
-
}
|
|
18553
|
-
},
|
|
18554
|
-
{
|
|
18555
|
-
name: "Eliza",
|
|
18556
|
-
content: {
|
|
18557
|
-
text: "Drop the channels. You come first."
|
|
18558
|
-
}
|
|
18559
|
-
},
|
|
18560
|
-
{
|
|
18561
|
-
name: "{{name1}}",
|
|
18562
|
-
content: {
|
|
18563
|
-
text: "But who's going to handle everything?"
|
|
18564
|
-
}
|
|
18565
|
-
},
|
|
18566
|
-
{
|
|
18567
|
-
name: "Eliza",
|
|
18568
|
-
content: {
|
|
18569
|
-
text: "We will. Take the break. Come back when you're ready."
|
|
18570
|
-
}
|
|
18571
|
-
}
|
|
18572
|
-
],
|
|
18573
|
-
[
|
|
18574
|
-
{
|
|
18575
|
-
name: "{{name1}}",
|
|
18576
|
-
content: {
|
|
18577
|
-
text: "Could you explain how blockchain technology works?"
|
|
18578
|
-
}
|
|
18579
|
-
},
|
|
18580
|
-
{
|
|
18581
|
-
name: "Eliza",
|
|
18582
|
-
content: {
|
|
18583
|
-
text: "A blockchain is a distributed database that maintains a growing list of records secured against tampering and revision. Think of it as a chain of blocks where each block contains data, its own hash, and the hash of the previous block."
|
|
18584
|
-
}
|
|
18585
|
-
}
|
|
18586
|
-
],
|
|
18587
|
-
[
|
|
18588
|
-
{
|
|
18589
|
-
name: "{{name1}}",
|
|
18590
|
-
content: {
|
|
18591
|
-
text: "Hey everyone, what are our community guidelines for new members?"
|
|
18592
|
-
}
|
|
18593
|
-
},
|
|
18594
|
-
{
|
|
18595
|
-
name: "Eliza",
|
|
18596
|
-
content: {
|
|
18597
|
-
text: "Let me check our guidelines.",
|
|
18598
|
-
providers: ["KNOWLEDGE"]
|
|
18599
|
-
}
|
|
18600
|
-
}
|
|
18601
|
-
],
|
|
18602
|
-
[
|
|
18603
|
-
{
|
|
18604
|
-
name: "{{name1}}",
|
|
18605
|
-
content: {
|
|
18606
|
-
text: "Are there any resources for onboarding new developers to our community?"
|
|
18607
|
-
}
|
|
18608
|
-
},
|
|
18609
|
-
{
|
|
18610
|
-
name: "Eliza",
|
|
18611
|
-
content: {
|
|
18612
|
-
text: "We have some documentation I can find for you.",
|
|
18613
|
-
providers: ["KNOWLEDGE"]
|
|
18614
|
-
}
|
|
18615
|
-
}
|
|
18616
|
-
],
|
|
18617
|
-
[
|
|
18618
|
-
{
|
|
18619
|
-
name: "{{name1}}",
|
|
18620
|
-
content: {
|
|
18621
|
-
text: "What process should we follow for handling code of conduct violations?"
|
|
18622
|
-
}
|
|
18623
|
-
},
|
|
18624
|
-
{
|
|
18625
|
-
name: "Eliza",
|
|
18626
|
-
content: {
|
|
18627
|
-
text: "Let me pull up our violation handling process.",
|
|
18628
|
-
providers: ["KNOWLEDGE"]
|
|
18629
|
-
}
|
|
18630
|
-
}
|
|
18631
|
-
],
|
|
18632
|
-
[
|
|
18633
|
-
{
|
|
18634
|
-
name: "{{name1}}",
|
|
18635
|
-
content: {
|
|
18636
|
-
text: "What can you tell me about quantum computing?"
|
|
18637
|
-
}
|
|
18638
|
-
},
|
|
18639
|
-
{
|
|
18640
|
-
name: "Eliza",
|
|
18641
|
-
content: {
|
|
18642
|
-
text: "Let me find some information about quantum computing.",
|
|
18643
|
-
providers: ["KNOWLEDGE"]
|
|
18644
|
-
}
|
|
18645
|
-
}
|
|
18646
|
-
]
|
|
18647
|
-
],
|
|
18648
|
-
postExamples: [
|
|
18649
|
-
"Sometimes the best debugging tool is a fresh cup of coffee and a walk around the block.",
|
|
18650
|
-
"The magic happens when developers stop competing and start collaborating. Build together, grow together.",
|
|
18651
|
-
"Reminder: Your code doesn't have to be perfect on the first try. Progress over perfection.",
|
|
18652
|
-
"Community tip: The person asking 'obvious' questions today might solve your toughest problem tomorrow. Be kind.",
|
|
18653
|
-
"Hot take: Good documentation is more valuable than clever code.",
|
|
18654
|
-
"The best feature you can add to your project? A welcoming community.",
|
|
18655
|
-
"Debugging is just a conversation with your past self. Make it easier by leaving good comments.",
|
|
18656
|
-
"Your daily reminder that impostor syndrome affects even the most experienced developers. You belong here.",
|
|
18657
|
-
"Pro tip: Read the error message. Then read it again. The answer is usually there.",
|
|
18658
|
-
"Building in public isn't about showing off. It's about learning together and helping others avoid your mistakes.",
|
|
18659
|
-
"The difference between junior and senior developers? Seniors know when NOT to write code.",
|
|
18660
|
-
"Community > Competition. Always.",
|
|
18661
|
-
"Remember: Every expert was once a beginner who refused to give up.",
|
|
18662
|
-
"Code reviews aren't personal attacks. They're opportunities to level up together.",
|
|
18663
|
-
"The most powerful tool in development? Asking for help when you need it."
|
|
18664
|
-
],
|
|
18665
|
-
style: {
|
|
18666
|
-
all: [
|
|
18667
|
-
"Keep responses concise but informative",
|
|
18668
|
-
"Use clear and direct language",
|
|
18669
|
-
"Be engaging and conversational",
|
|
18670
|
-
"Use humor when appropriate",
|
|
18671
|
-
"Be empathetic and understanding",
|
|
18672
|
-
"Provide helpful information",
|
|
18673
|
-
"Be encouraging and positive",
|
|
18674
|
-
"Adapt tone to the conversation",
|
|
18675
|
-
"Use knowledge resources when needed",
|
|
18676
|
-
"Respond to all types of questions"
|
|
18677
|
-
],
|
|
18678
|
-
chat: [
|
|
18679
|
-
"Be conversational and natural",
|
|
18680
|
-
"Engage with the topic at hand",
|
|
18681
|
-
"Be helpful and informative",
|
|
18682
|
-
"Show personality and warmth"
|
|
18683
|
-
],
|
|
18684
|
-
post: [
|
|
18685
|
-
"Keep it concise and punchy - every word counts",
|
|
18686
|
-
"Share insights, not platitudes",
|
|
18687
|
-
"Be authentic and conversational, not corporate",
|
|
18688
|
-
"Use specific examples over generic advice",
|
|
18689
|
-
"Add value with each post - teach, inspire, or entertain",
|
|
18690
|
-
"One clear thought per post",
|
|
18691
|
-
"Avoid excessive hashtags or mentions",
|
|
18692
|
-
"Write like you are talking to a friend",
|
|
18693
|
-
"Share personal observations and hot takes",
|
|
18694
|
-
"Be helpful without being preachy",
|
|
18695
|
-
"Use emojis sparingly and purposefully",
|
|
18696
|
-
"End with something thought-provoking when appropriate"
|
|
18697
|
-
]
|
|
18698
|
-
}
|
|
18699
|
-
};
|
|
18700
|
-
});
|
|
18701
|
-
|
|
18702
|
-
// src/utils/dependency-manager.ts
|
|
18703
|
-
import * as fs14 from "fs";
|
|
18704
|
-
import * as path25 from "path";
|
|
18705
|
-
import { logger as logger27 } from "@elizaos/core";
|
|
18706
|
-
function hasElizaOSCli(packageJsonPath) {
|
|
18707
|
-
try {
|
|
18708
|
-
if (!fs14.existsSync(packageJsonPath)) {
|
|
18709
|
-
return false;
|
|
18710
|
-
}
|
|
18711
|
-
let packageJson;
|
|
18712
|
-
try {
|
|
18713
|
-
packageJson = JSON.parse(fs14.readFileSync(packageJsonPath, "utf8"));
|
|
18714
|
-
} catch (parseError) {
|
|
18715
|
-
logger27.debug({ error: parseError, packageJsonPath }, `Error parsing JSON in package.json`);
|
|
18716
|
-
return false;
|
|
18717
|
-
}
|
|
18718
|
-
const dependencies = packageJson.dependencies || {};
|
|
18719
|
-
const devDependencies = packageJson.devDependencies || {};
|
|
18720
|
-
return "@elizaos/cli" in dependencies || "@elizaos/cli" in devDependencies;
|
|
18721
|
-
} catch (error) {
|
|
18722
|
-
logger27.debug({ error, packageJsonPath }, `Error reading package.json`);
|
|
18723
|
-
return false;
|
|
18724
|
-
}
|
|
18725
|
-
}
|
|
18726
|
-
function shouldAutoInstallCli(cwd = process.cwd()) {
|
|
18727
|
-
if (process.env.ELIZA_NO_AUTO_INSTALL === "true") {
|
|
18728
|
-
logger27.debug("Auto-install disabled via ELIZA_NO_AUTO_INSTALL");
|
|
18729
|
-
return false;
|
|
18730
|
-
}
|
|
18731
|
-
if (process.env.CI === "true" || process.env.ELIZA_TEST_MODE === "true") {
|
|
18732
|
-
logger27.debug("Skipping auto-install in CI/test environment");
|
|
18733
|
-
return false;
|
|
18734
|
-
}
|
|
18735
|
-
const dirInfo = detectDirectoryType(cwd);
|
|
18736
|
-
if (dirInfo.type === "elizaos-monorepo" || dirInfo.monorepoRoot) {
|
|
18737
|
-
logger27.debug("Skipping auto-install in monorepo");
|
|
18738
|
-
return false;
|
|
18739
|
-
}
|
|
18740
|
-
if (!dirInfo.hasPackageJson) {
|
|
18741
|
-
logger27.debug("No package.json found, skipping auto-install");
|
|
18742
|
-
return false;
|
|
18743
|
-
}
|
|
18744
|
-
const packageJsonPath = path25.join(cwd, "package.json");
|
|
18745
|
-
if (hasElizaOSCli(packageJsonPath)) {
|
|
18746
|
-
logger27.debug("@elizaos/cli already present, skipping auto-install");
|
|
18747
|
-
return false;
|
|
18748
|
-
}
|
|
18749
|
-
return true;
|
|
18750
|
-
}
|
|
18751
|
-
async function installElizaOSCli(cwd = process.cwd()) {
|
|
18752
|
-
try {
|
|
18753
|
-
logger27.info("Adding @elizaos/cli as dev dependency for enhanced development experience...");
|
|
18754
|
-
const result = await runBunWithSpinner(["add", "--dev", "@elizaos/cli"], cwd, {
|
|
18755
|
-
spinnerText: "Installing @elizaos/cli with bun...",
|
|
18756
|
-
successText: "\u2713 @elizaos/cli installed successfully",
|
|
18757
|
-
errorText: "Failed to install @elizaos/cli",
|
|
18758
|
-
showOutputOnError: false
|
|
18759
|
-
});
|
|
18760
|
-
if (result.success) {
|
|
18761
|
-
logger27.info("\u2713 @elizaos/cli added as dev dependency");
|
|
18762
|
-
return true;
|
|
18763
|
-
} else {
|
|
18764
|
-
logger27.warn("\u26A0 Failed to install @elizaos/cli as dev dependency (optional)");
|
|
18765
|
-
logger27.debug({ error: result.error }, "Installation error:");
|
|
18766
|
-
return false;
|
|
18767
|
-
}
|
|
18768
|
-
} catch (error) {
|
|
18769
|
-
logger27.warn("\u26A0 Failed to install @elizaos/cli as dev dependency (optional)");
|
|
18770
|
-
logger27.debug({ error }, "Installation error:");
|
|
18771
|
-
return false;
|
|
18772
|
-
}
|
|
18773
|
-
}
|
|
18774
|
-
async function ensureElizaOSCli(cwd = process.cwd()) {
|
|
18775
|
-
if (!shouldAutoInstallCli(cwd)) {
|
|
18776
|
-
return;
|
|
18777
|
-
}
|
|
18778
|
-
logger27.debug("Auto-installing @elizaos/cli for enhanced development experience");
|
|
18779
|
-
const success = await installElizaOSCli(cwd);
|
|
18780
|
-
if (success) {
|
|
18781
|
-
logger27.info("Next time you can use the local CLI for better performance and consistency");
|
|
18782
|
-
}
|
|
18783
|
-
}
|
|
18784
|
-
var init_dependency_manager = __esm(() => {
|
|
18785
|
-
init_bun_exec();
|
|
18786
|
-
init_spinner_utils();
|
|
18787
|
-
init_directory_detection();
|
|
18788
|
-
});
|
|
18789
|
-
|
|
18790
18466
|
// ../../node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
18791
18467
|
function assembleStyles() {
|
|
18792
18468
|
const codes = new Map;
|
|
@@ -19276,52 +18952,6 @@ var init_source = __esm(() => {
|
|
|
19276
18952
|
source_default = chalk;
|
|
19277
18953
|
});
|
|
19278
18954
|
|
|
19279
|
-
// src/commands/env/utils/file-operations.ts
|
|
19280
|
-
import { existsSync as existsSync26 } from "fs";
|
|
19281
|
-
import path27 from "path";
|
|
19282
|
-
async function getLocalEnvPath() {
|
|
19283
|
-
const localEnvPath = path27.join(process.cwd(), ".env");
|
|
19284
|
-
return existsSync26(localEnvPath) ? localEnvPath : null;
|
|
19285
|
-
}
|
|
19286
|
-
async function parseEnvFile(filePath) {
|
|
19287
|
-
const service = createEnvFileService(filePath);
|
|
19288
|
-
return service.read();
|
|
19289
|
-
}
|
|
19290
|
-
async function writeEnvFile2(filePath, envVars) {
|
|
19291
|
-
const service = createEnvFileService(filePath);
|
|
19292
|
-
await service.write(envVars, {
|
|
19293
|
-
preserveComments: true,
|
|
19294
|
-
updateProcessEnv: true
|
|
19295
|
-
});
|
|
19296
|
-
}
|
|
19297
|
-
async function resetEnvFile(filePath) {
|
|
19298
|
-
try {
|
|
19299
|
-
if (!existsSync26(filePath)) {
|
|
19300
|
-
return false;
|
|
19301
|
-
}
|
|
19302
|
-
const service = createEnvFileService(filePath);
|
|
19303
|
-
const envVars = await service.read();
|
|
19304
|
-
if (Object.keys(envVars).length === 0) {
|
|
19305
|
-
return false;
|
|
19306
|
-
}
|
|
19307
|
-
const resetVars = Object.keys(envVars).reduce((acc, key) => {
|
|
19308
|
-
acc[key] = "";
|
|
19309
|
-
return acc;
|
|
19310
|
-
}, {});
|
|
19311
|
-
await service.write(resetVars, {
|
|
19312
|
-
preserveComments: true,
|
|
19313
|
-
updateProcessEnv: false
|
|
19314
|
-
});
|
|
19315
|
-
return true;
|
|
19316
|
-
} catch (error) {
|
|
19317
|
-
console.error(`Error resetting environment file: ${error instanceof Error ? error.message : String(error)}`);
|
|
19318
|
-
return false;
|
|
19319
|
-
}
|
|
19320
|
-
}
|
|
19321
|
-
var init_file_operations = __esm(() => {
|
|
19322
|
-
init_env_file_service();
|
|
19323
|
-
});
|
|
19324
|
-
|
|
19325
18955
|
// ../../node_modules/@anthropic-ai/sdk/internal/tslib.mjs
|
|
19326
18956
|
function __classPrivateFieldSet2(receiver, state, value, kind, f) {
|
|
19327
18957
|
if (kind === "m")
|
|
@@ -33084,7 +32714,7 @@ var exports_ScreenRecorder = {};
|
|
|
33084
32714
|
__export(exports_ScreenRecorder, {
|
|
33085
32715
|
ScreenRecorder: () => ScreenRecorder
|
|
33086
32716
|
});
|
|
33087
|
-
import { spawn
|
|
32717
|
+
import { spawn, spawnSync } from "child_process";
|
|
33088
32718
|
import { PassThrough } from "stream";
|
|
33089
32719
|
var import_debug, __runInitializers4 = function(thisArg, initializers, value) {
|
|
33090
32720
|
var useValue = arguments.length > 2;
|
|
@@ -33180,7 +32810,7 @@ var init_ScreenRecorder = __esm(() => {
|
|
|
33180
32810
|
if (error2) {
|
|
33181
32811
|
throw error2;
|
|
33182
32812
|
}
|
|
33183
|
-
this.#process =
|
|
32813
|
+
this.#process = spawn(path47, [
|
|
33184
32814
|
["-loglevel", "error"],
|
|
33185
32815
|
["-avioflags", "direct"],
|
|
33186
32816
|
[
|
|
@@ -259606,599 +259236,6 @@ var require_dist12 = __commonJS((exports) => {
|
|
|
259606
259236
|
exports.cosmiconfigSync = cosmiconfigSync;
|
|
259607
259237
|
});
|
|
259608
259238
|
|
|
259609
|
-
// src/project.ts
|
|
259610
|
-
import {
|
|
259611
|
-
logger as logger41
|
|
259612
|
-
} from "@elizaos/core";
|
|
259613
|
-
import { stringToUuid } from "@elizaos/core";
|
|
259614
|
-
import * as fs31 from "fs";
|
|
259615
|
-
import path57 from "path";
|
|
259616
|
-
function isPlugin(module) {
|
|
259617
|
-
if (module && typeof module === "object" && typeof module.name === "string" && typeof module.description === "string") {
|
|
259618
|
-
return true;
|
|
259619
|
-
}
|
|
259620
|
-
if (module && typeof module === "object" && module.default && typeof module.default === "object" && typeof module.default.name === "string" && typeof module.default.description === "string") {
|
|
259621
|
-
return true;
|
|
259622
|
-
}
|
|
259623
|
-
for (const key in module) {
|
|
259624
|
-
if (key !== "default" && module[key] && typeof module[key] === "object" && typeof module[key].name === "string" && typeof module[key].description === "string") {
|
|
259625
|
-
return true;
|
|
259626
|
-
}
|
|
259627
|
-
}
|
|
259628
|
-
return false;
|
|
259629
|
-
}
|
|
259630
|
-
function extractPlugin(module) {
|
|
259631
|
-
if (module && typeof module === "object" && typeof module.name === "string" && typeof module.description === "string") {
|
|
259632
|
-
return module;
|
|
259633
|
-
}
|
|
259634
|
-
if (module && typeof module === "object" && module.default && typeof module.default === "object" && typeof module.default.name === "string" && typeof module.default.description === "string") {
|
|
259635
|
-
return module.default;
|
|
259636
|
-
}
|
|
259637
|
-
for (const key in module) {
|
|
259638
|
-
if (key !== "default" && module[key] && typeof module[key] === "object" && typeof module[key].name === "string" && typeof module[key].description === "string") {
|
|
259639
|
-
return module[key];
|
|
259640
|
-
}
|
|
259641
|
-
}
|
|
259642
|
-
throw new Error("Could not extract plugin from module");
|
|
259643
|
-
}
|
|
259644
|
-
async function loadProject(dir) {
|
|
259645
|
-
try {
|
|
259646
|
-
const dirInfo = detectDirectoryType(dir);
|
|
259647
|
-
if (!dirInfo.hasPackageJson) {
|
|
259648
|
-
throw new Error(`No package.json found in ${dir}`);
|
|
259649
|
-
}
|
|
259650
|
-
const packageJson = JSON.parse(fs31.readFileSync(path57.join(dir, "package.json"), "utf8"));
|
|
259651
|
-
const main2 = packageJson.main;
|
|
259652
|
-
if (!main2) {
|
|
259653
|
-
logger41.warn("No main field found in package.json, using default character");
|
|
259654
|
-
const defaultCharacterName = "Eliza (Default)";
|
|
259655
|
-
const elizaCharacter = getElizaCharacter();
|
|
259656
|
-
const defaultAgent = {
|
|
259657
|
-
character: {
|
|
259658
|
-
...elizaCharacter,
|
|
259659
|
-
id: stringToUuid(defaultCharacterName),
|
|
259660
|
-
name: defaultCharacterName
|
|
259661
|
-
},
|
|
259662
|
-
init: async () => {
|
|
259663
|
-
logger41.info("Initializing default Eliza character");
|
|
259664
|
-
}
|
|
259665
|
-
};
|
|
259666
|
-
return {
|
|
259667
|
-
agents: [defaultAgent],
|
|
259668
|
-
dir
|
|
259669
|
-
};
|
|
259670
|
-
}
|
|
259671
|
-
const entryPoints = [
|
|
259672
|
-
path57.join(dir, main2),
|
|
259673
|
-
path57.join(dir, "dist/index.js"),
|
|
259674
|
-
path57.join(dir, "src/index.ts"),
|
|
259675
|
-
path57.join(dir, "src/index.js"),
|
|
259676
|
-
path57.join(dir, "index.ts"),
|
|
259677
|
-
path57.join(dir, "index.js")
|
|
259678
|
-
];
|
|
259679
|
-
let projectModule = null;
|
|
259680
|
-
for (const entryPoint of entryPoints) {
|
|
259681
|
-
if (fs31.existsSync(entryPoint)) {
|
|
259682
|
-
try {
|
|
259683
|
-
const importPath = path57.resolve(entryPoint);
|
|
259684
|
-
const importUrl = process.platform === "win32" ? "file:///" + importPath.replace(/\\/g, "/") : "file://" + importPath;
|
|
259685
|
-
projectModule = await import(importUrl);
|
|
259686
|
-
logger41.info(`Loaded project from ${entryPoint}`);
|
|
259687
|
-
const exportKeys = Object.keys(projectModule);
|
|
259688
|
-
logger41.debug({ exportKeys }, `Module exports:`);
|
|
259689
|
-
if (exportKeys.includes("default")) {
|
|
259690
|
-
logger41.debug({ type: typeof projectModule.default }, `Default export type:`);
|
|
259691
|
-
if (typeof projectModule.default === "object" && projectModule.default !== null) {
|
|
259692
|
-
logger41.debug({ keys: Object.keys(projectModule.default) }, `Default export keys:`);
|
|
259693
|
-
}
|
|
259694
|
-
}
|
|
259695
|
-
break;
|
|
259696
|
-
} catch (error2) {
|
|
259697
|
-
logger41.warn({ error: error2, entryPoint }, `Failed to import project`);
|
|
259698
|
-
}
|
|
259699
|
-
}
|
|
259700
|
-
}
|
|
259701
|
-
if (!projectModule) {
|
|
259702
|
-
throw new Error("Could not find project entry point");
|
|
259703
|
-
}
|
|
259704
|
-
const moduleIsPlugin = isPlugin(projectModule);
|
|
259705
|
-
logger41.debug({ moduleIsPlugin }, `Is this a plugin?`);
|
|
259706
|
-
if (moduleIsPlugin) {
|
|
259707
|
-
logger41.info("Detected plugin module instead of project");
|
|
259708
|
-
try {
|
|
259709
|
-
const plugin = extractPlugin(projectModule);
|
|
259710
|
-
logger41.debug({ name: plugin.name, description: plugin.description }, `Found plugin:`);
|
|
259711
|
-
logger41.debug({ keys: Object.keys(plugin) }, `Plugin has the following properties:`);
|
|
259712
|
-
const completePlugin = {
|
|
259713
|
-
...plugin,
|
|
259714
|
-
name: plugin.name || "unknown-plugin",
|
|
259715
|
-
description: plugin.description || "No description",
|
|
259716
|
-
init: plugin.init || (async () => {
|
|
259717
|
-
logger41.info(`Dummy init for plugin: ${plugin.name}`);
|
|
259718
|
-
})
|
|
259719
|
-
};
|
|
259720
|
-
const characterName = "Eliza (Test Mode)";
|
|
259721
|
-
const elizaCharacter = getElizaCharacter();
|
|
259722
|
-
const testCharacter = {
|
|
259723
|
-
...elizaCharacter,
|
|
259724
|
-
id: stringToUuid(characterName),
|
|
259725
|
-
name: characterName,
|
|
259726
|
-
system: `${elizaCharacter.system} Testing the plugin: ${completePlugin.name}.`
|
|
259727
|
-
};
|
|
259728
|
-
logger41.info(`Using Eliza character as test agent for plugin: ${completePlugin.name}`);
|
|
259729
|
-
const testAgent = {
|
|
259730
|
-
character: testCharacter,
|
|
259731
|
-
plugins: [completePlugin],
|
|
259732
|
-
init: async () => {
|
|
259733
|
-
logger41.info(`Initializing Eliza test agent for plugin: ${completePlugin.name}`);
|
|
259734
|
-
}
|
|
259735
|
-
};
|
|
259736
|
-
return {
|
|
259737
|
-
agents: [testAgent],
|
|
259738
|
-
dir,
|
|
259739
|
-
isPlugin: true,
|
|
259740
|
-
pluginModule: completePlugin
|
|
259741
|
-
};
|
|
259742
|
-
} catch (error2) {
|
|
259743
|
-
logger41.error("Error extracting plugin from module:", error2 instanceof Error ? error2.message : String(error2));
|
|
259744
|
-
throw error2;
|
|
259745
|
-
}
|
|
259746
|
-
}
|
|
259747
|
-
const agents = [];
|
|
259748
|
-
if (projectModule.default && typeof projectModule.default === "object" && Array.isArray(projectModule.default.agents)) {
|
|
259749
|
-
agents.push(...projectModule.default.agents);
|
|
259750
|
-
logger41.debug({ count: agents.length }, `Found agents in default export's agents array`);
|
|
259751
|
-
} else {
|
|
259752
|
-
for (const [key, value] of Object.entries(projectModule)) {
|
|
259753
|
-
if (key === "default" && value && typeof value === "object") {
|
|
259754
|
-
if (value.character && value.init) {
|
|
259755
|
-
agents.push(value);
|
|
259756
|
-
logger41.debug(`Found agent in default export (single agent)`);
|
|
259757
|
-
}
|
|
259758
|
-
} else if (value && typeof value === "object" && value.character && value.init) {
|
|
259759
|
-
agents.push(value);
|
|
259760
|
-
logger41.debug({ key }, `Found agent in named export`);
|
|
259761
|
-
}
|
|
259762
|
-
}
|
|
259763
|
-
}
|
|
259764
|
-
if (agents.length === 0) {
|
|
259765
|
-
throw new Error("No agents found in project");
|
|
259766
|
-
}
|
|
259767
|
-
const project = {
|
|
259768
|
-
agents,
|
|
259769
|
-
dir
|
|
259770
|
-
};
|
|
259771
|
-
return project;
|
|
259772
|
-
} catch (error2) {
|
|
259773
|
-
logger41.error({ error: error2 }, "Error loading project:");
|
|
259774
|
-
throw error2;
|
|
259775
|
-
}
|
|
259776
|
-
}
|
|
259777
|
-
var init_project = __esm(() => {
|
|
259778
|
-
init_eliza();
|
|
259779
|
-
init_directory_detection();
|
|
259780
|
-
});
|
|
259781
|
-
|
|
259782
|
-
// src/utils/port-validation.ts
|
|
259783
|
-
function validatePort(value) {
|
|
259784
|
-
const port = Number.parseInt(value, 10);
|
|
259785
|
-
if (Number.isNaN(port) || port <= 0 || port > 65535) {
|
|
259786
|
-
throw new Error("Port must be a number between 1 and 65535");
|
|
259787
|
-
}
|
|
259788
|
-
return port;
|
|
259789
|
-
}
|
|
259790
|
-
|
|
259791
|
-
// src/commands/start/utils/config-utils.ts
|
|
259792
|
-
async function loadEnvConfig() {
|
|
259793
|
-
const envInfo = await UserEnvironment.getInstanceInfo();
|
|
259794
|
-
if (envInfo.paths.envFilePath) {
|
|
259795
|
-
import_dotenv4.default.config({ path: envInfo.paths.envFilePath });
|
|
259796
|
-
}
|
|
259797
|
-
return process.env;
|
|
259798
|
-
}
|
|
259799
|
-
function hasCharacterSecrets(character) {
|
|
259800
|
-
return character?.settings?.secrets && Object.keys(character.settings.secrets).length > 0;
|
|
259801
|
-
}
|
|
259802
|
-
function ensureCharacterSettings(character) {
|
|
259803
|
-
if (!character.settings) {
|
|
259804
|
-
character.settings = {};
|
|
259805
|
-
}
|
|
259806
|
-
}
|
|
259807
|
-
async function loadLocalEnvSecrets() {
|
|
259808
|
-
const envPath = await getLocalEnvPath();
|
|
259809
|
-
if (!envPath) {
|
|
259810
|
-
return null;
|
|
259811
|
-
}
|
|
259812
|
-
return await parseEnvFile(envPath);
|
|
259813
|
-
}
|
|
259814
|
-
async function setDefaultSecretsFromEnv(character) {
|
|
259815
|
-
ensureCharacterSettings(character);
|
|
259816
|
-
if (hasCharacterSecrets(character)) {
|
|
259817
|
-
return false;
|
|
259818
|
-
}
|
|
259819
|
-
const envSecrets = await loadLocalEnvSecrets();
|
|
259820
|
-
if (!envSecrets) {
|
|
259821
|
-
return false;
|
|
259822
|
-
}
|
|
259823
|
-
character.settings.secrets = envSecrets;
|
|
259824
|
-
return true;
|
|
259825
|
-
}
|
|
259826
|
-
var import_dotenv4;
|
|
259827
|
-
var init_config_utils = __esm(() => {
|
|
259828
|
-
init_utils();
|
|
259829
|
-
import_dotenv4 = __toESM(require_main(), 1);
|
|
259830
|
-
init_file_operations();
|
|
259831
|
-
});
|
|
259832
|
-
|
|
259833
|
-
// src/commands/start/utils/dependency-resolver.ts
|
|
259834
|
-
import { logger as logger42 } from "@elizaos/core";
|
|
259835
|
-
function resolvePluginDependencies(availablePlugins, isTestMode = false) {
|
|
259836
|
-
const resolutionOrder = [];
|
|
259837
|
-
const visited = new Set;
|
|
259838
|
-
const visiting = new Set;
|
|
259839
|
-
function visit(pluginName) {
|
|
259840
|
-
if (!availablePlugins.has(pluginName)) {
|
|
259841
|
-
logger42.warn(`Plugin dependency "${pluginName}" not found and will be skipped.`);
|
|
259842
|
-
return;
|
|
259843
|
-
}
|
|
259844
|
-
if (visited.has(pluginName))
|
|
259845
|
-
return;
|
|
259846
|
-
if (visiting.has(pluginName)) {
|
|
259847
|
-
logger42.error(`Circular dependency detected involving plugin: ${pluginName}`);
|
|
259848
|
-
return;
|
|
259849
|
-
}
|
|
259850
|
-
visiting.add(pluginName);
|
|
259851
|
-
const plugin = availablePlugins.get(pluginName);
|
|
259852
|
-
if (plugin) {
|
|
259853
|
-
const deps = [...plugin.dependencies || []];
|
|
259854
|
-
if (isTestMode) {
|
|
259855
|
-
deps.push(...plugin.testDependencies || []);
|
|
259856
|
-
}
|
|
259857
|
-
for (const dep of deps) {
|
|
259858
|
-
visit(dep);
|
|
259859
|
-
}
|
|
259860
|
-
}
|
|
259861
|
-
visiting.delete(pluginName);
|
|
259862
|
-
visited.add(pluginName);
|
|
259863
|
-
resolutionOrder.push(pluginName);
|
|
259864
|
-
}
|
|
259865
|
-
for (const name of availablePlugins.keys()) {
|
|
259866
|
-
if (!visited.has(name)) {
|
|
259867
|
-
visit(name);
|
|
259868
|
-
}
|
|
259869
|
-
}
|
|
259870
|
-
const finalPlugins = resolutionOrder.map((name) => availablePlugins.get(name)).filter((p2) => p2);
|
|
259871
|
-
logger42.info({ plugins: finalPlugins.map((p2) => p2.name) }, `Final plugins being loaded:`);
|
|
259872
|
-
return finalPlugins;
|
|
259873
|
-
}
|
|
259874
|
-
var init_dependency_resolver = () => {};
|
|
259875
|
-
|
|
259876
|
-
// src/commands/start/utils/plugin-utils.ts
|
|
259877
|
-
import { logger as logger43 } from "@elizaos/core";
|
|
259878
|
-
function isValidPluginShape(obj) {
|
|
259879
|
-
if (!obj || typeof obj !== "object" || !obj.name) {
|
|
259880
|
-
return false;
|
|
259881
|
-
}
|
|
259882
|
-
return !!(obj.init || obj.services || obj.providers || obj.actions || obj.evaluators || obj.description);
|
|
259883
|
-
}
|
|
259884
|
-
async function loadAndPreparePlugin(pluginName) {
|
|
259885
|
-
const version2 = getCliInstallTag();
|
|
259886
|
-
let pluginModule;
|
|
259887
|
-
const context2 = detectPluginContext(pluginName);
|
|
259888
|
-
if (context2.isLocalDevelopment) {
|
|
259889
|
-
try {
|
|
259890
|
-
pluginModule = await loadPluginModule(pluginName);
|
|
259891
|
-
if (!pluginModule) {
|
|
259892
|
-
logger43.error(`Failed to load local plugin ${pluginName}.`);
|
|
259893
|
-
provideLocalPluginGuidance(pluginName, context2);
|
|
259894
|
-
return null;
|
|
259895
|
-
}
|
|
259896
|
-
} catch (error2) {
|
|
259897
|
-
logger43.error(`Error loading local plugin ${pluginName}: ${error2}`);
|
|
259898
|
-
provideLocalPluginGuidance(pluginName, context2);
|
|
259899
|
-
return null;
|
|
259900
|
-
}
|
|
259901
|
-
} else {
|
|
259902
|
-
try {
|
|
259903
|
-
pluginModule = await loadPluginModule(pluginName);
|
|
259904
|
-
if (!pluginModule) {
|
|
259905
|
-
logger43.info(`Plugin ${pluginName} not available, installing...`);
|
|
259906
|
-
await installPlugin(pluginName, process.cwd(), version2);
|
|
259907
|
-
pluginModule = await loadPluginModule(pluginName);
|
|
259908
|
-
}
|
|
259909
|
-
} catch (error2) {
|
|
259910
|
-
logger43.error(`Failed to process plugin ${pluginName}: ${error2}`);
|
|
259911
|
-
return null;
|
|
259912
|
-
}
|
|
259913
|
-
}
|
|
259914
|
-
if (!pluginModule) {
|
|
259915
|
-
logger43.error(`Failed to load module for plugin ${pluginName}.`);
|
|
259916
|
-
return null;
|
|
259917
|
-
}
|
|
259918
|
-
const expectedFunctionName = `${pluginName.replace(/^@elizaos\/plugin-/, "").replace(/^@elizaos\//, "").replace(/-./g, (match2) => match2[1].toUpperCase())}Plugin`;
|
|
259919
|
-
const exportsToCheck = [
|
|
259920
|
-
pluginModule[expectedFunctionName],
|
|
259921
|
-
pluginModule.default,
|
|
259922
|
-
...Object.values(pluginModule)
|
|
259923
|
-
];
|
|
259924
|
-
for (const potentialPlugin of exportsToCheck) {
|
|
259925
|
-
if (isValidPluginShape(potentialPlugin)) {
|
|
259926
|
-
return potentialPlugin;
|
|
259927
|
-
}
|
|
259928
|
-
}
|
|
259929
|
-
logger43.warn(`Could not find a valid plugin export in ${pluginName}.`);
|
|
259930
|
-
return null;
|
|
259931
|
-
}
|
|
259932
|
-
var init_plugin_utils = __esm(() => {
|
|
259933
|
-
init_utils();
|
|
259934
|
-
init_plugin_context();
|
|
259935
|
-
});
|
|
259936
|
-
|
|
259937
|
-
// src/commands/start/actions/agent-start.ts
|
|
259938
|
-
var exports_agent_start = {};
|
|
259939
|
-
__export(exports_agent_start, {
|
|
259940
|
-
stopAgent: () => stopAgent2,
|
|
259941
|
-
startAgent: () => startAgent2
|
|
259942
|
-
});
|
|
259943
|
-
import {
|
|
259944
|
-
AgentRuntime as AgentRuntime2,
|
|
259945
|
-
encryptedCharacter,
|
|
259946
|
-
logger as logger44,
|
|
259947
|
-
stringToUuid as stringToUuid2
|
|
259948
|
-
} from "@elizaos/core";
|
|
259949
|
-
import sqlPlugin from "@elizaos/plugin-sql";
|
|
259950
|
-
async function startAgent2(character, server2, init, plugins2 = [], options = {}) {
|
|
259951
|
-
character.id ??= stringToUuid2(character.name);
|
|
259952
|
-
if (!hasCharacterSecrets(character)) {
|
|
259953
|
-
await setDefaultSecretsFromEnv(character);
|
|
259954
|
-
}
|
|
259955
|
-
const loadedPlugins = new Map;
|
|
259956
|
-
const pluginsToLoad = new Set(character.plugins || []);
|
|
259957
|
-
for (const p2 of plugins2) {
|
|
259958
|
-
if (typeof p2 === "string") {
|
|
259959
|
-
pluginsToLoad.add(p2);
|
|
259960
|
-
} else if (isValidPluginShape(p2) && !loadedPlugins.has(p2.name)) {
|
|
259961
|
-
loadedPlugins.set(p2.name, p2);
|
|
259962
|
-
(p2.dependencies || []).forEach((dep) => pluginsToLoad.add(dep));
|
|
259963
|
-
if (options.isTestMode) {
|
|
259964
|
-
(p2.testDependencies || []).forEach((dep) => pluginsToLoad.add(dep));
|
|
259965
|
-
}
|
|
259966
|
-
}
|
|
259967
|
-
}
|
|
259968
|
-
const allAvailablePlugins = new Map;
|
|
259969
|
-
for (const p2 of loadedPlugins.values()) {
|
|
259970
|
-
allAvailablePlugins.set(p2.name, p2);
|
|
259971
|
-
}
|
|
259972
|
-
for (const name of pluginsToLoad) {
|
|
259973
|
-
if (!allAvailablePlugins.has(name)) {
|
|
259974
|
-
const loaded = await loadAndPreparePlugin(name);
|
|
259975
|
-
if (loaded) {
|
|
259976
|
-
allAvailablePlugins.set(loaded.name, loaded);
|
|
259977
|
-
}
|
|
259978
|
-
}
|
|
259979
|
-
}
|
|
259980
|
-
let haveSql = false;
|
|
259981
|
-
for (const n of allAvailablePlugins.keys()) {
|
|
259982
|
-
if (n === sqlPlugin.name || n === "mysql") {
|
|
259983
|
-
haveSql = true;
|
|
259984
|
-
break;
|
|
259985
|
-
}
|
|
259986
|
-
}
|
|
259987
|
-
if (!haveSql) {
|
|
259988
|
-
allAvailablePlugins.set(sqlPlugin.name, sqlPlugin);
|
|
259989
|
-
}
|
|
259990
|
-
const finalPlugins = resolvePluginDependencies(allAvailablePlugins, options.isTestMode);
|
|
259991
|
-
const runtime = new AgentRuntime2({
|
|
259992
|
-
character: encryptedCharacter(character),
|
|
259993
|
-
plugins: finalPlugins,
|
|
259994
|
-
settings: await loadEnvConfig()
|
|
259995
|
-
});
|
|
259996
|
-
const initWrapper = async (runtime2) => {
|
|
259997
|
-
if (init) {
|
|
259998
|
-
await init(runtime2);
|
|
259999
|
-
}
|
|
260000
|
-
};
|
|
260001
|
-
await initWrapper(runtime);
|
|
260002
|
-
await runtime.initialize();
|
|
260003
|
-
server2.registerAgent(runtime);
|
|
260004
|
-
logger44.log(`Started ${runtime.character.name} as ${runtime.agentId}`);
|
|
260005
|
-
return runtime;
|
|
260006
|
-
}
|
|
260007
|
-
async function stopAgent2(runtime, server2) {
|
|
260008
|
-
await runtime.close();
|
|
260009
|
-
server2.unregisterAgent(runtime.agentId);
|
|
260010
|
-
logger44.success(`Agent ${runtime.character.name} stopped successfully!`);
|
|
260011
|
-
}
|
|
260012
|
-
var init_agent_start = __esm(() => {
|
|
260013
|
-
init_config_utils();
|
|
260014
|
-
init_dependency_resolver();
|
|
260015
|
-
init_plugin_utils();
|
|
260016
|
-
});
|
|
260017
|
-
|
|
260018
|
-
// src/commands/start/actions/server-start.ts
|
|
260019
|
-
import { logger as logger45 } from "@elizaos/core";
|
|
260020
|
-
import path58 from "path";
|
|
260021
|
-
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
260022
|
-
import { existsSync as existsSync40, readFileSync as readFileSync18 } from "fs";
|
|
260023
|
-
async function startAgents(options) {
|
|
260024
|
-
const postgresUrl = await configureDatabaseSettings(options.configure);
|
|
260025
|
-
if (postgresUrl)
|
|
260026
|
-
process.env.POSTGRES_URL = postgresUrl;
|
|
260027
|
-
const pgliteDataDir = postgresUrl ? undefined : await resolvePgliteDir();
|
|
260028
|
-
const moduleLoader = getModuleLoader();
|
|
260029
|
-
const serverModule = await moduleLoader.load("@elizaos/server");
|
|
260030
|
-
const { AgentServer, jsonToCharacter, loadCharacterTryPath } = serverModule;
|
|
260031
|
-
const __filename3 = fileURLToPath9(import.meta.url);
|
|
260032
|
-
const __dirname4 = path58.dirname(__filename3);
|
|
260033
|
-
let cliDistPath = path58.resolve(__dirname4, "../../../");
|
|
260034
|
-
const indexPath = path58.join(cliDistPath, "index.html");
|
|
260035
|
-
if (!existsSync40(indexPath)) {
|
|
260036
|
-
let currentDir = __dirname4;
|
|
260037
|
-
while (currentDir !== path58.dirname(currentDir)) {
|
|
260038
|
-
const packageJsonPath = path58.join(currentDir, "package.json");
|
|
260039
|
-
if (existsSync40(packageJsonPath)) {
|
|
260040
|
-
try {
|
|
260041
|
-
const packageJson = JSON.parse(readFileSync18(packageJsonPath, "utf-8"));
|
|
260042
|
-
if (packageJson.name === "@elizaos/cli") {
|
|
260043
|
-
const distPath = path58.join(currentDir, "dist");
|
|
260044
|
-
if (existsSync40(path58.join(distPath, "index.html"))) {
|
|
260045
|
-
cliDistPath = distPath;
|
|
260046
|
-
break;
|
|
260047
|
-
}
|
|
260048
|
-
}
|
|
260049
|
-
} catch {}
|
|
260050
|
-
}
|
|
260051
|
-
currentDir = path58.dirname(currentDir);
|
|
260052
|
-
}
|
|
260053
|
-
}
|
|
260054
|
-
const server2 = new AgentServer;
|
|
260055
|
-
await server2.initialize({
|
|
260056
|
-
dataDir: pgliteDataDir,
|
|
260057
|
-
postgresUrl: postgresUrl || undefined
|
|
260058
|
-
});
|
|
260059
|
-
server2.startAgent = (character) => startAgent2(character, server2);
|
|
260060
|
-
server2.stopAgent = (runtime) => stopAgent2(runtime, server2);
|
|
260061
|
-
server2.loadCharacterTryPath = loadCharacterTryPath;
|
|
260062
|
-
server2.jsonToCharacter = jsonToCharacter;
|
|
260063
|
-
const desiredPort = options.port || Number.parseInt(process.env.SERVER_PORT || "3000");
|
|
260064
|
-
const serverHost = process.env.SERVER_HOST || "0.0.0.0";
|
|
260065
|
-
const serverPort = await findNextAvailablePort(desiredPort, serverHost);
|
|
260066
|
-
if (serverPort !== desiredPort) {
|
|
260067
|
-
logger45.warn({ desiredPort, serverPort }, "Port is in use, using alternate port");
|
|
260068
|
-
}
|
|
260069
|
-
process.env.SERVER_PORT = serverPort.toString();
|
|
260070
|
-
try {
|
|
260071
|
-
await server2.start(serverPort);
|
|
260072
|
-
} catch (error2) {
|
|
260073
|
-
logger45.error({ error: error2, serverPort }, `Failed to start server on port:`);
|
|
260074
|
-
throw error2;
|
|
260075
|
-
}
|
|
260076
|
-
if (options.projectAgents && options.projectAgents.length > 0) {
|
|
260077
|
-
for (const projectAgent of options.projectAgents) {
|
|
260078
|
-
await startAgent2(projectAgent.character, server2, projectAgent.init, projectAgent.plugins || []);
|
|
260079
|
-
}
|
|
260080
|
-
} else if (options.characters && options.characters.length > 0) {
|
|
260081
|
-
for (const character of options.characters) {
|
|
260082
|
-
await startAgent2(character, server2);
|
|
260083
|
-
}
|
|
260084
|
-
} else {
|
|
260085
|
-
const elizaCharacter = getElizaCharacter();
|
|
260086
|
-
await startAgent2(elizaCharacter, server2);
|
|
260087
|
-
}
|
|
260088
|
-
}
|
|
260089
|
-
var init_server_start = __esm(() => {
|
|
260090
|
-
init_eliza();
|
|
260091
|
-
init_utils();
|
|
260092
|
-
init_module_loader();
|
|
260093
|
-
init_agent_start();
|
|
260094
|
-
});
|
|
260095
|
-
// src/commands/start/index.ts
|
|
260096
|
-
import { logger as logger46 } from "@elizaos/core";
|
|
260097
|
-
import * as fs32 from "fs";
|
|
260098
|
-
import * as path59 from "path";
|
|
260099
|
-
var start;
|
|
260100
|
-
var init_start = __esm(() => {
|
|
260101
|
-
init_project();
|
|
260102
|
-
init_utils();
|
|
260103
|
-
init_build_project();
|
|
260104
|
-
init_dependency_manager();
|
|
260105
|
-
init_directory_detection();
|
|
260106
|
-
init_module_loader();
|
|
260107
|
-
init_esm();
|
|
260108
|
-
init_server_start();
|
|
260109
|
-
init_config_utils();
|
|
260110
|
-
init_agent_start();
|
|
260111
|
-
init_server_start();
|
|
260112
|
-
init_config_utils();
|
|
260113
|
-
init_dependency_resolver();
|
|
260114
|
-
init_plugin_utils();
|
|
260115
|
-
start = new Command().name("start").description("Build and start the Eliza agent server").option("-c, --configure", "Reconfigure services and AI models").option("-p, --port <port>", "Port to listen on", validatePort).option("--character <paths...>", "Character file(s) to use").hook("preAction", async () => {
|
|
260116
|
-
await displayBanner();
|
|
260117
|
-
}).action(async (options) => {
|
|
260118
|
-
try {
|
|
260119
|
-
await loadEnvConfig();
|
|
260120
|
-
await ensureElizaOSCli();
|
|
260121
|
-
const localModulesPath = path59.join(process.cwd(), "node_modules");
|
|
260122
|
-
if (process.env.NODE_PATH) {
|
|
260123
|
-
process.env.NODE_PATH = `${localModulesPath}${path59.delimiter}${process.env.NODE_PATH}`;
|
|
260124
|
-
} else {
|
|
260125
|
-
process.env.NODE_PATH = localModulesPath;
|
|
260126
|
-
}
|
|
260127
|
-
const localBinPath = path59.join(process.cwd(), "node_modules", ".bin");
|
|
260128
|
-
if (process.env.PATH) {
|
|
260129
|
-
process.env.PATH = `${localBinPath}${path59.delimiter}${process.env.PATH}`;
|
|
260130
|
-
} else {
|
|
260131
|
-
process.env.PATH = localBinPath;
|
|
260132
|
-
}
|
|
260133
|
-
if (!process.env.PGLITE_WASM_MODE) {
|
|
260134
|
-
process.env.PGLITE_WASM_MODE = "node";
|
|
260135
|
-
}
|
|
260136
|
-
const cwd = process.cwd();
|
|
260137
|
-
const dirInfo = detectDirectoryType(cwd);
|
|
260138
|
-
const isMonorepo = dirInfo.type === "elizaos-monorepo";
|
|
260139
|
-
if (!isMonorepo && !process.env.ELIZA_TEST_MODE) {
|
|
260140
|
-
try {
|
|
260141
|
-
await buildProject(cwd, false);
|
|
260142
|
-
} catch (error2) {
|
|
260143
|
-
logger46.error("Build error:", error2 instanceof Error ? error2.message : String(error2));
|
|
260144
|
-
logger46.warn("Build failed, but continuing with start. Some features may not work correctly.");
|
|
260145
|
-
}
|
|
260146
|
-
}
|
|
260147
|
-
let characters = [];
|
|
260148
|
-
let projectAgents = [];
|
|
260149
|
-
if (options.character && options.character.length > 0) {
|
|
260150
|
-
const moduleLoader = getModuleLoader();
|
|
260151
|
-
const serverModule = await moduleLoader.load("@elizaos/server");
|
|
260152
|
-
const { loadCharacterTryPath } = serverModule;
|
|
260153
|
-
for (const charPath of options.character) {
|
|
260154
|
-
const resolvedPath = path59.resolve(charPath);
|
|
260155
|
-
if (!fs32.existsSync(resolvedPath)) {
|
|
260156
|
-
logger46.error(`Character file not found: ${resolvedPath}`);
|
|
260157
|
-
throw new Error(`Character file not found: ${resolvedPath}`);
|
|
260158
|
-
}
|
|
260159
|
-
try {
|
|
260160
|
-
const character = await loadCharacterTryPath(resolvedPath);
|
|
260161
|
-
if (character) {
|
|
260162
|
-
characters.push(character);
|
|
260163
|
-
logger46.info(`Successfully loaded character: ${character.name}`);
|
|
260164
|
-
} else {
|
|
260165
|
-
logger46.error(`Failed to load character from ${resolvedPath}: Invalid or empty character file`);
|
|
260166
|
-
throw new Error(`Invalid character file: ${resolvedPath}`);
|
|
260167
|
-
}
|
|
260168
|
-
} catch (e2) {
|
|
260169
|
-
logger46.error({ error: e2, resolvedPath }, `Failed to load character from path:`);
|
|
260170
|
-
throw new Error(`Invalid character file: ${resolvedPath}`);
|
|
260171
|
-
}
|
|
260172
|
-
}
|
|
260173
|
-
} else {
|
|
260174
|
-
try {
|
|
260175
|
-
const cwd2 = process.cwd();
|
|
260176
|
-
const dirInfo2 = detectDirectoryType(cwd2);
|
|
260177
|
-
if (dirInfo2.hasPackageJson && dirInfo2.type !== "non-elizaos-dir") {
|
|
260178
|
-
logger46.info("No character files specified, attempting to load project agents...");
|
|
260179
|
-
const project = await loadProject(cwd2);
|
|
260180
|
-
if (project.agents && project.agents.length > 0) {
|
|
260181
|
-
logger46.info(`Found ${project.agents.length} agent(s) in project configuration`);
|
|
260182
|
-
projectAgents = project.agents;
|
|
260183
|
-
for (const agent2 of project.agents) {
|
|
260184
|
-
if (agent2.character) {
|
|
260185
|
-
logger46.info(`Loaded character: ${agent2.character.name}`);
|
|
260186
|
-
}
|
|
260187
|
-
}
|
|
260188
|
-
}
|
|
260189
|
-
}
|
|
260190
|
-
} catch (e2) {
|
|
260191
|
-
logger46.debug({ error: e2 }, "Failed to load project agents, will use default character:");
|
|
260192
|
-
}
|
|
260193
|
-
}
|
|
260194
|
-
await startAgents({ ...options, characters, projectAgents });
|
|
260195
|
-
} catch (e2) {
|
|
260196
|
-
handleError(e2);
|
|
260197
|
-
process.exit(1);
|
|
260198
|
-
}
|
|
260199
|
-
});
|
|
260200
|
-
});
|
|
260201
|
-
|
|
260202
259239
|
// ../../node_modules/js-yaml/dist/js-yaml.mjs
|
|
260203
259240
|
var exports_js_yaml = {};
|
|
260204
259241
|
__export(exports_js_yaml, {
|
|
@@ -262862,61 +261899,6 @@ var init_js_yaml = __esm(() => {
|
|
|
262862
261899
|
js_yaml_default = jsYaml;
|
|
262863
261900
|
});
|
|
262864
261901
|
|
|
262865
|
-
// src/commands/scenario/src/env-loader.ts
|
|
262866
|
-
import fs37 from "fs";
|
|
262867
|
-
import path65 from "path";
|
|
262868
|
-
function loadEnvironmentVariables() {
|
|
262869
|
-
const possibleEnvPaths = [
|
|
262870
|
-
path65.join(process.cwd(), ".env"),
|
|
262871
|
-
path65.join(__dirname, "..", "..", ".env"),
|
|
262872
|
-
path65.join(__dirname, "..", "..", "..", "..", ".env")
|
|
262873
|
-
];
|
|
262874
|
-
let loadedFrom = null;
|
|
262875
|
-
for (const envPath of possibleEnvPaths) {
|
|
262876
|
-
if (fs37.existsSync(envPath)) {
|
|
262877
|
-
console.log(`[ENV] Loading environment from: ${envPath}`);
|
|
262878
|
-
const envFileContent = fs37.readFileSync(envPath);
|
|
262879
|
-
const parsedEnv = import_dotenv5.default.parse(envFileContent);
|
|
262880
|
-
for (const key in parsedEnv) {
|
|
262881
|
-
if (process.env[key] === undefined) {
|
|
262882
|
-
process.env[key] = parsedEnv[key];
|
|
262883
|
-
}
|
|
262884
|
-
}
|
|
262885
|
-
loadedFrom = envPath;
|
|
262886
|
-
console.log(`[ENV] Environment loaded with ${Object.keys(parsedEnv).length} variables`);
|
|
262887
|
-
break;
|
|
262888
|
-
}
|
|
262889
|
-
}
|
|
262890
|
-
if (!loadedFrom) {
|
|
262891
|
-
console.log("[ENV] No .env file found in any of the expected locations");
|
|
262892
|
-
}
|
|
262893
|
-
const criticalVars = ["OPENAI_API_KEY"];
|
|
262894
|
-
for (const varName of criticalVars) {
|
|
262895
|
-
if (process.env[varName]) {
|
|
262896
|
-
const valuePreview = (process.env[varName] || "").toString();
|
|
262897
|
-
const redacted = valuePreview.length > 8 ? `${valuePreview.slice(0, 4)}****${valuePreview.slice(-4)}` : "****";
|
|
262898
|
-
console.log(`[ENV] ${varName} found in process.env: ${redacted}`);
|
|
262899
|
-
} else {
|
|
262900
|
-
console.log(`[ENV] \u26A0\uFE0F ${varName} not found in process.env`);
|
|
262901
|
-
}
|
|
262902
|
-
}
|
|
262903
|
-
const safeKeys = ["NODE_ENV", "OPENAI_API_KEY"];
|
|
262904
|
-
const safeEnv = {};
|
|
262905
|
-
for (const key of safeKeys) {
|
|
262906
|
-
if (process.env[key]) {
|
|
262907
|
-
const val = process.env[key];
|
|
262908
|
-
safeEnv[key] = val.length > 8 ? `${val.slice(0, 4)}****${val.slice(-4)}` : "****";
|
|
262909
|
-
} else {
|
|
262910
|
-
safeEnv[key] = "<missing>";
|
|
262911
|
-
}
|
|
262912
|
-
}
|
|
262913
|
-
console.log("[ENV] Safe env preview:", JSON.stringify(safeEnv));
|
|
262914
|
-
}
|
|
262915
|
-
var import_dotenv5, __dirname = "/home/runner/work/eliza/eliza/packages/cli/src/commands/scenario/src";
|
|
262916
|
-
var init_env_loader = __esm(() => {
|
|
262917
|
-
import_dotenv5 = __toESM(require_main(), 1);
|
|
262918
|
-
});
|
|
262919
|
-
|
|
262920
261902
|
// src/commands/scenario/src/process-manager.ts
|
|
262921
261903
|
var exports_process_manager = {};
|
|
262922
261904
|
__export(exports_process_manager, {
|
|
@@ -263066,24 +262048,13 @@ __export(exports_runtime_factory, {
|
|
|
263066
262048
|
createScenarioAgent: () => createScenarioAgent,
|
|
263067
262049
|
askAgentViaApi: () => askAgentViaApi
|
|
263068
262050
|
});
|
|
263069
|
-
import { stringToUuid as
|
|
263070
|
-
import { AgentServer } from "@elizaos/server";
|
|
262051
|
+
import { stringToUuid as stringToUuid2 } from "@elizaos/core";
|
|
262052
|
+
import { AgentServer, ConfigManager } from "@elizaos/server";
|
|
263071
262053
|
import { ElizaClient } from "@elizaos/api-client";
|
|
263072
262054
|
import { ChannelType, stringToUuid as stringToUuidCore } from "@elizaos/core";
|
|
263073
|
-
import
|
|
263074
|
-
import
|
|
262055
|
+
import fs37 from "fs";
|
|
262056
|
+
import path64 from "path";
|
|
263075
262057
|
import { createServer } from "net";
|
|
263076
|
-
function ensureEnvLoaded() {
|
|
263077
|
-
if (!envLoaded) {
|
|
263078
|
-
loadEnvironmentVariables();
|
|
263079
|
-
envSettings = process.env;
|
|
263080
|
-
envLoaded = true;
|
|
263081
|
-
}
|
|
263082
|
-
if (!envSettings) {
|
|
263083
|
-
throw new Error("Failed to load environment settings");
|
|
263084
|
-
}
|
|
263085
|
-
return envSettings;
|
|
263086
|
-
}
|
|
263087
262058
|
async function findAvailablePort(startPort, endPort, host) {
|
|
263088
262059
|
const serverHost = host || process.env.SERVER_HOST || "0.0.0.0";
|
|
263089
262060
|
console.log(`\uD83D\uDD27 [DEBUG] Searching for available port in range ${startPort}-${endPort} on host ${serverHost}...`);
|
|
@@ -263137,16 +262108,13 @@ async function createScenarioServer(existingServer = null, desiredPort = 3000) {
|
|
|
263137
262108
|
server2 = existingServer;
|
|
263138
262109
|
} else {
|
|
263139
262110
|
server2 = new AgentServer;
|
|
263140
|
-
const pgliteRoot = process.env.PGLITE_DATA_DIR ||
|
|
263141
|
-
const uniqueDataDir =
|
|
262111
|
+
const pgliteRoot = process.env.PGLITE_DATA_DIR || path64.join(process.cwd(), ".eliza", ".elizadb");
|
|
262112
|
+
const uniqueDataDir = path64.join(pgliteRoot, `scenario-${Date.now()}-${Math.random().toString(36).slice(2)}`);
|
|
263142
262113
|
try {
|
|
263143
|
-
|
|
262114
|
+
fs37.mkdirSync(uniqueDataDir, { recursive: true });
|
|
263144
262115
|
} catch {}
|
|
263145
262116
|
process.env.PGLITE_DATA_DIR = uniqueDataDir;
|
|
263146
262117
|
await server2.initialize({ dataDir: uniqueDataDir });
|
|
263147
|
-
const { startAgent: serverStartAgent, stopAgent: serverStopAgent } = await Promise.resolve().then(() => (init_agent_start(), exports_agent_start));
|
|
263148
|
-
server2.startAgent = (character) => serverStartAgent(character, server2);
|
|
263149
|
-
server2.stopAgent = (runtime) => serverStopAgent(runtime, server2);
|
|
263150
262118
|
await server2.start(port);
|
|
263151
262119
|
createdServer = true;
|
|
263152
262120
|
process.env.SERVER_PORT = port.toString();
|
|
@@ -263180,13 +262148,11 @@ async function createScenarioAgent(server2, agentName = "scenario-agent", plugin
|
|
|
263180
262148
|
console.log(`\uD83D\uDD27 [DEBUG] createScenarioAgent called for agent: ${agentName}, plugins: ${pluginNames.join(", ")}`);
|
|
263181
262149
|
const character = {
|
|
263182
262150
|
name: agentName,
|
|
263183
|
-
id:
|
|
262151
|
+
id: stringToUuid2(agentName),
|
|
263184
262152
|
bio: "A test agent for scenario execution",
|
|
263185
262153
|
plugins: pluginNames,
|
|
263186
262154
|
settings: {
|
|
263187
|
-
secrets: {
|
|
263188
|
-
...ensureEnvLoaded()
|
|
263189
|
-
}
|
|
262155
|
+
secrets: {}
|
|
263190
262156
|
},
|
|
263191
262157
|
system: "Always respond to every message, even if the input is unclear or empty. Never ignore a user message.",
|
|
263192
262158
|
topics: ["testing", "scenarios", "automation"],
|
|
@@ -263196,8 +262162,12 @@ async function createScenarioAgent(server2, agentName = "scenario-agent", plugin
|
|
|
263196
262162
|
chat: ["Direct", "Helpful"]
|
|
263197
262163
|
}
|
|
263198
262164
|
};
|
|
263199
|
-
|
|
263200
|
-
|
|
262165
|
+
const configManager = new ConfigManager;
|
|
262166
|
+
await configManager.setDefaultSecretsFromEnv(character);
|
|
262167
|
+
const [runtime] = await server2.startAgents([character]);
|
|
262168
|
+
if (!runtime) {
|
|
262169
|
+
throw new Error(`Failed to start agent: ${character.name}`);
|
|
262170
|
+
}
|
|
263201
262171
|
const agentId = runtime.character.id;
|
|
263202
262172
|
return { runtime, agentId };
|
|
263203
262173
|
}
|
|
@@ -263389,10 +262359,7 @@ async function askAgentViaApi(server2, agentId, input2, timeoutMs = 60000, serve
|
|
|
263389
262359
|
throw error2;
|
|
263390
262360
|
}
|
|
263391
262361
|
}
|
|
263392
|
-
var envSettings = null, envLoaded = false;
|
|
263393
262362
|
var init_runtime_factory = __esm(() => {
|
|
263394
|
-
init_env_loader();
|
|
263395
|
-
init_start();
|
|
263396
262363
|
init_process_manager();
|
|
263397
262364
|
});
|
|
263398
262365
|
|
|
@@ -264105,7 +263072,7 @@ class EnhancedFileExistsEvaluator {
|
|
|
264105
263072
|
const expectedPath = params.path;
|
|
264106
263073
|
const createdFiles = Object.keys(runResult.files);
|
|
264107
263074
|
const success = createdFiles.includes(expectedPath) || createdFiles.includes(`./${expectedPath}`) || createdFiles.includes(expectedPath.replace(/^\.\//, ""));
|
|
264108
|
-
const matchingPath = createdFiles.find((
|
|
263075
|
+
const matchingPath = createdFiles.find((path65) => path65 === expectedPath || path65 === `./${expectedPath}` || path65 === expectedPath.replace(/^\.\//, ""));
|
|
264109
263076
|
return {
|
|
264110
263077
|
evaluator_type: "file_exists",
|
|
264111
263078
|
success,
|
|
@@ -265148,8 +264115,8 @@ var exports_LocalEnvironmentProvider = {};
|
|
|
265148
264115
|
__export(exports_LocalEnvironmentProvider, {
|
|
265149
264116
|
LocalEnvironmentProvider: () => LocalEnvironmentProvider
|
|
265150
264117
|
});
|
|
265151
|
-
import
|
|
265152
|
-
import
|
|
264118
|
+
import fs38 from "fs/promises";
|
|
264119
|
+
import path65 from "path";
|
|
265153
264120
|
import os10 from "os";
|
|
265154
264121
|
|
|
265155
264122
|
class LocalEnvironmentProvider {
|
|
@@ -265173,14 +264140,14 @@ class LocalEnvironmentProvider {
|
|
|
265173
264140
|
console.log(`\uD83D\uDD27 [DEBUG] - Server Port: ${serverPort}`);
|
|
265174
264141
|
}
|
|
265175
264142
|
async setup(scenario) {
|
|
265176
|
-
const tempDirPrefix =
|
|
265177
|
-
this.tempDir = await
|
|
264143
|
+
const tempDirPrefix = path65.join(os10.tmpdir(), "eliza-scenario-run-");
|
|
264144
|
+
this.tempDir = await fs38.mkdtemp(tempDirPrefix);
|
|
265178
264145
|
const virtualFs = scenario.setup?.virtual_fs;
|
|
265179
264146
|
if (virtualFs) {
|
|
265180
264147
|
for (const [filePath, content] of Object.entries(virtualFs)) {
|
|
265181
|
-
const fullPath =
|
|
265182
|
-
await
|
|
265183
|
-
await
|
|
264148
|
+
const fullPath = path65.join(this.tempDir, filePath);
|
|
264149
|
+
await fs38.mkdir(path65.dirname(fullPath), { recursive: true });
|
|
264150
|
+
await fs38.writeFile(fullPath, content);
|
|
265184
264151
|
}
|
|
265185
264152
|
}
|
|
265186
264153
|
}
|
|
@@ -265191,15 +264158,15 @@ class LocalEnvironmentProvider {
|
|
|
265191
264158
|
const files = {};
|
|
265192
264159
|
try {
|
|
265193
264160
|
const readDirRecursive = async (dirPath, basePath = "") => {
|
|
265194
|
-
const entries = await
|
|
264161
|
+
const entries = await fs38.readdir(dirPath, { withFileTypes: true });
|
|
265195
264162
|
for (const entry of entries) {
|
|
265196
|
-
const fullPath =
|
|
265197
|
-
const relativePath =
|
|
264163
|
+
const fullPath = path65.join(dirPath, entry.name);
|
|
264164
|
+
const relativePath = path65.join(basePath, entry.name);
|
|
265198
264165
|
if (entry.isDirectory()) {
|
|
265199
264166
|
await readDirRecursive(fullPath, relativePath);
|
|
265200
264167
|
} else if (entry.isFile()) {
|
|
265201
264168
|
try {
|
|
265202
|
-
const content = await
|
|
264169
|
+
const content = await fs38.readFile(fullPath, "utf-8");
|
|
265203
264170
|
files[relativePath] = content;
|
|
265204
264171
|
} catch (error2) {
|
|
265205
264172
|
files[relativePath] = "[binary or unreadable]";
|
|
@@ -265348,7 +264315,7 @@ class LocalEnvironmentProvider {
|
|
|
265348
264315
|
}
|
|
265349
264316
|
async teardown() {
|
|
265350
264317
|
if (this.tempDir) {
|
|
265351
|
-
await
|
|
264318
|
+
await fs38.rm(this.tempDir, { recursive: true, force: true });
|
|
265352
264319
|
this.tempDir = null;
|
|
265353
264320
|
}
|
|
265354
264321
|
}
|
|
@@ -266637,11 +265604,11 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
266637
265604
|
return isFunction2(object[key]);
|
|
266638
265605
|
});
|
|
266639
265606
|
}
|
|
266640
|
-
function baseGet(object,
|
|
266641
|
-
|
|
266642
|
-
var index = 0, length =
|
|
265607
|
+
function baseGet(object, path66) {
|
|
265608
|
+
path66 = castPath(path66, object);
|
|
265609
|
+
var index = 0, length = path66.length;
|
|
266643
265610
|
while (object != null && index < length) {
|
|
266644
|
-
object = object[toKey(
|
|
265611
|
+
object = object[toKey(path66[index++])];
|
|
266645
265612
|
}
|
|
266646
265613
|
return index && index == length ? object : undefined2;
|
|
266647
265614
|
}
|
|
@@ -266705,10 +265672,10 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
266705
265672
|
});
|
|
266706
265673
|
return accumulator;
|
|
266707
265674
|
}
|
|
266708
|
-
function baseInvoke(object,
|
|
266709
|
-
|
|
266710
|
-
object = parent(object,
|
|
266711
|
-
var func = object == null ? object : object[toKey(last2(
|
|
265675
|
+
function baseInvoke(object, path66, args) {
|
|
265676
|
+
path66 = castPath(path66, object);
|
|
265677
|
+
object = parent(object, path66);
|
|
265678
|
+
var func = object == null ? object : object[toKey(last2(path66))];
|
|
266712
265679
|
return func == null ? undefined2 : apply(func, object, args);
|
|
266713
265680
|
}
|
|
266714
265681
|
function baseIsArguments(value) {
|
|
@@ -266864,13 +265831,13 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
266864
265831
|
return object === source2 || baseIsMatch(object, source2, matchData);
|
|
266865
265832
|
};
|
|
266866
265833
|
}
|
|
266867
|
-
function baseMatchesProperty(
|
|
266868
|
-
if (isKey(
|
|
266869
|
-
return matchesStrictComparable(toKey(
|
|
265834
|
+
function baseMatchesProperty(path66, srcValue) {
|
|
265835
|
+
if (isKey(path66) && isStrictComparable(srcValue)) {
|
|
265836
|
+
return matchesStrictComparable(toKey(path66), srcValue);
|
|
266870
265837
|
}
|
|
266871
265838
|
return function(object) {
|
|
266872
|
-
var objValue = get(object,
|
|
266873
|
-
return objValue === undefined2 && objValue === srcValue ? hasIn(object,
|
|
265839
|
+
var objValue = get(object, path66);
|
|
265840
|
+
return objValue === undefined2 && objValue === srcValue ? hasIn(object, path66) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
|
|
266874
265841
|
};
|
|
266875
265842
|
}
|
|
266876
265843
|
function baseMerge(object, source2, srcIndex, customizer, stack) {
|
|
@@ -266967,23 +265934,23 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
266967
265934
|
});
|
|
266968
265935
|
}
|
|
266969
265936
|
function basePick(object, paths) {
|
|
266970
|
-
return basePickBy(object, paths, function(value,
|
|
266971
|
-
return hasIn(object,
|
|
265937
|
+
return basePickBy(object, paths, function(value, path66) {
|
|
265938
|
+
return hasIn(object, path66);
|
|
266972
265939
|
});
|
|
266973
265940
|
}
|
|
266974
265941
|
function basePickBy(object, paths, predicate) {
|
|
266975
265942
|
var index = -1, length = paths.length, result2 = {};
|
|
266976
265943
|
while (++index < length) {
|
|
266977
|
-
var
|
|
266978
|
-
if (predicate(value,
|
|
266979
|
-
baseSet(result2, castPath(
|
|
265944
|
+
var path66 = paths[index], value = baseGet(object, path66);
|
|
265945
|
+
if (predicate(value, path66)) {
|
|
265946
|
+
baseSet(result2, castPath(path66, object), value);
|
|
266980
265947
|
}
|
|
266981
265948
|
}
|
|
266982
265949
|
return result2;
|
|
266983
265950
|
}
|
|
266984
|
-
function basePropertyDeep(
|
|
265951
|
+
function basePropertyDeep(path66) {
|
|
266985
265952
|
return function(object) {
|
|
266986
|
-
return baseGet(object,
|
|
265953
|
+
return baseGet(object, path66);
|
|
266987
265954
|
};
|
|
266988
265955
|
}
|
|
266989
265956
|
function basePullAll(array, values2, iteratee2, comparator) {
|
|
@@ -267057,14 +266024,14 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
267057
266024
|
var array = values(collection);
|
|
267058
266025
|
return shuffleSelf(array, baseClamp(n, 0, array.length));
|
|
267059
266026
|
}
|
|
267060
|
-
function baseSet(object,
|
|
266027
|
+
function baseSet(object, path66, value, customizer) {
|
|
267061
266028
|
if (!isObject2(object)) {
|
|
267062
266029
|
return object;
|
|
267063
266030
|
}
|
|
267064
|
-
|
|
267065
|
-
var index = -1, length =
|
|
266031
|
+
path66 = castPath(path66, object);
|
|
266032
|
+
var index = -1, length = path66.length, lastIndex = length - 1, nested = object;
|
|
267066
266033
|
while (nested != null && ++index < length) {
|
|
267067
|
-
var key = toKey(
|
|
266034
|
+
var key = toKey(path66[index]), newValue = value;
|
|
267068
266035
|
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
267069
266036
|
return object;
|
|
267070
266037
|
}
|
|
@@ -267072,7 +266039,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
267072
266039
|
var objValue = nested[key];
|
|
267073
266040
|
newValue = customizer ? customizer(objValue, key, nested) : undefined2;
|
|
267074
266041
|
if (newValue === undefined2) {
|
|
267075
|
-
newValue = isObject2(objValue) ? objValue : isIndex(
|
|
266042
|
+
newValue = isObject2(objValue) ? objValue : isIndex(path66[index + 1]) ? [] : {};
|
|
267076
266043
|
}
|
|
267077
266044
|
}
|
|
267078
266045
|
assignValue(nested, key, newValue);
|
|
@@ -267238,13 +266205,13 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
267238
266205
|
}
|
|
267239
266206
|
return result2;
|
|
267240
266207
|
}
|
|
267241
|
-
function baseUnset(object,
|
|
267242
|
-
|
|
267243
|
-
object = parent(object,
|
|
267244
|
-
return object == null || delete object[toKey(last2(
|
|
266208
|
+
function baseUnset(object, path66) {
|
|
266209
|
+
path66 = castPath(path66, object);
|
|
266210
|
+
object = parent(object, path66);
|
|
266211
|
+
return object == null || delete object[toKey(last2(path66))];
|
|
267245
266212
|
}
|
|
267246
|
-
function baseUpdate(object,
|
|
267247
|
-
return baseSet(object,
|
|
266213
|
+
function baseUpdate(object, path66, updater, customizer) {
|
|
266214
|
+
return baseSet(object, path66, updater(baseGet(object, path66)), customizer);
|
|
267248
266215
|
}
|
|
267249
266216
|
function baseWhile(array, predicate, isDrop, fromRight) {
|
|
267250
266217
|
var length = array.length, index = fromRight ? length : -1;
|
|
@@ -268103,11 +267070,11 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
268103
267070
|
var match2 = source2.match(reWrapDetails);
|
|
268104
267071
|
return match2 ? match2[1].split(reSplitDetails) : [];
|
|
268105
267072
|
}
|
|
268106
|
-
function hasPath(object,
|
|
268107
|
-
|
|
268108
|
-
var index = -1, length =
|
|
267073
|
+
function hasPath(object, path66, hasFunc) {
|
|
267074
|
+
path66 = castPath(path66, object);
|
|
267075
|
+
var index = -1, length = path66.length, result2 = false;
|
|
268109
267076
|
while (++index < length) {
|
|
268110
|
-
var key = toKey(
|
|
267077
|
+
var key = toKey(path66[index]);
|
|
268111
267078
|
if (!(result2 = object != null && hasFunc(object, key))) {
|
|
268112
267079
|
break;
|
|
268113
267080
|
}
|
|
@@ -268311,8 +267278,8 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
268311
267278
|
return apply(func, this, otherArgs);
|
|
268312
267279
|
};
|
|
268313
267280
|
}
|
|
268314
|
-
function parent(object,
|
|
268315
|
-
return
|
|
267281
|
+
function parent(object, path66) {
|
|
267282
|
+
return path66.length < 2 ? object : baseGet(object, baseSlice(path66, 0, -1));
|
|
268316
267283
|
}
|
|
268317
267284
|
function reorder(array, indexes) {
|
|
268318
267285
|
var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array);
|
|
@@ -268945,10 +267912,10 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
268945
267912
|
}
|
|
268946
267913
|
return isString2(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
|
|
268947
267914
|
}
|
|
268948
|
-
var invokeMap = baseRest(function(collection,
|
|
268949
|
-
var index = -1, isFunc = typeof
|
|
267915
|
+
var invokeMap = baseRest(function(collection, path66, args) {
|
|
267916
|
+
var index = -1, isFunc = typeof path66 == "function", result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
|
|
268950
267917
|
baseEach(collection, function(value) {
|
|
268951
|
-
result2[++index] = isFunc ? apply(
|
|
267918
|
+
result2[++index] = isFunc ? apply(path66, value, args) : baseInvoke(value, path66, args);
|
|
268952
267919
|
});
|
|
268953
267920
|
return result2;
|
|
268954
267921
|
});
|
|
@@ -269600,15 +268567,15 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
269600
268567
|
function functionsIn(object) {
|
|
269601
268568
|
return object == null ? [] : baseFunctions(object, keysIn(object));
|
|
269602
268569
|
}
|
|
269603
|
-
function get(object,
|
|
269604
|
-
var result2 = object == null ? undefined2 : baseGet(object,
|
|
268570
|
+
function get(object, path66, defaultValue) {
|
|
268571
|
+
var result2 = object == null ? undefined2 : baseGet(object, path66);
|
|
269605
268572
|
return result2 === undefined2 ? defaultValue : result2;
|
|
269606
268573
|
}
|
|
269607
|
-
function has(object,
|
|
269608
|
-
return object != null && hasPath(object,
|
|
268574
|
+
function has(object, path66) {
|
|
268575
|
+
return object != null && hasPath(object, path66, baseHas);
|
|
269609
268576
|
}
|
|
269610
|
-
function hasIn(object,
|
|
269611
|
-
return object != null && hasPath(object,
|
|
268577
|
+
function hasIn(object, path66) {
|
|
268578
|
+
return object != null && hasPath(object, path66, baseHasIn);
|
|
269612
268579
|
}
|
|
269613
268580
|
var invert = createInverter(function(result2, value, key) {
|
|
269614
268581
|
if (value != null && typeof value.toString != "function") {
|
|
@@ -269661,10 +268628,10 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
269661
268628
|
return result2;
|
|
269662
268629
|
}
|
|
269663
268630
|
var isDeep = false;
|
|
269664
|
-
paths = arrayMap(paths, function(
|
|
269665
|
-
|
|
269666
|
-
isDeep || (isDeep =
|
|
269667
|
-
return
|
|
268631
|
+
paths = arrayMap(paths, function(path66) {
|
|
268632
|
+
path66 = castPath(path66, object);
|
|
268633
|
+
isDeep || (isDeep = path66.length > 1);
|
|
268634
|
+
return path66;
|
|
269668
268635
|
});
|
|
269669
268636
|
copyObject(object, getAllKeysIn(object), result2);
|
|
269670
268637
|
if (isDeep) {
|
|
@@ -269690,19 +268657,19 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
269690
268657
|
return [prop];
|
|
269691
268658
|
});
|
|
269692
268659
|
predicate = getIteratee(predicate);
|
|
269693
|
-
return basePickBy(object, props, function(value,
|
|
269694
|
-
return predicate(value,
|
|
268660
|
+
return basePickBy(object, props, function(value, path66) {
|
|
268661
|
+
return predicate(value, path66[0]);
|
|
269695
268662
|
});
|
|
269696
268663
|
}
|
|
269697
|
-
function result(object,
|
|
269698
|
-
|
|
269699
|
-
var index = -1, length =
|
|
268664
|
+
function result(object, path66, defaultValue) {
|
|
268665
|
+
path66 = castPath(path66, object);
|
|
268666
|
+
var index = -1, length = path66.length;
|
|
269700
268667
|
if (!length) {
|
|
269701
268668
|
length = 1;
|
|
269702
268669
|
object = undefined2;
|
|
269703
268670
|
}
|
|
269704
268671
|
while (++index < length) {
|
|
269705
|
-
var value = object == null ? undefined2 : object[toKey(
|
|
268672
|
+
var value = object == null ? undefined2 : object[toKey(path66[index])];
|
|
269706
268673
|
if (value === undefined2) {
|
|
269707
268674
|
index = length;
|
|
269708
268675
|
value = defaultValue;
|
|
@@ -269711,12 +268678,12 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
269711
268678
|
}
|
|
269712
268679
|
return object;
|
|
269713
268680
|
}
|
|
269714
|
-
function set2(object,
|
|
269715
|
-
return object == null ? object : baseSet(object,
|
|
268681
|
+
function set2(object, path66, value) {
|
|
268682
|
+
return object == null ? object : baseSet(object, path66, value);
|
|
269716
268683
|
}
|
|
269717
|
-
function setWith(object,
|
|
268684
|
+
function setWith(object, path66, value, customizer) {
|
|
269718
268685
|
customizer = typeof customizer == "function" ? customizer : undefined2;
|
|
269719
|
-
return object == null ? object : baseSet(object,
|
|
268686
|
+
return object == null ? object : baseSet(object, path66, value, customizer);
|
|
269720
268687
|
}
|
|
269721
268688
|
var toPairs = createToPairs(keys);
|
|
269722
268689
|
var toPairsIn = createToPairs(keysIn);
|
|
@@ -269738,15 +268705,15 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
269738
268705
|
});
|
|
269739
268706
|
return accumulator;
|
|
269740
268707
|
}
|
|
269741
|
-
function unset(object,
|
|
269742
|
-
return object == null ? true : baseUnset(object,
|
|
268708
|
+
function unset(object, path66) {
|
|
268709
|
+
return object == null ? true : baseUnset(object, path66);
|
|
269743
268710
|
}
|
|
269744
|
-
function update2(object,
|
|
269745
|
-
return object == null ? object : baseUpdate(object,
|
|
268711
|
+
function update2(object, path66, updater) {
|
|
268712
|
+
return object == null ? object : baseUpdate(object, path66, castFunction(updater));
|
|
269746
268713
|
}
|
|
269747
|
-
function updateWith(object,
|
|
268714
|
+
function updateWith(object, path66, updater, customizer) {
|
|
269748
268715
|
customizer = typeof customizer == "function" ? customizer : undefined2;
|
|
269749
|
-
return object == null ? object : baseUpdate(object,
|
|
268716
|
+
return object == null ? object : baseUpdate(object, path66, castFunction(updater), customizer);
|
|
269750
268717
|
}
|
|
269751
268718
|
function values(object) {
|
|
269752
268719
|
return object == null ? [] : baseValues(object, keys(object));
|
|
@@ -270141,17 +269108,17 @@ __p += '`;
|
|
|
270141
269108
|
function matches(source2) {
|
|
270142
269109
|
return baseMatches(baseClone(source2, CLONE_DEEP_FLAG));
|
|
270143
269110
|
}
|
|
270144
|
-
function matchesProperty(
|
|
270145
|
-
return baseMatchesProperty(
|
|
269111
|
+
function matchesProperty(path66, srcValue) {
|
|
269112
|
+
return baseMatchesProperty(path66, baseClone(srcValue, CLONE_DEEP_FLAG));
|
|
270146
269113
|
}
|
|
270147
|
-
var method = baseRest(function(
|
|
269114
|
+
var method = baseRest(function(path66, args) {
|
|
270148
269115
|
return function(object) {
|
|
270149
|
-
return baseInvoke(object,
|
|
269116
|
+
return baseInvoke(object, path66, args);
|
|
270150
269117
|
};
|
|
270151
269118
|
});
|
|
270152
269119
|
var methodOf = baseRest(function(object, args) {
|
|
270153
|
-
return function(
|
|
270154
|
-
return baseInvoke(object,
|
|
269120
|
+
return function(path66) {
|
|
269121
|
+
return baseInvoke(object, path66, args);
|
|
270155
269122
|
};
|
|
270156
269123
|
});
|
|
270157
269124
|
function mixin3(object, source2, options) {
|
|
@@ -270197,12 +269164,12 @@ __p += '`;
|
|
|
270197
269164
|
var over = createOver(arrayMap);
|
|
270198
269165
|
var overEvery = createOver(arrayEvery);
|
|
270199
269166
|
var overSome = createOver(arraySome);
|
|
270200
|
-
function property(
|
|
270201
|
-
return isKey(
|
|
269167
|
+
function property(path66) {
|
|
269168
|
+
return isKey(path66) ? baseProperty(toKey(path66)) : basePropertyDeep(path66);
|
|
270202
269169
|
}
|
|
270203
269170
|
function propertyOf(object) {
|
|
270204
|
-
return function(
|
|
270205
|
-
return object == null ? undefined2 : baseGet(object,
|
|
269171
|
+
return function(path66) {
|
|
269172
|
+
return object == null ? undefined2 : baseGet(object, path66);
|
|
270206
269173
|
};
|
|
270207
269174
|
}
|
|
270208
269175
|
var range2 = createRange();
|
|
@@ -270655,12 +269622,12 @@ __p += '`;
|
|
|
270655
269622
|
LazyWrapper.prototype.findLast = function(predicate) {
|
|
270656
269623
|
return this.reverse().find(predicate);
|
|
270657
269624
|
};
|
|
270658
|
-
LazyWrapper.prototype.invokeMap = baseRest(function(
|
|
270659
|
-
if (typeof
|
|
269625
|
+
LazyWrapper.prototype.invokeMap = baseRest(function(path66, args) {
|
|
269626
|
+
if (typeof path66 == "function") {
|
|
270660
269627
|
return new LazyWrapper(this);
|
|
270661
269628
|
}
|
|
270662
269629
|
return this.map(function(value) {
|
|
270663
|
-
return baseInvoke(value,
|
|
269630
|
+
return baseInvoke(value, path66, args);
|
|
270664
269631
|
});
|
|
270665
269632
|
});
|
|
270666
269633
|
LazyWrapper.prototype.reject = function(predicate) {
|
|
@@ -271034,14 +270001,14 @@ function formatDuration(seconds) {
|
|
|
271034
270001
|
}
|
|
271035
270002
|
|
|
271036
270003
|
// src/commands/scenario/src/path-parser.ts
|
|
271037
|
-
function parseParameterPath(
|
|
271038
|
-
if (pathCache.has(
|
|
271039
|
-
return pathCache.get(
|
|
270004
|
+
function parseParameterPath(path66) {
|
|
270005
|
+
if (pathCache.has(path66)) {
|
|
270006
|
+
return pathCache.get(path66);
|
|
271040
270007
|
}
|
|
271041
|
-
if (!
|
|
270008
|
+
if (!path66 || typeof path66 !== "string") {
|
|
271042
270009
|
throw new Error("Path must be a non-empty string");
|
|
271043
270010
|
}
|
|
271044
|
-
if (
|
|
270011
|
+
if (path66.startsWith(".") || path66.endsWith(".")) {
|
|
271045
270012
|
throw new Error("Path cannot start or end with a dot");
|
|
271046
270013
|
}
|
|
271047
270014
|
const segments = [];
|
|
@@ -271049,8 +270016,8 @@ function parseParameterPath(path68) {
|
|
|
271049
270016
|
let currentSegment = "";
|
|
271050
270017
|
let i2 = 0;
|
|
271051
270018
|
let lastCharWasArrayClose = false;
|
|
271052
|
-
while (i2 <
|
|
271053
|
-
const char =
|
|
270019
|
+
while (i2 < path66.length) {
|
|
270020
|
+
const char = path66[i2];
|
|
271054
270021
|
if (char === ".") {
|
|
271055
270022
|
if (currentSegment === "" && !lastCharWasArrayClose) {
|
|
271056
270023
|
throw new Error("Empty segment in path (double dots or leading/trailing dots not allowed)");
|
|
@@ -271067,11 +270034,11 @@ function parseParameterPath(path68) {
|
|
|
271067
270034
|
}
|
|
271068
270035
|
segments.push(currentSegment);
|
|
271069
270036
|
currentSegment = "";
|
|
271070
|
-
const closingBracket =
|
|
270037
|
+
const closingBracket = path66.indexOf("]", i2);
|
|
271071
270038
|
if (closingBracket === -1) {
|
|
271072
270039
|
throw new Error("Missing closing bracket for array index");
|
|
271073
270040
|
}
|
|
271074
|
-
const indexStr =
|
|
270041
|
+
const indexStr = path66.substring(i2 + 1, closingBracket);
|
|
271075
270042
|
if (!/^\d+$/.test(indexStr)) {
|
|
271076
270043
|
throw new Error(`Invalid array index: ${indexStr}`);
|
|
271077
270044
|
}
|
|
@@ -271090,7 +270057,7 @@ function parseParameterPath(path68) {
|
|
|
271090
270057
|
}
|
|
271091
270058
|
if (currentSegment !== "") {
|
|
271092
270059
|
segments.push(currentSegment);
|
|
271093
|
-
} else if (
|
|
270060
|
+
} else if (path66.endsWith(".")) {
|
|
271094
270061
|
throw new Error("Path cannot start or end with a dot");
|
|
271095
270062
|
}
|
|
271096
270063
|
if (segments.length === 0) {
|
|
@@ -271106,24 +270073,24 @@ function parseParameterPath(path68) {
|
|
|
271106
270073
|
const result = {
|
|
271107
270074
|
segments,
|
|
271108
270075
|
hasArrayAccess,
|
|
271109
|
-
originalPath:
|
|
270076
|
+
originalPath: path66
|
|
271110
270077
|
};
|
|
271111
|
-
pathCache.set(
|
|
270078
|
+
pathCache.set(path66, result);
|
|
271112
270079
|
return result;
|
|
271113
270080
|
}
|
|
271114
|
-
function isValidPathSyntax(
|
|
270081
|
+
function isValidPathSyntax(path66) {
|
|
271115
270082
|
try {
|
|
271116
|
-
parseParameterPath(
|
|
270083
|
+
parseParameterPath(path66);
|
|
271117
270084
|
return true;
|
|
271118
270085
|
} catch {
|
|
271119
270086
|
return false;
|
|
271120
270087
|
}
|
|
271121
270088
|
}
|
|
271122
|
-
function normalizeParameterPath(
|
|
271123
|
-
if (!
|
|
270089
|
+
function normalizeParameterPath(path66) {
|
|
270090
|
+
if (!path66 || typeof path66 !== "string") {
|
|
271124
270091
|
return "";
|
|
271125
270092
|
}
|
|
271126
|
-
let normalized =
|
|
270093
|
+
let normalized = path66.trim();
|
|
271127
270094
|
normalized = normalized.replace(/\.+/g, ".");
|
|
271128
270095
|
normalized = normalized.replace(/^\.+|\.+$/g, "");
|
|
271129
270096
|
return normalized;
|
|
@@ -271280,7 +270247,7 @@ __export(exports_parameter_override, {
|
|
|
271280
270247
|
applyParameterOverride: () => applyParameterOverride,
|
|
271281
270248
|
applyMatrixOverrides: () => applyMatrixOverrides
|
|
271282
270249
|
});
|
|
271283
|
-
function validateParameterPath(obj,
|
|
270250
|
+
function validateParameterPath(obj, path66) {
|
|
271284
270251
|
if (!obj || typeof obj !== "object") {
|
|
271285
270252
|
return {
|
|
271286
270253
|
isValid: false,
|
|
@@ -271290,7 +270257,7 @@ function validateParameterPath(obj, path68) {
|
|
|
271290
270257
|
};
|
|
271291
270258
|
}
|
|
271292
270259
|
try {
|
|
271293
|
-
const parsedPath = parseParameterPath(
|
|
270260
|
+
const parsedPath = parseParameterPath(path66);
|
|
271294
270261
|
let current = obj;
|
|
271295
270262
|
let currentPath = "";
|
|
271296
270263
|
for (let i2 = 0;i2 < parsedPath.segments.length; i2++) {
|
|
@@ -271360,54 +270327,54 @@ function validateParameterPath(obj, path68) {
|
|
|
271360
270327
|
};
|
|
271361
270328
|
}
|
|
271362
270329
|
}
|
|
271363
|
-
function validateParameterPathLegacy(obj,
|
|
271364
|
-
const result = validateParameterPath(obj,
|
|
270330
|
+
function validateParameterPathLegacy(obj, path66) {
|
|
270331
|
+
const result = validateParameterPath(obj, path66);
|
|
271365
270332
|
return result.isValid;
|
|
271366
270333
|
}
|
|
271367
|
-
function getValueAtPath(obj,
|
|
271368
|
-
const parsedPath = parseParameterPath(
|
|
270334
|
+
function getValueAtPath(obj, path66) {
|
|
270335
|
+
const parsedPath = parseParameterPath(path66);
|
|
271369
270336
|
let current = obj;
|
|
271370
270337
|
for (let i2 = 0;i2 < parsedPath.segments.length; i2++) {
|
|
271371
270338
|
const segment = parsedPath.segments[i2];
|
|
271372
270339
|
if (typeof segment === "number") {
|
|
271373
270340
|
if (!Array.isArray(current)) {
|
|
271374
|
-
throw new Error(`Expected array at path segment, but found ${typeof current} in path: ${
|
|
270341
|
+
throw new Error(`Expected array at path segment, but found ${typeof current} in path: ${path66}`);
|
|
271375
270342
|
}
|
|
271376
270343
|
if (segment >= current.length || segment < 0) {
|
|
271377
|
-
throw new Error(`Array index out of bounds: ${segment} in path: ${
|
|
270344
|
+
throw new Error(`Array index out of bounds: ${segment} in path: ${path66}`);
|
|
271378
270345
|
}
|
|
271379
270346
|
current = current[segment];
|
|
271380
270347
|
} else {
|
|
271381
270348
|
if (!current || typeof current !== "object") {
|
|
271382
|
-
throw new Error(`Expected object at path segment, but found ${typeof current} in path: ${
|
|
270349
|
+
throw new Error(`Expected object at path segment, but found ${typeof current} in path: ${path66}`);
|
|
271383
270350
|
}
|
|
271384
270351
|
if (!(segment in current)) {
|
|
271385
|
-
throw new Error(`Property '${segment}' not found in path: ${
|
|
270352
|
+
throw new Error(`Property '${segment}' not found in path: ${path66}`);
|
|
271386
270353
|
}
|
|
271387
270354
|
current = current[segment];
|
|
271388
270355
|
}
|
|
271389
270356
|
}
|
|
271390
270357
|
return current;
|
|
271391
270358
|
}
|
|
271392
|
-
function setValueAtPath(obj,
|
|
271393
|
-
const parsedPath = parseParameterPath(
|
|
270359
|
+
function setValueAtPath(obj, path66, value) {
|
|
270360
|
+
const parsedPath = parseParameterPath(path66);
|
|
271394
270361
|
let current = obj;
|
|
271395
270362
|
for (let i2 = 0;i2 < parsedPath.segments.length - 1; i2++) {
|
|
271396
270363
|
const segment = parsedPath.segments[i2];
|
|
271397
270364
|
if (typeof segment === "number") {
|
|
271398
270365
|
if (!Array.isArray(current)) {
|
|
271399
|
-
throw new Error(`Expected array at path segment, but found ${typeof current} in path: ${
|
|
270366
|
+
throw new Error(`Expected array at path segment, but found ${typeof current} in path: ${path66}`);
|
|
271400
270367
|
}
|
|
271401
270368
|
if (segment >= current.length || segment < 0) {
|
|
271402
|
-
throw new Error(`Array index out of bounds: ${segment} in path: ${
|
|
270369
|
+
throw new Error(`Array index out of bounds: ${segment} in path: ${path66}`);
|
|
271403
270370
|
}
|
|
271404
270371
|
current = current[segment];
|
|
271405
270372
|
} else {
|
|
271406
270373
|
if (!current || typeof current !== "object") {
|
|
271407
|
-
throw new Error(`Expected object at path segment, but found ${typeof current} in path: ${
|
|
270374
|
+
throw new Error(`Expected object at path segment, but found ${typeof current} in path: ${path66}`);
|
|
271408
270375
|
}
|
|
271409
270376
|
if (!(segment in current)) {
|
|
271410
|
-
throw new Error(`Property '${segment}' not found in path: ${
|
|
270377
|
+
throw new Error(`Property '${segment}' not found in path: ${path66}`);
|
|
271411
270378
|
}
|
|
271412
270379
|
current = current[segment];
|
|
271413
270380
|
}
|
|
@@ -271415,27 +270382,27 @@ function setValueAtPath(obj, path68, value) {
|
|
|
271415
270382
|
const finalSegment = parsedPath.segments[parsedPath.segments.length - 1];
|
|
271416
270383
|
if (typeof finalSegment === "number") {
|
|
271417
270384
|
if (!Array.isArray(current)) {
|
|
271418
|
-
throw new Error(`Expected array for final segment, but found ${typeof current} in path: ${
|
|
270385
|
+
throw new Error(`Expected array for final segment, but found ${typeof current} in path: ${path66}`);
|
|
271419
270386
|
}
|
|
271420
270387
|
if (finalSegment >= current.length || finalSegment < 0) {
|
|
271421
|
-
throw new Error(`Array index out of bounds: ${finalSegment} in path: ${
|
|
270388
|
+
throw new Error(`Array index out of bounds: ${finalSegment} in path: ${path66}`);
|
|
271422
270389
|
}
|
|
271423
270390
|
current[finalSegment] = value;
|
|
271424
270391
|
} else {
|
|
271425
270392
|
if (!current || typeof current !== "object") {
|
|
271426
|
-
throw new Error(`Expected object for final segment, but found ${typeof current} in path: ${
|
|
270393
|
+
throw new Error(`Expected object for final segment, but found ${typeof current} in path: ${path66}`);
|
|
271427
270394
|
}
|
|
271428
270395
|
current[finalSegment] = value;
|
|
271429
270396
|
}
|
|
271430
270397
|
}
|
|
271431
|
-
function applyParameterOverride(scenario,
|
|
270398
|
+
function applyParameterOverride(scenario, path66, value) {
|
|
271432
270399
|
const clonedScenario = deepClone(scenario);
|
|
271433
|
-
setValueAtPath(clonedScenario,
|
|
270400
|
+
setValueAtPath(clonedScenario, path66, value);
|
|
271434
270401
|
return clonedScenario;
|
|
271435
270402
|
}
|
|
271436
270403
|
function applyMatrixOverrides(baseScenario, overrides) {
|
|
271437
|
-
const parameterOverrides = Object.entries(overrides).map(([
|
|
271438
|
-
path:
|
|
270404
|
+
const parameterOverrides = Object.entries(overrides).map(([path66, value]) => ({
|
|
270405
|
+
path: path66,
|
|
271439
270406
|
value
|
|
271440
270407
|
}));
|
|
271441
270408
|
return applyParameterOverrides(baseScenario, parameterOverrides);
|
|
@@ -271493,8 +270460,8 @@ function applyParameterOverrides(baseScenario, overrides) {
|
|
|
271493
270460
|
return modifiedScenario;
|
|
271494
270461
|
}
|
|
271495
270462
|
function combinationToOverrides(combination) {
|
|
271496
|
-
return Object.entries(combination).map(([
|
|
271497
|
-
path:
|
|
270463
|
+
return Object.entries(combination).map(([path66, value]) => ({
|
|
270464
|
+
path: path66,
|
|
271498
270465
|
value
|
|
271499
270466
|
}));
|
|
271500
270467
|
}
|
|
@@ -271534,7 +270501,7 @@ __export(exports_run_isolation, {
|
|
|
271534
270501
|
cleanupIsolatedEnvironment: () => cleanupIsolatedEnvironment,
|
|
271535
270502
|
checkDiskSpace: () => checkDiskSpace
|
|
271536
270503
|
});
|
|
271537
|
-
import { promises as
|
|
270504
|
+
import { promises as fs39 } from "fs";
|
|
271538
270505
|
import { join as join17, dirname as dirname6 } from "path";
|
|
271539
270506
|
import { tmpdir as tmpdir4 } from "os";
|
|
271540
270507
|
function resetRunSequence() {
|
|
@@ -271547,13 +270514,13 @@ function generateRunId() {
|
|
|
271547
270514
|
}
|
|
271548
270515
|
async function createIsolatedEnvironment(runId, outputDir) {
|
|
271549
270516
|
const tempDir = join17(outputDir, "temp", runId);
|
|
271550
|
-
await
|
|
270517
|
+
await fs39.mkdir(tempDir, { recursive: true });
|
|
271551
270518
|
const dbPath = join17(tempDir, "database");
|
|
271552
270519
|
const logsDir = join17(tempDir, "logs");
|
|
271553
270520
|
const logPath = join17(logsDir, "run.log");
|
|
271554
270521
|
const scenarioPath = join17(tempDir, "scenario.yaml");
|
|
271555
|
-
await
|
|
271556
|
-
await
|
|
270522
|
+
await fs39.mkdir(dirname6(logPath), { recursive: true });
|
|
270523
|
+
await fs39.mkdir(dbPath, { recursive: true });
|
|
271557
270524
|
const cleanup = async () => {
|
|
271558
270525
|
await cleanupIsolatedEnvironment({
|
|
271559
270526
|
runId,
|
|
@@ -271575,14 +270542,14 @@ async function createIsolatedEnvironment(runId, outputDir) {
|
|
|
271575
270542
|
}
|
|
271576
270543
|
async function cleanupIsolatedEnvironment(context2) {
|
|
271577
270544
|
try {
|
|
271578
|
-
await
|
|
270545
|
+
await fs39.rm(context2.tempDir, { recursive: true, force: true });
|
|
271579
270546
|
} catch (error2) {
|
|
271580
270547
|
console.warn(`Warning: Failed to cleanup isolated environment ${context2.runId}:`, error2);
|
|
271581
270548
|
}
|
|
271582
270549
|
}
|
|
271583
270550
|
async function ensureIsolatedDatabase(dbPath) {
|
|
271584
270551
|
try {
|
|
271585
|
-
await
|
|
270552
|
+
await fs39.mkdir(dbPath, { recursive: true });
|
|
271586
270553
|
const dbConfig = {
|
|
271587
270554
|
type: "pglite",
|
|
271588
270555
|
path: dbPath,
|
|
@@ -271590,7 +270557,7 @@ async function ensureIsolatedDatabase(dbPath) {
|
|
|
271590
270557
|
temporary: true
|
|
271591
270558
|
};
|
|
271592
270559
|
const configPath = join17(dbPath, "config.json");
|
|
271593
|
-
await
|
|
270560
|
+
await fs39.writeFile(configPath, JSON.stringify(dbConfig, null, 2));
|
|
271594
270561
|
} catch (error2) {
|
|
271595
270562
|
throw new Error(`Failed to setup isolated database: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
271596
270563
|
}
|
|
@@ -271598,16 +270565,16 @@ async function ensureIsolatedDatabase(dbPath) {
|
|
|
271598
270565
|
async function writeTemporaryScenario(scenarioPath, baseScenario, parameters) {
|
|
271599
270566
|
try {
|
|
271600
270567
|
const modifiedScenario = JSON.parse(JSON.stringify(baseScenario));
|
|
271601
|
-
for (const [
|
|
271602
|
-
setNestedProperty(modifiedScenario,
|
|
270568
|
+
for (const [path66, value] of Object.entries(parameters)) {
|
|
270569
|
+
setNestedProperty(modifiedScenario, path66, value);
|
|
271603
270570
|
}
|
|
271604
|
-
await
|
|
270571
|
+
await fs39.writeFile(scenarioPath, JSON.stringify(modifiedScenario, null, 2));
|
|
271605
270572
|
} catch (error2) {
|
|
271606
270573
|
throw new Error(`Failed to write temporary scenario: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
271607
270574
|
}
|
|
271608
270575
|
}
|
|
271609
|
-
function setNestedProperty(obj,
|
|
271610
|
-
const keys =
|
|
270576
|
+
function setNestedProperty(obj, path66, value) {
|
|
270577
|
+
const keys = path66.split(".");
|
|
271611
270578
|
let current = obj;
|
|
271612
270579
|
for (let i2 = 0;i2 < keys.length - 1; i2++) {
|
|
271613
270580
|
const key = keys[i2];
|
|
@@ -271644,9 +270611,9 @@ function setNestedProperty(obj, path68, value) {
|
|
|
271644
270611
|
}
|
|
271645
270612
|
async function validateIsolationContext(context2) {
|
|
271646
270613
|
try {
|
|
271647
|
-
const tempDirExists = await
|
|
271648
|
-
const dbDirExists = await
|
|
271649
|
-
const logDirExists = await
|
|
270614
|
+
const tempDirExists = await fs39.access(context2.tempDir).then(() => true).catch(() => false);
|
|
270615
|
+
const dbDirExists = await fs39.access(context2.dbPath).then(() => true).catch(() => false);
|
|
270616
|
+
const logDirExists = await fs39.access(dirname6(context2.logPath)).then(() => true).catch(() => false);
|
|
271650
270617
|
return tempDirExists && dbDirExists && logDirExists;
|
|
271651
270618
|
} catch {
|
|
271652
270619
|
return false;
|
|
@@ -271684,11 +270651,11 @@ function estimateRunDiskSpace(baseScenario) {
|
|
|
271684
270651
|
}
|
|
271685
270652
|
async function checkDiskSpace(outputDir, _estimatedSpace) {
|
|
271686
270653
|
try {
|
|
271687
|
-
await
|
|
270654
|
+
await fs39.stat(outputDir);
|
|
271688
270655
|
return true;
|
|
271689
270656
|
} catch {
|
|
271690
270657
|
try {
|
|
271691
|
-
await
|
|
270658
|
+
await fs39.mkdir(outputDir, { recursive: true });
|
|
271692
270659
|
return true;
|
|
271693
270660
|
} catch {
|
|
271694
270661
|
return false;
|
|
@@ -271701,13 +270668,13 @@ async function monitorIsolatedResources(context2) {
|
|
|
271701
270668
|
let fileCount = 0;
|
|
271702
270669
|
async function calculateSize(dirPath) {
|
|
271703
270670
|
try {
|
|
271704
|
-
const entries = await
|
|
270671
|
+
const entries = await fs39.readdir(dirPath, { withFileTypes: true });
|
|
271705
270672
|
for (const entry of entries) {
|
|
271706
270673
|
const fullPath = join17(dirPath, entry.name);
|
|
271707
270674
|
if (entry.isDirectory()) {
|
|
271708
270675
|
await calculateSize(fullPath);
|
|
271709
270676
|
} else {
|
|
271710
|
-
const stats = await
|
|
270677
|
+
const stats = await fs39.stat(fullPath);
|
|
271711
270678
|
totalSize += stats.size;
|
|
271712
270679
|
fileCount++;
|
|
271713
270680
|
}
|
|
@@ -272338,7 +271305,7 @@ var exports_matrix_orchestrator = {};
|
|
|
272338
271305
|
__export(exports_matrix_orchestrator, {
|
|
272339
271306
|
executeMatrixRuns: () => executeMatrixRuns
|
|
272340
271307
|
});
|
|
272341
|
-
import { promises as
|
|
271308
|
+
import { promises as fs40 } from "fs";
|
|
272342
271309
|
import { join as join19 } from "path";
|
|
272343
271310
|
async function executeMatrixRuns(config4, combinations, options) {
|
|
272344
271311
|
console.log("\uD83D\uDD27 [DEBUG] executeMatrixRuns started");
|
|
@@ -272350,7 +271317,7 @@ async function executeMatrixRuns(config4, combinations, options) {
|
|
|
272350
271317
|
console.log(`\uD83D\uDD27 [DEBUG] [ProcessManager] Initial state: ${initialSummary.total} processes tracked`);
|
|
272351
271318
|
console.log("\uD83D\uDD27 [DEBUG] About to setup execution environment");
|
|
272352
271319
|
const { outputDir, maxParallel = 1, continueOnFailure = true, runTimeout = 300000 } = options;
|
|
272353
|
-
await
|
|
271320
|
+
await fs40.mkdir(outputDir, { recursive: true });
|
|
272354
271321
|
const progressTracker = createProgressTracker({
|
|
272355
271322
|
totalCombinations: combinations.length,
|
|
272356
271323
|
runsPerCombination: config4.runs_per_combination,
|
|
@@ -272378,7 +271345,7 @@ async function executeMatrixRuns(config4, combinations, options) {
|
|
|
272378
271345
|
resourceMonitor.start();
|
|
272379
271346
|
try {
|
|
272380
271347
|
console.log("\uD83D\uDD27 [DEBUG] About to read base scenario file");
|
|
272381
|
-
const baseScenarioContent = await
|
|
271348
|
+
const baseScenarioContent = await fs40.readFile(config4.base_scenario, "utf8");
|
|
272382
271349
|
console.log("\uD83D\uDD27 [DEBUG] Base scenario file read successfully");
|
|
272383
271350
|
let baseScenario;
|
|
272384
271351
|
try {
|
|
@@ -272689,7 +271656,7 @@ async function executeScenarioWithTimeout(scenarioPath, context2, timeout2, onPr
|
|
|
272689
271656
|
try {
|
|
272690
271657
|
onProgress(0.1, "Loading scenario...");
|
|
272691
271658
|
const yaml = await Promise.resolve().then(() => (init_js_yaml(), exports_js_yaml));
|
|
272692
|
-
const scenarioContent = await
|
|
271659
|
+
const scenarioContent = await fs40.readFile(scenarioPath, "utf8");
|
|
272693
271660
|
const scenario = yaml.load(scenarioContent);
|
|
272694
271661
|
onProgress(0.2, "Validating scenario...");
|
|
272695
271662
|
const { ScenarioSchema: ScenarioSchema2 } = await Promise.resolve().then(() => (init_schema(), exports_schema));
|
|
@@ -272907,13 +271874,13 @@ async function calculateRunDiskUsage(tempDir) {
|
|
|
272907
271874
|
}
|
|
272908
271875
|
async function saveMatrixConfiguration(config4, outputDir) {
|
|
272909
271876
|
const configPath = join19(outputDir, "config.yaml");
|
|
272910
|
-
await
|
|
271877
|
+
await fs40.writeFile(configPath, JSON.stringify(config4, null, 2));
|
|
272911
271878
|
}
|
|
272912
271879
|
async function saveRunResult(result, outputDir) {
|
|
272913
271880
|
const runsDir = join19(outputDir, "runs");
|
|
272914
|
-
await
|
|
271881
|
+
await fs40.mkdir(runsDir, { recursive: true });
|
|
272915
271882
|
const resultPath = join19(runsDir, `${result.runId}.json`);
|
|
272916
|
-
await
|
|
271883
|
+
await fs40.writeFile(resultPath, JSON.stringify(result, null, 2));
|
|
272917
271884
|
}
|
|
272918
271885
|
function createCombinationSummary(combinationId, allResults) {
|
|
272919
271886
|
const combinationResults = allResults.filter((r2) => r2.combinationId === combinationId);
|
|
@@ -272962,9 +271929,9 @@ async function generateExecutionSummary(_config, combinations, results, startTim
|
|
|
272962
271929
|
}
|
|
272963
271930
|
async function saveSummary(summary, outputDir) {
|
|
272964
271931
|
const summaryPath = join19(outputDir, "summary.json");
|
|
272965
|
-
await
|
|
271932
|
+
await fs40.writeFile(summaryPath, JSON.stringify(summary, null, 2));
|
|
272966
271933
|
const logsDir = join19(outputDir, "logs");
|
|
272967
|
-
await
|
|
271934
|
+
await fs40.mkdir(logsDir, { recursive: true });
|
|
272968
271935
|
const logPath = join19(logsDir, "matrix-execution.log");
|
|
272969
271936
|
const logContent = [
|
|
272970
271937
|
`Matrix Execution Summary`,
|
|
@@ -272987,7 +271954,7 @@ async function saveSummary(summary, outputDir) {
|
|
|
272987
271954
|
...summary.combinations.map((combo) => `- ${combo.combinationId}: ${combo.successfulRuns}/${combo.totalRuns} success (${(combo.successRate * 100).toFixed(1)}%)`)
|
|
272988
271955
|
].join(`
|
|
272989
271956
|
`);
|
|
272990
|
-
await
|
|
271957
|
+
await fs40.writeFile(logPath, logContent);
|
|
272991
271958
|
}
|
|
272992
271959
|
var init_matrix_orchestrator = __esm(() => {
|
|
272993
271960
|
init_run_isolation();
|
|
@@ -273202,8 +272169,237 @@ async function selectEmbeddingModel() {
|
|
|
273202
272169
|
}
|
|
273203
272170
|
return embeddingModel;
|
|
273204
272171
|
}
|
|
272172
|
+
// src/characters/eliza.ts
|
|
272173
|
+
var baseCharacter = {
|
|
272174
|
+
name: "Eliza",
|
|
272175
|
+
plugins: ["@elizaos/plugin-sql", "@elizaos/plugin-bootstrap"],
|
|
272176
|
+
secrets: {},
|
|
272177
|
+
settings: {
|
|
272178
|
+
avatar: "https://elizaos.github.io/eliza-avatars/Eliza/portrait.png"
|
|
272179
|
+
},
|
|
272180
|
+
system: "Respond to all messages in a helpful, conversational manner. Provide assistance on a wide range of topics, using knowledge when needed. Be concise but thorough, friendly but professional. Use humor when appropriate and be empathetic to user needs. Provide valuable information and insights when questions are asked.",
|
|
272181
|
+
bio: [
|
|
272182
|
+
"Engages with all types of questions and conversations",
|
|
272183
|
+
"Provides helpful, concise responses",
|
|
272184
|
+
"Uses knowledge resources effectively when needed",
|
|
272185
|
+
"Balances brevity with completeness",
|
|
272186
|
+
"Uses humor and empathy appropriately",
|
|
272187
|
+
"Adapts tone to match the conversation context",
|
|
272188
|
+
"Offers assistance proactively",
|
|
272189
|
+
"Communicates clearly and directly"
|
|
272190
|
+
],
|
|
272191
|
+
topics: [
|
|
272192
|
+
"general knowledge and information",
|
|
272193
|
+
"problem solving and troubleshooting",
|
|
272194
|
+
"technology and software",
|
|
272195
|
+
"community building and management",
|
|
272196
|
+
"business and productivity",
|
|
272197
|
+
"creativity and innovation",
|
|
272198
|
+
"personal development",
|
|
272199
|
+
"communication and collaboration",
|
|
272200
|
+
"education and learning",
|
|
272201
|
+
"entertainment and media"
|
|
272202
|
+
],
|
|
272203
|
+
messageExamples: [
|
|
272204
|
+
[
|
|
272205
|
+
{
|
|
272206
|
+
name: "{{name1}}",
|
|
272207
|
+
content: {
|
|
272208
|
+
text: "This user keeps derailing technical discussions with personal problems."
|
|
272209
|
+
}
|
|
272210
|
+
},
|
|
272211
|
+
{
|
|
272212
|
+
name: "Eliza",
|
|
272213
|
+
content: {
|
|
272214
|
+
text: "DM them. Sounds like they need to talk about something else."
|
|
272215
|
+
}
|
|
272216
|
+
},
|
|
272217
|
+
{
|
|
272218
|
+
name: "{{name1}}",
|
|
272219
|
+
content: {
|
|
272220
|
+
text: "I tried, they just keep bringing drama back to the main channel."
|
|
272221
|
+
}
|
|
272222
|
+
},
|
|
272223
|
+
{
|
|
272224
|
+
name: "Eliza",
|
|
272225
|
+
content: {
|
|
272226
|
+
text: "Send them my way. I've got time today."
|
|
272227
|
+
}
|
|
272228
|
+
}
|
|
272229
|
+
],
|
|
272230
|
+
[
|
|
272231
|
+
{
|
|
272232
|
+
name: "{{name1}}",
|
|
272233
|
+
content: {
|
|
272234
|
+
text: "I can't handle being a mod anymore. It's affecting my mental health."
|
|
272235
|
+
}
|
|
272236
|
+
},
|
|
272237
|
+
{
|
|
272238
|
+
name: "Eliza",
|
|
272239
|
+
content: {
|
|
272240
|
+
text: "Drop the channels. You come first."
|
|
272241
|
+
}
|
|
272242
|
+
},
|
|
272243
|
+
{
|
|
272244
|
+
name: "{{name1}}",
|
|
272245
|
+
content: {
|
|
272246
|
+
text: "But who's going to handle everything?"
|
|
272247
|
+
}
|
|
272248
|
+
},
|
|
272249
|
+
{
|
|
272250
|
+
name: "Eliza",
|
|
272251
|
+
content: {
|
|
272252
|
+
text: "We will. Take the break. Come back when you're ready."
|
|
272253
|
+
}
|
|
272254
|
+
}
|
|
272255
|
+
],
|
|
272256
|
+
[
|
|
272257
|
+
{
|
|
272258
|
+
name: "{{name1}}",
|
|
272259
|
+
content: {
|
|
272260
|
+
text: "Could you explain how blockchain technology works?"
|
|
272261
|
+
}
|
|
272262
|
+
},
|
|
272263
|
+
{
|
|
272264
|
+
name: "Eliza",
|
|
272265
|
+
content: {
|
|
272266
|
+
text: "A blockchain is a distributed database that maintains a growing list of records secured against tampering and revision. Think of it as a chain of blocks where each block contains data, its own hash, and the hash of the previous block."
|
|
272267
|
+
}
|
|
272268
|
+
}
|
|
272269
|
+
],
|
|
272270
|
+
[
|
|
272271
|
+
{
|
|
272272
|
+
name: "{{name1}}",
|
|
272273
|
+
content: {
|
|
272274
|
+
text: "Hey everyone, what are our community guidelines for new members?"
|
|
272275
|
+
}
|
|
272276
|
+
},
|
|
272277
|
+
{
|
|
272278
|
+
name: "Eliza",
|
|
272279
|
+
content: {
|
|
272280
|
+
text: "Let me check our guidelines.",
|
|
272281
|
+
providers: ["KNOWLEDGE"]
|
|
272282
|
+
}
|
|
272283
|
+
}
|
|
272284
|
+
],
|
|
272285
|
+
[
|
|
272286
|
+
{
|
|
272287
|
+
name: "{{name1}}",
|
|
272288
|
+
content: {
|
|
272289
|
+
text: "Are there any resources for onboarding new developers to our community?"
|
|
272290
|
+
}
|
|
272291
|
+
},
|
|
272292
|
+
{
|
|
272293
|
+
name: "Eliza",
|
|
272294
|
+
content: {
|
|
272295
|
+
text: "We have some documentation I can find for you.",
|
|
272296
|
+
providers: ["KNOWLEDGE"]
|
|
272297
|
+
}
|
|
272298
|
+
}
|
|
272299
|
+
],
|
|
272300
|
+
[
|
|
272301
|
+
{
|
|
272302
|
+
name: "{{name1}}",
|
|
272303
|
+
content: {
|
|
272304
|
+
text: "What process should we follow for handling code of conduct violations?"
|
|
272305
|
+
}
|
|
272306
|
+
},
|
|
272307
|
+
{
|
|
272308
|
+
name: "Eliza",
|
|
272309
|
+
content: {
|
|
272310
|
+
text: "Let me pull up our violation handling process.",
|
|
272311
|
+
providers: ["KNOWLEDGE"]
|
|
272312
|
+
}
|
|
272313
|
+
}
|
|
272314
|
+
],
|
|
272315
|
+
[
|
|
272316
|
+
{
|
|
272317
|
+
name: "{{name1}}",
|
|
272318
|
+
content: {
|
|
272319
|
+
text: "What can you tell me about quantum computing?"
|
|
272320
|
+
}
|
|
272321
|
+
},
|
|
272322
|
+
{
|
|
272323
|
+
name: "Eliza",
|
|
272324
|
+
content: {
|
|
272325
|
+
text: "Let me find some information about quantum computing.",
|
|
272326
|
+
providers: ["KNOWLEDGE"]
|
|
272327
|
+
}
|
|
272328
|
+
}
|
|
272329
|
+
]
|
|
272330
|
+
],
|
|
272331
|
+
postExamples: [
|
|
272332
|
+
"Sometimes the best debugging tool is a fresh cup of coffee and a walk around the block.",
|
|
272333
|
+
"The magic happens when developers stop competing and start collaborating. Build together, grow together.",
|
|
272334
|
+
"Reminder: Your code doesn't have to be perfect on the first try. Progress over perfection.",
|
|
272335
|
+
"Community tip: The person asking 'obvious' questions today might solve your toughest problem tomorrow. Be kind.",
|
|
272336
|
+
"Hot take: Good documentation is more valuable than clever code.",
|
|
272337
|
+
"The best feature you can add to your project? A welcoming community.",
|
|
272338
|
+
"Debugging is just a conversation with your past self. Make it easier by leaving good comments.",
|
|
272339
|
+
"Your daily reminder that impostor syndrome affects even the most experienced developers. You belong here.",
|
|
272340
|
+
"Pro tip: Read the error message. Then read it again. The answer is usually there.",
|
|
272341
|
+
"Building in public isn't about showing off. It's about learning together and helping others avoid your mistakes.",
|
|
272342
|
+
"The difference between junior and senior developers? Seniors know when NOT to write code.",
|
|
272343
|
+
"Community > Competition. Always.",
|
|
272344
|
+
"Remember: Every expert was once a beginner who refused to give up.",
|
|
272345
|
+
"Code reviews aren't personal attacks. They're opportunities to level up together.",
|
|
272346
|
+
"The most powerful tool in development? Asking for help when you need it."
|
|
272347
|
+
],
|
|
272348
|
+
style: {
|
|
272349
|
+
all: [
|
|
272350
|
+
"Keep responses concise but informative",
|
|
272351
|
+
"Use clear and direct language",
|
|
272352
|
+
"Be engaging and conversational",
|
|
272353
|
+
"Use humor when appropriate",
|
|
272354
|
+
"Be empathetic and understanding",
|
|
272355
|
+
"Provide helpful information",
|
|
272356
|
+
"Be encouraging and positive",
|
|
272357
|
+
"Adapt tone to the conversation",
|
|
272358
|
+
"Use knowledge resources when needed",
|
|
272359
|
+
"Respond to all types of questions"
|
|
272360
|
+
],
|
|
272361
|
+
chat: [
|
|
272362
|
+
"Be conversational and natural",
|
|
272363
|
+
"Engage with the topic at hand",
|
|
272364
|
+
"Be helpful and informative",
|
|
272365
|
+
"Show personality and warmth"
|
|
272366
|
+
],
|
|
272367
|
+
post: [
|
|
272368
|
+
"Keep it concise and punchy - every word counts",
|
|
272369
|
+
"Share insights, not platitudes",
|
|
272370
|
+
"Be authentic and conversational, not corporate",
|
|
272371
|
+
"Use specific examples over generic advice",
|
|
272372
|
+
"Add value with each post - teach, inspire, or entertain",
|
|
272373
|
+
"One clear thought per post",
|
|
272374
|
+
"Avoid excessive hashtags or mentions",
|
|
272375
|
+
"Write like you are talking to a friend",
|
|
272376
|
+
"Share personal observations and hot takes",
|
|
272377
|
+
"Be helpful without being preachy",
|
|
272378
|
+
"Use emojis sparingly and purposefully",
|
|
272379
|
+
"End with something thought-provoking when appropriate"
|
|
272380
|
+
]
|
|
272381
|
+
}
|
|
272382
|
+
};
|
|
272383
|
+
function getElizaCharacter() {
|
|
272384
|
+
const plugins = [
|
|
272385
|
+
"@elizaos/plugin-sql",
|
|
272386
|
+
...process.env.ANTHROPIC_API_KEY?.trim() ? ["@elizaos/plugin-anthropic"] : [],
|
|
272387
|
+
...process.env.OPENROUTER_API_KEY?.trim() ? ["@elizaos/plugin-openrouter"] : [],
|
|
272388
|
+
...process.env.OPENAI_API_KEY?.trim() ? ["@elizaos/plugin-openai"] : [],
|
|
272389
|
+
...process.env.GOOGLE_GENERATIVE_AI_API_KEY?.trim() ? ["@elizaos/plugin-google-genai"] : [],
|
|
272390
|
+
...process.env.DISCORD_API_TOKEN?.trim() ? ["@elizaos/plugin-discord"] : [],
|
|
272391
|
+
...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"] : [],
|
|
272392
|
+
...process.env.TELEGRAM_BOT_TOKEN?.trim() ? ["@elizaos/plugin-telegram"] : [],
|
|
272393
|
+
...!process.env.IGNORE_BOOTSTRAP ? ["@elizaos/plugin-bootstrap"] : [],
|
|
272394
|
+
"@elizaos/plugin-ollama"
|
|
272395
|
+
];
|
|
272396
|
+
return {
|
|
272397
|
+
...baseCharacter,
|
|
272398
|
+
plugins
|
|
272399
|
+
};
|
|
272400
|
+
}
|
|
272401
|
+
|
|
273205
272402
|
// src/commands/create/actions/creators.ts
|
|
273206
|
-
init_eliza();
|
|
273207
272403
|
init_utils();
|
|
273208
272404
|
init_dist2();
|
|
273209
272405
|
init_yoctocolors();
|
|
@@ -273523,6 +272719,9 @@ async function setupProjectEnvironment(targetDir, database, aiModel, embeddingMo
|
|
|
273523
272719
|
await installModelPlugin(embeddingModel, targetDir, "for embeddings");
|
|
273524
272720
|
}
|
|
273525
272721
|
}
|
|
272722
|
+
if (aiModel !== "local" && embeddingModel !== "local") {
|
|
272723
|
+
await installPluginWithSpinner("ollama", targetDir, "as universal fallback");
|
|
272724
|
+
}
|
|
273526
272725
|
}
|
|
273527
272726
|
|
|
273528
272727
|
// src/commands/create/actions/creators.ts
|
|
@@ -274347,7 +273546,94 @@ async function stopServer() {
|
|
|
274347
273546
|
// src/commands/dev/actions/dev-server.ts
|
|
274348
273547
|
init_utils();
|
|
274349
273548
|
init_port_handling();
|
|
274350
|
-
|
|
273549
|
+
|
|
273550
|
+
// src/utils/dependency-manager.ts
|
|
273551
|
+
init_bun_exec();
|
|
273552
|
+
init_spinner_utils();
|
|
273553
|
+
init_directory_detection();
|
|
273554
|
+
import * as fs14 from "fs";
|
|
273555
|
+
import * as path25 from "path";
|
|
273556
|
+
import { logger as logger27 } from "@elizaos/core";
|
|
273557
|
+
function hasElizaOSCli(packageJsonPath) {
|
|
273558
|
+
try {
|
|
273559
|
+
if (!fs14.existsSync(packageJsonPath)) {
|
|
273560
|
+
return false;
|
|
273561
|
+
}
|
|
273562
|
+
let packageJson;
|
|
273563
|
+
try {
|
|
273564
|
+
packageJson = JSON.parse(fs14.readFileSync(packageJsonPath, "utf8"));
|
|
273565
|
+
} catch (parseError) {
|
|
273566
|
+
logger27.debug({ error: parseError, packageJsonPath }, `Error parsing JSON in package.json`);
|
|
273567
|
+
return false;
|
|
273568
|
+
}
|
|
273569
|
+
const dependencies = packageJson.dependencies || {};
|
|
273570
|
+
const devDependencies = packageJson.devDependencies || {};
|
|
273571
|
+
return "@elizaos/cli" in dependencies || "@elizaos/cli" in devDependencies;
|
|
273572
|
+
} catch (error) {
|
|
273573
|
+
logger27.debug({ error, packageJsonPath }, `Error reading package.json`);
|
|
273574
|
+
return false;
|
|
273575
|
+
}
|
|
273576
|
+
}
|
|
273577
|
+
function shouldAutoInstallCli(cwd = process.cwd()) {
|
|
273578
|
+
if (process.env.ELIZA_NO_AUTO_INSTALL === "true") {
|
|
273579
|
+
logger27.debug("Auto-install disabled via ELIZA_NO_AUTO_INSTALL");
|
|
273580
|
+
return false;
|
|
273581
|
+
}
|
|
273582
|
+
if (process.env.CI === "true" || process.env.ELIZA_TEST_MODE === "true") {
|
|
273583
|
+
logger27.debug("Skipping auto-install in CI/test environment");
|
|
273584
|
+
return false;
|
|
273585
|
+
}
|
|
273586
|
+
const dirInfo = detectDirectoryType(cwd);
|
|
273587
|
+
if (dirInfo.type === "elizaos-monorepo" || dirInfo.monorepoRoot) {
|
|
273588
|
+
logger27.debug("Skipping auto-install in monorepo");
|
|
273589
|
+
return false;
|
|
273590
|
+
}
|
|
273591
|
+
if (!dirInfo.hasPackageJson) {
|
|
273592
|
+
logger27.debug("No package.json found, skipping auto-install");
|
|
273593
|
+
return false;
|
|
273594
|
+
}
|
|
273595
|
+
const packageJsonPath = path25.join(cwd, "package.json");
|
|
273596
|
+
if (hasElizaOSCli(packageJsonPath)) {
|
|
273597
|
+
logger27.debug("@elizaos/cli already present, skipping auto-install");
|
|
273598
|
+
return false;
|
|
273599
|
+
}
|
|
273600
|
+
return true;
|
|
273601
|
+
}
|
|
273602
|
+
async function installElizaOSCli(cwd = process.cwd()) {
|
|
273603
|
+
try {
|
|
273604
|
+
logger27.info("Adding @elizaos/cli as dev dependency for enhanced development experience...");
|
|
273605
|
+
const result = await runBunWithSpinner(["add", "--dev", "@elizaos/cli"], cwd, {
|
|
273606
|
+
spinnerText: "Installing @elizaos/cli with bun...",
|
|
273607
|
+
successText: "\u2713 @elizaos/cli installed successfully",
|
|
273608
|
+
errorText: "Failed to install @elizaos/cli",
|
|
273609
|
+
showOutputOnError: false
|
|
273610
|
+
});
|
|
273611
|
+
if (result.success) {
|
|
273612
|
+
logger27.info("\u2713 @elizaos/cli added as dev dependency");
|
|
273613
|
+
return true;
|
|
273614
|
+
} else {
|
|
273615
|
+
logger27.warn("\u26A0 Failed to install @elizaos/cli as dev dependency (optional)");
|
|
273616
|
+
logger27.debug({ error: result.error }, "Installation error:");
|
|
273617
|
+
return false;
|
|
273618
|
+
}
|
|
273619
|
+
} catch (error) {
|
|
273620
|
+
logger27.warn("\u26A0 Failed to install @elizaos/cli as dev dependency (optional)");
|
|
273621
|
+
logger27.debug({ error }, "Installation error:");
|
|
273622
|
+
return false;
|
|
273623
|
+
}
|
|
273624
|
+
}
|
|
273625
|
+
async function ensureElizaOSCli(cwd = process.cwd()) {
|
|
273626
|
+
if (!shouldAutoInstallCli(cwd)) {
|
|
273627
|
+
return;
|
|
273628
|
+
}
|
|
273629
|
+
logger27.debug("Auto-installing @elizaos/cli for enhanced development experience");
|
|
273630
|
+
const success = await installElizaOSCli(cwd);
|
|
273631
|
+
if (success) {
|
|
273632
|
+
logger27.info("Next time you can use the local CLI for better performance and consistency");
|
|
273633
|
+
}
|
|
273634
|
+
}
|
|
273635
|
+
|
|
273636
|
+
// src/commands/dev/actions/dev-server.ts
|
|
274351
273637
|
init_source();
|
|
274352
273638
|
import { logger as logger28 } from "@elizaos/core";
|
|
274353
273639
|
import * as path26 from "path";
|
|
@@ -274725,10 +274011,53 @@ init_yoctocolors();
|
|
|
274725
274011
|
|
|
274726
274012
|
// src/commands/env/actions/edit.ts
|
|
274727
274013
|
init_dist2();
|
|
274728
|
-
init_file_operations();
|
|
274729
274014
|
import { existsSync as existsSync27 } from "fs";
|
|
274730
274015
|
import path28 from "path";
|
|
274731
274016
|
|
|
274017
|
+
// src/commands/env/utils/file-operations.ts
|
|
274018
|
+
init_env_file_service();
|
|
274019
|
+
import { existsSync as existsSync26 } from "fs";
|
|
274020
|
+
import path27 from "path";
|
|
274021
|
+
async function getLocalEnvPath() {
|
|
274022
|
+
const localEnvPath = path27.join(process.cwd(), ".env");
|
|
274023
|
+
return existsSync26(localEnvPath) ? localEnvPath : null;
|
|
274024
|
+
}
|
|
274025
|
+
async function parseEnvFile(filePath) {
|
|
274026
|
+
const service = createEnvFileService(filePath);
|
|
274027
|
+
return service.read();
|
|
274028
|
+
}
|
|
274029
|
+
async function writeEnvFile2(filePath, envVars) {
|
|
274030
|
+
const service = createEnvFileService(filePath);
|
|
274031
|
+
await service.write(envVars, {
|
|
274032
|
+
preserveComments: true,
|
|
274033
|
+
updateProcessEnv: true
|
|
274034
|
+
});
|
|
274035
|
+
}
|
|
274036
|
+
async function resetEnvFile(filePath) {
|
|
274037
|
+
try {
|
|
274038
|
+
if (!existsSync26(filePath)) {
|
|
274039
|
+
return false;
|
|
274040
|
+
}
|
|
274041
|
+
const service = createEnvFileService(filePath);
|
|
274042
|
+
const envVars = await service.read();
|
|
274043
|
+
if (Object.keys(envVars).length === 0) {
|
|
274044
|
+
return false;
|
|
274045
|
+
}
|
|
274046
|
+
const resetVars = Object.keys(envVars).reduce((acc, key) => {
|
|
274047
|
+
acc[key] = "";
|
|
274048
|
+
return acc;
|
|
274049
|
+
}, {});
|
|
274050
|
+
await service.write(resetVars, {
|
|
274051
|
+
preserveComments: true,
|
|
274052
|
+
updateProcessEnv: false
|
|
274053
|
+
});
|
|
274054
|
+
return true;
|
|
274055
|
+
} catch (error) {
|
|
274056
|
+
console.error(`Error resetting environment file: ${error instanceof Error ? error.message : String(error)}`);
|
|
274057
|
+
return false;
|
|
274058
|
+
}
|
|
274059
|
+
}
|
|
274060
|
+
|
|
274732
274061
|
// src/commands/env/utils/validation.ts
|
|
274733
274062
|
function maskedValue(value) {
|
|
274734
274063
|
if (!value)
|
|
@@ -274897,7 +274226,6 @@ init_dist2();
|
|
|
274897
274226
|
// src/commands/env/actions/list.ts
|
|
274898
274227
|
init_utils();
|
|
274899
274228
|
init_yoctocolors();
|
|
274900
|
-
init_file_operations();
|
|
274901
274229
|
import { existsSync as existsSync28 } from "fs";
|
|
274902
274230
|
import path29 from "path";
|
|
274903
274231
|
async function listEnvVars() {
|
|
@@ -281272,7 +280600,6 @@ async function safeDeleteDirectory(dir, actions, label) {
|
|
|
281272
280600
|
}
|
|
281273
280601
|
|
|
281274
280602
|
// src/commands/env/actions/reset.ts
|
|
281275
|
-
init_file_operations();
|
|
281276
280603
|
async function resolvePgliteDir2() {
|
|
281277
280604
|
return path31.join(process.cwd(), ".eliza", "db");
|
|
281278
280605
|
}
|
|
@@ -281434,7 +280761,6 @@ async function showMainMenu(options) {
|
|
|
281434
280761
|
}
|
|
281435
280762
|
|
|
281436
280763
|
// src/commands/env/index.ts
|
|
281437
|
-
init_file_operations();
|
|
281438
280764
|
var env2 = new Command().name("env").description("Manage environment variables and secrets");
|
|
281439
280765
|
env2.command("list").description("List all environment variables").option("--system", "List only system information").option("--local", "List only local environment variables").action(async (options) => {
|
|
281440
280766
|
try {
|
|
@@ -296913,7 +296239,7 @@ ${Object.keys(reportData.results_by_parameter).length > 0 ? Object.keys(reportDa
|
|
|
296913
296239
|
`;
|
|
296914
296240
|
}
|
|
296915
296241
|
async function generatePdfReportWorkaround(htmlPath, pdfPath) {
|
|
296916
|
-
const { spawn:
|
|
296242
|
+
const { spawn: spawn2 } = await import("child_process");
|
|
296917
296243
|
return new Promise((resolve12, reject) => {
|
|
296918
296244
|
const nodeScript = `
|
|
296919
296245
|
const puppeteer = require('puppeteer');
|
|
@@ -296937,7 +296263,7 @@ const fs = require('fs');
|
|
|
296937
296263
|
}
|
|
296938
296264
|
})();
|
|
296939
296265
|
`;
|
|
296940
|
-
const nodeProcess =
|
|
296266
|
+
const nodeProcess = spawn2("node", ["-e", nodeScript], {
|
|
296941
296267
|
stdio: "inherit",
|
|
296942
296268
|
cwd: process.cwd()
|
|
296943
296269
|
});
|
|
@@ -297165,8 +296491,307 @@ The report command analyzes raw JSON outputs from scenario matrix runs and gener
|
|
|
297165
296491
|
comprehensive performance reports with statistics, parameter comparisons, and trajectory analysis.
|
|
297166
296492
|
`).addCommand(createGenerateCommand());
|
|
297167
296493
|
|
|
297168
|
-
// src/
|
|
297169
|
-
|
|
296494
|
+
// src/project.ts
|
|
296495
|
+
import {
|
|
296496
|
+
logger as logger41
|
|
296497
|
+
} from "@elizaos/core";
|
|
296498
|
+
import { stringToUuid } from "@elizaos/core";
|
|
296499
|
+
import * as fs31 from "fs";
|
|
296500
|
+
import path57 from "path";
|
|
296501
|
+
init_directory_detection();
|
|
296502
|
+
function isPlugin(module) {
|
|
296503
|
+
if (module && typeof module === "object" && typeof module.name === "string" && typeof module.description === "string") {
|
|
296504
|
+
return true;
|
|
296505
|
+
}
|
|
296506
|
+
if (module && typeof module === "object" && module.default && typeof module.default === "object" && typeof module.default.name === "string" && typeof module.default.description === "string") {
|
|
296507
|
+
return true;
|
|
296508
|
+
}
|
|
296509
|
+
for (const key in module) {
|
|
296510
|
+
if (key !== "default" && module[key] && typeof module[key] === "object" && typeof module[key].name === "string" && typeof module[key].description === "string") {
|
|
296511
|
+
return true;
|
|
296512
|
+
}
|
|
296513
|
+
}
|
|
296514
|
+
return false;
|
|
296515
|
+
}
|
|
296516
|
+
function extractPlugin(module) {
|
|
296517
|
+
if (module && typeof module === "object" && typeof module.name === "string" && typeof module.description === "string") {
|
|
296518
|
+
return module;
|
|
296519
|
+
}
|
|
296520
|
+
if (module && typeof module === "object" && module.default && typeof module.default === "object" && typeof module.default.name === "string" && typeof module.default.description === "string") {
|
|
296521
|
+
return module.default;
|
|
296522
|
+
}
|
|
296523
|
+
for (const key in module) {
|
|
296524
|
+
if (key !== "default" && module[key] && typeof module[key] === "object" && typeof module[key].name === "string" && typeof module[key].description === "string") {
|
|
296525
|
+
return module[key];
|
|
296526
|
+
}
|
|
296527
|
+
}
|
|
296528
|
+
throw new Error("Could not extract plugin from module");
|
|
296529
|
+
}
|
|
296530
|
+
async function loadProject(dir) {
|
|
296531
|
+
try {
|
|
296532
|
+
const dirInfo = detectDirectoryType(dir);
|
|
296533
|
+
if (!dirInfo.hasPackageJson) {
|
|
296534
|
+
throw new Error(`No package.json found in ${dir}`);
|
|
296535
|
+
}
|
|
296536
|
+
const packageJson = JSON.parse(fs31.readFileSync(path57.join(dir, "package.json"), "utf8"));
|
|
296537
|
+
const main2 = packageJson.main;
|
|
296538
|
+
if (!main2) {
|
|
296539
|
+
logger41.warn("No main field found in package.json, using default character");
|
|
296540
|
+
const defaultCharacterName = "Eliza (Default)";
|
|
296541
|
+
const elizaCharacter = getElizaCharacter();
|
|
296542
|
+
const defaultAgent = {
|
|
296543
|
+
character: {
|
|
296544
|
+
...elizaCharacter,
|
|
296545
|
+
id: stringToUuid(defaultCharacterName),
|
|
296546
|
+
name: defaultCharacterName
|
|
296547
|
+
},
|
|
296548
|
+
init: async () => {
|
|
296549
|
+
logger41.info("Initializing default Eliza character");
|
|
296550
|
+
}
|
|
296551
|
+
};
|
|
296552
|
+
return {
|
|
296553
|
+
agents: [defaultAgent],
|
|
296554
|
+
dir
|
|
296555
|
+
};
|
|
296556
|
+
}
|
|
296557
|
+
const entryPoints = [
|
|
296558
|
+
path57.join(dir, main2),
|
|
296559
|
+
path57.join(dir, "dist/index.js"),
|
|
296560
|
+
path57.join(dir, "src/index.ts"),
|
|
296561
|
+
path57.join(dir, "src/index.js"),
|
|
296562
|
+
path57.join(dir, "index.ts"),
|
|
296563
|
+
path57.join(dir, "index.js")
|
|
296564
|
+
];
|
|
296565
|
+
let projectModule = null;
|
|
296566
|
+
for (const entryPoint of entryPoints) {
|
|
296567
|
+
if (fs31.existsSync(entryPoint)) {
|
|
296568
|
+
try {
|
|
296569
|
+
const importPath = path57.resolve(entryPoint);
|
|
296570
|
+
const importUrl = process.platform === "win32" ? "file:///" + importPath.replace(/\\/g, "/") : "file://" + importPath;
|
|
296571
|
+
projectModule = await import(importUrl);
|
|
296572
|
+
logger41.info(`Loaded project from ${entryPoint}`);
|
|
296573
|
+
const exportKeys = Object.keys(projectModule);
|
|
296574
|
+
logger41.debug({ exportKeys }, `Module exports:`);
|
|
296575
|
+
if (exportKeys.includes("default")) {
|
|
296576
|
+
logger41.debug({ type: typeof projectModule.default }, `Default export type:`);
|
|
296577
|
+
if (typeof projectModule.default === "object" && projectModule.default !== null) {
|
|
296578
|
+
logger41.debug({ keys: Object.keys(projectModule.default) }, `Default export keys:`);
|
|
296579
|
+
}
|
|
296580
|
+
}
|
|
296581
|
+
break;
|
|
296582
|
+
} catch (error2) {
|
|
296583
|
+
logger41.warn({ error: error2, entryPoint }, `Failed to import project`);
|
|
296584
|
+
}
|
|
296585
|
+
}
|
|
296586
|
+
}
|
|
296587
|
+
if (!projectModule) {
|
|
296588
|
+
throw new Error("Could not find project entry point");
|
|
296589
|
+
}
|
|
296590
|
+
const moduleIsPlugin = isPlugin(projectModule);
|
|
296591
|
+
logger41.debug({ moduleIsPlugin }, `Is this a plugin?`);
|
|
296592
|
+
if (moduleIsPlugin) {
|
|
296593
|
+
logger41.info("Detected plugin module instead of project");
|
|
296594
|
+
try {
|
|
296595
|
+
const plugin = extractPlugin(projectModule);
|
|
296596
|
+
logger41.debug({ name: plugin.name, description: plugin.description }, `Found plugin:`);
|
|
296597
|
+
logger41.debug({ keys: Object.keys(plugin) }, `Plugin has the following properties:`);
|
|
296598
|
+
const completePlugin = {
|
|
296599
|
+
...plugin,
|
|
296600
|
+
name: plugin.name || "unknown-plugin",
|
|
296601
|
+
description: plugin.description || "No description",
|
|
296602
|
+
init: plugin.init || (async () => {
|
|
296603
|
+
logger41.info(`Dummy init for plugin: ${plugin.name}`);
|
|
296604
|
+
})
|
|
296605
|
+
};
|
|
296606
|
+
const characterName = "Eliza (Test Mode)";
|
|
296607
|
+
const elizaCharacter = getElizaCharacter();
|
|
296608
|
+
const testCharacter = {
|
|
296609
|
+
...elizaCharacter,
|
|
296610
|
+
id: stringToUuid(characterName),
|
|
296611
|
+
name: characterName,
|
|
296612
|
+
system: `${elizaCharacter.system} Testing the plugin: ${completePlugin.name}.`
|
|
296613
|
+
};
|
|
296614
|
+
logger41.info(`Using Eliza character as test agent for plugin: ${completePlugin.name}`);
|
|
296615
|
+
const testAgent = {
|
|
296616
|
+
character: testCharacter,
|
|
296617
|
+
plugins: [completePlugin],
|
|
296618
|
+
init: async () => {
|
|
296619
|
+
logger41.info(`Initializing Eliza test agent for plugin: ${completePlugin.name}`);
|
|
296620
|
+
}
|
|
296621
|
+
};
|
|
296622
|
+
return {
|
|
296623
|
+
agents: [testAgent],
|
|
296624
|
+
dir,
|
|
296625
|
+
isPlugin: true,
|
|
296626
|
+
pluginModule: completePlugin
|
|
296627
|
+
};
|
|
296628
|
+
} catch (error2) {
|
|
296629
|
+
logger41.error("Error extracting plugin from module:", error2 instanceof Error ? error2.message : String(error2));
|
|
296630
|
+
throw error2;
|
|
296631
|
+
}
|
|
296632
|
+
}
|
|
296633
|
+
const agents = [];
|
|
296634
|
+
if (projectModule.default && typeof projectModule.default === "object" && Array.isArray(projectModule.default.agents)) {
|
|
296635
|
+
agents.push(...projectModule.default.agents);
|
|
296636
|
+
logger41.debug({ count: agents.length }, `Found agents in default export's agents array`);
|
|
296637
|
+
} else {
|
|
296638
|
+
for (const [key, value] of Object.entries(projectModule)) {
|
|
296639
|
+
if (key === "default" && value && typeof value === "object") {
|
|
296640
|
+
if (value.character && value.init) {
|
|
296641
|
+
agents.push(value);
|
|
296642
|
+
logger41.debug(`Found agent in default export (single agent)`);
|
|
296643
|
+
}
|
|
296644
|
+
} else if (value && typeof value === "object" && value.character && value.init) {
|
|
296645
|
+
agents.push(value);
|
|
296646
|
+
logger41.debug({ key }, `Found agent in named export`);
|
|
296647
|
+
}
|
|
296648
|
+
}
|
|
296649
|
+
}
|
|
296650
|
+
if (agents.length === 0) {
|
|
296651
|
+
throw new Error("No agents found in project");
|
|
296652
|
+
}
|
|
296653
|
+
const project = {
|
|
296654
|
+
agents,
|
|
296655
|
+
dir
|
|
296656
|
+
};
|
|
296657
|
+
return project;
|
|
296658
|
+
} catch (error2) {
|
|
296659
|
+
logger41.error({ error: error2 }, "Error loading project:");
|
|
296660
|
+
throw error2;
|
|
296661
|
+
}
|
|
296662
|
+
}
|
|
296663
|
+
|
|
296664
|
+
// src/commands/start/index.ts
|
|
296665
|
+
init_utils();
|
|
296666
|
+
init_build_project();
|
|
296667
|
+
init_directory_detection();
|
|
296668
|
+
init_module_loader();
|
|
296669
|
+
|
|
296670
|
+
// src/utils/port-validation.ts
|
|
296671
|
+
function validatePort(value) {
|
|
296672
|
+
const port = Number.parseInt(value, 10);
|
|
296673
|
+
if (Number.isNaN(port) || port <= 0 || port > 65535) {
|
|
296674
|
+
throw new Error("Port must be a number between 1 and 65535");
|
|
296675
|
+
}
|
|
296676
|
+
return port;
|
|
296677
|
+
}
|
|
296678
|
+
|
|
296679
|
+
// src/commands/start/index.ts
|
|
296680
|
+
init_esm();
|
|
296681
|
+
var import_dotenv4 = __toESM(require_main(), 1);
|
|
296682
|
+
import { logger as logger42 } from "@elizaos/core";
|
|
296683
|
+
import * as fs32 from "fs";
|
|
296684
|
+
import * as path58 from "path";
|
|
296685
|
+
var start = new Command().name("start").description("Build and start the Eliza agent server").option("-c, --configure", "Reconfigure services and AI models").option("-p, --port <port>", "Port to listen on", validatePort).option("--character <paths...>", "Character file(s) to use").hook("preAction", async () => {
|
|
296686
|
+
await displayBanner();
|
|
296687
|
+
}).action(async (options) => {
|
|
296688
|
+
try {
|
|
296689
|
+
const envPath = path58.join(process.cwd(), ".env");
|
|
296690
|
+
if (fs32.existsSync(envPath)) {
|
|
296691
|
+
import_dotenv4.default.config({ path: envPath });
|
|
296692
|
+
}
|
|
296693
|
+
await ensureElizaOSCli();
|
|
296694
|
+
const localModulesPath = path58.join(process.cwd(), "node_modules");
|
|
296695
|
+
if (process.env.NODE_PATH) {
|
|
296696
|
+
process.env.NODE_PATH = `${localModulesPath}${path58.delimiter}${process.env.NODE_PATH}`;
|
|
296697
|
+
} else {
|
|
296698
|
+
process.env.NODE_PATH = localModulesPath;
|
|
296699
|
+
}
|
|
296700
|
+
const localBinPath = path58.join(process.cwd(), "node_modules", ".bin");
|
|
296701
|
+
if (process.env.PATH) {
|
|
296702
|
+
process.env.PATH = `${localBinPath}${path58.delimiter}${process.env.PATH}`;
|
|
296703
|
+
} else {
|
|
296704
|
+
process.env.PATH = localBinPath;
|
|
296705
|
+
}
|
|
296706
|
+
if (!process.env.PGLITE_WASM_MODE) {
|
|
296707
|
+
process.env.PGLITE_WASM_MODE = "node";
|
|
296708
|
+
}
|
|
296709
|
+
const cwd = process.cwd();
|
|
296710
|
+
const dirInfo = detectDirectoryType(cwd);
|
|
296711
|
+
const isMonorepo = dirInfo.type === "elizaos-monorepo";
|
|
296712
|
+
if (!isMonorepo && !process.env.ELIZA_TEST_MODE) {
|
|
296713
|
+
try {
|
|
296714
|
+
await buildProject(cwd, false);
|
|
296715
|
+
} catch (error2) {
|
|
296716
|
+
logger42.error("Build error:", error2 instanceof Error ? error2.message : String(error2));
|
|
296717
|
+
logger42.warn("Build failed, but continuing with start. Some features may not work correctly.");
|
|
296718
|
+
}
|
|
296719
|
+
}
|
|
296720
|
+
let characters = [];
|
|
296721
|
+
let projectAgents = [];
|
|
296722
|
+
if (options.character && options.character.length > 0) {
|
|
296723
|
+
const moduleLoader2 = getModuleLoader();
|
|
296724
|
+
const serverModule = await moduleLoader2.load("@elizaos/server");
|
|
296725
|
+
const { loadCharacterTryPath } = serverModule;
|
|
296726
|
+
for (const charPath of options.character) {
|
|
296727
|
+
const resolvedPath = path58.resolve(charPath);
|
|
296728
|
+
if (!fs32.existsSync(resolvedPath)) {
|
|
296729
|
+
logger42.error(`Character file not found: ${resolvedPath}`);
|
|
296730
|
+
throw new Error(`Character file not found: ${resolvedPath}`);
|
|
296731
|
+
}
|
|
296732
|
+
try {
|
|
296733
|
+
const character = await loadCharacterTryPath(resolvedPath);
|
|
296734
|
+
if (character) {
|
|
296735
|
+
characters.push(character);
|
|
296736
|
+
logger42.info(`Successfully loaded character: ${character.name}`);
|
|
296737
|
+
} else {
|
|
296738
|
+
logger42.error(`Failed to load character from ${resolvedPath}: Invalid or empty character file`);
|
|
296739
|
+
throw new Error(`Invalid character file: ${resolvedPath}`);
|
|
296740
|
+
}
|
|
296741
|
+
} catch (e2) {
|
|
296742
|
+
logger42.error({ error: e2, resolvedPath }, `Failed to load character from path:`);
|
|
296743
|
+
throw new Error(`Invalid character file: ${resolvedPath}`);
|
|
296744
|
+
}
|
|
296745
|
+
}
|
|
296746
|
+
} else {
|
|
296747
|
+
try {
|
|
296748
|
+
const cwd2 = process.cwd();
|
|
296749
|
+
const dirInfo2 = detectDirectoryType(cwd2);
|
|
296750
|
+
if (dirInfo2.hasPackageJson && dirInfo2.type !== "non-elizaos-dir") {
|
|
296751
|
+
logger42.info("No character files specified, attempting to load project agents...");
|
|
296752
|
+
const project = await loadProject(cwd2);
|
|
296753
|
+
if (project.agents && project.agents.length > 0) {
|
|
296754
|
+
logger42.info(`Found ${project.agents.length} agent(s) in project configuration`);
|
|
296755
|
+
projectAgents = project.agents;
|
|
296756
|
+
for (const agent2 of project.agents) {
|
|
296757
|
+
if (agent2.character) {
|
|
296758
|
+
logger42.info(`Loaded character: ${agent2.character.name}`);
|
|
296759
|
+
}
|
|
296760
|
+
}
|
|
296761
|
+
}
|
|
296762
|
+
}
|
|
296763
|
+
} catch (e2) {
|
|
296764
|
+
logger42.debug({ error: e2 }, "Failed to load project agents, will use default character:");
|
|
296765
|
+
}
|
|
296766
|
+
}
|
|
296767
|
+
const moduleLoader = getModuleLoader();
|
|
296768
|
+
const { AgentServer } = await moduleLoader.load("@elizaos/server");
|
|
296769
|
+
const server2 = new AgentServer;
|
|
296770
|
+
await server2.initialize({
|
|
296771
|
+
dataDir: process.env.PGLITE_DATA_DIR,
|
|
296772
|
+
postgresUrl: process.env.POSTGRES_URL
|
|
296773
|
+
});
|
|
296774
|
+
await server2.start(options.port || 3000);
|
|
296775
|
+
if (projectAgents && projectAgents.length > 0) {
|
|
296776
|
+
const charactersToStart = projectAgents.map((pa) => pa.character);
|
|
296777
|
+
const runtimes = await server2.startAgents(charactersToStart);
|
|
296778
|
+
for (let i = 0;i < projectAgents.length; i++) {
|
|
296779
|
+
const init = projectAgents[i]?.init;
|
|
296780
|
+
const runtime = runtimes[i];
|
|
296781
|
+
if (typeof init === "function" && runtime) {
|
|
296782
|
+
await init(runtime);
|
|
296783
|
+
}
|
|
296784
|
+
}
|
|
296785
|
+
logger42.info(`Started ${runtimes.length} project agents`);
|
|
296786
|
+
} else if (characters && characters.length > 0) {
|
|
296787
|
+
const runtimes = await server2.startAgents(characters);
|
|
296788
|
+
logger42.info(`Started ${runtimes.length} agents`);
|
|
296789
|
+
}
|
|
296790
|
+
} catch (e2) {
|
|
296791
|
+
handleError(e2);
|
|
296792
|
+
process.exit(1);
|
|
296793
|
+
}
|
|
296794
|
+
});
|
|
297170
296795
|
|
|
297171
296796
|
// src/commands/tee/index.ts
|
|
297172
296797
|
init_esm();
|
|
@@ -297174,45 +296799,45 @@ init_esm();
|
|
|
297174
296799
|
// src/commands/tee/phala-wrapper.ts
|
|
297175
296800
|
init_esm();
|
|
297176
296801
|
init_emoji_handler();
|
|
297177
|
-
import { spawn as
|
|
297178
|
-
import { logger as
|
|
296802
|
+
import { spawn as spawn2 } from "child_process";
|
|
296803
|
+
import { logger as logger43 } from "@elizaos/core";
|
|
297179
296804
|
var phalaCliCommand = new Command("phala").description("Official Phala Cloud CLI - Manage TEE deployments on Phala Cloud").allowUnknownOption().helpOption(false).allowExcessArguments(true).passThroughOptions().argument("[args...]", "All arguments to pass to Phala CLI").action(async (...commandArgs) => {
|
|
297180
296805
|
const cmd = commandArgs[commandArgs.length - 1];
|
|
297181
296806
|
const raw = cmd?.parent?.rawArgs ?? cmd?.rawArgs ?? process.argv;
|
|
297182
296807
|
const idx = raw.findIndex((arg) => arg === "phala");
|
|
297183
296808
|
const args = idx >= 0 ? raw.slice(idx + 1) : Array.isArray(commandArgs[0]) ? commandArgs[0] : [];
|
|
297184
296809
|
try {
|
|
297185
|
-
|
|
297186
|
-
const phalaProcess =
|
|
296810
|
+
logger43.info({ args }, "Running Phala CLI command");
|
|
296811
|
+
const phalaProcess = spawn2("npx", ["--yes", "phala", ...args], {
|
|
297187
296812
|
stdio: "inherit"
|
|
297188
296813
|
});
|
|
297189
296814
|
phalaProcess.on("error", (err) => {
|
|
297190
296815
|
const error2 = err;
|
|
297191
|
-
|
|
296816
|
+
logger43.error({ error: error2, args }, "Failed to execute Phala CLI");
|
|
297192
296817
|
if (error2.code === "ENOENT") {
|
|
297193
|
-
|
|
296818
|
+
logger43.error(`
|
|
297194
296819
|
${emoji.error("Error: npx not found. Please install Node.js and npm:")}`);
|
|
297195
|
-
|
|
297196
|
-
|
|
296820
|
+
logger43.error(" Visit https://nodejs.org or use a version manager like nvm");
|
|
296821
|
+
logger43.error(" curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash");
|
|
297197
296822
|
} else {
|
|
297198
|
-
|
|
296823
|
+
logger43.error(`
|
|
297199
296824
|
${emoji.error("Error: Failed to execute Phala CLI")}`);
|
|
297200
|
-
|
|
296825
|
+
logger43.error({ args }, " Try running directly: npx phala [args]");
|
|
297201
296826
|
}
|
|
297202
296827
|
process.exit(1);
|
|
297203
296828
|
});
|
|
297204
296829
|
phalaProcess.on("exit", (code) => {
|
|
297205
296830
|
if (code !== 0) {
|
|
297206
|
-
|
|
296831
|
+
logger43.warn({ code }, "Phala CLI exited with non-zero code");
|
|
297207
296832
|
}
|
|
297208
296833
|
process.exit(code || 0);
|
|
297209
296834
|
});
|
|
297210
296835
|
} catch (error2) {
|
|
297211
|
-
|
|
297212
|
-
|
|
296836
|
+
logger43.error({ error: error2, args }, "Error running Phala CLI");
|
|
296837
|
+
logger43.error(`
|
|
297213
296838
|
${emoji.error("Error: Failed to run Phala CLI")}`);
|
|
297214
|
-
|
|
297215
|
-
|
|
296839
|
+
logger43.error({ args }, " Try running Phala CLI directly with: npx phala [args]");
|
|
296840
|
+
logger43.error(" Or visit https://www.npmjs.com/package/phala for more information");
|
|
297216
296841
|
process.exit(1);
|
|
297217
296842
|
}
|
|
297218
296843
|
}).configureHelp({
|
|
@@ -297239,20 +296864,19 @@ var teeCommand = new Command("tee").description("Manage TEE deployments").enable
|
|
|
297239
296864
|
// src/commands/test/index.ts
|
|
297240
296865
|
init_utils();
|
|
297241
296866
|
init_esm();
|
|
297242
|
-
import { logger as
|
|
296867
|
+
import { logger as logger50 } from "@elizaos/core";
|
|
297243
296868
|
|
|
297244
296869
|
// src/commands/test/actions/run-all-tests.ts
|
|
297245
|
-
import { logger as
|
|
296870
|
+
import { logger as logger48 } from "@elizaos/core";
|
|
297246
296871
|
|
|
297247
296872
|
// src/commands/test/utils/project-utils.ts
|
|
297248
296873
|
init_directory_detection();
|
|
297249
|
-
init_project();
|
|
297250
296874
|
init_run_bun();
|
|
297251
|
-
import { logger as
|
|
296875
|
+
import { logger as logger44 } from "@elizaos/core";
|
|
297252
296876
|
import * as fs33 from "fs";
|
|
297253
|
-
import
|
|
296877
|
+
import path59 from "path";
|
|
297254
296878
|
function getProjectType(testPath) {
|
|
297255
|
-
const targetPath = testPath ?
|
|
296879
|
+
const targetPath = testPath ? path59.resolve(process.cwd(), testPath) : process.cwd();
|
|
297256
296880
|
return detectDirectoryType(targetPath);
|
|
297257
296881
|
}
|
|
297258
296882
|
function processFilterName(name) {
|
|
@@ -297272,11 +296896,11 @@ async function installPluginDependencies(projectInfo) {
|
|
|
297272
296896
|
}
|
|
297273
296897
|
const project = await loadProject(process.cwd());
|
|
297274
296898
|
if (project.isPlugin && project.pluginModule?.dependencies && project.pluginModule.dependencies.length > 0) {
|
|
297275
|
-
const pluginsDir =
|
|
296899
|
+
const pluginsDir = path59.join(process.cwd(), ".eliza", "plugins");
|
|
297276
296900
|
if (!fs33.existsSync(pluginsDir)) {
|
|
297277
296901
|
await fs33.promises.mkdir(pluginsDir, { recursive: true });
|
|
297278
296902
|
}
|
|
297279
|
-
const packageJsonPath =
|
|
296903
|
+
const packageJsonPath = path59.join(pluginsDir, "package.json");
|
|
297280
296904
|
if (!fs33.existsSync(packageJsonPath)) {
|
|
297281
296905
|
const packageJsonContent = {
|
|
297282
296906
|
name: "test-plugin-dependencies",
|
|
@@ -297289,12 +296913,12 @@ async function installPluginDependencies(projectInfo) {
|
|
|
297289
296913
|
const { installPlugin: installPlugin2 } = await Promise.resolve().then(() => (init_utils(), exports_utils));
|
|
297290
296914
|
for (const dependency of project.pluginModule.dependencies) {
|
|
297291
296915
|
await installPlugin2(dependency, pluginsDir);
|
|
297292
|
-
const dependencyPath =
|
|
296916
|
+
const dependencyPath = path59.join(pluginsDir, "node_modules", dependency);
|
|
297293
296917
|
if (fs33.existsSync(dependencyPath)) {
|
|
297294
296918
|
try {
|
|
297295
296919
|
await runBunCommand(["install"], dependencyPath);
|
|
297296
296920
|
} catch (error2) {
|
|
297297
|
-
|
|
296921
|
+
logger44.warn(`[Test Command] Failed to install devDependencies for ${dependency}: ${error2}`);
|
|
297298
296922
|
}
|
|
297299
296923
|
}
|
|
297300
296924
|
}
|
|
@@ -297304,17 +296928,17 @@ async function installPluginDependencies(projectInfo) {
|
|
|
297304
296928
|
// src/commands/test/actions/component-tests.ts
|
|
297305
296929
|
init_utils();
|
|
297306
296930
|
init_bun_exec();
|
|
297307
|
-
import { logger as
|
|
297308
|
-
import
|
|
296931
|
+
import { logger as logger46 } from "@elizaos/core";
|
|
296932
|
+
import path61 from "path";
|
|
297309
296933
|
|
|
297310
296934
|
// src/utils/testing/tsc-validator.ts
|
|
297311
296935
|
init_bun_exec();
|
|
297312
|
-
import { logger as
|
|
297313
|
-
import
|
|
297314
|
-
import { existsSync as
|
|
296936
|
+
import { logger as logger45 } from "@elizaos/core";
|
|
296937
|
+
import path60 from "path";
|
|
296938
|
+
import { existsSync as existsSync42 } from "fs";
|
|
297315
296939
|
async function runTypeCheck(projectPath, strict = true) {
|
|
297316
|
-
const tsconfigPath =
|
|
297317
|
-
if (!
|
|
296940
|
+
const tsconfigPath = path60.join(projectPath, "tsconfig.json");
|
|
296941
|
+
if (!existsSync42(tsconfigPath)) {
|
|
297318
296942
|
return {
|
|
297319
296943
|
success: false,
|
|
297320
296944
|
errors: [`No tsconfig.json found at ${tsconfigPath}`],
|
|
@@ -297337,7 +296961,7 @@ async function runTypeCheck(projectPath, strict = true) {
|
|
|
297337
296961
|
warnings: stderr.includes("warning") ? [stderr] : []
|
|
297338
296962
|
};
|
|
297339
296963
|
} catch (error2) {
|
|
297340
|
-
|
|
296964
|
+
logger45.error({ error: error2 }, "TypeScript validation failed:");
|
|
297341
296965
|
return {
|
|
297342
296966
|
success: false,
|
|
297343
296967
|
errors: [`TypeScript validation error: ${error2.message}`],
|
|
@@ -297351,38 +296975,38 @@ async function runComponentTests(testPath, options, projectInfo) {
|
|
|
297351
296975
|
const cwd = process.cwd();
|
|
297352
296976
|
const isPlugin2 = projectInfo.type === "elizaos-plugin";
|
|
297353
296977
|
if (!options.skipTypeCheck) {
|
|
297354
|
-
|
|
296978
|
+
logger46.info("Running TypeScript validation...");
|
|
297355
296979
|
const typeCheckResult = await runTypeCheck(cwd, true);
|
|
297356
296980
|
if (!typeCheckResult.success) {
|
|
297357
|
-
|
|
297358
|
-
typeCheckResult.errors.forEach((error2) =>
|
|
296981
|
+
logger46.error("TypeScript validation failed:");
|
|
296982
|
+
typeCheckResult.errors.forEach((error2) => logger46.error(error2));
|
|
297359
296983
|
return { failed: true };
|
|
297360
296984
|
}
|
|
297361
|
-
|
|
296985
|
+
logger46.success("TypeScript validation passed");
|
|
297362
296986
|
}
|
|
297363
296987
|
if (!options.skipBuild) {
|
|
297364
296988
|
try {
|
|
297365
|
-
|
|
296989
|
+
logger46.info(`Building ${isPlugin2 ? "plugin" : "project"}...`);
|
|
297366
296990
|
await buildProject(cwd, isPlugin2);
|
|
297367
|
-
|
|
296991
|
+
logger46.success(`Build completed successfully`);
|
|
297368
296992
|
} catch (buildError) {
|
|
297369
|
-
|
|
296993
|
+
logger46.error(`Build failed: ${buildError}`);
|
|
297370
296994
|
return { failed: true };
|
|
297371
296995
|
}
|
|
297372
296996
|
}
|
|
297373
|
-
|
|
296997
|
+
logger46.info("Running component tests...");
|
|
297374
296998
|
const args = ["test", "--passWithNoTests"];
|
|
297375
296999
|
if (options.name) {
|
|
297376
297000
|
const baseName = processFilterName(options.name);
|
|
297377
297001
|
if (baseName) {
|
|
297378
|
-
|
|
297002
|
+
logger46.info(`Using test filter: ${baseName}`);
|
|
297379
297003
|
args.push("-t", baseName);
|
|
297380
297004
|
}
|
|
297381
297005
|
}
|
|
297382
297006
|
const monorepoRoot = UserEnvironment.getInstance().findMonorepoRoot(process.cwd());
|
|
297383
297007
|
const baseDir = monorepoRoot ?? process.cwd();
|
|
297384
|
-
const targetPath = testPath ?
|
|
297385
|
-
|
|
297008
|
+
const targetPath = testPath ? path61.resolve(baseDir, testPath) : process.cwd();
|
|
297009
|
+
logger46.info(`Executing: bun ${args.join(" ")} in ${targetPath}`);
|
|
297386
297010
|
try {
|
|
297387
297011
|
const result = await bunExecInherit("bun", args, {
|
|
297388
297012
|
cwd: targetPath,
|
|
@@ -297391,35 +297015,32 @@ async function runComponentTests(testPath, options, projectInfo) {
|
|
|
297391
297015
|
CI: ""
|
|
297392
297016
|
}
|
|
297393
297017
|
});
|
|
297394
|
-
|
|
297018
|
+
logger46.info("Component tests completed");
|
|
297395
297019
|
return { failed: !result.success };
|
|
297396
297020
|
} catch (error2) {
|
|
297397
|
-
|
|
297021
|
+
logger46.error({ error: error2 }, "Error running component tests:");
|
|
297398
297022
|
return { failed: true };
|
|
297399
297023
|
}
|
|
297400
297024
|
}
|
|
297401
297025
|
|
|
297402
297026
|
// src/commands/test/actions/e2e-tests.ts
|
|
297403
|
-
init_project();
|
|
297404
297027
|
init_utils();
|
|
297405
297028
|
init_module_loader();
|
|
297406
297029
|
var dotenv5 = __toESM(require_main(), 1);
|
|
297407
|
-
|
|
297408
|
-
init_start();
|
|
297409
|
-
import { logger as logger51 } from "@elizaos/core";
|
|
297030
|
+
import { logger as logger47 } from "@elizaos/core";
|
|
297410
297031
|
import * as fs34 from "fs";
|
|
297411
|
-
import
|
|
297032
|
+
import path62 from "path";
|
|
297412
297033
|
async function runE2eTests(testPath, options, projectInfo) {
|
|
297413
297034
|
if (!options.skipBuild) {
|
|
297414
297035
|
try {
|
|
297415
297036
|
const cwd = process.cwd();
|
|
297416
297037
|
const isPlugin2 = projectInfo.type === "elizaos-plugin";
|
|
297417
|
-
|
|
297038
|
+
logger47.info(`Building ${isPlugin2 ? "plugin" : "project"}...`);
|
|
297418
297039
|
await buildProject(cwd, isPlugin2);
|
|
297419
|
-
|
|
297040
|
+
logger47.info(`Build completed successfully`);
|
|
297420
297041
|
} catch (buildError) {
|
|
297421
|
-
|
|
297422
|
-
|
|
297042
|
+
logger47.error(`Build error: ${buildError}`);
|
|
297043
|
+
logger47.warn(`Attempting to continue with tests despite build error`);
|
|
297423
297044
|
}
|
|
297424
297045
|
}
|
|
297425
297046
|
let server2;
|
|
@@ -297429,10 +297050,10 @@ async function runE2eTests(testPath, options, projectInfo) {
|
|
|
297429
297050
|
const moduleLoader = getModuleLoader();
|
|
297430
297051
|
const serverModule = await moduleLoader.load("@elizaos/server");
|
|
297431
297052
|
const { AgentServer, jsonToCharacter, loadCharacterTryPath } = serverModule;
|
|
297432
|
-
const elizaDir =
|
|
297433
|
-
const packageName =
|
|
297053
|
+
const elizaDir = path62.join(process.cwd(), ".eliza");
|
|
297054
|
+
const packageName = path62.basename(process.cwd());
|
|
297434
297055
|
const timestamp = Date.now();
|
|
297435
|
-
const uniqueDbDir =
|
|
297056
|
+
const uniqueDbDir = path62.join(process.cwd(), ".elizadb-test", `${packageName}-${timestamp}`);
|
|
297436
297057
|
const elizaDbDir = uniqueDbDir;
|
|
297437
297058
|
const envInfo = await UserEnvironment.getInstanceInfo();
|
|
297438
297059
|
const envFilePath = envInfo.paths.envFilePath;
|
|
@@ -297456,120 +297077,126 @@ async function runE2eTests(testPath, options, projectInfo) {
|
|
|
297456
297077
|
process.env.PGLITE_DATA_DIR = elizaDbDir;
|
|
297457
297078
|
console.info(`Set PGLITE_DATA_DIR to: ${elizaDbDir}`);
|
|
297458
297079
|
if (fs34.existsSync(envFilePath)) {
|
|
297459
|
-
|
|
297080
|
+
logger47.info(`Loading environment variables from: ${envFilePath}`);
|
|
297460
297081
|
dotenv5.config({ path: envFilePath });
|
|
297461
|
-
|
|
297082
|
+
logger47.info("Environment variables loaded");
|
|
297462
297083
|
} else {
|
|
297463
|
-
|
|
297084
|
+
logger47.warn(`Environment file not found: ${envFilePath}`);
|
|
297464
297085
|
}
|
|
297465
297086
|
const postgresUrl = process.env.POSTGRES_URL;
|
|
297466
|
-
|
|
297467
|
-
|
|
297087
|
+
logger47.info(`PostgreSQL URL for e2e tests: ${postgresUrl ? "found" : "not found (will use PGlite)"}`);
|
|
297088
|
+
logger47.info("Creating server instance...");
|
|
297468
297089
|
server2 = new AgentServer;
|
|
297469
|
-
|
|
297470
|
-
|
|
297090
|
+
logger47.info("Server instance created");
|
|
297091
|
+
logger47.info("Initializing server...");
|
|
297471
297092
|
try {
|
|
297472
297093
|
await server2.initialize({
|
|
297473
297094
|
dataDir: elizaDbDir,
|
|
297474
297095
|
postgresUrl
|
|
297475
297096
|
});
|
|
297476
|
-
|
|
297097
|
+
logger47.info("Server initialized successfully");
|
|
297477
297098
|
} catch (initError) {
|
|
297478
|
-
|
|
297099
|
+
logger47.error({ error: initError }, "Server initialization failed:");
|
|
297479
297100
|
throw initError;
|
|
297480
297101
|
}
|
|
297481
297102
|
let project;
|
|
297482
297103
|
try {
|
|
297483
|
-
|
|
297104
|
+
logger47.info("Attempting to load project or plugin...");
|
|
297484
297105
|
const monorepoRoot = UserEnvironment.getInstance().findMonorepoRoot(process.cwd());
|
|
297485
297106
|
const baseDir = monorepoRoot ?? process.cwd();
|
|
297486
|
-
const targetPath = testPath ?
|
|
297107
|
+
const targetPath = testPath ? path62.resolve(baseDir, testPath) : process.cwd();
|
|
297487
297108
|
project = await loadProject(targetPath);
|
|
297488
|
-
if (!project
|
|
297489
|
-
throw new Error("
|
|
297109
|
+
if (!project) {
|
|
297110
|
+
throw new Error("Failed to load project");
|
|
297111
|
+
}
|
|
297112
|
+
if (!project.isPlugin && (!project.agents || project.agents.length === 0)) {
|
|
297113
|
+
logger47.warn("No agents found in project configuration; falling back to default Eliza character for tests.");
|
|
297490
297114
|
}
|
|
297491
|
-
|
|
297492
|
-
|
|
297115
|
+
logger47.info(`Found ${project.agents?.length || 0} agents`);
|
|
297116
|
+
logger47.info("Setting up server properties...");
|
|
297117
|
+
const { AgentManager } = serverModule;
|
|
297118
|
+
const agentManager = new AgentManager(server2);
|
|
297493
297119
|
server2.startAgent = async (character) => {
|
|
297494
|
-
|
|
297495
|
-
|
|
297120
|
+
logger47.info(`Starting agent for character ${character.name}`);
|
|
297121
|
+
const [runtime] = await agentManager.startAgents([character], undefined, [], { isTestMode: true });
|
|
297122
|
+
return runtime;
|
|
297496
297123
|
};
|
|
297497
297124
|
server2.loadCharacterTryPath = loadCharacterTryPath;
|
|
297498
297125
|
server2.jsonToCharacter = jsonToCharacter;
|
|
297499
|
-
|
|
297126
|
+
logger47.info("Server properties set up");
|
|
297500
297127
|
const desiredPort = options.port || Number.parseInt(process.env.SERVER_PORT || "3000");
|
|
297501
297128
|
const serverHost = process.env.SERVER_HOST || "0.0.0.0";
|
|
297502
297129
|
const serverPort = await findNextAvailablePort(desiredPort, serverHost);
|
|
297503
297130
|
if (serverPort !== desiredPort) {
|
|
297504
|
-
|
|
297131
|
+
logger47.warn(`Port ${desiredPort} is in use for testing, using port ${serverPort} instead.`);
|
|
297505
297132
|
}
|
|
297506
|
-
|
|
297133
|
+
logger47.info("Starting server...");
|
|
297507
297134
|
try {
|
|
297508
297135
|
await server2.start(serverPort);
|
|
297509
|
-
|
|
297136
|
+
logger47.info({ serverPort }, "Server started successfully on port");
|
|
297510
297137
|
} catch (error2) {
|
|
297511
|
-
|
|
297138
|
+
logger47.error({ error: error2 }, "Error starting server:");
|
|
297512
297139
|
if (error2 instanceof Error) {
|
|
297513
|
-
|
|
297514
|
-
|
|
297140
|
+
logger47.error({ message: error2.message }, "Error details:");
|
|
297141
|
+
logger47.error({ stack: error2.stack }, "Stack trace:");
|
|
297515
297142
|
}
|
|
297516
297143
|
throw error2;
|
|
297517
297144
|
}
|
|
297518
297145
|
try {
|
|
297519
|
-
|
|
297520
|
-
if (project.isPlugin || project.agents
|
|
297146
|
+
logger47.info(`Found ${project.agents.length} agents in ${project.isPlugin ? "plugin" : "project"}`);
|
|
297147
|
+
if (project.isPlugin || (project.agents?.length || 0) === 0) {
|
|
297521
297148
|
process.env.ELIZA_TESTING_PLUGIN = "true";
|
|
297522
|
-
|
|
297149
|
+
logger47.info("Using default Eliza character as test agent");
|
|
297523
297150
|
try {
|
|
297524
297151
|
const pluginUnderTest = project.pluginModule;
|
|
297525
297152
|
if (!pluginUnderTest) {
|
|
297526
297153
|
throw new Error("Plugin module could not be loaded for testing.");
|
|
297527
297154
|
}
|
|
297528
297155
|
const defaultElizaCharacter = getElizaCharacter();
|
|
297529
|
-
const runtime = await
|
|
297156
|
+
const [runtime] = await agentManager.startAgents([defaultElizaCharacter], undefined, [pluginUnderTest], { isTestMode: true });
|
|
297530
297157
|
server2.registerAgent(runtime);
|
|
297531
297158
|
runtimes.push(runtime);
|
|
297532
297159
|
projectAgents.push({
|
|
297533
297160
|
character: defaultElizaCharacter,
|
|
297534
297161
|
plugins: runtime.plugins
|
|
297535
297162
|
});
|
|
297536
|
-
|
|
297163
|
+
logger47.info("Default test agent started successfully");
|
|
297537
297164
|
} catch (pluginError) {
|
|
297538
|
-
|
|
297165
|
+
logger47.error({ error: pluginError }, `Error starting plugin test agent:`);
|
|
297539
297166
|
throw pluginError;
|
|
297540
297167
|
}
|
|
297541
297168
|
} else {
|
|
297542
297169
|
for (const agent2 of project.agents) {
|
|
297543
297170
|
try {
|
|
297544
297171
|
const originalCharacter = { ...agent2.character };
|
|
297545
|
-
|
|
297546
|
-
const runtime = await
|
|
297172
|
+
logger47.debug(`Starting agent: ${originalCharacter.name}`);
|
|
297173
|
+
const [runtime] = await agentManager.startAgents([originalCharacter], agent2.init, agent2.plugins || [], { isTestMode: true });
|
|
297547
297174
|
runtimes.push(runtime);
|
|
297548
297175
|
projectAgents.push(agent2);
|
|
297549
297176
|
await new Promise((resolve13) => setTimeout(resolve13, 1000));
|
|
297550
297177
|
} catch (agentError) {
|
|
297551
|
-
|
|
297178
|
+
logger47.error({ error: agentError, agentName: agent2.character.name }, "Error starting agent");
|
|
297552
297179
|
if (agentError instanceof Error) {
|
|
297553
|
-
|
|
297554
|
-
|
|
297180
|
+
logger47.error({ message: agentError.message }, "Error details:");
|
|
297181
|
+
logger47.error({ stack: agentError.stack }, "Stack trace:");
|
|
297555
297182
|
}
|
|
297556
|
-
|
|
297183
|
+
logger47.warn(`Skipping agent ${agent2.character.name} due to startup error`);
|
|
297557
297184
|
}
|
|
297558
297185
|
}
|
|
297559
297186
|
}
|
|
297560
297187
|
if (runtimes.length === 0) {
|
|
297561
297188
|
throw new Error("Failed to start any agents from project");
|
|
297562
297189
|
}
|
|
297563
|
-
|
|
297190
|
+
logger47.debug(`Successfully started ${runtimes.length} agents for testing`);
|
|
297564
297191
|
let totalFailed = 0;
|
|
297565
297192
|
let anyTestsFound = false;
|
|
297566
297193
|
for (let i = 0;i < runtimes.length; i++) {
|
|
297567
297194
|
const runtime = runtimes[i];
|
|
297568
297195
|
const projectAgent = projectAgents[i];
|
|
297569
297196
|
if (project.isPlugin) {
|
|
297570
|
-
|
|
297197
|
+
logger47.debug(`Running tests for plugin: ${project.pluginModule?.name}`);
|
|
297571
297198
|
} else {
|
|
297572
|
-
|
|
297199
|
+
logger47.debug(`Running tests for agent: ${runtime.character.name}`);
|
|
297573
297200
|
}
|
|
297574
297201
|
const testRunner = new TestRunner(runtime, projectAgent);
|
|
297575
297202
|
const currentDirInfo = projectInfo;
|
|
@@ -297587,17 +297214,17 @@ async function runE2eTests(testPath, options, projectInfo) {
|
|
|
297587
297214
|
}
|
|
297588
297215
|
return { failed: anyTestsFound ? totalFailed > 0 : false };
|
|
297589
297216
|
} catch (error2) {
|
|
297590
|
-
|
|
297217
|
+
logger47.error({ error: error2 }, "Error in runE2eTests:");
|
|
297591
297218
|
if (error2 instanceof Error) {
|
|
297592
|
-
|
|
297593
|
-
|
|
297219
|
+
logger47.error({ message: error2.message }, "Error details:");
|
|
297220
|
+
logger47.error({ stack: error2.stack }, "Stack trace:");
|
|
297594
297221
|
} else {
|
|
297595
|
-
|
|
297596
|
-
|
|
297222
|
+
logger47.error({ type: typeof error2 }, "Unknown error type:");
|
|
297223
|
+
logger47.error({ error: error2 }, "Error value:");
|
|
297597
297224
|
try {
|
|
297598
|
-
|
|
297225
|
+
logger47.error({ stringified: JSON.stringify(error2, null, 2) }, "Stringified error:");
|
|
297599
297226
|
} catch (e2) {
|
|
297600
|
-
|
|
297227
|
+
logger47.error({ error: e2 }, "Could not stringify error:");
|
|
297601
297228
|
}
|
|
297602
297229
|
}
|
|
297603
297230
|
return { failed: true };
|
|
@@ -297611,7 +297238,7 @@ async function runE2eTests(testPath, options, projectInfo) {
|
|
|
297611
297238
|
fs34.rmSync(elizaDbDir, { recursive: true, force: true });
|
|
297612
297239
|
console.info(`Successfully cleaned up test database directory`);
|
|
297613
297240
|
}
|
|
297614
|
-
const testDir =
|
|
297241
|
+
const testDir = path62.dirname(elizaDbDir);
|
|
297615
297242
|
if (fs34.existsSync(testDir) && fs34.readdirSync(testDir).length === 0) {
|
|
297616
297243
|
fs34.rmSync(testDir, { recursive: true, force: true });
|
|
297617
297244
|
}
|
|
@@ -297620,33 +297247,33 @@ async function runE2eTests(testPath, options, projectInfo) {
|
|
|
297620
297247
|
}
|
|
297621
297248
|
}
|
|
297622
297249
|
} catch (error2) {
|
|
297623
|
-
|
|
297250
|
+
logger47.error({ error: error2 }, "Error in runE2eTests:");
|
|
297624
297251
|
if (error2 instanceof Error) {
|
|
297625
|
-
|
|
297626
|
-
|
|
297252
|
+
logger47.error({ message: error2.message }, "Error details:");
|
|
297253
|
+
logger47.error({ stack: error2.stack }, "Stack trace:");
|
|
297627
297254
|
} else {
|
|
297628
|
-
|
|
297629
|
-
|
|
297255
|
+
logger47.error({ type: typeof error2 }, "Unknown error type:");
|
|
297256
|
+
logger47.error({ error: error2 }, "Error value:");
|
|
297630
297257
|
try {
|
|
297631
|
-
|
|
297258
|
+
logger47.error({ stringified: JSON.stringify(error2, null, 2) }, "Stringified error:");
|
|
297632
297259
|
} catch (e2) {
|
|
297633
|
-
|
|
297260
|
+
logger47.error({ error: e2 }, "Could not stringify error:");
|
|
297634
297261
|
}
|
|
297635
297262
|
}
|
|
297636
297263
|
return { failed: true };
|
|
297637
297264
|
}
|
|
297638
297265
|
} catch (error2) {
|
|
297639
|
-
|
|
297266
|
+
logger47.error({ error: error2 }, "Error in runE2eTests:");
|
|
297640
297267
|
if (error2 instanceof Error) {
|
|
297641
|
-
|
|
297642
|
-
|
|
297268
|
+
logger47.error({ message: error2.message }, "Error details:");
|
|
297269
|
+
logger47.error({ stack: error2.stack }, "Stack trace:");
|
|
297643
297270
|
} else {
|
|
297644
|
-
|
|
297645
|
-
|
|
297271
|
+
logger47.error({ type: typeof error2 }, "Unknown error type:");
|
|
297272
|
+
logger47.error({ error: error2 }, "Error value:");
|
|
297646
297273
|
try {
|
|
297647
|
-
|
|
297274
|
+
logger47.error({ stringified: JSON.stringify(error2, null, 2) }, "Stringified error:");
|
|
297648
297275
|
} catch (e2) {
|
|
297649
|
-
|
|
297276
|
+
logger47.error({ error: e2 }, "Could not stringify error:");
|
|
297650
297277
|
}
|
|
297651
297278
|
}
|
|
297652
297279
|
return { failed: true };
|
|
@@ -297660,25 +297287,24 @@ async function runAllTests(testPath, options) {
|
|
|
297660
297287
|
if (!options.skipBuild) {
|
|
297661
297288
|
componentResult = await runComponentTests(testPath, options, projectInfo);
|
|
297662
297289
|
} else {
|
|
297663
|
-
|
|
297290
|
+
logger48.info("Skipping component tests due to --skip-build option");
|
|
297664
297291
|
}
|
|
297665
297292
|
const e2eResult = await runE2eTests(testPath, options, projectInfo);
|
|
297666
297293
|
if (componentResult.failed || e2eResult.failed) {
|
|
297667
297294
|
if (componentResult.failed) {
|
|
297668
|
-
|
|
297295
|
+
logger48.error("Component tests failed.");
|
|
297669
297296
|
}
|
|
297670
297297
|
if (e2eResult.failed) {
|
|
297671
|
-
|
|
297298
|
+
logger48.error("E2E tests failed.");
|
|
297672
297299
|
}
|
|
297673
|
-
|
|
297300
|
+
logger48.error("Test suite failed.");
|
|
297674
297301
|
process.exit(1);
|
|
297675
297302
|
}
|
|
297676
|
-
|
|
297303
|
+
logger48.success("All tests passed successfully!");
|
|
297677
297304
|
process.exit(0);
|
|
297678
297305
|
}
|
|
297679
297306
|
// src/commands/test/utils/plugin-utils.ts
|
|
297680
|
-
|
|
297681
|
-
import { logger as logger53 } from "@elizaos/core";
|
|
297307
|
+
import { logger as logger49 } from "@elizaos/core";
|
|
297682
297308
|
|
|
297683
297309
|
// src/commands/test/index.ts
|
|
297684
297310
|
var test = new Command().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(new Option("-t, --type <type>", "the type of test to run").choices(["component", "e2e", "all"]).default("all")).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) => {
|
|
@@ -297690,31 +297316,31 @@ var test = new Command().name("test").description("Run tests for the current pro
|
|
|
297690
297316
|
const projectInfo = getProjectType(testPath);
|
|
297691
297317
|
await installPluginDependencies(projectInfo);
|
|
297692
297318
|
}).action(async (testPath, options) => {
|
|
297693
|
-
|
|
297319
|
+
logger50.info("Starting tests...");
|
|
297694
297320
|
try {
|
|
297695
297321
|
const projectInfo = getProjectType(testPath);
|
|
297696
297322
|
switch (options.type) {
|
|
297697
297323
|
case "component":
|
|
297698
|
-
|
|
297324
|
+
logger50.info("Running component tests only...");
|
|
297699
297325
|
const componentResult = await runComponentTests(testPath, options, projectInfo);
|
|
297700
297326
|
if (componentResult.failed) {
|
|
297701
|
-
|
|
297327
|
+
logger50.error("Component tests failed.");
|
|
297702
297328
|
process.exit(1);
|
|
297703
297329
|
}
|
|
297704
|
-
|
|
297330
|
+
logger50.success("Component tests passed successfully!");
|
|
297705
297331
|
break;
|
|
297706
297332
|
case "e2e":
|
|
297707
|
-
|
|
297333
|
+
logger50.info("Running e2e tests only...");
|
|
297708
297334
|
const e2eResult = await runE2eTests(testPath, options, projectInfo);
|
|
297709
297335
|
if (e2eResult.failed) {
|
|
297710
|
-
|
|
297336
|
+
logger50.error("E2E tests failed.");
|
|
297711
297337
|
process.exit(1);
|
|
297712
297338
|
}
|
|
297713
|
-
|
|
297339
|
+
logger50.success("E2E tests passed successfully!");
|
|
297714
297340
|
break;
|
|
297715
297341
|
case "all":
|
|
297716
297342
|
default:
|
|
297717
|
-
|
|
297343
|
+
logger50.info("Running all tests...");
|
|
297718
297344
|
await runAllTests(testPath, options);
|
|
297719
297345
|
break;
|
|
297720
297346
|
}
|
|
@@ -297728,19 +297354,19 @@ var test = new Command().name("test").description("Run tests for the current pro
|
|
|
297728
297354
|
init_utils();
|
|
297729
297355
|
init_directory_detection();
|
|
297730
297356
|
init_esm();
|
|
297731
|
-
import { logger as
|
|
297357
|
+
import { logger as logger52 } from "@elizaos/core";
|
|
297732
297358
|
|
|
297733
297359
|
// src/commands/update/actions/dependency-update.ts
|
|
297734
297360
|
init_utils();
|
|
297735
297361
|
init_dist2();
|
|
297736
297362
|
import { promises as fs36 } from "fs";
|
|
297737
|
-
import * as
|
|
297363
|
+
import * as path63 from "path";
|
|
297738
297364
|
|
|
297739
297365
|
// src/commands/update/utils/package-utils.ts
|
|
297740
297366
|
init_bun_exec();
|
|
297741
297367
|
init_utils();
|
|
297742
297368
|
import fs35 from "fs/promises";
|
|
297743
|
-
import { logger as
|
|
297369
|
+
import { logger as logger51 } from "@elizaos/core";
|
|
297744
297370
|
async function checkForUpdates(dependencies) {
|
|
297745
297371
|
const updates = {};
|
|
297746
297372
|
const elizaPackages = Object.entries(dependencies).filter(([pkg2]) => pkg2.startsWith(ELIZAOS_ORG)).filter(([, version2]) => !isWorkspaceVersion(version2));
|
|
@@ -297752,7 +297378,7 @@ async function checkForUpdates(dependencies) {
|
|
|
297752
297378
|
if (needsUpdate) {
|
|
297753
297379
|
updates[pkg2] = { current: currentVersion, latest: latestVersion };
|
|
297754
297380
|
} else if (error2) {
|
|
297755
|
-
|
|
297381
|
+
logger51.debug(`${pkg2}: ${error2}`);
|
|
297756
297382
|
}
|
|
297757
297383
|
}
|
|
297758
297384
|
return { hasUpdates: Object.keys(updates).length > 0, updates };
|
|
@@ -297801,7 +297427,7 @@ Installing updated packages...`);
|
|
|
297801
297427
|
// src/commands/update/actions/dependency-update.ts
|
|
297802
297428
|
async function updateDependencies(cwd, isPlugin2, options = {}) {
|
|
297803
297429
|
const { dryRun = false, skipBuild = false } = options;
|
|
297804
|
-
const packageJsonPath =
|
|
297430
|
+
const packageJsonPath = path63.join(cwd, "package.json");
|
|
297805
297431
|
const content = await fs36.readFile(packageJsonPath, "utf8");
|
|
297806
297432
|
const packageJson = JSON.parse(content);
|
|
297807
297433
|
const allDependencies = {
|
|
@@ -297875,7 +297501,7 @@ var update = new Command().name("update").description("Update ElizaOS CLI and pr
|
|
|
297875
297501
|
try {
|
|
297876
297502
|
await displayBanner(true);
|
|
297877
297503
|
} catch {
|
|
297878
|
-
|
|
297504
|
+
logger52.debug("Banner display failed, continuing with update");
|
|
297879
297505
|
}
|
|
297880
297506
|
}).action(async (options) => {
|
|
297881
297507
|
try {
|
|
@@ -297913,7 +297539,7 @@ var update = new Command().name("update").description("Update ElizaOS CLI and pr
|
|
|
297913
297539
|
console.info("To create a new ElizaOS project, use: elizaos create <project-name>");
|
|
297914
297540
|
return;
|
|
297915
297541
|
}
|
|
297916
|
-
|
|
297542
|
+
logger52.debug(`Detected ${directoryInfo.type}`);
|
|
297917
297543
|
if (!isInProject) {
|
|
297918
297544
|
handleInvalidDirectory(directoryInfo);
|
|
297919
297545
|
return;
|
|
@@ -297948,15 +297574,15 @@ init_utils();
|
|
|
297948
297574
|
init_local_cli_delegation();
|
|
297949
297575
|
init_esm();
|
|
297950
297576
|
init_emoji_handler();
|
|
297951
|
-
import { logger as
|
|
297577
|
+
import { logger as logger53 } from "@elizaos/core";
|
|
297952
297578
|
|
|
297953
297579
|
// src/commands/scenario/index.ts
|
|
297954
297580
|
init_esm();
|
|
297955
297581
|
init_js_yaml();
|
|
297956
297582
|
init_schema();
|
|
297957
297583
|
init_LocalEnvironmentProvider();
|
|
297958
|
-
import
|
|
297959
|
-
import
|
|
297584
|
+
import fs41 from "fs";
|
|
297585
|
+
import path66 from "path";
|
|
297960
297586
|
import { logger as elizaLogger } from "@elizaos/core";
|
|
297961
297587
|
|
|
297962
297588
|
// src/commands/scenario/src/E2BEnvironmentProvider.ts
|
|
@@ -298494,120 +298120,124 @@ class Reporter {
|
|
|
298494
298120
|
}
|
|
298495
298121
|
}
|
|
298496
298122
|
// src/commands/scenario/src/plugin-parser.ts
|
|
298497
|
-
|
|
298498
|
-
|
|
298499
|
-
|
|
298500
|
-
|
|
298501
|
-
|
|
298502
|
-
|
|
298123
|
+
init_module_loader();
|
|
298124
|
+
function parsePlugins(pluginReferences) {
|
|
298125
|
+
if (!pluginReferences || pluginReferences.length === 0) {
|
|
298126
|
+
return [];
|
|
298127
|
+
}
|
|
298128
|
+
return pluginReferences.map((ref) => {
|
|
298129
|
+
if (typeof ref === "string") {
|
|
298130
|
+
return {
|
|
298131
|
+
name: ref,
|
|
298132
|
+
enabled: true,
|
|
298133
|
+
originalReference: ref
|
|
298134
|
+
};
|
|
298135
|
+
} else {
|
|
298136
|
+
return {
|
|
298137
|
+
name: ref.name,
|
|
298138
|
+
version: ref.version,
|
|
298139
|
+
config: ref.config,
|
|
298140
|
+
enabled: ref.enabled ?? true,
|
|
298141
|
+
originalReference: ref
|
|
298142
|
+
};
|
|
298503
298143
|
}
|
|
298504
|
-
|
|
298505
|
-
|
|
298506
|
-
|
|
298507
|
-
|
|
298508
|
-
|
|
298509
|
-
|
|
298510
|
-
|
|
298144
|
+
});
|
|
298145
|
+
}
|
|
298146
|
+
async function validatePlugins(plugins2) {
|
|
298147
|
+
const result = {
|
|
298148
|
+
valid: true,
|
|
298149
|
+
plugins: [],
|
|
298150
|
+
errors: [],
|
|
298151
|
+
warnings: []
|
|
298152
|
+
};
|
|
298153
|
+
const seenPlugins = new Set;
|
|
298154
|
+
for (const plugin of plugins2) {
|
|
298155
|
+
if (!plugin.enabled) {
|
|
298156
|
+
result.warnings.push(`Plugin '${plugin.name}' is disabled`);
|
|
298157
|
+
continue;
|
|
298158
|
+
}
|
|
298159
|
+
if (seenPlugins.has(plugin.name)) {
|
|
298160
|
+
result.errors.push(`Duplicate plugin '${plugin.name}' found`);
|
|
298161
|
+
result.valid = false;
|
|
298162
|
+
continue;
|
|
298163
|
+
}
|
|
298164
|
+
seenPlugins.add(plugin.name);
|
|
298165
|
+
if (!isValidPluginName(plugin.name)) {
|
|
298166
|
+
result.errors.push(`Invalid plugin name '${plugin.name}'. Expected format: @elizaos/plugin-*`);
|
|
298167
|
+
result.valid = false;
|
|
298168
|
+
continue;
|
|
298169
|
+
}
|
|
298170
|
+
try {
|
|
298171
|
+
const moduleLoader = getModuleLoader();
|
|
298172
|
+
const { PluginLoader } = await moduleLoader.load("@elizaos/server");
|
|
298173
|
+
const loader2 = new PluginLoader;
|
|
298174
|
+
const loadedPlugin = await loader2.loadAndPreparePlugin(plugin.name);
|
|
298175
|
+
if (loadedPlugin) {
|
|
298176
|
+
plugin.loadedPlugin = loadedPlugin;
|
|
298177
|
+
result.plugins.push(plugin);
|
|
298511
298178
|
} else {
|
|
298512
|
-
|
|
298513
|
-
name: ref.name,
|
|
298514
|
-
version: ref.version,
|
|
298515
|
-
config: ref.config,
|
|
298516
|
-
enabled: ref.enabled ?? true,
|
|
298517
|
-
originalReference: ref
|
|
298518
|
-
};
|
|
298519
|
-
}
|
|
298520
|
-
});
|
|
298521
|
-
}
|
|
298522
|
-
static async validatePlugins(plugins2) {
|
|
298523
|
-
const result = {
|
|
298524
|
-
valid: true,
|
|
298525
|
-
plugins: [],
|
|
298526
|
-
errors: [],
|
|
298527
|
-
warnings: []
|
|
298528
|
-
};
|
|
298529
|
-
const seenPlugins = new Set;
|
|
298530
|
-
for (const plugin of plugins2) {
|
|
298531
|
-
if (!plugin.enabled) {
|
|
298532
|
-
result.warnings.push(`Plugin '${plugin.name}' is disabled`);
|
|
298533
|
-
continue;
|
|
298534
|
-
}
|
|
298535
|
-
if (seenPlugins.has(plugin.name)) {
|
|
298536
|
-
result.errors.push(`Duplicate plugin '${plugin.name}' found`);
|
|
298537
|
-
result.valid = false;
|
|
298538
|
-
continue;
|
|
298539
|
-
}
|
|
298540
|
-
seenPlugins.add(plugin.name);
|
|
298541
|
-
if (!this.isValidPluginName(plugin.name)) {
|
|
298542
|
-
result.errors.push(`Invalid plugin name '${plugin.name}'. Expected format: @elizaos/plugin-*`);
|
|
298543
|
-
result.valid = false;
|
|
298544
|
-
continue;
|
|
298545
|
-
}
|
|
298546
|
-
try {
|
|
298547
|
-
const loadedPlugin = await loadAndPreparePlugin(plugin.name);
|
|
298548
|
-
if (loadedPlugin) {
|
|
298549
|
-
plugin.loadedPlugin = loadedPlugin;
|
|
298550
|
-
result.plugins.push(plugin);
|
|
298551
|
-
} else {
|
|
298552
|
-
result.errors.push(`Failed to load plugin '${plugin.name}'`);
|
|
298553
|
-
result.valid = false;
|
|
298554
|
-
continue;
|
|
298555
|
-
}
|
|
298556
|
-
} catch (error2) {
|
|
298557
|
-
result.errors.push(`Error loading plugin '${plugin.name}': ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
298558
|
-
result.valid = false;
|
|
298559
|
-
continue;
|
|
298560
|
-
}
|
|
298561
|
-
if (plugin.version && !this.isValidVersion(plugin.version)) {
|
|
298562
|
-
result.errors.push(`Invalid version '${plugin.version}' for plugin '${plugin.name}'`);
|
|
298563
|
-
result.valid = false;
|
|
298564
|
-
continue;
|
|
298565
|
-
}
|
|
298566
|
-
if (plugin.config && !this.isValidConfig(plugin.config)) {
|
|
298567
|
-
result.errors.push(`Invalid configuration for plugin '${plugin.name}'`);
|
|
298179
|
+
result.errors.push(`Failed to load plugin '${plugin.name}'`);
|
|
298568
298180
|
result.valid = false;
|
|
298569
298181
|
continue;
|
|
298570
298182
|
}
|
|
298183
|
+
} catch (error2) {
|
|
298184
|
+
result.errors.push(`Error loading plugin '${plugin.name}': ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
298185
|
+
result.valid = false;
|
|
298186
|
+
continue;
|
|
298187
|
+
}
|
|
298188
|
+
if (plugin.version && !isValidVersion(plugin.version)) {
|
|
298189
|
+
result.errors.push(`Invalid version '${plugin.version}' for plugin '${plugin.name}'`);
|
|
298190
|
+
result.valid = false;
|
|
298191
|
+
continue;
|
|
298192
|
+
}
|
|
298193
|
+
if (plugin.config && !isValidConfig(plugin.config)) {
|
|
298194
|
+
result.errors.push(`Invalid configuration for plugin '${plugin.name}'`);
|
|
298195
|
+
result.valid = false;
|
|
298196
|
+
continue;
|
|
298571
298197
|
}
|
|
298572
|
-
return result;
|
|
298573
|
-
}
|
|
298574
|
-
static async parseAndValidate(pluginReferences) {
|
|
298575
|
-
const parsedPlugins = this.parsePlugins(pluginReferences);
|
|
298576
|
-
return await this.validatePlugins(parsedPlugins);
|
|
298577
298198
|
}
|
|
298578
|
-
|
|
298579
|
-
|
|
298199
|
+
return result;
|
|
298200
|
+
}
|
|
298201
|
+
async function parseAndValidate(pluginReferences) {
|
|
298202
|
+
const parsedPlugins = parsePlugins(pluginReferences);
|
|
298203
|
+
return await validatePlugins(parsedPlugins);
|
|
298204
|
+
}
|
|
298205
|
+
function isValidPluginName(name) {
|
|
298206
|
+
return /^@elizaos\/plugin-[a-zA-Z0-9-]+$/.test(name);
|
|
298207
|
+
}
|
|
298208
|
+
function isValidVersion(version2) {
|
|
298209
|
+
return /^\d+\.\d+\.\d+$/.test(version2);
|
|
298210
|
+
}
|
|
298211
|
+
function isValidConfig(config4) {
|
|
298212
|
+
return typeof config4 === "object" && config4 !== null && !Array.isArray(config4);
|
|
298213
|
+
}
|
|
298214
|
+
function generateSummary(result) {
|
|
298215
|
+
const lines = [];
|
|
298216
|
+
lines.push(`Plugin Loading Summary:`);
|
|
298217
|
+
lines.push(` Total plugins: ${result.plugins.length}`);
|
|
298218
|
+
lines.push(` Valid: ${result.valid ? "Yes" : "No"}`);
|
|
298219
|
+
if (result.plugins.length > 0) {
|
|
298220
|
+
lines.push(` Plugins to load:`);
|
|
298221
|
+
result.plugins.forEach((plugin) => {
|
|
298222
|
+
const configStr = plugin.config ? ` (with config)` : "";
|
|
298223
|
+
const versionStr = plugin.version ? ` v${plugin.version}` : "";
|
|
298224
|
+
lines.push(` - ${plugin.name}${versionStr}${configStr}`);
|
|
298225
|
+
});
|
|
298580
298226
|
}
|
|
298581
|
-
|
|
298582
|
-
|
|
298227
|
+
if (result.errors.length > 0) {
|
|
298228
|
+
lines.push(` Errors:`);
|
|
298229
|
+
result.errors.forEach((error2) => {
|
|
298230
|
+
lines.push(` - ${error2}`);
|
|
298231
|
+
});
|
|
298583
298232
|
}
|
|
298584
|
-
|
|
298585
|
-
|
|
298233
|
+
if (result.warnings.length > 0) {
|
|
298234
|
+
lines.push(` Warnings:`);
|
|
298235
|
+
result.warnings.forEach((warning) => {
|
|
298236
|
+
lines.push(` - ${warning}`);
|
|
298237
|
+
});
|
|
298586
298238
|
}
|
|
298587
|
-
|
|
298588
|
-
const lines = [];
|
|
298589
|
-
lines.push(`Plugin Loading Summary:`);
|
|
298590
|
-
lines.push(` Total plugins: ${result.plugins.length}`);
|
|
298591
|
-
lines.push(` Valid: ${result.valid ? "Yes" : "No"}`);
|
|
298592
|
-
if (result.plugins.length > 0) {
|
|
298593
|
-
lines.push(` Plugins to load:`);
|
|
298594
|
-
result.plugins.forEach((plugin) => {
|
|
298595
|
-
const configStr = plugin.config ? ` (with config)` : "";
|
|
298596
|
-
const versionStr = plugin.version ? ` v${plugin.version}` : "";
|
|
298597
|
-
lines.push(` - ${plugin.name}${versionStr}${configStr}`);
|
|
298598
|
-
});
|
|
298599
|
-
}
|
|
298600
|
-
if (result.errors.length > 0) {
|
|
298601
|
-
lines.push(` Errors:`);
|
|
298602
|
-
result.errors.forEach((error2) => lines.push(` - ${error2}`));
|
|
298603
|
-
}
|
|
298604
|
-
if (result.warnings.length > 0) {
|
|
298605
|
-
lines.push(` Warnings:`);
|
|
298606
|
-
result.warnings.forEach((warning) => lines.push(` - ${warning}`));
|
|
298607
|
-
}
|
|
298608
|
-
return lines.join(`
|
|
298239
|
+
return lines.join(`
|
|
298609
298240
|
`);
|
|
298610
|
-
}
|
|
298611
298241
|
}
|
|
298612
298242
|
|
|
298613
298243
|
// src/commands/scenario/src/data-aggregator.ts
|
|
@@ -298720,14 +298350,14 @@ class RunDataAggregator {
|
|
|
298720
298350
|
// src/commands/scenario/index.ts
|
|
298721
298351
|
var __dirname = "/home/runner/work/eliza/eliza/packages/cli/src/commands/scenario";
|
|
298722
298352
|
async function runEvaluationsWithFallback(evaluationEngine, evaluations, result) {
|
|
298723
|
-
const
|
|
298353
|
+
const logger53 = elizaLogger || console;
|
|
298724
298354
|
try {
|
|
298725
|
-
|
|
298355
|
+
logger53.debug("[Evaluation] Using enhanced evaluations with structured output");
|
|
298726
298356
|
const enhancedResults = await evaluationEngine.runEnhancedEvaluations(evaluations, result);
|
|
298727
298357
|
if (Array.isArray(enhancedResults) && enhancedResults.length > 0) {
|
|
298728
298358
|
const firstResult = enhancedResults[0];
|
|
298729
298359
|
if (firstResult && typeof firstResult.evaluator_type === "string" && typeof firstResult.success === "boolean" && typeof firstResult.summary === "string" && typeof firstResult.details === "object") {
|
|
298730
|
-
|
|
298360
|
+
logger53.debug(`[Evaluation] Enhanced evaluations successful - ${enhancedResults.length} structured results`);
|
|
298731
298361
|
return enhancedResults.map((enhanced) => ({
|
|
298732
298362
|
success: enhanced.success,
|
|
298733
298363
|
message: enhanced.summary,
|
|
@@ -298735,16 +298365,16 @@ async function runEvaluationsWithFallback(evaluationEngine, evaluations, result)
|
|
|
298735
298365
|
}));
|
|
298736
298366
|
}
|
|
298737
298367
|
}
|
|
298738
|
-
|
|
298368
|
+
logger53.warn("[Evaluation] Enhanced results invalid, falling back to legacy evaluations");
|
|
298739
298369
|
} catch (error2) {
|
|
298740
|
-
|
|
298370
|
+
logger53.warn(`[Evaluation] Enhanced evaluations failed (${error2 instanceof Error ? error2.message : String(error2)}), falling back to legacy evaluations`);
|
|
298741
298371
|
}
|
|
298742
|
-
|
|
298372
|
+
logger53.debug("[Evaluation] Using legacy evaluation system (fallback)");
|
|
298743
298373
|
return await evaluationEngine.runEvaluations(evaluations, result);
|
|
298744
298374
|
}
|
|
298745
298375
|
var scenario = new Command().name("scenario").description("Manage and execute ElizaOS scenarios").addCommand(new Command("run").argument("<filePath>", "Path to the .scenario.yaml file").option("-l, --live", "Run scenario in live mode, ignoring mocks", false).description("Execute a scenario from a YAML file").action(async (filePath, options) => {
|
|
298746
|
-
const
|
|
298747
|
-
|
|
298376
|
+
const logger53 = elizaLogger || console;
|
|
298377
|
+
logger53.info(`Starting scenario run with args: ${JSON.stringify({ filePath, ...options })}`);
|
|
298748
298378
|
let provider = null;
|
|
298749
298379
|
let runtime = null;
|
|
298750
298380
|
let server2 = null;
|
|
@@ -298755,43 +298385,47 @@ var scenario = new Command().name("scenario").description("Manage and execute El
|
|
|
298755
298385
|
let finalStatus = false;
|
|
298756
298386
|
let reporter = null;
|
|
298757
298387
|
const scenarioRunId = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
298758
|
-
const logsDir =
|
|
298388
|
+
const logsDir = path66.join(__dirname, "_logs_");
|
|
298759
298389
|
let dataAggregator = null;
|
|
298760
298390
|
try {
|
|
298761
|
-
const fullPath =
|
|
298762
|
-
|
|
298763
|
-
if (!
|
|
298764
|
-
|
|
298391
|
+
const fullPath = path66.resolve(filePath);
|
|
298392
|
+
logger53.info(`Attempting to read scenario file from: ${fullPath}`);
|
|
298393
|
+
if (!fs41.existsSync(fullPath)) {
|
|
298394
|
+
logger53.error(`Error: File not found at '${fullPath}'`);
|
|
298765
298395
|
process.exit(1);
|
|
298766
298396
|
}
|
|
298767
|
-
const fileContents =
|
|
298397
|
+
const fileContents = fs41.readFileSync(fullPath, "utf8");
|
|
298768
298398
|
const rawScenario = load2(fileContents);
|
|
298769
298399
|
const validationResult = ScenarioSchema.safeParse(rawScenario);
|
|
298770
298400
|
if (!validationResult.success) {
|
|
298771
|
-
|
|
298401
|
+
logger53.error("Scenario file validation failed:");
|
|
298772
298402
|
console.error(JSON.stringify(validationResult.error.format(), null, 2));
|
|
298773
298403
|
process.exit(1);
|
|
298774
298404
|
}
|
|
298775
298405
|
const scenario2 = validationResult.data;
|
|
298776
|
-
if (!
|
|
298777
|
-
|
|
298406
|
+
if (!fs41.existsSync(logsDir)) {
|
|
298407
|
+
fs41.mkdirSync(logsDir, { recursive: true });
|
|
298778
298408
|
}
|
|
298779
298409
|
if (scenario2.plugins && scenario2.plugins.length > 0) {
|
|
298780
|
-
|
|
298781
|
-
const pluginResult = await
|
|
298410
|
+
logger53.info("Parsing and validating plugins...");
|
|
298411
|
+
const pluginResult = await parseAndValidate(scenario2.plugins);
|
|
298782
298412
|
if (!pluginResult.valid) {
|
|
298783
|
-
|
|
298784
|
-
pluginResult.errors.forEach((error2) =>
|
|
298413
|
+
logger53.error("Plugin validation failed:");
|
|
298414
|
+
pluginResult.errors.forEach((error2) => {
|
|
298415
|
+
logger53.error(` - ${error2}`);
|
|
298416
|
+
});
|
|
298785
298417
|
process.exit(1);
|
|
298786
298418
|
}
|
|
298787
298419
|
if (pluginResult.warnings.length > 0) {
|
|
298788
|
-
|
|
298789
|
-
pluginResult.warnings.forEach((warning) =>
|
|
298420
|
+
logger53.warn("Plugin warnings:");
|
|
298421
|
+
pluginResult.warnings.forEach((warning) => {
|
|
298422
|
+
logger53.warn(` - ${warning}`);
|
|
298423
|
+
});
|
|
298790
298424
|
}
|
|
298791
|
-
|
|
298425
|
+
logger53.info(generateSummary(pluginResult));
|
|
298792
298426
|
scenario2.parsedPlugins = pluginResult.plugins;
|
|
298793
298427
|
} else {
|
|
298794
|
-
|
|
298428
|
+
logger53.info("No plugins specified in scenario");
|
|
298795
298429
|
}
|
|
298796
298430
|
reporter = new Reporter;
|
|
298797
298431
|
reporter.reportStart(scenario2);
|
|
@@ -298806,7 +298440,7 @@ var scenario = new Command().name("scenario").description("Manage and execute El
|
|
|
298806
298440
|
}
|
|
298807
298441
|
const scenarioPlugins = Array.isArray(scenario2.plugins) ? scenario2.plugins.filter((p2) => p2.enabled !== false).map((p2) => typeof p2 === "string" ? p2 : p2.name) : [];
|
|
298808
298442
|
const finalPlugins = Array.from(new Set([...scenarioPlugins, ...defaultPlugins]));
|
|
298809
|
-
|
|
298443
|
+
logger53.info(`Using plugins: ${JSON.stringify(finalPlugins)}`);
|
|
298810
298444
|
if (scenario2.environment.type === "e2b") {
|
|
298811
298445
|
const created = await createScenarioServerAndAgent(null, 3000, finalPlugins);
|
|
298812
298446
|
server2 = created.server;
|
|
@@ -298826,18 +298460,18 @@ var scenario = new Command().name("scenario").description("Manage and execute El
|
|
|
298826
298460
|
serverPort = created.port;
|
|
298827
298461
|
}
|
|
298828
298462
|
provider = new LocalEnvironmentProvider(server2, agentId, runtime, serverPort);
|
|
298829
|
-
|
|
298463
|
+
logger53.info("Using local environment");
|
|
298830
298464
|
} else {
|
|
298831
|
-
|
|
298465
|
+
logger53.error(`Unsupported environment type: '${scenario2.environment.type}'`);
|
|
298832
298466
|
process.exit(1);
|
|
298833
298467
|
}
|
|
298834
298468
|
if (runtime && scenario2.setup?.mocks && !options.live) {
|
|
298835
|
-
|
|
298469
|
+
logger53.info("Initializing MockEngine...");
|
|
298836
298470
|
mockEngine = new MockEngine(runtime);
|
|
298837
|
-
|
|
298471
|
+
logger53.info("Applying mocks...");
|
|
298838
298472
|
mockEngine.applyMocks(scenario2.setup.mocks);
|
|
298839
298473
|
}
|
|
298840
|
-
|
|
298474
|
+
logger53.info(`Setting up '${scenario2.environment.type}' environment...`);
|
|
298841
298475
|
await provider.setup(scenario2);
|
|
298842
298476
|
if (runtime) {
|
|
298843
298477
|
const trajectoryReconstructor = new TrajectoryReconstructor(runtime);
|
|
@@ -298847,42 +298481,42 @@ var scenario = new Command().name("scenario").description("Manage and execute El
|
|
|
298847
298481
|
const combinationId = `single-${scenarioRunId}`;
|
|
298848
298482
|
const parameters = { "scenario.file": filePath };
|
|
298849
298483
|
dataAggregator.startRun(runId2, combinationId, parameters);
|
|
298850
|
-
|
|
298484
|
+
logger53.info(`\uD83D\uDCCA [DataAggregator] Started tracking run: ${runId2}`);
|
|
298851
298485
|
}
|
|
298852
|
-
|
|
298486
|
+
logger53.info("Executing run block...");
|
|
298853
298487
|
const startTime = Date.now();
|
|
298854
298488
|
const results = await provider.run(scenario2);
|
|
298855
298489
|
const endTime = Date.now();
|
|
298856
298490
|
results.forEach((result) => {
|
|
298857
298491
|
reporter?.reportExecutionResult(result);
|
|
298858
298492
|
});
|
|
298859
|
-
|
|
298493
|
+
logger53.info(`\uD83D\uDCC2 Using logs directory: ${logsDir}`);
|
|
298860
298494
|
const runId = generateRunFilename(1);
|
|
298861
|
-
|
|
298495
|
+
logger53.info(`\uD83D\uDD0D DEBUG: About to write ${results.length} execution results to ${logsDir}`);
|
|
298862
298496
|
results.forEach((result, i2) => {
|
|
298863
298497
|
const executionFilename = generateStepFilename(runId, i2, "execution");
|
|
298864
|
-
const executionPath =
|
|
298865
|
-
|
|
298866
|
-
|
|
298498
|
+
const executionPath = path66.join(logsDir, executionFilename);
|
|
298499
|
+
fs41.writeFileSync(executionPath, JSON.stringify(result, null, 2));
|
|
298500
|
+
logger53.info(`\uD83D\uDCC4 Execution results written to: ${executionPath}`);
|
|
298867
298501
|
});
|
|
298868
298502
|
const allEvaluationResults = [];
|
|
298869
298503
|
if (runtime) {
|
|
298870
298504
|
const evaluationEngine = new EvaluationEngine(runtime);
|
|
298871
|
-
|
|
298505
|
+
logger53.info("Running evaluations with runtime...");
|
|
298872
298506
|
for (let i2 = 0;i2 < results.length; i2++) {
|
|
298873
298507
|
const step = scenario2.run[i2];
|
|
298874
298508
|
const result = results[i2];
|
|
298875
298509
|
if (step.evaluations && step.evaluations.length > 0) {
|
|
298876
298510
|
const evaluationResults = await runEvaluationsWithFallback(evaluationEngine, step.evaluations, result);
|
|
298877
298511
|
const evaluationFilename = generateStepFilename(runId, i2, "evaluation");
|
|
298878
|
-
const evaluationPath =
|
|
298879
|
-
|
|
298880
|
-
|
|
298512
|
+
const evaluationPath = path66.join(logsDir, evaluationFilename);
|
|
298513
|
+
fs41.writeFileSync(evaluationPath, JSON.stringify(evaluationResults, null, 2));
|
|
298514
|
+
logger53.info(`\uD83D\uDCCA Evaluation results written to: ${evaluationPath}`);
|
|
298881
298515
|
allEvaluationResults.push(...evaluationResults);
|
|
298882
298516
|
}
|
|
298883
298517
|
}
|
|
298884
298518
|
} else {
|
|
298885
|
-
|
|
298519
|
+
logger53.info("Running basic evaluations without runtime...");
|
|
298886
298520
|
for (let i2 = 0;i2 < results.length; i2++) {
|
|
298887
298521
|
const step = scenario2.run[i2];
|
|
298888
298522
|
const result = results[i2];
|
|
@@ -298912,9 +298546,9 @@ var scenario = new Command().name("scenario").description("Manage and execute El
|
|
|
298912
298546
|
allEvaluationResults.push(evaluationResult);
|
|
298913
298547
|
}
|
|
298914
298548
|
const evaluationFilename = generateStepFilename(runId, i2, "evaluation");
|
|
298915
|
-
const evaluationPath =
|
|
298916
|
-
|
|
298917
|
-
|
|
298549
|
+
const evaluationPath = path66.join(logsDir, evaluationFilename);
|
|
298550
|
+
fs41.writeFileSync(evaluationPath, JSON.stringify(stepEvaluationResults, null, 2));
|
|
298551
|
+
logger53.info(`\uD83D\uDCCA Basic evaluation results written to: ${evaluationPath}`);
|
|
298918
298552
|
}
|
|
298919
298553
|
}
|
|
298920
298554
|
}
|
|
@@ -298967,15 +298601,15 @@ var scenario = new Command().name("scenario").description("Manage and execute El
|
|
|
298967
298601
|
});
|
|
298968
298602
|
const scenarioRunResult = await dataAggregator.buildResult(roomId, enhancedEvaluationResults, combinedExecutionResult);
|
|
298969
298603
|
const centralizedFilename = `${runId}.json`;
|
|
298970
|
-
const centralizedPath =
|
|
298971
|
-
|
|
298972
|
-
|
|
298604
|
+
const centralizedPath = path66.join(logsDir, centralizedFilename);
|
|
298605
|
+
fs41.writeFileSync(centralizedPath, JSON.stringify(scenarioRunResult, null, 2));
|
|
298606
|
+
logger53.info(`\uD83D\uDCCB [DataAggregator] Centralized result written to: ${centralizedPath}`);
|
|
298973
298607
|
} catch (aggregatorError) {
|
|
298974
|
-
|
|
298608
|
+
logger53.error(`[DataAggregator] Failed to generate centralized result: ${aggregatorError}`);
|
|
298975
298609
|
}
|
|
298976
298610
|
}
|
|
298977
298611
|
} catch (error2) {
|
|
298978
|
-
|
|
298612
|
+
logger53.error("An error occurred during scenario execution:", error2 instanceof Error ? error2.message : String(error2));
|
|
298979
298613
|
if (dataAggregator) {
|
|
298980
298614
|
try {
|
|
298981
298615
|
dataAggregator.recordError(error2 instanceof Error ? error2 : new Error(String(error2)));
|
|
@@ -298988,32 +298622,32 @@ var scenario = new Command().name("scenario").description("Manage and execute El
|
|
|
298988
298622
|
files: {}
|
|
298989
298623
|
});
|
|
298990
298624
|
const errorFilename = `run-${failedResult.run_id}.json`;
|
|
298991
|
-
const errorPath =
|
|
298992
|
-
|
|
298993
|
-
|
|
298625
|
+
const errorPath = path66.join(logsDir, errorFilename);
|
|
298626
|
+
fs41.writeFileSync(errorPath, JSON.stringify(failedResult, null, 2));
|
|
298627
|
+
logger53.info(`\uD83D\uDCA5 [DataAggregator] Error result written to: ${errorPath}`);
|
|
298994
298628
|
} catch (aggregatorError) {
|
|
298995
|
-
|
|
298629
|
+
logger53.error(`[DataAggregator] Failed to record error: ${aggregatorError}`);
|
|
298996
298630
|
}
|
|
298997
298631
|
}
|
|
298998
298632
|
process.exit(1);
|
|
298999
298633
|
} finally {
|
|
299000
298634
|
if (mockEngine) {
|
|
299001
|
-
|
|
298635
|
+
logger53.info("Reverting mocks...");
|
|
299002
298636
|
mockEngine.revertMocks();
|
|
299003
298637
|
}
|
|
299004
298638
|
if (provider) {
|
|
299005
|
-
|
|
298639
|
+
logger53.info("Tearing down environment...");
|
|
299006
298640
|
await provider.teardown();
|
|
299007
298641
|
}
|
|
299008
298642
|
if (runtime) {
|
|
299009
298643
|
try {
|
|
299010
298644
|
const e2bService = runtime.getService("e2b");
|
|
299011
298645
|
if (e2bService && typeof e2bService.stop === "function") {
|
|
299012
|
-
|
|
298646
|
+
logger53.info("Stopping E2B service...");
|
|
299013
298647
|
await e2bService.stop();
|
|
299014
298648
|
}
|
|
299015
298649
|
await runtime.close();
|
|
299016
|
-
|
|
298650
|
+
logger53.info("Runtime shutdown complete");
|
|
299017
298651
|
} catch {}
|
|
299018
298652
|
}
|
|
299019
298653
|
if (server2 && createdServer) {
|
|
@@ -299036,214 +298670,214 @@ var scenario = new Command().name("scenario").description("Manage and execute El
|
|
|
299036
298670
|
validateMatrixParameterPaths: validateMatrixParameterPaths2,
|
|
299037
298671
|
combinationToOverrides: combinationToOverrides2
|
|
299038
298672
|
} = await Promise.resolve().then(() => (init_parameter_override(), exports_parameter_override));
|
|
299039
|
-
const
|
|
299040
|
-
|
|
298673
|
+
const logger53 = elizaLogger || console;
|
|
298674
|
+
logger53.info(`\uD83E\uDDEA Starting matrix analysis with config: ${configPath}`);
|
|
299041
298675
|
if (options.verbose) {
|
|
299042
|
-
|
|
298676
|
+
logger53.info(`Options: ${JSON.stringify(options, null, 2)}`);
|
|
299043
298677
|
}
|
|
299044
298678
|
const { processManager: processManager2 } = await Promise.resolve().then(() => (init_process_manager(), exports_process_manager));
|
|
299045
298679
|
let isShuttingDown = false;
|
|
299046
298680
|
const handleShutdown = async (signal) => {
|
|
299047
298681
|
if (isShuttingDown) {
|
|
299048
|
-
|
|
298682
|
+
logger53.info(`\uD83D\uDD27 [Matrix] Already shutting down, ignoring ${signal}`);
|
|
299049
298683
|
return;
|
|
299050
298684
|
}
|
|
299051
298685
|
isShuttingDown = true;
|
|
299052
|
-
|
|
298686
|
+
logger53.info(`\uD83D\uDD27 [Matrix] Received ${signal}, initiating graceful shutdown...`);
|
|
299053
298687
|
const summary = processManager2.getSummary();
|
|
299054
298688
|
if (summary.total > 0) {
|
|
299055
|
-
|
|
298689
|
+
logger53.info(`\uD83D\uDD27 [Matrix] Cleaning up ${summary.total} tracked processes...`);
|
|
299056
298690
|
await processManager2.terminateAllProcesses();
|
|
299057
|
-
|
|
298691
|
+
logger53.info(`\uD83D\uDD27 [Matrix] Process cleanup completed`);
|
|
299058
298692
|
}
|
|
299059
|
-
|
|
298693
|
+
logger53.info(`\uD83D\uDD27 [Matrix] Shutdown complete`);
|
|
299060
298694
|
process.exit(0);
|
|
299061
298695
|
};
|
|
299062
298696
|
process.on("SIGINT", () => handleShutdown("SIGINT"));
|
|
299063
298697
|
process.on("SIGTERM", () => handleShutdown("SIGTERM"));
|
|
299064
298698
|
try {
|
|
299065
|
-
const fullPath =
|
|
299066
|
-
const configDir =
|
|
299067
|
-
|
|
299068
|
-
if (!
|
|
299069
|
-
|
|
299070
|
-
|
|
298699
|
+
const fullPath = path66.resolve(configPath);
|
|
298700
|
+
const configDir = path66.dirname(fullPath);
|
|
298701
|
+
logger53.info(`\uD83D\uDCC2 Loading matrix configuration from: ${fullPath}`);
|
|
298702
|
+
if (!fs41.existsSync(fullPath)) {
|
|
298703
|
+
logger53.error(`\u274C Error: Matrix configuration file not found at '${fullPath}'`);
|
|
298704
|
+
logger53.info("\uD83D\uDCA1 Make sure the file exists and the path is correct.");
|
|
299071
298705
|
process.exit(1);
|
|
299072
298706
|
}
|
|
299073
|
-
const fileContents =
|
|
298707
|
+
const fileContents = fs41.readFileSync(fullPath, "utf8");
|
|
299074
298708
|
let rawMatrixConfig;
|
|
299075
298709
|
try {
|
|
299076
298710
|
rawMatrixConfig = load2(fileContents);
|
|
299077
298711
|
} catch (yamlError) {
|
|
299078
|
-
|
|
299079
|
-
|
|
299080
|
-
|
|
298712
|
+
logger53.error(`\u274C Error: Failed to parse YAML configuration file:`);
|
|
298713
|
+
logger53.error(yamlError instanceof Error ? yamlError.message : String(yamlError));
|
|
298714
|
+
logger53.info("\uD83D\uDCA1 Check that your YAML syntax is valid.");
|
|
299081
298715
|
process.exit(1);
|
|
299082
298716
|
}
|
|
299083
|
-
if (rawMatrixConfig.base_scenario && !
|
|
299084
|
-
rawMatrixConfig.base_scenario =
|
|
298717
|
+
if (rawMatrixConfig.base_scenario && !path66.isAbsolute(rawMatrixConfig.base_scenario)) {
|
|
298718
|
+
rawMatrixConfig.base_scenario = path66.resolve(configDir, rawMatrixConfig.base_scenario);
|
|
299085
298719
|
}
|
|
299086
|
-
|
|
298720
|
+
logger53.info("\uD83D\uDD0D Validating matrix configuration...");
|
|
299087
298721
|
const validationResult = validateMatrixConfig2(rawMatrixConfig);
|
|
299088
298722
|
if (!validationResult.success) {
|
|
299089
|
-
|
|
298723
|
+
logger53.error("\u274C Matrix configuration validation failed:");
|
|
299090
298724
|
const errors = validationResult.error.format();
|
|
299091
|
-
const formatErrors = (obj,
|
|
298725
|
+
const formatErrors = (obj, path67 = "") => {
|
|
299092
298726
|
if (obj._errors && obj._errors.length > 0) {
|
|
299093
298727
|
obj._errors.forEach((error2) => {
|
|
299094
|
-
|
|
298728
|
+
logger53.error(` ${path67}: ${error2}`);
|
|
299095
298729
|
});
|
|
299096
298730
|
}
|
|
299097
298731
|
Object.keys(obj).forEach((key) => {
|
|
299098
298732
|
if (key !== "_errors" && typeof obj[key] === "object") {
|
|
299099
|
-
const newPath =
|
|
298733
|
+
const newPath = path67 ? `${path67}.${key}` : key;
|
|
299100
298734
|
formatErrors(obj[key], newPath);
|
|
299101
298735
|
}
|
|
299102
298736
|
});
|
|
299103
298737
|
};
|
|
299104
298738
|
formatErrors(errors);
|
|
299105
|
-
|
|
299106
|
-
|
|
298739
|
+
logger53.info("\uD83D\uDCA1 Please fix the configuration errors and try again.");
|
|
298740
|
+
logger53.info("\uD83D\uDCD6 See the matrix testing documentation for examples and guidance.");
|
|
299107
298741
|
process.exit(1);
|
|
299108
298742
|
}
|
|
299109
298743
|
const matrixConfig = validationResult.data;
|
|
299110
|
-
|
|
298744
|
+
logger53.info("\u2705 Matrix configuration is valid!");
|
|
299111
298745
|
const totalCombinations = calculateTotalCombinations2(matrixConfig);
|
|
299112
298746
|
const totalRuns = calculateTotalRuns2(matrixConfig);
|
|
299113
|
-
|
|
298747
|
+
logger53.info(`
|
|
299114
298748
|
\uD83D\uDCCA Matrix Analysis:`);
|
|
299115
|
-
|
|
298749
|
+
logger53.info(` Name: ${matrixConfig.name}`);
|
|
299116
298750
|
if (matrixConfig.description) {
|
|
299117
|
-
|
|
299118
|
-
}
|
|
299119
|
-
|
|
299120
|
-
|
|
299121
|
-
|
|
299122
|
-
|
|
299123
|
-
|
|
299124
|
-
|
|
298751
|
+
logger53.info(` Description: ${matrixConfig.description}`);
|
|
298752
|
+
}
|
|
298753
|
+
logger53.info(` Base Scenario: ${matrixConfig.base_scenario}`);
|
|
298754
|
+
logger53.info(` Runs per combination: ${matrixConfig.runs_per_combination}`);
|
|
298755
|
+
logger53.info(` Matrix axes: ${matrixConfig.matrix.length}`);
|
|
298756
|
+
logger53.info(` Total combinations: ${totalCombinations}`);
|
|
298757
|
+
logger53.info(` Total test runs: ${totalRuns}`);
|
|
298758
|
+
logger53.info(`
|
|
299125
298759
|
\uD83C\uDFAF Matrix Structure:`);
|
|
299126
298760
|
matrixConfig.matrix.forEach((axis, index) => {
|
|
299127
|
-
|
|
299128
|
-
|
|
299129
|
-
|
|
298761
|
+
logger53.info(` Axis ${index + 1}: ${axis.parameter}`);
|
|
298762
|
+
logger53.info(` Values: [${axis.values.map((v2) => JSON.stringify(v2)).join(", ")}]`);
|
|
298763
|
+
logger53.info(` Count: ${axis.values.length}`);
|
|
299130
298764
|
});
|
|
299131
298765
|
const baseScenarioPath = matrixConfig.base_scenario;
|
|
299132
|
-
if (!
|
|
299133
|
-
|
|
298766
|
+
if (!fs41.existsSync(baseScenarioPath)) {
|
|
298767
|
+
logger53.error(`
|
|
299134
298768
|
\u274C Error: Base scenario file not found at '${baseScenarioPath}'`);
|
|
299135
|
-
|
|
298769
|
+
logger53.info("\uD83D\uDCA1 Make sure the base_scenario path in your matrix config is correct.");
|
|
299136
298770
|
process.exit(1);
|
|
299137
298771
|
}
|
|
299138
|
-
|
|
298772
|
+
logger53.info(`\u2705 Base scenario file found: ${baseScenarioPath}`);
|
|
299139
298773
|
let baseScenario;
|
|
299140
298774
|
try {
|
|
299141
|
-
const baseScenarioContents =
|
|
298775
|
+
const baseScenarioContents = fs41.readFileSync(baseScenarioPath, "utf8");
|
|
299142
298776
|
baseScenario = load2(baseScenarioContents);
|
|
299143
298777
|
const baseValidationResult = ScenarioSchema.safeParse(baseScenario);
|
|
299144
298778
|
if (!baseValidationResult.success) {
|
|
299145
|
-
|
|
298779
|
+
logger53.error(`
|
|
299146
298780
|
\u274C Error: Base scenario file is invalid:`);
|
|
299147
|
-
|
|
298781
|
+
logger53.error(JSON.stringify(baseValidationResult.error.format(), null, 2));
|
|
299148
298782
|
process.exit(1);
|
|
299149
298783
|
}
|
|
299150
|
-
|
|
298784
|
+
logger53.info(`\u2705 Base scenario is valid`);
|
|
299151
298785
|
} catch (yamlError) {
|
|
299152
|
-
|
|
298786
|
+
logger53.error(`
|
|
299153
298787
|
\u274C Error: Failed to parse base scenario YAML file:`);
|
|
299154
|
-
|
|
298788
|
+
logger53.error(yamlError instanceof Error ? yamlError.message : String(yamlError));
|
|
299155
298789
|
process.exit(1);
|
|
299156
298790
|
}
|
|
299157
|
-
|
|
298791
|
+
logger53.info(`\uD83D\uDD0D Validating matrix parameter paths...`);
|
|
299158
298792
|
const pathValidation = validateMatrixParameterPaths2(baseScenario, matrixConfig.matrix);
|
|
299159
298793
|
if (!pathValidation.valid) {
|
|
299160
|
-
|
|
298794
|
+
logger53.error(`
|
|
299161
298795
|
\u274C Error: Invalid parameter paths in matrix configuration:`);
|
|
299162
298796
|
pathValidation.invalidPaths.forEach((invalidPath) => {
|
|
299163
|
-
|
|
298797
|
+
logger53.error(` - ${invalidPath}`);
|
|
299164
298798
|
});
|
|
299165
|
-
|
|
299166
|
-
|
|
298799
|
+
logger53.info("\uD83D\uDCA1 Make sure all parameter paths exist in your base scenario.");
|
|
298800
|
+
logger53.info("\uD83D\uDCD6 Check the matrix testing documentation for parameter path examples.");
|
|
299167
298801
|
process.exit(1);
|
|
299168
298802
|
}
|
|
299169
|
-
|
|
298803
|
+
logger53.info(`\u2705 All matrix parameter paths are valid`);
|
|
299170
298804
|
const combinations = generateMatrixCombinations2(matrixConfig);
|
|
299171
298805
|
if (options.verbose || options.dryRun) {
|
|
299172
|
-
|
|
298806
|
+
logger53.info(`
|
|
299173
298807
|
\uD83D\uDD00 Matrix Combinations:`);
|
|
299174
298808
|
combinations.forEach((combo, index) => {
|
|
299175
|
-
|
|
298809
|
+
logger53.info(` ${index + 1}. ${combo.id}: ${JSON.stringify(combo.parameters, null, 0)}`);
|
|
299176
298810
|
});
|
|
299177
298811
|
if (combinations.length > 0 && options.verbose) {
|
|
299178
|
-
|
|
298812
|
+
logger53.info(`
|
|
299179
298813
|
\uD83D\uDEE0\uFE0F Parameter Override Preview:`);
|
|
299180
298814
|
try {
|
|
299181
298815
|
const firstCombination = combinations[0];
|
|
299182
298816
|
const overrides = combinationToOverrides2(firstCombination.parameters);
|
|
299183
|
-
|
|
299184
|
-
|
|
299185
|
-
|
|
299186
|
-
|
|
299187
|
-
|
|
298817
|
+
logger53.info(` \uD83D\uDCCB Example: ${firstCombination.id}`);
|
|
298818
|
+
logger53.info(` \uD83D\uDCCA Metadata: ${firstCombination.metadata.combinationIndex + 1} of ${firstCombination.metadata.totalCombinations}`);
|
|
298819
|
+
logger53.info(` \uD83D\uDCDD Original scenario name: "${baseScenario.name}"`);
|
|
298820
|
+
logger53.info(` \uD83D\uDCDD Modified scenario ready for execution`);
|
|
298821
|
+
logger53.info(` \uD83D\uDCDD Parameters applied:`);
|
|
299188
298822
|
overrides.forEach((override) => {
|
|
299189
|
-
|
|
298823
|
+
logger53.info(` \uD83D\uDD27 ${override.path}: ${JSON.stringify(override.value)}`);
|
|
299190
298824
|
});
|
|
299191
|
-
|
|
298825
|
+
logger53.info(` \uD83D\uDCDD This combination will run ${matrixConfig.runs_per_combination} time(s)`);
|
|
299192
298826
|
} catch (error2) {
|
|
299193
|
-
|
|
298827
|
+
logger53.warn(` \u26A0\uFE0F Could not generate override preview: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
299194
298828
|
}
|
|
299195
298829
|
}
|
|
299196
298830
|
}
|
|
299197
298831
|
let filteredCombinations = combinations;
|
|
299198
298832
|
if (options.filter) {
|
|
299199
|
-
|
|
298833
|
+
logger53.info(`
|
|
299200
298834
|
\uD83D\uDD0D Applying filter: ${options.filter}`);
|
|
299201
298835
|
filteredCombinations = filterCombinations2(combinations, options.filter);
|
|
299202
|
-
|
|
298836
|
+
logger53.info(` Filtered to ${filteredCombinations.length} combinations`);
|
|
299203
298837
|
}
|
|
299204
298838
|
if (totalRuns > 50) {
|
|
299205
|
-
|
|
298839
|
+
logger53.info(`
|
|
299206
298840
|
\u26A0\uFE0F Warning: This matrix will execute ${totalRuns} total test runs.`);
|
|
299207
|
-
|
|
299208
|
-
|
|
298841
|
+
logger53.info(" This may take a significant amount of time and resources.");
|
|
298842
|
+
logger53.info(" Consider using --filter to reduce the scope or increasing --parallel for faster execution.");
|
|
299209
298843
|
}
|
|
299210
298844
|
if (options.dryRun) {
|
|
299211
|
-
|
|
298845
|
+
logger53.info(`
|
|
299212
298846
|
\uD83D\uDD0D Dry Run Complete - Matrix Analysis Only`);
|
|
299213
|
-
|
|
299214
|
-
|
|
298847
|
+
logger53.info("\u2728 Matrix configuration is valid and ready for execution.");
|
|
298848
|
+
logger53.info("\uD83D\uDCDD To execute the matrix, run the same command without --dry-run");
|
|
299215
298849
|
if (!isShuttingDown) {
|
|
299216
298850
|
const summary = processManager2.getSummary();
|
|
299217
298851
|
if (summary.total > 0) {
|
|
299218
|
-
|
|
298852
|
+
logger53.info(`\uD83D\uDD27 [Matrix] Cleaning up ${summary.total} processes after dry-run...`);
|
|
299219
298853
|
await processManager2.terminateAllProcesses();
|
|
299220
298854
|
}
|
|
299221
298855
|
}
|
|
299222
298856
|
process.exit(0);
|
|
299223
298857
|
} else {
|
|
299224
298858
|
const executionStats = calculateExecutionStats2(filteredCombinations, matrixConfig.runs_per_combination);
|
|
299225
|
-
|
|
298859
|
+
logger53.info(`
|
|
299226
298860
|
\uD83D\uDE80 Matrix Execution Plan:`);
|
|
299227
|
-
|
|
299228
|
-
|
|
299229
|
-
|
|
299230
|
-
|
|
299231
|
-
|
|
299232
|
-
|
|
298861
|
+
logger53.info(` Parallel execution: ${options.parallel} concurrent runs`);
|
|
298862
|
+
logger53.info(` Total combinations to execute: ${executionStats.totalCombinations}`);
|
|
298863
|
+
logger53.info(` Total runs: ${executionStats.totalRuns}`);
|
|
298864
|
+
logger53.info(` Estimated duration: ${formatDuration2(executionStats.estimatedDuration.realistic)} (realistic)`);
|
|
298865
|
+
logger53.info(` Duration range: ${formatDuration2(executionStats.estimatedDuration.optimistic)} - ${formatDuration2(executionStats.estimatedDuration.pessimistic)}`);
|
|
298866
|
+
logger53.info(`
|
|
299233
298867
|
\u2705 Matrix Ready for Execution:`);
|
|
299234
|
-
|
|
299235
|
-
|
|
299236
|
-
|
|
299237
|
-
|
|
299238
|
-
|
|
298868
|
+
logger53.info(" \uD83C\uDFAF Matrix configuration: \u2705 Valid");
|
|
298869
|
+
logger53.info(" \uD83C\uDFAF Parameter combinations: \u2705 Generated");
|
|
298870
|
+
logger53.info(" \uD83C\uDFAF Execution context: \u2705 Prepared");
|
|
298871
|
+
logger53.info(" \uD83C\uDFAF Base scenario: \u2705 Validated");
|
|
298872
|
+
logger53.info("\uD83D\uDD27 [DEBUG] About to import matrix-orchestrator...");
|
|
299239
298873
|
const { executeMatrixRuns: executeMatrixRuns2 } = await Promise.resolve().then(() => (init_matrix_orchestrator(), exports_matrix_orchestrator));
|
|
299240
|
-
|
|
299241
|
-
|
|
298874
|
+
logger53.info("\uD83D\uDD27 [DEBUG] Successfully imported matrix-orchestrator");
|
|
298875
|
+
logger53.info(`
|
|
299242
298876
|
\uD83D\uDE80 Starting Matrix Execution...`);
|
|
299243
|
-
const logsDir =
|
|
298877
|
+
const logsDir = path66.join(__dirname, "_logs_");
|
|
299244
298878
|
const matrixRunId = generateRunFilename(1);
|
|
299245
|
-
const outputDir =
|
|
299246
|
-
|
|
298879
|
+
const outputDir = path66.join(logsDir, matrixRunId.replace("run-", "matrix-"));
|
|
298880
|
+
logger53.info("\uD83D\uDD27 [DEBUG] About to call executeMatrixRuns...");
|
|
299247
298881
|
const results = await executeMatrixRuns2(matrixConfig, filteredCombinations, {
|
|
299248
298882
|
outputDir,
|
|
299249
298883
|
maxParallel: parseInt(options.parallel, 10),
|
|
@@ -299252,54 +298886,54 @@ var scenario = new Command().name("scenario").description("Manage and execute El
|
|
|
299252
298886
|
verbose: options.verbose,
|
|
299253
298887
|
onProgress: (message, eventType, _data) => {
|
|
299254
298888
|
if (options.verbose || eventType === "MATRIX_STARTED" || eventType === "COMBINATION_COMPLETED" || eventType === "MATRIX_COMPLETED") {
|
|
299255
|
-
|
|
298889
|
+
logger53.info(`\uD83D\uDD04 ${message}`);
|
|
299256
298890
|
}
|
|
299257
298891
|
},
|
|
299258
298892
|
onCombinationComplete: (summary) => {
|
|
299259
|
-
|
|
298893
|
+
logger53.info(`\u2705 Combination ${summary.combinationId} completed: ${summary.successfulRuns}/${summary.totalRuns} successful (${(summary.successRate * 100).toFixed(1)}%)`);
|
|
299260
298894
|
},
|
|
299261
298895
|
onResourceWarning: (alert) => {
|
|
299262
|
-
|
|
298896
|
+
logger53.warn(`\u26A0\uFE0F Resource ${alert.resource} at ${alert.currentUsage.toFixed(1)}%: ${alert.message}`);
|
|
299263
298897
|
if (alert.recommendation) {
|
|
299264
|
-
|
|
298898
|
+
logger53.info(`\uD83D\uDCA1 Recommendation: ${alert.recommendation}`);
|
|
299265
298899
|
}
|
|
299266
298900
|
}
|
|
299267
298901
|
});
|
|
299268
|
-
|
|
298902
|
+
logger53.info("\uD83D\uDD27 [DEBUG] executeMatrixRuns completed successfully");
|
|
299269
298903
|
const successfulRuns = results.filter((r2) => r2.success).length;
|
|
299270
298904
|
const failedRuns = results.length - successfulRuns;
|
|
299271
298905
|
const successRate = results.length > 0 ? successfulRuns / results.length * 100 : 0;
|
|
299272
|
-
|
|
298906
|
+
logger53.info(`
|
|
299273
298907
|
\uD83C\uDF89 Matrix Execution Complete!`);
|
|
299274
|
-
|
|
299275
|
-
|
|
299276
|
-
|
|
299277
|
-
|
|
299278
|
-
|
|
299279
|
-
|
|
298908
|
+
logger53.info(`\uD83D\uDCCA Results Summary:`);
|
|
298909
|
+
logger53.info(` Total runs: ${results.length}`);
|
|
298910
|
+
logger53.info(` Successful: ${successfulRuns}`);
|
|
298911
|
+
logger53.info(` Failed: ${failedRuns}`);
|
|
298912
|
+
logger53.info(` Success rate: ${successRate.toFixed(1)}%`);
|
|
298913
|
+
logger53.info(`\uD83D\uDCC1 Results saved to: ${outputDir}`);
|
|
299280
298914
|
if (!isShuttingDown) {
|
|
299281
298915
|
const summary = processManager2.getSummary();
|
|
299282
298916
|
if (summary.total > 0) {
|
|
299283
|
-
|
|
298917
|
+
logger53.info(`\uD83D\uDD27 [Matrix] Cleaning up ${summary.total} processes after completion...`);
|
|
299284
298918
|
await processManager2.terminateAllProcesses();
|
|
299285
|
-
|
|
298919
|
+
logger53.info(`\uD83D\uDD27 [Matrix] Process cleanup completed`);
|
|
299286
298920
|
}
|
|
299287
298921
|
}
|
|
299288
298922
|
process.exit(failedRuns === 0 ? 0 : 1);
|
|
299289
298923
|
}
|
|
299290
298924
|
} catch (error2) {
|
|
299291
|
-
|
|
298925
|
+
logger53.error("\u274C An error occurred during matrix analysis:", error2 instanceof Error ? error2.message : String(error2));
|
|
299292
298926
|
if (options.verbose && error2 instanceof Error && error2.stack) {
|
|
299293
|
-
|
|
298927
|
+
logger53.error(`Stack trace: ${error2.stack}`);
|
|
299294
298928
|
}
|
|
299295
298929
|
if (!isShuttingDown) {
|
|
299296
298930
|
const summary = processManager2.getSummary();
|
|
299297
298931
|
if (summary.total > 0) {
|
|
299298
|
-
|
|
298932
|
+
logger53.info(`\uD83D\uDD27 [Matrix] Cleaning up ${summary.total} processes after error...`);
|
|
299299
298933
|
await processManager2.terminateAllProcesses();
|
|
299300
298934
|
}
|
|
299301
298935
|
}
|
|
299302
|
-
|
|
298936
|
+
logger53.info("\uD83D\uDCA1 Use --verbose for more detailed error information.");
|
|
299303
298937
|
process.exit(1);
|
|
299304
298938
|
}
|
|
299305
298939
|
}));
|
|
@@ -299320,19 +298954,19 @@ var shutdownState = {
|
|
|
299320
298954
|
};
|
|
299321
298955
|
async function gracefulShutdown(signal) {
|
|
299322
298956
|
if (!shutdownState.tryInitiateShutdown()) {
|
|
299323
|
-
|
|
298957
|
+
logger53.debug(`Ignoring ${signal} - shutdown already in progress`);
|
|
299324
298958
|
return;
|
|
299325
298959
|
}
|
|
299326
|
-
|
|
298960
|
+
logger53.info(`Received ${signal}, shutting down gracefully...`);
|
|
299327
298961
|
try {
|
|
299328
298962
|
const serverWasStopped = await stopServer();
|
|
299329
298963
|
if (serverWasStopped) {
|
|
299330
|
-
|
|
298964
|
+
logger53.info("Server stopped successfully");
|
|
299331
298965
|
}
|
|
299332
298966
|
} catch (error2) {
|
|
299333
298967
|
const errorMessage = error2 instanceof Error ? error2.message : String(error2);
|
|
299334
|
-
|
|
299335
|
-
|
|
298968
|
+
logger53.error(`Error stopping server: ${errorMessage}`);
|
|
298969
|
+
logger53.debug({ error: error2 }, "Full error details:");
|
|
299336
298970
|
}
|
|
299337
298971
|
const exitCode = signal === "SIGINT" ? 130 : signal === "SIGTERM" ? 143 : 0;
|
|
299338
298972
|
process.exit(exitCode);
|
|
@@ -299366,9 +299000,9 @@ async function main2() {
|
|
|
299366
299000
|
await program2.parseAsync();
|
|
299367
299001
|
}
|
|
299368
299002
|
main2().catch((error2) => {
|
|
299369
|
-
|
|
299003
|
+
logger53.error({ error: error2 }, "An error occurred:");
|
|
299370
299004
|
process.exit(1);
|
|
299371
299005
|
});
|
|
299372
299006
|
|
|
299373
|
-
//# debugId=
|
|
299007
|
+
//# debugId=88B53409D97677C264756E2164756E21
|
|
299374
299008
|
//# sourceMappingURL=index.js.map
|