@elizaos/cli 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-7F7J7V7K.js → chunk-5RHJRZKW.js} +6 -6
- package/dist/chunk-GRPGGUED.js +2262 -0
- package/dist/{chunk-IMVD3V75.js → chunk-J5E77VTL.js} +2 -2
- package/dist/{chunk-GDP7OWFE.js → chunk-PMV25BM7.js} +2 -2
- package/dist/chunk-XB5JBFO6.js +41 -0
- package/dist/{chunk-RXPGZT6Z.js → chunk-YKFBLIQD.js} +154 -137
- package/dist/commands/agent/actions/index.js +3 -3
- package/dist/commands/agent/index.js +3 -3
- package/dist/commands/create/actions/index.js +5 -5
- package/dist/commands/create/index.js +6 -6
- package/dist/commands/shared/index.js +1 -1
- package/dist/index.js +35 -32
- package/dist/{plugin-creator-35CAJF4O.js → plugin-creator-KFTUVFYX.js} +10 -7
- package/dist/{registry-3LKJUU3X.js → registry-WOGFPQNY.js} +3 -3
- package/dist/{setup-JDB67JV2.js → setup-KAJWYH6P.js} +4 -4
- package/dist/templates/plugin-starter/dist/index.js +12 -2
- package/dist/templates/plugin-starter/dist/index.js.map +1 -1
- package/dist/templates/plugin-starter/package.json +1 -1
- package/dist/templates/plugin-starter/src/plugin.ts +16 -4
- package/dist/templates/project-starter/package.json +4 -4
- package/dist/templates/project-starter/src/plugin.ts +29 -3
- package/dist/templates/project-tee-starter/package.json +3 -3
- package/dist/{utils-SV7PQSFH.js → utils-Q5OUIPQH.js} +3 -3
- package/package.json +5 -6
- package/templates/plugin-starter/dist/.vite/manifest.json +1 -1
- package/templates/plugin-starter/dist/index.js +12 -2
- package/templates/plugin-starter/dist/index.js.map +1 -1
- package/templates/plugin-starter/package.json +1 -1
- package/templates/plugin-starter/src/plugin.ts +16 -4
- package/templates/project-starter/package.json +4 -4
- package/templates/project-starter/src/plugin.ts +29 -3
- package/templates/project-tee-starter/package.json +3 -3
- package/dist/chunk-7PPBVSWE.js +0 -166
- package/dist/chunk-AQ6OMR2A.js +0 -14
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
agent,
|
|
7
7
|
getAgents,
|
|
8
8
|
resolveAgentId
|
|
9
|
-
} from "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
9
|
+
} from "../../chunk-YKFBLIQD.js";
|
|
10
|
+
import "../../chunk-GRPGGUED.js";
|
|
11
11
|
import {
|
|
12
12
|
getAgentRuntimeUrl,
|
|
13
13
|
getAgentsBaseUrl
|
|
14
14
|
} from "../../chunk-F24MS2YR.js";
|
|
15
|
-
import "../../chunk-
|
|
15
|
+
import "../../chunk-XB5JBFO6.js";
|
|
16
16
|
export {
|
|
17
17
|
agent,
|
|
18
18
|
getAgentRuntimeUrl,
|
|
@@ -7,17 +7,17 @@ import {
|
|
|
7
7
|
createPlugin,
|
|
8
8
|
createProject,
|
|
9
9
|
createTEEProject
|
|
10
|
-
} from "../../../chunk-
|
|
10
|
+
} from "../../../chunk-5RHJRZKW.js";
|
|
11
11
|
import {
|
|
12
12
|
createProjectDirectories,
|
|
13
13
|
setupAIModelConfig,
|
|
14
14
|
setupEmbeddingModelConfig,
|
|
15
15
|
setupProjectEnvironment
|
|
16
|
-
} from "../../../chunk-
|
|
17
|
-
import "../../../chunk-
|
|
18
|
-
import "../../../chunk-
|
|
16
|
+
} from "../../../chunk-PMV25BM7.js";
|
|
17
|
+
import "../../../chunk-YKFBLIQD.js";
|
|
18
|
+
import "../../../chunk-GRPGGUED.js";
|
|
19
19
|
import "../../../chunk-F24MS2YR.js";
|
|
20
|
-
import "../../../chunk-
|
|
20
|
+
import "../../../chunk-XB5JBFO6.js";
|
|
21
21
|
export {
|
|
22
22
|
createAgent,
|
|
23
23
|
createPlugin,
|
|
@@ -4,13 +4,13 @@ const require = createRequire(import.meta.url);
|
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
create
|
|
7
|
-
} from "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
11
|
-
import "../../chunk-
|
|
7
|
+
} from "../../chunk-J5E77VTL.js";
|
|
8
|
+
import "../../chunk-5RHJRZKW.js";
|
|
9
|
+
import "../../chunk-PMV25BM7.js";
|
|
10
|
+
import "../../chunk-YKFBLIQD.js";
|
|
11
|
+
import "../../chunk-GRPGGUED.js";
|
|
12
12
|
import "../../chunk-F24MS2YR.js";
|
|
13
|
-
import "../../chunk-
|
|
13
|
+
import "../../chunk-XB5JBFO6.js";
|
|
14
14
|
export {
|
|
15
15
|
create
|
|
16
16
|
};
|
package/dist/index.js
CHANGED
|
@@ -5,11 +5,11 @@ const require = createRequire(import.meta.url);
|
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
create
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-J5E77VTL.js";
|
|
9
9
|
import {
|
|
10
10
|
getElizaCharacter
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-5RHJRZKW.js";
|
|
12
|
+
import "./chunk-PMV25BM7.js";
|
|
13
13
|
import {
|
|
14
14
|
TestRunner,
|
|
15
15
|
UserEnvironment,
|
|
@@ -46,14 +46,17 @@ import {
|
|
|
46
46
|
testPublishToGitHub,
|
|
47
47
|
testPublishToNpm,
|
|
48
48
|
validateDataDir
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-YKFBLIQD.js";
|
|
50
50
|
import {
|
|
51
51
|
configureEmojis,
|
|
52
52
|
emoji,
|
|
53
|
+
require_execa,
|
|
53
54
|
runBunCommand
|
|
54
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-GRPGGUED.js";
|
|
55
56
|
import "./chunk-F24MS2YR.js";
|
|
56
|
-
import
|
|
57
|
+
import {
|
|
58
|
+
__toESM
|
|
59
|
+
} from "./chunk-XB5JBFO6.js";
|
|
57
60
|
|
|
58
61
|
// src/utils/port-validation.ts
|
|
59
62
|
function validatePort(value) {
|
|
@@ -1582,8 +1585,8 @@ async function addPlugin(pluginArg, opts) {
|
|
|
1582
1585
|
}
|
|
1583
1586
|
|
|
1584
1587
|
// src/commands/plugins/actions/remove.ts
|
|
1588
|
+
var import_execa = __toESM(require_execa(), 1);
|
|
1585
1589
|
import { logger as logger4 } from "@elizaos/core";
|
|
1586
|
-
import { execa } from "execa";
|
|
1587
1590
|
import { existsSync as existsSync9, rmSync } from "fs";
|
|
1588
1591
|
import path9 from "path";
|
|
1589
1592
|
async function removePlugin(plugin) {
|
|
@@ -1610,7 +1613,7 @@ async function removePlugin(plugin) {
|
|
|
1610
1613
|
}
|
|
1611
1614
|
console.info(`Removing ${packageNameToRemove}...`);
|
|
1612
1615
|
try {
|
|
1613
|
-
await execa("bun", ["remove", packageNameToRemove], {
|
|
1616
|
+
await (0, import_execa.execa)("bun", ["remove", packageNameToRemove], {
|
|
1614
1617
|
cwd,
|
|
1615
1618
|
stdio: "inherit"
|
|
1616
1619
|
});
|
|
@@ -2929,7 +2932,7 @@ import { readFileSync as readFileSync4 } from "fs";
|
|
|
2929
2932
|
import path12 from "path";
|
|
2930
2933
|
async function generatePlugin(opts) {
|
|
2931
2934
|
try {
|
|
2932
|
-
const { PluginCreator } = await import("./plugin-creator-
|
|
2935
|
+
const { PluginCreator } = await import("./plugin-creator-KFTUVFYX.js");
|
|
2933
2936
|
if (opts.apiKey) {
|
|
2934
2937
|
process.env.ANTHROPIC_API_KEY = opts.apiKey;
|
|
2935
2938
|
}
|
|
@@ -3040,7 +3043,7 @@ import path18 from "path";
|
|
|
3040
3043
|
import * as clack10 from "@clack/prompts";
|
|
3041
3044
|
|
|
3042
3045
|
// src/commands/publish/actions/npm-publish.ts
|
|
3043
|
-
|
|
3046
|
+
var import_execa2 = __toESM(require_execa(), 1);
|
|
3044
3047
|
import { promises as fs2 } from "fs";
|
|
3045
3048
|
import path13 from "path";
|
|
3046
3049
|
async function publishToNpm(cwd, packageJson, npmUsername) {
|
|
@@ -3052,9 +3055,9 @@ async function publishToNpm(cwd, packageJson, npmUsername) {
|
|
|
3052
3055
|
await fs2.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2), "utf-8");
|
|
3053
3056
|
}
|
|
3054
3057
|
console.info("Building package...");
|
|
3055
|
-
await
|
|
3058
|
+
await (0, import_execa2.execa)("npm", ["run", "build"], { cwd, stdio: "inherit" });
|
|
3056
3059
|
console.info("Publishing to npm...");
|
|
3057
|
-
await
|
|
3060
|
+
await (0, import_execa2.execa)("npm", ["publish", "--ignore-scripts"], { cwd, stdio: "inherit" });
|
|
3058
3061
|
console.log(`[\u221A] Successfully published ${packageJson.name}@${packageJson.version} to npm`);
|
|
3059
3062
|
}
|
|
3060
3063
|
|
|
@@ -3292,14 +3295,14 @@ async function generatePackageMetadata(packageJson, cliVersion, username) {
|
|
|
3292
3295
|
}
|
|
3293
3296
|
|
|
3294
3297
|
// src/commands/publish/utils/authentication.ts
|
|
3295
|
-
|
|
3298
|
+
var import_execa3 = __toESM(require_execa(), 1);
|
|
3296
3299
|
import * as clack7 from "@clack/prompts";
|
|
3297
3300
|
async function getNpmUsername() {
|
|
3298
3301
|
console.info(
|
|
3299
3302
|
"NPM authentication required for registry compliance (package name must match potential NPM package)."
|
|
3300
3303
|
);
|
|
3301
3304
|
try {
|
|
3302
|
-
const { stdout } = await
|
|
3305
|
+
const { stdout } = await (0, import_execa3.execa)("npm", ["whoami"]);
|
|
3303
3306
|
const currentUser = stdout.trim();
|
|
3304
3307
|
console.info(`Found existing NPM login: ${currentUser}`);
|
|
3305
3308
|
const useExisting = await clack7.confirm({
|
|
@@ -3314,8 +3317,8 @@ async function getNpmUsername() {
|
|
|
3314
3317
|
return currentUser;
|
|
3315
3318
|
} else {
|
|
3316
3319
|
console.info("Please login with your desired NPM account...");
|
|
3317
|
-
await
|
|
3318
|
-
const { stdout: newStdout } = await
|
|
3320
|
+
await (0, import_execa3.execa)("npm", ["login"], { stdio: "inherit" });
|
|
3321
|
+
const { stdout: newStdout } = await (0, import_execa3.execa)("npm", ["whoami"]);
|
|
3319
3322
|
const newUser = newStdout.trim();
|
|
3320
3323
|
console.info(`Logged in as: ${newUser}`);
|
|
3321
3324
|
return newUser;
|
|
@@ -3323,8 +3326,8 @@ async function getNpmUsername() {
|
|
|
3323
3326
|
} catch (error) {
|
|
3324
3327
|
console.info("Not logged into NPM. Please login to continue...");
|
|
3325
3328
|
try {
|
|
3326
|
-
await
|
|
3327
|
-
const { stdout } = await
|
|
3329
|
+
await (0, import_execa3.execa)("npm", ["login"], { stdio: "inherit" });
|
|
3330
|
+
const { stdout } = await (0, import_execa3.execa)("npm", ["whoami"]);
|
|
3328
3331
|
const username = stdout.trim();
|
|
3329
3332
|
console.info(`Successfully logged in as: ${username}`);
|
|
3330
3333
|
return username;
|
|
@@ -3336,7 +3339,7 @@ async function getNpmUsername() {
|
|
|
3336
3339
|
}
|
|
3337
3340
|
|
|
3338
3341
|
// src/commands/publish/utils/version-check.ts
|
|
3339
|
-
|
|
3342
|
+
var import_execa7 = __toESM(require_execa(), 1);
|
|
3340
3343
|
import { promises as fs7 } from "fs";
|
|
3341
3344
|
import path17 from "path";
|
|
3342
3345
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
@@ -3347,12 +3350,12 @@ import { logger as logger13 } from "@elizaos/core";
|
|
|
3347
3350
|
import { Command as Command4 } from "commander";
|
|
3348
3351
|
|
|
3349
3352
|
// src/commands/update/actions/cli-update.ts
|
|
3353
|
+
var import_execa5 = __toESM(require_execa(), 1);
|
|
3350
3354
|
import { logger as logger11 } from "@elizaos/core";
|
|
3351
|
-
import { execa as execa5 } from "execa";
|
|
3352
3355
|
|
|
3353
3356
|
// src/commands/update/utils/version-utils.ts
|
|
3357
|
+
var import_execa4 = __toESM(require_execa(), 1);
|
|
3354
3358
|
import { logger as logger10 } from "@elizaos/core";
|
|
3355
|
-
import { execa as execa4 } from "execa";
|
|
3356
3359
|
import * as semver from "semver";
|
|
3357
3360
|
var SPECIAL_VERSION_TAGS = ["latest", "next", "canary", "rc", "dev", "nightly", "alpha"];
|
|
3358
3361
|
var ELIZAOS_ORG = "@elizaos";
|
|
@@ -3398,7 +3401,7 @@ function isMajorUpdate(currentVersion, targetVersion) {
|
|
|
3398
3401
|
}
|
|
3399
3402
|
async function fetchLatestVersion(packageName) {
|
|
3400
3403
|
try {
|
|
3401
|
-
const { stdout } = await
|
|
3404
|
+
const { stdout } = await (0, import_execa4.execa)("npm", ["view", packageName, "version"], {
|
|
3402
3405
|
env: { NODE_ENV: "production" }
|
|
3403
3406
|
});
|
|
3404
3407
|
const version = stdout.trim();
|
|
@@ -3448,7 +3451,7 @@ async function performCliUpdate(options = {}) {
|
|
|
3448
3451
|
migrationError instanceof Error ? migrationError.message : String(migrationError)
|
|
3449
3452
|
);
|
|
3450
3453
|
try {
|
|
3451
|
-
await
|
|
3454
|
+
await (0, import_execa5.execa)("npm", ["install", "-g", `@elizaos/cli@${latestVersion}`], {
|
|
3452
3455
|
stdio: "inherit"
|
|
3453
3456
|
});
|
|
3454
3457
|
console.log(`CLI updated successfully to version ${latestVersion} [\u2713]`);
|
|
@@ -3462,7 +3465,7 @@ async function performCliUpdate(options = {}) {
|
|
|
3462
3465
|
}
|
|
3463
3466
|
}
|
|
3464
3467
|
try {
|
|
3465
|
-
await
|
|
3468
|
+
await (0, import_execa5.execa)("bun", ["add", "-g", `@elizaos/cli@${latestVersion}`], { stdio: "inherit" });
|
|
3466
3469
|
console.log(`CLI updated successfully to version ${latestVersion} [\u2713]`);
|
|
3467
3470
|
return true;
|
|
3468
3471
|
} catch (bunError) {
|
|
@@ -3485,8 +3488,8 @@ import { promises as fs6 } from "fs";
|
|
|
3485
3488
|
import * as path16 from "path";
|
|
3486
3489
|
|
|
3487
3490
|
// src/commands/update/utils/package-utils.ts
|
|
3491
|
+
var import_execa6 = __toESM(require_execa(), 1);
|
|
3488
3492
|
import fs5 from "fs/promises";
|
|
3489
|
-
import { execa as execa6 } from "execa";
|
|
3490
3493
|
import { logger as logger12 } from "@elizaos/core";
|
|
3491
3494
|
async function checkForUpdates(dependencies) {
|
|
3492
3495
|
const updates = {};
|
|
@@ -3534,7 +3537,7 @@ async function installDependencies(cwd) {
|
|
|
3534
3537
|
console.log("\nInstalling updated packages...");
|
|
3535
3538
|
try {
|
|
3536
3539
|
const packageManager = await getPackageManager();
|
|
3537
|
-
await
|
|
3540
|
+
await (0, import_execa6.execa)(packageManager, ["install"], { cwd, stdio: "inherit" });
|
|
3538
3541
|
console.log("Dependencies installed successfully [\u2713]");
|
|
3539
3542
|
} catch (error) {
|
|
3540
3543
|
throw new Error(
|
|
@@ -3695,7 +3698,7 @@ async function checkCliVersion() {
|
|
|
3695
3698
|
const cliPackageJsonContent = await fs7.readFile(cliPackageJsonPath, "utf-8");
|
|
3696
3699
|
const cliPackageJson = JSON.parse(cliPackageJsonContent);
|
|
3697
3700
|
const currentVersion = cliPackageJson.version || "0.0.0";
|
|
3698
|
-
const { stdout } = await
|
|
3701
|
+
const { stdout } = await (0, import_execa7.execa)("npm", ["view", "@elizaos/cli", "time", "--json"]);
|
|
3699
3702
|
const timeData = JSON.parse(stdout);
|
|
3700
3703
|
delete timeData.created;
|
|
3701
3704
|
delete timeData.modified;
|
|
@@ -4042,13 +4045,13 @@ var publish = new Command5().name("publish").description("Publish a plugin to np
|
|
|
4042
4045
|
import { Command as Command6 } from "commander";
|
|
4043
4046
|
|
|
4044
4047
|
// src/commands/monorepo/actions/clone.ts
|
|
4045
|
-
|
|
4048
|
+
var import_execa8 = __toESM(require_execa(), 1);
|
|
4046
4049
|
import { existsSync as existsSync12, readdirSync as readdirSync3, mkdirSync } from "fs";
|
|
4047
4050
|
import path19 from "path";
|
|
4048
4051
|
async function cloneRepository(repo, branch, destination) {
|
|
4049
4052
|
try {
|
|
4050
4053
|
const repoUrl = `https://github.com/${repo}`;
|
|
4051
|
-
await
|
|
4054
|
+
await (0, import_execa8.execa)("git", ["clone", "-b", branch, repoUrl, destination], {
|
|
4052
4055
|
stdio: "inherit"
|
|
4053
4056
|
});
|
|
4054
4057
|
} catch (error) {
|
|
@@ -4812,7 +4815,7 @@ async function installPluginDependencies(projectInfo) {
|
|
|
4812
4815
|
};
|
|
4813
4816
|
await fs11.promises.writeFile(packageJsonPath, JSON.stringify(packageJsonContent, null, 2));
|
|
4814
4817
|
}
|
|
4815
|
-
const { installPlugin: installPlugin2 } = await import("./utils-
|
|
4818
|
+
const { installPlugin: installPlugin2 } = await import("./utils-Q5OUIPQH.js");
|
|
4816
4819
|
for (const dependency of project.pluginModule.dependencies) {
|
|
4817
4820
|
await installPlugin2(dependency, pluginsDir);
|
|
4818
4821
|
const dependencyPath = path24.join(pluginsDir, "node_modules", dependency);
|
|
@@ -4835,8 +4838,8 @@ import { spawn as spawn3 } from "child_process";
|
|
|
4835
4838
|
import path26 from "path";
|
|
4836
4839
|
|
|
4837
4840
|
// src/utils/testing/tsc-validator.ts
|
|
4841
|
+
var import_execa9 = __toESM(require_execa(), 1);
|
|
4838
4842
|
import { logger as logger21 } from "@elizaos/core";
|
|
4839
|
-
import { execa as execa9 } from "execa";
|
|
4840
4843
|
import path25 from "path";
|
|
4841
4844
|
import { existsSync as existsSync17 } from "fs";
|
|
4842
4845
|
async function runTypeCheck(projectPath, strict = true) {
|
|
@@ -4853,7 +4856,7 @@ async function runTypeCheck(projectPath, strict = true) {
|
|
|
4853
4856
|
if (strict) {
|
|
4854
4857
|
args.push("--strict");
|
|
4855
4858
|
}
|
|
4856
|
-
const { stdout, stderr } = await
|
|
4859
|
+
const { stdout, stderr } = await (0, import_execa9.execa)("tsc", args, {
|
|
4857
4860
|
cwd: projectPath,
|
|
4858
4861
|
reject: false
|
|
4859
4862
|
});
|
|
@@ -3,14 +3,17 @@ import { createRequire } from 'module';
|
|
|
3
3
|
const require = createRequire(import.meta.url);
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
+
require_execa,
|
|
6
7
|
runBunCommand
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import
|
|
8
|
+
} from "./chunk-GRPGGUED.js";
|
|
9
|
+
import {
|
|
10
|
+
__toESM
|
|
11
|
+
} from "./chunk-XB5JBFO6.js";
|
|
9
12
|
|
|
10
13
|
// src/utils/plugin-creator.ts
|
|
14
|
+
var import_execa = __toESM(require_execa(), 1);
|
|
11
15
|
import Anthropic from "@anthropic-ai/sdk";
|
|
12
16
|
import { logger } from "@elizaos/core";
|
|
13
|
-
import { execa } from "execa";
|
|
14
17
|
import * as fs from "fs-extra";
|
|
15
18
|
import * as clack from "@clack/prompts";
|
|
16
19
|
import ora from "ora";
|
|
@@ -90,7 +93,7 @@ var PluginCreator = class {
|
|
|
90
93
|
spinner.info("Checking disk space...");
|
|
91
94
|
await this.checkDiskSpace();
|
|
92
95
|
try {
|
|
93
|
-
await execa("claude", ["--version"], { stdio: "pipe" });
|
|
96
|
+
await (0, import_execa.execa)("claude", ["--version"], { stdio: "pipe" });
|
|
94
97
|
} catch {
|
|
95
98
|
throw new Error(
|
|
96
99
|
"Claude Code is required for plugin generation. Install with: bun install -g @anthropic-ai/claude-code"
|
|
@@ -214,7 +217,7 @@ var PluginCreator = class {
|
|
|
214
217
|
await fs.ensureDir(tempDir);
|
|
215
218
|
this.pluginPath = path.join(tempDir, `plugin-${pluginName}`);
|
|
216
219
|
try {
|
|
217
|
-
await execa(
|
|
220
|
+
await (0, import_execa.execa)(
|
|
218
221
|
"bunx",
|
|
219
222
|
["@elizaos/cli", "create", `plugin-${pluginName}`, "-t", "plugin-starter"],
|
|
220
223
|
{
|
|
@@ -684,7 +687,7 @@ Make all necessary changes to fix the issues and ensure the plugin builds and al
|
|
|
684
687
|
prompt
|
|
685
688
|
];
|
|
686
689
|
logger.info(`\u{1F680} Executing: claude ${claudeArgs.join(" ")}`);
|
|
687
|
-
this.activeClaudeProcess = execa("claude", claudeArgs, {
|
|
690
|
+
this.activeClaudeProcess = (0, import_execa.execa)("claude", claudeArgs, {
|
|
688
691
|
stdio: "inherit",
|
|
689
692
|
cwd: this.pluginPath
|
|
690
693
|
});
|
|
@@ -887,7 +890,7 @@ ${fileContent}
|
|
|
887
890
|
}
|
|
888
891
|
async getAvailableDiskSpace() {
|
|
889
892
|
try {
|
|
890
|
-
const result = await execa("df", ["-k", os.tmpdir()]);
|
|
893
|
+
const result = await (0, import_execa.execa)("df", ["-k", os.tmpdir()]);
|
|
891
894
|
const lines = result.stdout.split("\n");
|
|
892
895
|
const dataLine = lines[1];
|
|
893
896
|
const parts = dataLine.split(/\s+/);
|
|
@@ -28,10 +28,10 @@ import {
|
|
|
28
28
|
setEnvVar,
|
|
29
29
|
setGitHubToken,
|
|
30
30
|
validateDataDir
|
|
31
|
-
} from "./chunk-
|
|
32
|
-
import "./chunk-
|
|
31
|
+
} from "./chunk-YKFBLIQD.js";
|
|
32
|
+
import "./chunk-GRPGGUED.js";
|
|
33
33
|
import "./chunk-F24MS2YR.js";
|
|
34
|
-
import "./chunk-
|
|
34
|
+
import "./chunk-XB5JBFO6.js";
|
|
35
35
|
export {
|
|
36
36
|
checkDataDir,
|
|
37
37
|
ensureElizaDir,
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
setupAIModelConfig,
|
|
8
8
|
setupEmbeddingModelConfig,
|
|
9
9
|
setupProjectEnvironment
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-PMV25BM7.js";
|
|
11
|
+
import "./chunk-YKFBLIQD.js";
|
|
12
|
+
import "./chunk-GRPGGUED.js";
|
|
13
13
|
import "./chunk-F24MS2YR.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-XB5JBFO6.js";
|
|
15
15
|
export {
|
|
16
16
|
createProjectDirectories,
|
|
17
17
|
setupAIModelConfig,
|
|
@@ -216,10 +216,20 @@ var helloWorldAction = {
|
|
|
216
216
|
if (callback) {
|
|
217
217
|
await callback(responseContent);
|
|
218
218
|
}
|
|
219
|
-
return
|
|
219
|
+
return {
|
|
220
|
+
text: "hello world!",
|
|
221
|
+
success: true,
|
|
222
|
+
data: {
|
|
223
|
+
actions: ["HELLO_WORLD"],
|
|
224
|
+
source: message.content.source
|
|
225
|
+
}
|
|
226
|
+
};
|
|
220
227
|
} catch (error) {
|
|
221
228
|
logger.error("Error in HELLO_WORLD action:", error);
|
|
222
|
-
|
|
229
|
+
return {
|
|
230
|
+
success: false,
|
|
231
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
232
|
+
};
|
|
223
233
|
}
|
|
224
234
|
},
|
|
225
235
|
examples: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugin.ts","../src/__tests__/e2e/starter-plugin.ts","../src/index.ts"],"sourcesContent":["import type { Plugin } from '@elizaos/core';\nimport {\n type Action,\n type Content,\n type GenerateTextParams,\n type HandlerCallback,\n type IAgentRuntime,\n type Memory,\n ModelType,\n type Provider,\n type ProviderResult,\n Service,\n type State,\n logger,\n} from '@elizaos/core';\nimport { z } from 'zod';\nimport { StarterPluginTestSuite } from './tests';\n\n/**\n * Defines the configuration schema for a plugin, including the validation rules for the plugin name.\n *\n * @type {import('zod').ZodObject<{ EXAMPLE_PLUGIN_VARIABLE: import('zod').ZodString }>}\n */\nconst configSchema = z.object({\n EXAMPLE_PLUGIN_VARIABLE: z\n .string()\n .min(1, 'Example plugin variable is not provided')\n .optional()\n .transform((val) => {\n if (!val) {\n logger.warn('Example plugin variable is not provided (this is expected)');\n }\n return val;\n }),\n});\n\n/**\n * Example HelloWorld action\n * This demonstrates the simplest possible action structure\n */\n/**\n * Action representing a hello world message.\n * @typedef {Object} Action\n * @property {string} name - The name of the action.\n * @property {string[]} similes - An array of related actions.\n * @property {string} description - A brief description of the action.\n * @property {Function} validate - Asynchronous function to validate the action.\n * @property {Function} handler - Asynchronous function to handle the action and generate a response.\n * @property {Object[]} examples - An array of example inputs and expected outputs for the action.\n */\nconst helloWorldAction: Action = {\n name: 'HELLO_WORLD',\n similes: ['GREET', 'SAY_HELLO'],\n description: 'Responds with a simple hello world message',\n\n validate: async (\n _runtime: IAgentRuntime,\n _message: Memory,\n _state: State | undefined\n ): Promise<boolean> => {\n // Always valid\n return true;\n },\n\n handler: async (\n _runtime: IAgentRuntime,\n message: Memory,\n _state: State | undefined,\n _options: any,\n callback?: HandlerCallback,\n _responses?: Memory[]\n ) => {\n try {\n logger.info('Handling HELLO_WORLD action');\n\n // Simple response content\n const responseContent: Content = {\n text: 'hello world!',\n actions: ['HELLO_WORLD'],\n source: message.content.source,\n };\n\n // Call back with the hello world message if callback is provided\n if (callback) {\n await callback(responseContent);\n }\n\n return responseContent;\n } catch (error) {\n logger.error('Error in HELLO_WORLD action:', error);\n throw error;\n }\n },\n\n examples: [\n [\n {\n name: '{{name1}}',\n content: {\n text: 'Can you say hello?',\n },\n },\n {\n name: '{{name2}}',\n content: {\n text: 'hello world!',\n actions: ['HELLO_WORLD'],\n },\n },\n ],\n ],\n};\n\n/**\n * Example Hello World Provider\n * This demonstrates the simplest possible provider implementation\n */\nconst helloWorldProvider: Provider = {\n name: 'HELLO_WORLD_PROVIDER',\n description: 'A simple example provider',\n\n get: async (\n _runtime: IAgentRuntime,\n _message: Memory,\n _state: State | undefined\n ): Promise<ProviderResult> => {\n return {\n text: 'I am a provider',\n values: {},\n data: {},\n };\n },\n};\n\nexport class StarterService extends Service {\n static serviceType = 'starter';\n capabilityDescription =\n 'This is a starter service which is attached to the agent through the starter plugin.';\n constructor(protected runtime: IAgentRuntime) {\n super(runtime);\n }\n\n static async start(runtime: IAgentRuntime) {\n logger.info(`*** Starting starter service - MODIFIED: ${new Date().toISOString()} ***`);\n const service = new StarterService(runtime);\n return service;\n }\n\n static async stop(runtime: IAgentRuntime) {\n logger.info('*** TESTING DEV MODE - STOP MESSAGE CHANGED! ***');\n // get the service from the runtime\n const service = runtime.getService(StarterService.serviceType);\n if (!service) {\n throw new Error('Starter service not found');\n }\n service.stop();\n }\n\n async stop() {\n logger.info('*** THIRD CHANGE - TESTING FILE WATCHING! ***');\n }\n}\n\nexport const starterPlugin: Plugin = {\n name: 'plugin-starter',\n description: 'Plugin starter for elizaOS',\n config: {\n EXAMPLE_PLUGIN_VARIABLE: process.env.EXAMPLE_PLUGIN_VARIABLE,\n },\n async init(config: Record<string, string>) {\n logger.info('*** TESTING DEV MODE - PLUGIN MODIFIED AND RELOADED! ***');\n try {\n const validatedConfig = await configSchema.parseAsync(config);\n\n // Set all environment variables at once\n for (const [key, value] of Object.entries(validatedConfig)) {\n if (value) process.env[key] = value;\n }\n } catch (error) {\n if (error instanceof z.ZodError) {\n throw new Error(\n `Invalid plugin configuration: ${error.errors.map((e) => e.message).join(', ')}`\n );\n }\n throw error;\n }\n },\n models: {\n [ModelType.TEXT_SMALL]: async (\n _runtime,\n { prompt, stopSequences = [] }: GenerateTextParams\n ) => {\n return 'Never gonna give you up, never gonna let you down, never gonna run around and desert you...';\n },\n [ModelType.TEXT_LARGE]: async (\n _runtime,\n {\n prompt,\n stopSequences = [],\n maxTokens = 8192,\n temperature = 0.7,\n frequencyPenalty = 0.7,\n presencePenalty = 0.7,\n }: GenerateTextParams\n ) => {\n return 'Never gonna make you cry, never gonna say goodbye, never gonna tell a lie and hurt you...';\n },\n },\n routes: [\n {\n name: 'hello-world-route',\n path: '/helloworld',\n type: 'GET',\n handler: async (_req: any, res: any) => {\n // send a response\n res.json({\n message: 'Hello World!',\n });\n },\n },\n {\n name: 'current-time-route',\n path: '/api/time',\n type: 'GET',\n handler: async (_req: any, res: any) => {\n // Return current time in various formats\n const now = new Date();\n res.json({\n timestamp: now.toISOString(),\n unix: Math.floor(now.getTime() / 1000),\n formatted: now.toLocaleString(),\n timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,\n });\n },\n },\n ],\n events: {\n MESSAGE_RECEIVED: [\n async (params) => {\n logger.debug('MESSAGE_RECEIVED event received');\n // print the keys\n logger.debug(Object.keys(params));\n },\n ],\n VOICE_MESSAGE_RECEIVED: [\n async (params) => {\n logger.debug('VOICE_MESSAGE_RECEIVED event received');\n // print the keys\n logger.debug(Object.keys(params));\n },\n ],\n WORLD_CONNECTED: [\n async (params) => {\n logger.debug('WORLD_CONNECTED event received');\n // print the keys\n logger.debug(Object.keys(params));\n },\n ],\n WORLD_JOINED: [\n async (params) => {\n logger.debug('WORLD_JOINED event received');\n // print the keys\n logger.debug(Object.keys(params));\n },\n ],\n },\n services: [StarterService],\n actions: [helloWorldAction],\n providers: [helloWorldProvider],\n tests: [StarterPluginTestSuite],\n // dependencies: ['@elizaos/plugin-knowledge'], <--- plugin dependecies go here (if requires another plugin)\n};\n\nexport default starterPlugin;\n","import { type Content, type HandlerCallback } from '@elizaos/core';\n\n/**\n * E2E (End-to-End) Test Suite for ElizaOS Plugins\n * ================================================\n *\n * This file contains end-to-end tests that run within a real ElizaOS runtime environment.\n * Unlike unit tests that test individual components in isolation, e2e tests validate\n * the entire plugin behavior in a production-like environment.\n *\n * NOTE: The tests are properly structured and included in the plugin build.\n * If the test runner is not detecting these tests, it may be looking at the wrong\n * plugin name or there may be a test runner configuration issue. The tests are\n * exported correctly through src/tests.ts and included in the plugin's tests array.\n *\n * HOW E2E TESTS WORK:\n * -------------------\n * 1. Tests are executed by the ElizaOS test runner using `elizaos test e2e`\n * 2. Each test receives a real runtime instance with the plugin loaded\n * 3. Tests can interact with the runtime just like in production\n * 4. Tests throw errors to indicate failure (no assertion library needed)\n *\n * WRITING NEW E2E TESTS:\n * ----------------------\n * 1. Add a new test object to the `tests` array below\n * 2. Each test must have:\n * - `name`: A unique identifier for the test\n * - `fn`: An async function that receives the runtime and performs the test\n *\n * Example structure:\n * ```typescript\n * {\n * name: 'my_new_test',\n * fn: async (runtime) => {\n * // Your test logic here\n * if (someCondition !== expected) {\n * throw new Error('Test failed: reason');\n * }\n * }\n * }\n * ```\n *\n * BEST PRACTICES:\n * ---------------\n * - Test real user scenarios, not implementation details\n * - Use descriptive test names that explain what's being tested\n * - Include clear error messages that help diagnose failures\n * - Test both success and failure paths\n * - Clean up any resources created during tests\n *\n * AVAILABLE RUNTIME METHODS:\n * --------------------------\n * - runtime.getService(type): Get a service instance\n * - runtime.character: Access character configuration\n * - runtime.models: Access AI models\n * - runtime.db: Access database methods\n * - runtime.actions: Access registered actions\n * - runtime.providers: Access registered providers\n *\n * For more details, see the ElizaOS documentation.\n */\n\n// Define a minimal TestSuite interface that matches what's needed\ninterface TestSuite {\n name: string;\n description?: string;\n tests: Array<{\n name: string;\n fn: (runtime: any) => Promise<any>;\n }>;\n}\n\n// Define minimal interfaces for the types we need\ntype UUID = `${string}-${string}-${string}-${string}-${string}`;\n\ninterface Memory {\n entityId: UUID;\n roomId: UUID;\n content: {\n text: string;\n source: string;\n actions?: string[];\n };\n}\n\ninterface State {\n values: Record<string, any>;\n data: Record<string, any>;\n text: string;\n}\n\nexport const StarterPluginTestSuite: TestSuite = {\n name: 'plugin_starter_test_suite',\n description: 'E2E tests for the starter plugin',\n\n tests: [\n /**\n * Basic Plugin Verification Test\n * ------------------------------\n * This test verifies that the plugin is properly loaded and initialized\n * within the runtime environment.\n */\n {\n name: 'example_test',\n fn: async (runtime) => {\n // Test the character name\n if (runtime.character.name !== 'Eliza') {\n throw new Error(\n `Expected character name to be \"Eliza\" but got \"${runtime.character.name}\"`\n );\n }\n // Verify the plugin is loaded properly\n const service = runtime.getService('starter');\n if (!service) {\n throw new Error('Starter service not found');\n }\n },\n },\n\n /**\n * Action Registration Test\n * ------------------------\n * Verifies that custom actions are properly registered with the runtime.\n * This is important to ensure actions are available for the agent to use.\n */\n {\n name: 'should_have_hello_world_action',\n fn: async (runtime) => {\n // Access actions through runtime.actions instead of getPlugin\n const actionExists = runtime.actions?.some((a) => a.name === 'HELLO_WORLD');\n if (!actionExists) {\n throw new Error('Hello world action not found in runtime actions');\n }\n },\n },\n\n /**\n * Hello World Action Response Test\n * ---------------------------------\n * This test demonstrates a complete scenario where:\n * 1. The agent is asked to say \"hello\"\n * 2. The HELLO_WORLD action is triggered\n * 3. The agent responds with text containing \"hello world\"\n *\n * This is a key pattern for testing agent behaviors - you simulate\n * a user message and verify the agent's response.\n */\n {\n name: 'hello_world_action_test',\n fn: async (runtime) => {\n // Create a test message asking the agent to say hello\n const testMessage: Memory = {\n entityId: '12345678-1234-1234-1234-123456789012' as UUID,\n roomId: '12345678-1234-1234-1234-123456789012' as UUID,\n content: {\n text: 'Can you say hello?',\n source: 'test',\n actions: ['HELLO_WORLD'], // Specify which action we expect to trigger\n },\n };\n\n // Create a test state (can include context if needed)\n const testState: State = {\n values: {},\n data: {},\n text: '',\n };\n\n let responseText = '';\n let responseReceived = false;\n\n // Find the hello world action in runtime.actions\n const helloWorldAction = runtime.actions?.find((a) => a.name === 'HELLO_WORLD');\n if (!helloWorldAction) {\n throw new Error('Hello world action not found in runtime actions');\n }\n\n // Create a callback that captures the agent's response\n // This simulates how the runtime would handle the action's response\n const callback: HandlerCallback = async (response: Content) => {\n responseReceived = true;\n responseText = response.text || '';\n\n // Verify the response includes the expected action\n if (!response.actions?.includes('HELLO_WORLD')) {\n throw new Error('Response did not include HELLO_WORLD action');\n }\n\n // Return Promise<Memory[]> as required by the HandlerCallback interface\n return Promise.resolve([]);\n };\n\n // Execute the action - this simulates the runtime calling the action\n await helloWorldAction.handler(runtime, testMessage, testState, {}, callback);\n\n // Verify we received a response\n if (!responseReceived) {\n throw new Error('Hello world action did not produce a response');\n }\n\n // Verify the response contains \"hello world\" (case-insensitive)\n if (!responseText.toLowerCase().includes('hello world')) {\n throw new Error(`Expected response to contain \"hello world\" but got: \"${responseText}\"`);\n }\n\n // Success! The agent responded with \"hello world\" as expected\n },\n },\n\n /**\n * Provider Functionality Test\n * ---------------------------\n * Tests that providers can supply data to the agent when needed.\n * Providers are used to fetch external data or compute values.\n */\n {\n name: 'hello_world_provider_test',\n fn: async (runtime) => {\n // Create a test message\n const testMessage: Memory = {\n entityId: '12345678-1234-1234-1234-123456789012' as UUID,\n roomId: '12345678-1234-1234-1234-123456789012' as UUID,\n content: {\n text: 'What can you provide?',\n source: 'test',\n },\n };\n\n // Create a test state\n const testState: State = {\n values: {},\n data: {},\n text: '',\n };\n\n // Find the hello world provider in runtime.providers\n const helloWorldProvider = runtime.providers?.find(\n (p) => p.name === 'HELLO_WORLD_PROVIDER'\n );\n if (!helloWorldProvider) {\n throw new Error('Hello world provider not found in runtime providers');\n }\n\n // Test the provider\n const result = await helloWorldProvider.get(runtime, testMessage, testState);\n\n if (result.text !== 'I am a provider') {\n throw new Error(`Expected provider to return \"I am a provider\", got \"${result.text}\"`);\n }\n },\n },\n\n /**\n * Service Lifecycle Test\n * ----------------------\n * Verifies that services can be started, accessed, and stopped properly.\n * Services run background tasks or manage long-lived resources.\n */\n {\n name: 'starter_service_test',\n fn: async (runtime) => {\n // Get the service from the runtime\n const service = runtime.getService('starter');\n if (!service) {\n throw new Error('Starter service not found');\n }\n\n // Check service capability description\n if (\n service.capabilityDescription !==\n 'This is a starter service which is attached to the agent through the starter plugin.'\n ) {\n throw new Error('Incorrect service capability description');\n }\n\n // Test service stop method\n await service.stop();\n },\n },\n\n /**\n * ADD YOUR CUSTOM TESTS HERE\n * --------------------------\n * To add a new test:\n *\n * 1. Copy this template:\n * ```typescript\n * {\n * name: 'your_test_name',\n * fn: async (runtime) => {\n * // Setup: Create any test data needed\n *\n * // Action: Perform the operation you want to test\n *\n * // Assert: Check the results\n * if (result !== expected) {\n * throw new Error(`Expected ${expected} but got ${result}`);\n * }\n * }\n * }\n * ```\n *\n * 2. Common test patterns:\n * - Test action responses to specific prompts\n * - Verify provider data under different conditions\n * - Check service behavior during lifecycle events\n * - Validate plugin configuration handling\n * - Test error cases and edge conditions\n *\n * 3. Tips:\n * - Use meaningful variable names\n * - Include helpful error messages\n * - Test one thing per test\n * - Consider both success and failure scenarios\n */\n ],\n};\n\n// Export a default instance of the test suite for the E2E test runner\nexport default StarterPluginTestSuite;\n","import { starterPlugin } from './plugin.ts';\n\nexport { starterPlugin, StarterService } from './plugin.ts';\nexport default starterPlugin;\n"],"mappings":";AACA;AAA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EAAE,gBAAgB,EAAE;AAAA,QACpD,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAAA,EACA,QAAQ;AAAA,IACN,kBAAkB;AAAA,MAChB,OAAO,WAAW;AAChB,eAAO,MAAM,iCAAiC;AAE9C,eAAO,MAAM,OAAO,KAAK,MAAM,CAAC;AAAA,MAClC;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB,OAAO,WAAW;AAChB,eAAO,MAAM,uCAAuC;AAEpD,eAAO,MAAM,OAAO,KAAK,MAAM,CAAC;AAAA,MAClC;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,OAAO,WAAW;AAChB,eAAO,MAAM,gCAAgC;AAE7C,eAAO,MAAM,OAAO,KAAK,MAAM,CAAC;AAAA,MAClC;AAAA,IACF;AAAA,IACA,cAAc;AAAA,MACZ,OAAO,WAAW;AAChB,eAAO,MAAM,6BAA6B;AAE1C,eAAO,MAAM,OAAO,KAAK,MAAM,CAAC;AAAA,MAClC;AAAA,IACF;AAAA,EACF;AAAA,EACA,UAAU,CAAC,cAAc;AAAA,EACzB,SAAS,CAAC,gBAAgB;AAAA,EAC1B,WAAW,CAAC,kBAAkB;AAAA,EAC9B,OAAO,CAAC,sBAAsB;AAAA;AAEhC;;;AE5QA,IAAO,gBAAQ;","names":["helloWorldAction","helloWorldProvider"]}
|
|
1
|
+
{"version":3,"sources":["../src/plugin.ts","../src/__tests__/e2e/starter-plugin.ts","../src/index.ts"],"sourcesContent":["import type { Plugin } from '@elizaos/core';\nimport {\n type Action,\n type ActionResult,\n type Content,\n type GenerateTextParams,\n type HandlerCallback,\n type IAgentRuntime,\n type Memory,\n ModelType,\n type Provider,\n type ProviderResult,\n Service,\n type State,\n logger,\n} from '@elizaos/core';\nimport { z } from 'zod';\nimport { StarterPluginTestSuite } from './tests';\n\n/**\n * Defines the configuration schema for a plugin, including the validation rules for the plugin name.\n *\n * @type {import('zod').ZodObject<{ EXAMPLE_PLUGIN_VARIABLE: import('zod').ZodString }>}\n */\nconst configSchema = z.object({\n EXAMPLE_PLUGIN_VARIABLE: z\n .string()\n .min(1, 'Example plugin variable is not provided')\n .optional()\n .transform((val) => {\n if (!val) {\n logger.warn('Example plugin variable is not provided (this is expected)');\n }\n return val;\n }),\n});\n\n/**\n * Example HelloWorld action\n * This demonstrates the simplest possible action structure\n */\n/**\n * Action representing a hello world message.\n * @typedef {Object} Action\n * @property {string} name - The name of the action.\n * @property {string[]} similes - An array of related actions.\n * @property {string} description - A brief description of the action.\n * @property {Function} validate - Asynchronous function to validate the action.\n * @property {Function} handler - Asynchronous function to handle the action and generate a response.\n * @property {Object[]} examples - An array of example inputs and expected outputs for the action.\n */\nconst helloWorldAction: Action = {\n name: 'HELLO_WORLD',\n similes: ['GREET', 'SAY_HELLO'],\n description: 'Responds with a simple hello world message',\n\n validate: async (\n _runtime: IAgentRuntime,\n _message: Memory,\n _state: State | undefined\n ): Promise<boolean> => {\n // Always valid\n return true;\n },\n\n handler: async (\n _runtime: IAgentRuntime,\n message: Memory,\n _state: State | undefined,\n _options: any,\n callback?: HandlerCallback,\n _responses?: Memory[]\n ): Promise<ActionResult> => {\n try {\n logger.info('Handling HELLO_WORLD action');\n\n // Simple response content for callback\n const responseContent: Content = {\n text: 'hello world!',\n actions: ['HELLO_WORLD'],\n source: message.content.source,\n };\n\n // Call back with the hello world message if callback is provided\n if (callback) {\n await callback(responseContent);\n }\n\n // Return ActionResult\n return {\n text: 'hello world!',\n success: true,\n data: {\n actions: ['HELLO_WORLD'],\n source: message.content.source,\n },\n };\n } catch (error) {\n logger.error('Error in HELLO_WORLD action:', error);\n return {\n success: false,\n error: error instanceof Error ? error : new Error(String(error)),\n };\n }\n },\n\n examples: [\n [\n {\n name: '{{name1}}',\n content: {\n text: 'Can you say hello?',\n },\n },\n {\n name: '{{name2}}',\n content: {\n text: 'hello world!',\n actions: ['HELLO_WORLD'],\n },\n },\n ],\n ],\n};\n\n/**\n * Example Hello World Provider\n * This demonstrates the simplest possible provider implementation\n */\nconst helloWorldProvider: Provider = {\n name: 'HELLO_WORLD_PROVIDER',\n description: 'A simple example provider',\n\n get: async (\n _runtime: IAgentRuntime,\n _message: Memory,\n _state: State | undefined\n ): Promise<ProviderResult> => {\n return {\n text: 'I am a provider',\n values: {},\n data: {},\n };\n },\n};\n\nexport class StarterService extends Service {\n static serviceType = 'starter';\n capabilityDescription =\n 'This is a starter service which is attached to the agent through the starter plugin.';\n constructor(protected runtime: IAgentRuntime) {\n super(runtime);\n }\n\n static async start(runtime: IAgentRuntime) {\n logger.info(`*** Starting starter service - MODIFIED: ${new Date().toISOString()} ***`);\n const service = new StarterService(runtime);\n return service;\n }\n\n static async stop(runtime: IAgentRuntime) {\n logger.info('*** TESTING DEV MODE - STOP MESSAGE CHANGED! ***');\n // get the service from the runtime\n const service = runtime.getService(StarterService.serviceType);\n if (!service) {\n throw new Error('Starter service not found');\n }\n service.stop();\n }\n\n async stop() {\n logger.info('*** THIRD CHANGE - TESTING FILE WATCHING! ***');\n }\n}\n\nexport const starterPlugin: Plugin = {\n name: 'plugin-starter',\n description: 'Plugin starter for elizaOS',\n config: {\n EXAMPLE_PLUGIN_VARIABLE: process.env.EXAMPLE_PLUGIN_VARIABLE,\n },\n async init(config: Record<string, string>) {\n logger.info('*** TESTING DEV MODE - PLUGIN MODIFIED AND RELOADED! ***');\n try {\n const validatedConfig = await configSchema.parseAsync(config);\n\n // Set all environment variables at once\n for (const [key, value] of Object.entries(validatedConfig)) {\n if (value) process.env[key] = value;\n }\n } catch (error) {\n if (error instanceof z.ZodError) {\n throw new Error(\n `Invalid plugin configuration: ${error.errors.map((e) => e.message).join(', ')}`\n );\n }\n throw error;\n }\n },\n models: {\n [ModelType.TEXT_SMALL]: async (\n _runtime,\n { prompt, stopSequences = [] }: GenerateTextParams\n ) => {\n return 'Never gonna give you up, never gonna let you down, never gonna run around and desert you...';\n },\n [ModelType.TEXT_LARGE]: async (\n _runtime,\n {\n prompt,\n stopSequences = [],\n maxTokens = 8192,\n temperature = 0.7,\n frequencyPenalty = 0.7,\n presencePenalty = 0.7,\n }: GenerateTextParams\n ) => {\n return 'Never gonna make you cry, never gonna say goodbye, never gonna tell a lie and hurt you...';\n },\n },\n routes: [\n {\n name: 'hello-world-route',\n path: '/helloworld',\n type: 'GET',\n handler: async (_req: any, res: any) => {\n // send a response\n res.json({\n message: 'Hello World!',\n });\n },\n },\n {\n name: 'current-time-route',\n path: '/api/time',\n type: 'GET',\n handler: async (_req: any, res: any) => {\n // Return current time in various formats\n const now = new Date();\n res.json({\n timestamp: now.toISOString(),\n unix: Math.floor(now.getTime() / 1000),\n formatted: now.toLocaleString(),\n timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,\n });\n },\n },\n ],\n events: {\n MESSAGE_RECEIVED: [\n async (params) => {\n logger.debug('MESSAGE_RECEIVED event received');\n // print the keys\n logger.debug(Object.keys(params));\n },\n ],\n VOICE_MESSAGE_RECEIVED: [\n async (params) => {\n logger.debug('VOICE_MESSAGE_RECEIVED event received');\n // print the keys\n logger.debug(Object.keys(params));\n },\n ],\n WORLD_CONNECTED: [\n async (params) => {\n logger.debug('WORLD_CONNECTED event received');\n // print the keys\n logger.debug(Object.keys(params));\n },\n ],\n WORLD_JOINED: [\n async (params) => {\n logger.debug('WORLD_JOINED event received');\n // print the keys\n logger.debug(Object.keys(params));\n },\n ],\n },\n services: [StarterService],\n actions: [helloWorldAction],\n providers: [helloWorldProvider],\n tests: [StarterPluginTestSuite],\n // dependencies: ['@elizaos/plugin-knowledge'], <--- plugin dependecies go here (if requires another plugin)\n};\n\nexport default starterPlugin;\n","import { type Content, type HandlerCallback } from '@elizaos/core';\n\n/**\n * E2E (End-to-End) Test Suite for ElizaOS Plugins\n * ================================================\n *\n * This file contains end-to-end tests that run within a real ElizaOS runtime environment.\n * Unlike unit tests that test individual components in isolation, e2e tests validate\n * the entire plugin behavior in a production-like environment.\n *\n * NOTE: The tests are properly structured and included in the plugin build.\n * If the test runner is not detecting these tests, it may be looking at the wrong\n * plugin name or there may be a test runner configuration issue. The tests are\n * exported correctly through src/tests.ts and included in the plugin's tests array.\n *\n * HOW E2E TESTS WORK:\n * -------------------\n * 1. Tests are executed by the ElizaOS test runner using `elizaos test e2e`\n * 2. Each test receives a real runtime instance with the plugin loaded\n * 3. Tests can interact with the runtime just like in production\n * 4. Tests throw errors to indicate failure (no assertion library needed)\n *\n * WRITING NEW E2E TESTS:\n * ----------------------\n * 1. Add a new test object to the `tests` array below\n * 2. Each test must have:\n * - `name`: A unique identifier for the test\n * - `fn`: An async function that receives the runtime and performs the test\n *\n * Example structure:\n * ```typescript\n * {\n * name: 'my_new_test',\n * fn: async (runtime) => {\n * // Your test logic here\n * if (someCondition !== expected) {\n * throw new Error('Test failed: reason');\n * }\n * }\n * }\n * ```\n *\n * BEST PRACTICES:\n * ---------------\n * - Test real user scenarios, not implementation details\n * - Use descriptive test names that explain what's being tested\n * - Include clear error messages that help diagnose failures\n * - Test both success and failure paths\n * - Clean up any resources created during tests\n *\n * AVAILABLE RUNTIME METHODS:\n * --------------------------\n * - runtime.getService(type): Get a service instance\n * - runtime.character: Access character configuration\n * - runtime.models: Access AI models\n * - runtime.db: Access database methods\n * - runtime.actions: Access registered actions\n * - runtime.providers: Access registered providers\n *\n * For more details, see the ElizaOS documentation.\n */\n\n// Define a minimal TestSuite interface that matches what's needed\ninterface TestSuite {\n name: string;\n description?: string;\n tests: Array<{\n name: string;\n fn: (runtime: any) => Promise<any>;\n }>;\n}\n\n// Define minimal interfaces for the types we need\ntype UUID = `${string}-${string}-${string}-${string}-${string}`;\n\ninterface Memory {\n entityId: UUID;\n roomId: UUID;\n content: {\n text: string;\n source: string;\n actions?: string[];\n };\n}\n\ninterface State {\n values: Record<string, any>;\n data: Record<string, any>;\n text: string;\n}\n\nexport const StarterPluginTestSuite: TestSuite = {\n name: 'plugin_starter_test_suite',\n description: 'E2E tests for the starter plugin',\n\n tests: [\n /**\n * Basic Plugin Verification Test\n * ------------------------------\n * This test verifies that the plugin is properly loaded and initialized\n * within the runtime environment.\n */\n {\n name: 'example_test',\n fn: async (runtime) => {\n // Test the character name\n if (runtime.character.name !== 'Eliza') {\n throw new Error(\n `Expected character name to be \"Eliza\" but got \"${runtime.character.name}\"`\n );\n }\n // Verify the plugin is loaded properly\n const service = runtime.getService('starter');\n if (!service) {\n throw new Error('Starter service not found');\n }\n },\n },\n\n /**\n * Action Registration Test\n * ------------------------\n * Verifies that custom actions are properly registered with the runtime.\n * This is important to ensure actions are available for the agent to use.\n */\n {\n name: 'should_have_hello_world_action',\n fn: async (runtime) => {\n // Access actions through runtime.actions instead of getPlugin\n const actionExists = runtime.actions?.some((a) => a.name === 'HELLO_WORLD');\n if (!actionExists) {\n throw new Error('Hello world action not found in runtime actions');\n }\n },\n },\n\n /**\n * Hello World Action Response Test\n * ---------------------------------\n * This test demonstrates a complete scenario where:\n * 1. The agent is asked to say \"hello\"\n * 2. The HELLO_WORLD action is triggered\n * 3. The agent responds with text containing \"hello world\"\n *\n * This is a key pattern for testing agent behaviors - you simulate\n * a user message and verify the agent's response.\n */\n {\n name: 'hello_world_action_test',\n fn: async (runtime) => {\n // Create a test message asking the agent to say hello\n const testMessage: Memory = {\n entityId: '12345678-1234-1234-1234-123456789012' as UUID,\n roomId: '12345678-1234-1234-1234-123456789012' as UUID,\n content: {\n text: 'Can you say hello?',\n source: 'test',\n actions: ['HELLO_WORLD'], // Specify which action we expect to trigger\n },\n };\n\n // Create a test state (can include context if needed)\n const testState: State = {\n values: {},\n data: {},\n text: '',\n };\n\n let responseText = '';\n let responseReceived = false;\n\n // Find the hello world action in runtime.actions\n const helloWorldAction = runtime.actions?.find((a) => a.name === 'HELLO_WORLD');\n if (!helloWorldAction) {\n throw new Error('Hello world action not found in runtime actions');\n }\n\n // Create a callback that captures the agent's response\n // This simulates how the runtime would handle the action's response\n const callback: HandlerCallback = async (response: Content) => {\n responseReceived = true;\n responseText = response.text || '';\n\n // Verify the response includes the expected action\n if (!response.actions?.includes('HELLO_WORLD')) {\n throw new Error('Response did not include HELLO_WORLD action');\n }\n\n // Return Promise<Memory[]> as required by the HandlerCallback interface\n return Promise.resolve([]);\n };\n\n // Execute the action - this simulates the runtime calling the action\n await helloWorldAction.handler(runtime, testMessage, testState, {}, callback);\n\n // Verify we received a response\n if (!responseReceived) {\n throw new Error('Hello world action did not produce a response');\n }\n\n // Verify the response contains \"hello world\" (case-insensitive)\n if (!responseText.toLowerCase().includes('hello world')) {\n throw new Error(`Expected response to contain \"hello world\" but got: \"${responseText}\"`);\n }\n\n // Success! The agent responded with \"hello world\" as expected\n },\n },\n\n /**\n * Provider Functionality Test\n * ---------------------------\n * Tests that providers can supply data to the agent when needed.\n * Providers are used to fetch external data or compute values.\n */\n {\n name: 'hello_world_provider_test',\n fn: async (runtime) => {\n // Create a test message\n const testMessage: Memory = {\n entityId: '12345678-1234-1234-1234-123456789012' as UUID,\n roomId: '12345678-1234-1234-1234-123456789012' as UUID,\n content: {\n text: 'What can you provide?',\n source: 'test',\n },\n };\n\n // Create a test state\n const testState: State = {\n values: {},\n data: {},\n text: '',\n };\n\n // Find the hello world provider in runtime.providers\n const helloWorldProvider = runtime.providers?.find(\n (p) => p.name === 'HELLO_WORLD_PROVIDER'\n );\n if (!helloWorldProvider) {\n throw new Error('Hello world provider not found in runtime providers');\n }\n\n // Test the provider\n const result = await helloWorldProvider.get(runtime, testMessage, testState);\n\n if (result.text !== 'I am a provider') {\n throw new Error(`Expected provider to return \"I am a provider\", got \"${result.text}\"`);\n }\n },\n },\n\n /**\n * Service Lifecycle Test\n * ----------------------\n * Verifies that services can be started, accessed, and stopped properly.\n * Services run background tasks or manage long-lived resources.\n */\n {\n name: 'starter_service_test',\n fn: async (runtime) => {\n // Get the service from the runtime\n const service = runtime.getService('starter');\n if (!service) {\n throw new Error('Starter service not found');\n }\n\n // Check service capability description\n if (\n service.capabilityDescription !==\n 'This is a starter service which is attached to the agent through the starter plugin.'\n ) {\n throw new Error('Incorrect service capability description');\n }\n\n // Test service stop method\n await service.stop();\n },\n },\n\n /**\n * ADD YOUR CUSTOM TESTS HERE\n * --------------------------\n * To add a new test:\n *\n * 1. Copy this template:\n * ```typescript\n * {\n * name: 'your_test_name',\n * fn: async (runtime) => {\n * // Setup: Create any test data needed\n *\n * // Action: Perform the operation you want to test\n *\n * // Assert: Check the results\n * if (result !== expected) {\n * throw new Error(`Expected ${expected} but got ${result}`);\n * }\n * }\n * }\n * ```\n *\n * 2. Common test patterns:\n * - Test action responses to specific prompts\n * - Verify provider data under different conditions\n * - Check service behavior during lifecycle events\n * - Validate plugin configuration handling\n * - Test error cases and edge conditions\n *\n * 3. Tips:\n * - Use meaningful variable names\n * - Include helpful error messages\n * - Test one thing per test\n * - Consider both success and failure scenarios\n */\n ],\n};\n\n// Export a default instance of the test suite for the E2E test runner\nexport default StarterPluginTestSuite;\n","import { starterPlugin } from './plugin.ts';\n\nexport { starterPlugin, StarterService } from './plugin.ts';\nexport default starterPlugin;\n"],"mappings":";AACA;AAAA,EAQE;AAAA,EAGA;AAAA,EAEA;AAAA,OACK;AACP,SAAS,SAAS;;;AC2EX,IAAM,yBAAoC;AAAA,EAC/C,MAAM;AAAA,EACN,aAAa;AAAA,EAEb,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOL;AAAA,MACE,MAAM;AAAA,MACN,IAAI,OAAO,YAAY;AAErB,YAAI,QAAQ,UAAU,SAAS,SAAS;AACtC,gBAAM,IAAI;AAAA,YACR,kDAAkD,QAAQ,UAAU,IAAI;AAAA,UAC1E;AAAA,QACF;AAEA,cAAM,UAAU,QAAQ,WAAW,SAAS;AAC5C,YAAI,CAAC,SAAS;AACZ,gBAAM,IAAI,MAAM,2BAA2B;AAAA,QAC7C;AAAA,MACF;AAAA,IACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQA;AAAA,MACE,MAAM;AAAA,MACN,IAAI,OAAO,YAAY;AAErB,cAAM,eAAe,QAAQ,SAAS,KAAK,CAAC,MAAM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AA,MACf,OAAO,WAAW;AAChB,eAAO,MAAM,gCAAgC;AAE7C,eAAO,MAAM,OAAO,KAAK,MAAM,CAAC;AAAA,MAClC;AAAA,IACF;AAAA,IACA,cAAc;AAAA,MACZ,OAAO,WAAW;AAChB,eAAO,MAAM,6BAA6B;AAE1C,eAAO,MAAM,OAAO,KAAK,MAAM,CAAC;AAAA,MAClC;AAAA,IACF;AAAA,EACF;AAAA,EACA,UAAU,CAAC,cAAc;AAAA,EACzB,SAAS,CAAC,gBAAgB;AAAA,EAC1B,WAAW,CAAC,kBAAkB;AAAA,EAC9B,OAAO,CAAC,sBAAsB;AAAA;AAEhC;;;AExRA,IAAO,gBAAQ;","names":["helloWorldAction","helloWorldProvider"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Plugin } from '@elizaos/core';
|
|
2
2
|
import {
|
|
3
3
|
type Action,
|
|
4
|
+
type ActionResult,
|
|
4
5
|
type Content,
|
|
5
6
|
type GenerateTextParams,
|
|
6
7
|
type HandlerCallback,
|
|
@@ -69,11 +70,11 @@ const helloWorldAction: Action = {
|
|
|
69
70
|
_options: any,
|
|
70
71
|
callback?: HandlerCallback,
|
|
71
72
|
_responses?: Memory[]
|
|
72
|
-
) => {
|
|
73
|
+
): Promise<ActionResult> => {
|
|
73
74
|
try {
|
|
74
75
|
logger.info('Handling HELLO_WORLD action');
|
|
75
76
|
|
|
76
|
-
// Simple response content
|
|
77
|
+
// Simple response content for callback
|
|
77
78
|
const responseContent: Content = {
|
|
78
79
|
text: 'hello world!',
|
|
79
80
|
actions: ['HELLO_WORLD'],
|
|
@@ -85,10 +86,21 @@ const helloWorldAction: Action = {
|
|
|
85
86
|
await callback(responseContent);
|
|
86
87
|
}
|
|
87
88
|
|
|
88
|
-
|
|
89
|
+
// Return ActionResult
|
|
90
|
+
return {
|
|
91
|
+
text: 'hello world!',
|
|
92
|
+
success: true,
|
|
93
|
+
data: {
|
|
94
|
+
actions: ['HELLO_WORLD'],
|
|
95
|
+
source: message.content.source,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
89
98
|
} catch (error) {
|
|
90
99
|
logger.error('Error in HELLO_WORLD action:', error);
|
|
91
|
-
|
|
100
|
+
return {
|
|
101
|
+
success: false,
|
|
102
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
103
|
+
};
|
|
92
104
|
}
|
|
93
105
|
},
|
|
94
106
|
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@elizaos/cli": "1.2.
|
|
32
|
-
"@elizaos/core": "1.2.
|
|
33
|
-
"@elizaos/plugin-bootstrap": "1.2.
|
|
34
|
-
"@elizaos/plugin-sql": "1.2.
|
|
31
|
+
"@elizaos/cli": "1.2.2",
|
|
32
|
+
"@elizaos/core": "1.2.2",
|
|
33
|
+
"@elizaos/plugin-bootstrap": "1.2.2",
|
|
34
|
+
"@elizaos/plugin-sql": "1.2.2",
|
|
35
35
|
"@tanstack/react-query": "^5.29.0",
|
|
36
36
|
"clsx": "^2.1.1",
|
|
37
37
|
"react": "^18.3.1",
|