@elizaos/cli 1.6.2-alpha.14 → 1.6.2-alpha.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/tee/eigen-wrapper.d.ts +3 -0
- package/dist/commands/tee/eigen-wrapper.d.ts.map +1 -0
- package/dist/commands/tee/index.d.ts.map +1 -1
- package/dist/index.js +650 -457
- package/dist/index.js.map +6 -5
- package/dist/templates/plugin-quick-starter/package.json +2 -2
- package/dist/templates/plugin-starter/package.json +2 -2
- package/dist/templates/project-starter/package.json +6 -6
- package/dist/templates/project-tee-starter/package.json +4 -4
- package/dist/version.d.ts +2 -2
- package/dist/version.js +2 -2
- package/package.json +7 -7
- package/templates/plugin-quick-starter/package.json +2 -2
- package/templates/plugin-starter/package.json +2 -2
- package/templates/project-starter/package.json +6 -6
- package/templates/project-tee-starter/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -4749,7 +4749,7 @@ __export(exports_version, {
|
|
|
4749
4749
|
BUILD_TIME: () => BUILD_TIME,
|
|
4750
4750
|
BUILD_ENV: () => BUILD_ENV
|
|
4751
4751
|
});
|
|
4752
|
-
var CLI_VERSION = "1.6.2-alpha.
|
|
4752
|
+
var CLI_VERSION = "1.6.2-alpha.16", CLI_NAME = "@elizaos/cli", CLI_DESCRIPTION = "elizaOS CLI - Manage your AI agents and plugins", BUILD_TIME = "2025-10-15T17:36:44.719Z", BUILD_ENV = "production", version_default;
|
|
4753
4753
|
var init_version = __esm(() => {
|
|
4754
4754
|
version_default = {
|
|
4755
4755
|
version: CLI_VERSION,
|
|
@@ -278447,14 +278447,14 @@ function resolveYamlBinary(data) {
|
|
|
278447
278447
|
return bitlen % 8 === 0;
|
|
278448
278448
|
}
|
|
278449
278449
|
function constructYamlBinary(data) {
|
|
278450
|
-
var idx, tailbits,
|
|
278450
|
+
var idx, tailbits, input3 = data.replace(/[\r\n=]/g, ""), max = input3.length, map4 = BASE64_MAP, bits = 0, result = [];
|
|
278451
278451
|
for (idx = 0;idx < max; idx++) {
|
|
278452
278452
|
if (idx % 4 === 0 && idx) {
|
|
278453
278453
|
result.push(bits >> 16 & 255);
|
|
278454
278454
|
result.push(bits >> 8 & 255);
|
|
278455
278455
|
result.push(bits & 255);
|
|
278456
278456
|
}
|
|
278457
|
-
bits = bits << 6 | map4.indexOf(
|
|
278457
|
+
bits = bits << 6 | map4.indexOf(input3.charAt(idx));
|
|
278458
278458
|
}
|
|
278459
278459
|
tailbits = max % 4 * 6;
|
|
278460
278460
|
if (tailbits === 0) {
|
|
@@ -278628,8 +278628,8 @@ function charFromCodepoint(c) {
|
|
|
278628
278628
|
}
|
|
278629
278629
|
return String.fromCharCode((c - 65536 >> 10) + 55296, (c - 65536 & 1023) + 56320);
|
|
278630
278630
|
}
|
|
278631
|
-
function State$1(
|
|
278632
|
-
this.input =
|
|
278631
|
+
function State$1(input3, options) {
|
|
278632
|
+
this.input = input3;
|
|
278633
278633
|
this.filename = options["filename"] || null;
|
|
278634
278634
|
this.schema = options["schema"] || _default3;
|
|
278635
278635
|
this.onWarning = options["onWarning"] || null;
|
|
@@ -278638,7 +278638,7 @@ function State$1(input2, options) {
|
|
|
278638
278638
|
this.listener = options["listener"] || null;
|
|
278639
278639
|
this.implicitTypes = this.schema.compiledImplicit;
|
|
278640
278640
|
this.typeMap = this.schema.compiledTypeMap;
|
|
278641
|
-
this.length =
|
|
278641
|
+
this.length = input3.length;
|
|
278642
278642
|
this.position = 0;
|
|
278643
278643
|
this.line = 0;
|
|
278644
278644
|
this.lineStart = 0;
|
|
@@ -279616,20 +279616,20 @@ function readDocument(state) {
|
|
|
279616
279616
|
return;
|
|
279617
279617
|
}
|
|
279618
279618
|
}
|
|
279619
|
-
function loadDocuments(
|
|
279620
|
-
|
|
279619
|
+
function loadDocuments(input3, options) {
|
|
279620
|
+
input3 = String(input3);
|
|
279621
279621
|
options = options || {};
|
|
279622
|
-
if (
|
|
279623
|
-
if (
|
|
279624
|
-
|
|
279622
|
+
if (input3.length !== 0) {
|
|
279623
|
+
if (input3.charCodeAt(input3.length - 1) !== 10 && input3.charCodeAt(input3.length - 1) !== 13) {
|
|
279624
|
+
input3 += `
|
|
279625
279625
|
`;
|
|
279626
279626
|
}
|
|
279627
|
-
if (
|
|
279628
|
-
|
|
279627
|
+
if (input3.charCodeAt(0) === 65279) {
|
|
279628
|
+
input3 = input3.slice(1);
|
|
279629
279629
|
}
|
|
279630
279630
|
}
|
|
279631
|
-
var state = new State$1(
|
|
279632
|
-
var nullpos =
|
|
279631
|
+
var state = new State$1(input3, options);
|
|
279632
|
+
var nullpos = input3.indexOf("\x00");
|
|
279633
279633
|
if (nullpos !== -1) {
|
|
279634
279634
|
state.position = nullpos;
|
|
279635
279635
|
throwError(state, "null byte is not allowed in input");
|
|
@@ -279644,12 +279644,12 @@ function loadDocuments(input2, options) {
|
|
|
279644
279644
|
}
|
|
279645
279645
|
return state.documents;
|
|
279646
279646
|
}
|
|
279647
|
-
function loadAll$1(
|
|
279647
|
+
function loadAll$1(input3, iterator2, options) {
|
|
279648
279648
|
if (iterator2 !== null && typeof iterator2 === "object" && typeof options === "undefined") {
|
|
279649
279649
|
options = iterator2;
|
|
279650
279650
|
iterator2 = null;
|
|
279651
279651
|
}
|
|
279652
|
-
var documents = loadDocuments(
|
|
279652
|
+
var documents = loadDocuments(input3, options);
|
|
279653
279653
|
if (typeof iterator2 !== "function") {
|
|
279654
279654
|
return documents;
|
|
279655
279655
|
}
|
|
@@ -279657,8 +279657,8 @@ function loadAll$1(input2, iterator2, options) {
|
|
|
279657
279657
|
iterator2(documents[index]);
|
|
279658
279658
|
}
|
|
279659
279659
|
}
|
|
279660
|
-
function load$1(
|
|
279661
|
-
var documents = loadDocuments(
|
|
279660
|
+
function load$1(input3, options) {
|
|
279661
|
+
var documents = loadDocuments(input3, options);
|
|
279662
279662
|
if (documents.length === 0) {
|
|
279663
279663
|
return;
|
|
279664
279664
|
} else if (documents.length === 1) {
|
|
@@ -280209,12 +280209,12 @@ function inspectNode(object2, objects, duplicatesIndexes) {
|
|
|
280209
280209
|
}
|
|
280210
280210
|
}
|
|
280211
280211
|
}
|
|
280212
|
-
function dump$1(
|
|
280212
|
+
function dump$1(input3, options) {
|
|
280213
280213
|
options = options || {};
|
|
280214
280214
|
var state = new State(options);
|
|
280215
280215
|
if (!state.noRefs)
|
|
280216
|
-
getDuplicateReferences(
|
|
280217
|
-
var value =
|
|
280216
|
+
getDuplicateReferences(input3, state);
|
|
280217
|
+
var value = input3;
|
|
280218
280218
|
if (state.replacer) {
|
|
280219
280219
|
value = state.replacer.call({ "": value }, "", value);
|
|
280220
280220
|
}
|
|
@@ -280783,7 +280783,7 @@ import { AgentServer } from "@elizaos/server";
|
|
|
280783
280783
|
import { ElizaClient } from "@elizaos/api-client";
|
|
280784
280784
|
import { ChannelType, stringToUuid as stringToUuidCore } from "@elizaos/core";
|
|
280785
280785
|
import fs50 from "fs";
|
|
280786
|
-
import
|
|
280786
|
+
import path75 from "path";
|
|
280787
280787
|
import { createServer } from "net";
|
|
280788
280788
|
async function findAvailablePort(startPort, endPort, host) {
|
|
280789
280789
|
const serverHost = host || process.env.SERVER_HOST || "0.0.0.0";
|
|
@@ -280838,8 +280838,8 @@ async function createScenarioServer(existingServer = null, desiredPort = 3000) {
|
|
|
280838
280838
|
server2 = existingServer;
|
|
280839
280839
|
} else {
|
|
280840
280840
|
server2 = new AgentServer;
|
|
280841
|
-
const pgliteRoot = process.env.PGLITE_DATA_DIR ||
|
|
280842
|
-
const uniqueDataDir =
|
|
280841
|
+
const pgliteRoot = process.env.PGLITE_DATA_DIR || path75.join(process.cwd(), ".eliza", ".elizadb");
|
|
280842
|
+
const uniqueDataDir = path75.join(pgliteRoot, `scenario-${Date.now()}-${Math.random().toString(36).slice(2)}`);
|
|
280843
280843
|
try {
|
|
280844
280844
|
fs50.mkdirSync(uniqueDataDir, { recursive: true });
|
|
280845
280845
|
} catch {}
|
|
@@ -280929,9 +280929,9 @@ async function shutdownScenarioServer(server2, port) {
|
|
|
280929
280929
|
}
|
|
280930
280930
|
}
|
|
280931
280931
|
}
|
|
280932
|
-
async function askAgentViaApi(server2, agentId,
|
|
280932
|
+
async function askAgentViaApi(server2, agentId, input3, timeoutMs = 60000, serverPort, existingChannelId) {
|
|
280933
280933
|
console.log(`\uD83D\uDD27 [askAgentViaApi] === FUNCTION START ===`);
|
|
280934
|
-
console.log(`\uD83D\uDD27 [askAgentViaApi] Parameters: agentId=${agentId}, input="${
|
|
280934
|
+
console.log(`\uD83D\uDD27 [askAgentViaApi] Parameters: agentId=${agentId}, input="${input3}", serverPort=${serverPort}, existingChannelId=${existingChannelId}`);
|
|
280935
280935
|
try {
|
|
280936
280936
|
const port = serverPort ?? server2?.port ?? 3000;
|
|
280937
280937
|
console.log(`\uD83D\uDD27 [askAgentViaApi] Port calculation: provided=${serverPort}, server.port=${server2?.port}, final=${port}`);
|
|
@@ -281031,7 +281031,7 @@ async function askAgentViaApi(server2, agentId, input2, timeoutMs = 60000, serve
|
|
|
281031
281031
|
headers: { "Content-Type": "application/json" },
|
|
281032
281032
|
body: JSON.stringify({
|
|
281033
281033
|
author_id: testUserId,
|
|
281034
|
-
content:
|
|
281034
|
+
content: input3,
|
|
281035
281035
|
server_id: defaultServer.id,
|
|
281036
281036
|
metadata: { scenario: true, user_display_name: "Scenario User" },
|
|
281037
281037
|
source_type: "scenario_message"
|
|
@@ -281801,7 +281801,7 @@ class EnhancedFileExistsEvaluator {
|
|
|
281801
281801
|
const expectedPath = params.path;
|
|
281802
281802
|
const createdFiles = Object.keys(runResult.files);
|
|
281803
281803
|
const success3 = createdFiles.includes(expectedPath) || createdFiles.includes(`./${expectedPath}`) || createdFiles.includes(expectedPath.replace(/^\.\//, ""));
|
|
281804
|
-
const matchingPath = createdFiles.find((
|
|
281804
|
+
const matchingPath = createdFiles.find((path76) => path76 === expectedPath || path76 === `./${expectedPath}` || path76 === expectedPath.replace(/^\.\//, ""));
|
|
281805
281805
|
return {
|
|
281806
281806
|
evaluator_type: "file_exists",
|
|
281807
281807
|
success: success3,
|
|
@@ -282845,7 +282845,7 @@ __export(exports_LocalEnvironmentProvider, {
|
|
|
282845
282845
|
LocalEnvironmentProvider: () => LocalEnvironmentProvider
|
|
282846
282846
|
});
|
|
282847
282847
|
import fs51 from "fs/promises";
|
|
282848
|
-
import
|
|
282848
|
+
import path76 from "path";
|
|
282849
282849
|
import os11 from "os";
|
|
282850
282850
|
|
|
282851
282851
|
class LocalEnvironmentProvider {
|
|
@@ -282869,13 +282869,13 @@ class LocalEnvironmentProvider {
|
|
|
282869
282869
|
console.log(`\uD83D\uDD27 [DEBUG] - Server Port: ${serverPort}`);
|
|
282870
282870
|
}
|
|
282871
282871
|
async setup(scenario) {
|
|
282872
|
-
const tempDirPrefix =
|
|
282872
|
+
const tempDirPrefix = path76.join(os11.tmpdir(), "eliza-scenario-run-");
|
|
282873
282873
|
this.tempDir = await fs51.mkdtemp(tempDirPrefix);
|
|
282874
282874
|
const virtualFs = scenario.setup?.virtual_fs;
|
|
282875
282875
|
if (virtualFs) {
|
|
282876
282876
|
for (const [filePath, content] of Object.entries(virtualFs)) {
|
|
282877
|
-
const fullPath =
|
|
282878
|
-
await fs51.mkdir(
|
|
282877
|
+
const fullPath = path76.join(this.tempDir, filePath);
|
|
282878
|
+
await fs51.mkdir(path76.dirname(fullPath), { recursive: true });
|
|
282879
282879
|
await fs51.writeFile(fullPath, content);
|
|
282880
282880
|
}
|
|
282881
282881
|
}
|
|
@@ -282889,8 +282889,8 @@ class LocalEnvironmentProvider {
|
|
|
282889
282889
|
const readDirRecursive = async (dirPath, basePath = "") => {
|
|
282890
282890
|
const entries = await fs51.readdir(dirPath, { withFileTypes: true });
|
|
282891
282891
|
for (const entry of entries) {
|
|
282892
|
-
const fullPath =
|
|
282893
|
-
const relativePath =
|
|
282892
|
+
const fullPath = path76.join(dirPath, entry.name);
|
|
282893
|
+
const relativePath = path76.join(basePath, entry.name);
|
|
282894
282894
|
if (entry.isDirectory()) {
|
|
282895
282895
|
await readDirRecursive(fullPath, relativePath);
|
|
282896
282896
|
} else if (entry.isFile()) {
|
|
@@ -284333,11 +284333,11 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
284333
284333
|
return isFunction3(object2[key]);
|
|
284334
284334
|
});
|
|
284335
284335
|
}
|
|
284336
|
-
function baseGet(object2,
|
|
284337
|
-
|
|
284338
|
-
var index = 0, length =
|
|
284336
|
+
function baseGet(object2, path77) {
|
|
284337
|
+
path77 = castPath(path77, object2);
|
|
284338
|
+
var index = 0, length = path77.length;
|
|
284339
284339
|
while (object2 != null && index < length) {
|
|
284340
|
-
object2 = object2[toKey(
|
|
284340
|
+
object2 = object2[toKey(path77[index++])];
|
|
284341
284341
|
}
|
|
284342
284342
|
return index && index == length ? object2 : undefined2;
|
|
284343
284343
|
}
|
|
@@ -284401,10 +284401,10 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
284401
284401
|
});
|
|
284402
284402
|
return accumulator;
|
|
284403
284403
|
}
|
|
284404
|
-
function baseInvoke(object2,
|
|
284405
|
-
|
|
284406
|
-
object2 = parent(object2,
|
|
284407
|
-
var func = object2 == null ? object2 : object2[toKey(last2(
|
|
284404
|
+
function baseInvoke(object2, path77, args) {
|
|
284405
|
+
path77 = castPath(path77, object2);
|
|
284406
|
+
object2 = parent(object2, path77);
|
|
284407
|
+
var func = object2 == null ? object2 : object2[toKey(last2(path77))];
|
|
284408
284408
|
return func == null ? undefined2 : apply(func, object2, args);
|
|
284409
284409
|
}
|
|
284410
284410
|
function baseIsArguments(value) {
|
|
@@ -284560,13 +284560,13 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
284560
284560
|
return object2 === source2 || baseIsMatch(object2, source2, matchData);
|
|
284561
284561
|
};
|
|
284562
284562
|
}
|
|
284563
|
-
function baseMatchesProperty(
|
|
284564
|
-
if (isKey(
|
|
284565
|
-
return matchesStrictComparable(toKey(
|
|
284563
|
+
function baseMatchesProperty(path77, srcValue) {
|
|
284564
|
+
if (isKey(path77) && isStrictComparable(srcValue)) {
|
|
284565
|
+
return matchesStrictComparable(toKey(path77), srcValue);
|
|
284566
284566
|
}
|
|
284567
284567
|
return function(object2) {
|
|
284568
|
-
var objValue = get(object2,
|
|
284569
|
-
return objValue === undefined2 && objValue === srcValue ? hasIn(object2,
|
|
284568
|
+
var objValue = get(object2, path77);
|
|
284569
|
+
return objValue === undefined2 && objValue === srcValue ? hasIn(object2, path77) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
|
|
284570
284570
|
};
|
|
284571
284571
|
}
|
|
284572
284572
|
function baseMerge(object2, source2, srcIndex, customizer, stack) {
|
|
@@ -284663,23 +284663,23 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
284663
284663
|
});
|
|
284664
284664
|
}
|
|
284665
284665
|
function basePick(object2, paths) {
|
|
284666
|
-
return basePickBy(object2, paths, function(value,
|
|
284667
|
-
return hasIn(object2,
|
|
284666
|
+
return basePickBy(object2, paths, function(value, path77) {
|
|
284667
|
+
return hasIn(object2, path77);
|
|
284668
284668
|
});
|
|
284669
284669
|
}
|
|
284670
284670
|
function basePickBy(object2, paths, predicate) {
|
|
284671
284671
|
var index = -1, length = paths.length, result2 = {};
|
|
284672
284672
|
while (++index < length) {
|
|
284673
|
-
var
|
|
284674
|
-
if (predicate(value,
|
|
284675
|
-
baseSet(result2, castPath(
|
|
284673
|
+
var path77 = paths[index], value = baseGet(object2, path77);
|
|
284674
|
+
if (predicate(value, path77)) {
|
|
284675
|
+
baseSet(result2, castPath(path77, object2), value);
|
|
284676
284676
|
}
|
|
284677
284677
|
}
|
|
284678
284678
|
return result2;
|
|
284679
284679
|
}
|
|
284680
|
-
function basePropertyDeep(
|
|
284680
|
+
function basePropertyDeep(path77) {
|
|
284681
284681
|
return function(object2) {
|
|
284682
|
-
return baseGet(object2,
|
|
284682
|
+
return baseGet(object2, path77);
|
|
284683
284683
|
};
|
|
284684
284684
|
}
|
|
284685
284685
|
function basePullAll(array2, values2, iteratee2, comparator) {
|
|
@@ -284753,14 +284753,14 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
284753
284753
|
var array2 = values(collection);
|
|
284754
284754
|
return shuffleSelf(array2, baseClamp(n, 0, array2.length));
|
|
284755
284755
|
}
|
|
284756
|
-
function baseSet(object2,
|
|
284756
|
+
function baseSet(object2, path77, value, customizer) {
|
|
284757
284757
|
if (!isObject3(object2)) {
|
|
284758
284758
|
return object2;
|
|
284759
284759
|
}
|
|
284760
|
-
|
|
284761
|
-
var index = -1, length =
|
|
284760
|
+
path77 = castPath(path77, object2);
|
|
284761
|
+
var index = -1, length = path77.length, lastIndex = length - 1, nested = object2;
|
|
284762
284762
|
while (nested != null && ++index < length) {
|
|
284763
|
-
var key = toKey(
|
|
284763
|
+
var key = toKey(path77[index]), newValue = value;
|
|
284764
284764
|
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
284765
284765
|
return object2;
|
|
284766
284766
|
}
|
|
@@ -284768,7 +284768,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
284768
284768
|
var objValue = nested[key];
|
|
284769
284769
|
newValue = customizer ? customizer(objValue, key, nested) : undefined2;
|
|
284770
284770
|
if (newValue === undefined2) {
|
|
284771
|
-
newValue = isObject3(objValue) ? objValue : isIndex(
|
|
284771
|
+
newValue = isObject3(objValue) ? objValue : isIndex(path77[index + 1]) ? [] : {};
|
|
284772
284772
|
}
|
|
284773
284773
|
}
|
|
284774
284774
|
assignValue(nested, key, newValue);
|
|
@@ -284934,13 +284934,13 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
284934
284934
|
}
|
|
284935
284935
|
return result2;
|
|
284936
284936
|
}
|
|
284937
|
-
function baseUnset(object2,
|
|
284938
|
-
|
|
284939
|
-
object2 = parent(object2,
|
|
284940
|
-
return object2 == null || delete object2[toKey(last2(
|
|
284937
|
+
function baseUnset(object2, path77) {
|
|
284938
|
+
path77 = castPath(path77, object2);
|
|
284939
|
+
object2 = parent(object2, path77);
|
|
284940
|
+
return object2 == null || delete object2[toKey(last2(path77))];
|
|
284941
284941
|
}
|
|
284942
|
-
function baseUpdate(object2,
|
|
284943
|
-
return baseSet(object2,
|
|
284942
|
+
function baseUpdate(object2, path77, updater, customizer) {
|
|
284943
|
+
return baseSet(object2, path77, updater(baseGet(object2, path77)), customizer);
|
|
284944
284944
|
}
|
|
284945
284945
|
function baseWhile(array2, predicate, isDrop, fromRight) {
|
|
284946
284946
|
var length = array2.length, index = fromRight ? length : -1;
|
|
@@ -285799,11 +285799,11 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
285799
285799
|
var match2 = source2.match(reWrapDetails);
|
|
285800
285800
|
return match2 ? match2[1].split(reSplitDetails) : [];
|
|
285801
285801
|
}
|
|
285802
|
-
function hasPath(object2,
|
|
285803
|
-
|
|
285804
|
-
var index = -1, length =
|
|
285802
|
+
function hasPath(object2, path77, hasFunc) {
|
|
285803
|
+
path77 = castPath(path77, object2);
|
|
285804
|
+
var index = -1, length = path77.length, result2 = false;
|
|
285805
285805
|
while (++index < length) {
|
|
285806
|
-
var key = toKey(
|
|
285806
|
+
var key = toKey(path77[index]);
|
|
285807
285807
|
if (!(result2 = object2 != null && hasFunc(object2, key))) {
|
|
285808
285808
|
break;
|
|
285809
285809
|
}
|
|
@@ -286007,8 +286007,8 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
286007
286007
|
return apply(func, this, otherArgs);
|
|
286008
286008
|
};
|
|
286009
286009
|
}
|
|
286010
|
-
function parent(object2,
|
|
286011
|
-
return
|
|
286010
|
+
function parent(object2, path77) {
|
|
286011
|
+
return path77.length < 2 ? object2 : baseGet(object2, baseSlice(path77, 0, -1));
|
|
286012
286012
|
}
|
|
286013
286013
|
function reorder(array2, indexes) {
|
|
286014
286014
|
var arrLength = array2.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array2);
|
|
@@ -286641,10 +286641,10 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
286641
286641
|
}
|
|
286642
286642
|
return isString2(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
|
|
286643
286643
|
}
|
|
286644
|
-
var invokeMap = baseRest(function(collection,
|
|
286645
|
-
var index = -1, isFunc = typeof
|
|
286644
|
+
var invokeMap = baseRest(function(collection, path77, args) {
|
|
286645
|
+
var index = -1, isFunc = typeof path77 == "function", result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
|
|
286646
286646
|
baseEach(collection, function(value) {
|
|
286647
|
-
result2[++index] = isFunc ? apply(
|
|
286647
|
+
result2[++index] = isFunc ? apply(path77, value, args) : baseInvoke(value, path77, args);
|
|
286648
286648
|
});
|
|
286649
286649
|
return result2;
|
|
286650
286650
|
});
|
|
@@ -287296,15 +287296,15 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
287296
287296
|
function functionsIn(object2) {
|
|
287297
287297
|
return object2 == null ? [] : baseFunctions(object2, keysIn(object2));
|
|
287298
287298
|
}
|
|
287299
|
-
function get(object2,
|
|
287300
|
-
var result2 = object2 == null ? undefined2 : baseGet(object2,
|
|
287299
|
+
function get(object2, path77, defaultValue) {
|
|
287300
|
+
var result2 = object2 == null ? undefined2 : baseGet(object2, path77);
|
|
287301
287301
|
return result2 === undefined2 ? defaultValue : result2;
|
|
287302
287302
|
}
|
|
287303
|
-
function has(object2,
|
|
287304
|
-
return object2 != null && hasPath(object2,
|
|
287303
|
+
function has(object2, path77) {
|
|
287304
|
+
return object2 != null && hasPath(object2, path77, baseHas);
|
|
287305
287305
|
}
|
|
287306
|
-
function hasIn(object2,
|
|
287307
|
-
return object2 != null && hasPath(object2,
|
|
287306
|
+
function hasIn(object2, path77) {
|
|
287307
|
+
return object2 != null && hasPath(object2, path77, baseHasIn);
|
|
287308
287308
|
}
|
|
287309
287309
|
var invert = createInverter(function(result2, value, key) {
|
|
287310
287310
|
if (value != null && typeof value.toString != "function") {
|
|
@@ -287357,10 +287357,10 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
287357
287357
|
return result2;
|
|
287358
287358
|
}
|
|
287359
287359
|
var isDeep = false;
|
|
287360
|
-
paths = arrayMap(paths, function(
|
|
287361
|
-
|
|
287362
|
-
isDeep || (isDeep =
|
|
287363
|
-
return
|
|
287360
|
+
paths = arrayMap(paths, function(path77) {
|
|
287361
|
+
path77 = castPath(path77, object2);
|
|
287362
|
+
isDeep || (isDeep = path77.length > 1);
|
|
287363
|
+
return path77;
|
|
287364
287364
|
});
|
|
287365
287365
|
copyObject(object2, getAllKeysIn(object2), result2);
|
|
287366
287366
|
if (isDeep) {
|
|
@@ -287386,19 +287386,19 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
287386
287386
|
return [prop];
|
|
287387
287387
|
});
|
|
287388
287388
|
predicate = getIteratee(predicate);
|
|
287389
|
-
return basePickBy(object2, props, function(value,
|
|
287390
|
-
return predicate(value,
|
|
287389
|
+
return basePickBy(object2, props, function(value, path77) {
|
|
287390
|
+
return predicate(value, path77[0]);
|
|
287391
287391
|
});
|
|
287392
287392
|
}
|
|
287393
|
-
function result(object2,
|
|
287394
|
-
|
|
287395
|
-
var index = -1, length =
|
|
287393
|
+
function result(object2, path77, defaultValue) {
|
|
287394
|
+
path77 = castPath(path77, object2);
|
|
287395
|
+
var index = -1, length = path77.length;
|
|
287396
287396
|
if (!length) {
|
|
287397
287397
|
length = 1;
|
|
287398
287398
|
object2 = undefined2;
|
|
287399
287399
|
}
|
|
287400
287400
|
while (++index < length) {
|
|
287401
|
-
var value = object2 == null ? undefined2 : object2[toKey(
|
|
287401
|
+
var value = object2 == null ? undefined2 : object2[toKey(path77[index])];
|
|
287402
287402
|
if (value === undefined2) {
|
|
287403
287403
|
index = length;
|
|
287404
287404
|
value = defaultValue;
|
|
@@ -287407,12 +287407,12 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
287407
287407
|
}
|
|
287408
287408
|
return object2;
|
|
287409
287409
|
}
|
|
287410
|
-
function set3(object2,
|
|
287411
|
-
return object2 == null ? object2 : baseSet(object2,
|
|
287410
|
+
function set3(object2, path77, value) {
|
|
287411
|
+
return object2 == null ? object2 : baseSet(object2, path77, value);
|
|
287412
287412
|
}
|
|
287413
|
-
function setWith(object2,
|
|
287413
|
+
function setWith(object2, path77, value, customizer) {
|
|
287414
287414
|
customizer = typeof customizer == "function" ? customizer : undefined2;
|
|
287415
|
-
return object2 == null ? object2 : baseSet(object2,
|
|
287415
|
+
return object2 == null ? object2 : baseSet(object2, path77, value, customizer);
|
|
287416
287416
|
}
|
|
287417
287417
|
var toPairs = createToPairs(keys);
|
|
287418
287418
|
var toPairsIn = createToPairs(keysIn);
|
|
@@ -287434,15 +287434,15 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
287434
287434
|
});
|
|
287435
287435
|
return accumulator;
|
|
287436
287436
|
}
|
|
287437
|
-
function unset(object2,
|
|
287438
|
-
return object2 == null ? true : baseUnset(object2,
|
|
287437
|
+
function unset(object2, path77) {
|
|
287438
|
+
return object2 == null ? true : baseUnset(object2, path77);
|
|
287439
287439
|
}
|
|
287440
|
-
function update4(object2,
|
|
287441
|
-
return object2 == null ? object2 : baseUpdate(object2,
|
|
287440
|
+
function update4(object2, path77, updater) {
|
|
287441
|
+
return object2 == null ? object2 : baseUpdate(object2, path77, castFunction(updater));
|
|
287442
287442
|
}
|
|
287443
|
-
function updateWith(object2,
|
|
287443
|
+
function updateWith(object2, path77, updater, customizer) {
|
|
287444
287444
|
customizer = typeof customizer == "function" ? customizer : undefined2;
|
|
287445
|
-
return object2 == null ? object2 : baseUpdate(object2,
|
|
287445
|
+
return object2 == null ? object2 : baseUpdate(object2, path77, castFunction(updater), customizer);
|
|
287446
287446
|
}
|
|
287447
287447
|
function values(object2) {
|
|
287448
287448
|
return object2 == null ? [] : baseValues(object2, keys(object2));
|
|
@@ -287837,17 +287837,17 @@ __p += '`;
|
|
|
287837
287837
|
function matches(source2) {
|
|
287838
287838
|
return baseMatches(baseClone(source2, CLONE_DEEP_FLAG));
|
|
287839
287839
|
}
|
|
287840
|
-
function matchesProperty(
|
|
287841
|
-
return baseMatchesProperty(
|
|
287840
|
+
function matchesProperty(path77, srcValue) {
|
|
287841
|
+
return baseMatchesProperty(path77, baseClone(srcValue, CLONE_DEEP_FLAG));
|
|
287842
287842
|
}
|
|
287843
|
-
var method = baseRest(function(
|
|
287843
|
+
var method = baseRest(function(path77, args) {
|
|
287844
287844
|
return function(object2) {
|
|
287845
|
-
return baseInvoke(object2,
|
|
287845
|
+
return baseInvoke(object2, path77, args);
|
|
287846
287846
|
};
|
|
287847
287847
|
});
|
|
287848
287848
|
var methodOf = baseRest(function(object2, args) {
|
|
287849
|
-
return function(
|
|
287850
|
-
return baseInvoke(object2,
|
|
287849
|
+
return function(path77) {
|
|
287850
|
+
return baseInvoke(object2, path77, args);
|
|
287851
287851
|
};
|
|
287852
287852
|
});
|
|
287853
287853
|
function mixin3(object2, source2, options) {
|
|
@@ -287893,12 +287893,12 @@ __p += '`;
|
|
|
287893
287893
|
var over = createOver(arrayMap);
|
|
287894
287894
|
var overEvery = createOver(arrayEvery);
|
|
287895
287895
|
var overSome = createOver(arraySome);
|
|
287896
|
-
function property(
|
|
287897
|
-
return isKey(
|
|
287896
|
+
function property(path77) {
|
|
287897
|
+
return isKey(path77) ? baseProperty(toKey(path77)) : basePropertyDeep(path77);
|
|
287898
287898
|
}
|
|
287899
287899
|
function propertyOf(object2) {
|
|
287900
|
-
return function(
|
|
287901
|
-
return object2 == null ? undefined2 : baseGet(object2,
|
|
287900
|
+
return function(path77) {
|
|
287901
|
+
return object2 == null ? undefined2 : baseGet(object2, path77);
|
|
287902
287902
|
};
|
|
287903
287903
|
}
|
|
287904
287904
|
var range2 = createRange();
|
|
@@ -288351,12 +288351,12 @@ __p += '`;
|
|
|
288351
288351
|
LazyWrapper.prototype.findLast = function(predicate) {
|
|
288352
288352
|
return this.reverse().find(predicate);
|
|
288353
288353
|
};
|
|
288354
|
-
LazyWrapper.prototype.invokeMap = baseRest(function(
|
|
288355
|
-
if (typeof
|
|
288354
|
+
LazyWrapper.prototype.invokeMap = baseRest(function(path77, args) {
|
|
288355
|
+
if (typeof path77 == "function") {
|
|
288356
288356
|
return new LazyWrapper(this);
|
|
288357
288357
|
}
|
|
288358
288358
|
return this.map(function(value) {
|
|
288359
|
-
return baseInvoke(value,
|
|
288359
|
+
return baseInvoke(value, path77, args);
|
|
288360
288360
|
});
|
|
288361
288361
|
});
|
|
288362
288362
|
LazyWrapper.prototype.reject = function(predicate) {
|
|
@@ -288730,14 +288730,14 @@ function formatDuration(seconds) {
|
|
|
288730
288730
|
}
|
|
288731
288731
|
|
|
288732
288732
|
// src/commands/scenario/src/path-parser.ts
|
|
288733
|
-
function parseParameterPath(
|
|
288734
|
-
if (pathCache.has(
|
|
288735
|
-
return pathCache.get(
|
|
288733
|
+
function parseParameterPath(path77) {
|
|
288734
|
+
if (pathCache.has(path77)) {
|
|
288735
|
+
return pathCache.get(path77);
|
|
288736
288736
|
}
|
|
288737
|
-
if (!
|
|
288737
|
+
if (!path77 || typeof path77 !== "string") {
|
|
288738
288738
|
throw new Error("Path must be a non-empty string");
|
|
288739
288739
|
}
|
|
288740
|
-
if (
|
|
288740
|
+
if (path77.startsWith(".") || path77.endsWith(".")) {
|
|
288741
288741
|
throw new Error("Path cannot start or end with a dot");
|
|
288742
288742
|
}
|
|
288743
288743
|
const segments = [];
|
|
@@ -288745,8 +288745,8 @@ function parseParameterPath(path76) {
|
|
|
288745
288745
|
let currentSegment = "";
|
|
288746
288746
|
let i2 = 0;
|
|
288747
288747
|
let lastCharWasArrayClose = false;
|
|
288748
|
-
while (i2 <
|
|
288749
|
-
const char =
|
|
288748
|
+
while (i2 < path77.length) {
|
|
288749
|
+
const char = path77[i2];
|
|
288750
288750
|
if (char === ".") {
|
|
288751
288751
|
if (currentSegment === "" && !lastCharWasArrayClose) {
|
|
288752
288752
|
throw new Error("Empty segment in path (double dots or leading/trailing dots not allowed)");
|
|
@@ -288763,11 +288763,11 @@ function parseParameterPath(path76) {
|
|
|
288763
288763
|
}
|
|
288764
288764
|
segments.push(currentSegment);
|
|
288765
288765
|
currentSegment = "";
|
|
288766
|
-
const closingBracket =
|
|
288766
|
+
const closingBracket = path77.indexOf("]", i2);
|
|
288767
288767
|
if (closingBracket === -1) {
|
|
288768
288768
|
throw new Error("Missing closing bracket for array index");
|
|
288769
288769
|
}
|
|
288770
|
-
const indexStr =
|
|
288770
|
+
const indexStr = path77.substring(i2 + 1, closingBracket);
|
|
288771
288771
|
if (!/^\d+$/.test(indexStr)) {
|
|
288772
288772
|
throw new Error(`Invalid array index: ${indexStr}`);
|
|
288773
288773
|
}
|
|
@@ -288786,7 +288786,7 @@ function parseParameterPath(path76) {
|
|
|
288786
288786
|
}
|
|
288787
288787
|
if (currentSegment !== "") {
|
|
288788
288788
|
segments.push(currentSegment);
|
|
288789
|
-
} else if (
|
|
288789
|
+
} else if (path77.endsWith(".")) {
|
|
288790
288790
|
throw new Error("Path cannot start or end with a dot");
|
|
288791
288791
|
}
|
|
288792
288792
|
if (segments.length === 0) {
|
|
@@ -288802,24 +288802,24 @@ function parseParameterPath(path76) {
|
|
|
288802
288802
|
const result = {
|
|
288803
288803
|
segments,
|
|
288804
288804
|
hasArrayAccess,
|
|
288805
|
-
originalPath:
|
|
288805
|
+
originalPath: path77
|
|
288806
288806
|
};
|
|
288807
|
-
pathCache.set(
|
|
288807
|
+
pathCache.set(path77, result);
|
|
288808
288808
|
return result;
|
|
288809
288809
|
}
|
|
288810
|
-
function isValidPathSyntax(
|
|
288810
|
+
function isValidPathSyntax(path77) {
|
|
288811
288811
|
try {
|
|
288812
|
-
parseParameterPath(
|
|
288812
|
+
parseParameterPath(path77);
|
|
288813
288813
|
return true;
|
|
288814
288814
|
} catch {
|
|
288815
288815
|
return false;
|
|
288816
288816
|
}
|
|
288817
288817
|
}
|
|
288818
|
-
function normalizeParameterPath(
|
|
288819
|
-
if (!
|
|
288818
|
+
function normalizeParameterPath(path77) {
|
|
288819
|
+
if (!path77 || typeof path77 !== "string") {
|
|
288820
288820
|
return "";
|
|
288821
288821
|
}
|
|
288822
|
-
let normalized =
|
|
288822
|
+
let normalized = path77.trim();
|
|
288823
288823
|
normalized = normalized.replace(/\.+/g, ".");
|
|
288824
288824
|
normalized = normalized.replace(/^\.+|\.+$/g, "");
|
|
288825
288825
|
return normalized;
|
|
@@ -288976,7 +288976,7 @@ __export(exports_parameter_override, {
|
|
|
288976
288976
|
applyParameterOverride: () => applyParameterOverride,
|
|
288977
288977
|
applyMatrixOverrides: () => applyMatrixOverrides
|
|
288978
288978
|
});
|
|
288979
|
-
function validateParameterPath(obj,
|
|
288979
|
+
function validateParameterPath(obj, path77) {
|
|
288980
288980
|
if (!obj || typeof obj !== "object") {
|
|
288981
288981
|
return {
|
|
288982
288982
|
isValid: false,
|
|
@@ -288986,7 +288986,7 @@ function validateParameterPath(obj, path76) {
|
|
|
288986
288986
|
};
|
|
288987
288987
|
}
|
|
288988
288988
|
try {
|
|
288989
|
-
const parsedPath = parseParameterPath(
|
|
288989
|
+
const parsedPath = parseParameterPath(path77);
|
|
288990
288990
|
let current = obj;
|
|
288991
288991
|
let currentPath = "";
|
|
288992
288992
|
for (let i2 = 0;i2 < parsedPath.segments.length; i2++) {
|
|
@@ -289056,54 +289056,54 @@ function validateParameterPath(obj, path76) {
|
|
|
289056
289056
|
};
|
|
289057
289057
|
}
|
|
289058
289058
|
}
|
|
289059
|
-
function validateParameterPathLegacy(obj,
|
|
289060
|
-
const result = validateParameterPath(obj,
|
|
289059
|
+
function validateParameterPathLegacy(obj, path77) {
|
|
289060
|
+
const result = validateParameterPath(obj, path77);
|
|
289061
289061
|
return result.isValid;
|
|
289062
289062
|
}
|
|
289063
|
-
function getValueAtPath(obj,
|
|
289064
|
-
const parsedPath = parseParameterPath(
|
|
289063
|
+
function getValueAtPath(obj, path77) {
|
|
289064
|
+
const parsedPath = parseParameterPath(path77);
|
|
289065
289065
|
let current = obj;
|
|
289066
289066
|
for (let i2 = 0;i2 < parsedPath.segments.length; i2++) {
|
|
289067
289067
|
const segment = parsedPath.segments[i2];
|
|
289068
289068
|
if (typeof segment === "number") {
|
|
289069
289069
|
if (!Array.isArray(current)) {
|
|
289070
|
-
throw new Error(`Expected array at path segment, but found ${typeof current} in path: ${
|
|
289070
|
+
throw new Error(`Expected array at path segment, but found ${typeof current} in path: ${path77}`);
|
|
289071
289071
|
}
|
|
289072
289072
|
if (segment >= current.length || segment < 0) {
|
|
289073
|
-
throw new Error(`Array index out of bounds: ${segment} in path: ${
|
|
289073
|
+
throw new Error(`Array index out of bounds: ${segment} in path: ${path77}`);
|
|
289074
289074
|
}
|
|
289075
289075
|
current = current[segment];
|
|
289076
289076
|
} else {
|
|
289077
289077
|
if (!current || typeof current !== "object") {
|
|
289078
|
-
throw new Error(`Expected object at path segment, but found ${typeof current} in path: ${
|
|
289078
|
+
throw new Error(`Expected object at path segment, but found ${typeof current} in path: ${path77}`);
|
|
289079
289079
|
}
|
|
289080
289080
|
if (!(segment in current)) {
|
|
289081
|
-
throw new Error(`Property '${segment}' not found in path: ${
|
|
289081
|
+
throw new Error(`Property '${segment}' not found in path: ${path77}`);
|
|
289082
289082
|
}
|
|
289083
289083
|
current = current[segment];
|
|
289084
289084
|
}
|
|
289085
289085
|
}
|
|
289086
289086
|
return current;
|
|
289087
289087
|
}
|
|
289088
|
-
function setValueAtPath(obj,
|
|
289089
|
-
const parsedPath = parseParameterPath(
|
|
289088
|
+
function setValueAtPath(obj, path77, value) {
|
|
289089
|
+
const parsedPath = parseParameterPath(path77);
|
|
289090
289090
|
let current = obj;
|
|
289091
289091
|
for (let i2 = 0;i2 < parsedPath.segments.length - 1; i2++) {
|
|
289092
289092
|
const segment = parsedPath.segments[i2];
|
|
289093
289093
|
if (typeof segment === "number") {
|
|
289094
289094
|
if (!Array.isArray(current)) {
|
|
289095
|
-
throw new Error(`Expected array at path segment, but found ${typeof current} in path: ${
|
|
289095
|
+
throw new Error(`Expected array at path segment, but found ${typeof current} in path: ${path77}`);
|
|
289096
289096
|
}
|
|
289097
289097
|
if (segment >= current.length || segment < 0) {
|
|
289098
|
-
throw new Error(`Array index out of bounds: ${segment} in path: ${
|
|
289098
|
+
throw new Error(`Array index out of bounds: ${segment} in path: ${path77}`);
|
|
289099
289099
|
}
|
|
289100
289100
|
current = current[segment];
|
|
289101
289101
|
} else {
|
|
289102
289102
|
if (!current || typeof current !== "object") {
|
|
289103
|
-
throw new Error(`Expected object at path segment, but found ${typeof current} in path: ${
|
|
289103
|
+
throw new Error(`Expected object at path segment, but found ${typeof current} in path: ${path77}`);
|
|
289104
289104
|
}
|
|
289105
289105
|
if (!(segment in current)) {
|
|
289106
|
-
throw new Error(`Property '${segment}' not found in path: ${
|
|
289106
|
+
throw new Error(`Property '${segment}' not found in path: ${path77}`);
|
|
289107
289107
|
}
|
|
289108
289108
|
current = current[segment];
|
|
289109
289109
|
}
|
|
@@ -289111,27 +289111,27 @@ function setValueAtPath(obj, path76, value) {
|
|
|
289111
289111
|
const finalSegment = parsedPath.segments[parsedPath.segments.length - 1];
|
|
289112
289112
|
if (typeof finalSegment === "number") {
|
|
289113
289113
|
if (!Array.isArray(current)) {
|
|
289114
|
-
throw new Error(`Expected array for final segment, but found ${typeof current} in path: ${
|
|
289114
|
+
throw new Error(`Expected array for final segment, but found ${typeof current} in path: ${path77}`);
|
|
289115
289115
|
}
|
|
289116
289116
|
if (finalSegment >= current.length || finalSegment < 0) {
|
|
289117
|
-
throw new Error(`Array index out of bounds: ${finalSegment} in path: ${
|
|
289117
|
+
throw new Error(`Array index out of bounds: ${finalSegment} in path: ${path77}`);
|
|
289118
289118
|
}
|
|
289119
289119
|
current[finalSegment] = value;
|
|
289120
289120
|
} else {
|
|
289121
289121
|
if (!current || typeof current !== "object") {
|
|
289122
|
-
throw new Error(`Expected object for final segment, but found ${typeof current} in path: ${
|
|
289122
|
+
throw new Error(`Expected object for final segment, but found ${typeof current} in path: ${path77}`);
|
|
289123
289123
|
}
|
|
289124
289124
|
current[finalSegment] = value;
|
|
289125
289125
|
}
|
|
289126
289126
|
}
|
|
289127
|
-
function applyParameterOverride(scenario,
|
|
289127
|
+
function applyParameterOverride(scenario, path77, value) {
|
|
289128
289128
|
const clonedScenario = deepClone(scenario);
|
|
289129
|
-
setValueAtPath(clonedScenario,
|
|
289129
|
+
setValueAtPath(clonedScenario, path77, value);
|
|
289130
289130
|
return clonedScenario;
|
|
289131
289131
|
}
|
|
289132
289132
|
function applyMatrixOverrides(baseScenario, overrides) {
|
|
289133
|
-
const parameterOverrides = Object.entries(overrides).map(([
|
|
289134
|
-
path:
|
|
289133
|
+
const parameterOverrides = Object.entries(overrides).map(([path77, value]) => ({
|
|
289134
|
+
path: path77,
|
|
289135
289135
|
value
|
|
289136
289136
|
}));
|
|
289137
289137
|
return applyParameterOverrides(baseScenario, parameterOverrides);
|
|
@@ -289189,8 +289189,8 @@ function applyParameterOverrides(baseScenario, overrides) {
|
|
|
289189
289189
|
return modifiedScenario;
|
|
289190
289190
|
}
|
|
289191
289191
|
function combinationToOverrides(combination) {
|
|
289192
|
-
return Object.entries(combination).map(([
|
|
289193
|
-
path:
|
|
289192
|
+
return Object.entries(combination).map(([path77, value]) => ({
|
|
289193
|
+
path: path77,
|
|
289194
289194
|
value
|
|
289195
289195
|
}));
|
|
289196
289196
|
}
|
|
@@ -289294,16 +289294,16 @@ async function ensureIsolatedDatabase(dbPath) {
|
|
|
289294
289294
|
async function writeTemporaryScenario(scenarioPath, baseScenario, parameters) {
|
|
289295
289295
|
try {
|
|
289296
289296
|
const modifiedScenario = JSON.parse(JSON.stringify(baseScenario));
|
|
289297
|
-
for (const [
|
|
289298
|
-
setNestedProperty(modifiedScenario,
|
|
289297
|
+
for (const [path77, value] of Object.entries(parameters)) {
|
|
289298
|
+
setNestedProperty(modifiedScenario, path77, value);
|
|
289299
289299
|
}
|
|
289300
289300
|
await fs52.writeFile(scenarioPath, JSON.stringify(modifiedScenario, null, 2));
|
|
289301
289301
|
} catch (error47) {
|
|
289302
289302
|
throw new Error(`Failed to write temporary scenario: ${error47 instanceof Error ? error47.message : String(error47)}`);
|
|
289303
289303
|
}
|
|
289304
289304
|
}
|
|
289305
|
-
function setNestedProperty(obj,
|
|
289306
|
-
const keys =
|
|
289305
|
+
function setNestedProperty(obj, path77, value) {
|
|
289306
|
+
const keys = path77.split(".");
|
|
289307
289307
|
let current = obj;
|
|
289308
289308
|
for (let i2 = 0;i2 < keys.length - 1; i2++) {
|
|
289309
289309
|
const key = keys[i2];
|
|
@@ -289969,8 +289969,8 @@ async function calculateDiskUsage(dirPath) {
|
|
|
289969
289969
|
stdout: "pipe",
|
|
289970
289970
|
stderr: "pipe"
|
|
289971
289971
|
});
|
|
289972
|
-
const
|
|
289973
|
-
const lines =
|
|
289972
|
+
const output3 = await new Response(proc6.stdout).text();
|
|
289973
|
+
const lines = output3.split(`
|
|
289974
289974
|
`);
|
|
289975
289975
|
const freeBytes = parseInt(lines[0].split(":")[1].trim());
|
|
289976
289976
|
const totalBytes = parseInt(lines[1].split(":")[1].trim());
|
|
@@ -289990,8 +289990,8 @@ async function calculateDiskUsage(dirPath) {
|
|
|
289990
289990
|
stdout: "pipe",
|
|
289991
289991
|
stderr: "pipe"
|
|
289992
289992
|
});
|
|
289993
|
-
const
|
|
289994
|
-
const lines =
|
|
289993
|
+
const output3 = await new Response(proc6.stdout).text();
|
|
289994
|
+
const lines = output3.split(`
|
|
289995
289995
|
`);
|
|
289996
289996
|
const data = lines[1].split(/\s+/);
|
|
289997
289997
|
const totalKB = parseInt(data[1]);
|
|
@@ -316250,25 +316250,218 @@ ${emoji.error("Error: Failed to run Phala CLI")}`);
|
|
|
316250
316250
|
console.log(" $ npx phala help");
|
|
316251
316251
|
});
|
|
316252
316252
|
|
|
316253
|
+
// src/commands/tee/eigen-wrapper.ts
|
|
316254
|
+
init_esm();
|
|
316255
|
+
init_emoji_handler();
|
|
316256
|
+
init_bun_exec();
|
|
316257
|
+
import { logger as logger49 } from "@elizaos/core";
|
|
316258
|
+
import readline3 from "readline/promises";
|
|
316259
|
+
import { stdin as input2, stdout as output2 } from "process";
|
|
316260
|
+
import path69 from "path";
|
|
316261
|
+
var findRawArgs = (cmd) => {
|
|
316262
|
+
const commandWithRawArgs = cmd;
|
|
316263
|
+
const parentRawArgs = commandWithRawArgs.parent?.rawArgs;
|
|
316264
|
+
if (Array.isArray(parentRawArgs)) {
|
|
316265
|
+
return parentRawArgs;
|
|
316266
|
+
}
|
|
316267
|
+
if (Array.isArray(commandWithRawArgs.rawArgs)) {
|
|
316268
|
+
return commandWithRawArgs.rawArgs;
|
|
316269
|
+
}
|
|
316270
|
+
return process.argv;
|
|
316271
|
+
};
|
|
316272
|
+
var sliceArgsAfterSubcommand = (rawArgs, subcommand) => {
|
|
316273
|
+
const subcommandIndex = rawArgs.findIndex((arg) => arg === subcommand);
|
|
316274
|
+
if (subcommandIndex >= 0) {
|
|
316275
|
+
return rawArgs.slice(subcommandIndex + 1);
|
|
316276
|
+
}
|
|
316277
|
+
return [];
|
|
316278
|
+
};
|
|
316279
|
+
var eigenCliCommand = new Command("eigen").description("Eigen CLI - Manage TEE deployments on Eigen infrastructure").allowUnknownOption().helpOption(false).allowExcessArguments(true).passThroughOptions().argument("[args...]", "All arguments to pass to the Eigen CLI").action(async (...commandArgs) => {
|
|
316280
|
+
const cmd = commandArgs[commandArgs.length - 1];
|
|
316281
|
+
const rawArgs = findRawArgs(cmd);
|
|
316282
|
+
const argsFromRaw = sliceArgsAfterSubcommand(rawArgs, "eigen");
|
|
316283
|
+
const args = argsFromRaw.length > 0 ? argsFromRaw : Array.isArray(commandArgs[0]) ? commandArgs[0] : [];
|
|
316284
|
+
const candidateBinaries = (() => {
|
|
316285
|
+
const candidates = new Set;
|
|
316286
|
+
const fromEnv = process.env.EIGENX_BIN;
|
|
316287
|
+
if (fromEnv && fromEnv.trim().length > 0) {
|
|
316288
|
+
candidates.add(fromEnv);
|
|
316289
|
+
}
|
|
316290
|
+
candidates.add("eigenx");
|
|
316291
|
+
candidates.add("eigenx-dev");
|
|
316292
|
+
const home = process.env.HOME;
|
|
316293
|
+
if (home) {
|
|
316294
|
+
const potentialDirs = [
|
|
316295
|
+
path69.join(home, "bin"),
|
|
316296
|
+
path69.join(home, ".local", "bin"),
|
|
316297
|
+
path69.join(home, ".eigenx", "bin")
|
|
316298
|
+
];
|
|
316299
|
+
for (const dir of potentialDirs) {
|
|
316300
|
+
candidates.add(path69.join(dir, "eigenx"));
|
|
316301
|
+
candidates.add(path69.join(dir, "eigenx-dev"));
|
|
316302
|
+
}
|
|
316303
|
+
}
|
|
316304
|
+
const commonDirs = ["/usr/local/bin", "/usr/bin", "/opt/homebrew/bin"];
|
|
316305
|
+
for (const dir of commonDirs) {
|
|
316306
|
+
candidates.add(path69.join(dir, "eigenx"));
|
|
316307
|
+
candidates.add(path69.join(dir, "eigenx-dev"));
|
|
316308
|
+
}
|
|
316309
|
+
return Array.from(candidates);
|
|
316310
|
+
})();
|
|
316311
|
+
const resolveCandidate = async (candidate) => {
|
|
316312
|
+
if (path69.isAbsolute(candidate)) {
|
|
316313
|
+
try {
|
|
316314
|
+
const file2 = Bun.file(candidate);
|
|
316315
|
+
const exists = await file2.exists();
|
|
316316
|
+
if (exists) {
|
|
316317
|
+
return { command: candidate, additionalPath: path69.dirname(candidate) };
|
|
316318
|
+
}
|
|
316319
|
+
} catch {}
|
|
316320
|
+
return null;
|
|
316321
|
+
}
|
|
316322
|
+
if (await commandExists(candidate)) {
|
|
316323
|
+
return { command: candidate };
|
|
316324
|
+
}
|
|
316325
|
+
return null;
|
|
316326
|
+
};
|
|
316327
|
+
const ensureEigenCli = async () => {
|
|
316328
|
+
for (const candidate of candidateBinaries) {
|
|
316329
|
+
const resolved = await resolveCandidate(candidate);
|
|
316330
|
+
if (resolved) {
|
|
316331
|
+
return resolved;
|
|
316332
|
+
}
|
|
316333
|
+
}
|
|
316334
|
+
return null;
|
|
316335
|
+
};
|
|
316336
|
+
let resolvedBinary = await ensureEigenCli();
|
|
316337
|
+
if (!resolvedBinary) {
|
|
316338
|
+
logger49.warn("Eigen CLI binary not found in PATH.");
|
|
316339
|
+
logger49.warn("Attempting to install the Eigen CLI with user consent.");
|
|
316340
|
+
const autoInstall = process.env.ELIZA_TEE_EIGEN_AUTO_INSTALL === "true";
|
|
316341
|
+
const isInteractive2 = process.stdin.isTTY && process.stdout.isTTY;
|
|
316342
|
+
if (!autoInstall && !isInteractive2) {
|
|
316343
|
+
logger49.error(`
|
|
316344
|
+
${emoji.error("Error: Eigen CLI not installed and cannot prompt in non-interactive mode.")}`);
|
|
316345
|
+
logger49.error(" Install manually:");
|
|
316346
|
+
logger49.error(" curl -fsSL https://eigenx-scripts.s3.us-east-1.amazonaws.com/install-eigenx.sh | bash");
|
|
316347
|
+
process.exit(1);
|
|
316348
|
+
return;
|
|
316349
|
+
}
|
|
316350
|
+
let userConsent = autoInstall;
|
|
316351
|
+
if (!autoInstall) {
|
|
316352
|
+
const rl = readline3.createInterface({ input: input2, output: output2 });
|
|
316353
|
+
console.log("");
|
|
316354
|
+
console.log("Eigen CLI Installer");
|
|
316355
|
+
console.log(" This will download and install the Eigen CLI by running:");
|
|
316356
|
+
console.log(" curl -fsSL https://eigenx-scripts.s3.us-east-1.amazonaws.com/install-eigenx.sh | bash");
|
|
316357
|
+
console.log("");
|
|
316358
|
+
console.log("The script adds eigenx binaries (eigenx, eigenx-dev) to your PATH.");
|
|
316359
|
+
console.log("");
|
|
316360
|
+
const answer = (await rl.question("Proceed with Eigen CLI installation? [y/N] ")).trim().toLowerCase();
|
|
316361
|
+
rl.close();
|
|
316362
|
+
userConsent = answer === "y" || answer === "yes";
|
|
316363
|
+
}
|
|
316364
|
+
if (!userConsent) {
|
|
316365
|
+
logger49.error(`
|
|
316366
|
+
${emoji.error("Eigen CLI installation is required to run this command.")}`);
|
|
316367
|
+
logger49.error(" Installation can be performed at any time using:");
|
|
316368
|
+
logger49.error(" curl -fsSL https://eigenx-scripts.s3.us-east-1.amazonaws.com/install-eigenx.sh | bash");
|
|
316369
|
+
process.exit(1);
|
|
316370
|
+
return;
|
|
316371
|
+
}
|
|
316372
|
+
const curlAvailable = await commandExists("curl");
|
|
316373
|
+
if (!curlAvailable) {
|
|
316374
|
+
logger49.error(`
|
|
316375
|
+
${emoji.error("Error: curl is required to install the Eigen CLI.")}`);
|
|
316376
|
+
logger49.error(" Please install curl and try again.");
|
|
316377
|
+
process.exit(1);
|
|
316378
|
+
return;
|
|
316379
|
+
}
|
|
316380
|
+
logger49.info("Installing Eigen CLI...");
|
|
316381
|
+
try {
|
|
316382
|
+
await bunExecInherit("bash", [
|
|
316383
|
+
"-c",
|
|
316384
|
+
"curl -fsSL https://eigenx-scripts.s3.us-east-1.amazonaws.com/install-eigenx.sh | bash"
|
|
316385
|
+
]);
|
|
316386
|
+
} catch (error47) {
|
|
316387
|
+
logger49.error({ error: error47 }, "Eigen CLI installation failed");
|
|
316388
|
+
logger49.error(" Please review the output above for details.");
|
|
316389
|
+
process.exit(1);
|
|
316390
|
+
return;
|
|
316391
|
+
}
|
|
316392
|
+
resolvedBinary = await ensureEigenCli();
|
|
316393
|
+
if (!resolvedBinary) {
|
|
316394
|
+
logger49.error(`
|
|
316395
|
+
${emoji.error("Error: Eigen CLI installation completed, but binary not found in PATH.")}`);
|
|
316396
|
+
logger49.error(" Ensure your PATH includes the location where eigenx was installed.");
|
|
316397
|
+
process.exit(1);
|
|
316398
|
+
return;
|
|
316399
|
+
}
|
|
316400
|
+
logger49.info({ binary: resolvedBinary.command }, "Eigen CLI installation completed successfully.");
|
|
316401
|
+
}
|
|
316402
|
+
const prependPathEntries = [];
|
|
316403
|
+
if (resolvedBinary.additionalPath) {
|
|
316404
|
+
prependPathEntries.push(resolvedBinary.additionalPath);
|
|
316405
|
+
}
|
|
316406
|
+
if (process.env.ELIZA_TEE_EIGEN_EXTRA_PATHS) {
|
|
316407
|
+
const extraPaths = process.env.ELIZA_TEE_EIGEN_EXTRA_PATHS.split(path69.delimiter).map((p2) => p2.trim()).filter((p2) => p2.length > 0);
|
|
316408
|
+
prependPathEntries.push(...extraPaths);
|
|
316409
|
+
}
|
|
316410
|
+
const envOverride = (() => {
|
|
316411
|
+
if (prependPathEntries.length === 0) {
|
|
316412
|
+
return;
|
|
316413
|
+
}
|
|
316414
|
+
const existingPath = process.env.PATH ?? "";
|
|
316415
|
+
const combined = [...prependPathEntries, existingPath].filter((entry) => entry.length > 0).join(path69.delimiter);
|
|
316416
|
+
return { PATH: combined };
|
|
316417
|
+
})();
|
|
316418
|
+
logger49.info({ args, binary: resolvedBinary.command }, "Running Eigen CLI command");
|
|
316419
|
+
try {
|
|
316420
|
+
const result = await bunExecInherit(resolvedBinary.command, args, envOverride ? { env: envOverride } : {});
|
|
316421
|
+
process.exit(result.exitCode ?? 0);
|
|
316422
|
+
} catch (error47) {
|
|
316423
|
+
logger49.error({ error: error47, args, binary: resolvedBinary.command }, "Failed to execute Eigen CLI");
|
|
316424
|
+
process.exit(1);
|
|
316425
|
+
}
|
|
316426
|
+
}).configureHelp({
|
|
316427
|
+
helpWidth: 100
|
|
316428
|
+
}).on("--help", () => {
|
|
316429
|
+
console.log("");
|
|
316430
|
+
console.log("This command wraps the official Eigen CLI (eigenx).");
|
|
316431
|
+
console.log("Ensure the Eigen CLI binary is installed and available on your PATH.");
|
|
316432
|
+
console.log("All arguments are passed directly to the Eigen CLI.");
|
|
316433
|
+
console.log("");
|
|
316434
|
+
console.log("Examples:");
|
|
316435
|
+
console.log(" $ elizaos tee eigen help");
|
|
316436
|
+
console.log(" $ elizaos tee eigen app list");
|
|
316437
|
+
console.log(" $ elizaos tee eigen app deploy myregistry/myapp:v1.0");
|
|
316438
|
+
console.log("");
|
|
316439
|
+
console.log("For full Eigen CLI documentation, run:");
|
|
316440
|
+
console.log(" $ eigenx help");
|
|
316441
|
+
console.log("");
|
|
316442
|
+
console.log("Installation:");
|
|
316443
|
+
console.log(" $ curl -fsSL https://eigenx-scripts.s3.us-east-1.amazonaws.com/install-eigenx.sh | bash");
|
|
316444
|
+
});
|
|
316445
|
+
|
|
316253
316446
|
// src/commands/tee/index.ts
|
|
316254
|
-
var teeCommand = new Command("tee").description("Manage TEE deployments").enablePositionalOptions().addCommand(phalaCliCommand);
|
|
316447
|
+
var teeCommand = new Command("tee").description("Manage TEE deployments").enablePositionalOptions().addCommand(phalaCliCommand).addCommand(eigenCliCommand);
|
|
316255
316448
|
|
|
316256
316449
|
// src/commands/test/index.ts
|
|
316257
316450
|
init_utils();
|
|
316258
316451
|
init_esm();
|
|
316259
|
-
import { logger as
|
|
316452
|
+
import { logger as logger56 } from "@elizaos/core";
|
|
316260
316453
|
|
|
316261
316454
|
// src/commands/test/actions/run-all-tests.ts
|
|
316262
|
-
import { logger as
|
|
316455
|
+
import { logger as logger54 } from "@elizaos/core";
|
|
316263
316456
|
|
|
316264
316457
|
// src/commands/test/utils/project-utils.ts
|
|
316265
316458
|
init_directory_detection();
|
|
316266
316459
|
init_run_bun();
|
|
316267
|
-
import { logger as
|
|
316460
|
+
import { logger as logger50 } from "@elizaos/core";
|
|
316268
316461
|
import * as fs46 from "fs";
|
|
316269
|
-
import
|
|
316462
|
+
import path70 from "path";
|
|
316270
316463
|
function getProjectType(testPath) {
|
|
316271
|
-
const targetPath = testPath ?
|
|
316464
|
+
const targetPath = testPath ? path70.resolve(process.cwd(), testPath) : process.cwd();
|
|
316272
316465
|
return detectDirectoryType(targetPath);
|
|
316273
316466
|
}
|
|
316274
316467
|
function processFilterName(name2) {
|
|
@@ -316288,11 +316481,11 @@ async function installPluginDependencies(projectInfo) {
|
|
|
316288
316481
|
}
|
|
316289
316482
|
const project = await loadProject(process.cwd());
|
|
316290
316483
|
if (project.isPlugin && project.pluginModule?.dependencies && project.pluginModule.dependencies.length > 0) {
|
|
316291
|
-
const pluginsDir =
|
|
316484
|
+
const pluginsDir = path70.join(process.cwd(), ".eliza", "plugins");
|
|
316292
316485
|
if (!fs46.existsSync(pluginsDir)) {
|
|
316293
316486
|
await fs46.promises.mkdir(pluginsDir, { recursive: true });
|
|
316294
316487
|
}
|
|
316295
|
-
const packageJsonPath =
|
|
316488
|
+
const packageJsonPath = path70.join(pluginsDir, "package.json");
|
|
316296
316489
|
if (!fs46.existsSync(packageJsonPath)) {
|
|
316297
316490
|
const packageJsonContent = {
|
|
316298
316491
|
name: "test-plugin-dependencies",
|
|
@@ -316305,12 +316498,12 @@ async function installPluginDependencies(projectInfo) {
|
|
|
316305
316498
|
const { installPlugin: installPlugin2 } = await Promise.resolve().then(() => (init_utils(), exports_utils));
|
|
316306
316499
|
for (const dependency of project.pluginModule.dependencies) {
|
|
316307
316500
|
await installPlugin2(dependency, pluginsDir);
|
|
316308
|
-
const dependencyPath =
|
|
316501
|
+
const dependencyPath = path70.join(pluginsDir, "node_modules", dependency);
|
|
316309
316502
|
if (fs46.existsSync(dependencyPath)) {
|
|
316310
316503
|
try {
|
|
316311
316504
|
await runBunCommand(["install"], dependencyPath);
|
|
316312
316505
|
} catch (error47) {
|
|
316313
|
-
|
|
316506
|
+
logger50.warn(`[Test Command] Failed to install devDependencies for ${dependency}: ${error47}`);
|
|
316314
316507
|
}
|
|
316315
316508
|
}
|
|
316316
316509
|
}
|
|
@@ -316320,16 +316513,16 @@ async function installPluginDependencies(projectInfo) {
|
|
|
316320
316513
|
// src/commands/test/actions/component-tests.ts
|
|
316321
316514
|
init_utils();
|
|
316322
316515
|
init_bun_exec();
|
|
316323
|
-
import { logger as
|
|
316324
|
-
import
|
|
316516
|
+
import { logger as logger52 } from "@elizaos/core";
|
|
316517
|
+
import path72 from "path";
|
|
316325
316518
|
|
|
316326
316519
|
// src/utils/testing/tsc-validator.ts
|
|
316327
316520
|
init_bun_exec();
|
|
316328
|
-
import { logger as
|
|
316329
|
-
import
|
|
316521
|
+
import { logger as logger51 } from "@elizaos/core";
|
|
316522
|
+
import path71 from "path";
|
|
316330
316523
|
import { existsSync as existsSync44 } from "fs";
|
|
316331
316524
|
async function runTypeCheck(projectPath, strict = true) {
|
|
316332
|
-
const tsconfigPath =
|
|
316525
|
+
const tsconfigPath = path71.join(projectPath, "tsconfig.json");
|
|
316333
316526
|
if (!existsSync44(tsconfigPath)) {
|
|
316334
316527
|
return {
|
|
316335
316528
|
success: false,
|
|
@@ -316353,7 +316546,7 @@ async function runTypeCheck(projectPath, strict = true) {
|
|
|
316353
316546
|
warnings: stderr.includes("warning") ? [stderr] : []
|
|
316354
316547
|
};
|
|
316355
316548
|
} catch (error47) {
|
|
316356
|
-
|
|
316549
|
+
logger51.error({ error: error47 }, "TypeScript validation failed:");
|
|
316357
316550
|
return {
|
|
316358
316551
|
success: false,
|
|
316359
316552
|
errors: [`TypeScript validation error: ${error47.message}`],
|
|
@@ -316367,38 +316560,38 @@ async function runComponentTests(testPath, options, projectInfo) {
|
|
|
316367
316560
|
const cwd = process.cwd();
|
|
316368
316561
|
const isPlugin2 = projectInfo.type === "elizaos-plugin";
|
|
316369
316562
|
if (!options.skipTypeCheck) {
|
|
316370
|
-
|
|
316563
|
+
logger52.info("Running TypeScript validation...");
|
|
316371
316564
|
const typeCheckResult = await runTypeCheck(cwd, true);
|
|
316372
316565
|
if (!typeCheckResult.success) {
|
|
316373
|
-
|
|
316374
|
-
typeCheckResult.errors.forEach((error47) =>
|
|
316566
|
+
logger52.error("TypeScript validation failed:");
|
|
316567
|
+
typeCheckResult.errors.forEach((error47) => logger52.error(error47));
|
|
316375
316568
|
return { failed: true };
|
|
316376
316569
|
}
|
|
316377
|
-
|
|
316570
|
+
logger52.success("TypeScript validation passed");
|
|
316378
316571
|
}
|
|
316379
316572
|
if (!options.skipBuild) {
|
|
316380
316573
|
try {
|
|
316381
|
-
|
|
316574
|
+
logger52.info(`Building ${isPlugin2 ? "plugin" : "project"}...`);
|
|
316382
316575
|
await buildProject(cwd, isPlugin2);
|
|
316383
|
-
|
|
316576
|
+
logger52.success(`Build completed successfully`);
|
|
316384
316577
|
} catch (buildError) {
|
|
316385
|
-
|
|
316578
|
+
logger52.error(`Build failed: ${buildError}`);
|
|
316386
316579
|
return { failed: true };
|
|
316387
316580
|
}
|
|
316388
316581
|
}
|
|
316389
|
-
|
|
316582
|
+
logger52.info("Running component tests...");
|
|
316390
316583
|
const args = ["test", "--passWithNoTests"];
|
|
316391
316584
|
if (options.name) {
|
|
316392
316585
|
const baseName = processFilterName(options.name);
|
|
316393
316586
|
if (baseName) {
|
|
316394
|
-
|
|
316587
|
+
logger52.info(`Using test filter: ${baseName}`);
|
|
316395
316588
|
args.push("-t", baseName);
|
|
316396
316589
|
}
|
|
316397
316590
|
}
|
|
316398
316591
|
const monorepoRoot = UserEnvironment.getInstance().findMonorepoRoot(process.cwd());
|
|
316399
316592
|
const baseDir = monorepoRoot ?? process.cwd();
|
|
316400
|
-
const targetPath = testPath ?
|
|
316401
|
-
|
|
316593
|
+
const targetPath = testPath ? path72.resolve(baseDir, testPath) : process.cwd();
|
|
316594
|
+
logger52.info(`Executing: bun ${args.join(" ")} in ${targetPath}`);
|
|
316402
316595
|
try {
|
|
316403
316596
|
const result = await bunExecInherit("bun", args, {
|
|
316404
316597
|
cwd: targetPath,
|
|
@@ -316407,10 +316600,10 @@ async function runComponentTests(testPath, options, projectInfo) {
|
|
|
316407
316600
|
CI: ""
|
|
316408
316601
|
}
|
|
316409
316602
|
});
|
|
316410
|
-
|
|
316603
|
+
logger52.info("Component tests completed");
|
|
316411
316604
|
return { failed: !result.success };
|
|
316412
316605
|
} catch (error47) {
|
|
316413
|
-
|
|
316606
|
+
logger52.error({ error: error47 }, "Error running component tests:");
|
|
316414
316607
|
return { failed: true };
|
|
316415
316608
|
}
|
|
316416
316609
|
}
|
|
@@ -316419,20 +316612,20 @@ async function runComponentTests(testPath, options, projectInfo) {
|
|
|
316419
316612
|
init_utils();
|
|
316420
316613
|
init_module_loader();
|
|
316421
316614
|
var dotenv6 = __toESM(require_main(), 1);
|
|
316422
|
-
import { logger as
|
|
316615
|
+
import { logger as logger53 } from "@elizaos/core";
|
|
316423
316616
|
import * as fs47 from "fs";
|
|
316424
|
-
import
|
|
316617
|
+
import path73 from "path";
|
|
316425
316618
|
async function runE2eTests(testPath, options, projectInfo) {
|
|
316426
316619
|
if (!options.skipBuild) {
|
|
316427
316620
|
try {
|
|
316428
316621
|
const cwd = process.cwd();
|
|
316429
316622
|
const isPlugin2 = projectInfo.type === "elizaos-plugin";
|
|
316430
|
-
|
|
316623
|
+
logger53.info(`Building ${isPlugin2 ? "plugin" : "project"}...`);
|
|
316431
316624
|
await buildProject(cwd, isPlugin2);
|
|
316432
|
-
|
|
316625
|
+
logger53.info(`Build completed successfully`);
|
|
316433
316626
|
} catch (buildError) {
|
|
316434
|
-
|
|
316435
|
-
|
|
316627
|
+
logger53.error(`Build error: ${buildError}`);
|
|
316628
|
+
logger53.warn(`Attempting to continue with tests despite build error`);
|
|
316436
316629
|
}
|
|
316437
316630
|
}
|
|
316438
316631
|
let server2;
|
|
@@ -316442,10 +316635,10 @@ async function runE2eTests(testPath, options, projectInfo) {
|
|
|
316442
316635
|
const moduleLoader = getModuleLoader();
|
|
316443
316636
|
const serverModule = await moduleLoader.load("@elizaos/server");
|
|
316444
316637
|
const { AgentServer, jsonToCharacter, loadCharacterTryPath } = serverModule;
|
|
316445
|
-
const elizaDir =
|
|
316446
|
-
const packageName =
|
|
316638
|
+
const elizaDir = path73.join(process.cwd(), ".eliza");
|
|
316639
|
+
const packageName = path73.basename(process.cwd());
|
|
316447
316640
|
const timestamp = Date.now();
|
|
316448
|
-
const uniqueDbDir =
|
|
316641
|
+
const uniqueDbDir = path73.join(process.cwd(), ".elizadb-test", `${packageName}-${timestamp}`);
|
|
316449
316642
|
const elizaDbDir = uniqueDbDir;
|
|
316450
316643
|
const envInfo = await UserEnvironment.getInstanceInfo();
|
|
316451
316644
|
const envFilePath = envInfo.paths.envFilePath;
|
|
@@ -316469,74 +316662,74 @@ async function runE2eTests(testPath, options, projectInfo) {
|
|
|
316469
316662
|
process.env.PGLITE_DATA_DIR = elizaDbDir;
|
|
316470
316663
|
console.info(`Set PGLITE_DATA_DIR to: ${elizaDbDir}`);
|
|
316471
316664
|
if (fs47.existsSync(envFilePath)) {
|
|
316472
|
-
|
|
316665
|
+
logger53.info(`Loading environment variables from: ${envFilePath}`);
|
|
316473
316666
|
dotenv6.config({ path: envFilePath });
|
|
316474
|
-
|
|
316667
|
+
logger53.info("Environment variables loaded");
|
|
316475
316668
|
} else {
|
|
316476
|
-
|
|
316669
|
+
logger53.warn(`Environment file not found: ${envFilePath}`);
|
|
316477
316670
|
}
|
|
316478
316671
|
const postgresUrl = process.env.POSTGRES_URL;
|
|
316479
|
-
|
|
316480
|
-
|
|
316672
|
+
logger53.info(`PostgreSQL URL for e2e tests: ${postgresUrl ? "found" : "not found (will use PGlite)"}`);
|
|
316673
|
+
logger53.info("Creating server instance...");
|
|
316481
316674
|
server2 = new AgentServer;
|
|
316482
|
-
|
|
316483
|
-
|
|
316675
|
+
logger53.info("Server instance created");
|
|
316676
|
+
logger53.info("Initializing server...");
|
|
316484
316677
|
try {
|
|
316485
316678
|
await server2.initialize({
|
|
316486
316679
|
dataDir: elizaDbDir,
|
|
316487
316680
|
postgresUrl
|
|
316488
316681
|
});
|
|
316489
|
-
|
|
316682
|
+
logger53.info("Server initialized successfully");
|
|
316490
316683
|
} catch (initError) {
|
|
316491
|
-
|
|
316684
|
+
logger53.error({ error: initError }, "Server initialization failed:");
|
|
316492
316685
|
throw initError;
|
|
316493
316686
|
}
|
|
316494
316687
|
let project;
|
|
316495
316688
|
try {
|
|
316496
|
-
|
|
316689
|
+
logger53.info("Attempting to load project or plugin...");
|
|
316497
316690
|
const monorepoRoot = UserEnvironment.getInstance().findMonorepoRoot(process.cwd());
|
|
316498
316691
|
const baseDir = monorepoRoot ?? process.cwd();
|
|
316499
|
-
const targetPath = testPath ?
|
|
316692
|
+
const targetPath = testPath ? path73.resolve(baseDir, testPath) : process.cwd();
|
|
316500
316693
|
project = await loadProject(targetPath);
|
|
316501
316694
|
if (!project) {
|
|
316502
316695
|
throw new Error("Failed to load project");
|
|
316503
316696
|
}
|
|
316504
316697
|
if (!project.isPlugin && (!project.agents || project.agents.length === 0)) {
|
|
316505
|
-
|
|
316698
|
+
logger53.warn("No agents found in project configuration; falling back to default Eliza character for tests.");
|
|
316506
316699
|
}
|
|
316507
|
-
|
|
316508
|
-
|
|
316700
|
+
logger53.info(`Found ${project.agents?.length || 0} agents`);
|
|
316701
|
+
logger53.info("Setting up server properties...");
|
|
316509
316702
|
server2.startAgent = async (character) => {
|
|
316510
|
-
|
|
316703
|
+
logger53.info(`Starting agent for character ${character.name}`);
|
|
316511
316704
|
const runtimes2 = await server2.startAgents([character], [], { isTestMode: true });
|
|
316512
316705
|
return runtimes2[0];
|
|
316513
316706
|
};
|
|
316514
316707
|
server2.loadCharacterTryPath = loadCharacterTryPath;
|
|
316515
316708
|
server2.jsonToCharacter = jsonToCharacter;
|
|
316516
|
-
|
|
316709
|
+
logger53.info("Server properties set up");
|
|
316517
316710
|
const desiredPort = options.port || Number.parseInt(process.env.SERVER_PORT || "3000");
|
|
316518
316711
|
const serverHost = process.env.SERVER_HOST || "0.0.0.0";
|
|
316519
316712
|
const serverPort = await findNextAvailablePort(desiredPort, serverHost);
|
|
316520
316713
|
if (serverPort !== desiredPort) {
|
|
316521
|
-
|
|
316714
|
+
logger53.warn(`Port ${desiredPort} is in use for testing, using port ${serverPort} instead.`);
|
|
316522
316715
|
}
|
|
316523
|
-
|
|
316716
|
+
logger53.info("Starting server...");
|
|
316524
316717
|
try {
|
|
316525
316718
|
await server2.start(serverPort);
|
|
316526
|
-
|
|
316719
|
+
logger53.info({ serverPort }, "Server started successfully on port");
|
|
316527
316720
|
} catch (error47) {
|
|
316528
|
-
|
|
316721
|
+
logger53.error({ error: error47 }, "Error starting server:");
|
|
316529
316722
|
if (error47 instanceof Error) {
|
|
316530
|
-
|
|
316531
|
-
|
|
316723
|
+
logger53.error({ message: error47.message }, "Error details:");
|
|
316724
|
+
logger53.error({ stack: error47.stack }, "Stack trace:");
|
|
316532
316725
|
}
|
|
316533
316726
|
throw error47;
|
|
316534
316727
|
}
|
|
316535
316728
|
try {
|
|
316536
|
-
|
|
316729
|
+
logger53.info(`Found ${project.agents.length} agents in ${project.isPlugin ? "plugin" : "project"}`);
|
|
316537
316730
|
if (project.isPlugin || (project.agents?.length || 0) === 0) {
|
|
316538
316731
|
process.env.ELIZA_TESTING_PLUGIN = "true";
|
|
316539
|
-
|
|
316732
|
+
logger53.info("Using default Eliza character as test agent");
|
|
316540
316733
|
try {
|
|
316541
316734
|
const pluginUnderTest = project.pluginModule;
|
|
316542
316735
|
if (!pluginUnderTest) {
|
|
@@ -316550,48 +316743,48 @@ async function runE2eTests(testPath, options, projectInfo) {
|
|
|
316550
316743
|
character: defaultElizaCharacter,
|
|
316551
316744
|
plugins: runtime.plugins
|
|
316552
316745
|
});
|
|
316553
|
-
|
|
316746
|
+
logger53.info("Default test agent started successfully");
|
|
316554
316747
|
} catch (pluginError) {
|
|
316555
|
-
|
|
316748
|
+
logger53.error({ error: pluginError }, `Error starting plugin test agent:`);
|
|
316556
316749
|
throw pluginError;
|
|
316557
316750
|
}
|
|
316558
316751
|
} else {
|
|
316559
316752
|
for (const agent2 of project.agents) {
|
|
316560
316753
|
try {
|
|
316561
316754
|
const originalCharacter = { ...agent2.character };
|
|
316562
|
-
|
|
316755
|
+
logger53.debug(`Starting agent: ${originalCharacter.name}`);
|
|
316563
316756
|
const startedRuntimes = await server2.startAgents([originalCharacter], agent2.plugins || [], { isTestMode: true });
|
|
316564
316757
|
const runtime = startedRuntimes[0];
|
|
316565
316758
|
if (agent2.init) {
|
|
316566
|
-
|
|
316759
|
+
logger53.debug(`Running custom init for agent: ${originalCharacter.name}`);
|
|
316567
316760
|
await agent2.init(runtime);
|
|
316568
316761
|
}
|
|
316569
316762
|
runtimes.push(runtime);
|
|
316570
316763
|
projectAgents.push(agent2);
|
|
316571
316764
|
await new Promise((resolve14) => setTimeout(resolve14, 1000));
|
|
316572
316765
|
} catch (agentError) {
|
|
316573
|
-
|
|
316766
|
+
logger53.error({ error: agentError, agentName: agent2.character.name }, "Error starting agent");
|
|
316574
316767
|
if (agentError instanceof Error) {
|
|
316575
|
-
|
|
316576
|
-
|
|
316768
|
+
logger53.error({ message: agentError.message }, "Error details:");
|
|
316769
|
+
logger53.error({ stack: agentError.stack }, "Stack trace:");
|
|
316577
316770
|
}
|
|
316578
|
-
|
|
316771
|
+
logger53.warn(`Skipping agent ${agent2.character.name} due to startup error`);
|
|
316579
316772
|
}
|
|
316580
316773
|
}
|
|
316581
316774
|
}
|
|
316582
316775
|
if (runtimes.length === 0) {
|
|
316583
316776
|
throw new Error("Failed to start any agents from project");
|
|
316584
316777
|
}
|
|
316585
|
-
|
|
316778
|
+
logger53.debug(`Successfully started ${runtimes.length} agents for testing`);
|
|
316586
316779
|
let totalFailed = 0;
|
|
316587
316780
|
let anyTestsFound = false;
|
|
316588
316781
|
for (let i = 0;i < runtimes.length; i++) {
|
|
316589
316782
|
const runtime = runtimes[i];
|
|
316590
316783
|
const projectAgent = projectAgents[i];
|
|
316591
316784
|
if (project.isPlugin) {
|
|
316592
|
-
|
|
316785
|
+
logger53.debug(`Running tests for plugin: ${project.pluginModule?.name}`);
|
|
316593
316786
|
} else {
|
|
316594
|
-
|
|
316787
|
+
logger53.debug(`Running tests for agent: ${runtime.character.name}`);
|
|
316595
316788
|
}
|
|
316596
316789
|
const testRunner = new TestRunner(runtime, projectAgent);
|
|
316597
316790
|
const currentDirInfo = projectInfo;
|
|
@@ -316609,17 +316802,17 @@ async function runE2eTests(testPath, options, projectInfo) {
|
|
|
316609
316802
|
}
|
|
316610
316803
|
return { failed: anyTestsFound ? totalFailed > 0 : false };
|
|
316611
316804
|
} catch (error47) {
|
|
316612
|
-
|
|
316805
|
+
logger53.error({ error: error47 }, "Error in runE2eTests:");
|
|
316613
316806
|
if (error47 instanceof Error) {
|
|
316614
|
-
|
|
316615
|
-
|
|
316807
|
+
logger53.error({ message: error47.message }, "Error details:");
|
|
316808
|
+
logger53.error({ stack: error47.stack }, "Stack trace:");
|
|
316616
316809
|
} else {
|
|
316617
|
-
|
|
316618
|
-
|
|
316810
|
+
logger53.error({ type: typeof error47 }, "Unknown error type:");
|
|
316811
|
+
logger53.error({ error: error47 }, "Error value:");
|
|
316619
316812
|
try {
|
|
316620
|
-
|
|
316813
|
+
logger53.error({ stringified: JSON.stringify(error47, null, 2) }, "Stringified error:");
|
|
316621
316814
|
} catch (e2) {
|
|
316622
|
-
|
|
316815
|
+
logger53.error({ error: e2 }, "Could not stringify error:");
|
|
316623
316816
|
}
|
|
316624
316817
|
}
|
|
316625
316818
|
return { failed: true };
|
|
@@ -316633,7 +316826,7 @@ async function runE2eTests(testPath, options, projectInfo) {
|
|
|
316633
316826
|
fs47.rmSync(elizaDbDir, { recursive: true, force: true });
|
|
316634
316827
|
console.info(`Successfully cleaned up test database directory`);
|
|
316635
316828
|
}
|
|
316636
|
-
const testDir =
|
|
316829
|
+
const testDir = path73.dirname(elizaDbDir);
|
|
316637
316830
|
if (fs47.existsSync(testDir) && fs47.readdirSync(testDir).length === 0) {
|
|
316638
316831
|
fs47.rmSync(testDir, { recursive: true, force: true });
|
|
316639
316832
|
}
|
|
@@ -316642,33 +316835,33 @@ async function runE2eTests(testPath, options, projectInfo) {
|
|
|
316642
316835
|
}
|
|
316643
316836
|
}
|
|
316644
316837
|
} catch (error47) {
|
|
316645
|
-
|
|
316838
|
+
logger53.error({ error: error47 }, "Error in runE2eTests:");
|
|
316646
316839
|
if (error47 instanceof Error) {
|
|
316647
|
-
|
|
316648
|
-
|
|
316840
|
+
logger53.error({ message: error47.message }, "Error details:");
|
|
316841
|
+
logger53.error({ stack: error47.stack }, "Stack trace:");
|
|
316649
316842
|
} else {
|
|
316650
|
-
|
|
316651
|
-
|
|
316843
|
+
logger53.error({ type: typeof error47 }, "Unknown error type:");
|
|
316844
|
+
logger53.error({ error: error47 }, "Error value:");
|
|
316652
316845
|
try {
|
|
316653
|
-
|
|
316846
|
+
logger53.error({ stringified: JSON.stringify(error47, null, 2) }, "Stringified error:");
|
|
316654
316847
|
} catch (e2) {
|
|
316655
|
-
|
|
316848
|
+
logger53.error({ error: e2 }, "Could not stringify error:");
|
|
316656
316849
|
}
|
|
316657
316850
|
}
|
|
316658
316851
|
return { failed: true };
|
|
316659
316852
|
}
|
|
316660
316853
|
} catch (error47) {
|
|
316661
|
-
|
|
316854
|
+
logger53.error({ error: error47 }, "Error in runE2eTests:");
|
|
316662
316855
|
if (error47 instanceof Error) {
|
|
316663
|
-
|
|
316664
|
-
|
|
316856
|
+
logger53.error({ message: error47.message }, "Error details:");
|
|
316857
|
+
logger53.error({ stack: error47.stack }, "Stack trace:");
|
|
316665
316858
|
} else {
|
|
316666
|
-
|
|
316667
|
-
|
|
316859
|
+
logger53.error({ type: typeof error47 }, "Unknown error type:");
|
|
316860
|
+
logger53.error({ error: error47 }, "Error value:");
|
|
316668
316861
|
try {
|
|
316669
|
-
|
|
316862
|
+
logger53.error({ stringified: JSON.stringify(error47, null, 2) }, "Stringified error:");
|
|
316670
316863
|
} catch (e2) {
|
|
316671
|
-
|
|
316864
|
+
logger53.error({ error: e2 }, "Could not stringify error:");
|
|
316672
316865
|
}
|
|
316673
316866
|
}
|
|
316674
316867
|
return { failed: true };
|
|
@@ -316682,24 +316875,24 @@ async function runAllTests(testPath, options) {
|
|
|
316682
316875
|
if (!options.skipBuild) {
|
|
316683
316876
|
componentResult = await runComponentTests(testPath, options, projectInfo);
|
|
316684
316877
|
} else {
|
|
316685
|
-
|
|
316878
|
+
logger54.info("Skipping component tests due to --skip-build option");
|
|
316686
316879
|
}
|
|
316687
316880
|
const e2eResult = await runE2eTests(testPath, options, projectInfo);
|
|
316688
316881
|
if (componentResult.failed || e2eResult.failed) {
|
|
316689
316882
|
if (componentResult.failed) {
|
|
316690
|
-
|
|
316883
|
+
logger54.error("Component tests failed.");
|
|
316691
316884
|
}
|
|
316692
316885
|
if (e2eResult.failed) {
|
|
316693
|
-
|
|
316886
|
+
logger54.error("E2E tests failed.");
|
|
316694
316887
|
}
|
|
316695
|
-
|
|
316888
|
+
logger54.error("Test suite failed.");
|
|
316696
316889
|
process.exit(1);
|
|
316697
316890
|
}
|
|
316698
|
-
|
|
316891
|
+
logger54.success("All tests passed successfully!");
|
|
316699
316892
|
process.exit(0);
|
|
316700
316893
|
}
|
|
316701
316894
|
// src/commands/test/utils/plugin-utils.ts
|
|
316702
|
-
import { logger as
|
|
316895
|
+
import { logger as logger55 } from "@elizaos/core";
|
|
316703
316896
|
|
|
316704
316897
|
// src/commands/test/index.ts
|
|
316705
316898
|
var test = new Command().name("test").description("Run tests for the current project or a specified plugin").argument("[path]", "Optional path to the project or plugin to test").addOption(new Option("-t, --type <type>", "the type of test to run").choices(["component", "e2e", "all"]).default("all")).option("--port <port>", "The port to run e2e tests on", validatePort).option("--name <name>", "Filter tests by name").option("--skip-build", "Skip building before running tests").option("--skip-type-check", "Skip TypeScript validation before running tests").hook("preAction", async (thisCommand) => {
|
|
@@ -316711,31 +316904,31 @@ var test = new Command().name("test").description("Run tests for the current pro
|
|
|
316711
316904
|
const projectInfo = getProjectType(testPath);
|
|
316712
316905
|
await installPluginDependencies(projectInfo);
|
|
316713
316906
|
}).action(async (testPath, options) => {
|
|
316714
|
-
|
|
316907
|
+
logger56.info("Starting tests...");
|
|
316715
316908
|
try {
|
|
316716
316909
|
const projectInfo = getProjectType(testPath);
|
|
316717
316910
|
switch (options.type) {
|
|
316718
316911
|
case "component":
|
|
316719
|
-
|
|
316912
|
+
logger56.info("Running component tests only...");
|
|
316720
316913
|
const componentResult = await runComponentTests(testPath, options, projectInfo);
|
|
316721
316914
|
if (componentResult.failed) {
|
|
316722
|
-
|
|
316915
|
+
logger56.error("Component tests failed.");
|
|
316723
316916
|
process.exit(1);
|
|
316724
316917
|
}
|
|
316725
|
-
|
|
316918
|
+
logger56.success("Component tests passed successfully!");
|
|
316726
316919
|
break;
|
|
316727
316920
|
case "e2e":
|
|
316728
|
-
|
|
316921
|
+
logger56.info("Running e2e tests only...");
|
|
316729
316922
|
const e2eResult = await runE2eTests(testPath, options, projectInfo);
|
|
316730
316923
|
if (e2eResult.failed) {
|
|
316731
|
-
|
|
316924
|
+
logger56.error("E2E tests failed.");
|
|
316732
316925
|
process.exit(1);
|
|
316733
316926
|
}
|
|
316734
|
-
|
|
316927
|
+
logger56.success("E2E tests passed successfully!");
|
|
316735
316928
|
break;
|
|
316736
316929
|
case "all":
|
|
316737
316930
|
default:
|
|
316738
|
-
|
|
316931
|
+
logger56.info("Running all tests...");
|
|
316739
316932
|
await runAllTests(testPath, options);
|
|
316740
316933
|
break;
|
|
316741
316934
|
}
|
|
@@ -316749,19 +316942,19 @@ var test = new Command().name("test").description("Run tests for the current pro
|
|
|
316749
316942
|
init_utils();
|
|
316750
316943
|
init_directory_detection();
|
|
316751
316944
|
init_esm();
|
|
316752
|
-
import { logger as
|
|
316945
|
+
import { logger as logger58 } from "@elizaos/core";
|
|
316753
316946
|
|
|
316754
316947
|
// src/commands/update/actions/dependency-update.ts
|
|
316755
316948
|
init_utils();
|
|
316756
316949
|
init_dist2();
|
|
316757
316950
|
import { promises as fs49 } from "fs";
|
|
316758
|
-
import * as
|
|
316951
|
+
import * as path74 from "path";
|
|
316759
316952
|
|
|
316760
316953
|
// src/commands/update/utils/package-utils.ts
|
|
316761
316954
|
init_bun_exec();
|
|
316762
316955
|
init_utils();
|
|
316763
316956
|
import fs48 from "fs/promises";
|
|
316764
|
-
import { logger as
|
|
316957
|
+
import { logger as logger57 } from "@elizaos/core";
|
|
316765
316958
|
async function checkForUpdates(dependencies) {
|
|
316766
316959
|
const updates = {};
|
|
316767
316960
|
const elizaPackages = Object.entries(dependencies).filter(([pkg]) => pkg.startsWith(ELIZAOS_ORG)).filter(([, version3]) => !isWorkspaceVersion(version3));
|
|
@@ -316773,7 +316966,7 @@ async function checkForUpdates(dependencies) {
|
|
|
316773
316966
|
if (needsUpdate) {
|
|
316774
316967
|
updates[pkg] = { current: currentVersion, latest: latestVersion };
|
|
316775
316968
|
} else if (error47) {
|
|
316776
|
-
|
|
316969
|
+
logger57.debug(`${pkg}: ${error47}`);
|
|
316777
316970
|
}
|
|
316778
316971
|
}
|
|
316779
316972
|
return { hasUpdates: Object.keys(updates).length > 0, updates };
|
|
@@ -316822,7 +317015,7 @@ Installing updated packages...`);
|
|
|
316822
317015
|
// src/commands/update/actions/dependency-update.ts
|
|
316823
317016
|
async function updateDependencies(cwd, isPlugin2, options = {}) {
|
|
316824
317017
|
const { dryRun = false, skipBuild = false } = options;
|
|
316825
|
-
const packageJsonPath =
|
|
317018
|
+
const packageJsonPath = path74.join(cwd, "package.json");
|
|
316826
317019
|
const content = await fs49.readFile(packageJsonPath, "utf8");
|
|
316827
317020
|
const packageJson = JSON.parse(content);
|
|
316828
317021
|
const allDependencies = {
|
|
@@ -316896,7 +317089,7 @@ var update3 = new Command().name("update").description("Update ElizaOS CLI and p
|
|
|
316896
317089
|
try {
|
|
316897
317090
|
await displayBanner(true);
|
|
316898
317091
|
} catch {
|
|
316899
|
-
|
|
317092
|
+
logger58.debug("Banner display failed, continuing with update");
|
|
316900
317093
|
}
|
|
316901
317094
|
}).action(async (options) => {
|
|
316902
317095
|
try {
|
|
@@ -316934,7 +317127,7 @@ var update3 = new Command().name("update").description("Update ElizaOS CLI and p
|
|
|
316934
317127
|
console.info("To create a new ElizaOS project, use: elizaos create <project-name>");
|
|
316935
317128
|
return;
|
|
316936
317129
|
}
|
|
316937
|
-
|
|
317130
|
+
logger58.debug(`Detected ${directoryInfo.type}`);
|
|
316938
317131
|
if (!isInProject) {
|
|
316939
317132
|
handleInvalidDirectory(directoryInfo);
|
|
316940
317133
|
return;
|
|
@@ -316969,7 +317162,7 @@ init_utils();
|
|
|
316969
317162
|
init_local_cli_delegation();
|
|
316970
317163
|
init_esm();
|
|
316971
317164
|
init_emoji_handler();
|
|
316972
|
-
import { logger as
|
|
317165
|
+
import { logger as logger59 } from "@elizaos/core";
|
|
316973
317166
|
|
|
316974
317167
|
// src/commands/scenario/index.ts
|
|
316975
317168
|
init_esm();
|
|
@@ -316977,7 +317170,7 @@ init_js_yaml();
|
|
|
316977
317170
|
init_schema();
|
|
316978
317171
|
init_LocalEnvironmentProvider();
|
|
316979
317172
|
import fs54 from "fs";
|
|
316980
|
-
import
|
|
317173
|
+
import path77 from "path";
|
|
316981
317174
|
import { logger as elizaLogger } from "@elizaos/core";
|
|
316982
317175
|
|
|
316983
317176
|
// src/commands/scenario/src/E2BEnvironmentProvider.ts
|
|
@@ -317199,9 +317392,9 @@ class MockEngine {
|
|
|
317199
317392
|
}
|
|
317200
317393
|
if (mock.responseFn) {
|
|
317201
317394
|
try {
|
|
317202
|
-
const
|
|
317395
|
+
const input3 = this.extractInputFromArgs(args);
|
|
317203
317396
|
const context2 = this.buildRequestContext(args);
|
|
317204
|
-
return this.parseResponseTemplate(mock.responseFn, { args, input:
|
|
317397
|
+
return this.parseResponseTemplate(mock.responseFn, { args, input: input3, context: context2 });
|
|
317205
317398
|
} catch (error47) {
|
|
317206
317399
|
this.logger.error(`Response template error: ${error47}`);
|
|
317207
317400
|
throw error47;
|
|
@@ -317212,7 +317405,7 @@ class MockEngine {
|
|
|
317212
317405
|
async matchesCondition(mock, args) {
|
|
317213
317406
|
if (!mock.when)
|
|
317214
317407
|
return true;
|
|
317215
|
-
const
|
|
317408
|
+
const input3 = this.extractInputFromArgs(args);
|
|
317216
317409
|
const context2 = this.buildRequestContext(args);
|
|
317217
317410
|
if (mock.when.args) {
|
|
317218
317411
|
if (!import_lodash.default.isEqual(args, mock.when.args)) {
|
|
@@ -317220,7 +317413,7 @@ class MockEngine {
|
|
|
317220
317413
|
}
|
|
317221
317414
|
}
|
|
317222
317415
|
if (mock.when.input) {
|
|
317223
|
-
if (!this.matchesInput(
|
|
317416
|
+
if (!this.matchesInput(input3, mock.when.input)) {
|
|
317224
317417
|
return false;
|
|
317225
317418
|
}
|
|
317226
317419
|
}
|
|
@@ -317231,7 +317424,7 @@ class MockEngine {
|
|
|
317231
317424
|
}
|
|
317232
317425
|
if (mock.when.matcher) {
|
|
317233
317426
|
try {
|
|
317234
|
-
const result = this.evaluateTemplate(mock.when.matcher, { args, input:
|
|
317427
|
+
const result = this.evaluateTemplate(mock.when.matcher, { args, input: input3, context: context2 });
|
|
317235
317428
|
if (!result) {
|
|
317236
317429
|
return false;
|
|
317237
317430
|
}
|
|
@@ -317248,16 +317441,16 @@ class MockEngine {
|
|
|
317248
317441
|
return true;
|
|
317249
317442
|
}
|
|
317250
317443
|
extractInputFromArgs(args) {
|
|
317251
|
-
const
|
|
317444
|
+
const input3 = {};
|
|
317252
317445
|
for (let i2 = 0;i2 < args.length; i2++) {
|
|
317253
317446
|
const arg = args[i2];
|
|
317254
317447
|
if (typeof arg === "object" && arg !== null) {
|
|
317255
|
-
Object.assign(
|
|
317448
|
+
Object.assign(input3, arg);
|
|
317256
317449
|
} else if (typeof arg === "string" || typeof arg === "number") {
|
|
317257
|
-
|
|
317450
|
+
input3[`arg${i2}`] = arg;
|
|
317258
317451
|
}
|
|
317259
317452
|
}
|
|
317260
|
-
return
|
|
317453
|
+
return input3;
|
|
317261
317454
|
}
|
|
317262
317455
|
buildRequestContext(args) {
|
|
317263
317456
|
return {
|
|
@@ -317289,9 +317482,9 @@ class MockEngine {
|
|
|
317289
317482
|
}
|
|
317290
317483
|
return score;
|
|
317291
317484
|
}
|
|
317292
|
-
matchesInput(
|
|
317485
|
+
matchesInput(input3, expectedInput) {
|
|
317293
317486
|
for (const [key, value] of Object.entries(expectedInput)) {
|
|
317294
|
-
if (!import_lodash.default.isEqual(
|
|
317487
|
+
if (!import_lodash.default.isEqual(input3[key], value)) {
|
|
317295
317488
|
return false;
|
|
317296
317489
|
}
|
|
317297
317490
|
}
|
|
@@ -317745,14 +317938,14 @@ class RunDataAggregator {
|
|
|
317745
317938
|
// src/commands/scenario/index.ts
|
|
317746
317939
|
var __dirname = "/home/runner/work/eliza/eliza/packages/cli/src/commands/scenario";
|
|
317747
317940
|
async function runEvaluationsWithFallback(evaluationEngine, evaluations, result) {
|
|
317748
|
-
const
|
|
317941
|
+
const logger59 = elizaLogger || console;
|
|
317749
317942
|
try {
|
|
317750
|
-
|
|
317943
|
+
logger59.debug("[Evaluation] Using enhanced evaluations with structured output");
|
|
317751
317944
|
const enhancedResults = await evaluationEngine.runEnhancedEvaluations(evaluations, result);
|
|
317752
317945
|
if (Array.isArray(enhancedResults) && enhancedResults.length > 0) {
|
|
317753
317946
|
const firstResult = enhancedResults[0];
|
|
317754
317947
|
if (firstResult && typeof firstResult.evaluator_type === "string" && typeof firstResult.success === "boolean" && typeof firstResult.summary === "string" && typeof firstResult.details === "object") {
|
|
317755
|
-
|
|
317948
|
+
logger59.debug(`[Evaluation] Enhanced evaluations successful - ${enhancedResults.length} structured results`);
|
|
317756
317949
|
return enhancedResults.map((enhanced) => ({
|
|
317757
317950
|
success: enhanced.success,
|
|
317758
317951
|
message: enhanced.summary,
|
|
@@ -317760,16 +317953,16 @@ async function runEvaluationsWithFallback(evaluationEngine, evaluations, result)
|
|
|
317760
317953
|
}));
|
|
317761
317954
|
}
|
|
317762
317955
|
}
|
|
317763
|
-
|
|
317956
|
+
logger59.warn("[Evaluation] Enhanced results invalid, falling back to legacy evaluations");
|
|
317764
317957
|
} catch (error47) {
|
|
317765
|
-
|
|
317958
|
+
logger59.warn(`[Evaluation] Enhanced evaluations failed (${error47 instanceof Error ? error47.message : String(error47)}), falling back to legacy evaluations`);
|
|
317766
317959
|
}
|
|
317767
|
-
|
|
317960
|
+
logger59.debug("[Evaluation] Using legacy evaluation system (fallback)");
|
|
317768
317961
|
return await evaluationEngine.runEvaluations(evaluations, result);
|
|
317769
317962
|
}
|
|
317770
317963
|
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) => {
|
|
317771
|
-
const
|
|
317772
|
-
|
|
317964
|
+
const logger59 = elizaLogger || console;
|
|
317965
|
+
logger59.info(`Starting scenario run with args: ${JSON.stringify({ filePath, ...options })}`);
|
|
317773
317966
|
let provider = null;
|
|
317774
317967
|
let runtime = null;
|
|
317775
317968
|
let server2 = null;
|
|
@@ -317780,20 +317973,20 @@ var scenario = new Command().name("scenario").description("Manage and execute El
|
|
|
317780
317973
|
let finalStatus = false;
|
|
317781
317974
|
let reporter = null;
|
|
317782
317975
|
const scenarioRunId = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
317783
|
-
const logsDir =
|
|
317976
|
+
const logsDir = path77.join(__dirname, "_logs_");
|
|
317784
317977
|
let dataAggregator = null;
|
|
317785
317978
|
try {
|
|
317786
|
-
const fullPath =
|
|
317787
|
-
|
|
317979
|
+
const fullPath = path77.resolve(filePath);
|
|
317980
|
+
logger59.info(`Attempting to read scenario file from: ${fullPath}`);
|
|
317788
317981
|
if (!fs54.existsSync(fullPath)) {
|
|
317789
|
-
|
|
317982
|
+
logger59.error(`Error: File not found at '${fullPath}'`);
|
|
317790
317983
|
process.exit(1);
|
|
317791
317984
|
}
|
|
317792
317985
|
const fileContents = fs54.readFileSync(fullPath, "utf8");
|
|
317793
317986
|
const rawScenario = load2(fileContents);
|
|
317794
317987
|
const validationResult = ScenarioSchema.safeParse(rawScenario);
|
|
317795
317988
|
if (!validationResult.success) {
|
|
317796
|
-
|
|
317989
|
+
logger59.error("Scenario file validation failed:");
|
|
317797
317990
|
console.error(JSON.stringify(validationResult.error.format(), null, 2));
|
|
317798
317991
|
process.exit(1);
|
|
317799
317992
|
}
|
|
@@ -317802,25 +317995,25 @@ var scenario = new Command().name("scenario").description("Manage and execute El
|
|
|
317802
317995
|
fs54.mkdirSync(logsDir, { recursive: true });
|
|
317803
317996
|
}
|
|
317804
317997
|
if (scenario2.plugins && scenario2.plugins.length > 0) {
|
|
317805
|
-
|
|
317998
|
+
logger59.info("Parsing and validating plugins...");
|
|
317806
317999
|
const pluginResult = await parseAndValidate(scenario2.plugins);
|
|
317807
318000
|
if (!pluginResult.valid) {
|
|
317808
|
-
|
|
318001
|
+
logger59.error("Plugin validation failed:");
|
|
317809
318002
|
pluginResult.errors.forEach((error47) => {
|
|
317810
|
-
|
|
318003
|
+
logger59.error(` - ${error47}`);
|
|
317811
318004
|
});
|
|
317812
318005
|
process.exit(1);
|
|
317813
318006
|
}
|
|
317814
318007
|
if (pluginResult.warnings.length > 0) {
|
|
317815
|
-
|
|
318008
|
+
logger59.warn("Plugin warnings:");
|
|
317816
318009
|
pluginResult.warnings.forEach((warning2) => {
|
|
317817
|
-
|
|
318010
|
+
logger59.warn(` - ${warning2}`);
|
|
317818
318011
|
});
|
|
317819
318012
|
}
|
|
317820
|
-
|
|
318013
|
+
logger59.info(generateSummary(pluginResult));
|
|
317821
318014
|
scenario2.parsedPlugins = pluginResult.plugins;
|
|
317822
318015
|
} else {
|
|
317823
|
-
|
|
318016
|
+
logger59.info("No plugins specified in scenario");
|
|
317824
318017
|
}
|
|
317825
318018
|
reporter = new Reporter;
|
|
317826
318019
|
reporter.reportStart(scenario2);
|
|
@@ -317835,7 +318028,7 @@ var scenario = new Command().name("scenario").description("Manage and execute El
|
|
|
317835
318028
|
}
|
|
317836
318029
|
const scenarioPlugins = Array.isArray(scenario2.plugins) ? scenario2.plugins.filter((p2) => p2.enabled !== false).map((p2) => typeof p2 === "string" ? p2 : p2.name) : [];
|
|
317837
318030
|
const finalPlugins = Array.from(new Set([...scenarioPlugins, ...defaultPlugins]));
|
|
317838
|
-
|
|
318031
|
+
logger59.info(`Using plugins: ${JSON.stringify(finalPlugins)}`);
|
|
317839
318032
|
if (scenario2.environment.type === "e2b") {
|
|
317840
318033
|
const created = await createScenarioServerAndAgent(null, 3000, finalPlugins);
|
|
317841
318034
|
server2 = created.server;
|
|
@@ -317855,18 +318048,18 @@ var scenario = new Command().name("scenario").description("Manage and execute El
|
|
|
317855
318048
|
serverPort = created.port;
|
|
317856
318049
|
}
|
|
317857
318050
|
provider = new LocalEnvironmentProvider(server2, agentId, runtime, serverPort);
|
|
317858
|
-
|
|
318051
|
+
logger59.info("Using local environment");
|
|
317859
318052
|
} else {
|
|
317860
|
-
|
|
318053
|
+
logger59.error(`Unsupported environment type: '${scenario2.environment.type}'`);
|
|
317861
318054
|
process.exit(1);
|
|
317862
318055
|
}
|
|
317863
318056
|
if (runtime && scenario2.setup?.mocks && !options.live) {
|
|
317864
|
-
|
|
318057
|
+
logger59.info("Initializing MockEngine...");
|
|
317865
318058
|
mockEngine = new MockEngine(runtime);
|
|
317866
|
-
|
|
318059
|
+
logger59.info("Applying mocks...");
|
|
317867
318060
|
mockEngine.applyMocks(scenario2.setup.mocks);
|
|
317868
318061
|
}
|
|
317869
|
-
|
|
318062
|
+
logger59.info(`Setting up '${scenario2.environment.type}' environment...`);
|
|
317870
318063
|
await provider.setup(scenario2);
|
|
317871
318064
|
if (runtime) {
|
|
317872
318065
|
const trajectoryReconstructor = new TrajectoryReconstructor(runtime);
|
|
@@ -317876,42 +318069,42 @@ var scenario = new Command().name("scenario").description("Manage and execute El
|
|
|
317876
318069
|
const combinationId = `single-${scenarioRunId}`;
|
|
317877
318070
|
const parameters = { "scenario.file": filePath };
|
|
317878
318071
|
dataAggregator.startRun(runId2, combinationId, parameters);
|
|
317879
|
-
|
|
318072
|
+
logger59.info(`\uD83D\uDCCA [DataAggregator] Started tracking run: ${runId2}`);
|
|
317880
318073
|
}
|
|
317881
|
-
|
|
318074
|
+
logger59.info("Executing run block...");
|
|
317882
318075
|
const startTime = Date.now();
|
|
317883
318076
|
const results = await provider.run(scenario2);
|
|
317884
318077
|
const endTime = Date.now();
|
|
317885
318078
|
results.forEach((result) => {
|
|
317886
318079
|
reporter?.reportExecutionResult(result);
|
|
317887
318080
|
});
|
|
317888
|
-
|
|
318081
|
+
logger59.info(`\uD83D\uDCC2 Using logs directory: ${logsDir}`);
|
|
317889
318082
|
const runId = generateRunFilename(1);
|
|
317890
|
-
|
|
318083
|
+
logger59.info(`\uD83D\uDD0D DEBUG: About to write ${results.length} execution results to ${logsDir}`);
|
|
317891
318084
|
results.forEach((result, i2) => {
|
|
317892
318085
|
const executionFilename = generateStepFilename(runId, i2, "execution");
|
|
317893
|
-
const executionPath =
|
|
318086
|
+
const executionPath = path77.join(logsDir, executionFilename);
|
|
317894
318087
|
fs54.writeFileSync(executionPath, JSON.stringify(result, null, 2));
|
|
317895
|
-
|
|
318088
|
+
logger59.info(`\uD83D\uDCC4 Execution results written to: ${executionPath}`);
|
|
317896
318089
|
});
|
|
317897
318090
|
const allEvaluationResults = [];
|
|
317898
318091
|
if (runtime) {
|
|
317899
318092
|
const evaluationEngine = new EvaluationEngine(runtime);
|
|
317900
|
-
|
|
318093
|
+
logger59.info("Running evaluations with runtime...");
|
|
317901
318094
|
for (let i2 = 0;i2 < results.length; i2++) {
|
|
317902
318095
|
const step = scenario2.run[i2];
|
|
317903
318096
|
const result = results[i2];
|
|
317904
318097
|
if (step.evaluations && step.evaluations.length > 0) {
|
|
317905
318098
|
const evaluationResults = await runEvaluationsWithFallback(evaluationEngine, step.evaluations, result);
|
|
317906
318099
|
const evaluationFilename = generateStepFilename(runId, i2, "evaluation");
|
|
317907
|
-
const evaluationPath =
|
|
318100
|
+
const evaluationPath = path77.join(logsDir, evaluationFilename);
|
|
317908
318101
|
fs54.writeFileSync(evaluationPath, JSON.stringify(evaluationResults, null, 2));
|
|
317909
|
-
|
|
318102
|
+
logger59.info(`\uD83D\uDCCA Evaluation results written to: ${evaluationPath}`);
|
|
317910
318103
|
allEvaluationResults.push(...evaluationResults);
|
|
317911
318104
|
}
|
|
317912
318105
|
}
|
|
317913
318106
|
} else {
|
|
317914
|
-
|
|
318107
|
+
logger59.info("Running basic evaluations without runtime...");
|
|
317915
318108
|
for (let i2 = 0;i2 < results.length; i2++) {
|
|
317916
318109
|
const step = scenario2.run[i2];
|
|
317917
318110
|
const result = results[i2];
|
|
@@ -317941,9 +318134,9 @@ var scenario = new Command().name("scenario").description("Manage and execute El
|
|
|
317941
318134
|
allEvaluationResults.push(evaluationResult);
|
|
317942
318135
|
}
|
|
317943
318136
|
const evaluationFilename = generateStepFilename(runId, i2, "evaluation");
|
|
317944
|
-
const evaluationPath =
|
|
318137
|
+
const evaluationPath = path77.join(logsDir, evaluationFilename);
|
|
317945
318138
|
fs54.writeFileSync(evaluationPath, JSON.stringify(stepEvaluationResults, null, 2));
|
|
317946
|
-
|
|
318139
|
+
logger59.info(`\uD83D\uDCCA Basic evaluation results written to: ${evaluationPath}`);
|
|
317947
318140
|
}
|
|
317948
318141
|
}
|
|
317949
318142
|
}
|
|
@@ -317996,15 +318189,15 @@ var scenario = new Command().name("scenario").description("Manage and execute El
|
|
|
317996
318189
|
});
|
|
317997
318190
|
const scenarioRunResult = await dataAggregator.buildResult(roomId, enhancedEvaluationResults, combinedExecutionResult);
|
|
317998
318191
|
const centralizedFilename = `${runId}.json`;
|
|
317999
|
-
const centralizedPath =
|
|
318192
|
+
const centralizedPath = path77.join(logsDir, centralizedFilename);
|
|
318000
318193
|
fs54.writeFileSync(centralizedPath, JSON.stringify(scenarioRunResult, null, 2));
|
|
318001
|
-
|
|
318194
|
+
logger59.info(`\uD83D\uDCCB [DataAggregator] Centralized result written to: ${centralizedPath}`);
|
|
318002
318195
|
} catch (aggregatorError) {
|
|
318003
|
-
|
|
318196
|
+
logger59.error(`[DataAggregator] Failed to generate centralized result: ${aggregatorError}`);
|
|
318004
318197
|
}
|
|
318005
318198
|
}
|
|
318006
318199
|
} catch (error47) {
|
|
318007
|
-
|
|
318200
|
+
logger59.error("An error occurred during scenario execution:", error47 instanceof Error ? error47.message : String(error47));
|
|
318008
318201
|
if (dataAggregator) {
|
|
318009
318202
|
try {
|
|
318010
318203
|
dataAggregator.recordError(error47 instanceof Error ? error47 : new Error(String(error47)));
|
|
@@ -318017,32 +318210,32 @@ var scenario = new Command().name("scenario").description("Manage and execute El
|
|
|
318017
318210
|
files: {}
|
|
318018
318211
|
});
|
|
318019
318212
|
const errorFilename = `run-${failedResult.run_id}.json`;
|
|
318020
|
-
const errorPath =
|
|
318213
|
+
const errorPath = path77.join(logsDir, errorFilename);
|
|
318021
318214
|
fs54.writeFileSync(errorPath, JSON.stringify(failedResult, null, 2));
|
|
318022
|
-
|
|
318215
|
+
logger59.info(`\uD83D\uDCA5 [DataAggregator] Error result written to: ${errorPath}`);
|
|
318023
318216
|
} catch (aggregatorError) {
|
|
318024
|
-
|
|
318217
|
+
logger59.error(`[DataAggregator] Failed to record error: ${aggregatorError}`);
|
|
318025
318218
|
}
|
|
318026
318219
|
}
|
|
318027
318220
|
process.exit(1);
|
|
318028
318221
|
} finally {
|
|
318029
318222
|
if (mockEngine) {
|
|
318030
|
-
|
|
318223
|
+
logger59.info("Reverting mocks...");
|
|
318031
318224
|
mockEngine.revertMocks();
|
|
318032
318225
|
}
|
|
318033
318226
|
if (provider) {
|
|
318034
|
-
|
|
318227
|
+
logger59.info("Tearing down environment...");
|
|
318035
318228
|
await provider.teardown();
|
|
318036
318229
|
}
|
|
318037
318230
|
if (runtime) {
|
|
318038
318231
|
try {
|
|
318039
318232
|
const e2bService = runtime.getService("e2b");
|
|
318040
318233
|
if (e2bService && typeof e2bService.stop === "function") {
|
|
318041
|
-
|
|
318234
|
+
logger59.info("Stopping E2B service...");
|
|
318042
318235
|
await e2bService.stop();
|
|
318043
318236
|
}
|
|
318044
318237
|
await runtime.close();
|
|
318045
|
-
|
|
318238
|
+
logger59.info("Runtime shutdown complete");
|
|
318046
318239
|
} catch {}
|
|
318047
318240
|
}
|
|
318048
318241
|
if (server2 && createdServer) {
|
|
@@ -318065,38 +318258,38 @@ var scenario = new Command().name("scenario").description("Manage and execute El
|
|
|
318065
318258
|
validateMatrixParameterPaths: validateMatrixParameterPaths2,
|
|
318066
318259
|
combinationToOverrides: combinationToOverrides2
|
|
318067
318260
|
} = await Promise.resolve().then(() => (init_parameter_override(), exports_parameter_override));
|
|
318068
|
-
const
|
|
318069
|
-
|
|
318261
|
+
const logger59 = elizaLogger || console;
|
|
318262
|
+
logger59.info(`\uD83E\uDDEA Starting matrix analysis with config: ${configPath}`);
|
|
318070
318263
|
if (options.verbose) {
|
|
318071
|
-
|
|
318264
|
+
logger59.info(`Options: ${JSON.stringify(options, null, 2)}`);
|
|
318072
318265
|
}
|
|
318073
318266
|
const { processManager: processManager2 } = await Promise.resolve().then(() => (init_process_manager(), exports_process_manager));
|
|
318074
318267
|
let isShuttingDown = false;
|
|
318075
318268
|
const handleShutdown = async (signal) => {
|
|
318076
318269
|
if (isShuttingDown) {
|
|
318077
|
-
|
|
318270
|
+
logger59.info(`\uD83D\uDD27 [Matrix] Already shutting down, ignoring ${signal}`);
|
|
318078
318271
|
return;
|
|
318079
318272
|
}
|
|
318080
318273
|
isShuttingDown = true;
|
|
318081
|
-
|
|
318274
|
+
logger59.info(`\uD83D\uDD27 [Matrix] Received ${signal}, initiating graceful shutdown...`);
|
|
318082
318275
|
const summary = processManager2.getSummary();
|
|
318083
318276
|
if (summary.total > 0) {
|
|
318084
|
-
|
|
318277
|
+
logger59.info(`\uD83D\uDD27 [Matrix] Cleaning up ${summary.total} tracked processes...`);
|
|
318085
318278
|
await processManager2.terminateAllProcesses();
|
|
318086
|
-
|
|
318279
|
+
logger59.info(`\uD83D\uDD27 [Matrix] Process cleanup completed`);
|
|
318087
318280
|
}
|
|
318088
|
-
|
|
318281
|
+
logger59.info(`\uD83D\uDD27 [Matrix] Shutdown complete`);
|
|
318089
318282
|
process.exit(0);
|
|
318090
318283
|
};
|
|
318091
318284
|
process.on("SIGINT", () => handleShutdown("SIGINT"));
|
|
318092
318285
|
process.on("SIGTERM", () => handleShutdown("SIGTERM"));
|
|
318093
318286
|
try {
|
|
318094
|
-
const fullPath =
|
|
318095
|
-
const configDir =
|
|
318096
|
-
|
|
318287
|
+
const fullPath = path77.resolve(configPath);
|
|
318288
|
+
const configDir = path77.dirname(fullPath);
|
|
318289
|
+
logger59.info(`\uD83D\uDCC2 Loading matrix configuration from: ${fullPath}`);
|
|
318097
318290
|
if (!fs54.existsSync(fullPath)) {
|
|
318098
|
-
|
|
318099
|
-
|
|
318291
|
+
logger59.error(`\u274C Error: Matrix configuration file not found at '${fullPath}'`);
|
|
318292
|
+
logger59.info("\uD83D\uDCA1 Make sure the file exists and the path is correct.");
|
|
318100
318293
|
process.exit(1);
|
|
318101
318294
|
}
|
|
318102
318295
|
const fileContents = fs54.readFileSync(fullPath, "utf8");
|
|
@@ -318104,175 +318297,175 @@ var scenario = new Command().name("scenario").description("Manage and execute El
|
|
|
318104
318297
|
try {
|
|
318105
318298
|
rawMatrixConfig = load2(fileContents);
|
|
318106
318299
|
} catch (yamlError) {
|
|
318107
|
-
|
|
318108
|
-
|
|
318109
|
-
|
|
318300
|
+
logger59.error(`\u274C Error: Failed to parse YAML configuration file:`);
|
|
318301
|
+
logger59.error(yamlError instanceof Error ? yamlError.message : String(yamlError));
|
|
318302
|
+
logger59.info("\uD83D\uDCA1 Check that your YAML syntax is valid.");
|
|
318110
318303
|
process.exit(1);
|
|
318111
318304
|
}
|
|
318112
|
-
if (rawMatrixConfig.base_scenario && !
|
|
318113
|
-
rawMatrixConfig.base_scenario =
|
|
318305
|
+
if (rawMatrixConfig.base_scenario && !path77.isAbsolute(rawMatrixConfig.base_scenario)) {
|
|
318306
|
+
rawMatrixConfig.base_scenario = path77.resolve(configDir, rawMatrixConfig.base_scenario);
|
|
318114
318307
|
}
|
|
318115
|
-
|
|
318308
|
+
logger59.info("\uD83D\uDD0D Validating matrix configuration...");
|
|
318116
318309
|
const validationResult = validateMatrixConfig2(rawMatrixConfig);
|
|
318117
318310
|
if (!validationResult.success) {
|
|
318118
|
-
|
|
318311
|
+
logger59.error("\u274C Matrix configuration validation failed:");
|
|
318119
318312
|
const errors3 = validationResult.error.format();
|
|
318120
|
-
const formatErrors = (obj,
|
|
318313
|
+
const formatErrors = (obj, path78 = "") => {
|
|
318121
318314
|
if (obj._errors && obj._errors.length > 0) {
|
|
318122
318315
|
obj._errors.forEach((error47) => {
|
|
318123
|
-
|
|
318316
|
+
logger59.error(` ${path78}: ${error47}`);
|
|
318124
318317
|
});
|
|
318125
318318
|
}
|
|
318126
318319
|
Object.keys(obj).forEach((key) => {
|
|
318127
318320
|
if (key !== "_errors" && typeof obj[key] === "object") {
|
|
318128
|
-
const newPath =
|
|
318321
|
+
const newPath = path78 ? `${path78}.${key}` : key;
|
|
318129
318322
|
formatErrors(obj[key], newPath);
|
|
318130
318323
|
}
|
|
318131
318324
|
});
|
|
318132
318325
|
};
|
|
318133
318326
|
formatErrors(errors3);
|
|
318134
|
-
|
|
318135
|
-
|
|
318327
|
+
logger59.info("\uD83D\uDCA1 Please fix the configuration errors and try again.");
|
|
318328
|
+
logger59.info("\uD83D\uDCD6 See the matrix testing documentation for examples and guidance.");
|
|
318136
318329
|
process.exit(1);
|
|
318137
318330
|
}
|
|
318138
318331
|
const matrixConfig = validationResult.data;
|
|
318139
|
-
|
|
318332
|
+
logger59.info("\u2705 Matrix configuration is valid!");
|
|
318140
318333
|
const totalCombinations = calculateTotalCombinations2(matrixConfig);
|
|
318141
318334
|
const totalRuns = calculateTotalRuns2(matrixConfig);
|
|
318142
|
-
|
|
318335
|
+
logger59.info(`
|
|
318143
318336
|
\uD83D\uDCCA Matrix Analysis:`);
|
|
318144
|
-
|
|
318337
|
+
logger59.info(` Name: ${matrixConfig.name}`);
|
|
318145
318338
|
if (matrixConfig.description) {
|
|
318146
|
-
|
|
318147
|
-
}
|
|
318148
|
-
|
|
318149
|
-
|
|
318150
|
-
|
|
318151
|
-
|
|
318152
|
-
|
|
318153
|
-
|
|
318339
|
+
logger59.info(` Description: ${matrixConfig.description}`);
|
|
318340
|
+
}
|
|
318341
|
+
logger59.info(` Base Scenario: ${matrixConfig.base_scenario}`);
|
|
318342
|
+
logger59.info(` Runs per combination: ${matrixConfig.runs_per_combination}`);
|
|
318343
|
+
logger59.info(` Matrix axes: ${matrixConfig.matrix.length}`);
|
|
318344
|
+
logger59.info(` Total combinations: ${totalCombinations}`);
|
|
318345
|
+
logger59.info(` Total test runs: ${totalRuns}`);
|
|
318346
|
+
logger59.info(`
|
|
318154
318347
|
\uD83C\uDFAF Matrix Structure:`);
|
|
318155
318348
|
matrixConfig.matrix.forEach((axis, index) => {
|
|
318156
|
-
|
|
318157
|
-
|
|
318158
|
-
|
|
318349
|
+
logger59.info(` Axis ${index + 1}: ${axis.parameter}`);
|
|
318350
|
+
logger59.info(` Values: [${axis.values.map((v2) => JSON.stringify(v2)).join(", ")}]`);
|
|
318351
|
+
logger59.info(` Count: ${axis.values.length}`);
|
|
318159
318352
|
});
|
|
318160
318353
|
const baseScenarioPath = matrixConfig.base_scenario;
|
|
318161
318354
|
if (!fs54.existsSync(baseScenarioPath)) {
|
|
318162
|
-
|
|
318355
|
+
logger59.error(`
|
|
318163
318356
|
\u274C Error: Base scenario file not found at '${baseScenarioPath}'`);
|
|
318164
|
-
|
|
318357
|
+
logger59.info("\uD83D\uDCA1 Make sure the base_scenario path in your matrix config is correct.");
|
|
318165
318358
|
process.exit(1);
|
|
318166
318359
|
}
|
|
318167
|
-
|
|
318360
|
+
logger59.info(`\u2705 Base scenario file found: ${baseScenarioPath}`);
|
|
318168
318361
|
let baseScenario;
|
|
318169
318362
|
try {
|
|
318170
318363
|
const baseScenarioContents = fs54.readFileSync(baseScenarioPath, "utf8");
|
|
318171
318364
|
baseScenario = load2(baseScenarioContents);
|
|
318172
318365
|
const baseValidationResult = ScenarioSchema.safeParse(baseScenario);
|
|
318173
318366
|
if (!baseValidationResult.success) {
|
|
318174
|
-
|
|
318367
|
+
logger59.error(`
|
|
318175
318368
|
\u274C Error: Base scenario file is invalid:`);
|
|
318176
|
-
|
|
318369
|
+
logger59.error(JSON.stringify(baseValidationResult.error.format(), null, 2));
|
|
318177
318370
|
process.exit(1);
|
|
318178
318371
|
}
|
|
318179
|
-
|
|
318372
|
+
logger59.info(`\u2705 Base scenario is valid`);
|
|
318180
318373
|
} catch (yamlError) {
|
|
318181
|
-
|
|
318374
|
+
logger59.error(`
|
|
318182
318375
|
\u274C Error: Failed to parse base scenario YAML file:`);
|
|
318183
|
-
|
|
318376
|
+
logger59.error(yamlError instanceof Error ? yamlError.message : String(yamlError));
|
|
318184
318377
|
process.exit(1);
|
|
318185
318378
|
}
|
|
318186
|
-
|
|
318379
|
+
logger59.info(`\uD83D\uDD0D Validating matrix parameter paths...`);
|
|
318187
318380
|
const pathValidation = validateMatrixParameterPaths2(baseScenario, matrixConfig.matrix);
|
|
318188
318381
|
if (!pathValidation.valid) {
|
|
318189
|
-
|
|
318382
|
+
logger59.error(`
|
|
318190
318383
|
\u274C Error: Invalid parameter paths in matrix configuration:`);
|
|
318191
318384
|
pathValidation.invalidPaths.forEach((invalidPath) => {
|
|
318192
|
-
|
|
318385
|
+
logger59.error(` - ${invalidPath}`);
|
|
318193
318386
|
});
|
|
318194
|
-
|
|
318195
|
-
|
|
318387
|
+
logger59.info("\uD83D\uDCA1 Make sure all parameter paths exist in your base scenario.");
|
|
318388
|
+
logger59.info("\uD83D\uDCD6 Check the matrix testing documentation for parameter path examples.");
|
|
318196
318389
|
process.exit(1);
|
|
318197
318390
|
}
|
|
318198
|
-
|
|
318391
|
+
logger59.info(`\u2705 All matrix parameter paths are valid`);
|
|
318199
318392
|
const combinations = generateMatrixCombinations2(matrixConfig);
|
|
318200
318393
|
if (options.verbose || options.dryRun) {
|
|
318201
|
-
|
|
318394
|
+
logger59.info(`
|
|
318202
318395
|
\uD83D\uDD00 Matrix Combinations:`);
|
|
318203
318396
|
combinations.forEach((combo, index) => {
|
|
318204
|
-
|
|
318397
|
+
logger59.info(` ${index + 1}. ${combo.id}: ${JSON.stringify(combo.parameters, null, 0)}`);
|
|
318205
318398
|
});
|
|
318206
318399
|
if (combinations.length > 0 && options.verbose) {
|
|
318207
|
-
|
|
318400
|
+
logger59.info(`
|
|
318208
318401
|
\uD83D\uDEE0\uFE0F Parameter Override Preview:`);
|
|
318209
318402
|
try {
|
|
318210
318403
|
const firstCombination = combinations[0];
|
|
318211
318404
|
const overrides = combinationToOverrides2(firstCombination.parameters);
|
|
318212
|
-
|
|
318213
|
-
|
|
318214
|
-
|
|
318215
|
-
|
|
318216
|
-
|
|
318405
|
+
logger59.info(` \uD83D\uDCCB Example: ${firstCombination.id}`);
|
|
318406
|
+
logger59.info(` \uD83D\uDCCA Metadata: ${firstCombination.metadata.combinationIndex + 1} of ${firstCombination.metadata.totalCombinations}`);
|
|
318407
|
+
logger59.info(` \uD83D\uDCDD Original scenario name: "${baseScenario.name}"`);
|
|
318408
|
+
logger59.info(` \uD83D\uDCDD Modified scenario ready for execution`);
|
|
318409
|
+
logger59.info(` \uD83D\uDCDD Parameters applied:`);
|
|
318217
318410
|
overrides.forEach((override) => {
|
|
318218
|
-
|
|
318411
|
+
logger59.info(` \uD83D\uDD27 ${override.path}: ${JSON.stringify(override.value)}`);
|
|
318219
318412
|
});
|
|
318220
|
-
|
|
318413
|
+
logger59.info(` \uD83D\uDCDD This combination will run ${matrixConfig.runs_per_combination} time(s)`);
|
|
318221
318414
|
} catch (error47) {
|
|
318222
|
-
|
|
318415
|
+
logger59.warn(` \u26A0\uFE0F Could not generate override preview: ${error47 instanceof Error ? error47.message : String(error47)}`);
|
|
318223
318416
|
}
|
|
318224
318417
|
}
|
|
318225
318418
|
}
|
|
318226
318419
|
let filteredCombinations = combinations;
|
|
318227
318420
|
if (options.filter) {
|
|
318228
|
-
|
|
318421
|
+
logger59.info(`
|
|
318229
318422
|
\uD83D\uDD0D Applying filter: ${options.filter}`);
|
|
318230
318423
|
filteredCombinations = filterCombinations2(combinations, options.filter);
|
|
318231
|
-
|
|
318424
|
+
logger59.info(` Filtered to ${filteredCombinations.length} combinations`);
|
|
318232
318425
|
}
|
|
318233
318426
|
if (totalRuns > 50) {
|
|
318234
|
-
|
|
318427
|
+
logger59.info(`
|
|
318235
318428
|
\u26A0\uFE0F Warning: This matrix will execute ${totalRuns} total test runs.`);
|
|
318236
|
-
|
|
318237
|
-
|
|
318429
|
+
logger59.info(" This may take a significant amount of time and resources.");
|
|
318430
|
+
logger59.info(" Consider using --filter to reduce the scope or increasing --parallel for faster execution.");
|
|
318238
318431
|
}
|
|
318239
318432
|
if (options.dryRun) {
|
|
318240
|
-
|
|
318433
|
+
logger59.info(`
|
|
318241
318434
|
\uD83D\uDD0D Dry Run Complete - Matrix Analysis Only`);
|
|
318242
|
-
|
|
318243
|
-
|
|
318435
|
+
logger59.info("\u2728 Matrix configuration is valid and ready for execution.");
|
|
318436
|
+
logger59.info("\uD83D\uDCDD To execute the matrix, run the same command without --dry-run");
|
|
318244
318437
|
if (!isShuttingDown) {
|
|
318245
318438
|
const summary = processManager2.getSummary();
|
|
318246
318439
|
if (summary.total > 0) {
|
|
318247
|
-
|
|
318440
|
+
logger59.info(`\uD83D\uDD27 [Matrix] Cleaning up ${summary.total} processes after dry-run...`);
|
|
318248
318441
|
await processManager2.terminateAllProcesses();
|
|
318249
318442
|
}
|
|
318250
318443
|
}
|
|
318251
318444
|
process.exit(0);
|
|
318252
318445
|
} else {
|
|
318253
318446
|
const executionStats = calculateExecutionStats2(filteredCombinations, matrixConfig.runs_per_combination);
|
|
318254
|
-
|
|
318447
|
+
logger59.info(`
|
|
318255
318448
|
\uD83D\uDE80 Matrix Execution Plan:`);
|
|
318256
|
-
|
|
318257
|
-
|
|
318258
|
-
|
|
318259
|
-
|
|
318260
|
-
|
|
318261
|
-
|
|
318449
|
+
logger59.info(` Parallel execution: ${options.parallel} concurrent runs`);
|
|
318450
|
+
logger59.info(` Total combinations to execute: ${executionStats.totalCombinations}`);
|
|
318451
|
+
logger59.info(` Total runs: ${executionStats.totalRuns}`);
|
|
318452
|
+
logger59.info(` Estimated duration: ${formatDuration2(executionStats.estimatedDuration.realistic)} (realistic)`);
|
|
318453
|
+
logger59.info(` Duration range: ${formatDuration2(executionStats.estimatedDuration.optimistic)} - ${formatDuration2(executionStats.estimatedDuration.pessimistic)}`);
|
|
318454
|
+
logger59.info(`
|
|
318262
318455
|
\u2705 Matrix Ready for Execution:`);
|
|
318263
|
-
|
|
318264
|
-
|
|
318265
|
-
|
|
318266
|
-
|
|
318267
|
-
|
|
318456
|
+
logger59.info(" \uD83C\uDFAF Matrix configuration: \u2705 Valid");
|
|
318457
|
+
logger59.info(" \uD83C\uDFAF Parameter combinations: \u2705 Generated");
|
|
318458
|
+
logger59.info(" \uD83C\uDFAF Execution context: \u2705 Prepared");
|
|
318459
|
+
logger59.info(" \uD83C\uDFAF Base scenario: \u2705 Validated");
|
|
318460
|
+
logger59.info("\uD83D\uDD27 [DEBUG] About to import matrix-orchestrator...");
|
|
318268
318461
|
const { executeMatrixRuns: executeMatrixRuns2 } = await Promise.resolve().then(() => (init_matrix_orchestrator(), exports_matrix_orchestrator));
|
|
318269
|
-
|
|
318270
|
-
|
|
318462
|
+
logger59.info("\uD83D\uDD27 [DEBUG] Successfully imported matrix-orchestrator");
|
|
318463
|
+
logger59.info(`
|
|
318271
318464
|
\uD83D\uDE80 Starting Matrix Execution...`);
|
|
318272
|
-
const logsDir =
|
|
318465
|
+
const logsDir = path77.join(__dirname, "_logs_");
|
|
318273
318466
|
const matrixRunId = generateRunFilename(1);
|
|
318274
|
-
const outputDir =
|
|
318275
|
-
|
|
318467
|
+
const outputDir = path77.join(logsDir, matrixRunId.replace("run-", "matrix-"));
|
|
318468
|
+
logger59.info("\uD83D\uDD27 [DEBUG] About to call executeMatrixRuns...");
|
|
318276
318469
|
const results = await executeMatrixRuns2(matrixConfig, filteredCombinations, {
|
|
318277
318470
|
outputDir,
|
|
318278
318471
|
maxParallel: parseInt(options.parallel, 10),
|
|
@@ -318281,54 +318474,54 @@ var scenario = new Command().name("scenario").description("Manage and execute El
|
|
|
318281
318474
|
verbose: options.verbose,
|
|
318282
318475
|
onProgress: (message, eventType, _data) => {
|
|
318283
318476
|
if (options.verbose || eventType === "MATRIX_STARTED" || eventType === "COMBINATION_COMPLETED" || eventType === "MATRIX_COMPLETED") {
|
|
318284
|
-
|
|
318477
|
+
logger59.info(`\uD83D\uDD04 ${message}`);
|
|
318285
318478
|
}
|
|
318286
318479
|
},
|
|
318287
318480
|
onCombinationComplete: (summary) => {
|
|
318288
|
-
|
|
318481
|
+
logger59.info(`\u2705 Combination ${summary.combinationId} completed: ${summary.successfulRuns}/${summary.totalRuns} successful (${(summary.successRate * 100).toFixed(1)}%)`);
|
|
318289
318482
|
},
|
|
318290
318483
|
onResourceWarning: (alert) => {
|
|
318291
|
-
|
|
318484
|
+
logger59.warn(`\u26A0\uFE0F Resource ${alert.resource} at ${alert.currentUsage.toFixed(1)}%: ${alert.message}`);
|
|
318292
318485
|
if (alert.recommendation) {
|
|
318293
|
-
|
|
318486
|
+
logger59.info(`\uD83D\uDCA1 Recommendation: ${alert.recommendation}`);
|
|
318294
318487
|
}
|
|
318295
318488
|
}
|
|
318296
318489
|
});
|
|
318297
|
-
|
|
318490
|
+
logger59.info("\uD83D\uDD27 [DEBUG] executeMatrixRuns completed successfully");
|
|
318298
318491
|
const successfulRuns = results.filter((r2) => r2.success).length;
|
|
318299
318492
|
const failedRuns = results.length - successfulRuns;
|
|
318300
318493
|
const successRate = results.length > 0 ? successfulRuns / results.length * 100 : 0;
|
|
318301
|
-
|
|
318494
|
+
logger59.info(`
|
|
318302
318495
|
\uD83C\uDF89 Matrix Execution Complete!`);
|
|
318303
|
-
|
|
318304
|
-
|
|
318305
|
-
|
|
318306
|
-
|
|
318307
|
-
|
|
318308
|
-
|
|
318496
|
+
logger59.info(`\uD83D\uDCCA Results Summary:`);
|
|
318497
|
+
logger59.info(` Total runs: ${results.length}`);
|
|
318498
|
+
logger59.info(` Successful: ${successfulRuns}`);
|
|
318499
|
+
logger59.info(` Failed: ${failedRuns}`);
|
|
318500
|
+
logger59.info(` Success rate: ${successRate.toFixed(1)}%`);
|
|
318501
|
+
logger59.info(`\uD83D\uDCC1 Results saved to: ${outputDir}`);
|
|
318309
318502
|
if (!isShuttingDown) {
|
|
318310
318503
|
const summary = processManager2.getSummary();
|
|
318311
318504
|
if (summary.total > 0) {
|
|
318312
|
-
|
|
318505
|
+
logger59.info(`\uD83D\uDD27 [Matrix] Cleaning up ${summary.total} processes after completion...`);
|
|
318313
318506
|
await processManager2.terminateAllProcesses();
|
|
318314
|
-
|
|
318507
|
+
logger59.info(`\uD83D\uDD27 [Matrix] Process cleanup completed`);
|
|
318315
318508
|
}
|
|
318316
318509
|
}
|
|
318317
318510
|
process.exit(failedRuns === 0 ? 0 : 1);
|
|
318318
318511
|
}
|
|
318319
318512
|
} catch (error47) {
|
|
318320
|
-
|
|
318513
|
+
logger59.error("\u274C An error occurred during matrix analysis:", error47 instanceof Error ? error47.message : String(error47));
|
|
318321
318514
|
if (options.verbose && error47 instanceof Error && error47.stack) {
|
|
318322
|
-
|
|
318515
|
+
logger59.error(`Stack trace: ${error47.stack}`);
|
|
318323
318516
|
}
|
|
318324
318517
|
if (!isShuttingDown) {
|
|
318325
318518
|
const summary = processManager2.getSummary();
|
|
318326
318519
|
if (summary.total > 0) {
|
|
318327
|
-
|
|
318520
|
+
logger59.info(`\uD83D\uDD27 [Matrix] Cleaning up ${summary.total} processes after error...`);
|
|
318328
318521
|
await processManager2.terminateAllProcesses();
|
|
318329
318522
|
}
|
|
318330
318523
|
}
|
|
318331
|
-
|
|
318524
|
+
logger59.info("\uD83D\uDCA1 Use --verbose for more detailed error information.");
|
|
318332
318525
|
process.exit(1);
|
|
318333
318526
|
}
|
|
318334
318527
|
}));
|
|
@@ -318349,19 +318542,19 @@ var shutdownState = {
|
|
|
318349
318542
|
};
|
|
318350
318543
|
async function gracefulShutdown(signal) {
|
|
318351
318544
|
if (!shutdownState.tryInitiateShutdown()) {
|
|
318352
|
-
|
|
318545
|
+
logger59.debug(`Ignoring ${signal} - shutdown already in progress`);
|
|
318353
318546
|
return;
|
|
318354
318547
|
}
|
|
318355
|
-
|
|
318548
|
+
logger59.info(`Received ${signal}, shutting down gracefully...`);
|
|
318356
318549
|
try {
|
|
318357
318550
|
const serverWasStopped = await stopServer();
|
|
318358
318551
|
if (serverWasStopped) {
|
|
318359
|
-
|
|
318552
|
+
logger59.info("Server stopped successfully");
|
|
318360
318553
|
}
|
|
318361
318554
|
} catch (error47) {
|
|
318362
318555
|
const errorMessage = error47 instanceof Error ? error47.message : String(error47);
|
|
318363
|
-
|
|
318364
|
-
|
|
318556
|
+
logger59.error(`Error stopping server: ${errorMessage}`);
|
|
318557
|
+
logger59.debug({ error: error47 }, "Full error details:");
|
|
318365
318558
|
}
|
|
318366
318559
|
const exitCode = signal === "SIGINT" ? 130 : signal === "SIGTERM" ? 143 : 0;
|
|
318367
318560
|
process.exit(exitCode);
|
|
@@ -318395,9 +318588,9 @@ async function main() {
|
|
|
318395
318588
|
await program2.parseAsync();
|
|
318396
318589
|
}
|
|
318397
318590
|
main().catch((error47) => {
|
|
318398
|
-
|
|
318591
|
+
logger59.error({ error: error47 }, "An error occurred:");
|
|
318399
318592
|
process.exit(1);
|
|
318400
318593
|
});
|
|
318401
318594
|
|
|
318402
|
-
//# debugId=
|
|
318595
|
+
//# debugId=C897D0A55C8868B464756E2164756E21
|
|
318403
318596
|
//# sourceMappingURL=index.js.map
|