@elizaos/cli 1.4.2 → 1.4.4
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/{chunk-SMZBJQJR.js → chunk-HOC6B3QV.js} +1 -1
- package/dist/{chunk-D3QSET5H.js → chunk-N5G5XSGP.js} +29 -5
- package/dist/{chunk-FSSUAWXQ.js → chunk-NSNXXD3I.js} +2 -2
- package/dist/commands/agent/actions/index.js +1 -1
- package/dist/commands/agent/index.js +1 -1
- package/dist/commands/create/actions/index.js +2 -2
- package/dist/commands/create/index.js +3 -3
- package/dist/index.js +138 -128
- package/dist/{registry-RF6PW3EN.js → registry-ELONUC44.js} +1 -1
- package/dist/templates/plugin-quick-starter/package.json +2 -2
- package/dist/templates/plugin-quick-starter/src/__tests__/test-utils.ts +1 -0
- package/dist/templates/plugin-starter/package.json +2 -2
- package/dist/templates/plugin-starter/src/__tests__/test-utils.ts +1 -0
- package/dist/templates/project-starter/package.json +4 -4
- package/dist/templates/project-starter/src/__tests__/config.test.ts +6 -15
- package/dist/templates/project-starter/src/__tests__/error-handling.test.ts +4 -18
- package/dist/templates/project-starter/src/__tests__/events.test.ts +27 -23
- package/dist/templates/project-tee-starter/package.json +4 -4
- package/dist/templates/project-tee-starter/src/__tests__/config.test.ts +40 -0
- package/dist/templates/project-tee-starter/src/index.ts +1 -2
- package/dist/templates/project-tee-starter/src/plugin.ts +21 -19
- package/dist/{utils-5HPZSIF6.js → utils-X6UXPLKD.js} +1 -1
- package/package.json +6 -7
- package/templates/plugin-quick-starter/package.json +2 -2
- package/templates/plugin-quick-starter/src/__tests__/test-utils.ts +1 -0
- package/templates/plugin-starter/package.json +2 -2
- package/templates/plugin-starter/src/__tests__/test-utils.ts +1 -0
- package/templates/project-starter/package.json +4 -4
- package/templates/project-starter/src/__tests__/config.test.ts +6 -15
- package/templates/project-starter/src/__tests__/error-handling.test.ts +4 -18
- package/templates/project-starter/src/__tests__/events.test.ts +27 -23
- package/templates/project-tee-starter/package.json +4 -4
- package/templates/project-tee-starter/src/__tests__/config.test.ts +40 -0
- package/templates/project-tee-starter/src/index.ts +1 -2
- package/templates/project-tee-starter/src/plugin.ts +21 -19
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import {
|
|
3
3
|
create
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NSNXXD3I.js";
|
|
5
5
|
import {
|
|
6
6
|
getElizaCharacter
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HOC6B3QV.js";
|
|
8
8
|
import {
|
|
9
9
|
TestRunner,
|
|
10
10
|
UserEnvironment,
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
testPublishToNpm,
|
|
45
45
|
tryDelegateToLocalCli,
|
|
46
46
|
validateDataDir
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-N5G5XSGP.js";
|
|
48
48
|
import {
|
|
49
49
|
configureEmojis,
|
|
50
50
|
emoji,
|
|
@@ -2422,13 +2422,13 @@ var SimpleMigrationAgent = class extends EventTarget {
|
|
|
2422
2422
|
if (eventHandlers.has(handler)) {
|
|
2423
2423
|
return this;
|
|
2424
2424
|
}
|
|
2425
|
-
const wrappedHandler = (e) => {
|
|
2425
|
+
const wrappedHandler = ((e) => {
|
|
2426
2426
|
if (e instanceof CustomEvent) {
|
|
2427
2427
|
handler(e.detail);
|
|
2428
2428
|
} else {
|
|
2429
2429
|
handler(void 0);
|
|
2430
2430
|
}
|
|
2431
|
-
};
|
|
2431
|
+
});
|
|
2432
2432
|
eventHandlers.set(handler, wrappedHandler);
|
|
2433
2433
|
this.addEventListener(event, wrappedHandler);
|
|
2434
2434
|
return this;
|
|
@@ -3535,7 +3535,8 @@ async function generatePackageMetadata(packageJson, cliVersion, username) {
|
|
|
3535
3535
|
// node, browser, or universal
|
|
3536
3536
|
runtimeVersion: cliVersion,
|
|
3537
3537
|
// Compatible CLI/runtime version
|
|
3538
|
-
repository: packageJson.repository
|
|
3538
|
+
...packageJson.repository?.url && { repository: packageJson.repository.url },
|
|
3539
|
+
// Only include if present
|
|
3539
3540
|
maintainers: packageJson.maintainers || [username],
|
|
3540
3541
|
publishedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3541
3542
|
publishedBy: username,
|
|
@@ -4186,6 +4187,14 @@ var publish = new Command5().name("publish").description("Publish a plugin to np
|
|
|
4186
4187
|
replacement.replace();
|
|
4187
4188
|
}
|
|
4188
4189
|
});
|
|
4190
|
+
if (opts.npm && packageJson.repository) {
|
|
4191
|
+
delete packageJson.repository;
|
|
4192
|
+
console.info("Removed repository field for npm-only publishing");
|
|
4193
|
+
}
|
|
4194
|
+
if (opts.npm && packageJson.bugs) {
|
|
4195
|
+
delete packageJson.bugs;
|
|
4196
|
+
console.info("Removed bugs field for npm-only publishing");
|
|
4197
|
+
}
|
|
4189
4198
|
const finalPluginName = packageJson.name.startsWith("@") ? packageJson.name.split("/")[1] : packageJson.name;
|
|
4190
4199
|
await fs9.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2), "utf-8");
|
|
4191
4200
|
await validatePluginRequirements(cwd, packageJson);
|
|
@@ -5017,45 +5026,46 @@ import { Command as Command9 } from "commander";
|
|
|
5017
5026
|
// src/commands/tee/phala-wrapper.ts
|
|
5018
5027
|
import { Command as Command8 } from "commander";
|
|
5019
5028
|
import { spawn } from "child_process";
|
|
5020
|
-
import {
|
|
5021
|
-
var phalaCliCommand = new Command8("phala").description("Official Phala Cloud CLI - Manage TEE deployments on Phala Cloud").allowUnknownOption().helpOption(false).action(async (
|
|
5022
|
-
const
|
|
5029
|
+
import { logger as logger22 } from "@elizaos/core";
|
|
5030
|
+
var phalaCliCommand = new Command8("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) => {
|
|
5031
|
+
const cmd = commandArgs[commandArgs.length - 1];
|
|
5032
|
+
const raw = cmd?.parent?.rawArgs ?? cmd?.rawArgs ?? process.argv;
|
|
5033
|
+
const idx = raw.findIndex((arg) => arg === "phala");
|
|
5034
|
+
const args = idx >= 0 ? raw.slice(idx + 1) : Array.isArray(commandArgs[0]) ? commandArgs[0] : [];
|
|
5023
5035
|
try {
|
|
5024
|
-
|
|
5036
|
+
logger22.info({ args }, "Running Phala CLI command");
|
|
5025
5037
|
const phalaProcess = spawn("npx", ["--yes", "phala", ...args], {
|
|
5026
|
-
stdio: "inherit"
|
|
5027
|
-
shell: true
|
|
5038
|
+
stdio: "inherit"
|
|
5028
5039
|
});
|
|
5029
|
-
phalaProcess.on("error", (
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
${emoji.error("Error: npx not found. Please install Node.js and npm:")}`
|
|
5035
|
-
);
|
|
5036
|
-
|
|
5037
|
-
elizaLogger.error(
|
|
5040
|
+
phalaProcess.on("error", (err) => {
|
|
5041
|
+
const error = err;
|
|
5042
|
+
logger22.error({ error, args }, "Failed to execute Phala CLI");
|
|
5043
|
+
if (error.code === "ENOENT") {
|
|
5044
|
+
logger22.error(`
|
|
5045
|
+
${emoji.error("Error: npx not found. Please install Node.js and npm:")}`);
|
|
5046
|
+
logger22.error(" Visit https://nodejs.org or use a version manager like nvm");
|
|
5047
|
+
logger22.error(
|
|
5038
5048
|
" curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash"
|
|
5039
5049
|
);
|
|
5040
5050
|
} else {
|
|
5041
|
-
|
|
5051
|
+
logger22.error(`
|
|
5042
5052
|
${emoji.error("Error: Failed to execute Phala CLI")}`);
|
|
5043
|
-
|
|
5053
|
+
logger22.error({ args }, " Try running directly: npx phala [args]");
|
|
5044
5054
|
}
|
|
5045
5055
|
process.exit(1);
|
|
5046
5056
|
});
|
|
5047
5057
|
phalaProcess.on("exit", (code) => {
|
|
5048
5058
|
if (code !== 0) {
|
|
5049
|
-
|
|
5059
|
+
logger22.warn({ code }, "Phala CLI exited with non-zero code");
|
|
5050
5060
|
}
|
|
5051
5061
|
process.exit(code || 0);
|
|
5052
5062
|
});
|
|
5053
5063
|
} catch (error) {
|
|
5054
|
-
|
|
5055
|
-
|
|
5064
|
+
logger22.error({ error, args }, "Error running Phala CLI");
|
|
5065
|
+
logger22.error(`
|
|
5056
5066
|
${emoji.error("Error: Failed to run Phala CLI")}`);
|
|
5057
|
-
|
|
5058
|
-
|
|
5067
|
+
logger22.error({ args }, " Try running Phala CLI directly with: npx phala [args]");
|
|
5068
|
+
logger22.error(" Or visit https://www.npmjs.com/package/phala for more information");
|
|
5059
5069
|
process.exit(1);
|
|
5060
5070
|
}
|
|
5061
5071
|
}).configureHelp({
|
|
@@ -5077,17 +5087,17 @@ ${emoji.error("Error: Failed to run Phala CLI")}`);
|
|
|
5077
5087
|
});
|
|
5078
5088
|
|
|
5079
5089
|
// src/commands/tee/index.ts
|
|
5080
|
-
var teeCommand = new Command9("tee").description("Manage TEE deployments").addCommand(phalaCliCommand);
|
|
5090
|
+
var teeCommand = new Command9("tee").description("Manage TEE deployments").enablePositionalOptions().addCommand(phalaCliCommand);
|
|
5081
5091
|
|
|
5082
5092
|
// src/commands/test/index.ts
|
|
5083
|
-
import { logger as
|
|
5093
|
+
import { logger as logger29 } from "@elizaos/core";
|
|
5084
5094
|
import { Command as Command10, Option as Option2 } from "commander";
|
|
5085
5095
|
|
|
5086
5096
|
// src/commands/test/actions/run-all-tests.ts
|
|
5087
|
-
import { logger as
|
|
5097
|
+
import { logger as logger27 } from "@elizaos/core";
|
|
5088
5098
|
|
|
5089
5099
|
// src/commands/test/utils/project-utils.ts
|
|
5090
|
-
import { logger as
|
|
5100
|
+
import { logger as logger23 } from "@elizaos/core";
|
|
5091
5101
|
import * as fs12 from "fs";
|
|
5092
5102
|
import path26 from "path";
|
|
5093
5103
|
function getProjectType(testPath) {
|
|
@@ -5124,7 +5134,7 @@ async function installPluginDependencies(projectInfo) {
|
|
|
5124
5134
|
};
|
|
5125
5135
|
await fs12.promises.writeFile(packageJsonPath, JSON.stringify(packageJsonContent, null, 2));
|
|
5126
5136
|
}
|
|
5127
|
-
const { installPlugin: installPlugin2 } = await import("./utils-
|
|
5137
|
+
const { installPlugin: installPlugin2 } = await import("./utils-X6UXPLKD.js");
|
|
5128
5138
|
for (const dependency of project.pluginModule.dependencies) {
|
|
5129
5139
|
await installPlugin2(dependency, pluginsDir);
|
|
5130
5140
|
const dependencyPath = path26.join(pluginsDir, "node_modules", dependency);
|
|
@@ -5132,7 +5142,7 @@ async function installPluginDependencies(projectInfo) {
|
|
|
5132
5142
|
try {
|
|
5133
5143
|
await runBunCommand(["install"], dependencyPath);
|
|
5134
5144
|
} catch (error) {
|
|
5135
|
-
|
|
5145
|
+
logger23.warn(
|
|
5136
5146
|
`[Test Command] Failed to install devDependencies for ${dependency}: ${error}`
|
|
5137
5147
|
);
|
|
5138
5148
|
}
|
|
@@ -5142,11 +5152,11 @@ async function installPluginDependencies(projectInfo) {
|
|
|
5142
5152
|
}
|
|
5143
5153
|
|
|
5144
5154
|
// src/commands/test/actions/component-tests.ts
|
|
5145
|
-
import { logger as
|
|
5155
|
+
import { logger as logger25 } from "@elizaos/core";
|
|
5146
5156
|
import path28 from "path";
|
|
5147
5157
|
|
|
5148
5158
|
// src/utils/testing/tsc-validator.ts
|
|
5149
|
-
import { logger as
|
|
5159
|
+
import { logger as logger24 } from "@elizaos/core";
|
|
5150
5160
|
import path27 from "path";
|
|
5151
5161
|
import { existsSync as existsSync18 } from "fs";
|
|
5152
5162
|
async function runTypeCheck(projectPath, strict = true) {
|
|
@@ -5174,7 +5184,7 @@ async function runTypeCheck(projectPath, strict = true) {
|
|
|
5174
5184
|
warnings: stderr.includes("warning") ? [stderr] : []
|
|
5175
5185
|
};
|
|
5176
5186
|
} catch (error) {
|
|
5177
|
-
|
|
5187
|
+
logger24.error({ error }, "TypeScript validation failed:");
|
|
5178
5188
|
return {
|
|
5179
5189
|
success: false,
|
|
5180
5190
|
errors: [`TypeScript validation error: ${error.message}`],
|
|
@@ -5188,38 +5198,38 @@ async function runComponentTests(testPath, options, projectInfo) {
|
|
|
5188
5198
|
const cwd = process.cwd();
|
|
5189
5199
|
const isPlugin2 = projectInfo.type === "elizaos-plugin";
|
|
5190
5200
|
if (!options.skipTypeCheck) {
|
|
5191
|
-
|
|
5201
|
+
logger25.info("Running TypeScript validation...");
|
|
5192
5202
|
const typeCheckResult = await runTypeCheck(cwd, true);
|
|
5193
5203
|
if (!typeCheckResult.success) {
|
|
5194
|
-
|
|
5195
|
-
typeCheckResult.errors.forEach((error) =>
|
|
5204
|
+
logger25.error("TypeScript validation failed:");
|
|
5205
|
+
typeCheckResult.errors.forEach((error) => logger25.error(error));
|
|
5196
5206
|
return { failed: true };
|
|
5197
5207
|
}
|
|
5198
|
-
|
|
5208
|
+
logger25.success("TypeScript validation passed");
|
|
5199
5209
|
}
|
|
5200
5210
|
if (!options.skipBuild) {
|
|
5201
5211
|
try {
|
|
5202
|
-
|
|
5212
|
+
logger25.info(`Building ${isPlugin2 ? "plugin" : "project"}...`);
|
|
5203
5213
|
await buildProject(cwd, isPlugin2);
|
|
5204
|
-
|
|
5214
|
+
logger25.success(`Build completed successfully`);
|
|
5205
5215
|
} catch (buildError) {
|
|
5206
|
-
|
|
5216
|
+
logger25.error(`Build failed: ${buildError}`);
|
|
5207
5217
|
return { failed: true };
|
|
5208
5218
|
}
|
|
5209
5219
|
}
|
|
5210
|
-
|
|
5220
|
+
logger25.info("Running component tests...");
|
|
5211
5221
|
const args = ["test", "--passWithNoTests"];
|
|
5212
5222
|
if (options.name) {
|
|
5213
5223
|
const baseName = processFilterName(options.name);
|
|
5214
5224
|
if (baseName) {
|
|
5215
|
-
|
|
5225
|
+
logger25.info(`Using test filter: ${baseName}`);
|
|
5216
5226
|
args.push("-t", baseName);
|
|
5217
5227
|
}
|
|
5218
5228
|
}
|
|
5219
5229
|
const monorepoRoot = UserEnvironment.getInstance().findMonorepoRoot(process.cwd());
|
|
5220
5230
|
const baseDir = monorepoRoot ?? process.cwd();
|
|
5221
5231
|
const targetPath = testPath ? path28.resolve(baseDir, testPath) : process.cwd();
|
|
5222
|
-
|
|
5232
|
+
logger25.info(`Executing: bun ${args.join(" ")} in ${targetPath}`);
|
|
5223
5233
|
try {
|
|
5224
5234
|
const result = await bunExecInherit("bun", args, {
|
|
5225
5235
|
cwd: targetPath,
|
|
@@ -5230,16 +5240,16 @@ async function runComponentTests(testPath, options, projectInfo) {
|
|
|
5230
5240
|
// Override CI to empty string (some tools check existence, but most check truthiness)
|
|
5231
5241
|
}
|
|
5232
5242
|
});
|
|
5233
|
-
|
|
5243
|
+
logger25.info("Component tests completed");
|
|
5234
5244
|
return { failed: !result.success };
|
|
5235
5245
|
} catch (error) {
|
|
5236
|
-
|
|
5246
|
+
logger25.error({ error }, "Error running component tests:");
|
|
5237
5247
|
return { failed: true };
|
|
5238
5248
|
}
|
|
5239
5249
|
}
|
|
5240
5250
|
|
|
5241
5251
|
// src/commands/test/actions/e2e-tests.ts
|
|
5242
|
-
import { logger as
|
|
5252
|
+
import { logger as logger26 } from "@elizaos/core";
|
|
5243
5253
|
import * as dotenv2 from "dotenv";
|
|
5244
5254
|
import * as fs13 from "fs";
|
|
5245
5255
|
import path29 from "path";
|
|
@@ -5248,12 +5258,12 @@ async function runE2eTests(testPath, options, projectInfo) {
|
|
|
5248
5258
|
try {
|
|
5249
5259
|
const cwd = process.cwd();
|
|
5250
5260
|
const isPlugin2 = projectInfo.type === "elizaos-plugin";
|
|
5251
|
-
|
|
5261
|
+
logger26.info(`Building ${isPlugin2 ? "plugin" : "project"}...`);
|
|
5252
5262
|
await buildProject(cwd, isPlugin2);
|
|
5253
|
-
|
|
5263
|
+
logger26.info(`Build completed successfully`);
|
|
5254
5264
|
} catch (buildError) {
|
|
5255
|
-
|
|
5256
|
-
|
|
5265
|
+
logger26.error(`Build error: ${buildError}`);
|
|
5266
|
+
logger26.warn(`Attempting to continue with tests despite build error`);
|
|
5257
5267
|
}
|
|
5258
5268
|
}
|
|
5259
5269
|
let server;
|
|
@@ -5290,33 +5300,33 @@ async function runE2eTests(testPath, options, projectInfo) {
|
|
|
5290
5300
|
process.env.PGLITE_DATA_DIR = elizaDbDir;
|
|
5291
5301
|
console.info(`Set PGLITE_DATA_DIR to: ${elizaDbDir}`);
|
|
5292
5302
|
if (fs13.existsSync(envFilePath)) {
|
|
5293
|
-
|
|
5303
|
+
logger26.info(`Loading environment variables from: ${envFilePath}`);
|
|
5294
5304
|
dotenv2.config({ path: envFilePath });
|
|
5295
|
-
|
|
5305
|
+
logger26.info("Environment variables loaded");
|
|
5296
5306
|
} else {
|
|
5297
|
-
|
|
5307
|
+
logger26.warn(`Environment file not found: ${envFilePath}`);
|
|
5298
5308
|
}
|
|
5299
5309
|
const postgresUrl = process.env.POSTGRES_URL;
|
|
5300
|
-
|
|
5310
|
+
logger26.info(
|
|
5301
5311
|
`PostgreSQL URL for e2e tests: ${postgresUrl ? "found" : "not found (will use PGlite)"}`
|
|
5302
5312
|
);
|
|
5303
|
-
|
|
5313
|
+
logger26.info("Creating server instance...");
|
|
5304
5314
|
server = new AgentServer();
|
|
5305
|
-
|
|
5306
|
-
|
|
5315
|
+
logger26.info("Server instance created");
|
|
5316
|
+
logger26.info("Initializing server...");
|
|
5307
5317
|
try {
|
|
5308
5318
|
await server.initialize({
|
|
5309
5319
|
dataDir: elizaDbDir,
|
|
5310
5320
|
postgresUrl
|
|
5311
5321
|
});
|
|
5312
|
-
|
|
5322
|
+
logger26.info("Server initialized successfully");
|
|
5313
5323
|
} catch (initError) {
|
|
5314
|
-
|
|
5324
|
+
logger26.error({ error: initError }, "Server initialization failed:");
|
|
5315
5325
|
throw initError;
|
|
5316
5326
|
}
|
|
5317
5327
|
let project;
|
|
5318
5328
|
try {
|
|
5319
|
-
|
|
5329
|
+
logger26.info("Attempting to load project or plugin...");
|
|
5320
5330
|
const monorepoRoot = UserEnvironment.getInstance().findMonorepoRoot(process.cwd());
|
|
5321
5331
|
const baseDir = monorepoRoot ?? process.cwd();
|
|
5322
5332
|
const targetPath = testPath ? path29.resolve(baseDir, testPath) : process.cwd();
|
|
@@ -5324,39 +5334,39 @@ async function runE2eTests(testPath, options, projectInfo) {
|
|
|
5324
5334
|
if (!project || !project.agents || project.agents.length === 0) {
|
|
5325
5335
|
throw new Error("No agents found in project configuration");
|
|
5326
5336
|
}
|
|
5327
|
-
|
|
5328
|
-
|
|
5337
|
+
logger26.info(`Found ${project.agents.length} agents`);
|
|
5338
|
+
logger26.info("Setting up server properties...");
|
|
5329
5339
|
server.startAgent = async (character) => {
|
|
5330
|
-
|
|
5340
|
+
logger26.info(`Starting agent for character ${character.name}`);
|
|
5331
5341
|
return startAgent(character, server, void 0, [], { isTestMode: true });
|
|
5332
5342
|
};
|
|
5333
5343
|
server.loadCharacterTryPath = loadCharacterTryPath;
|
|
5334
5344
|
server.jsonToCharacter = jsonToCharacter;
|
|
5335
|
-
|
|
5345
|
+
logger26.info("Server properties set up");
|
|
5336
5346
|
const desiredPort = options.port || Number.parseInt(process.env.SERVER_PORT || "3000");
|
|
5337
5347
|
const serverPort = await findNextAvailablePort(desiredPort);
|
|
5338
5348
|
if (serverPort !== desiredPort) {
|
|
5339
|
-
|
|
5349
|
+
logger26.warn(`Port ${desiredPort} is in use for testing, using port ${serverPort} instead.`);
|
|
5340
5350
|
}
|
|
5341
|
-
|
|
5351
|
+
logger26.info("Starting server...");
|
|
5342
5352
|
try {
|
|
5343
5353
|
await server.start(serverPort);
|
|
5344
|
-
|
|
5354
|
+
logger26.info({ serverPort }, "Server started successfully on port");
|
|
5345
5355
|
} catch (error) {
|
|
5346
|
-
|
|
5356
|
+
logger26.error({ error }, "Error starting server:");
|
|
5347
5357
|
if (error instanceof Error) {
|
|
5348
|
-
|
|
5349
|
-
|
|
5358
|
+
logger26.error({ message: error.message }, "Error details:");
|
|
5359
|
+
logger26.error({ stack: error.stack }, "Stack trace:");
|
|
5350
5360
|
}
|
|
5351
5361
|
throw error;
|
|
5352
5362
|
}
|
|
5353
5363
|
try {
|
|
5354
|
-
|
|
5364
|
+
logger26.info(
|
|
5355
5365
|
`Found ${project.agents.length} agents in ${project.isPlugin ? "plugin" : "project"}`
|
|
5356
5366
|
);
|
|
5357
5367
|
if (project.isPlugin || project.agents.length === 0) {
|
|
5358
5368
|
process.env.ELIZA_TESTING_PLUGIN = "true";
|
|
5359
|
-
|
|
5369
|
+
logger26.info("Using default Eliza character as test agent");
|
|
5360
5370
|
try {
|
|
5361
5371
|
const pluginUnderTest = project.pluginModule;
|
|
5362
5372
|
if (!pluginUnderTest) {
|
|
@@ -5379,16 +5389,16 @@ async function runE2eTests(testPath, options, projectInfo) {
|
|
|
5379
5389
|
plugins: runtime.plugins
|
|
5380
5390
|
// Pass all plugins, not just the one under test
|
|
5381
5391
|
});
|
|
5382
|
-
|
|
5392
|
+
logger26.info("Default test agent started successfully");
|
|
5383
5393
|
} catch (pluginError) {
|
|
5384
|
-
|
|
5394
|
+
logger26.error({ error: pluginError }, `Error starting plugin test agent:`);
|
|
5385
5395
|
throw pluginError;
|
|
5386
5396
|
}
|
|
5387
5397
|
} else {
|
|
5388
5398
|
for (const agent2 of project.agents) {
|
|
5389
5399
|
try {
|
|
5390
5400
|
const originalCharacter = { ...agent2.character };
|
|
5391
|
-
|
|
5401
|
+
logger26.debug(`Starting agent: ${originalCharacter.name}`);
|
|
5392
5402
|
const runtime = await startAgent(
|
|
5393
5403
|
originalCharacter,
|
|
5394
5404
|
server,
|
|
@@ -5401,31 +5411,31 @@ async function runE2eTests(testPath, options, projectInfo) {
|
|
|
5401
5411
|
projectAgents.push(agent2);
|
|
5402
5412
|
await new Promise((resolve2) => setTimeout(resolve2, 1e3));
|
|
5403
5413
|
} catch (agentError) {
|
|
5404
|
-
|
|
5414
|
+
logger26.error(
|
|
5405
5415
|
{ error: agentError, agentName: agent2.character.name },
|
|
5406
5416
|
"Error starting agent"
|
|
5407
5417
|
);
|
|
5408
5418
|
if (agentError instanceof Error) {
|
|
5409
|
-
|
|
5410
|
-
|
|
5419
|
+
logger26.error({ message: agentError.message }, "Error details:");
|
|
5420
|
+
logger26.error({ stack: agentError.stack }, "Stack trace:");
|
|
5411
5421
|
}
|
|
5412
|
-
|
|
5422
|
+
logger26.warn(`Skipping agent ${agent2.character.name} due to startup error`);
|
|
5413
5423
|
}
|
|
5414
5424
|
}
|
|
5415
5425
|
}
|
|
5416
5426
|
if (runtimes.length === 0) {
|
|
5417
5427
|
throw new Error("Failed to start any agents from project");
|
|
5418
5428
|
}
|
|
5419
|
-
|
|
5429
|
+
logger26.debug(`Successfully started ${runtimes.length} agents for testing`);
|
|
5420
5430
|
let totalFailed = 0;
|
|
5421
5431
|
let anyTestsFound = false;
|
|
5422
5432
|
for (let i = 0; i < runtimes.length; i++) {
|
|
5423
5433
|
const runtime = runtimes[i];
|
|
5424
5434
|
const projectAgent = projectAgents[i];
|
|
5425
5435
|
if (project.isPlugin) {
|
|
5426
|
-
|
|
5436
|
+
logger26.debug(`Running tests for plugin: ${project.pluginModule?.name}`);
|
|
5427
5437
|
} else {
|
|
5428
|
-
|
|
5438
|
+
logger26.debug(`Running tests for agent: ${runtime.character.name}`);
|
|
5429
5439
|
}
|
|
5430
5440
|
const testRunner = new TestRunner(runtime, projectAgent);
|
|
5431
5441
|
const currentDirInfo = projectInfo;
|
|
@@ -5446,17 +5456,17 @@ async function runE2eTests(testPath, options, projectInfo) {
|
|
|
5446
5456
|
}
|
|
5447
5457
|
return { failed: anyTestsFound ? totalFailed > 0 : false };
|
|
5448
5458
|
} catch (error) {
|
|
5449
|
-
|
|
5459
|
+
logger26.error({ error }, "Error in runE2eTests:");
|
|
5450
5460
|
if (error instanceof Error) {
|
|
5451
|
-
|
|
5452
|
-
|
|
5461
|
+
logger26.error({ message: error.message }, "Error details:");
|
|
5462
|
+
logger26.error({ stack: error.stack }, "Stack trace:");
|
|
5453
5463
|
} else {
|
|
5454
|
-
|
|
5455
|
-
|
|
5464
|
+
logger26.error({ type: typeof error }, "Unknown error type:");
|
|
5465
|
+
logger26.error({ error }, "Error value:");
|
|
5456
5466
|
try {
|
|
5457
|
-
|
|
5467
|
+
logger26.error({ stringified: JSON.stringify(error, null, 2) }, "Stringified error:");
|
|
5458
5468
|
} catch (e) {
|
|
5459
|
-
|
|
5469
|
+
logger26.error({ error: e }, "Could not stringify error:");
|
|
5460
5470
|
}
|
|
5461
5471
|
}
|
|
5462
5472
|
return { failed: true };
|
|
@@ -5479,33 +5489,33 @@ async function runE2eTests(testPath, options, projectInfo) {
|
|
|
5479
5489
|
}
|
|
5480
5490
|
}
|
|
5481
5491
|
} catch (error) {
|
|
5482
|
-
|
|
5492
|
+
logger26.error({ error }, "Error in runE2eTests:");
|
|
5483
5493
|
if (error instanceof Error) {
|
|
5484
|
-
|
|
5485
|
-
|
|
5494
|
+
logger26.error({ message: error.message }, "Error details:");
|
|
5495
|
+
logger26.error({ stack: error.stack }, "Stack trace:");
|
|
5486
5496
|
} else {
|
|
5487
|
-
|
|
5488
|
-
|
|
5497
|
+
logger26.error({ type: typeof error }, "Unknown error type:");
|
|
5498
|
+
logger26.error({ error }, "Error value:");
|
|
5489
5499
|
try {
|
|
5490
|
-
|
|
5500
|
+
logger26.error({ stringified: JSON.stringify(error, null, 2) }, "Stringified error:");
|
|
5491
5501
|
} catch (e) {
|
|
5492
|
-
|
|
5502
|
+
logger26.error({ error: e }, "Could not stringify error:");
|
|
5493
5503
|
}
|
|
5494
5504
|
}
|
|
5495
5505
|
return { failed: true };
|
|
5496
5506
|
}
|
|
5497
5507
|
} catch (error) {
|
|
5498
|
-
|
|
5508
|
+
logger26.error({ error }, "Error in runE2eTests:");
|
|
5499
5509
|
if (error instanceof Error) {
|
|
5500
|
-
|
|
5501
|
-
|
|
5510
|
+
logger26.error({ message: error.message }, "Error details:");
|
|
5511
|
+
logger26.error({ stack: error.stack }, "Stack trace:");
|
|
5502
5512
|
} else {
|
|
5503
|
-
|
|
5504
|
-
|
|
5513
|
+
logger26.error({ type: typeof error }, "Unknown error type:");
|
|
5514
|
+
logger26.error({ error }, "Error value:");
|
|
5505
5515
|
try {
|
|
5506
|
-
|
|
5516
|
+
logger26.error({ stringified: JSON.stringify(error, null, 2) }, "Stringified error:");
|
|
5507
5517
|
} catch (e) {
|
|
5508
|
-
|
|
5518
|
+
logger26.error({ error: e }, "Could not stringify error:");
|
|
5509
5519
|
}
|
|
5510
5520
|
}
|
|
5511
5521
|
return { failed: true };
|
|
@@ -5519,20 +5529,20 @@ async function runAllTests(testPath, options) {
|
|
|
5519
5529
|
if (!options.skipBuild) {
|
|
5520
5530
|
componentResult = await runComponentTests(testPath, options, projectInfo);
|
|
5521
5531
|
} else {
|
|
5522
|
-
|
|
5532
|
+
logger27.info("Skipping component tests due to --skip-build option");
|
|
5523
5533
|
}
|
|
5524
5534
|
const e2eResult = await runE2eTests(testPath, options, projectInfo);
|
|
5525
5535
|
if (componentResult.failed || e2eResult.failed) {
|
|
5526
5536
|
if (componentResult.failed) {
|
|
5527
|
-
|
|
5537
|
+
logger27.error("Component tests failed.");
|
|
5528
5538
|
}
|
|
5529
5539
|
if (e2eResult.failed) {
|
|
5530
|
-
|
|
5540
|
+
logger27.error("E2E tests failed.");
|
|
5531
5541
|
}
|
|
5532
|
-
|
|
5542
|
+
logger27.error("Test suite failed.");
|
|
5533
5543
|
process.exit(1);
|
|
5534
5544
|
}
|
|
5535
|
-
|
|
5545
|
+
logger27.success("All tests passed successfully!");
|
|
5536
5546
|
process.exit(0);
|
|
5537
5547
|
}
|
|
5538
5548
|
|
|
@@ -5540,7 +5550,7 @@ async function runAllTests(testPath, options) {
|
|
|
5540
5550
|
import * as net from "net";
|
|
5541
5551
|
|
|
5542
5552
|
// src/commands/test/utils/plugin-utils.ts
|
|
5543
|
-
import { logger as
|
|
5553
|
+
import { logger as logger28 } from "@elizaos/core";
|
|
5544
5554
|
import * as fs14 from "fs";
|
|
5545
5555
|
import path30 from "path";
|
|
5546
5556
|
|
|
@@ -5556,31 +5566,31 @@ var test = new Command10().name("test").description("Run tests for the current p
|
|
|
5556
5566
|
const projectInfo = getProjectType(testPath);
|
|
5557
5567
|
await installPluginDependencies(projectInfo);
|
|
5558
5568
|
}).action(async (testPath, options) => {
|
|
5559
|
-
|
|
5569
|
+
logger29.info("Starting tests...");
|
|
5560
5570
|
try {
|
|
5561
5571
|
const projectInfo = getProjectType(testPath);
|
|
5562
5572
|
switch (options.type) {
|
|
5563
5573
|
case "component":
|
|
5564
|
-
|
|
5574
|
+
logger29.info("Running component tests only...");
|
|
5565
5575
|
const componentResult = await runComponentTests(testPath, options, projectInfo);
|
|
5566
5576
|
if (componentResult.failed) {
|
|
5567
|
-
|
|
5577
|
+
logger29.error("Component tests failed.");
|
|
5568
5578
|
process.exit(1);
|
|
5569
5579
|
}
|
|
5570
|
-
|
|
5580
|
+
logger29.success("Component tests passed successfully!");
|
|
5571
5581
|
break;
|
|
5572
5582
|
case "e2e":
|
|
5573
|
-
|
|
5583
|
+
logger29.info("Running e2e tests only...");
|
|
5574
5584
|
const e2eResult = await runE2eTests(testPath, options, projectInfo);
|
|
5575
5585
|
if (e2eResult.failed) {
|
|
5576
|
-
|
|
5586
|
+
logger29.error("E2E tests failed.");
|
|
5577
5587
|
process.exit(1);
|
|
5578
5588
|
}
|
|
5579
|
-
|
|
5589
|
+
logger29.success("E2E tests passed successfully!");
|
|
5580
5590
|
break;
|
|
5581
5591
|
case "all":
|
|
5582
5592
|
default:
|
|
5583
|
-
|
|
5593
|
+
logger29.info("Running all tests...");
|
|
5584
5594
|
await runAllTests(testPath, options);
|
|
5585
5595
|
break;
|
|
5586
5596
|
}
|
|
@@ -5591,7 +5601,7 @@ var test = new Command10().name("test").description("Run tests for the current p
|
|
|
5591
5601
|
});
|
|
5592
5602
|
|
|
5593
5603
|
// src/index.ts
|
|
5594
|
-
import { logger as
|
|
5604
|
+
import { logger as logger30 } from "@elizaos/core";
|
|
5595
5605
|
import { Command as Command11 } from "commander";
|
|
5596
5606
|
process.env.NODE_OPTIONS = "--no-deprecation";
|
|
5597
5607
|
process.env.NODE_NO_WARNINGS = "1";
|
|
@@ -5612,19 +5622,19 @@ var shutdownState = {
|
|
|
5612
5622
|
};
|
|
5613
5623
|
async function gracefulShutdown(signal) {
|
|
5614
5624
|
if (!shutdownState.tryInitiateShutdown()) {
|
|
5615
|
-
|
|
5625
|
+
logger30.debug(`Ignoring ${signal} - shutdown already in progress`);
|
|
5616
5626
|
return;
|
|
5617
5627
|
}
|
|
5618
|
-
|
|
5628
|
+
logger30.info(`Received ${signal}, shutting down gracefully...`);
|
|
5619
5629
|
try {
|
|
5620
5630
|
const serverWasStopped = await stopServer();
|
|
5621
5631
|
if (serverWasStopped) {
|
|
5622
|
-
|
|
5632
|
+
logger30.info("Server stopped successfully");
|
|
5623
5633
|
}
|
|
5624
5634
|
} catch (error) {
|
|
5625
5635
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
5626
|
-
|
|
5627
|
-
|
|
5636
|
+
logger30.error(`Error stopping server: ${errorMessage}`);
|
|
5637
|
+
logger30.debug({ error }, "Full error details:");
|
|
5628
5638
|
}
|
|
5629
5639
|
const exitCode = signal === "SIGINT" ? 130 : signal === "SIGTERM" ? 143 : 0;
|
|
5630
5640
|
process.exit(exitCode);
|
|
@@ -5658,6 +5668,6 @@ async function main() {
|
|
|
5658
5668
|
await program.parseAsync();
|
|
5659
5669
|
}
|
|
5660
5670
|
main().catch((error) => {
|
|
5661
|
-
|
|
5671
|
+
logger30.error({ error }, "An error occurred:");
|
|
5662
5672
|
process.exit(1);
|
|
5663
5673
|
});
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"tsup.config.ts"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@elizaos/core": "1.4.
|
|
44
|
+
"@elizaos/core": "1.4.4",
|
|
45
45
|
"zod": "^3.24.4"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@elizaos/cli": "1.4.
|
|
48
|
+
"@elizaos/cli": "1.4.4",
|
|
49
49
|
"dotenv": "16.4.5",
|
|
50
50
|
"prettier": "3.5.3",
|
|
51
51
|
"tsup": "8.5.0",
|
|
@@ -139,6 +139,7 @@ export function createMockRuntime(overrides: Partial<IAgentRuntime> = {}): IAgen
|
|
|
139
139
|
getMemoriesByRoomIds: mock().mockResolvedValue([]),
|
|
140
140
|
searchMemories: mock().mockResolvedValue([]),
|
|
141
141
|
addEmbeddingToMemory: mock().mockImplementation(async (memory: Memory) => memory),
|
|
142
|
+
queueEmbeddingGeneration: mock().mockResolvedValue(undefined),
|
|
142
143
|
getAllMemories: mock().mockResolvedValue([]),
|
|
143
144
|
clearAllAgentMemories: mock().mockResolvedValue(undefined),
|
|
144
145
|
updateMemory: mock().mockResolvedValue(true),
|