@elizaos/cli 1.0.10 → 1.0.12
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/README.md +4 -4
- package/dist/assets/{index-DDQnwxzL.js → index-CtxA4ev_.js} +32568 -31589
- package/dist/assets/{index-DDQnwxzL.js.map → index-CtxA4ev_.js.map} +1 -1
- package/dist/assets/{index-CmuPnu0u.js → index-xhCgCbS4.js} +2 -2
- package/dist/assets/index-xhCgCbS4.js.br +0 -0
- package/dist/assets/{index-CmuPnu0u.js.map → index-xhCgCbS4.js.map} +1 -1
- package/dist/assets/vendor-DSdxb8P-.js.map +1 -1
- package/dist/chunk-AQ6OMR2A.js +14 -0
- package/dist/chunk-KB3JDWUI.js +106 -0
- package/dist/{chunk-GWQB7PBK.js → chunk-PYMK3ECE.js} +44 -18
- package/dist/chunk-Y76S7TNK.js +5372 -0
- package/dist/{chunk-B4KJXECB.js → chunk-YDVNTQX3.js} +6 -6
- package/dist/commands/agent/actions/index.js +3 -3
- package/dist/commands/agent/index.js +3 -3
- package/dist/commands/create/actions/index.js +4 -4
- package/dist/commands/create/index.js +5 -5
- package/dist/commands/shared/index.js +1 -1
- package/dist/index.html +1 -1
- package/dist/index.js +344 -7703
- package/dist/migrator-UQ4XFYE5.js +744 -0
- package/dist/{plugin-creator-T4K2673C.js → plugin-creator-TLQLTQIB.js} +8 -11
- package/dist/{registry-CBMRMYCG.js → registry-7PBDJL64.js} +3 -3
- package/dist/templates/plugin-starter/bunfig.toml +5 -1
- package/dist/templates/plugin-starter/package.json +6 -8
- package/dist/templates/plugin-starter/scripts/install-test-deps.js +50 -0
- package/dist/templates/plugin-starter/src/index.ts +1 -1
- package/dist/templates/project-starter/bunfig.toml +13 -1
- package/dist/templates/project-starter/package.json +16 -20
- package/dist/templates/project-starter/scripts/install-test-deps.js +51 -0
- package/dist/templates/project-starter/src/__tests__/config.test.ts +9 -9
- package/dist/templates/project-starter/src/__tests__/error-handling.test.ts +11 -11
- package/dist/templates/project-starter/src/__tests__/events.test.ts +6 -6
- package/dist/templates/project-starter/src/__tests__/integration.test.ts +11 -11
- package/dist/templates/project-starter/src/__tests__/routes.test.ts +2 -2
- package/dist/templates/project-tee-starter/__tests__/env.test.ts +10 -6
- package/dist/templates/project-tee-starter/bunfig.toml +13 -1
- package/dist/templates/project-tee-starter/e2e/project.test.ts +1 -1
- package/dist/templates/project-tee-starter/e2e/starter-plugin.test.ts +1 -1
- package/dist/templates/project-tee-starter/package.json +3 -3
- package/dist/{utils-TIALZU53.js → utils-WRGBZBAJ.js} +9 -3
- package/package.json +28 -56
- package/templates/plugin-starter/bunfig.toml +5 -1
- package/templates/plugin-starter/package.json +6 -8
- package/templates/plugin-starter/scripts/install-test-deps.js +50 -0
- package/templates/plugin-starter/src/index.ts +1 -1
- package/templates/project-starter/bunfig.toml +13 -1
- package/templates/project-starter/package.json +16 -20
- package/templates/project-starter/scripts/install-test-deps.js +51 -0
- package/templates/project-starter/src/__tests__/config.test.ts +9 -9
- package/templates/project-starter/src/__tests__/error-handling.test.ts +11 -11
- package/templates/project-starter/src/__tests__/events.test.ts +6 -6
- package/templates/project-starter/src/__tests__/integration.test.ts +11 -11
- package/templates/project-starter/src/__tests__/routes.test.ts +2 -2
- package/templates/project-tee-starter/__tests__/env.test.ts +10 -6
- package/templates/project-tee-starter/bunfig.toml +13 -1
- package/templates/project-tee-starter/e2e/project.test.ts +1 -1
- package/templates/project-tee-starter/e2e/starter-plugin.test.ts +1 -1
- package/templates/project-tee-starter/package.json +3 -3
- package/dist/assets/index-CmuPnu0u.js.br +0 -0
- package/dist/chunk-2GXSCVA2.js +0 -2057
- package/dist/chunk-567UPUC7.js +0 -52
- package/dist/chunk-7HYEGM5V.js +0 -11098
- package/dist/chunk-LQ6XHF53.js +0 -19487
- package/dist/chunk-WS4DWCDZ.js +0 -892
- package/dist/fileFromPath-KB6XMTJ4.js +0 -133
- package/dist/migrator-JREQPDN3.js +0 -7523
- package/dist/pglite.data +0 -0
- package/dist/pglite.wasm +0 -0
|
@@ -61,6 +61,7 @@ import {
|
|
|
61
61
|
isRunningViaNpx,
|
|
62
62
|
isUtf8Locale,
|
|
63
63
|
isValidAnthropicKey,
|
|
64
|
+
isValidGoogleKey,
|
|
64
65
|
isValidOllamaEndpoint,
|
|
65
66
|
isValidOpenAIKey,
|
|
66
67
|
isValidPostgresUrl,
|
|
@@ -71,6 +72,7 @@ import {
|
|
|
71
72
|
mergeProcessEnvWithTemplate,
|
|
72
73
|
migrateCliToBun,
|
|
73
74
|
promptAndStoreAnthropicKey,
|
|
75
|
+
promptAndStoreGoogleKey,
|
|
74
76
|
promptAndStoreOllamaConfig,
|
|
75
77
|
promptAndStoreOpenAIKey,
|
|
76
78
|
promptAndStorePostgresUrl,
|
|
@@ -94,6 +96,7 @@ import {
|
|
|
94
96
|
setupPgLite,
|
|
95
97
|
showUpdateNotification,
|
|
96
98
|
storeAnthropicKey,
|
|
99
|
+
storeGoogleKey,
|
|
97
100
|
storeOllamaConfig,
|
|
98
101
|
storeOpenAIKey,
|
|
99
102
|
storePgliteDataDir,
|
|
@@ -105,13 +108,13 @@ import {
|
|
|
105
108
|
validateGitHubToken,
|
|
106
109
|
validatePluginEnvVars,
|
|
107
110
|
writeEnvFile
|
|
108
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-Y76S7TNK.js";
|
|
109
112
|
import {
|
|
110
113
|
runBunCommand
|
|
111
114
|
} from "./chunk-RIAWNDYI.js";
|
|
112
|
-
import "./chunk-
|
|
115
|
+
import "./chunk-KB3JDWUI.js";
|
|
113
116
|
import "./chunk-F24MS2YR.js";
|
|
114
|
-
import "./chunk-
|
|
117
|
+
import "./chunk-AQ6OMR2A.js";
|
|
115
118
|
export {
|
|
116
119
|
NAV_BACK,
|
|
117
120
|
NAV_NEXT,
|
|
@@ -171,6 +174,7 @@ export {
|
|
|
171
174
|
isRunningViaNpx,
|
|
172
175
|
isUtf8Locale,
|
|
173
176
|
isValidAnthropicKey,
|
|
177
|
+
isValidGoogleKey,
|
|
174
178
|
isValidOllamaEndpoint,
|
|
175
179
|
isValidOpenAIKey,
|
|
176
180
|
isValidPostgresUrl,
|
|
@@ -181,6 +185,7 @@ export {
|
|
|
181
185
|
mergeProcessEnvWithTemplate,
|
|
182
186
|
migrateCliToBun,
|
|
183
187
|
promptAndStoreAnthropicKey,
|
|
188
|
+
promptAndStoreGoogleKey,
|
|
184
189
|
promptAndStoreOllamaConfig,
|
|
185
190
|
promptAndStoreOpenAIKey,
|
|
186
191
|
promptAndStorePostgresUrl,
|
|
@@ -205,6 +210,7 @@ export {
|
|
|
205
210
|
setupPgLite,
|
|
206
211
|
showUpdateNotification,
|
|
207
212
|
storeAnthropicKey,
|
|
213
|
+
storeGoogleKey,
|
|
208
214
|
storeOllamaConfig,
|
|
209
215
|
storeOpenAIKey,
|
|
210
216
|
storePgliteDataDir,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elizaos/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "elizaOS CLI - Manage your AI agents and plugins",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -53,76 +53,48 @@
|
|
|
53
53
|
"test:cli": "cross-env NODE_OPTIONS=\"--max-old-space-size=4096\" bun test tests/commands/ --timeout 120000"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@
|
|
57
|
-
"@
|
|
58
|
-
"@babel/parser": "^7.22.6",
|
|
59
|
-
"@esbuild-plugins/tsconfig-paths": "^0.1.2",
|
|
60
|
-
"@types/babel__core": "^7.20.1",
|
|
61
|
-
"@types/diff": "^5.0.3",
|
|
56
|
+
"@types/bun": "^1.2.17",
|
|
57
|
+
"@types/express": "^5.0.2",
|
|
62
58
|
"@types/fs-extra": "^11.0.1",
|
|
59
|
+
"@types/helmet": "^4.0.0",
|
|
63
60
|
"@types/inquirer": "^9.0.8",
|
|
64
|
-
"@types/
|
|
65
|
-
"@types/node": "^22.15.3",
|
|
61
|
+
"@types/node": "^24.0.3",
|
|
66
62
|
"@types/prompts": "^2.4.2",
|
|
67
63
|
"@types/semver": "^7.5.8",
|
|
68
|
-
"axios": "^1.7.9",
|
|
69
64
|
"bats-assert": "^2.0.0",
|
|
70
65
|
"bats-support": "^0.3.0",
|
|
71
|
-
"bun-types": "^1.2.16",
|
|
72
|
-
"commander": "^10.0.0",
|
|
73
66
|
"cross-env": "^7.0.3",
|
|
74
|
-
"diff": "^5.1.0",
|
|
75
|
-
"dotenv": "^16.5.0",
|
|
76
67
|
"esbuild-plugin-copy": "^2.1.1",
|
|
77
|
-
"execa": "^7.0.0",
|
|
78
|
-
"fs-extra": "^11.1.0",
|
|
79
|
-
"glob": "^11.0.0",
|
|
80
|
-
"globby": "^14.0.2",
|
|
81
|
-
"https-proxy-agent": "^6.2.0",
|
|
82
|
-
"ora": "^8.1.1",
|
|
83
68
|
"prettier": "3.5.3",
|
|
84
|
-
"recast": "^0.23.2",
|
|
85
|
-
"rimraf": "6.0.1",
|
|
86
|
-
"simple-git": "^3.27.0",
|
|
87
|
-
"tiktoken": "^1.0.18",
|
|
88
|
-
"tsconfig-paths": "^4.2.0",
|
|
89
69
|
"tsup": "8.5.0",
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"typescript": "5.8.2",
|
|
93
|
-
"vite": "^5.4.1",
|
|
94
|
-
"which": "^4.0.0",
|
|
95
|
-
"ws": "^8.18.0",
|
|
96
|
-
"yoctocolors": "^2.1.1"
|
|
70
|
+
"typescript": "5.8.3",
|
|
71
|
+
"vite": "^6.3.5"
|
|
97
72
|
},
|
|
98
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "47425598c211a43748abe7386d4259e1fb7080e7",
|
|
99
74
|
"dependencies": {
|
|
75
|
+
"@anthropic-ai/sdk": "^0.54.0",
|
|
100
76
|
"@clack/prompts": "^0.11.0",
|
|
101
|
-
"@
|
|
102
|
-
"@elizaos/
|
|
103
|
-
"@elizaos/plugin-
|
|
104
|
-
"@elizaos/
|
|
105
|
-
"
|
|
106
|
-
"@elizaos/plugin-openai": "latest",
|
|
107
|
-
"@elizaos/plugin-sql": "1.0.10",
|
|
108
|
-
"@elizaos/server": "1.0.10",
|
|
109
|
-
"@noble/curves": "^1.6.0",
|
|
110
|
-
"@sindresorhus/merge-streams": "^4.0.0",
|
|
111
|
-
"@types/express": "^5.0.2",
|
|
112
|
-
"@types/helmet": "^4.0.0",
|
|
113
|
-
"bun": "^1.2.13",
|
|
77
|
+
"@elizaos/core": "1.0.12",
|
|
78
|
+
"@elizaos/plugin-openai": "1.0.4",
|
|
79
|
+
"@elizaos/plugin-sql": "1.0.12",
|
|
80
|
+
"@elizaos/server": "1.0.12",
|
|
81
|
+
"bun": "^1.2.17",
|
|
114
82
|
"chokidar": "^4.0.3",
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
"
|
|
83
|
+
"commander": "^14.0.0",
|
|
84
|
+
"dotenv": "^16.5.0",
|
|
85
|
+
"execa": "^9.6.0",
|
|
86
|
+
"fs-extra": "^11.1.0",
|
|
87
|
+
"globby": "^14.0.2",
|
|
88
|
+
"https-proxy-agent": "^7.0.6",
|
|
120
89
|
"inquirer": "^12.6.3",
|
|
121
|
-
"
|
|
122
|
-
"
|
|
90
|
+
"ora": "^8.1.1",
|
|
91
|
+
"rimraf": "6.0.1",
|
|
123
92
|
"semver": "^7.7.2",
|
|
124
|
-
"
|
|
125
|
-
"
|
|
126
|
-
"
|
|
93
|
+
"simple-git": "^3.27.0",
|
|
94
|
+
"tiktoken": "^1.0.18",
|
|
95
|
+
"tsconfig-paths": "^4.2.0",
|
|
96
|
+
"type-fest": "^4.41.0",
|
|
97
|
+
"yoctocolors": "^2.1.1",
|
|
98
|
+
"zod": "^3.25.67"
|
|
127
99
|
}
|
|
128
100
|
}
|
|
@@ -50,12 +50,9 @@
|
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@cypress/react": "^9.0.1",
|
|
54
53
|
"@elizaos/cli": "^1.0.0",
|
|
55
54
|
"@tailwindcss/vite": "^4.1.10",
|
|
56
|
-
"@testing-library/cypress": "^10.0.3",
|
|
57
55
|
"@vitejs/plugin-react-swc": "^3.10.2",
|
|
58
|
-
"cypress": "^14.4.1",
|
|
59
56
|
"dotenv": "16.4.5",
|
|
60
57
|
"prettier": "3.5.3",
|
|
61
58
|
"tailwindcss-animate": "^1.0.7",
|
|
@@ -67,11 +64,12 @@
|
|
|
67
64
|
"dev": "elizaos dev",
|
|
68
65
|
"build": "tsc --noEmit && vite build && tsup",
|
|
69
66
|
"lint": "prettier --write ./src",
|
|
70
|
-
"test:component": "bun test",
|
|
71
|
-
"test:e2e": "bun test",
|
|
72
|
-
"test:e2e:manual": "node scripts/test-e2e-manual.js",
|
|
73
|
-
"test:cypress": "cypress run --component",
|
|
74
|
-
"test": "bun run test:component && bun run test:e2e",
|
|
67
|
+
"test:component": "bun run test:install && bun test",
|
|
68
|
+
"test:e2e": "bun run test:install && bun test",
|
|
69
|
+
"test:e2e:manual": "bun run test:install && node scripts/test-e2e-manual.js",
|
|
70
|
+
"test:cypress": "bun run test:install && cypress run --component",
|
|
71
|
+
"test": "bun run test:install && bun run test:component && bun run test:e2e",
|
|
72
|
+
"test:install": "node scripts/install-test-deps.js",
|
|
75
73
|
"publish": "elizaos publish",
|
|
76
74
|
"format": "prettier --write ./src",
|
|
77
75
|
"format:check": "prettier --check ./src"
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { existsSync, readFileSync } from 'fs';
|
|
4
|
+
import { execSync } from 'child_process';
|
|
5
|
+
import { join } from 'path';
|
|
6
|
+
|
|
7
|
+
const testDependencies = {
|
|
8
|
+
'@cypress/react': '^9.0.1',
|
|
9
|
+
'@testing-library/cypress': '^10.0.3',
|
|
10
|
+
cypress: '^14.4.1',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
function isInstalled(packageName) {
|
|
14
|
+
try {
|
|
15
|
+
const packageJsonPath = join(process.cwd(), 'package.json');
|
|
16
|
+
if (existsSync(packageJsonPath)) {
|
|
17
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
|
|
18
|
+
const deps = { ...packageJson.dependencies, ...packageJson.devDependencies };
|
|
19
|
+
return packageName in deps;
|
|
20
|
+
}
|
|
21
|
+
} catch (error) {
|
|
22
|
+
// Silent fail, will install if error
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function installTestDependencies() {
|
|
28
|
+
const missingDeps = Object.entries(testDependencies)
|
|
29
|
+
.filter(([name]) => !isInstalled(name))
|
|
30
|
+
.map(([name, version]) => `${name}@${version}`);
|
|
31
|
+
|
|
32
|
+
if (missingDeps.length === 0) {
|
|
33
|
+
console.log('✓ Test dependencies already installed');
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
console.log('Installing test dependencies...');
|
|
38
|
+
try {
|
|
39
|
+
execSync(`bun add -d ${missingDeps.join(' ')}`, {
|
|
40
|
+
stdio: 'inherit',
|
|
41
|
+
cwd: process.cwd(),
|
|
42
|
+
});
|
|
43
|
+
console.log('✓ Test dependencies installed successfully');
|
|
44
|
+
} catch (error) {
|
|
45
|
+
console.error('Failed to install test dependencies:', error.message);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
installTestDependencies();
|
|
@@ -268,7 +268,7 @@ export const starterPlugin: Plugin = {
|
|
|
268
268
|
actions: [helloWorldAction],
|
|
269
269
|
providers: [helloWorldProvider],
|
|
270
270
|
tests: [StarterPluginTestSuite],
|
|
271
|
-
// dependencies: ['@elizaos/plugin-knowledge'], <--- plugin
|
|
271
|
+
// dependencies: ['@elizaos/plugin-knowledge'], <--- plugin dependencies go here (if requires another plugin)
|
|
272
272
|
};
|
|
273
273
|
|
|
274
274
|
export default starterPlugin;
|
|
@@ -3,4 +3,16 @@ timeout = 60000
|
|
|
3
3
|
coverage = true
|
|
4
4
|
|
|
5
5
|
[test.env]
|
|
6
|
-
NODE_ENV = "test"
|
|
6
|
+
NODE_ENV = "test"
|
|
7
|
+
|
|
8
|
+
coverage-exclude = [
|
|
9
|
+
"**/dist/**",
|
|
10
|
+
"**/build/**",
|
|
11
|
+
"**/chunk-*.js",
|
|
12
|
+
"**/*.chunk.js",
|
|
13
|
+
"**/node_modules/**",
|
|
14
|
+
"**/*.min.js",
|
|
15
|
+
"**/*.bundle.js",
|
|
16
|
+
"**/coverage/**",
|
|
17
|
+
"**/.turbo/**",
|
|
18
|
+
]
|
|
@@ -28,11 +28,10 @@
|
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@elizaos/cli": "1.0.
|
|
32
|
-
"@elizaos/core": "1.0.
|
|
33
|
-
"@elizaos/plugin-bootstrap": "1.0.
|
|
34
|
-
"@elizaos/plugin-
|
|
35
|
-
"@elizaos/plugin-sql": "1.0.9",
|
|
31
|
+
"@elizaos/cli": "1.0.12",
|
|
32
|
+
"@elizaos/core": "1.0.12",
|
|
33
|
+
"@elizaos/plugin-bootstrap": "1.0.12",
|
|
34
|
+
"@elizaos/plugin-sql": "1.0.12",
|
|
36
35
|
"@tanstack/react-query": "^5.29.0",
|
|
37
36
|
"clsx": "^2.1.1",
|
|
38
37
|
"react": "^18.3.1",
|
|
@@ -42,13 +41,9 @@
|
|
|
42
41
|
"zod": "3.24.2"
|
|
43
42
|
},
|
|
44
43
|
"devDependencies": {
|
|
45
|
-
"@cypress/react": "^9.0.1",
|
|
46
|
-
"@cypress/vite-dev-server": "^6.0.3",
|
|
47
|
-
"@testing-library/cypress": "^10.0.3",
|
|
48
44
|
"@types/react": "^18.3.3",
|
|
49
45
|
"@types/react-dom": "^18.3.0",
|
|
50
46
|
"@vitejs/plugin-react": "^4.3.1",
|
|
51
|
-
"cypress": "^14.4.1",
|
|
52
47
|
"prettier": "3.5.3",
|
|
53
48
|
"tsup": "8.5.0",
|
|
54
49
|
"typescript": "^5.6.3",
|
|
@@ -61,20 +56,21 @@
|
|
|
61
56
|
"lint": "prettier --write ./src",
|
|
62
57
|
"type-check": "tsc --noEmit",
|
|
63
58
|
"type-check:watch": "tsc --noEmit --watch",
|
|
64
|
-
"test:component": "bun test",
|
|
65
|
-
"test:e2e": "bun test",
|
|
66
|
-
"test": "bun run test:component && bun run test:e2e",
|
|
67
|
-
"test:coverage": "bun test --coverage",
|
|
68
|
-
"test:watch": "bun test --watch",
|
|
59
|
+
"test:component": "bun run test:install && bun test",
|
|
60
|
+
"test:e2e": "bun run test:install && bun test",
|
|
61
|
+
"test": "bun run test:install && bun run test:component && bun run test:e2e",
|
|
62
|
+
"test:coverage": "bun run test:install && bun test --coverage",
|
|
63
|
+
"test:watch": "bun run test:install && bun test --watch",
|
|
64
|
+
"test:install": "node scripts/install-test-deps.js",
|
|
69
65
|
"format": "prettier --write ./src",
|
|
70
66
|
"format:check": "prettier --check ./src",
|
|
71
67
|
"check-all": "bun run type-check && bun run format:check && bun run test",
|
|
72
|
-
"cy:open": "cypress open",
|
|
73
|
-
"cy:run": "cypress run --component",
|
|
74
|
-
"cy:test": "cypress run --component --reporter spec",
|
|
75
|
-
"cypress:component": "cypress run --component",
|
|
76
|
-
"cypress:e2e": "cypress run --e2e",
|
|
77
|
-
"cypress:open": "cypress open"
|
|
68
|
+
"cy:open": "bun run test:install && cypress open",
|
|
69
|
+
"cy:run": "bun run test:install && cypress run --component",
|
|
70
|
+
"cy:test": "bun run test:install && cypress run --component --reporter spec",
|
|
71
|
+
"cypress:component": "bun run test:install && cypress run --component",
|
|
72
|
+
"cypress:e2e": "bun run test:install && cypress run --e2e",
|
|
73
|
+
"cypress:open": "bun run test:install && cypress open"
|
|
78
74
|
},
|
|
79
75
|
"publishConfig": {
|
|
80
76
|
"access": "public"
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { existsSync, readFileSync } from 'fs';
|
|
4
|
+
import { execSync } from 'child_process';
|
|
5
|
+
import { join } from 'path';
|
|
6
|
+
|
|
7
|
+
const testDependencies = {
|
|
8
|
+
'@cypress/react': '^9.0.1',
|
|
9
|
+
'@cypress/vite-dev-server': '^6.0.3',
|
|
10
|
+
'@testing-library/cypress': '^10.0.3',
|
|
11
|
+
cypress: '^14.4.1',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
function isInstalled(packageName) {
|
|
15
|
+
try {
|
|
16
|
+
const packageJsonPath = join(process.cwd(), 'package.json');
|
|
17
|
+
if (existsSync(packageJsonPath)) {
|
|
18
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
|
|
19
|
+
const deps = { ...packageJson.dependencies, ...packageJson.devDependencies };
|
|
20
|
+
return packageName in deps;
|
|
21
|
+
}
|
|
22
|
+
} catch (error) {
|
|
23
|
+
// Silent fail, will install if error
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function installTestDependencies() {
|
|
29
|
+
const missingDeps = Object.entries(testDependencies)
|
|
30
|
+
.filter(([name]) => !isInstalled(name))
|
|
31
|
+
.map(([name, version]) => `${name}@${version}`);
|
|
32
|
+
|
|
33
|
+
if (missingDeps.length === 0) {
|
|
34
|
+
console.log('✓ Test dependencies already installed');
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
console.log('Installing test dependencies...');
|
|
39
|
+
try {
|
|
40
|
+
execSync(`bun add -d ${missingDeps.join(' ')}`, {
|
|
41
|
+
stdio: 'inherit',
|
|
42
|
+
cwd: process.cwd(),
|
|
43
|
+
});
|
|
44
|
+
console.log('✓ Test dependencies installed successfully');
|
|
45
|
+
} catch (error) {
|
|
46
|
+
console.error('Failed to install test dependencies:', error.message);
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
installTestDependencies();
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { describe, expect, it,
|
|
1
|
+
import { describe, expect, it, beforeEach, afterEach, mock } from 'bun:test';
|
|
2
2
|
import plugin from '../plugin';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { createMockRuntime } from './utils/core-test-utils';
|
|
5
5
|
|
|
6
6
|
// Mock logger
|
|
7
|
-
|
|
8
|
-
const actual =
|
|
7
|
+
mock.module('@elizaos/core', () => {
|
|
8
|
+
const actual = require('@elizaos/core');
|
|
9
9
|
return {
|
|
10
10
|
...actual,
|
|
11
11
|
logger: {
|
|
12
|
-
info:
|
|
13
|
-
error:
|
|
14
|
-
warn:
|
|
12
|
+
info: mock(),
|
|
13
|
+
error: mock(),
|
|
14
|
+
warn: mock(),
|
|
15
15
|
},
|
|
16
16
|
};
|
|
17
17
|
});
|
|
@@ -24,7 +24,7 @@ describe('Plugin Configuration Schema', () => {
|
|
|
24
24
|
const originalEnv = { ...process.env };
|
|
25
25
|
|
|
26
26
|
beforeEach(() => {
|
|
27
|
-
|
|
27
|
+
mock.restore();
|
|
28
28
|
// Reset environment variables before each test
|
|
29
29
|
process.env = { ...originalEnv };
|
|
30
30
|
});
|
|
@@ -150,7 +150,7 @@ describe('Plugin Configuration Schema', () => {
|
|
|
150
150
|
|
|
151
151
|
// Mock the parseAsync function
|
|
152
152
|
const originalParseAsync = schema.parseAsync;
|
|
153
|
-
schema.parseAsync =
|
|
153
|
+
schema.parseAsync = mock().mockRejectedValue(mockZodError);
|
|
154
154
|
|
|
155
155
|
try {
|
|
156
156
|
// Use the mocked schema directly to avoid TypeScript errors
|
|
@@ -176,7 +176,7 @@ describe('Plugin Configuration Schema', () => {
|
|
|
176
176
|
|
|
177
177
|
// Mock the parseAsync function
|
|
178
178
|
const originalParseAsync = schema.parseAsync;
|
|
179
|
-
schema.parseAsync =
|
|
179
|
+
schema.parseAsync = mock().mockRejectedValue(genericError);
|
|
180
180
|
|
|
181
181
|
try {
|
|
182
182
|
// Use the mocked schema directly to avoid TypeScript errors
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, expect, it,
|
|
1
|
+
import { describe, expect, it, beforeEach, afterEach, mock, spyOn } from 'bun:test';
|
|
2
2
|
import plugin from '../plugin';
|
|
3
3
|
import { StarterService } from '../plugin';
|
|
4
4
|
import { logger } from '@elizaos/core';
|
|
@@ -6,21 +6,21 @@ import type { IAgentRuntime, Memory, State } from '@elizaos/core';
|
|
|
6
6
|
import { v4 as uuidv4 } from 'uuid';
|
|
7
7
|
|
|
8
8
|
// Mock logger
|
|
9
|
-
|
|
10
|
-
const actual =
|
|
9
|
+
mock.module('@elizaos/core', () => {
|
|
10
|
+
const actual = require('@elizaos/core');
|
|
11
11
|
return {
|
|
12
12
|
...actual,
|
|
13
13
|
logger: {
|
|
14
|
-
info:
|
|
15
|
-
error:
|
|
16
|
-
warn:
|
|
14
|
+
info: mock(),
|
|
15
|
+
error: mock(),
|
|
16
|
+
warn: mock(),
|
|
17
17
|
},
|
|
18
18
|
};
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
describe('Error Handling', () => {
|
|
22
22
|
beforeEach(() => {
|
|
23
|
-
|
|
23
|
+
mock.restore();
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
afterEach(() => {
|
|
@@ -57,7 +57,7 @@ describe('Error Handling', () => {
|
|
|
57
57
|
text: '',
|
|
58
58
|
} as State;
|
|
59
59
|
|
|
60
|
-
const mockCallback =
|
|
60
|
+
const mockCallback = mock();
|
|
61
61
|
|
|
62
62
|
// Mock the logger.error to verify it's called
|
|
63
63
|
spyOn(logger, 'error');
|
|
@@ -80,7 +80,7 @@ describe('Error Handling', () => {
|
|
|
80
80
|
describe('Service Error Handling', () => {
|
|
81
81
|
it('should throw an error when stopping non-existent service', async () => {
|
|
82
82
|
const mockRuntime = {
|
|
83
|
-
getService:
|
|
83
|
+
getService: mock().mockReturnValue(null),
|
|
84
84
|
} as unknown as IAgentRuntime;
|
|
85
85
|
|
|
86
86
|
let caughtError = null;
|
|
@@ -97,13 +97,13 @@ describe('Error Handling', () => {
|
|
|
97
97
|
|
|
98
98
|
it('should handle service stop errors gracefully', async () => {
|
|
99
99
|
const mockServiceWithError = {
|
|
100
|
-
stop:
|
|
100
|
+
stop: mock().mockImplementation(() => {
|
|
101
101
|
throw new Error('Error stopping service');
|
|
102
102
|
}),
|
|
103
103
|
};
|
|
104
104
|
|
|
105
105
|
const mockRuntime = {
|
|
106
|
-
getService:
|
|
106
|
+
getService: mock().mockReturnValue(mockServiceWithError),
|
|
107
107
|
} as unknown as IAgentRuntime;
|
|
108
108
|
|
|
109
109
|
// The error should be propagated
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { describe, expect, it,
|
|
1
|
+
import { describe, expect, it, beforeEach, mock } from 'bun:test';
|
|
2
2
|
import plugin from '../plugin';
|
|
3
3
|
import { logger } from '@elizaos/core';
|
|
4
4
|
|
|
5
5
|
// Mock logger
|
|
6
|
-
|
|
7
|
-
const actual =
|
|
6
|
+
mock.module('@elizaos/core', () => {
|
|
7
|
+
const actual = require('@elizaos/core');
|
|
8
8
|
return {
|
|
9
9
|
...actual,
|
|
10
10
|
logger: {
|
|
11
|
-
info:
|
|
12
|
-
error:
|
|
11
|
+
info: mock(),
|
|
12
|
+
error: mock(),
|
|
13
13
|
},
|
|
14
14
|
};
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
describe('Plugin Events', () => {
|
|
18
18
|
beforeEach(() => {
|
|
19
|
-
|
|
19
|
+
mock.restore();
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
it('should have events defined', () => {
|
|
@@ -2,7 +2,7 @@ import { IAgentRuntime, logger, Plugin } from '@elizaos/core';
|
|
|
2
2
|
import * as fs from 'node:fs';
|
|
3
3
|
import * as os from 'node:os';
|
|
4
4
|
import * as path from 'node:path';
|
|
5
|
-
import { afterAll, beforeAll, describe, expect, it } from 'bun:test';
|
|
5
|
+
import { afterAll, beforeAll, describe, expect, it, mock, spyOn } from 'bun:test';
|
|
6
6
|
import { character } from '../index';
|
|
7
7
|
import plugin from '../plugin';
|
|
8
8
|
|
|
@@ -92,27 +92,27 @@ describe('Integration: Runtime Initialization', () => {
|
|
|
92
92
|
const customMockRuntime = {
|
|
93
93
|
character: { ...character },
|
|
94
94
|
plugins: [],
|
|
95
|
-
registerPlugin:
|
|
95
|
+
registerPlugin: mock().mockImplementation((plugin: Plugin) => {
|
|
96
96
|
// In a real runtime, registering the plugin would call its init method,
|
|
97
97
|
// but since we're testing init itself, we just need to record the call
|
|
98
98
|
return Promise.resolve();
|
|
99
99
|
}),
|
|
100
|
-
initialize:
|
|
101
|
-
getService:
|
|
102
|
-
getSetting:
|
|
103
|
-
useModel:
|
|
104
|
-
getProviderResults:
|
|
105
|
-
evaluateProviders:
|
|
106
|
-
evaluate:
|
|
100
|
+
initialize: mock(),
|
|
101
|
+
getService: mock(),
|
|
102
|
+
getSetting: mock().mockReturnValue(null),
|
|
103
|
+
useModel: mock().mockResolvedValue('Test model response'),
|
|
104
|
+
getProviderResults: mock().mockResolvedValue([]),
|
|
105
|
+
evaluateProviders: mock().mockResolvedValue([]),
|
|
106
|
+
evaluate: mock().mockResolvedValue([]),
|
|
107
107
|
} as unknown as IAgentRuntime;
|
|
108
108
|
|
|
109
109
|
// Ensure we're testing safely - to avoid parallel test race conditions
|
|
110
110
|
const originalInit = plugin.init;
|
|
111
111
|
let initCalled = false;
|
|
112
112
|
|
|
113
|
-
// Mock the plugin.init method using
|
|
113
|
+
// Mock the plugin.init method using mock instead of direct assignment
|
|
114
114
|
if (plugin.init) {
|
|
115
|
-
plugin.init =
|
|
115
|
+
plugin.init = mock(async (config, runtime) => {
|
|
116
116
|
// Set flag to indicate our wrapper was called
|
|
117
117
|
initCalled = true;
|
|
118
118
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, expect, it } from 'bun:test';
|
|
1
|
+
import { describe, expect, it, mock } from 'bun:test';
|
|
2
2
|
import plugin from '../plugin';
|
|
3
3
|
|
|
4
4
|
describe('Plugin Routes', () => {
|
|
@@ -30,7 +30,7 @@ describe('Plugin Routes', () => {
|
|
|
30
30
|
// Create mock request and response objects
|
|
31
31
|
const mockReq = {};
|
|
32
32
|
const mockRes = {
|
|
33
|
-
json:
|
|
33
|
+
json: mock(),
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
// Mock runtime object as third parameter
|