@elizaos/cli 1.6.5 → 1.7.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/dist/commands/agent/actions/lifecycle.d.ts.map +1 -1
  2. package/dist/commands/create/actions/creators.d.ts.map +1 -1
  3. package/dist/commands/create/utils/validation.d.ts +1 -1
  4. package/dist/commands/create/utils/validation.d.ts.map +1 -1
  5. package/dist/commands/deploy/types.d.ts +1 -1
  6. package/dist/commands/deploy/types.d.ts.map +1 -1
  7. package/dist/commands/dev/actions/dev-server.d.ts.map +1 -1
  8. package/dist/commands/publish/types.d.ts +1 -1
  9. package/dist/commands/publish/types.d.ts.map +1 -1
  10. package/dist/commands/report/generate.d.ts.map +1 -1
  11. package/dist/commands/report/src/analysis-engine.d.ts.map +1 -1
  12. package/dist/commands/scenario/index.d.ts.map +1 -1
  13. package/dist/commands/scenario/src/ConversationEvaluators.d.ts +4 -16
  14. package/dist/commands/scenario/src/ConversationEvaluators.d.ts.map +1 -1
  15. package/dist/commands/scenario/src/ConversationManager.d.ts +2 -2
  16. package/dist/commands/scenario/src/ConversationManager.d.ts.map +1 -1
  17. package/dist/commands/scenario/src/EnhancedEvaluationEngine.d.ts +3 -3
  18. package/dist/commands/scenario/src/EnhancedEvaluationEngine.d.ts.map +1 -1
  19. package/dist/commands/scenario/src/EvaluationEngine.d.ts +4 -4
  20. package/dist/commands/scenario/src/EvaluationEngine.d.ts.map +1 -1
  21. package/dist/commands/scenario/src/LocalEnvironmentProvider.d.ts +2 -2
  22. package/dist/commands/scenario/src/LocalEnvironmentProvider.d.ts.map +1 -1
  23. package/dist/commands/scenario/src/MockEngine.d.ts +2 -2
  24. package/dist/commands/scenario/src/MockEngine.d.ts.map +1 -1
  25. package/dist/commands/scenario/src/TrajectoryReconstructor.d.ts +4 -4
  26. package/dist/commands/scenario/src/TrajectoryReconstructor.d.ts.map +1 -1
  27. package/dist/commands/scenario/src/UserSimulator.d.ts +2 -2
  28. package/dist/commands/scenario/src/UserSimulator.d.ts.map +1 -1
  29. package/dist/commands/scenario/src/conversation-types.d.ts +8 -2
  30. package/dist/commands/scenario/src/conversation-types.d.ts.map +1 -1
  31. package/dist/commands/scenario/src/data-aggregator.d.ts +2 -2
  32. package/dist/commands/scenario/src/data-aggregator.d.ts.map +1 -1
  33. package/dist/commands/scenario/src/deep-clone.d.ts +2 -2
  34. package/dist/commands/scenario/src/deep-clone.d.ts.map +1 -1
  35. package/dist/commands/scenario/src/matrix-orchestrator.d.ts.map +1 -1
  36. package/dist/commands/scenario/src/matrix-runner.d.ts +2 -1
  37. package/dist/commands/scenario/src/matrix-runner.d.ts.map +1 -1
  38. package/dist/commands/scenario/src/matrix-schema.d.ts +3 -3
  39. package/dist/commands/scenario/src/matrix-schema.d.ts.map +1 -1
  40. package/dist/commands/scenario/src/matrix-types.d.ts +7 -3
  41. package/dist/commands/scenario/src/matrix-types.d.ts.map +1 -1
  42. package/dist/commands/scenario/src/parameter-override.d.ts +15 -15
  43. package/dist/commands/scenario/src/parameter-override.d.ts.map +1 -1
  44. package/dist/commands/scenario/src/plugin-parser.d.ts +1 -1
  45. package/dist/commands/scenario/src/plugin-parser.d.ts.map +1 -1
  46. package/dist/commands/scenario/src/progress-tracker.d.ts +4 -4
  47. package/dist/commands/scenario/src/progress-tracker.d.ts.map +1 -1
  48. package/dist/commands/scenario/src/resource-monitor.d.ts.map +1 -1
  49. package/dist/commands/scenario/src/run-isolation.d.ts +6 -2
  50. package/dist/commands/scenario/src/run-isolation.d.ts.map +1 -1
  51. package/dist/commands/scenario/src/runtime-factory.d.ts +1 -1
  52. package/dist/commands/scenario/src/runtime-factory.d.ts.map +1 -1
  53. package/dist/commands/scenario/src/schema.d.ts +6 -7
  54. package/dist/commands/scenario/src/schema.d.ts.map +1 -1
  55. package/dist/commands/shared/types.d.ts +2 -2
  56. package/dist/commands/shared/types.d.ts.map +1 -1
  57. package/dist/commands/tee/phala-wrapper.d.ts.map +1 -1
  58. package/dist/commands/test/actions/e2e-tests.d.ts.map +1 -1
  59. package/dist/index.js +713 -1052
  60. package/dist/index.js.map +53 -54
  61. package/dist/project.d.ts.map +1 -1
  62. package/dist/services/env-file.service.d.ts.map +1 -1
  63. package/dist/templates/plugin-quick-starter/package.json +2 -2
  64. package/dist/templates/plugin-quick-starter/src/__tests__/plugin.test.ts +2 -1
  65. package/dist/templates/plugin-quick-starter/src/__tests__/test-utils.ts +1 -0
  66. package/dist/templates/plugin-quick-starter/src/plugin.ts +8 -10
  67. package/dist/templates/plugin-starter/package.json +2 -2
  68. package/dist/templates/plugin-starter/src/__tests__/integration.test.ts +3 -3
  69. package/dist/templates/plugin-starter/src/__tests__/test-utils.ts +1 -0
  70. package/dist/templates/plugin-starter/src/frontend/index.tsx +4 -1
  71. package/dist/templates/plugin-starter/src/plugin.ts +4 -2
  72. package/dist/templates/project-starter/package.json +6 -6
  73. package/dist/templates/project-starter/src/__tests__/error-handling.test.ts +7 -6
  74. package/dist/templates/project-starter/src/__tests__/integration.test.ts +1 -1
  75. package/dist/templates/project-starter/src/__tests__/provider.test.ts +2 -2
  76. package/dist/templates/project-starter/src/__tests__/test-utils.ts +1 -1
  77. package/dist/templates/project-starter/src/__tests__/utils/core-test-utils.ts +1 -0
  78. package/dist/templates/project-starter/src/plugin.ts +3 -1
  79. package/dist/templates/project-tee-starter/package.json +4 -4
  80. package/dist/templates/project-tee-starter/src/__tests__/integration.test.ts +1 -1
  81. package/dist/templates/project-tee-starter/src/__tests__/provider.test.ts +1 -1
  82. package/dist/templates/project-tee-starter/src/__tests__/test-utils.ts +1 -1
  83. package/dist/templates/project-tee-starter/src/__tests__/utils/core-test-utils.ts +1 -0
  84. package/dist/templates/project-tee-starter/src/frontend/panels.tsx +4 -3
  85. package/dist/utils/build-project.d.ts.map +1 -1
  86. package/dist/utils/config-manager.d.ts +1 -1
  87. package/dist/utils/config-manager.d.ts.map +1 -1
  88. package/dist/utils/copy-template.d.ts.map +1 -1
  89. package/dist/utils/get-config.d.ts.map +1 -1
  90. package/dist/utils/github.d.ts +5 -1
  91. package/dist/utils/github.d.ts.map +1 -1
  92. package/dist/utils/load-plugin.d.ts +1 -1
  93. package/dist/utils/load-plugin.d.ts.map +1 -1
  94. package/dist/utils/package-manager.d.ts.map +1 -1
  95. package/dist/utils/plugin-context.d.ts +4 -1
  96. package/dist/utils/plugin-context.d.ts.map +1 -1
  97. package/dist/utils/registry/index.d.ts.map +1 -1
  98. package/dist/utils/run-bun.d.ts.map +1 -1
  99. package/dist/utils/spinner-utils.d.ts +2 -2
  100. package/dist/utils/spinner-utils.d.ts.map +1 -1
  101. package/dist/utils/test-runner.d.ts.map +1 -1
  102. package/dist/utils/testing/tsc-validator.d.ts.map +1 -1
  103. package/dist/version.d.ts +2 -2
  104. package/dist/version.d.ts.map +1 -1
  105. package/dist/version.js +2 -2
  106. package/package.json +8 -8
  107. package/templates/plugin-quick-starter/package.json +2 -2
  108. package/templates/plugin-quick-starter/src/__tests__/plugin.test.ts +2 -1
  109. package/templates/plugin-quick-starter/src/__tests__/test-utils.ts +1 -0
  110. package/templates/plugin-quick-starter/src/plugin.ts +8 -10
  111. package/templates/plugin-starter/package.json +2 -2
  112. package/templates/plugin-starter/src/__tests__/integration.test.ts +3 -3
  113. package/templates/plugin-starter/src/__tests__/test-utils.ts +1 -0
  114. package/templates/plugin-starter/src/frontend/index.tsx +4 -1
  115. package/templates/plugin-starter/src/plugin.ts +4 -2
  116. package/templates/project-starter/package.json +6 -6
  117. package/templates/project-starter/src/__tests__/error-handling.test.ts +7 -6
  118. package/templates/project-starter/src/__tests__/integration.test.ts +1 -1
  119. package/templates/project-starter/src/__tests__/provider.test.ts +2 -2
  120. package/templates/project-starter/src/__tests__/test-utils.ts +1 -1
  121. package/templates/project-starter/src/__tests__/utils/core-test-utils.ts +1 -0
  122. package/templates/project-starter/src/plugin.ts +3 -1
  123. package/templates/project-tee-starter/package.json +4 -4
  124. package/templates/project-tee-starter/src/__tests__/integration.test.ts +1 -1
  125. package/templates/project-tee-starter/src/__tests__/provider.test.ts +1 -1
  126. package/templates/project-tee-starter/src/__tests__/test-utils.ts +1 -1
  127. package/templates/project-tee-starter/src/__tests__/utils/core-test-utils.ts +1 -0
  128. package/templates/project-tee-starter/src/frontend/panels.tsx +4 -3
  129. package/dist/commands/scenario/src/E2BEnvironmentProvider.d.ts +0 -18
  130. package/dist/commands/scenario/src/E2BEnvironmentProvider.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -4670,7 +4670,7 @@ __export(exports_version, {
4670
4670
  BUILD_TIME: () => BUILD_TIME,
4671
4671
  BUILD_ENV: () => BUILD_ENV
4672
4672
  });
4673
- var CLI_VERSION = "1.6.5", CLI_NAME = "@elizaos/cli", CLI_DESCRIPTION = "elizaOS CLI - Manage your AI agents and plugins", BUILD_TIME = "2025-12-08T03:27:27.365Z", BUILD_ENV = "production", version_default;
4673
+ var CLI_VERSION = "1.7.0-beta.0", CLI_NAME = "@elizaos/cli", CLI_DESCRIPTION = "elizaOS CLI - Manage your AI agents and plugins", BUILD_TIME = "2025-12-20T05:11:06.325Z", BUILD_ENV = "production", version_default;
4674
4674
  var init_version = __esm(() => {
4675
4675
  version_default = {
4676
4676
  version: CLI_VERSION,
@@ -6155,42 +6155,33 @@ function isQuietMode() {
6155
6155
  }
6156
6156
  async function runCommandWithSpinner(command, args, options) {
6157
6157
  const spinner = Y2();
6158
- try {
6159
- spinner.start(options.spinnerText);
6160
- const result = await bunExec(command, args, {
6161
- cwd: options.cwd || process.cwd()
6162
- });
6163
- if (result.success) {
6164
- spinner.stop(options.successText);
6165
- return {
6166
- success: true,
6167
- stdout: result.stdout,
6168
- stderr: result.stderr
6169
- };
6170
- } else {
6171
- const errorMessage = options.errorText || `Command failed with exit code ${result.exitCode}`;
6172
- spinner.stop(exports_base.red(errorMessage));
6173
- if (options.showOutputOnError !== false) {
6174
- if (result.stdout) {
6175
- console.error(exports_base.dim("stdout:"), result.stdout);
6176
- }
6177
- if (result.stderr) {
6178
- console.error(exports_base.dim("stderr:"), result.stderr);
6179
- }
6158
+ spinner.start(options.spinnerText);
6159
+ const result = await bunExec(command, args, {
6160
+ cwd: options.cwd || process.cwd()
6161
+ });
6162
+ if (result.success) {
6163
+ spinner.stop(options.successText);
6164
+ return {
6165
+ success: true,
6166
+ stdout: result.stdout,
6167
+ stderr: result.stderr
6168
+ };
6169
+ } else {
6170
+ const errorMessage = options.errorText || `Command failed with exit code ${result.exitCode}`;
6171
+ spinner.stop(exports_base.red(errorMessage));
6172
+ if (options.showOutputOnError !== false) {
6173
+ if (result.stdout) {
6174
+ console.error(exports_base.dim("stdout:"), result.stdout);
6175
+ }
6176
+ if (result.stderr) {
6177
+ console.error(exports_base.dim("stderr:"), result.stderr);
6180
6178
  }
6181
- return {
6182
- success: false,
6183
- stdout: result.stdout,
6184
- stderr: result.stderr,
6185
- error: new Error(`${errorMessage}: ${result.stderr || result.stdout}`)
6186
- };
6187
6179
  }
6188
- } catch (error) {
6189
- const errorMessage = options.errorText || "Command execution failed";
6190
- spinner.stop(exports_base.red(errorMessage));
6191
6180
  return {
6192
6181
  success: false,
6193
- error
6182
+ stdout: result.stdout,
6183
+ stderr: result.stderr,
6184
+ error: new Error(`${errorMessage}: ${result.stderr || result.stdout}`)
6194
6185
  };
6195
6186
  }
6196
6187
  }
@@ -6295,38 +6286,30 @@ async function buildProject(cwd = process.cwd(), isPlugin = false) {
6295
6286
  await fs3.promises.rm(distPath, { recursive: true, force: true });
6296
6287
  }
6297
6288
  const projectType = isPlugin ? "plugin" : "project";
6298
- try {
6299
- const packageJson = JSON.parse(fs3.readFileSync(packageJsonPath, "utf8"));
6300
- if (packageJson.scripts?.build) {
6301
- const result = await runBunWithSpinner(["run", "build"], cwd, {
6302
- spinnerText: `Building ${projectType}...`,
6303
- successText: exports_base.green(`\u2713 ${projectType.charAt(0).toUpperCase() + projectType.slice(1)} built successfully`),
6304
- errorText: `Failed to build ${projectType}`
6305
- });
6306
- if (!result.success) {
6307
- throw result.error || new Error(`Failed to build using bun`);
6308
- }
6309
- return;
6289
+ const packageJson = JSON.parse(fs3.readFileSync(packageJsonPath, "utf8"));
6290
+ if (packageJson.scripts?.build) {
6291
+ const result = await runBunWithSpinner(["run", "build"], cwd, {
6292
+ spinnerText: `Building ${projectType}...`,
6293
+ successText: exports_base.green(`\u2713 ${projectType.charAt(0).toUpperCase() + projectType.slice(1)} built successfully`),
6294
+ errorText: `Failed to build ${projectType}`
6295
+ });
6296
+ if (!result.success) {
6297
+ throw result.error || new Error(`Failed to build using bun`);
6310
6298
  }
6311
- const tsconfigPath = path4.join(cwd, "tsconfig.json");
6312
- if (fs3.existsSync(tsconfigPath)) {
6313
- try {
6314
- const result = await bunExec("bunx", ["tsc", "--build"], {
6315
- cwd
6316
- });
6317
- if (result.success) {
6318
- return;
6319
- } else {
6320
- throw new Error(`bunx tsc build failed: ${result.stderr || result.stdout}`);
6321
- }
6322
- } catch (tscError) {
6323
- throw new Error(`bunx tsc build failed: ${tscError}`);
6324
- }
6299
+ return;
6300
+ }
6301
+ const tsconfigPath = path4.join(cwd, "tsconfig.json");
6302
+ if (fs3.existsSync(tsconfigPath)) {
6303
+ const result = await bunExec("bunx", ["tsc", "--build"], {
6304
+ cwd
6305
+ });
6306
+ if (result.success) {
6307
+ return;
6308
+ } else {
6309
+ throw new Error(`bunx tsc build failed: ${result.stderr || result.stdout}`);
6325
6310
  }
6326
- throw new Error("Could not determine how to build the project");
6327
- } catch (error) {
6328
- throw error;
6329
6311
  }
6312
+ throw new Error("Could not determine how to build the project");
6330
6313
  }
6331
6314
  var init_build_project = __esm(() => {
6332
6315
  init_bun_exec();
@@ -6525,22 +6508,14 @@ async function loadConfig() {
6525
6508
  }
6526
6509
  }
6527
6510
  async function saveConfig(config) {
6528
- try {
6529
- const configPath = await getConfigFilePath();
6530
- const elizaDir = path5.dirname(configPath);
6531
- if (!await fileExists(elizaDir)) {
6532
- await fs4.mkdir(elizaDir, { recursive: true });
6533
- }
6534
- config.lastUpdated = new Date().toISOString();
6535
- await fs4.writeFile(configPath, JSON.stringify(config, null, 2), "utf8");
6536
- logger7.info({ src: "cli", util: "config-manager", configPath }, "Configuration saved");
6537
- } catch (error) {
6538
- logger7.error({
6539
- src: "cli",
6540
- util: "config-manager",
6541
- error: error instanceof Error ? error.message : String(error)
6542
- }, "Error saving configuration");
6511
+ const configPath = await getConfigFilePath();
6512
+ const elizaDir = path5.dirname(configPath);
6513
+ if (!await fileExists(elizaDir)) {
6514
+ await fs4.mkdir(elizaDir, { recursive: true });
6543
6515
  }
6516
+ config.lastUpdated = new Date().toISOString();
6517
+ await fs4.writeFile(configPath, JSON.stringify(config, null, 2), "utf8");
6518
+ logger7.info({ src: "cli", util: "config-manager", configPath }, "Configuration saved");
6544
6519
  }
6545
6520
  var init_config_manager = __esm(() => {
6546
6521
  init_user_environment();
@@ -6689,6 +6664,7 @@ ${possibleTemplatePaths.join(`
6689
6664
  util: "copy-template",
6690
6665
  error: error instanceof Error ? error.message : String(error)
6691
6666
  }, "Error updating package.json");
6667
+ throw error;
6692
6668
  }
6693
6669
  logger8.debug({ src: "cli", util: "copy-template", templateType }, "Template copied successfully");
6694
6670
  }
@@ -6965,63 +6941,55 @@ class EnvFileService {
6965
6941
  }
6966
6942
  async read() {
6967
6943
  const result = {};
6968
- try {
6969
- if (!existsSync7(this.filePath)) {
6970
- return result;
6971
- }
6972
- const content = await fs6.readFile(this.filePath, "utf-8");
6973
- const lines = content.split(`
6944
+ if (!existsSync7(this.filePath)) {
6945
+ return result;
6946
+ }
6947
+ const content = await fs6.readFile(this.filePath, "utf-8");
6948
+ const lines = content.split(`
6974
6949
  `);
6975
- for (const line of lines) {
6976
- const trimmedLine = line.trim();
6977
- if (trimmedLine && !trimmedLine.startsWith("#")) {
6978
- const separatorIndex = trimmedLine.indexOf("=");
6979
- if (separatorIndex > 0) {
6980
- const key = trimmedLine.substring(0, separatorIndex).trim();
6981
- const value = trimmedLine.substring(separatorIndex + 1).trim();
6982
- result[key] = value;
6983
- }
6950
+ for (const line of lines) {
6951
+ const trimmedLine = line.trim();
6952
+ if (trimmedLine && !trimmedLine.startsWith("#")) {
6953
+ const separatorIndex = trimmedLine.indexOf("=");
6954
+ if (separatorIndex > 0) {
6955
+ const key = trimmedLine.substring(0, separatorIndex).trim();
6956
+ const value = trimmedLine.substring(separatorIndex + 1).trim();
6957
+ result[key] = value;
6984
6958
  }
6985
6959
  }
6986
- } catch (error) {
6987
- logger9.error(`Error reading environment file: ${error}`);
6988
6960
  }
6989
6961
  return result;
6990
6962
  }
6991
6963
  async readWithComments() {
6992
6964
  const entries = [];
6993
- try {
6994
- if (!existsSync7(this.filePath)) {
6995
- return entries;
6996
- }
6997
- const content = await fs6.readFile(this.filePath, "utf-8");
6998
- const lines = content.split(`
6965
+ if (!existsSync7(this.filePath)) {
6966
+ return entries;
6967
+ }
6968
+ const content = await fs6.readFile(this.filePath, "utf-8");
6969
+ const lines = content.split(`
6999
6970
  `);
7000
- let currentComment;
7001
- for (const line of lines) {
7002
- const trimmedLine = line.trim();
7003
- if (trimmedLine.startsWith("#")) {
7004
- const comment = trimmedLine.substring(1).trim();
7005
- currentComment = currentComment ? `${currentComment}
6971
+ let currentComment;
6972
+ for (const line of lines) {
6973
+ const trimmedLine = line.trim();
6974
+ if (trimmedLine.startsWith("#")) {
6975
+ const comment = trimmedLine.substring(1).trim();
6976
+ currentComment = currentComment ? `${currentComment}
7006
6977
  ${comment}` : comment;
7007
- } else if (trimmedLine && !trimmedLine.startsWith("#")) {
7008
- const separatorIndex = trimmedLine.indexOf("=");
7009
- if (separatorIndex > 0) {
7010
- const key = trimmedLine.substring(0, separatorIndex).trim();
7011
- const value = trimmedLine.substring(separatorIndex + 1).trim();
7012
- entries.push({
7013
- key,
7014
- value,
7015
- comment: currentComment
7016
- });
7017
- currentComment = undefined;
7018
- }
7019
- } else if (!trimmedLine) {
6978
+ } else if (trimmedLine && !trimmedLine.startsWith("#")) {
6979
+ const separatorIndex = trimmedLine.indexOf("=");
6980
+ if (separatorIndex > 0) {
6981
+ const key = trimmedLine.substring(0, separatorIndex).trim();
6982
+ const value = trimmedLine.substring(separatorIndex + 1).trim();
6983
+ entries.push({
6984
+ key,
6985
+ value,
6986
+ comment: currentComment
6987
+ });
7020
6988
  currentComment = undefined;
7021
6989
  }
6990
+ } else if (!trimmedLine) {
6991
+ currentComment = undefined;
7022
6992
  }
7023
- } catch (error) {
7024
- logger9.error(`Error reading environment file with comments: ${error}`);
7025
6993
  }
7026
6994
  return entries;
7027
6995
  }
@@ -25660,9 +25628,7 @@ import { logger as logger12 } from "@elizaos/core";
25660
25628
  import { existsSync as existsSync11, promises as fs8 } from "fs";
25661
25629
  import path12 from "path";
25662
25630
  async function ensureElizaDir2() {
25663
- try {
25664
- await fs8.mkdir(ELIZA_DIR, { recursive: true });
25665
- } catch (error47) {}
25631
+ await fs8.mkdir(ELIZA_DIR, { recursive: true });
25666
25632
  }
25667
25633
  async function getRegistrySettings() {
25668
25634
  await ensureElizaDir2();
@@ -27145,7 +27111,8 @@ async function tryImporting(importPath, strategy, repository) {
27145
27111
  logger16.success({ src: "cli", util: "load-plugin", repository, strategy, path: importPath }, "Plugin loaded");
27146
27112
  return module;
27147
27113
  } catch (error47) {
27148
- logger16.debug({ src: "cli", util: "load-plugin", strategy, path: importPath, error: error47?.message }, "Import failed");
27114
+ const errorMessage = error47 instanceof Error ? error47.message : String(error47);
27115
+ logger16.debug({ src: "cli", util: "load-plugin", strategy, path: importPath, error: errorMessage }, "Import failed");
27149
27116
  return null;
27150
27117
  }
27151
27118
  }
@@ -27377,10 +27344,11 @@ async function runBunCommand(args, cwd, silent = false) {
27377
27344
  throw new Error(`Bun command failed with exit code ${result.exitCode}: ${result.stderr || result.stdout}`);
27378
27345
  }
27379
27346
  } catch (error47) {
27380
- if (error47.code === "ENOENT" || error47.message?.includes("bun: command not found")) {
27347
+ const errorObj = error47;
27348
+ if (errorObj.code === "ENOENT" || errorObj.message?.includes("bun: command not found")) {
27381
27349
  throw new Error(`Bun command not found. ${displayBunInstallationTipCompact()}`);
27382
27350
  }
27383
- if (isCI && isInstallCommand && (error47.message?.includes("frozen-lockfile") || error47.message?.includes("install"))) {
27351
+ if (isCI && isInstallCommand && (errorObj.message?.includes("frozen-lockfile") || errorObj.message?.includes("install"))) {
27384
27352
  console.warn("CI-optimized install failed, retrying with basic args...");
27385
27353
  const retryResult = silent ? await bunExec("bun", args, { cwd }) : await bunExecInherit("bun", args, { cwd });
27386
27354
  if (silent && !retryResult.success) {
@@ -27444,7 +27412,8 @@ async function removeFromBunLock(packageName, directory) {
27444
27412
  }
27445
27413
  }
27446
27414
  } catch (error47) {
27447
- logger18.warn({ src: "cli", util: "package-manager", packageName, error: error47.message }, "Unexpected error removing package from bun.lock");
27415
+ const errorMessage = error47 instanceof Error ? error47.message : String(error47);
27416
+ logger18.warn({ src: "cli", util: "package-manager", packageName, error: errorMessage }, "Unexpected error removing package from bun.lock");
27448
27417
  }
27449
27418
  }
27450
27419
  async function executeInstallation(packageName, versionOrTag = "", directory = process.cwd()) {
@@ -27461,10 +27430,12 @@ async function executeInstallation(packageName, versionOrTag = "", directory = p
27461
27430
  })() : packageName;
27462
27431
  return { success: true, installedIdentifier };
27463
27432
  } catch (error47) {
27464
- if (error47.code === "ENOENT" || error47.message?.includes("bun: command not found")) {
27433
+ const errorObj = error47;
27434
+ if (errorObj.code === "ENOENT" || errorObj.message?.includes("bun: command not found")) {
27465
27435
  logger18.warn({ src: "cli", util: "package-manager" }, "Installation failed - bun command not found");
27466
27436
  } else {
27467
- logger18.warn({ src: "cli", util: "package-manager", finalSpecifier, error: error47.message }, "Installation failed");
27437
+ const errorMessage = error47 instanceof Error ? error47.message : String(error47);
27438
+ logger18.warn({ src: "cli", util: "package-manager", finalSpecifier, error: errorMessage }, "Installation failed");
27468
27439
  }
27469
27440
  return { success: false, installedIdentifier: null };
27470
27441
  }
@@ -30226,14 +30197,19 @@ class TestRunner {
30226
30197
  };
30227
30198
  const testingPlugin = process.env.ELIZA_TESTING_PLUGIN === "true";
30228
30199
  if (testingPlugin && projectAgent?.plugins) {
30229
- const corePlugins = ["@elizaos/plugin-sql"];
30200
+ const corePlugins = ["@elizaos/plugin-sql", "@elizaos/plugin-bootstrap", "bootstrap"];
30201
+ const excludedPlugins = projectAgent.plugins.filter((plugin) => corePlugins.includes(plugin.name));
30230
30202
  const nonCorePlugins = projectAgent.plugins.filter((plugin) => !corePlugins.includes(plugin.name));
30203
+ if (excludedPlugins.length > 0) {
30204
+ safeLogger.debug(`Excluding ${excludedPlugins.length} core plugin(s) from test scope: ${excludedPlugins.map((p2) => p2.name).join(", ")} (these provide infrastructure, not testable features)`);
30205
+ }
30231
30206
  if (nonCorePlugins.length > 0) {
30232
30207
  this.pluginUnderTest = nonCorePlugins[0];
30233
30208
  this.isDirectPluginTest = true;
30234
30209
  safeLogger.debug(`Direct plugin test detected - will only run tests for plugin: ${this.pluginUnderTest.name}`);
30235
30210
  } else {
30236
30211
  this.isDirectPluginTest = false;
30212
+ safeLogger.debug("No non-core plugins found to test - all loaded plugins are infrastructure plugins");
30237
30213
  }
30238
30214
  } else if (projectAgent?.plugins?.length === 1 && (projectAgent.character.name.includes(`Test Agent for ${projectAgent.plugins[0].name}`) || projectAgent.character.name.toLowerCase().includes("test") && projectAgent.character.name.toLowerCase().includes(projectAgent.plugins[0].name.toLowerCase()))) {
30239
30215
  this.pluginUnderTest = projectAgent.plugins[0];
@@ -31534,7 +31510,7 @@ var init_schema = __esm(() => {
31534
31510
  evaluator_type: exports_external.string(),
31535
31511
  success: exports_external.boolean(),
31536
31512
  summary: exports_external.string(),
31537
- details: exports_external.record(exports_external.string(), exports_external.any())
31513
+ details: exports_external.record(exports_external.string(), exports_external.unknown())
31538
31514
  });
31539
31515
  CapabilityCheckSchema = exports_external.object({
31540
31516
  capability: exports_external.string(),
@@ -31723,7 +31699,7 @@ var init_schema = __esm(() => {
31723
31699
  description: exports_external.string(),
31724
31700
  plugins: exports_external.array(PluginReferenceSchema).optional(),
31725
31701
  environment: exports_external.object({
31726
- type: exports_external.enum(["e2b", "local"])
31702
+ type: exports_external.enum(["local"])
31727
31703
  }),
31728
31704
  setup: SetupSchema.optional(),
31729
31705
  run: exports_external.array(RunStepSchema),
@@ -272995,7 +272971,6 @@ import path70 from "path";
272995
272971
  import { createServer } from "net";
272996
272972
  async function findAvailablePort(startPort, endPort, host) {
272997
272973
  const serverHost = host || process.env.SERVER_HOST || "0.0.0.0";
272998
- console.log(`\uD83D\uDD27 [DEBUG] Searching for available port in range ${startPort}-${endPort} on host ${serverHost}...`);
272999
272974
  const ports = Array.from({ length: endPort - startPort + 1 }, (_4, i3) => startPort + i3);
273000
272975
  for (let i3 = ports.length - 1;i3 > 0; i3--) {
273001
272976
  const j2 = Math.floor(Math.random() * (i3 + 1));
@@ -273003,7 +272978,6 @@ async function findAvailablePort(startPort, endPort, host) {
273003
272978
  }
273004
272979
  for (const port of ports) {
273005
272980
  try {
273006
- console.log(`\uD83D\uDD27 [DEBUG] Testing port ${port} on host ${serverHost}...`);
273007
272981
  const server2 = createServer();
273008
272982
  await new Promise((resolve14, reject) => {
273009
272983
  const timeout2 = setTimeout(() => {
@@ -273020,10 +272994,8 @@ async function findAvailablePort(startPort, endPort, host) {
273020
272994
  reject(err);
273021
272995
  });
273022
272996
  });
273023
- console.log(`\uD83D\uDD27 [DEBUG] Port ${port} is available`);
273024
272997
  return port;
273025
- } catch (error47) {
273026
- console.log(`\uD83D\uDD27 [DEBUG] Port ${port} is in use: ${error47}`);
272998
+ } catch {
273027
272999
  continue;
273028
273000
  }
273029
273001
  }
@@ -273034,9 +273006,7 @@ async function createScenarioServer(existingServer = null, desiredPort = 3000) {
273034
273006
  let createdServer = false;
273035
273007
  let port = desiredPort;
273036
273008
  if (port === 0) {
273037
- console.log("\uD83D\uDD27 [DEBUG] Finding available port in range 3001-4000...");
273038
273009
  port = await findAvailablePort(3001, 4000);
273039
- console.log(`\uD83D\uDD27 [DEBUG] Found available port: ${port}`);
273040
273010
  }
273041
273011
  let retryCount = 0;
273042
273012
  const maxRetries = 3;
@@ -273055,21 +273025,16 @@ async function createScenarioServer(existingServer = null, desiredPort = 3000) {
273055
273025
  await server2.start({ port, dataDir: uniqueDataDir });
273056
273026
  createdServer = true;
273057
273027
  process.env.SERVER_PORT = port.toString();
273058
- console.log(`\uD83D\uDD27 [DEBUG] Set SERVER_PORT environment variable to ${port}`);
273059
- const serverPid = server2.server?.pid || process.pid;
273060
273028
  const runId = `agent-server-${port}`;
273061
- processManager.registerProcess(runId, serverPid, "agent-server", port);
273062
- console.log(`\uD83D\uDD27 [DEBUG] [ProcessManager] Registered AgentServer process ${serverPid} for port ${port}`);
273029
+ processManager.registerProcess(runId, process.pid, "agent-server", port);
273063
273030
  }
273064
273031
  break;
273065
273032
  } catch (error47) {
273066
273033
  retryCount++;
273067
- console.log(`\uD83D\uDD27 [DEBUG] Failed to start server on port ${port}, attempt ${retryCount}/${maxRetries}: ${error47}`);
273068
273034
  if (retryCount >= maxRetries) {
273069
273035
  throw error47;
273070
273036
  }
273071
273037
  port = await findAvailablePort(port + 1, 3100);
273072
- console.log(`\uD83D\uDD27 [DEBUG] Retrying with new port: ${port}`);
273073
273038
  }
273074
273039
  }
273075
273040
  if (!server2) {
@@ -273082,7 +273047,6 @@ async function createScenarioAgent(server2, agentName = "scenario-agent", plugin
273082
273047
  "@elizaos/plugin-openai",
273083
273048
  "@elizaos/plugin-bootstrap"
273084
273049
  ]) {
273085
- console.log(`\uD83D\uDD27 [DEBUG] createScenarioAgent called for agent: ${agentName}, plugins: ${pluginNames.join(", ")}`);
273086
273050
  const character2 = {
273087
273051
  name: agentName,
273088
273052
  id: stringToUuid2(agentName),
@@ -273117,68 +273081,45 @@ async function createScenarioServerAndAgent(existingServer = null, desiredPort =
273117
273081
  }
273118
273082
  async function shutdownScenarioServer(server2, port) {
273119
273083
  try {
273120
- console.log(`\uD83D\uDD27 [DEBUG] Shutting down AgentServer on port ${port}...`);
273121
273084
  if (server2 && typeof server2.stop === "function") {
273122
273085
  await server2.stop();
273123
- console.log(`\uD83D\uDD27 [DEBUG] AgentServer on port ${port} stopped successfully`);
273124
273086
  }
273125
273087
  const runId = `agent-server-${port}`;
273126
273088
  processManager.unregisterProcess(runId);
273127
- console.log(`\uD83D\uDD27 [DEBUG] [ProcessManager] Unregistered AgentServer for port ${port}`);
273128
- } catch (error47) {
273129
- console.log(`\uD83D\uDD27 [DEBUG] Error shutting down AgentServer on port ${port}:`, error47);
273130
- const serverPid = server2?.server?.pid || process.pid;
273131
- if (processManager.isProcessRunning(serverPid)) {
273132
- console.log(`\uD83D\uDD27 [DEBUG] Force terminating AgentServer process ${serverPid}...`);
273089
+ } catch {
273090
+ if (processManager.isProcessRunning(process.pid)) {
273133
273091
  const runId = `agent-server-${port}`;
273134
273092
  processManager.terminateProcess(runId);
273135
273093
  }
273136
273094
  }
273137
273095
  }
273138
- async function askAgentViaApi(server2, agentId, input3, timeoutMs = 60000, serverPort, existingChannelId) {
273139
- console.log(`\uD83D\uDD27 [askAgentViaApi] === FUNCTION START ===`);
273140
- console.log(`\uD83D\uDD27 [askAgentViaApi] Parameters: agentId=${agentId}, input="${input3}", serverPort=${serverPort}, existingChannelId=${existingChannelId}`);
273096
+ async function askAgentViaApi(_server, agentId, input3, timeoutMs = 60000, serverPort, existingChannelId) {
273141
273097
  try {
273142
- const port = serverPort ?? server2?.port ?? 3000;
273143
- console.log(`\uD83D\uDD27 [askAgentViaApi] Port calculation: provided=${serverPort}, server.port=${server2?.port}, final=${port}`);
273144
- console.log(`\uD83D\uDD27 [askAgentViaApi] Creating ElizaClient with baseUrl: http://localhost:${port}`);
273145
- console.log(`\uD83D\uDD27 [askAgentViaApi] Environment check for comparison:`);
273146
- console.log(`\uD83D\uDD27 [askAgentViaApi] - SERVER_PORT env: ${process.env.SERVER_PORT || "NOT SET"}`);
273147
- console.log(`\uD83D\uDD27 [askAgentViaApi] - CENTRAL_MESSAGE_SERVER_URL env: ${process.env.CENTRAL_MESSAGE_SERVER_URL || "NOT SET"}`);
273098
+ const port = serverPort ?? (process.env.SERVER_PORT ? parseInt(process.env.SERVER_PORT, 10) : undefined) ?? 3000;
273148
273099
  const client = ElizaClient.create({ baseUrl: `http://localhost:${port}` });
273149
- console.log(`\uD83D\uDD27 [askAgentViaApi] \u2705 ElizaClient created`);
273150
- console.log(`\uD83D\uDD27 [askAgentViaApi] About to call client.messaging.listMessageServers()...`);
273151
273100
  const { messageServers } = await client.messaging.listMessageServers();
273152
- console.log(`\uD83D\uDD27 [askAgentViaApi] \u2705 listMessageServers() returned ${messageServers.length} servers`);
273153
273101
  if (messageServers.length === 0)
273154
273102
  throw new Error("No servers found");
273155
273103
  const defaultMessageServer = messageServers[0];
273156
- console.log(`\uD83D\uDD27 [askAgentViaApi] Using server: ${defaultMessageServer.id} (${defaultMessageServer.name || "unnamed"})`);
273157
273104
  const testUserId = stringToUuidCore("11111111-1111-1111-1111-111111111111");
273158
- console.log(`\uD83D\uDD27 [askAgentViaApi] Test user ID: ${testUserId}`);
273159
273105
  let channel;
273160
273106
  if (existingChannelId) {
273161
273107
  try {
273162
- console.log(`\uD83D\uDD27 [askAgentViaApi] Using existing channel: ${existingChannelId}`);
273163
273108
  channel = { id: existingChannelId };
273164
273109
  const channelDetailsResponse = await fetch(`http://localhost:${port}/api/messaging/central-channels/${existingChannelId}/details`, {
273165
273110
  method: "GET",
273166
273111
  headers: { "Content-Type": "application/json" }
273167
273112
  });
273168
273113
  if (!channelDetailsResponse.ok) {
273169
- console.log(`\uD83D\uDD27 [askAgentViaApi] \u26A0\uFE0F Channel ${existingChannelId} validation failed: ${channelDetailsResponse.status}, creating new channel`);
273170
273114
  throw new Error(`Channel validation failed: ${channelDetailsResponse.status}`);
273171
273115
  }
273172
273116
  const channelDetails = await channelDetailsResponse.json();
273173
273117
  channel = channelDetails.data;
273174
- console.log(`\uD83D\uDD27 [askAgentViaApi] \u2705 Using existing channel: ${channel.id} (${channel.name || "unnamed"})`);
273175
- } catch (error47) {
273176
- console.log(`\uD83D\uDD27 [askAgentViaApi] \u26A0\uFE0F Channel validation failed, creating new channel: ${error47.message}`);
273118
+ } catch {
273177
273119
  channel = null;
273178
273120
  }
273179
273121
  }
273180
273122
  if (!channel) {
273181
- console.log(`\uD83D\uDD27 [askAgentViaApi] About to create channel via POST /api/messaging/central-channels...`);
273182
273123
  const channelResponse = await fetch(`http://localhost:${port}/api/messaging/central-channels`, {
273183
273124
  method: "POST",
273184
273125
  headers: { "Content-Type": "application/json" },
@@ -273190,48 +273131,21 @@ async function askAgentViaApi(server2, agentId, input3, timeoutMs = 60000, serve
273190
273131
  metadata: { scenario: true }
273191
273132
  })
273192
273133
  });
273193
- console.log(`\uD83D\uDD27 [askAgentViaApi] Channel creation response status: ${channelResponse.status}`);
273194
- if (!channelResponse.ok)
273134
+ if (!channelResponse.ok) {
273195
273135
  throw new Error(`Channel creation failed: ${channelResponse.status}`);
273196
- console.log(`\uD83D\uDD27 [askAgentViaApi] About to parse channel response JSON...`);
273136
+ }
273197
273137
  const channelResult = await channelResponse.json();
273198
- console.log(`\uD83D\uDD27 [askAgentViaApi] \u2705 Channel response parsed`);
273199
273138
  channel = channelResult.data;
273200
- console.log(`\uD83D\uDD27 [askAgentViaApi] Channel created: ${channel.id} (${channel.name || "unnamed"})`);
273201
273139
  }
273202
- console.log(`\uD83D\uDD27 [askAgentViaApi] About to add agent ${agentId} to channel ${channel.id}...`);
273203
273140
  try {
273204
273141
  await client.messaging.addAgentToChannel(channel.id, agentId);
273205
- console.log(`\uD83D\uDD27 [askAgentViaApi] \u2705 Agent added to channel`);
273206
- } catch (error47) {
273207
- console.log(`\uD83D\uDD27 [askAgentViaApi] Agent add result: ${error47.message} (may already be in channel)`);
273208
- }
273209
- console.log(`\uD83D\uDD27 [askAgentViaApi] \uD83D\uDD0D DEBUG: Checking server channels before sync...`);
273210
- try {
273211
- const messageServerChannels = await client.messaging.getMessageServerChannels(defaultMessageServer.id);
273212
- console.log(`\uD83D\uDD27 [askAgentViaApi] \uD83D\uDD0D DEBUG: Server reports ${messageServerChannels.channels.length} total channels`);
273213
- const ourChannel = messageServerChannels.channels.find((c3) => c3.id === channel.id);
273214
- console.log(`\uD83D\uDD27 [askAgentViaApi] \uD83D\uDD0D DEBUG: Our channel ${channel.id} found in server list: ${!!ourChannel}`);
273215
- if (ourChannel) {
273216
- console.log(`\uD83D\uDD27 [askAgentViaApi] \uD83D\uDD0D DEBUG: Channel details:`, JSON.stringify(ourChannel, null, 2));
273217
- }
273218
- } catch (error47) {
273219
- console.log(`\uD83D\uDD27 [askAgentViaApi] \uD83D\uDD0D DEBUG: Error checking server channels:`, error47);
273220
- }
273142
+ } catch {}
273221
273143
  if (!existingChannelId) {
273222
- console.log(`\uD83D\uDD27 [askAgentViaApi] Waiting 1s for MessageBusService channel sync...`);
273223
273144
  await new Promise((resolve14) => setTimeout(resolve14, 1000));
273224
- console.log(`\uD83D\uDD27 [askAgentViaApi] \uD83D\uDD04 Refreshing agent channel cache...`);
273225
273145
  try {
273226
273146
  await client.messaging.addAgentToChannel(channel.id, agentId);
273227
- console.log(`\uD83D\uDD27 [askAgentViaApi] \uD83D\uDD04 Agent re-added to channel for cache refresh`);
273228
- } catch (error47) {
273229
- console.log(`\uD83D\uDD27 [askAgentViaApi] Cache refresh result: ${error47.message} (may already be cached)`);
273230
- }
273231
- } else {
273232
- console.log(`\uD83D\uDD27 [askAgentViaApi] \u2705 Reusing existing channel - skipping cache sync delays`);
273147
+ } catch {}
273233
273148
  }
273234
- console.log(`\uD83D\uDD27 [askAgentViaApi] About to post message via POST /api/messaging/central-channels/${channel.id}/messages...`);
273235
273149
  const postResp = await fetch(`http://localhost:${port}/api/messaging/central-channels/${channel.id}/messages`, {
273236
273150
  method: "POST",
273237
273151
  headers: { "Content-Type": "application/json" },
@@ -273243,27 +273157,18 @@ async function askAgentViaApi(server2, agentId, input3, timeoutMs = 60000, serve
273243
273157
  source_type: "scenario_message"
273244
273158
  })
273245
273159
  });
273246
- console.log(`\uD83D\uDD27 [askAgentViaApi] Message post response status: ${postResp.status}`);
273247
273160
  if (!postResp.ok) {
273248
273161
  const errText = await postResp.text();
273249
- console.log(`\uD83D\uDD27 [askAgentViaApi] \u274C Post failed: ${postResp.status} - ${errText}`);
273250
273162
  throw new Error(`Post message failed: ${postResp.status} - ${errText}`);
273251
273163
  }
273252
- console.log(`\uD83D\uDD27 [askAgentViaApi] About to parse post response JSON...`);
273253
273164
  await postResp.json();
273254
- console.log(`\uD83D\uDD27 [askAgentViaApi] \u2705 Message posted successfully`);
273255
273165
  const startTime = Date.now();
273256
- console.log(`\uD83D\uDD27 [askAgentViaApi] Starting time: ${startTime}, waiting up to ${timeoutMs}ms for response...`);
273257
273166
  const pollInterval = 1000;
273258
273167
  const checkForResponse = async () => {
273259
- console.log(`\uD83D\uDD27 [askAgentViaApi] About to call getChannelMessages...`);
273260
273168
  const messages = await client.messaging.getChannelMessages(channel.id, { limit: 20 });
273261
- console.log(`\uD83D\uDD27 [askAgentViaApi] \u2705 Got ${messages.messages?.length || 0} messages from channel`);
273262
273169
  const agentMessages = messages.messages.filter((msg) => msg.authorId === agentId && new Date(msg.createdAt).getTime() > startTime);
273263
- console.log(`\uD83D\uDD27 [askAgentViaApi] Found ${agentMessages.length} agent messages after startTime`);
273264
273170
  if (agentMessages.length > 0) {
273265
273171
  const latestMessage = agentMessages.sort((a2, b3) => new Date(b3.createdAt).getTime() - new Date(a2.createdAt).getTime())[0];
273266
- console.log(`\uD83D\uDD27 [askAgentViaApi] \u2705 Returning latest message: "${latestMessage.content}"`);
273267
273172
  return { response: latestMessage.content, roomId: channel.id };
273268
273173
  }
273269
273174
  return null;
@@ -273272,7 +273177,6 @@ async function askAgentViaApi(server2, agentId, input3, timeoutMs = 60000, serve
273272
273177
  const poll = async () => {
273273
273178
  try {
273274
273179
  if (Date.now() - startTime >= timeoutMs) {
273275
- console.log(`\uD83D\uDD27 [askAgentViaApi] \u274C Timeout after ${timeoutMs}ms - no agent response`);
273276
273180
  reject(new Error("Timeout waiting for agent response"));
273277
273181
  return;
273278
273182
  }
@@ -273283,15 +273187,13 @@ async function askAgentViaApi(server2, agentId, input3, timeoutMs = 60000, serve
273283
273187
  }
273284
273188
  setTimeout(poll, pollInterval);
273285
273189
  } catch (error47) {
273286
- console.log(`\uD83D\uDD27 [askAgentViaApi] \u274C Error during polling:`, error47);
273287
273190
  reject(error47);
273288
273191
  }
273289
273192
  };
273290
273193
  poll();
273291
273194
  });
273292
273195
  } catch (error47) {
273293
- console.log(`\uD83D\uDD27 [askAgentViaApi] \u274C EXCEPTION CAUGHT:`, error47);
273294
- throw error47;
273196
+ throw new Error(`Failed to get agent response: ${error47 instanceof Error ? error47.message : String(error47)}`);
273295
273197
  }
273296
273198
  }
273297
273199
  var init_runtime_factory = __esm(() => {
@@ -273334,18 +273236,20 @@ class TrajectoryReconstructor {
273334
273236
  --- Memory ${index + 1}/${memories.length} ---`);
273335
273237
  console.log(`ID: ${mem.id}`);
273336
273238
  console.log(`CreatedAt: ${mem.createdAt} (${new Date(mem.createdAt || 0).toISOString()})`);
273337
- console.log(`Type: ${mem.type || "undefined"}`);
273239
+ const memWithType = mem;
273240
+ console.log(`Type: ${memWithType.type || "undefined"}`);
273338
273241
  console.log(`Content Type: ${typeof mem.content}`);
273339
- if (mem.content && typeof mem.content === "object") {
273340
- console.log(`Content.type: ${mem.content?.type}`);
273341
- console.log(`Content keys:`, Object.keys(mem.content));
273342
- if (mem.content?.type === "action_result") {
273242
+ if (mem.content && typeof mem.content === "object" && mem.content !== null) {
273243
+ const contentObj = mem.content;
273244
+ console.log(`Content.type: ${contentObj.type || "undefined"}`);
273245
+ console.log(`Content keys:`, Object.keys(contentObj));
273246
+ if (contentObj.type === "action_result") {
273343
273247
  console.log(`\uD83C\uDFAF FOUND ACTION_RESULT - FULL CONTENT:`, JSON.stringify(mem.content, null, 2));
273344
- } else if (mem.content?.type === "user" || mem.content?.type === "agent") {
273248
+ } else if (contentObj.type === "user" || contentObj.type === "agent") {
273345
273249
  console.log(`\uD83D\uDCAC MESSAGE CONTENT:`, JSON.stringify({
273346
- type: mem.content.type,
273347
- text: mem.content.text,
273348
- content: mem.content.content
273250
+ type: contentObj.type,
273251
+ text: contentObj.text,
273252
+ content: contentObj.content
273349
273253
  }, null, 2));
273350
273254
  } else {
273351
273255
  console.log(`\uD83D\uDCCB OTHER CONTENT:`, JSON.stringify(mem.content, null, 2));
@@ -273356,8 +273260,20 @@ class TrajectoryReconstructor {
273356
273260
  });
273357
273261
  console.log(`\uD83D\uDD0D [TrajectoryReconstructor] ===== MEMORY ANALYSIS END =====
273358
273262
  `);
273359
- const actionMemories = memories.filter((mem) => mem && typeof mem.content === "object" && mem.content?.type === "action_result");
273360
- const messageMemories = memories.filter((mem) => mem && typeof mem.content === "object" && (mem.content?.type === "agent" || mem.content?.type === "user" || mem.content?.thought && mem.content?.actions || mem.content?.source === "scenario_message"));
273263
+ const actionMemories = memories.filter((mem) => {
273264
+ if (!mem || typeof mem.content !== "object" || mem.content === null) {
273265
+ return false;
273266
+ }
273267
+ const contentObj = mem.content;
273268
+ return contentObj.type === "action_result";
273269
+ });
273270
+ const messageMemories = memories.filter((mem) => {
273271
+ if (!mem || typeof mem.content !== "object" || mem.content === null) {
273272
+ return false;
273273
+ }
273274
+ const contentObj = mem.content;
273275
+ return contentObj.type === "agent" || contentObj.type === "user" || typeof contentObj.thought !== "undefined" && typeof contentObj.actions !== "undefined" || contentObj.source === "scenario_message";
273276
+ });
273361
273277
  console.log(`\uD83C\uDFAF [TrajectoryReconstructor] Processing ${actionMemories.length} action memories and ${messageMemories.length} message memories...`);
273362
273278
  const steps = [];
273363
273279
  const runIds = new Set;
@@ -273365,23 +273281,23 @@ class TrajectoryReconstructor {
273365
273281
  const content = memory.content;
273366
273282
  console.log(`
273367
273283
  \uD83D\uDD04 Processing action memory ${memory.id}...`);
273368
- console.log(` actionName: ${content?.actionName}`);
273369
- console.log(` actionParams:`, content?.actionParams);
273370
- console.log(` actionResult:`, content?.actionResult);
273371
- console.log(` thought:`, content?.thought);
273372
- console.log(` planThought:`, content?.planThought);
273373
- console.log(` actionStatus:`, content?.actionStatus);
273374
- const actionName = content?.actionName || "unknown";
273375
- const actionParams = content?.actionParams || {};
273376
- const actionResult = content?.actionResult || {};
273377
- const thought = content?.thought || content?.planThought || "";
273284
+ console.log(` actionName: ${content.actionName || "undefined"}`);
273285
+ console.log(` actionParams:`, content.actionParams || {});
273286
+ console.log(` actionResult:`, content.actionResult || {});
273287
+ console.log(` thought:`, content.thought || "undefined");
273288
+ console.log(` planThought:`, content.planThought || "undefined");
273289
+ console.log(` actionStatus:`, content.actionStatus || "undefined");
273290
+ const actionName = content.actionName || "unknown";
273291
+ const actionParams = content.actionParams || {};
273292
+ const actionResult = content.actionResult;
273293
+ const thought = content.thought || content.planThought || "";
273378
273294
  let observationContent = "";
273379
- if (actionResult?.text) {
273380
- observationContent = actionResult.text;
273381
- } else if (actionResult?.stdout) {
273382
- observationContent = actionResult.stdout;
273383
- } else if (actionResult?.output) {
273384
- observationContent = actionResult.output;
273295
+ if (actionResult && typeof actionResult === "object" && "text" in actionResult) {
273296
+ observationContent = String(actionResult.text);
273297
+ } else if (actionResult && typeof actionResult === "object" && "stdout" in actionResult) {
273298
+ observationContent = String(actionResult.stdout);
273299
+ } else if (actionResult && typeof actionResult === "object" && "output" in actionResult) {
273300
+ observationContent = String(actionResult.output);
273385
273301
  } else if (typeof actionResult === "string") {
273386
273302
  observationContent = actionResult;
273387
273303
  } else if (actionResult && typeof actionResult === "object") {
@@ -273423,14 +273339,14 @@ class TrajectoryReconstructor {
273423
273339
  const timestamp2 = new Date(memory.createdAt || Date.now()).toISOString();
273424
273340
  console.log(`
273425
273341
  \uD83D\uDD04 Processing message memory ${memory.id}...`);
273426
- console.log(` type: ${content?.type}`);
273427
- console.log(` text: ${content?.text?.substring(0, 100)}...`);
273428
- console.log(` source: ${content?.source}`);
273429
- console.log(` thought: ${content?.thought ? "present" : "absent"}`);
273342
+ console.log(` type: ${content.type || "undefined"}`);
273343
+ console.log(` text: ${content.text ? String(content.text).substring(0, 100) + "..." : "undefined"}`);
273344
+ console.log(` source: ${content.source || "undefined"}`);
273345
+ console.log(` thought: ${content.thought ? "present" : "absent"}`);
273430
273346
  console.log(` Content Type: ${typeof content}`);
273431
273347
  console.log(` Content Keys: ${Object.keys(content || {}).join(", ")}`);
273432
273348
  console.log(` Full Content: ${JSON.stringify(content, null, 2)}`);
273433
- const isAgentMessage = content?.type === "agent" || content?.thought && content?.actions;
273349
+ const isAgentMessage = content.type === "agent" || typeof content.thought !== "undefined" && typeof content.actions !== "undefined";
273434
273350
  if (isAgentMessage && content?.thought) {
273435
273351
  const thoughtStep = {
273436
273352
  type: "thought",
@@ -273471,7 +273387,10 @@ class TrajectoryReconstructor {
273471
273387
  console.log(`\uD83D\uDCCA [TrajectoryReconstructor] Time window: ${trajectory.startTime} - ${trajectory.endTime}`);
273472
273388
  if (trajectory.steps.length > 0) {
273473
273389
  console.log(`\u2705 [TrajectoryReconstructor] SUCCESS on attempt ${attempt}: Found ${trajectory.steps.length} trajectory steps`);
273474
- console.log(`\uD83D\uDCCA [TrajectoryReconstructor] Actions found:`, trajectory.steps.filter((s) => s.type === "action").map((s) => s.content.name));
273390
+ console.log(`\uD83D\uDCCA [TrajectoryReconstructor] Actions found:`, trajectory.steps.filter((s) => s.type === "action").map((s) => {
273391
+ const content = s.content;
273392
+ return content.name || "unknown";
273393
+ }));
273475
273394
  console.log(`\uD83D\uDCCA [TrajectoryReconstructor] First step sample:`, JSON.stringify(trajectory.steps[0], null, 2));
273476
273395
  console.log(`\uD83D\uDCCA [TrajectoryReconstructor] ===== SUCCESS END =====
273477
273396
  `);
@@ -273506,13 +273425,14 @@ class UserSimulator {
273506
273425
  console.log(`\uD83D\uDC64 [UserSimulator] Calling LLM with model: ${this.config.model_type || ModelType.TEXT_LARGE}`);
273507
273426
  console.log(`\uD83D\uDC64 [UserSimulator] Prompt length: ${prompt.length}`);
273508
273427
  console.log(`\uD83D\uDC64 [UserSimulator] Prompt preview: ${prompt.substring(0, 200)}...`);
273509
- const response = await this.runtime.useModel(this.config.model_type || ModelType.TEXT_LARGE, {
273428
+ const rawResponse = await this.runtime.useModel(this.config.model_type || ModelType.TEXT_LARGE, {
273510
273429
  prompt,
273511
273430
  temperature: this.config.temperature || 0.8
273512
273431
  });
273432
+ const response = String(rawResponse || "");
273513
273433
  console.log(`\uD83D\uDC64 [UserSimulator] Raw LLM response: "${response}"`);
273514
273434
  console.log(`\uD83D\uDC64 [UserSimulator] Response type: ${typeof response}`);
273515
- console.log(`\uD83D\uDC64 [UserSimulator] Response length: ${response?.length || 0}`);
273435
+ console.log(`\uD83D\uDC64 [UserSimulator] Response length: ${response.length}`);
273516
273436
  if (context2.debugOptions?.log_user_simulation) {
273517
273437
  console.log(`\uD83D\uDC64 [UserSimulator] Generated response: "${response}"`);
273518
273438
  console.log(`\uD83D\uDC64 [UserSimulator] Context: Turn ${context2.turnNumber}/${context2.maxTurns}`);
@@ -273619,7 +273539,8 @@ class ConversationLengthEvaluator {
273619
273539
  };
273620
273540
  }
273621
273541
  const { turnCount } = metadata2;
273622
- const { min_turns, max_turns, optimal_turns, target_range } = params;
273542
+ const typedParams = params;
273543
+ const { min_turns, max_turns, optimal_turns, target_range } = typedParams;
273623
273544
  let success3 = true;
273624
273545
  let message = `Conversation lasted ${turnCount} turns`;
273625
273546
  const issues = [];
@@ -273655,7 +273576,8 @@ class ConversationLengthEvaluator {
273655
273576
 
273656
273577
  class ConversationFlowEvaluator {
273657
273578
  async evaluate(params, runResult, runtime) {
273658
- const { required_patterns, flow_quality_threshold } = params;
273579
+ const typedParams = params;
273580
+ const { required_patterns, flow_quality_threshold } = typedParams;
273659
273581
  const conversationText = runResult.stdout;
273660
273582
  const detectedPatterns = [];
273661
273583
  const missedPatterns = [];
@@ -273700,7 +273622,7 @@ ${conversationText}
273700
273622
  Analyze the conversation and respond with only 'yes' or 'no'.`;
273701
273623
  try {
273702
273624
  const response = await runtime.useModel(ModelType2.TEXT_LARGE, {
273703
- messages: [{ role: "user", content: analysisPrompt }],
273625
+ prompt: analysisPrompt,
273704
273626
  temperature: 0.1
273705
273627
  });
273706
273628
  return response.toLowerCase().includes("yes");
@@ -273713,7 +273635,8 @@ Analyze the conversation and respond with only 'yes' or 'no'.`;
273713
273635
 
273714
273636
  class UserSatisfactionEvaluator {
273715
273637
  async evaluate(params, runResult, runtime) {
273716
- const { satisfaction_threshold, indicators, measurement_method } = params;
273638
+ const typedParams = params;
273639
+ const { satisfaction_threshold, indicators, measurement_method } = typedParams;
273717
273640
  const conversationText = runResult.stdout;
273718
273641
  let satisfactionScore = 0;
273719
273642
  const method = measurement_method || "llm_judge";
@@ -273780,7 +273703,7 @@ ${conversationText}
273780
273703
  Respond with only a number between 0.0 and 1.0:`;
273781
273704
  try {
273782
273705
  const response = await runtime.useModel(ModelType2.TEXT_LARGE, {
273783
- messages: [{ role: "user", content: prompt }],
273706
+ prompt,
273784
273707
  temperature: 0.1
273785
273708
  });
273786
273709
  const score = parseFloat(response.trim());
@@ -273806,7 +273729,7 @@ ${conversationText}
273806
273729
  Respond with only a number between 0.0 and 1.0:`;
273807
273730
  try {
273808
273731
  const response = await runtime.useModel(ModelType2.TEXT_LARGE, {
273809
- messages: [{ role: "user", content: prompt }],
273732
+ prompt,
273810
273733
  temperature: 0.1
273811
273734
  });
273812
273735
  const score = parseFloat(response.trim());
@@ -273820,7 +273743,8 @@ Respond with only a number between 0.0 and 1.0:`;
273820
273743
 
273821
273744
  class ContextRetentionEvaluator {
273822
273745
  async evaluate(params, runResult, runtime) {
273823
- const { test_memory_of, retention_turns, memory_accuracy_threshold } = params;
273746
+ const typedParams = params;
273747
+ const { test_memory_of, retention_turns, memory_accuracy_threshold } = typedParams;
273824
273748
  const conversationText = runResult.stdout;
273825
273749
  const turns = this.parseConversationTurns(conversationText);
273826
273750
  const retentionTurns = retention_turns || 3;
@@ -273880,7 +273804,7 @@ The agent shows memory if they:
273880
273804
  Respond with only 'yes' or 'no'.`;
273881
273805
  try {
273882
273806
  const response = await runtime.useModel(ModelType2.TEXT_LARGE, {
273883
- messages: [{ role: "user", content: prompt }],
273807
+ prompt,
273884
273808
  temperature: 0.1
273885
273809
  });
273886
273810
  return response.toLowerCase().includes("yes");
@@ -274091,8 +274015,18 @@ class EnhancedTrajectoryContainsActionEvaluator {
274091
274015
  const actionResults = actionMemories.filter((mem) => mem.content?.type === "action_result");
274092
274016
  const normalize3 = (name) => (typeof name === "string" ? name : "").toLowerCase().replace(/_/g, "");
274093
274017
  const target = normalize3(actionName);
274094
- const matchingAction = actionResults.find((mem) => normalize3(mem.content?.actionName ?? "") === target);
274095
- const allActionNames = actionResults.map((mem) => mem.content?.actionName || "unknown");
274018
+ const isActionResultContent = (content) => {
274019
+ return typeof content === "object" && content !== null;
274020
+ };
274021
+ const matchingAction = actionResults.find((mem) => {
274022
+ const contentObj = isActionResultContent(mem.content) ? mem.content : null;
274023
+ const actionName2 = contentObj?.actionName;
274024
+ return typeof actionName2 === "string" && normalize3(actionName2) === target;
274025
+ });
274026
+ const allActionNames = actionResults.map((mem) => {
274027
+ const contentObj = isActionResultContent(mem.content) ? mem.content : null;
274028
+ return contentObj?.actionName || "unknown";
274029
+ });
274096
274030
  if (!matchingAction) {
274097
274031
  return {
274098
274032
  evaluator_type: "trajectory_contains_action",
@@ -274151,13 +274085,15 @@ class EnhancedLLMJudgeEvaluator {
274151
274085
  const temperature = params.temperature || 0.1;
274152
274086
  const timeoutMs = Number(process.env.LLM_JUDGE_TIMEOUT_MS || 15000);
274153
274087
  let modelType = candidateModels.find((m2) => runtime.getModel?.(m2)) ?? ModelType3.TEXT_LARGE;
274154
- const capabilities = params.capabilities;
274088
+ const paramsWithCapabilities = params;
274089
+ const capabilities = paramsWithCapabilities.capabilities;
274155
274090
  if (capabilities !== undefined) {
274156
274091
  try {
274157
274092
  const capabilitiesSchema = exports_external.array(exports_external.string()).min(1, "Capabilities array must not be empty");
274158
274093
  capabilitiesSchema.parse(capabilities);
274159
274094
  } catch (error47) {
274160
- throw new Error(`Invalid capabilities: ${error47.message}`);
274095
+ const errorMessage = error47 instanceof Error ? error47.message : String(error47);
274096
+ throw new Error(`Invalid capabilities: ${errorMessage}`);
274161
274097
  }
274162
274098
  }
274163
274099
  const structuredPrompt = this.createStructuredPrompt(runResult, prompt, expected, capabilities);
@@ -274172,7 +274108,7 @@ class EnhancedLLMJudgeEvaluator {
274172
274108
  details: {
274173
274109
  error: "no_model_available",
274174
274110
  attempted_models: candidateModels,
274175
- models_available: Array.from(runtime.models.keys()),
274111
+ models_available: [],
274176
274112
  prompt,
274177
274113
  expected
274178
274114
  }
@@ -274190,16 +274126,18 @@ class EnhancedLLMJudgeEvaluator {
274190
274126
  ]);
274191
274127
  let parsedResponse;
274192
274128
  try {
274193
- parsedResponse = this.validateStructuredResponse(response, jsonSchema);
274129
+ const responseValue = typeof response === "string" ? response : typeof response === "object" && response !== null && !Array.isArray(response) ? response : String(response);
274130
+ parsedResponse = this.validateStructuredResponse(responseValue, jsonSchema);
274194
274131
  } catch (parseError) {
274132
+ const errorMessage = parseError instanceof Error ? parseError.message : String(parseError);
274195
274133
  return {
274196
274134
  evaluator_type: "llm_judge",
274197
274135
  success: false,
274198
- summary: `LLM Judge FAILED: Invalid LLM response - ${parseError.message}`,
274136
+ summary: `LLM Judge FAILED: Invalid LLM response - ${errorMessage}`,
274199
274137
  details: {
274200
274138
  error: "llm_parse_error",
274201
274139
  error_type: "llm_parse_error",
274202
- error_message: parseError.message,
274140
+ error_message: errorMessage,
274203
274141
  model_used: modelType,
274204
274142
  prompt,
274205
274143
  expected,
@@ -274229,7 +274167,7 @@ class EnhancedLLMJudgeEvaluator {
274229
274167
  }
274230
274168
  };
274231
274169
  } catch (error47) {
274232
- const msg = error47?.message || String(error47);
274170
+ const msg = error47 instanceof Error ? error47.message : String(error47);
274233
274171
  const isTimeout = msg.toLowerCase().includes("timeout");
274234
274172
  return {
274235
274173
  evaluator_type: "llm_judge",
@@ -274326,32 +274264,32 @@ Provide your assessment as a structured JSON response with detailed reasoning fo
274326
274264
  };
274327
274265
  }
274328
274266
  validateStructuredResponse(response, _schema) {
274329
- if (typeof response === "string") {
274330
- response = JSON.parse(response);
274331
- }
274332
- if (!response.qualitative_summary || !response.capability_checklist) {
274267
+ const responseObj = typeof response === "string" ? JSON.parse(response) : response;
274268
+ const typedResponse = responseObj;
274269
+ if (!typedResponse.qualitative_summary || !typedResponse.capability_checklist) {
274333
274270
  throw new Error("Invalid LLM response: missing required fields");
274334
274271
  }
274335
- if (!Array.isArray(response.capability_checklist)) {
274272
+ if (!Array.isArray(typedResponse.capability_checklist)) {
274336
274273
  throw new Error("Invalid LLM response: capability_checklist must be an array");
274337
274274
  }
274338
- if (response.capability_checklist.length === 0) {
274339
- response.capability_checklist = [
274340
- {
274341
- capability: "Task Completion",
274342
- achieved: response.overall_success || false,
274343
- reasoning: "Default capability assessment based on overall success"
274344
- }
274345
- ];
274275
+ const capabilityChecklist = typedResponse.capability_checklist;
274276
+ if (capabilityChecklist.length === 0) {
274277
+ capabilityChecklist.push({
274278
+ capability: "Task Completion",
274279
+ achieved: typedResponse.overall_success || false,
274280
+ reasoning: "Default capability assessment based on overall success"
274281
+ });
274346
274282
  }
274347
- if (response.confidence === undefined) {
274348
- response.confidence = 0.8;
274283
+ if (typedResponse.confidence === undefined) {
274284
+ typedResponse.confidence = 0.8;
274349
274285
  }
274350
- if (response.overall_success === undefined) {
274351
- const allAchieved = response.capability_checklist.every((cap) => cap.achieved === true);
274352
- response.overall_success = allAchieved;
274286
+ const completeResponseObj = typeof response === "string" ? JSON.parse(response) : response;
274287
+ const completeTypedResponse = completeResponseObj;
274288
+ if (completeTypedResponse.overall_success === undefined) {
274289
+ const allAchieved = completeTypedResponse.capability_checklist.every((cap) => cap.achieved === true);
274290
+ completeTypedResponse.overall_success = allAchieved;
274353
274291
  }
274354
- return response;
274292
+ return completeTypedResponse;
274355
274293
  }
274356
274294
  compareWithExpected(parsedResponse, expected) {
274357
274295
  const overallSuccess = parsedResponse.overall_success;
@@ -274364,7 +274302,7 @@ Provide your assessment as a structured JSON response with detailed reasoning fo
274364
274302
  const threshold = parseFloat(expectedLower.replace("+", ""));
274365
274303
  return confidence >= threshold;
274366
274304
  }
274367
- return overallSuccess;
274305
+ return overallSuccess ?? false;
274368
274306
  }
274369
274307
  }
274370
274308
  var init_EnhancedEvaluationEngine = __esm(() => {
@@ -274493,19 +274431,24 @@ class TrajectoryContainsActionEvaluator {
274493
274431
  count: 50,
274494
274432
  unique: false
274495
274433
  });
274434
+ const isActionResultContent = (content) => {
274435
+ return typeof content === "object" && content !== null;
274436
+ };
274496
274437
  const actionResults = actionMemories.filter((mem) => {
274497
- if (!mem || typeof mem.content !== "object")
274438
+ if (!mem || typeof mem.content !== "object" || mem.content === null)
274498
274439
  return false;
274499
- const contentType = mem.content?.type;
274440
+ const contentType = isActionResultContent(mem.content) ? mem.content.type : undefined;
274500
274441
  const metadataType = mem.metadata?.type;
274501
- const hasActionName = mem.content?.actionName || mem.metadata?.actionName;
274442
+ const contentObj2 = isActionResultContent(mem.content) ? mem.content : null;
274443
+ const hasActionName = contentObj2?.actionName || mem.metadata?.actionName;
274502
274444
  return contentType === "action_result" || metadataType === "action_result" || contentType === "agent" && hasActionName;
274503
274445
  });
274504
274446
  const normalize3 = (name) => (typeof name === "string" ? name : "").toLowerCase().replace(/_/g, "");
274505
274447
  const target = normalize3(actionName);
274506
274448
  const matchingAction = actionResults.find((mem) => {
274507
- const contentActionName = mem.content?.actionName;
274508
- const metadataActionName = mem.metadata?.actionName;
274449
+ const contentObj2 = isActionResultContent(mem.content) ? mem.content : null;
274450
+ const contentActionName = typeof contentObj2?.actionName === "string" ? contentObj2.actionName : undefined;
274451
+ const metadataActionName = typeof mem.metadata?.actionName === "string" ? mem.metadata.actionName : undefined;
274509
274452
  const contentNormalized = normalize3(contentActionName);
274510
274453
  const metadataNormalized = normalize3(metadataActionName);
274511
274454
  return contentNormalized === target || metadataNormalized === target;
@@ -274516,8 +274459,9 @@ class TrajectoryContainsActionEvaluator {
274516
274459
  message: `Action '${actionName}' was not found in the execution trajectory`
274517
274460
  };
274518
274461
  }
274519
- const actionStatus = matchingAction.content?.actionStatus || "unknown";
274520
- const message = actionStatus === "completed" ? `Action '${params.action}' was executed successfully` : `Action '${params.action}' was executed but failed: ${matchingAction.content?.error || "Unknown error"}`;
274462
+ const contentObj = isActionResultContent(matchingAction.content) ? matchingAction.content : null;
274463
+ const actionStatus = contentObj?.actionStatus || "unknown";
274464
+ const message = actionStatus === "completed" ? `Action '${params.action}' was executed successfully` : `Action '${params.action}' was executed but failed: ${contentObj?.error || "Unknown error"}`;
274521
274465
  return {
274522
274466
  success: true,
274523
274467
  message
@@ -274557,14 +274501,10 @@ CRITICAL: You must respond with a JSON object that EXACTLY matches this schema:
274557
274501
  ${JSON.stringify(jsonSchema, null, 2)}
274558
274502
 
274559
274503
  The response MUST include these exact field names:
274560
- ${Object.keys(jsonSchema.properties).join(", ")}
274504
+ ${typeof jsonSchema === "object" && jsonSchema !== null && "properties" in jsonSchema && typeof jsonSchema.properties === "object" && jsonSchema.properties !== null ? Object.keys(jsonSchema.properties).join(", ") : "N/A"}
274561
274505
 
274562
274506
  Do not use any other field names. Use only the exact field names specified above.`;
274563
274507
  try {
274564
- const availableModels = runtime.models;
274565
- const modelKeys = availableModels && typeof availableModels.keys === "function" ? Array.from(availableModels.keys()) : Object.keys(availableModels || {});
274566
- console.log(`\uD83D\uDD0D [LLMJudgeEvaluator] Available models: ${JSON.stringify(availableModels)}`);
274567
- console.log(`\uD83D\uDD0D [LLMJudgeEvaluator] Model keys: ${JSON.stringify(modelKeys)}`);
274568
274508
  const modelHandler = runtime.getModel(modelType);
274569
274509
  console.log(`\uD83D\uDD0D [LLMJudgeEvaluator] Model handler: ${JSON.stringify(modelHandler)}`);
274570
274510
  console.log(`\uD83D\uDD0D [LLMJudgeEvaluator] Model type: ${modelType}`);
@@ -274587,12 +274527,15 @@ Do not use any other field names. Use only the exact field names specified above
274587
274527
  ]);
274588
274528
  const parsedResponse = this.validateResponse(response, jsonSchema);
274589
274529
  const success3 = this.compareWithExpected(parsedResponse, expected);
274530
+ const responseObj = parsedResponse;
274531
+ const judgment = responseObj.judgment;
274532
+ const confidence = responseObj.confidence;
274590
274533
  return {
274591
274534
  success: success3,
274592
- message: `LLM judgment: ${parsedResponse.judgment} (confidence: ${parsedResponse.confidence}). Expected: "${expected}". Result: ${success3}`
274535
+ message: `LLM judgment: ${judgment || "unknown"} (confidence: ${confidence ?? "unknown"}). Expected: "${expected}". Result: ${success3}`
274593
274536
  };
274594
274537
  } catch (error47) {
274595
- const msg = error47?.message || String(error47);
274538
+ const msg = error47 instanceof Error ? error47.message : String(error47);
274596
274539
  const isTimeout = msg.toLowerCase().includes("timeout");
274597
274540
  return {
274598
274541
  success: false,
@@ -274628,7 +274571,8 @@ Do not use any other field names. Use only the exact field names specified above
274628
274571
  }
274629
274572
  convertToZodSchema(schema2) {
274630
274573
  const properties = {};
274631
- for (const [key, prop] of Object.entries(schema2.properties || {})) {
274574
+ const schemaProperties = schema2.properties || {};
274575
+ for (const [key, prop] of Object.entries(schemaProperties)) {
274632
274576
  const propSchema = prop;
274633
274577
  if (propSchema.type === "string") {
274634
274578
  let zodProp = exports_external.string();
@@ -274652,22 +274596,23 @@ Do not use any other field names. Use only the exact field names specified above
274652
274596
  return exports_external.object(properties);
274653
274597
  }
274654
274598
  compareWithExpected(parsedResponse, expected) {
274655
- const judgment = parsedResponse.judgment.toLowerCase();
274599
+ const judgment = parsedResponse.judgment?.toLowerCase() || "";
274600
+ const confidence = parsedResponse.confidence;
274656
274601
  const expectedLower = expected.toLowerCase();
274657
274602
  if (expectedLower === "yes" || expectedLower === "no") {
274658
274603
  return judgment === expectedLower;
274659
274604
  }
274660
274605
  if (expectedLower.includes("+")) {
274661
274606
  const threshold = parseFloat(expectedLower.replace("+", ""));
274662
- return parsedResponse.confidence >= threshold;
274607
+ return confidence !== undefined && confidence >= threshold;
274663
274608
  }
274664
274609
  if (expectedLower.endsWith("-")) {
274665
274610
  const threshold = parseFloat(expectedLower.replace("-", ""));
274666
- return parsedResponse.confidence <= threshold;
274611
+ return confidence !== undefined && confidence <= threshold;
274667
274612
  }
274668
274613
  if (expectedLower.includes("-")) {
274669
274614
  const [min, max] = expectedLower.split("-").map(Number);
274670
- return parsedResponse.confidence >= min && parsedResponse.confidence <= max;
274615
+ return confidence !== undefined && confidence >= min && confidence <= max;
274671
274616
  }
274672
274617
  return judgment.includes(expectedLower);
274673
274618
  }
@@ -274970,7 +274915,7 @@ ${conversationText}
274970
274915
  Should this conversation be terminated? Respond with only 'yes' or 'no'.`;
274971
274916
  try {
274972
274917
  const response = await this.runtime.useModel(ModelType5.TEXT_LARGE, {
274973
- messages: [{ role: "user", content: prompt }],
274918
+ prompt,
274974
274919
  temperature: 0.1
274975
274920
  });
274976
274921
  return response.toLowerCase().includes("yes");
@@ -275068,11 +275013,6 @@ class LocalEnvironmentProvider {
275068
275013
  this.runtime = _runtime ?? null;
275069
275014
  this.serverPort = serverPort ?? null;
275070
275015
  this.trajectoryReconstructor = _runtime ? new TrajectoryReconstructor(_runtime) : null;
275071
- console.log(`\uD83D\uDD27 [DEBUG] LocalEnvironmentProvider CONSTRUCTOR:`);
275072
- console.log(`\uD83D\uDD27 [DEBUG] - Server: ${server2 ? "present" : "null"}`);
275073
- console.log(`\uD83D\uDD27 [DEBUG] - Agent ID: ${agentId}`);
275074
- console.log(`\uD83D\uDD27 [DEBUG] - Runtime: ${_runtime ? "present" : "null"}`);
275075
- console.log(`\uD83D\uDD27 [DEBUG] - Server Port: ${serverPort}`);
275076
275016
  }
275077
275017
  async setup(scenario) {
275078
275018
  const tempDirPrefix = path71.join(os11.tmpdir(), "eliza-scenario-run-");
@@ -275147,7 +275087,7 @@ class LocalEnvironmentProvider {
275147
275087
  executionResult.conversationMetadata = {
275148
275088
  turnCount: conversationResult.turns.length,
275149
275089
  terminatedEarly: conversationResult.terminatedEarly,
275150
- terminationReason: conversationResult.terminationReason,
275090
+ terminationReason: conversationResult.terminationReason ?? undefined,
275151
275091
  finalEvaluations: conversationResult.finalEvaluations
275152
275092
  };
275153
275093
  results.push(executionResult);
@@ -275158,10 +275098,6 @@ class LocalEnvironmentProvider {
275158
275098
  const { response, roomId } = await askAgentViaApi(this.server, this.agentId, step.input, 90000, this.serverPort);
275159
275099
  await new Promise((resolve14) => setTimeout(resolve14, 3000));
275160
275100
  const trajectory = this.trajectoryReconstructor && roomId ? await this.trajectoryReconstructor.getLatestTrajectory(roomId) : [];
275161
- console.log(`\uD83D\uDD0D [Trajectory Debug] Room ID: ${roomId}, Steps found: ${trajectory.length}`);
275162
- if (trajectory.length > 0) {
275163
- console.log(`\uD83D\uDCCA [Trajectory Debug] First step:`, JSON.stringify(trajectory[0], null, 2));
275164
- }
275165
275101
  const endedAtMs = Date.now();
275166
275102
  const durationMs = endedAtMs - startedAtMs;
275167
275103
  results.push({
@@ -275220,17 +275156,18 @@ class LocalEnvironmentProvider {
275220
275156
  let exitCode = 1;
275221
275157
  let stderr = "";
275222
275158
  let stdout = "";
275223
- if (error47.exitCode !== undefined) {
275224
- exitCode = error47.exitCode;
275159
+ const errorObj = error47;
275160
+ if (errorObj.exitCode !== undefined) {
275161
+ exitCode = errorObj.exitCode;
275225
275162
  }
275226
- if (error47.stderr) {
275227
- stderr = error47.stderr;
275163
+ if (errorObj.stderr) {
275164
+ stderr = errorObj.stderr;
275228
275165
  }
275229
- if (error47.stdout) {
275230
- stdout = error47.stdout;
275166
+ if (errorObj.stdout) {
275167
+ stdout = errorObj.stdout;
275231
275168
  }
275232
- if (!stderr && error47.message) {
275233
- stderr = error47.message;
275169
+ if (!stderr && errorObj.message) {
275170
+ stderr = errorObj.message;
275234
275171
  }
275235
275172
  results.push({
275236
275173
  exitCode,
@@ -280765,7 +280702,14 @@ var init_matrix_schema = __esm(() => {
280765
280702
  init_zod();
280766
280703
  MatrixAxisSchema = exports_external.object({
280767
280704
  parameter: exports_external.string().min(1, "Parameter path cannot be empty"),
280768
- values: exports_external.array(exports_external.any()).min(1, "Values array must contain at least 1 element")
280705
+ values: exports_external.array(exports_external.union([
280706
+ exports_external.string(),
280707
+ exports_external.number(),
280708
+ exports_external.boolean(),
280709
+ exports_external.null(),
280710
+ exports_external.record(exports_external.string(), exports_external.unknown()),
280711
+ exports_external.array(exports_external.unknown())
280712
+ ])).min(1, "Values array must contain at least 1 element")
280769
280713
  });
280770
280714
  MatrixConfigSchema = exports_external.object({
280771
280715
  name: exports_external.string().min(1, "Name cannot be empty"),
@@ -281050,7 +280994,8 @@ function deepClone(obj) {
281050
280994
  return new RegExp(obj.source, obj.flags);
281051
280995
  }
281052
280996
  if (obj instanceof Error) {
281053
- const cloned = new obj.constructor(obj.message);
280997
+ const ErrorConstructor = obj.constructor;
280998
+ const cloned = new ErrorConstructor(obj.message);
281054
280999
  cloned.stack = obj.stack;
281055
281000
  cloned.name = obj.name;
281056
281001
  return cloned;
@@ -281102,23 +281047,26 @@ function hasCircularReference(obj) {
281102
281047
  if (current === null || typeof current !== "object") {
281103
281048
  return false;
281104
281049
  }
281105
- if (visited.has(current)) {
281106
- return true;
281107
- }
281108
- visited.add(current);
281109
- if (Array.isArray(current)) {
281110
- for (const item of current) {
281111
- if (checkCircular(item)) {
281112
- return true;
281113
- }
281050
+ if (typeof current === "object" && current !== null) {
281051
+ if (visited.has(current)) {
281052
+ return true;
281114
281053
  }
281115
- } else {
281116
- for (const key in current) {
281117
- if (current.hasOwnProperty(key)) {
281118
- if (checkCircular(current[key])) {
281054
+ visited.add(current);
281055
+ if (Array.isArray(current)) {
281056
+ for (const item of current) {
281057
+ if (checkCircular(item)) {
281119
281058
  return true;
281120
281059
  }
281121
281060
  }
281061
+ } else {
281062
+ const currentObj = current;
281063
+ for (const key in currentObj) {
281064
+ if (currentObj.hasOwnProperty(key)) {
281065
+ if (checkCircular(currentObj[key])) {
281066
+ return true;
281067
+ }
281068
+ }
281069
+ }
281122
281070
  }
281123
281071
  }
281124
281072
  return false;
@@ -281149,9 +281097,10 @@ function deepCloneWithLimit(obj, maxDepth = 50) {
281149
281097
  return current.map((item) => cloneWithDepth(item, depth + 1));
281150
281098
  }
281151
281099
  const cloned = {};
281152
- for (const key in current) {
281153
- if (current.hasOwnProperty(key)) {
281154
- cloned[key] = cloneWithDepth(current[key], depth + 1);
281100
+ const currentObj = current;
281101
+ for (const key in currentObj) {
281102
+ if (currentObj.hasOwnProperty(key)) {
281103
+ cloned[key] = cloneWithDepth(currentObj[key], depth + 1);
281155
281104
  }
281156
281105
  }
281157
281106
  return cloned;
@@ -281227,9 +281176,10 @@ function validateParameterPath(obj, path72) {
281227
281176
  targetType: typeof current
281228
281177
  };
281229
281178
  }
281230
- if (!(segment in current)) {
281231
- const availableProps = Object.keys(current).slice(0, 5);
281232
- const suggestion = availableProps.length > 0 ? `Available properties: ${availableProps.join(", ")}${Object.keys(current).length > 5 ? "..." : ""}` : "Object has no properties";
281179
+ const currentObj = current;
281180
+ if (!(segment in currentObj)) {
281181
+ const availableProps = Object.keys(currentObj).slice(0, 5);
281182
+ const suggestion = availableProps.length > 0 ? `Available properties: ${availableProps.join(", ")}${Object.keys(currentObj).length > 5 ? "..." : ""}` : "Object has no properties";
281233
281183
  return {
281234
281184
  isValid: false,
281235
281185
  error: `Property '${segment}' does not exist at path '${currentPath}'`,
@@ -281238,7 +281188,7 @@ function validateParameterPath(obj, path72) {
281238
281188
  targetType: "object"
281239
281189
  };
281240
281190
  }
281241
- current = current[segment];
281191
+ current = currentObj[segment];
281242
281192
  }
281243
281193
  }
281244
281194
  return {
@@ -281283,10 +281233,11 @@ function getValueAtPath(obj, path72) {
281283
281233
  if (!current || typeof current !== "object") {
281284
281234
  throw new Error(`Expected object at path segment, but found ${typeof current} in path: ${path72}`);
281285
281235
  }
281286
- if (!(segment in current)) {
281236
+ const currentObj = current;
281237
+ if (!(segment in currentObj)) {
281287
281238
  throw new Error(`Property '${segment}' not found in path: ${path72}`);
281288
281239
  }
281289
- current = current[segment];
281240
+ current = currentObj[segment];
281290
281241
  }
281291
281242
  }
281292
281243
  return current;
@@ -281305,13 +281256,14 @@ function setValueAtPath(obj, path72, value) {
281305
281256
  }
281306
281257
  current = current[segment];
281307
281258
  } else {
281308
- if (!current || typeof current !== "object") {
281259
+ if (!current || typeof current !== "object" || Array.isArray(current)) {
281309
281260
  throw new Error(`Expected object at path segment, but found ${typeof current} in path: ${path72}`);
281310
281261
  }
281311
- if (!(segment in current)) {
281262
+ const currentObj = current;
281263
+ if (!(segment in currentObj)) {
281312
281264
  throw new Error(`Property '${segment}' not found in path: ${path72}`);
281313
281265
  }
281314
- current = current[segment];
281266
+ current = currentObj[segment];
281315
281267
  }
281316
281268
  }
281317
281269
  const finalSegment = parsedPath.segments[parsedPath.segments.length - 1];
@@ -281324,10 +281276,11 @@ function setValueAtPath(obj, path72, value) {
281324
281276
  }
281325
281277
  current[finalSegment] = value;
281326
281278
  } else {
281327
- if (!current || typeof current !== "object") {
281279
+ if (!current || typeof current !== "object" || Array.isArray(current)) {
281328
281280
  throw new Error(`Expected object for final segment, but found ${typeof current} in path: ${path72}`);
281329
281281
  }
281330
- current[finalSegment] = value;
281282
+ const currentObj = current;
281283
+ currentObj[finalSegment] = value;
281331
281284
  }
281332
281285
  }
281333
281286
  function applyParameterOverride(scenario, path72, value) {
@@ -281513,17 +281466,18 @@ function setNestedProperty(obj, path72, value) {
281513
281466
  let current = obj;
281514
281467
  for (let i3 = 0;i3 < keys.length - 1; i3++) {
281515
281468
  const key = keys[i3];
281516
- const arrayMatch2 = key.match(/^(.+)\[(\d+)\]$/);
281517
- if (arrayMatch2) {
281518
- const [, arrayKey, indexStr] = arrayMatch2;
281519
- const index = parseInt(indexStr, 10);
281469
+ const arrayMatch = key.match(/^(.+)\[(\d+)\]$/);
281470
+ if (arrayMatch) {
281471
+ const arrayKey = arrayMatch[1];
281472
+ const index = parseInt(arrayMatch[2], 10);
281520
281473
  if (!current[arrayKey]) {
281521
281474
  current[arrayKey] = [];
281522
281475
  }
281523
- if (!current[arrayKey][index]) {
281524
- current[arrayKey][index] = {};
281476
+ const arr = current[arrayKey];
281477
+ if (!arr[index]) {
281478
+ arr[index] = {};
281525
281479
  }
281526
- current = current[arrayKey][index];
281480
+ current = arr[index];
281527
281481
  } else {
281528
281482
  if (!current[key]) {
281529
281483
  current[key] = {};
@@ -281532,10 +281486,10 @@ function setNestedProperty(obj, path72, value) {
281532
281486
  }
281533
281487
  }
281534
281488
  const finalKey = keys[keys.length - 1];
281535
- const arrayMatch = finalKey.match(/^(.+)\[(\d+)\]$/);
281536
- if (arrayMatch) {
281537
- const [, arrayKey, indexStr] = arrayMatch;
281538
- const index = parseInt(indexStr, 10);
281489
+ const finalArrayMatch = finalKey.match(/^(.+)\[(\d+)\]$/);
281490
+ if (finalArrayMatch) {
281491
+ const arrayKey = finalArrayMatch[1];
281492
+ const index = parseInt(finalArrayMatch[2], 10);
281539
281493
  if (!current[arrayKey]) {
281540
281494
  current[arrayKey] = [];
281541
281495
  }
@@ -282242,15 +282196,12 @@ __export(exports_matrix_orchestrator, {
282242
282196
  });
282243
282197
  import { promises as fs40 } from "fs";
282244
282198
  import { join as join20 } from "path";
282199
+ import { logger as logger55 } from "@elizaos/core";
282245
282200
  async function executeMatrixRuns(config5, combinations, options) {
282246
- console.log("\uD83D\uDD27 [DEBUG] executeMatrixRuns started");
282247
282201
  const startTime = new Date;
282248
282202
  const results = [];
282249
282203
  const activeRuns = new Map;
282250
282204
  let sharedServer = null;
282251
- const initialSummary = processManager.getSummary();
282252
- console.log(`\uD83D\uDD27 [DEBUG] [ProcessManager] Initial state: ${initialSummary.total} processes tracked`);
282253
- console.log("\uD83D\uDD27 [DEBUG] About to setup execution environment");
282254
282205
  const { outputDir, maxParallel = 1, continueOnFailure = true, runTimeout = 300000 } = options;
282255
282206
  await fs40.mkdir(outputDir, { recursive: true });
282256
282207
  const progressTracker = createProgressTracker({
@@ -282279,82 +282230,46 @@ async function executeMatrixRuns(config5, combinations, options) {
282279
282230
  });
282280
282231
  resourceMonitor.start();
282281
282232
  try {
282282
- console.log("\uD83D\uDD27 [DEBUG] About to read base scenario file");
282283
282233
  const baseScenarioContent = await fs40.readFile(config5.base_scenario, "utf8");
282284
- console.log("\uD83D\uDD27 [DEBUG] Base scenario file read successfully");
282285
282234
  let baseScenario;
282286
282235
  try {
282287
- console.log("\uD83D\uDD27 [DEBUG] Attempting to parse as JSON");
282288
282236
  baseScenario = JSON.parse(baseScenarioContent);
282289
- console.log("\uD83D\uDD27 [DEBUG] JSON parsing successful");
282290
282237
  } catch {
282291
- console.log("\uD83D\uDD27 [DEBUG] JSON parsing failed, attempting YAML import");
282292
282238
  const yaml = await Promise.resolve().then(() => (init_js_yaml(), exports_js_yaml));
282293
- console.log("\uD83D\uDD27 [DEBUG] YAML import successful, parsing content");
282294
282239
  baseScenario = yaml.load(baseScenarioContent);
282295
- console.log("\uD83D\uDD27 [DEBUG] YAML parsing successful");
282296
282240
  }
282297
- console.log("\uD83D\uDD27 [DEBUG] About to save matrix configuration");
282298
282241
  await saveMatrixConfiguration(config5, outputDir);
282299
- console.log("\uD83D\uDD27 [DEBUG] Matrix configuration saved successfully");
282300
- console.log("\uD83D\uDD27 [DEBUG] About to execute all combinations");
282301
- console.log("\uD83D\uDD27 [DEBUG] Extracting dynamic plugins from scenario configuration...");
282302
282242
  const defaultPlugins = ["@elizaos/plugin-sql", "@elizaos/plugin-bootstrap"];
282303
282243
  const scenarioPlugins = Array.isArray(baseScenario.plugins) ? baseScenario.plugins.filter((p2) => typeof p2 === "string" || p2.enabled !== false).map((p2) => typeof p2 === "string" ? p2 : p2.name) : [];
282304
282244
  const finalPlugins = Array.from(new Set([...scenarioPlugins, ...defaultPlugins, "@elizaos/plugin-openai"]));
282305
- console.log(`\uD83D\uDD27 [DEBUG] Dynamic plugins loaded: ${JSON.stringify(finalPlugins)}`);
282306
- console.log(`\uD83D\uDD27 [DEBUG] Shared server condition check: combinations.length=${combinations.length}, runs_per_combination=${config5.runs_per_combination}`);
282307
282245
  if (combinations.length > 1 || config5.runs_per_combination > 1) {
282308
282246
  console.log("\uD83D\uDD27 [DEBUG] Matrix testing detected - creating shared server for better isolation...");
282309
282247
  const { createScenarioServer: createScenarioServer2 } = await Promise.resolve().then(() => (init_runtime_factory(), exports_runtime_factory));
282310
282248
  try {
282311
- console.log(`\uD83D\uDD27 [DEBUG] Calling createScenarioServer(null, 3000)... (using fixed port 3000 for MessageBusService compatibility)`);
282312
282249
  const serverResult = await createScenarioServer2(null, 3000);
282313
282250
  sharedServer = {
282314
282251
  server: serverResult.server,
282315
282252
  port: serverResult.port
282316
282253
  };
282317
- console.log(`\uD83D\uDD27 [DEBUG] \u2705 Shared server created successfully on port ${sharedServer.port}`);
282318
- console.log(`\uD83D\uDD27 [DEBUG] \u2705 Server result details: port=${serverResult.port}, createdServer=${serverResult.createdServer}`);
282319
282254
  } catch (error47) {
282320
- console.log(`\uD83D\uDD27 [DEBUG] \u274C Failed to create shared server, falling back to individual servers: ${error47}`);
282321
282255
  sharedServer = null;
282322
282256
  }
282323
282257
  }
282324
282258
  let runCounter = 0;
282325
- console.log(`\uD83D\uDD27 [DEBUG] Total combinations to execute: ${combinations.length}`);
282326
- console.log("\uD83D\uDD27 [DEBUG] About to start execution loop");
282327
282259
  for (const combination of combinations) {
282328
- console.log(`\uD83D\uDD27 [DEBUG] Processing combination: ${combination.id}`);
282329
282260
  const combinationResults = [];
282330
- console.log(`\uD83D\uDD27 [DEBUG] About to process ${config5.runs_per_combination} runs for this combination`);
282331
- console.log("\uD83D\uDD27 [DEBUG] About to start processing runs for this combination");
282332
282261
  for (let runIndex = 0;runIndex < config5.runs_per_combination; runIndex++) {
282333
- console.log(`\uD83D\uDD27 [DEBUG] About to process run ${runIndex + 1} of ${config5.runs_per_combination}`);
282334
- console.log(`\uD83D\uDD27 [DEBUG] Current active runs count: ${activeRuns.size}`);
282335
- console.log(`\uD83D\uDD27 [DEBUG] Max parallel execution: ${maxParallel}`);
282336
282262
  const memoryUsage = process.memoryUsage();
282337
- console.log(`\uD83D\uDD27 [DEBUG] Current memory usage: ${memoryUsage.heapUsed / 1024 / 1024} MB`);
282338
- console.log(`\uD83D\uDD27 [DEBUG] Total memory usage: ${memoryUsage.heapTotal / 1024 / 1024} MB`);
282339
282263
  if (memoryUsage.heapUsed > 524288000) {
282340
- console.log(`\uD83D\uDD27 [DEBUG] High memory usage detected, forcing cleanup...`);
282341
282264
  if (global.gc) {
282342
282265
  global.gc();
282343
- console.log(`\uD83D\uDD27 [DEBUG] Forced garbage collection due to high memory usage`);
282344
282266
  }
282345
282267
  }
282346
282268
  runCounter++;
282347
282269
  const runId = generateRunFilename(runCounter);
282348
- console.log(`\uD83D\uDD27 [DEBUG] Generated runId: ${runId}`);
282349
- console.log(`\uD83D\uDD27 [DEBUG] Combination parameters:`, JSON.stringify(combination.parameters, null, 2));
282350
- console.log(`\uD83D\uDD27 [DEBUG] Waiting for available slot... (active runs: ${activeRuns.size}/${maxParallel})`);
282351
282270
  await waitForAvailableSlot(activeRuns, maxParallel);
282352
- console.log(`\uD83D\uDD27 [DEBUG] Slot available, about to start the run ${runId}`);
282353
- console.log(`\uD83D\uDD27 [DEBUG] About to call executeIndividualRun with timeout: ${runTimeout}ms`);
282354
282271
  const runPromise = executeIndividualRun(runId, combination, baseScenario, outputDir, progressTracker, resourceMonitor, runTimeout, sharedServer ?? undefined, finalPlugins);
282355
- console.log(`\uD83D\uDD27 [DEBUG] Creating isolated environment for runId: ${runId}`);
282356
282272
  const context2 = await createIsolatedEnvironment(runId, outputDir);
282357
- console.log(`\uD83D\uDD27 [DEBUG] Isolated environment created, adding to active runs`);
282358
282273
  activeRuns.set(runId, {
282359
282274
  runId,
282360
282275
  combinationId: combination.id,
@@ -282363,31 +282278,21 @@ async function executeMatrixRuns(config5, combinations, options) {
282363
282278
  startTime: new Date,
282364
282279
  promise: runPromise
282365
282280
  });
282366
- console.log(`\uD83D\uDD27 [DEBUG] Active runs after adding: ${activeRuns.size}`);
282367
- console.log(`\uD83D\uDD27 [DEBUG] Setting up completion handlers for runId: ${runId}`);
282368
282281
  runPromise.then(async (result) => {
282369
- console.log(`\uD83D\uDD27 [DEBUG] Run ${runId} completed successfully`);
282370
282282
  results.push(result);
282371
282283
  combinationResults.push(result);
282372
282284
  await saveRunResult(result, outputDir);
282373
282285
  const activeRun = activeRuns.get(runId);
282374
282286
  if (activeRun) {
282375
- console.log(`\uD83D\uDD27 [DEBUG] Cleaning up resources for runId: ${runId}`);
282376
282287
  try {
282377
282288
  await activeRun.context.cleanup();
282378
- console.log(`\uD83D\uDD27 [DEBUG] Context cleanup completed for runId: ${runId}`);
282379
- } catch (cleanupError) {
282380
- console.log(`\uD83D\uDD27 [DEBUG] Context cleanup failed for runId: ${runId}: ${cleanupError}`);
282381
- }
282289
+ } catch (cleanupError) {}
282382
282290
  activeRuns.delete(runId);
282383
- console.log(`\uD83D\uDD27 [DEBUG] Active runs after cleanup: ${activeRuns.size}`);
282384
282291
  if (global.gc) {
282385
282292
  global.gc();
282386
- console.log(`\uD83D\uDD27 [DEBUG] Forced garbage collection after runId: ${runId}`);
282387
282293
  }
282388
282294
  }
282389
282295
  }).catch(async (error47) => {
282390
- console.log(`\uD83D\uDD27 [DEBUG] Run ${runId} failed with error: ${error47.message}`);
282391
282296
  let resourceMetrics = {
282392
282297
  memoryUsage: 0,
282393
282298
  diskUsage: 0,
@@ -282406,7 +282311,11 @@ async function executeMatrixRuns(config5, combinations, options) {
282406
282311
  };
282407
282312
  }
282408
282313
  } catch (metricsError) {
282409
- console.log(`\uD83D\uDD27 [DEBUG] Failed to capture metrics for failed run ${runId}: ${metricsError}`);
282314
+ logger55.debug({
282315
+ src: "cli",
282316
+ command: "scenario:matrix",
282317
+ error: metricsError instanceof Error ? metricsError.message : String(metricsError)
282318
+ }, "Failed to collect resource metrics for failed run");
282410
282319
  }
282411
282320
  const failedResult = {
282412
282321
  runId,
@@ -282423,18 +282332,18 @@ async function executeMatrixRuns(config5, combinations, options) {
282423
282332
  await saveRunResult(failedResult, outputDir);
282424
282333
  const activeRun = activeRuns.get(runId);
282425
282334
  if (activeRun) {
282426
- console.log(`\uD83D\uDD27 [DEBUG] Cleaning up failed run resources for runId: ${runId}`);
282427
282335
  try {
282428
282336
  await activeRun.context.cleanup();
282429
- console.log(`\uD83D\uDD27 [DEBUG] Failed run context cleanup completed for runId: ${runId}`);
282430
282337
  } catch (cleanupError) {
282431
- console.log(`\uD83D\uDD27 [DEBUG] Failed run context cleanup failed for runId: ${runId}: ${cleanupError}`);
282338
+ logger55.debug({
282339
+ src: "cli",
282340
+ command: "scenario:matrix",
282341
+ error: cleanupError instanceof Error ? cleanupError.message : String(cleanupError)
282342
+ }, "Failed to cleanup context for failed run");
282432
282343
  }
282433
282344
  activeRuns.delete(runId);
282434
- console.log(`\uD83D\uDD27 [DEBUG] Active runs after failed run cleanup: ${activeRuns.size}`);
282435
282345
  if (global.gc) {
282436
282346
  global.gc();
282437
- console.log(`\uD83D\uDD27 [DEBUG] Forced garbage collection after failed runId: ${runId}`);
282438
282347
  }
282439
282348
  }
282440
282349
  if (!continueOnFailure) {
@@ -282442,13 +282351,9 @@ async function executeMatrixRuns(config5, combinations, options) {
282442
282351
  }
282443
282352
  });
282444
282353
  }
282445
- console.log(`\uD83D\uDD27 [DEBUG] Waiting for combination ${combination.id} to complete...`);
282446
282354
  try {
282447
282355
  await waitForCombinationCompletion(combination.id, activeRuns);
282448
- console.log(`\uD83D\uDD27 [DEBUG] Combination ${combination.id} completed successfully`);
282449
282356
  } catch (error47) {
282450
- const errorMessage = error47 instanceof Error ? error47.message : String(error47);
282451
- console.log(`\uD83D\uDD27 [DEBUG] Combination ${combination.id} failed: ${errorMessage}`);
282452
282357
  if (!continueOnFailure) {
282453
282358
  throw error47;
282454
282359
  }
@@ -282461,32 +282366,22 @@ async function executeMatrixRuns(config5, combinations, options) {
282461
282366
  return results;
282462
282367
  } finally {
282463
282368
  if (sharedServer) {
282464
- console.log(`\uD83D\uDD27 [DEBUG] Shutting down shared server on port ${sharedServer.port}...`);
282465
282369
  try {
282466
282370
  const { shutdownScenarioServer: shutdownScenarioServer2 } = await Promise.resolve().then(() => (init_runtime_factory(), exports_runtime_factory));
282467
282371
  await shutdownScenarioServer2(sharedServer.server, sharedServer.port);
282468
- console.log(`\uD83D\uDD27 [DEBUG] \u2705 Shared server shutdown completed`);
282469
- } catch (error47) {
282470
- console.log(`\uD83D\uDD27 [DEBUG] \u274C Failed to shutdown shared server: ${error47}`);
282471
- }
282372
+ } catch (error47) {}
282472
282373
  }
282473
282374
  resourceMonitor.stop();
282474
282375
  const finalSummary = processManager.getSummary();
282475
- console.log(`\uD83D\uDD27 [DEBUG] [ProcessManager] Final state: ${finalSummary.total} processes tracked`);
282476
- if (finalSummary.total > 0) {
282477
- console.log(`\uD83D\uDD27 [DEBUG] [ProcessManager] Process types:`, finalSummary.byType);
282478
- }
282376
+ if (finalSummary.total > 0) {}
282479
282377
  for (const activeRun of activeRuns.values()) {
282480
282378
  try {
282481
282379
  await activeRun.context.cleanup();
282482
- } catch (error47) {
282483
- console.warn(`Failed to cleanup run ${activeRun.runId}:`, error47);
282484
- }
282380
+ } catch (error47) {}
282485
282381
  }
282486
282382
  }
282487
282383
  }
282488
282384
  async function executeIndividualRun(runId, combination, baseScenario, outputDir, progressTracker, _resourceMonitor, timeout2, sharedServer, dynamicPlugins) {
282489
- console.log(`\uD83D\uDD27 [DEBUG] executeIndividualRun started for runId: ${runId} with timeout: ${timeout2}ms`);
282490
282385
  const startTime = new Date;
282491
282386
  const timeoutPromise = new Promise((_5, reject) => {
282492
282387
  setTimeout(() => {
@@ -282494,30 +282389,18 @@ async function executeIndividualRun(runId, combination, baseScenario, outputDir,
282494
282389
  }, timeout2);
282495
282390
  });
282496
282391
  try {
282497
- console.log(`\uD83D\uDD27 [DEBUG] executeIndividualRun: Starting progress tracking for runId: ${runId}`);
282498
282392
  progressTracker.startRun(runId, combination.id, combination.parameters);
282499
- console.log(`\uD83D\uDD27 [DEBUG] executeIndividualRun: About to create isolated environment for runId: ${runId}`);
282500
282393
  const context2 = await createIsolatedEnvironment(runId, outputDir);
282501
- console.log(`\uD83D\uDD27 [DEBUG] executeIndividualRun: Isolated environment created successfully for runId: ${runId}`);
282502
282394
  try {
282503
- console.log(`\uD83D\uDD27 [DEBUG] executeIndividualRun: About to write temporary scenario for runId: ${runId}`);
282504
282395
  await writeTemporaryScenario(context2.scenarioPath, baseScenario, combination.parameters);
282505
- console.log(`\uD83D\uDD27 [DEBUG] executeIndividualRun: Temporary scenario written successfully for runId: ${runId}`);
282506
- console.log(`\uD83D\uDD27 [DEBUG] executeIndividualRun: About to get resource snapshot before run for runId: ${runId}`);
282507
282396
  const resourcesBefore = await getResourceSnapshot();
282508
- console.log(`\uD83D\uDD27 [DEBUG] executeIndividualRun: Resource snapshot before run completed for runId: ${runId}`);
282509
- console.log(`\uD83D\uDD27 [DEBUG] executeIndividualRun: About to execute scenario with timeout for runId: ${runId}, timeout: ${timeout2}ms`);
282510
282397
  const scenarioResult = await Promise.race([
282511
282398
  executeScenarioWithTimeout(context2.scenarioPath, context2, timeout2, (progress, status) => {
282512
282399
  progressTracker.updateRunProgress(runId, progress, status);
282513
282400
  }, sharedServer, runId, dynamicPlugins),
282514
282401
  timeoutPromise
282515
282402
  ]);
282516
- console.log(`\uD83D\uDD27 [DEBUG] executeIndividualRun: Scenario execution completed successfully for runId: ${runId}`);
282517
- console.log(`\uD83D\uDD27 [DEBUG] executeIndividualRun: About to get resource snapshot after run for runId: ${runId}`);
282518
282403
  const resourcesAfter = await getResourceSnapshot();
282519
- console.log(`\uD83D\uDD27 [DEBUG] executeIndividualRun: Resource snapshot after run completed for runId: ${runId}`);
282520
- console.log(`\uD83D\uDD27 [DEBUG] executeIndividualRun: About to calculate metrics for runId: ${runId}`);
282521
282404
  const endTime = new Date;
282522
282405
  const duration3 = endTime.getTime() - startTime.getTime();
282523
282406
  const metrics = {
@@ -282526,9 +282409,7 @@ async function executeIndividualRun(runId, combination, baseScenario, outputDir,
282526
282409
  tokenCount: scenarioResult.tokenCount || 0,
282527
282410
  cpuUsage: resourcesAfter.cpuUsage
282528
282411
  };
282529
- console.log(`\uD83D\uDD27 [DEBUG] executeIndividualRun: About to mark run as completed for runId: ${runId}`);
282530
282412
  progressTracker.completeRun(runId, true, duration3);
282531
- console.log(`\uD83D\uDD27 [DEBUG] executeIndividualRun: Run marked as completed for runId: ${runId}`);
282532
282413
  const result = {
282533
282414
  runId,
282534
282415
  combinationId: combination.id,
@@ -282540,15 +282421,11 @@ async function executeIndividualRun(runId, combination, baseScenario, outputDir,
282540
282421
  scenarioResult,
282541
282422
  metrics
282542
282423
  };
282543
- console.log(`\uD83D\uDD27 [DEBUG] executeIndividualRun: About to return result for runId: ${runId}`);
282544
282424
  return result;
282545
282425
  } finally {
282546
- console.log(`\uD83D\uDD27 [DEBUG] executeIndividualRun: About to cleanup isolated environment for runId: ${runId}`);
282547
282426
  await context2.cleanup();
282548
- console.log(`\uD83D\uDD27 [DEBUG] executeIndividualRun: Isolated environment cleanup completed for runId: ${runId}`);
282549
282427
  }
282550
282428
  } catch (error47) {
282551
- console.log(`\uD83D\uDD27 [DEBUG] executeIndividualRun: Error occurred for runId: ${runId}, error: ${error47}`);
282552
282429
  const endTime = new Date;
282553
282430
  const duration3 = endTime.getTime() - startTime.getTime();
282554
282431
  progressTracker.completeRun(runId, false, duration3, error47 instanceof Error ? error47.message : String(error47));
@@ -282558,17 +282435,13 @@ async function executeIndividualRun(runId, combination, baseScenario, outputDir,
282558
282435
  tokenCount: 0,
282559
282436
  cpuUsage: 0
282560
282437
  };
282561
- try {
282562
- const resourcesAfter = await getResourceSnapshot();
282563
- resourceMetrics = {
282564
- memoryUsage: resourcesAfter.memoryUsage,
282565
- diskUsage: 0,
282566
- tokenCount: 0,
282567
- cpuUsage: resourcesAfter.cpuUsage
282568
- };
282569
- } catch (metricsError) {
282570
- console.log(`\uD83D\uDD27 [DEBUG] Failed to capture metrics for failed run ${runId}: ${metricsError}`);
282571
- }
282438
+ const resourcesAfter = await getResourceSnapshot();
282439
+ resourceMetrics = {
282440
+ memoryUsage: resourcesAfter.memoryUsage,
282441
+ diskUsage: 0,
282442
+ tokenCount: 0,
282443
+ cpuUsage: resourcesAfter.cpuUsage
282444
+ };
282572
282445
  return {
282573
282446
  runId,
282574
282447
  combinationId: combination.id,
@@ -282601,11 +282474,7 @@ async function executeScenarioWithTimeout(scenarioPath, context2, timeout2, onPr
282601
282474
  }
282602
282475
  onProgress(0.3, "Setting up environment...");
282603
282476
  const { LocalEnvironmentProvider: LocalEnvironmentProvider2 } = await Promise.resolve().then(() => (init_LocalEnvironmentProvider(), exports_LocalEnvironmentProvider));
282604
- const {
282605
- createScenarioServerAndAgent: createScenarioServerAndAgent2,
282606
- createScenarioAgent: createScenarioAgent2,
282607
- shutdownScenarioServer: shutdownScenarioServer2
282608
- } = await Promise.resolve().then(() => (init_runtime_factory(), exports_runtime_factory));
282477
+ const { createScenarioServerAndAgent: createScenarioServerAndAgent2, createScenarioAgent: createScenarioAgent2, shutdownScenarioServer: shutdownScenarioServer2 } = await Promise.resolve().then(() => (init_runtime_factory(), exports_runtime_factory));
282609
282478
  const originalEnv = process.env;
282610
282479
  process.env = {
282611
282480
  ...originalEnv,
@@ -282621,14 +282490,10 @@ async function executeScenarioWithTimeout(scenarioPath, context2, timeout2, onPr
282621
282490
  let port;
282622
282491
  let serverCreated = false;
282623
282492
  if (sharedServer) {
282624
- console.log(`\uD83D\uDD27 [DEBUG] Using shared server on port ${sharedServer.port} for agent creation`);
282625
- console.log(`\uD83D\uDD27 [DEBUG] Dynamic plugins for agent: ${JSON.stringify(dynamicPlugins)}`);
282626
282493
  server2 = sharedServer.server;
282627
282494
  port = sharedServer.port;
282628
282495
  process.env.SERVER_PORT = port.toString();
282629
- console.log(`\uD83D\uDD27 [DEBUG] Set SERVER_PORT environment variable to ${port} for shared server`);
282630
282496
  const uniqueAgentName = `scenario-agent-${runId}`;
282631
- console.log(`\uD83D\uDD27 [DEBUG] Creating unique agent: ${uniqueAgentName} for run: ${runId}`);
282632
282497
  const agentResult = await createScenarioAgent2(server2, uniqueAgentName, dynamicPlugins || [
282633
282498
  "@elizaos/plugin-sql",
282634
282499
  "@elizaos/plugin-openai",
@@ -282637,11 +282502,8 @@ async function executeScenarioWithTimeout(scenarioPath, context2, timeout2, onPr
282637
282502
  runtime = agentResult.runtime;
282638
282503
  agentId = agentResult.agentId;
282639
282504
  serverCreated = false;
282640
- console.log(`\uD83D\uDD27 [DEBUG] Agent ${agentId} created successfully on shared server port ${port}`);
282641
282505
  } else {
282642
282506
  const uniqueAgentName = `scenario-agent-${runId}`;
282643
- console.log(`\uD83D\uDD27 [DEBUG] Creating single scenario with unique agent: ${uniqueAgentName} for run: ${runId}`);
282644
- console.log(`\uD83D\uDD27 [DEBUG] Dynamic plugins for single scenario: ${JSON.stringify(dynamicPlugins)}`);
282645
282507
  const result2 = await createScenarioServerAndAgent2(null, 3000, dynamicPlugins || [
282646
282508
  "@elizaos/plugin-sql",
282647
282509
  "@elizaos/plugin-openai",
@@ -282653,7 +282515,6 @@ async function executeScenarioWithTimeout(scenarioPath, context2, timeout2, onPr
282653
282515
  port = result2.port;
282654
282516
  serverCreated = result2.createdServer;
282655
282517
  }
282656
- console.log(`\uD83D\uDD27 [DEBUG] Creating LocalEnvironmentProvider with port: ${port}`);
282657
282518
  const provider = new LocalEnvironmentProvider2(server2, agentId, runtime, port);
282658
282519
  onProgress(0.5, "Setting up scenario environment...");
282659
282520
  await provider.setup(scenario);
@@ -282668,13 +282529,10 @@ async function executeScenarioWithTimeout(scenarioPath, context2, timeout2, onPr
282668
282529
  const step = scenario.run[i3];
282669
282530
  const executionResult = executionResults[i3];
282670
282531
  if (step.evaluations && step.evaluations.length > 0) {
282671
- console.log(`\uD83D\uDD27 [DEBUG] Running ${step.evaluations.length} evaluations for step ${i3}`);
282672
282532
  try {
282673
282533
  const stepEvaluations = await evaluationEngine.runEnhancedEvaluations(step.evaluations, executionResult);
282674
282534
  evaluationResults.push(...stepEvaluations);
282675
- console.log(`\uD83D\uDD27 [DEBUG] Step ${i3} evaluations completed: ${stepEvaluations.length} results`);
282676
282535
  } catch (evaluationError) {
282677
- console.log(`\uD83D\uDD27 [DEBUG] Step ${i3} evaluations failed: ${evaluationError}`);
282678
282536
  evaluationResults.push({
282679
282537
  evaluator_type: "step_evaluation_failed",
282680
282538
  success: false,
@@ -282695,17 +282553,11 @@ async function executeScenarioWithTimeout(scenarioPath, context2, timeout2, onPr
282695
282553
  success3 = evaluationResults.length > 0 && evaluationResults.every((r2) => r2.success);
282696
282554
  }
282697
282555
  if (serverCreated) {
282698
- console.log(`\uD83D\uDD27 [DEBUG] Shutting down individual scenario server on port ${port}`);
282699
282556
  await shutdownScenarioServer2(server2, port);
282700
282557
  } else {
282701
- console.log(`\uD83D\uDD27 [DEBUG] Stopping agent ${agentId} on shared server (keeping server running)`);
282702
282558
  if (server2 && typeof server2.unregisterAgent === "function") {
282703
- console.log(`\uD83D\uDD27 [DEBUG] Calling server.unregisterAgent(${agentId})`);
282704
282559
  server2.unregisterAgent(agentId);
282705
- console.log(`\uD83D\uDD27 [DEBUG] \u2705 Agent ${agentId} unregistered successfully`);
282706
- } else {
282707
- console.log(`\uD83D\uDD27 [DEBUG] \u26A0\uFE0F Server missing unregisterAgent method`);
282708
- }
282560
+ } else {}
282709
282561
  }
282710
282562
  onProgress(1, "Complete");
282711
282563
  const result = {
@@ -282751,24 +282603,13 @@ function estimateTokenCount(executionResults) {
282751
282603
  }
282752
282604
  async function waitForAvailableSlot(activeRuns, maxParallel) {
282753
282605
  while (activeRuns.size >= maxParallel) {
282754
- console.log(`\uD83D\uDD27 [DEBUG] Waiting for slot... activeRuns.size=${activeRuns.size}, maxParallel=${maxParallel}`);
282755
282606
  const promises4 = Array.from(activeRuns.values()).map((run) => run.promise);
282756
282607
  if (promises4.length === 0) {
282757
- console.log(`\uD83D\uDD27 [DEBUG] No active promises found, breaking out of wait loop`);
282758
- break;
282759
- }
282760
- console.log(`\uD83D\uDD27 [DEBUG] Waiting for one of ${promises4.length} promises to complete...`);
282761
- try {
282762
- await Promise.race(promises4);
282763
- console.log(`\uD83D\uDD27 [DEBUG] A promise completed, checking for cleanup...`);
282764
- await new Promise((resolve14) => setTimeout(resolve14, 100));
282765
- console.log(`\uD83D\uDD27 [DEBUG] After cleanup wait, activeRuns.size=${activeRuns.size}`);
282766
- } catch (error47) {
282767
- console.log(`\uD83D\uDD27 [DEBUG] Promise race failed: ${error47}`);
282768
282608
  break;
282769
282609
  }
282610
+ await Promise.race(promises4);
282611
+ await new Promise((resolve14) => setTimeout(resolve14, 100));
282770
282612
  }
282771
- console.log(`\uD83D\uDD27 [DEBUG] Available slot found! activeRuns.size=${activeRuns.size}`);
282772
282613
  }
282773
282614
  async function waitForCombinationCompletion(combinationId, activeRuns) {
282774
282615
  const combinationRuns = Array.from(activeRuns.values()).filter((run) => run.combinationId === combinationId);
@@ -282927,12 +282768,14 @@ function validateCreateOptions(options) {
282927
282768
  return initOptionsSchema.parse(options);
282928
282769
  } catch (error47) {
282929
282770
  if (error47 instanceof exports_external.ZodError) {
282930
- const typeError = error47.issues.find((e2) => e2.path.includes("type") && (e2.code === "invalid_enum_value" || e2.code === "invalid_value"));
282931
- if (typeError && (("received" in typeError) || ("values" in typeError))) {
282771
+ const typeError = error47.issues.find((e2) => e2.path.includes("type") && (e2.code === "invalid_type" || e2.code === "invalid_value"));
282772
+ if (typeError) {
282932
282773
  const enumError = typeError;
282933
282774
  const receivedValue = enumError.received || "unknown";
282934
- const expectedValues = enumError.options || enumError.values || [];
282935
- throw new Error(`Invalid type '${receivedValue}'. Expected: ${expectedValues.join(", ")}`);
282775
+ const expectedValue = enumError.expected || "unknown";
282776
+ const expectedValues = enumError.options || [];
282777
+ const expectedList = expectedValues.length > 0 ? expectedValues.join(", ") : expectedValue;
282778
+ throw new Error(`Invalid type '${receivedValue}'. Expected: ${expectedList}`);
282936
282779
  }
282937
282780
  }
282938
282781
  throw error47;
@@ -283876,7 +283719,8 @@ async function createAgent(agentName, targetDir, isNonInteractive = false) {
283876
283719
  await fs13.access(agentFilePath);
283877
283720
  throw new Error(`Agent file ${agentFilePath} already exists`);
283878
283721
  } catch (error47) {
283879
- if (error47.code !== "ENOENT") {
283722
+ const errorWithCode = error47;
283723
+ if (errorWithCode.code !== "ENOENT") {
283880
283724
  throw error47;
283881
283725
  }
283882
283726
  }
@@ -292732,10 +292576,11 @@ async function startDevMode(options) {
292732
292576
  }
292733
292577
  const rebuildAndRestart = async () => {
292734
292578
  try {
292735
- if (rebuildAndRestart._inFlight) {
292579
+ const rebuildFn = rebuildAndRestart;
292580
+ if (rebuildFn._inFlight) {
292736
292581
  return;
292737
292582
  }
292738
- rebuildAndRestart._inFlight = true;
292583
+ rebuildFn._inFlight = true;
292739
292584
  await serverManager2.stop();
292740
292585
  const hasLocalVite2 = fs17.existsSync(path36.join(cwd, "vite.config.ts")) || fs17.existsSync(path36.join(cwd, "vite.config.js"));
292741
292586
  const shouldStartClient2 = (isProject || isMonorepo) && hasLocalClientSource(cwd) || isPlugin && hasLocalVite2;
@@ -292756,7 +292601,8 @@ async function startDevMode(options) {
292756
292601
  await serverManager2.start(cliArgs);
292757
292602
  }
292758
292603
  } finally {
292759
- rebuildAndRestart._inFlight = false;
292604
+ const rebuildFn = rebuildAndRestart;
292605
+ rebuildFn._inFlight = false;
292760
292606
  }
292761
292607
  };
292762
292608
  if (isProject || isPlugin || isMonorepo) {
@@ -302013,8 +301859,9 @@ class AnalysisEngine {
302013
301859
  const capabilityStats = {};
302014
301860
  runs.forEach((run) => {
302015
301861
  run.evaluations.forEach((evaluation) => {
302016
- const capability = evaluation.details?.capability || evaluation.evaluator_type;
302017
- if (capability) {
301862
+ const capabilityRaw = evaluation.details?.capability || evaluation.evaluator_type;
301863
+ const capability = typeof capabilityRaw === "string" ? capabilityRaw : String(capabilityRaw || "unknown");
301864
+ if (capability && capability !== "unknown") {
302018
301865
  if (!capabilityStats[capability]) {
302019
301866
  capabilityStats[capability] = { total: 0, passed: 0 };
302020
301867
  }
@@ -302078,13 +301925,16 @@ class AnalysisEngine {
302078
301925
  }
302079
301926
  const pathParts = parameterPath.split(".");
302080
301927
  let value = parameters;
301928
+ let currentValue = value;
302081
301929
  for (const part of pathParts) {
302082
- if (value && typeof value === "object" && part in value) {
302083
- value = value[part];
301930
+ if (currentValue && typeof currentValue === "object" && currentValue !== null && !Array.isArray(currentValue) && part in currentValue) {
301931
+ const valueObj = currentValue;
301932
+ currentValue = valueObj[part];
302084
301933
  } else {
302085
301934
  return;
302086
301935
  }
302087
301936
  }
301937
+ return currentValue;
302088
301938
  return value;
302089
301939
  }
302090
301940
  serializeParameterValue(value) {
@@ -311519,19 +311369,29 @@ function transformMatrixRunResultToScenarioRunResult(matrixResult) {
311519
311369
  const firstExecutionResult = scenarioResult.executionResults[0];
311520
311370
  if (firstExecutionResult) {
311521
311371
  if (firstExecutionResult.trajectory) {
311522
- trajectory = firstExecutionResult.trajectory.map((step) => ({
311523
- type: step.type,
311524
- timestamp: step.timestamp,
311525
- content: step.content || ""
311526
- }));
311372
+ trajectory = firstExecutionResult.trajectory.map((step) => {
311373
+ const stepType = step.type === "action" || step.type === "thought" || step.type === "observation" ? step.type : "observation";
311374
+ return {
311375
+ type: stepType,
311376
+ timestamp: step.timestamp,
311377
+ content: typeof step.content === "string" ? step.content : String(step.content || "")
311378
+ };
311379
+ });
311527
311380
  }
311528
311381
  finalResponse = firstExecutionResult.stdout || "";
311529
311382
  }
311530
311383
  }
311531
- if (scenarioResult && scenarioResult.evaluations) {
311532
- evaluations = scenarioResult.evaluations.filter((evaluation) => {
311533
- return evaluation && typeof evaluation.evaluator_type === "string" && typeof evaluation.success === "boolean" && typeof evaluation.summary === "string" && evaluation.details !== undefined;
311384
+ const scenarioResultWithEvaluations = scenarioResult;
311385
+ if (scenarioResultWithEvaluations && scenarioResultWithEvaluations.evaluations) {
311386
+ const filteredEvaluations = scenarioResultWithEvaluations.evaluations.filter((evaluation) => {
311387
+ return evaluation && typeof evaluation.evaluator_type === "string" && typeof evaluation.success === "boolean" && typeof evaluation.summary === "string" && evaluation.details !== undefined && typeof evaluation.details === "object" && evaluation.details !== null;
311534
311388
  });
311389
+ evaluations = filteredEvaluations.map((evaluation) => ({
311390
+ evaluator_type: evaluation.evaluator_type,
311391
+ success: evaluation.success,
311392
+ summary: evaluation.summary,
311393
+ details: evaluation.details
311394
+ }));
311535
311395
  }
311536
311396
  let llmCallCount = 0;
311537
311397
  if (trajectory.length > 0) {
@@ -311738,10 +311598,11 @@ async function validateInputDirectory(inputDir) {
311738
311598
  throw new Error(`Input path is not a directory: ${inputDir}`);
311739
311599
  }
311740
311600
  } catch (error47) {
311741
- if (error47.code === "ENOENT") {
311601
+ const errorWithCode = error47;
311602
+ if (errorWithCode.code === "ENOENT") {
311742
311603
  throw new Error(`Input directory not found: ${inputDir}`);
311743
311604
  }
311744
- throw new Error(`Cannot access input directory: ${inputDir}. ${error47.message}`);
311605
+ throw new Error(`Cannot access input directory: ${inputDir}. ${error47 instanceof Error ? error47.message : String(error47)}`);
311745
311606
  }
311746
311607
  }
311747
311608
  async function ingestRunData(inputDir) {
@@ -311849,7 +311710,8 @@ function collectParameterPaths(obj, currentPath, variations, maxDepth = 3, curre
311849
311710
  if (currentDepth >= maxDepth || obj === null || typeof obj !== "object") {
311850
311711
  return;
311851
311712
  }
311852
- Object.entries(obj).forEach(([key, value]) => {
311713
+ const objRecord = obj;
311714
+ Object.entries(objRecord).forEach(([key, value]) => {
311853
311715
  const paramPath = currentPath ? `${currentPath}.${key}` : key;
311854
311716
  if (typeof value === "object" && value !== null && !Array.isArray(value)) {
311855
311717
  collectParameterPaths(value, paramPath, variations, maxDepth, currentDepth + 1);
@@ -311857,7 +311719,8 @@ function collectParameterPaths(obj, currentPath, variations, maxDepth = 3, curre
311857
311719
  if (!variations.has(paramPath)) {
311858
311720
  variations.set(paramPath, new Set);
311859
311721
  }
311860
- variations.get(paramPath).add(value);
311722
+ const valueToAdd = value;
311723
+ variations.get(paramPath).add(valueToAdd);
311861
311724
  }
311862
311725
  });
311863
311726
  }
@@ -311955,175 +311818,162 @@ function isPlugin(module) {
311955
311818
  if (module && typeof module === "object" && typeof module.name === "string" && typeof module.description === "string") {
311956
311819
  return true;
311957
311820
  }
311958
- if (module && typeof module === "object" && module.default && typeof module.default === "object" && typeof module.default.name === "string" && typeof module.default.description === "string") {
311821
+ const moduleObj = module;
311822
+ if (module && typeof module === "object" && moduleObj.default && typeof moduleObj.default === "object" && typeof moduleObj.default.name === "string" && typeof moduleObj.default.description === "string") {
311959
311823
  return true;
311960
311824
  }
311961
311825
  for (const key in module) {
311962
- if (key !== "default" && module[key] && typeof module[key] === "object" && typeof module[key].name === "string" && typeof module[key].description === "string") {
311826
+ const value = moduleObj[key];
311827
+ if (key !== "default" && value && typeof value === "object" && typeof value.name === "string" && typeof value.description === "string") {
311963
311828
  return true;
311964
311829
  }
311965
311830
  }
311966
311831
  return false;
311967
311832
  }
311968
311833
  function extractPlugin(module) {
311969
- if (module && typeof module === "object" && typeof module.name === "string" && typeof module.description === "string") {
311834
+ const moduleObj = module;
311835
+ if (module && typeof module === "object" && typeof moduleObj.name === "string" && typeof moduleObj.description === "string") {
311970
311836
  return module;
311971
311837
  }
311972
- if (module && typeof module === "object" && module.default && typeof module.default === "object" && typeof module.default.name === "string" && typeof module.default.description === "string") {
311973
- return module.default;
311838
+ if (module && typeof module === "object" && moduleObj.default && typeof moduleObj.default === "object" && typeof moduleObj.default.name === "string" && typeof moduleObj.default.description === "string") {
311839
+ return moduleObj.default;
311974
311840
  }
311975
311841
  for (const key in module) {
311976
- if (key !== "default" && module[key] && typeof module[key] === "object" && typeof module[key].name === "string" && typeof module[key].description === "string") {
311977
- return module[key];
311842
+ const value = moduleObj[key];
311843
+ if (key !== "default" && value && typeof value === "object" && typeof value.name === "string" && typeof value.description === "string") {
311844
+ return value;
311978
311845
  }
311979
311846
  }
311980
311847
  throw new Error("Could not extract plugin from module");
311981
311848
  }
311982
311849
  async function loadProject(dir) {
311983
- try {
311984
- const dirInfo = detectDirectoryType(dir);
311985
- if (!dirInfo.hasPackageJson) {
311986
- throw new Error(`No package.json found in ${dir}`);
311987
- }
311988
- const packageJson = JSON.parse(fs31.readFileSync(path62.join(dir, "package.json"), "utf8"));
311989
- const main = packageJson.main;
311990
- if (!main) {
311991
- logger42.warn({ src: "cli", util: "project" }, "No main field found in package.json, using default character");
311992
- const defaultCharacterName = "Eliza (Default)";
311993
- const elizaCharacter = getDefaultCharacter();
311994
- const defaultAgent = {
311995
- character: {
311996
- ...elizaCharacter,
311997
- id: stringToUuid(defaultCharacterName),
311998
- name: defaultCharacterName
311999
- },
312000
- init: async () => {
312001
- logger42.info({ src: "cli", util: "project" }, "Initializing default Eliza character");
312002
- }
312003
- };
312004
- return {
312005
- agents: [defaultAgent],
312006
- dir
312007
- };
312008
- }
312009
- const entryPoints = [
312010
- path62.join(dir, main),
312011
- path62.join(dir, "dist/index.js"),
312012
- path62.join(dir, "src/index.ts"),
312013
- path62.join(dir, "src/index.js"),
312014
- path62.join(dir, "index.ts"),
312015
- path62.join(dir, "index.js")
312016
- ];
312017
- let projectModule = null;
312018
- for (const entryPoint of entryPoints) {
312019
- if (fs31.existsSync(entryPoint)) {
312020
- try {
312021
- const importPath = path62.resolve(entryPoint);
312022
- const importUrl = process.platform === "win32" ? "file:///" + importPath.replace(/\\/g, "/") : "file://" + importPath;
312023
- projectModule = await import(importUrl);
312024
- logger42.info({ src: "cli", util: "project", entryPoint }, "Loaded project");
312025
- const exportKeys = Object.keys(projectModule);
312026
- logger42.debug({ src: "cli", util: "project", exportKeys }, "Module exports");
312027
- if (exportKeys.includes("default")) {
312028
- logger42.debug({ src: "cli", util: "project", type: typeof projectModule.default }, "Default export type");
312029
- if (typeof projectModule.default === "object" && projectModule.default !== null) {
312030
- logger42.debug({ src: "cli", util: "project", keys: Object.keys(projectModule.default) }, "Default export keys");
312031
- }
312032
- }
312033
- break;
312034
- } catch (error47) {
312035
- logger42.warn({
312036
- src: "cli",
312037
- util: "project",
312038
- error: error47 instanceof Error ? error47.message : String(error47),
312039
- entryPoint
312040
- }, "Failed to import project");
312041
- }
311850
+ const dirInfo = detectDirectoryType(dir);
311851
+ if (!dirInfo.hasPackageJson) {
311852
+ throw new Error(`No package.json found in ${dir}`);
311853
+ }
311854
+ const packageJson = JSON.parse(fs31.readFileSync(path62.join(dir, "package.json"), "utf8"));
311855
+ const main = packageJson.main;
311856
+ if (!main) {
311857
+ logger42.warn({ src: "cli", util: "project" }, "No main field found in package.json, using default character");
311858
+ const defaultCharacterName = "Eliza (Default)";
311859
+ const elizaCharacter = getDefaultCharacter();
311860
+ const defaultAgent = {
311861
+ character: {
311862
+ ...elizaCharacter,
311863
+ id: stringToUuid(defaultCharacterName),
311864
+ name: defaultCharacterName
311865
+ },
311866
+ init: async () => {
311867
+ logger42.info({ src: "cli", util: "project" }, "Initializing default Eliza character");
312042
311868
  }
312043
- }
312044
- if (!projectModule) {
312045
- throw new Error("Could not find project entry point");
312046
- }
312047
- const moduleIsPlugin = isPlugin(projectModule);
312048
- logger42.debug({ src: "cli", util: "project", moduleIsPlugin }, "Is this a plugin?");
312049
- if (moduleIsPlugin) {
312050
- logger42.info({ src: "cli", util: "project" }, "Detected plugin module instead of project");
311869
+ };
311870
+ return {
311871
+ agents: [defaultAgent],
311872
+ dir
311873
+ };
311874
+ }
311875
+ const entryPoints = [
311876
+ path62.join(dir, main),
311877
+ path62.join(dir, "dist/index.js"),
311878
+ path62.join(dir, "src/index.ts"),
311879
+ path62.join(dir, "src/index.js"),
311880
+ path62.join(dir, "index.ts"),
311881
+ path62.join(dir, "index.js")
311882
+ ];
311883
+ let projectModule = null;
311884
+ for (const entryPoint of entryPoints) {
311885
+ if (fs31.existsSync(entryPoint)) {
312051
311886
  try {
312052
- const plugin = extractPlugin(projectModule);
312053
- logger42.debug({ src: "cli", util: "project", name: plugin.name, description: plugin.description }, "Found plugin");
312054
- logger42.debug({ src: "cli", util: "project", keys: Object.keys(plugin) }, "Plugin has the following properties");
312055
- const completePlugin = {
312056
- ...plugin,
312057
- name: plugin.name || "unknown-plugin",
312058
- description: plugin.description || "No description",
312059
- init: plugin.init || (async () => {
312060
- logger42.info({ src: "cli", util: "project", pluginName: plugin.name }, "Dummy init for plugin");
312061
- })
312062
- };
312063
- const characterName = "Eliza (Test Mode)";
312064
- const elizaCharacter = getDefaultCharacter();
312065
- const testCharacter = {
312066
- ...elizaCharacter,
312067
- id: stringToUuid(characterName),
312068
- name: characterName,
312069
- system: `${elizaCharacter.system} Testing the plugin: ${completePlugin.name}.`
312070
- };
312071
- logger42.info({ src: "cli", util: "project", pluginName: completePlugin.name }, "Using Eliza character as test agent for plugin");
312072
- const testAgent = {
312073
- character: testCharacter,
312074
- plugins: [completePlugin],
312075
- init: async () => {
312076
- logger42.info({ src: "cli", util: "project", pluginName: completePlugin.name }, "Initializing Eliza test agent for plugin");
311887
+ const importPath = path62.resolve(entryPoint);
311888
+ const importUrl = process.platform === "win32" ? "file:///" + importPath.replace(/\\/g, "/") : "file://" + importPath;
311889
+ projectModule = await import(importUrl);
311890
+ logger42.info({ src: "cli", util: "project", entryPoint }, "Loaded project");
311891
+ const exportKeys = Object.keys(projectModule);
311892
+ logger42.debug({ src: "cli", util: "project", exportKeys }, "Module exports");
311893
+ if (exportKeys.includes("default")) {
311894
+ logger42.debug({ src: "cli", util: "project", type: typeof projectModule.default }, "Default export type");
311895
+ if (typeof projectModule.default === "object" && projectModule.default !== null) {
311896
+ logger42.debug({ src: "cli", util: "project", keys: Object.keys(projectModule.default) }, "Default export keys");
312077
311897
  }
312078
- };
312079
- return {
312080
- agents: [testAgent],
312081
- dir,
312082
- isPlugin: true,
312083
- pluginModule: completePlugin
312084
- };
311898
+ }
311899
+ break;
312085
311900
  } catch (error47) {
312086
- logger42.error({
311901
+ logger42.warn({
312087
311902
  src: "cli",
312088
311903
  util: "project",
312089
- error: error47 instanceof Error ? error47.message : String(error47)
312090
- }, "Error extracting plugin from module");
312091
- throw error47;
311904
+ error: error47 instanceof Error ? error47.message : String(error47),
311905
+ entryPoint
311906
+ }, "Failed to import project");
311907
+ }
311908
+ }
311909
+ }
311910
+ if (!projectModule) {
311911
+ throw new Error("Could not find project entry point");
311912
+ }
311913
+ const moduleIsPlugin = isPlugin(projectModule);
311914
+ logger42.debug({ src: "cli", util: "project", moduleIsPlugin }, "Is this a plugin?");
311915
+ if (moduleIsPlugin) {
311916
+ logger42.info({ src: "cli", util: "project" }, "Detected plugin module instead of project");
311917
+ const plugin = extractPlugin(projectModule);
311918
+ logger42.debug({ src: "cli", util: "project", name: plugin.name, description: plugin.description }, "Found plugin");
311919
+ logger42.debug({ src: "cli", util: "project", keys: Object.keys(plugin) }, "Plugin has the following properties");
311920
+ const completePlugin = {
311921
+ ...plugin,
311922
+ name: plugin.name || "unknown-plugin",
311923
+ description: plugin.description || "No description",
311924
+ init: plugin.init || (async () => {
311925
+ logger42.info({ src: "cli", util: "project", pluginName: plugin.name }, "Dummy init for plugin");
311926
+ })
311927
+ };
311928
+ const characterName = "Eliza (Test Mode)";
311929
+ const elizaCharacter = getDefaultCharacter();
311930
+ const testCharacter = {
311931
+ ...elizaCharacter,
311932
+ id: stringToUuid(characterName),
311933
+ name: characterName,
311934
+ system: `${elizaCharacter.system} Testing the plugin: ${completePlugin.name}.`
311935
+ };
311936
+ logger42.info({ src: "cli", util: "project", pluginName: completePlugin.name }, "Using Eliza character as test agent for plugin");
311937
+ const testAgent = {
311938
+ character: testCharacter,
311939
+ plugins: [completePlugin],
311940
+ init: async () => {
311941
+ logger42.info({ src: "cli", util: "project", pluginName: completePlugin.name }, "Initializing Eliza test agent for plugin");
312092
311942
  }
312093
- }
312094
- const agents = [];
312095
- if (projectModule.default && typeof projectModule.default === "object" && Array.isArray(projectModule.default.agents)) {
312096
- agents.push(...projectModule.default.agents);
312097
- logger42.debug({ src: "cli", util: "project", count: agents.length }, "Found agents in default export agents array");
312098
- } else {
312099
- for (const [key, value] of Object.entries(projectModule)) {
312100
- if (key === "default" && value && typeof value === "object") {
312101
- if (value.character && value.init) {
312102
- agents.push(value);
312103
- logger42.debug({ src: "cli", util: "project" }, "Found agent in default export (single agent)");
312104
- }
312105
- } else if (value && typeof value === "object" && value.character && value.init) {
311943
+ };
311944
+ return {
311945
+ agents: [testAgent],
311946
+ dir,
311947
+ isPlugin: true,
311948
+ pluginModule: completePlugin
311949
+ };
311950
+ }
311951
+ const agents = [];
311952
+ const defaultExport = projectModule.default;
311953
+ if (defaultExport && typeof defaultExport === "object" && Array.isArray(defaultExport.agents)) {
311954
+ agents.push(...defaultExport.agents);
311955
+ logger42.debug({ src: "cli", util: "project", count: agents.length }, "Found agents in default export agents array");
311956
+ } else {
311957
+ for (const [key, value] of Object.entries(projectModule)) {
311958
+ if (key === "default" && value && typeof value === "object") {
311959
+ if (value.character && value.init) {
312106
311960
  agents.push(value);
312107
- logger42.debug({ src: "cli", util: "project", key }, "Found agent in named export");
311961
+ logger42.debug({ src: "cli", util: "project" }, "Found agent in default export (single agent)");
312108
311962
  }
311963
+ } else if (value && typeof value === "object" && value.character && value.init) {
311964
+ agents.push(value);
311965
+ logger42.debug({ src: "cli", util: "project", key }, "Found agent in named export");
312109
311966
  }
312110
311967
  }
312111
- if (agents.length === 0) {
312112
- throw new Error("No agents found in project");
312113
- }
312114
- const project = {
312115
- agents,
312116
- dir
312117
- };
312118
- return project;
312119
- } catch (error47) {
312120
- logger42.error({
312121
- src: "cli",
312122
- util: "project",
312123
- error: error47 instanceof Error ? error47.message : String(error47)
312124
- }, "Error loading project");
312125
- throw error47;
312126
311968
  }
311969
+ if (agents.length === 0) {
311970
+ throw new Error("No agents found in project");
311971
+ }
311972
+ const project = {
311973
+ agents,
311974
+ dir
311975
+ };
311976
+ return project;
312127
311977
  }
312128
311978
 
312129
311979
  // src/commands/start/index.ts
@@ -312263,7 +312113,8 @@ import { spawn as spawn4 } from "child_process";
312263
312113
  import { logger as logger44 } from "@elizaos/core";
312264
312114
  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) => {
312265
312115
  const cmd = commandArgs[commandArgs.length - 1];
312266
- const raw = cmd?.parent?.rawArgs ?? cmd?.rawArgs ?? process.argv;
312116
+ const cmdWithRawArgs = cmd;
312117
+ const raw = cmdWithRawArgs?.parent?.rawArgs ?? cmdWithRawArgs?.rawArgs ?? process.argv;
312267
312118
  const idx = raw.findIndex((arg) => arg === "phala");
312268
312119
  const args = idx >= 0 ? raw.slice(idx + 1) : Array.isArray(commandArgs[0]) ? commandArgs[0] : [];
312269
312120
  try {
@@ -312629,10 +312480,11 @@ async function runTypeCheck(projectPath, strict = true) {
312629
312480
  warnings: stderr.includes("warning") ? [stderr] : []
312630
312481
  };
312631
312482
  } catch (error47) {
312632
- logger47.error({ error: error47 }, "TypeScript validation failed:");
312483
+ const errorMessage = error47 instanceof Error ? error47.message : String(error47);
312484
+ logger47.error({ error: errorMessage }, "TypeScript validation failed:");
312633
312485
  return {
312634
312486
  success: false,
312635
- errors: [`TypeScript validation error: ${error47.message}`],
312487
+ errors: [`TypeScript validation error: ${errorMessage}`],
312636
312488
  warnings: []
312637
312489
  };
312638
312490
  }
@@ -312703,7 +312555,7 @@ async function runComponentTests(testPath, options, projectInfo) {
312703
312555
  init_utils2();
312704
312556
  import { logger as logger49 } from "@elizaos/core";
312705
312557
  var dotenv5 = __toESM(require_main(), 1);
312706
- import { AgentServer as AgentServer2, jsonToCharacter, loadCharacterTryPath as loadCharacterTryPath2 } from "@elizaos/server";
312558
+ import { AgentServer as AgentServer2 } from "@elizaos/server";
312707
312559
  import * as fs34 from "fs";
312708
312560
  import path68 from "path";
312709
312561
  async function runE2eTests(testPath, options, projectInfo) {
@@ -312765,21 +312617,7 @@ async function runE2eTests(testPath, options, projectInfo) {
312765
312617
  logger49.info({ src: "cli", command: "test-e2e" }, "Creating server instance");
312766
312618
  server2 = new AgentServer2;
312767
312619
  logger49.info({ src: "cli", command: "test-e2e" }, "Server instance created");
312768
- logger49.info({ src: "cli", command: "test-e2e" }, "Initializing server");
312769
- try {
312770
- await server2.initialize({
312771
- dataDir: elizaDbDir,
312772
- postgresUrl
312773
- });
312774
- logger49.info({ src: "cli", command: "test-e2e" }, "Server initialized successfully");
312775
- } catch (initError) {
312776
- logger49.error({
312777
- src: "cli",
312778
- command: "test-e2e",
312779
- error: initError instanceof Error ? initError.message : String(initError)
312780
- }, "Server initialization failed");
312781
- throw initError;
312782
- }
312620
+ logger49.info({ src: "cli", command: "test-e2e" }, "Server instance ready");
312783
312621
  let project;
312784
312622
  try {
312785
312623
  logger49.info({ src: "cli", command: "test-e2e" }, "Attempting to load project or plugin");
@@ -312794,15 +312632,6 @@ async function runE2eTests(testPath, options, projectInfo) {
312794
312632
  logger49.warn({ src: "cli", command: "test-e2e" }, "No agents found in project configuration; falling back to default Eliza character for tests");
312795
312633
  }
312796
312634
  logger49.info({ src: "cli", command: "test-e2e", agentCount: project.agents?.length || 0 }, "Found agents");
312797
- logger49.info({ src: "cli", command: "test-e2e" }, "Setting up server properties");
312798
- server2.startAgent = async (character2) => {
312799
- logger49.info({ src: "cli", command: "test-e2e", characterName: character2.name }, "Starting agent for character");
312800
- const runtimes2 = await server2.startAgents([character2], [], { isTestMode: true });
312801
- return runtimes2[0];
312802
- };
312803
- server2.loadCharacterTryPath = loadCharacterTryPath2;
312804
- server2.jsonToCharacter = jsonToCharacter;
312805
- logger49.info({ src: "cli", command: "test-e2e" }, "Server properties set up");
312806
312635
  logger49.info({ src: "cli", command: "test-e2e" }, "Starting server");
312807
312636
  try {
312808
312637
  await server2.start(options.port ? { port: options.port } : undefined);
@@ -312834,7 +312663,12 @@ async function runE2eTests(testPath, options, projectInfo) {
312834
312663
  throw new Error("Plugin module could not be loaded for testing.");
312835
312664
  }
312836
312665
  const defaultElizaCharacter = getDefaultCharacter();
312837
- const startedRuntimes = await server2.startAgents([defaultElizaCharacter], [pluginUnderTest], { isTestMode: true });
312666
+ const startedRuntimes = await server2.startAgents([
312667
+ {
312668
+ character: defaultElizaCharacter,
312669
+ plugins: [pluginUnderTest]
312670
+ }
312671
+ ], { isTestMode: true });
312838
312672
  const runtime = startedRuntimes[0];
312839
312673
  runtimes.push(runtime);
312840
312674
  projectAgents.push({
@@ -312957,18 +312791,8 @@ async function runE2eTests(testPath, options, projectInfo) {
312957
312791
  src: "cli",
312958
312792
  command: "test-e2e",
312959
312793
  error: error47 instanceof Error ? error47.message : String(error47)
312960
- }, "Error in runE2eTests");
312961
- if (error47 instanceof Error) {
312962
- logger49.error({ src: "cli", command: "test-e2e", message: error47.message, stack: error47.stack }, "Error details");
312963
- } else {
312964
- logger49.error({ src: "cli", command: "test-e2e", type: typeof error47 }, "Unknown error type");
312965
- try {
312966
- logger49.error({ src: "cli", command: "test-e2e", stringified: JSON.stringify(error47, null, 2) }, "Stringified error");
312967
- } catch (e2) {
312968
- logger49.error({ src: "cli", command: "test-e2e", error: e2 instanceof Error ? e2.message : String(e2) }, "Could not stringify error");
312969
- }
312970
- }
312971
- return { failed: true };
312794
+ }, "Error loading project");
312795
+ throw error47;
312972
312796
  }
312973
312797
  } catch (error47) {
312974
312798
  logger49.error({
@@ -312976,16 +312800,6 @@ async function runE2eTests(testPath, options, projectInfo) {
312976
312800
  command: "test-e2e",
312977
312801
  error: error47 instanceof Error ? error47.message : String(error47)
312978
312802
  }, "Error in runE2eTests");
312979
- if (error47 instanceof Error) {
312980
- logger49.error({ src: "cli", command: "test-e2e", message: error47.message, stack: error47.stack }, "Error details");
312981
- } else {
312982
- logger49.error({ src: "cli", command: "test-e2e", type: typeof error47 }, "Unknown error type");
312983
- try {
312984
- logger49.error({ src: "cli", command: "test-e2e", stringified: JSON.stringify(error47, null, 2) }, "Stringified error");
312985
- } catch (e2) {
312986
- logger49.error({ src: "cli", command: "test-e2e", error: e2 instanceof Error ? e2.message : String(e2) }, "Could not stringify error");
312987
- }
312988
- }
312989
312803
  return { failed: true };
312990
312804
  }
312991
312805
  }
@@ -313290,154 +313104,18 @@ init_utils2();
313290
313104
  init_local_cli_delegation();
313291
313105
  init_esm();
313292
313106
  init_emoji_handler();
313293
- import { logger as logger55 } from "@elizaos/core";
313107
+ import { logger as logger56 } from "@elizaos/core";
313294
313108
 
313295
313109
  // src/commands/scenario/index.ts
313296
313110
  init_esm();
313297
313111
  init_js_yaml();
313298
313112
  init_schema();
313299
313113
  init_LocalEnvironmentProvider();
313114
+ init_runtime_factory();
313300
313115
  import fs41 from "fs";
313301
313116
  import path72 from "path";
313302
313117
  import { logger as elizaLogger } from "@elizaos/core";
313303
313118
 
313304
- // src/commands/scenario/src/E2BEnvironmentProvider.ts
313305
- init_runtime_factory();
313306
-
313307
- class E2BEnvironmentProvider {
313308
- runtime;
313309
- sandboxId = null;
313310
- server;
313311
- agentId;
313312
- serverPort;
313313
- trajectoryReconstructor;
313314
- constructor(runtime, server2, agentId, serverPort) {
313315
- this.runtime = runtime;
313316
- this.server = server2;
313317
- this.agentId = agentId;
313318
- this.serverPort = serverPort;
313319
- this.trajectoryReconstructor = new TrajectoryReconstructor(runtime);
313320
- const e2bService = runtime.getService("e2b");
313321
- if (!e2bService) {
313322
- throw new Error("E2B service not found. Please ensure @elizaos/plugin-e2b is properly configured.");
313323
- }
313324
- }
313325
- async setup(scenario) {
313326
- const e2bService = this.runtime.getService("e2b");
313327
- this.sandboxId = await e2bService.createSandbox({
313328
- timeoutMs: 300000,
313329
- metadata: {
313330
- purpose: "scenario-execution",
313331
- scenarioName: scenario.name
313332
- }
313333
- });
313334
- const virtualFs = scenario.setup?.virtual_fs;
313335
- if (virtualFs && this.sandboxId) {
313336
- for (const [filePath, content] of Object.entries(virtualFs)) {
313337
- if (typeof filePath !== "string" || filePath.includes("..") || filePath.includes("`") || filePath.includes("$")) {
313338
- throw new Error(`Invalid file path: ${filePath}`);
313339
- }
313340
- if (typeof content !== "string") {
313341
- throw new Error(`Invalid file content for ${filePath}`);
313342
- }
313343
- const safeFilePath = JSON.stringify(filePath);
313344
- const safeContent = JSON.stringify(content);
313345
- const writeFileCode = `
313346
- import json
313347
- file_path = json.loads(${safeFilePath})
313348
- content = json.loads(${safeContent})
313349
- with open(file_path, "w") as f:
313350
- f.write(content)
313351
- print(f"Created file: {file_path}")
313352
- `;
313353
- await e2bService.executeCode(writeFileCode, "python");
313354
- }
313355
- }
313356
- }
313357
- async captureFileSystem(e2bService) {
313358
- const captureCode = `
313359
- import os
313360
- import json
313361
- files = {}
313362
- for root, dirs, files_list in os.walk('.'):
313363
- for file in files_list:
313364
- path = os.path.join(root, file)
313365
- try:
313366
- with open(path, 'r') as f:
313367
- files[path] = f.read()
313368
- except Exception as e:
313369
- files[path] = f"[binary or unreadable: {str(e)}]"
313370
- print(json.dumps(files))
313371
- `;
313372
- try {
313373
- const result = await e2bService.executeCode(captureCode, "python");
313374
- const filesJson = result.text || result.logs?.stdout?.join(`
313375
- `) || "{}";
313376
- if (typeof filesJson === "string" && filesJson.trim().startsWith("{")) {
313377
- return JSON.parse(filesJson);
313378
- } else {
313379
- console.warn("File system capture returned non-JSON response, returning empty files object");
313380
- return {};
313381
- }
313382
- } catch (error47) {
313383
- console.warn("Failed to capture file system state:", error47);
313384
- return {};
313385
- }
313386
- }
313387
- async run(scenario) {
313388
- const e2bService = this.runtime.getService("e2b");
313389
- const results = [];
313390
- for (const step of scenario.run) {
313391
- const startedAtMs = Date.now();
313392
- if (step.input) {
313393
- const { response, roomId } = await askAgentViaApi(this.server, this.agentId, step.input, 90000, this.serverPort);
313394
- const trajectory = await this.trajectoryReconstructor.getLatestTrajectory(roomId);
313395
- const endedAtMs = Date.now();
313396
- const durationMs = endedAtMs - startedAtMs;
313397
- results.push({
313398
- exitCode: 0,
313399
- stdout: response,
313400
- stderr: "",
313401
- files: await this.captureFileSystem(e2bService),
313402
- startedAtMs,
313403
- endedAtMs,
313404
- durationMs,
313405
- trajectory
313406
- });
313407
- } else if (step.code) {
313408
- const result = await e2bService.executeCode(step.code, step.lang);
313409
- const files = await this.captureFileSystem(e2bService);
313410
- const endedAtMs = Date.now();
313411
- const durationMs = endedAtMs - startedAtMs;
313412
- results.push({
313413
- exitCode: result.error ? 1 : 0,
313414
- stdout: result.text || result.logs?.stdout?.join(`
313415
- `) || "",
313416
- stderr: result.error?.value || result.logs?.stderr?.join(`
313417
- `) || "",
313418
- files,
313419
- startedAtMs,
313420
- endedAtMs,
313421
- durationMs
313422
- });
313423
- } else {
313424
- throw new Error("Step must have either input or code");
313425
- }
313426
- }
313427
- return results;
313428
- }
313429
- async teardown() {
313430
- if (this.sandboxId) {
313431
- const e2bService = this.runtime.getService("e2b");
313432
- await e2bService.killSandbox(this.sandboxId);
313433
- this.sandboxId = null;
313434
- }
313435
- }
313436
- }
313437
-
313438
- // src/commands/scenario/index.ts
313439
- init_runtime_factory();
313440
-
313441
313119
  // src/commands/scenario/src/MockEngine.ts
313442
313120
  var import_lodash = __toESM(require_lodash(), 1);
313443
313121
 
@@ -313468,7 +313146,7 @@ class MockEngine {
313468
313146
  if (!originalService) {
313469
313147
  return null;
313470
313148
  }
313471
- return new Proxy(originalService, {
313149
+ const proxiedService = new Proxy(originalService, {
313472
313150
  get: (target, prop, receiver) => {
313473
313151
  const key = `${name}.${prop}`;
313474
313152
  if (!this.mockRegistry.has(key)) {
@@ -313488,6 +313166,7 @@ class MockEngine {
313488
313166
  };
313489
313167
  }
313490
313168
  });
313169
+ return proxiedService;
313491
313170
  };
313492
313171
  }
313493
313172
  revertMocks() {
@@ -313519,14 +313198,9 @@ class MockEngine {
313519
313198
  throw error47;
313520
313199
  }
313521
313200
  if (mock.responseFn) {
313522
- try {
313523
- const input3 = this.extractInputFromArgs(args);
313524
- const context2 = this.buildRequestContext(args);
313525
- return this.parseResponseTemplate(mock.responseFn, { args, input: input3, context: context2 });
313526
- } catch (error47) {
313527
- this.logger.error(`Response template error: ${error47}`);
313528
- throw error47;
313529
- }
313201
+ const input3 = this.extractInputFromArgs(args);
313202
+ const context2 = this.buildRequestContext(args);
313203
+ return this.parseResponseTemplate(mock.responseFn, { args, input: input3, context: context2 });
313530
313204
  }
313531
313205
  return mock.response;
313532
313206
  }
@@ -314048,14 +313722,14 @@ class RunDataAggregator {
314048
313722
  // src/commands/scenario/index.ts
314049
313723
  var __dirname = "/home/runner/work/eliza/eliza/packages/cli/src/commands/scenario";
314050
313724
  async function runEvaluationsWithFallback(evaluationEngine, evaluations, result) {
314051
- const logger55 = elizaLogger || console;
313725
+ const logger56 = elizaLogger || console;
314052
313726
  try {
314053
- logger55.debug("[Evaluation] Using enhanced evaluations with structured output");
313727
+ logger56.debug("[Evaluation] Using enhanced evaluations with structured output");
314054
313728
  const enhancedResults = await evaluationEngine.runEnhancedEvaluations(evaluations, result);
314055
313729
  if (Array.isArray(enhancedResults) && enhancedResults.length > 0) {
314056
313730
  const firstResult = enhancedResults[0];
314057
313731
  if (firstResult && typeof firstResult.evaluator_type === "string" && typeof firstResult.success === "boolean" && typeof firstResult.summary === "string" && typeof firstResult.details === "object") {
314058
- logger55.debug(`[Evaluation] Enhanced evaluations successful - ${enhancedResults.length} structured results`);
313732
+ logger56.debug(`[Evaluation] Enhanced evaluations successful - ${enhancedResults.length} structured results`);
314059
313733
  return enhancedResults.map((enhanced) => ({
314060
313734
  success: enhanced.success,
314061
313735
  message: enhanced.summary,
@@ -314063,16 +313737,23 @@ async function runEvaluationsWithFallback(evaluationEngine, evaluations, result)
314063
313737
  }));
314064
313738
  }
314065
313739
  }
314066
- logger55.warn("[Evaluation] Enhanced results invalid, falling back to legacy evaluations");
313740
+ logger56.warn("[Evaluation] Enhanced results invalid, falling back to legacy evaluations");
314067
313741
  } catch (error47) {
314068
- logger55.warn(`[Evaluation] Enhanced evaluations failed (${error47 instanceof Error ? error47.message : String(error47)}), falling back to legacy evaluations`);
314069
- }
314070
- logger55.debug("[Evaluation] Using legacy evaluation system (fallback)");
314071
- return await evaluationEngine.runEvaluations(evaluations, result);
313742
+ logger56.warn(`[Evaluation] Enhanced evaluations failed (${error47 instanceof Error ? error47.message : String(error47)}), falling back to legacy evaluations`);
313743
+ }
313744
+ logger56.debug("[Evaluation] Using legacy evaluation system (fallback)");
313745
+ const legacyResults = await evaluationEngine.runEvaluations(evaluations, result);
313746
+ return legacyResults.map((result2) => ({
313747
+ success: result2.success,
313748
+ message: result2.message,
313749
+ evaluator_type: "legacy",
313750
+ summary: result2.message,
313751
+ details: {}
313752
+ }));
314072
313753
  }
314073
313754
  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) => {
314074
- const logger55 = elizaLogger || console;
314075
- logger55.info(`Starting scenario run with args: ${JSON.stringify({ filePath, ...options })}`);
313755
+ const logger56 = elizaLogger || console;
313756
+ logger56.info(`Starting scenario run with args: ${JSON.stringify({ filePath, ...options })}`);
314076
313757
  let provider = null;
314077
313758
  let runtime = null;
314078
313759
  let server2 = null;
@@ -314087,16 +313768,16 @@ var scenario = new Command().name("scenario").description("Manage and execute El
314087
313768
  let dataAggregator = null;
314088
313769
  try {
314089
313770
  const fullPath = path72.resolve(filePath);
314090
- logger55.info(`Attempting to read scenario file from: ${fullPath}`);
313771
+ logger56.info(`Attempting to read scenario file from: ${fullPath}`);
314091
313772
  if (!fs41.existsSync(fullPath)) {
314092
- logger55.error(`Error: File not found at '${fullPath}'`);
313773
+ logger56.error(`Error: File not found at '${fullPath}'`);
314093
313774
  process.exit(1);
314094
313775
  }
314095
313776
  const fileContents = fs41.readFileSync(fullPath, "utf8");
314096
313777
  const rawScenario = load3(fileContents);
314097
313778
  const validationResult = ScenarioSchema.safeParse(rawScenario);
314098
313779
  if (!validationResult.success) {
314099
- logger55.error("Scenario file validation failed:");
313780
+ logger56.error("Scenario file validation failed:");
314100
313781
  console.error(JSON.stringify(validationResult.error.format(), null, 2));
314101
313782
  process.exit(1);
314102
313783
  }
@@ -314105,25 +313786,24 @@ var scenario = new Command().name("scenario").description("Manage and execute El
314105
313786
  fs41.mkdirSync(logsDir, { recursive: true });
314106
313787
  }
314107
313788
  if (scenario2.plugins && scenario2.plugins.length > 0) {
314108
- logger55.info("Parsing and validating plugins...");
313789
+ logger56.info("Parsing and validating plugins...");
314109
313790
  const pluginResult = await parseAndValidate(scenario2.plugins);
314110
313791
  if (!pluginResult.valid) {
314111
- logger55.error("Plugin validation failed:");
313792
+ logger56.error("Plugin validation failed:");
314112
313793
  pluginResult.errors.forEach((error47) => {
314113
- logger55.error(` - ${error47}`);
313794
+ logger56.error(` - ${error47}`);
314114
313795
  });
314115
313796
  process.exit(1);
314116
313797
  }
314117
313798
  if (pluginResult.warnings.length > 0) {
314118
- logger55.warn("Plugin warnings:");
313799
+ logger56.warn("Plugin warnings:");
314119
313800
  pluginResult.warnings.forEach((warning2) => {
314120
- logger55.warn(` - ${warning2}`);
313801
+ logger56.warn(` - ${warning2}`);
314121
313802
  });
314122
313803
  }
314123
- logger55.info(generateSummary(pluginResult));
314124
- scenario2.parsedPlugins = pluginResult.plugins;
313804
+ logger56.info(generateSummary(pluginResult));
314125
313805
  } else {
314126
- logger55.info("No plugins specified in scenario");
313806
+ logger56.info("No plugins specified in scenario");
314127
313807
  }
314128
313808
  reporter = new Reporter;
314129
313809
  reporter.reportStart(scenario2);
@@ -314136,40 +313816,27 @@ var scenario = new Command().name("scenario").description("Manage and execute El
314136
313816
  const uniqueDir = `${process.cwd()}/test-data/scenario-${Date.now()}-${Math.random().toString(36).slice(2)}`;
314137
313817
  process.env.PGLITE_DATA_DIR = uniqueDir;
314138
313818
  }
314139
- const scenarioPlugins = Array.isArray(scenario2.plugins) ? scenario2.plugins.filter((p2) => p2.enabled !== false).map((p2) => typeof p2 === "string" ? p2 : p2.name) : [];
313819
+ const scenarioWithPlugins = scenario2;
313820
+ const scenarioPlugins = Array.isArray(scenarioWithPlugins.plugins) ? scenarioWithPlugins.plugins.filter((p2) => typeof p2 === "string" || p2.enabled !== false).map((p2) => typeof p2 === "string" ? p2 : p2.name) : [];
314140
313821
  const finalPlugins = Array.from(new Set([...scenarioPlugins, ...defaultPlugins]));
314141
- logger55.info(`Using plugins: ${JSON.stringify(finalPlugins)}`);
314142
- if (scenario2.environment.type === "e2b") {
313822
+ logger56.info(`Using plugins: ${JSON.stringify(finalPlugins)}`);
313823
+ if (!server2 || !runtime || !agentId) {
314143
313824
  const created = await createScenarioServerAndAgent(null, 3000, finalPlugins);
314144
313825
  server2 = created.server;
314145
313826
  runtime = created.runtime;
314146
313827
  agentId = created.agentId;
314147
313828
  createdServer = created.createdServer;
314148
313829
  serverPort = created.port;
314149
- const hasE2B = !!runtime.getService?.("e2b");
314150
- provider = hasE2B ? new E2BEnvironmentProvider(runtime, server2, agentId, serverPort) : new LocalEnvironmentProvider(server2, agentId, runtime, serverPort);
314151
- } else if (scenario2.environment.type === "local") {
314152
- if (!server2 || !runtime || !agentId) {
314153
- const created = await createScenarioServerAndAgent(null, 3000, finalPlugins);
314154
- server2 = created.server;
314155
- runtime = created.runtime;
314156
- agentId = created.agentId;
314157
- createdServer = created.createdServer;
314158
- serverPort = created.port;
314159
- }
314160
- provider = new LocalEnvironmentProvider(server2, agentId, runtime, serverPort);
314161
- logger55.info("Using local environment");
314162
- } else {
314163
- logger55.error(`Unsupported environment type: '${scenario2.environment.type}'`);
314164
- process.exit(1);
314165
313830
  }
313831
+ provider = new LocalEnvironmentProvider(server2, agentId, runtime, serverPort);
313832
+ logger56.info("Using local environment");
314166
313833
  if (runtime && scenario2.setup?.mocks && !options.live) {
314167
- logger55.info("Initializing MockEngine...");
313834
+ logger56.info("Initializing MockEngine...");
314168
313835
  mockEngine = new MockEngine(runtime);
314169
- logger55.info("Applying mocks...");
313836
+ logger56.info("Applying mocks...");
314170
313837
  mockEngine.applyMocks(scenario2.setup.mocks);
314171
313838
  }
314172
- logger55.info(`Setting up '${scenario2.environment.type}' environment...`);
313839
+ logger56.info("Setting up local environment...");
314173
313840
  await provider.setup(scenario2);
314174
313841
  if (runtime) {
314175
313842
  const trajectoryReconstructor = new TrajectoryReconstructor(runtime);
@@ -314179,28 +313846,27 @@ var scenario = new Command().name("scenario").description("Manage and execute El
314179
313846
  const combinationId = `single-${scenarioRunId}`;
314180
313847
  const parameters = { "scenario.file": filePath };
314181
313848
  dataAggregator.startRun(runId2, combinationId, parameters);
314182
- logger55.info(`\uD83D\uDCCA [DataAggregator] Started tracking run: ${runId2}`);
313849
+ logger56.info(`\uD83D\uDCCA [DataAggregator] Started tracking run: ${runId2}`);
314183
313850
  }
314184
- logger55.info("Executing run block...");
313851
+ logger56.info("Executing run block...");
314185
313852
  const startTime = Date.now();
314186
313853
  const results = await provider.run(scenario2);
314187
313854
  const endTime = Date.now();
314188
313855
  results.forEach((result) => {
314189
313856
  reporter?.reportExecutionResult(result);
314190
313857
  });
314191
- logger55.info(`\uD83D\uDCC2 Using logs directory: ${logsDir}`);
313858
+ logger56.info(`\uD83D\uDCC2 Using logs directory: ${logsDir}`);
314192
313859
  const runId = generateRunFilename(1);
314193
- logger55.info(`\uD83D\uDD0D DEBUG: About to write ${results.length} execution results to ${logsDir}`);
314194
313860
  results.forEach((result, i3) => {
314195
313861
  const executionFilename = generateStepFilename(runId, i3, "execution");
314196
313862
  const executionPath = path72.join(logsDir, executionFilename);
314197
313863
  fs41.writeFileSync(executionPath, JSON.stringify(result, null, 2));
314198
- logger55.info(`\uD83D\uDCC4 Execution results written to: ${executionPath}`);
313864
+ logger56.info(`\uD83D\uDCC4 Execution results written to: ${executionPath}`);
314199
313865
  });
314200
313866
  const allEvaluationResults = [];
314201
313867
  if (runtime) {
314202
313868
  const evaluationEngine = new EvaluationEngine(runtime);
314203
- logger55.info("Running evaluations with runtime...");
313869
+ logger56.info("Running evaluations with runtime...");
314204
313870
  for (let i3 = 0;i3 < results.length; i3++) {
314205
313871
  const step = scenario2.run[i3];
314206
313872
  const result = results[i3];
@@ -314209,12 +313875,12 @@ var scenario = new Command().name("scenario").description("Manage and execute El
314209
313875
  const evaluationFilename = generateStepFilename(runId, i3, "evaluation");
314210
313876
  const evaluationPath = path72.join(logsDir, evaluationFilename);
314211
313877
  fs41.writeFileSync(evaluationPath, JSON.stringify(evaluationResults, null, 2));
314212
- logger55.info(`\uD83D\uDCCA Evaluation results written to: ${evaluationPath}`);
313878
+ logger56.info(`\uD83D\uDCCA Evaluation results written to: ${evaluationPath}`);
314213
313879
  allEvaluationResults.push(...evaluationResults);
314214
313880
  }
314215
313881
  }
314216
313882
  } else {
314217
- logger55.info("Running basic evaluations without runtime...");
313883
+ logger56.info("Running basic evaluations without runtime...");
314218
313884
  for (let i3 = 0;i3 < results.length; i3++) {
314219
313885
  const step = scenario2.run[i3];
314220
313886
  const result = results[i3];
@@ -314246,7 +313912,7 @@ var scenario = new Command().name("scenario").description("Manage and execute El
314246
313912
  const evaluationFilename = generateStepFilename(runId, i3, "evaluation");
314247
313913
  const evaluationPath = path72.join(logsDir, evaluationFilename);
314248
313914
  fs41.writeFileSync(evaluationPath, JSON.stringify(stepEvaluationResults, null, 2));
314249
- logger55.info(`\uD83D\uDCCA Basic evaluation results written to: ${evaluationPath}`);
313915
+ logger56.info(`\uD83D\uDCCA Basic evaluation results written to: ${evaluationPath}`);
314250
313916
  }
314251
313917
  }
314252
313918
  }
@@ -314284,8 +313950,13 @@ var scenario = new Command().name("scenario").description("Manage and execute El
314284
313950
  if (result._enhanced) {
314285
313951
  return result._enhanced;
314286
313952
  }
314287
- if (result.evaluator_type && result.summary && result.details) {
314288
- return result;
313953
+ if (result.evaluator_type && result.summary && result.details && typeof result.evaluator_type === "string" && typeof result.summary === "string" && typeof result.details === "object" && result.details !== null) {
313954
+ return {
313955
+ evaluator_type: result.evaluator_type,
313956
+ success: result.success || false,
313957
+ summary: result.summary,
313958
+ details: result.details
313959
+ };
314289
313960
  }
314290
313961
  return {
314291
313962
  evaluator_type: "legacy",
@@ -314301,13 +313972,13 @@ var scenario = new Command().name("scenario").description("Manage and execute El
314301
313972
  const centralizedFilename = `${runId}.json`;
314302
313973
  const centralizedPath = path72.join(logsDir, centralizedFilename);
314303
313974
  fs41.writeFileSync(centralizedPath, JSON.stringify(scenarioRunResult, null, 2));
314304
- logger55.info(`\uD83D\uDCCB [DataAggregator] Centralized result written to: ${centralizedPath}`);
313975
+ logger56.info(`\uD83D\uDCCB [DataAggregator] Centralized result written to: ${centralizedPath}`);
314305
313976
  } catch (aggregatorError) {
314306
- logger55.error(`[DataAggregator] Failed to generate centralized result: ${aggregatorError}`);
313977
+ logger56.error(`[DataAggregator] Failed to generate centralized result: ${aggregatorError}`);
314307
313978
  }
314308
313979
  }
314309
313980
  } catch (error47) {
314310
- logger55.error("An error occurred during scenario execution:", error47 instanceof Error ? error47.message : String(error47));
313981
+ logger56.error("An error occurred during scenario execution:", error47 instanceof Error ? error47.message : String(error47));
314311
313982
  if (dataAggregator) {
314312
313983
  try {
314313
313984
  dataAggregator.recordError(error47 instanceof Error ? error47 : new Error(String(error47)));
@@ -314322,30 +313993,25 @@ var scenario = new Command().name("scenario").description("Manage and execute El
314322
313993
  const errorFilename = `run-${failedResult.run_id}.json`;
314323
313994
  const errorPath = path72.join(logsDir, errorFilename);
314324
313995
  fs41.writeFileSync(errorPath, JSON.stringify(failedResult, null, 2));
314325
- logger55.info(`\uD83D\uDCA5 [DataAggregator] Error result written to: ${errorPath}`);
313996
+ logger56.info(`\uD83D\uDCA5 [DataAggregator] Error result written to: ${errorPath}`);
314326
313997
  } catch (aggregatorError) {
314327
- logger55.error(`[DataAggregator] Failed to record error: ${aggregatorError}`);
313998
+ logger56.error(`[DataAggregator] Failed to record error: ${aggregatorError}`);
314328
313999
  }
314329
314000
  }
314330
314001
  process.exit(1);
314331
314002
  } finally {
314332
314003
  if (mockEngine) {
314333
- logger55.info("Reverting mocks...");
314004
+ logger56.info("Reverting mocks...");
314334
314005
  mockEngine.revertMocks();
314335
314006
  }
314336
314007
  if (provider) {
314337
- logger55.info("Tearing down environment...");
314008
+ logger56.info("Tearing down environment...");
314338
314009
  await provider.teardown();
314339
314010
  }
314340
314011
  if (runtime) {
314341
314012
  try {
314342
- const e2bService = runtime.getService("e2b");
314343
- if (e2bService && typeof e2bService.stop === "function") {
314344
- logger55.info("Stopping E2B service...");
314345
- await e2bService.stop();
314346
- }
314347
314013
  await runtime.close();
314348
- logger55.info("Runtime shutdown complete");
314014
+ logger56.info("Runtime shutdown complete");
314349
314015
  } catch {}
314350
314016
  }
314351
314017
  if (server2 && createdServer) {
@@ -314364,31 +314030,28 @@ var scenario = new Command().name("scenario").description("Manage and execute El
314364
314030
  calculateExecutionStats: calculateExecutionStats2,
314365
314031
  formatDuration: formatDuration2
314366
314032
  } = await Promise.resolve().then(() => exports_matrix_runner);
314367
- const {
314368
- validateMatrixParameterPaths: validateMatrixParameterPaths2,
314369
- combinationToOverrides: combinationToOverrides2
314370
- } = await Promise.resolve().then(() => (init_parameter_override(), exports_parameter_override));
314371
- const logger55 = elizaLogger || console;
314372
- logger55.info(`\uD83E\uDDEA Starting matrix analysis with config: ${configPath}`);
314033
+ const { validateMatrixParameterPaths: validateMatrixParameterPaths2, combinationToOverrides: combinationToOverrides2 } = await Promise.resolve().then(() => (init_parameter_override(), exports_parameter_override));
314034
+ const logger56 = elizaLogger || console;
314035
+ logger56.info(`\uD83E\uDDEA Starting matrix analysis with config: ${configPath}`);
314373
314036
  if (options.verbose) {
314374
- logger55.info(`Options: ${JSON.stringify(options, null, 2)}`);
314037
+ logger56.info(`Options: ${JSON.stringify(options, null, 2)}`);
314375
314038
  }
314376
314039
  const { processManager: processManager2 } = await Promise.resolve().then(() => (init_process_manager(), exports_process_manager));
314377
314040
  let isShuttingDown = false;
314378
314041
  const handleShutdown = async (signal) => {
314379
314042
  if (isShuttingDown) {
314380
- logger55.info(`\uD83D\uDD27 [Matrix] Already shutting down, ignoring ${signal}`);
314043
+ logger56.info(`\uD83D\uDD27 [Matrix] Already shutting down, ignoring ${signal}`);
314381
314044
  return;
314382
314045
  }
314383
314046
  isShuttingDown = true;
314384
- logger55.info(`\uD83D\uDD27 [Matrix] Received ${signal}, initiating graceful shutdown...`);
314047
+ logger56.info(`\uD83D\uDD27 [Matrix] Received ${signal}, initiating graceful shutdown...`);
314385
314048
  const summary = processManager2.getSummary();
314386
314049
  if (summary.total > 0) {
314387
- logger55.info(`\uD83D\uDD27 [Matrix] Cleaning up ${summary.total} tracked processes...`);
314050
+ logger56.info(`\uD83D\uDD27 [Matrix] Cleaning up ${summary.total} tracked processes...`);
314388
314051
  await processManager2.terminateAllProcesses();
314389
- logger55.info(`\uD83D\uDD27 [Matrix] Process cleanup completed`);
314052
+ logger56.info(`\uD83D\uDD27 [Matrix] Process cleanup completed`);
314390
314053
  }
314391
- logger55.info(`\uD83D\uDD27 [Matrix] Shutdown complete`);
314054
+ logger56.info(`\uD83D\uDD27 [Matrix] Shutdown complete`);
314392
314055
  process.exit(0);
314393
314056
  };
314394
314057
  process.on("SIGINT", () => handleShutdown("SIGINT"));
@@ -314396,186 +314059,185 @@ var scenario = new Command().name("scenario").description("Manage and execute El
314396
314059
  try {
314397
314060
  const fullPath = path72.resolve(configPath);
314398
314061
  const configDir = path72.dirname(fullPath);
314399
- logger55.info(`\uD83D\uDCC2 Loading matrix configuration from: ${fullPath}`);
314062
+ logger56.info(`\uD83D\uDCC2 Loading matrix configuration from: ${fullPath}`);
314400
314063
  if (!fs41.existsSync(fullPath)) {
314401
- logger55.error(`\u274C Error: Matrix configuration file not found at '${fullPath}'`);
314402
- logger55.info("\uD83D\uDCA1 Make sure the file exists and the path is correct.");
314064
+ logger56.error(`\u274C Error: Matrix configuration file not found at '${fullPath}'`);
314065
+ logger56.info("\uD83D\uDCA1 Make sure the file exists and the path is correct.");
314403
314066
  process.exit(1);
314404
314067
  }
314405
314068
  const fileContents = fs41.readFileSync(fullPath, "utf8");
314406
314069
  let rawMatrixConfig;
314407
314070
  try {
314408
- rawMatrixConfig = load3(fileContents);
314071
+ const loadedConfig = load3(fileContents);
314072
+ rawMatrixConfig = typeof loadedConfig === "object" && loadedConfig !== null && !Array.isArray(loadedConfig) ? loadedConfig : {};
314409
314073
  } catch (yamlError) {
314410
- logger55.error(`\u274C Error: Failed to parse YAML configuration file:`);
314411
- logger55.error(yamlError instanceof Error ? yamlError.message : String(yamlError));
314412
- logger55.info("\uD83D\uDCA1 Check that your YAML syntax is valid.");
314074
+ logger56.error(`\u274C Error: Failed to parse YAML configuration file:`);
314075
+ logger56.error(yamlError instanceof Error ? yamlError.message : String(yamlError));
314076
+ logger56.info("\uD83D\uDCA1 Check that your YAML syntax is valid.");
314413
314077
  process.exit(1);
314414
314078
  }
314415
- if (rawMatrixConfig.base_scenario && !path72.isAbsolute(rawMatrixConfig.base_scenario)) {
314079
+ if (rawMatrixConfig.base_scenario && typeof rawMatrixConfig.base_scenario === "string" && !path72.isAbsolute(rawMatrixConfig.base_scenario)) {
314416
314080
  rawMatrixConfig.base_scenario = path72.resolve(configDir, rawMatrixConfig.base_scenario);
314417
314081
  }
314418
- logger55.info("\uD83D\uDD0D Validating matrix configuration...");
314082
+ logger56.info("\uD83D\uDD0D Validating matrix configuration...");
314419
314083
  const validationResult = validateMatrixConfig2(rawMatrixConfig);
314420
314084
  if (!validationResult.success) {
314421
- logger55.error("\u274C Matrix configuration validation failed:");
314085
+ logger56.error("\u274C Matrix configuration validation failed:");
314422
314086
  const errors3 = validationResult.error.format();
314423
- const formatErrors = (obj, path73 = "") => {
314087
+ const formatErrors = (obj, errorPath = "") => {
314424
314088
  if (obj._errors && obj._errors.length > 0) {
314425
314089
  obj._errors.forEach((error47) => {
314426
- logger55.error(` ${path73}: ${error47}`);
314090
+ logger56.error(` ${errorPath}: ${error47}`);
314427
314091
  });
314428
314092
  }
314429
314093
  Object.keys(obj).forEach((key) => {
314430
- if (key !== "_errors" && typeof obj[key] === "object") {
314431
- const newPath = path73 ? `${path73}.${key}` : key;
314094
+ if (key !== "_errors" && typeof obj[key] === "object" && obj[key] !== null) {
314095
+ const newPath = errorPath ? `${errorPath}.${key}` : key;
314432
314096
  formatErrors(obj[key], newPath);
314433
314097
  }
314434
314098
  });
314435
314099
  };
314436
314100
  formatErrors(errors3);
314437
- logger55.info("\uD83D\uDCA1 Please fix the configuration errors and try again.");
314438
- logger55.info("\uD83D\uDCD6 See the matrix testing documentation for examples and guidance.");
314101
+ logger56.info("\uD83D\uDCA1 Please fix the configuration errors and try again.");
314102
+ logger56.info("\uD83D\uDCD6 See the matrix testing documentation for examples and guidance.");
314439
314103
  process.exit(1);
314440
314104
  }
314441
314105
  const matrixConfig = validationResult.data;
314442
- logger55.info("\u2705 Matrix configuration is valid!");
314106
+ logger56.info("\u2705 Matrix configuration is valid!");
314443
314107
  const totalCombinations = calculateTotalCombinations2(matrixConfig);
314444
314108
  const totalRuns = calculateTotalRuns2(matrixConfig);
314445
- logger55.info(`
314109
+ logger56.info(`
314446
314110
  \uD83D\uDCCA Matrix Analysis:`);
314447
- logger55.info(` Name: ${matrixConfig.name}`);
314111
+ logger56.info(` Name: ${matrixConfig.name}`);
314448
314112
  if (matrixConfig.description) {
314449
- logger55.info(` Description: ${matrixConfig.description}`);
314450
- }
314451
- logger55.info(` Base Scenario: ${matrixConfig.base_scenario}`);
314452
- logger55.info(` Runs per combination: ${matrixConfig.runs_per_combination}`);
314453
- logger55.info(` Matrix axes: ${matrixConfig.matrix.length}`);
314454
- logger55.info(` Total combinations: ${totalCombinations}`);
314455
- logger55.info(` Total test runs: ${totalRuns}`);
314456
- logger55.info(`
314113
+ logger56.info(` Description: ${matrixConfig.description}`);
314114
+ }
314115
+ logger56.info(` Base Scenario: ${matrixConfig.base_scenario}`);
314116
+ logger56.info(` Runs per combination: ${matrixConfig.runs_per_combination}`);
314117
+ logger56.info(` Matrix axes: ${matrixConfig.matrix.length}`);
314118
+ logger56.info(` Total combinations: ${totalCombinations}`);
314119
+ logger56.info(` Total test runs: ${totalRuns}`);
314120
+ logger56.info(`
314457
314121
  \uD83C\uDFAF Matrix Structure:`);
314458
314122
  matrixConfig.matrix.forEach((axis, index) => {
314459
- logger55.info(` Axis ${index + 1}: ${axis.parameter}`);
314460
- logger55.info(` Values: [${axis.values.map((v2) => JSON.stringify(v2)).join(", ")}]`);
314461
- logger55.info(` Count: ${axis.values.length}`);
314123
+ logger56.info(` Axis ${index + 1}: ${axis.parameter}`);
314124
+ logger56.info(` Values: [${axis.values.map((v2) => JSON.stringify(v2)).join(", ")}]`);
314125
+ logger56.info(` Count: ${axis.values.length}`);
314462
314126
  });
314463
314127
  const baseScenarioPath = matrixConfig.base_scenario;
314464
314128
  if (!fs41.existsSync(baseScenarioPath)) {
314465
- logger55.error(`
314129
+ logger56.error(`
314466
314130
  \u274C Error: Base scenario file not found at '${baseScenarioPath}'`);
314467
- logger55.info("\uD83D\uDCA1 Make sure the base_scenario path in your matrix config is correct.");
314131
+ logger56.info("\uD83D\uDCA1 Make sure the base_scenario path in your matrix config is correct.");
314468
314132
  process.exit(1);
314469
314133
  }
314470
- logger55.info(`\u2705 Base scenario file found: ${baseScenarioPath}`);
314134
+ logger56.info(`\u2705 Base scenario file found: ${baseScenarioPath}`);
314471
314135
  let baseScenario;
314472
314136
  try {
314473
314137
  const baseScenarioContents = fs41.readFileSync(baseScenarioPath, "utf8");
314474
- baseScenario = load3(baseScenarioContents);
314138
+ const loadedScenario = load3(baseScenarioContents);
314139
+ baseScenario = typeof loadedScenario === "object" && loadedScenario !== null && !Array.isArray(loadedScenario) ? loadedScenario : {};
314475
314140
  const baseValidationResult = ScenarioSchema.safeParse(baseScenario);
314476
314141
  if (!baseValidationResult.success) {
314477
- logger55.error(`
314142
+ logger56.error(`
314478
314143
  \u274C Error: Base scenario file is invalid:`);
314479
- logger55.error(JSON.stringify(baseValidationResult.error.format(), null, 2));
314144
+ logger56.error(JSON.stringify(baseValidationResult.error.format(), null, 2));
314480
314145
  process.exit(1);
314481
314146
  }
314482
- logger55.info(`\u2705 Base scenario is valid`);
314147
+ logger56.info(`\u2705 Base scenario is valid`);
314483
314148
  } catch (yamlError) {
314484
- logger55.error(`
314149
+ logger56.error(`
314485
314150
  \u274C Error: Failed to parse base scenario YAML file:`);
314486
- logger55.error(yamlError instanceof Error ? yamlError.message : String(yamlError));
314151
+ logger56.error(yamlError instanceof Error ? yamlError.message : String(yamlError));
314487
314152
  process.exit(1);
314488
314153
  }
314489
- logger55.info(`\uD83D\uDD0D Validating matrix parameter paths...`);
314154
+ logger56.info(`\uD83D\uDD0D Validating matrix parameter paths...`);
314490
314155
  const pathValidation = validateMatrixParameterPaths2(baseScenario, matrixConfig.matrix);
314491
314156
  if (!pathValidation.valid) {
314492
- logger55.error(`
314157
+ logger56.error(`
314493
314158
  \u274C Error: Invalid parameter paths in matrix configuration:`);
314494
314159
  pathValidation.invalidPaths.forEach((invalidPath) => {
314495
- logger55.error(` - ${invalidPath}`);
314160
+ logger56.error(` - ${invalidPath}`);
314496
314161
  });
314497
- logger55.info("\uD83D\uDCA1 Make sure all parameter paths exist in your base scenario.");
314498
- logger55.info("\uD83D\uDCD6 Check the matrix testing documentation for parameter path examples.");
314162
+ logger56.info("\uD83D\uDCA1 Make sure all parameter paths exist in your base scenario.");
314163
+ logger56.info("\uD83D\uDCD6 Check the matrix testing documentation for parameter path examples.");
314499
314164
  process.exit(1);
314500
314165
  }
314501
- logger55.info(`\u2705 All matrix parameter paths are valid`);
314166
+ logger56.info(`\u2705 All matrix parameter paths are valid`);
314502
314167
  const combinations = generateMatrixCombinations2(matrixConfig);
314503
314168
  if (options.verbose || options.dryRun) {
314504
- logger55.info(`
314169
+ logger56.info(`
314505
314170
  \uD83D\uDD00 Matrix Combinations:`);
314506
314171
  combinations.forEach((combo, index) => {
314507
- logger55.info(` ${index + 1}. ${combo.id}: ${JSON.stringify(combo.parameters, null, 0)}`);
314172
+ logger56.info(` ${index + 1}. ${combo.id}: ${JSON.stringify(combo.parameters, null, 0)}`);
314508
314173
  });
314509
314174
  if (combinations.length > 0 && options.verbose) {
314510
- logger55.info(`
314175
+ logger56.info(`
314511
314176
  \uD83D\uDEE0\uFE0F Parameter Override Preview:`);
314512
314177
  try {
314513
314178
  const firstCombination = combinations[0];
314514
314179
  const overrides = combinationToOverrides2(firstCombination.parameters);
314515
- logger55.info(` \uD83D\uDCCB Example: ${firstCombination.id}`);
314516
- logger55.info(` \uD83D\uDCCA Metadata: ${firstCombination.metadata.combinationIndex + 1} of ${firstCombination.metadata.totalCombinations}`);
314517
- logger55.info(` \uD83D\uDCDD Original scenario name: "${baseScenario.name}"`);
314518
- logger55.info(` \uD83D\uDCDD Modified scenario ready for execution`);
314519
- logger55.info(` \uD83D\uDCDD Parameters applied:`);
314180
+ logger56.info(` \uD83D\uDCCB Example: ${firstCombination.id}`);
314181
+ logger56.info(` \uD83D\uDCCA Metadata: ${firstCombination.metadata.combinationIndex + 1} of ${firstCombination.metadata.totalCombinations}`);
314182
+ logger56.info(` \uD83D\uDCDD Original scenario name: "${baseScenario.name}"`);
314183
+ logger56.info(` \uD83D\uDCDD Modified scenario ready for execution`);
314184
+ logger56.info(` \uD83D\uDCDD Parameters applied:`);
314520
314185
  overrides.forEach((override) => {
314521
- logger55.info(` \uD83D\uDD27 ${override.path}: ${JSON.stringify(override.value)}`);
314186
+ logger56.info(` \uD83D\uDD27 ${override.path}: ${JSON.stringify(override.value)}`);
314522
314187
  });
314523
- logger55.info(` \uD83D\uDCDD This combination will run ${matrixConfig.runs_per_combination} time(s)`);
314188
+ logger56.info(` \uD83D\uDCDD This combination will run ${matrixConfig.runs_per_combination} time(s)`);
314524
314189
  } catch (error47) {
314525
- logger55.warn(` \u26A0\uFE0F Could not generate override preview: ${error47 instanceof Error ? error47.message : String(error47)}`);
314190
+ logger56.warn(` \u26A0\uFE0F Could not generate override preview: ${error47 instanceof Error ? error47.message : String(error47)}`);
314526
314191
  }
314527
314192
  }
314528
314193
  }
314529
314194
  let filteredCombinations = combinations;
314530
314195
  if (options.filter) {
314531
- logger55.info(`
314196
+ logger56.info(`
314532
314197
  \uD83D\uDD0D Applying filter: ${options.filter}`);
314533
314198
  filteredCombinations = filterCombinations2(combinations, options.filter);
314534
- logger55.info(` Filtered to ${filteredCombinations.length} combinations`);
314199
+ logger56.info(` Filtered to ${filteredCombinations.length} combinations`);
314535
314200
  }
314536
314201
  if (totalRuns > 50) {
314537
- logger55.info(`
314202
+ logger56.info(`
314538
314203
  \u26A0\uFE0F Warning: This matrix will execute ${totalRuns} total test runs.`);
314539
- logger55.info(" This may take a significant amount of time and resources.");
314540
- logger55.info(" Consider using --filter to reduce the scope or increasing --parallel for faster execution.");
314204
+ logger56.info(" This may take a significant amount of time and resources.");
314205
+ logger56.info(" Consider using --filter to reduce the scope or increasing --parallel for faster execution.");
314541
314206
  }
314542
314207
  if (options.dryRun) {
314543
- logger55.info(`
314208
+ logger56.info(`
314544
314209
  \uD83D\uDD0D Dry Run Complete - Matrix Analysis Only`);
314545
- logger55.info("\u2728 Matrix configuration is valid and ready for execution.");
314546
- logger55.info("\uD83D\uDCDD To execute the matrix, run the same command without --dry-run");
314210
+ logger56.info("\u2728 Matrix configuration is valid and ready for execution.");
314211
+ logger56.info("\uD83D\uDCDD To execute the matrix, run the same command without --dry-run");
314547
314212
  if (!isShuttingDown) {
314548
314213
  const summary = processManager2.getSummary();
314549
314214
  if (summary.total > 0) {
314550
- logger55.info(`\uD83D\uDD27 [Matrix] Cleaning up ${summary.total} processes after dry-run...`);
314215
+ logger56.info(`\uD83D\uDD27 [Matrix] Cleaning up ${summary.total} processes after dry-run...`);
314551
314216
  await processManager2.terminateAllProcesses();
314552
314217
  }
314553
314218
  }
314554
314219
  process.exit(0);
314555
314220
  } else {
314556
314221
  const executionStats = calculateExecutionStats2(filteredCombinations, matrixConfig.runs_per_combination);
314557
- logger55.info(`
314222
+ logger56.info(`
314558
314223
  \uD83D\uDE80 Matrix Execution Plan:`);
314559
- logger55.info(` Parallel execution: ${options.parallel} concurrent runs`);
314560
- logger55.info(` Total combinations to execute: ${executionStats.totalCombinations}`);
314561
- logger55.info(` Total runs: ${executionStats.totalRuns}`);
314562
- logger55.info(` Estimated duration: ${formatDuration2(executionStats.estimatedDuration.realistic)} (realistic)`);
314563
- logger55.info(` Duration range: ${formatDuration2(executionStats.estimatedDuration.optimistic)} - ${formatDuration2(executionStats.estimatedDuration.pessimistic)}`);
314564
- logger55.info(`
314224
+ logger56.info(` Parallel execution: ${options.parallel} concurrent runs`);
314225
+ logger56.info(` Total combinations to execute: ${executionStats.totalCombinations}`);
314226
+ logger56.info(` Total runs: ${executionStats.totalRuns}`);
314227
+ logger56.info(` Estimated duration: ${formatDuration2(executionStats.estimatedDuration.realistic)} (realistic)`);
314228
+ logger56.info(` Duration range: ${formatDuration2(executionStats.estimatedDuration.optimistic)} - ${formatDuration2(executionStats.estimatedDuration.pessimistic)}`);
314229
+ logger56.info(`
314565
314230
  \u2705 Matrix Ready for Execution:`);
314566
- logger55.info(" \uD83C\uDFAF Matrix configuration: \u2705 Valid");
314567
- logger55.info(" \uD83C\uDFAF Parameter combinations: \u2705 Generated");
314568
- logger55.info(" \uD83C\uDFAF Execution context: \u2705 Prepared");
314569
- logger55.info(" \uD83C\uDFAF Base scenario: \u2705 Validated");
314570
- logger55.info("\uD83D\uDD27 [DEBUG] About to import matrix-orchestrator...");
314231
+ logger56.info(" \uD83C\uDFAF Matrix configuration: \u2705 Valid");
314232
+ logger56.info(" \uD83C\uDFAF Parameter combinations: \u2705 Generated");
314233
+ logger56.info(" \uD83C\uDFAF Execution context: \u2705 Prepared");
314234
+ logger56.info(" \uD83C\uDFAF Base scenario: \u2705 Validated");
314571
314235
  const { executeMatrixRuns: executeMatrixRuns2 } = await Promise.resolve().then(() => (init_matrix_orchestrator(), exports_matrix_orchestrator));
314572
- logger55.info("\uD83D\uDD27 [DEBUG] Successfully imported matrix-orchestrator");
314573
- logger55.info(`
314236
+ logger56.info(`
314574
314237
  \uD83D\uDE80 Starting Matrix Execution...`);
314575
314238
  const logsDir = path72.join(__dirname, "_logs_");
314576
314239
  const matrixRunId = generateRunFilename(1);
314577
314240
  const outputDir = path72.join(logsDir, matrixRunId.replace("run-", "matrix-"));
314578
- logger55.info("\uD83D\uDD27 [DEBUG] About to call executeMatrixRuns...");
314579
314241
  const results = await executeMatrixRuns2(matrixConfig, filteredCombinations, {
314580
314242
  outputDir,
314581
314243
  maxParallel: parseInt(options.parallel, 10),
@@ -314584,54 +314246,53 @@ var scenario = new Command().name("scenario").description("Manage and execute El
314584
314246
  verbose: options.verbose,
314585
314247
  onProgress: (message, eventType, _data) => {
314586
314248
  if (options.verbose || eventType === "MATRIX_STARTED" || eventType === "COMBINATION_COMPLETED" || eventType === "MATRIX_COMPLETED") {
314587
- logger55.info(`\uD83D\uDD04 ${message}`);
314249
+ logger56.info(`\uD83D\uDD04 ${message}`);
314588
314250
  }
314589
314251
  },
314590
314252
  onCombinationComplete: (summary) => {
314591
- logger55.info(`\u2705 Combination ${summary.combinationId} completed: ${summary.successfulRuns}/${summary.totalRuns} successful (${(summary.successRate * 100).toFixed(1)}%)`);
314253
+ logger56.info(`\u2705 Combination ${summary.combinationId} completed: ${summary.successfulRuns}/${summary.totalRuns} successful (${(summary.successRate * 100).toFixed(1)}%)`);
314592
314254
  },
314593
314255
  onResourceWarning: (alert) => {
314594
- logger55.warn(`\u26A0\uFE0F Resource ${alert.resource} at ${alert.currentUsage.toFixed(1)}%: ${alert.message}`);
314256
+ logger56.warn(`\u26A0\uFE0F Resource ${alert.resource} at ${alert.currentUsage.toFixed(1)}%: ${alert.message}`);
314595
314257
  if (alert.recommendation) {
314596
- logger55.info(`\uD83D\uDCA1 Recommendation: ${alert.recommendation}`);
314258
+ logger56.info(`\uD83D\uDCA1 Recommendation: ${alert.recommendation}`);
314597
314259
  }
314598
314260
  }
314599
314261
  });
314600
- logger55.info("\uD83D\uDD27 [DEBUG] executeMatrixRuns completed successfully");
314601
314262
  const successfulRuns = results.filter((r2) => r2.success).length;
314602
314263
  const failedRuns = results.length - successfulRuns;
314603
314264
  const successRate = results.length > 0 ? successfulRuns / results.length * 100 : 0;
314604
- logger55.info(`
314265
+ logger56.info(`
314605
314266
  \uD83C\uDF89 Matrix Execution Complete!`);
314606
- logger55.info(`\uD83D\uDCCA Results Summary:`);
314607
- logger55.info(` Total runs: ${results.length}`);
314608
- logger55.info(` Successful: ${successfulRuns}`);
314609
- logger55.info(` Failed: ${failedRuns}`);
314610
- logger55.info(` Success rate: ${successRate.toFixed(1)}%`);
314611
- logger55.info(`\uD83D\uDCC1 Results saved to: ${outputDir}`);
314267
+ logger56.info(`\uD83D\uDCCA Results Summary:`);
314268
+ logger56.info(` Total runs: ${results.length}`);
314269
+ logger56.info(` Successful: ${successfulRuns}`);
314270
+ logger56.info(` Failed: ${failedRuns}`);
314271
+ logger56.info(` Success rate: ${successRate.toFixed(1)}%`);
314272
+ logger56.info(`\uD83D\uDCC1 Results saved to: ${outputDir}`);
314612
314273
  if (!isShuttingDown) {
314613
314274
  const summary = processManager2.getSummary();
314614
314275
  if (summary.total > 0) {
314615
- logger55.info(`\uD83D\uDD27 [Matrix] Cleaning up ${summary.total} processes after completion...`);
314276
+ logger56.info(`\uD83D\uDD27 [Matrix] Cleaning up ${summary.total} processes after completion...`);
314616
314277
  await processManager2.terminateAllProcesses();
314617
- logger55.info(`\uD83D\uDD27 [Matrix] Process cleanup completed`);
314278
+ logger56.info(`\uD83D\uDD27 [Matrix] Process cleanup completed`);
314618
314279
  }
314619
314280
  }
314620
314281
  process.exit(failedRuns === 0 ? 0 : 1);
314621
314282
  }
314622
314283
  } catch (error47) {
314623
- logger55.error("\u274C An error occurred during matrix analysis:", error47 instanceof Error ? error47.message : String(error47));
314284
+ logger56.error("\u274C An error occurred during matrix analysis:", error47 instanceof Error ? error47.message : String(error47));
314624
314285
  if (options.verbose && error47 instanceof Error && error47.stack) {
314625
- logger55.error(`Stack trace: ${error47.stack}`);
314286
+ logger56.error(`Stack trace: ${error47.stack}`);
314626
314287
  }
314627
314288
  if (!isShuttingDown) {
314628
314289
  const summary = processManager2.getSummary();
314629
314290
  if (summary.total > 0) {
314630
- logger55.info(`\uD83D\uDD27 [Matrix] Cleaning up ${summary.total} processes after error...`);
314291
+ logger56.info(`\uD83D\uDD27 [Matrix] Cleaning up ${summary.total} processes after error...`);
314631
314292
  await processManager2.terminateAllProcesses();
314632
314293
  }
314633
314294
  }
314634
- logger55.info("\uD83D\uDCA1 Use --verbose for more detailed error information.");
314295
+ logger56.info("\uD83D\uDCA1 Use --verbose for more detailed error information.");
314635
314296
  process.exit(1);
314636
314297
  }
314637
314298
  }));
@@ -314652,17 +314313,17 @@ var shutdownState = {
314652
314313
  };
314653
314314
  async function gracefulShutdown(signal) {
314654
314315
  if (!shutdownState.tryInitiateShutdown()) {
314655
- logger55.debug({ src: "cli", signal }, "Ignoring signal - shutdown already in progress");
314316
+ logger56.debug({ src: "cli", signal }, "Ignoring signal - shutdown already in progress");
314656
314317
  return;
314657
314318
  }
314658
- logger55.info({ src: "cli", signal }, "Received signal, shutting down gracefully");
314319
+ logger56.info({ src: "cli", signal }, "Received signal, shutting down gracefully");
314659
314320
  try {
314660
314321
  const serverWasStopped = await stopServer();
314661
314322
  if (serverWasStopped) {
314662
- logger55.info({ src: "cli" }, "Server stopped successfully");
314323
+ logger56.info({ src: "cli" }, "Server stopped successfully");
314663
314324
  }
314664
314325
  } catch (error47) {
314665
- logger55.error({ src: "cli", error: error47 instanceof Error ? error47.message : String(error47) }, "Error stopping server");
314326
+ logger56.error({ src: "cli", error: error47 instanceof Error ? error47.message : String(error47) }, "Error stopping server");
314666
314327
  }
314667
314328
  const exitCode = signal === "SIGINT" ? 130 : signal === "SIGTERM" ? 143 : 0;
314668
314329
  process.exit(exitCode);
@@ -314708,9 +314369,9 @@ async function main() {
314708
314369
  await program2.parseAsync();
314709
314370
  }
314710
314371
  main().catch((error47) => {
314711
- logger55.error({ src: "cli", error: error47 instanceof Error ? error47.message : String(error47) }, "An error occurred");
314372
+ logger56.error({ src: "cli", error: error47 instanceof Error ? error47.message : String(error47) }, "An error occurred");
314712
314373
  process.exit(1);
314713
314374
  });
314714
314375
 
314715
- //# debugId=E144D1A35CCEADCC64756E2164756E21
314376
+ //# debugId=63A37C677E9FC84064756E2164756E21
314716
314377
  //# sourceMappingURL=index.js.map