@elizaos/cli 1.3.0 → 1.3.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/README.md +1 -1
- package/dist/{chunk-2CUIHNPL.js → chunk-5GUS4CFO.js} +7 -2
- package/dist/{chunk-2ALAPQLV.js → chunk-E6XYTE3A.js} +296 -311
- package/dist/chunk-GXWWPFBO.js +39 -0
- package/dist/{chunk-I77ZRNYO.js → chunk-T2QDIXGU.js} +2 -2
- package/dist/commands/agent/actions/index.d.ts +5 -0
- package/dist/commands/agent/actions/index.js +2 -2
- package/dist/commands/agent/index.d.ts +2 -2
- package/dist/commands/agent/index.js +2 -2
- package/dist/commands/create/actions/index.js +3 -3
- package/dist/commands/create/index.js +4 -4
- package/dist/commands/shared/index.d.ts +11 -28
- package/dist/commands/shared/index.js +7 -3
- package/dist/index.js +541 -450
- package/dist/{registry-N626N4VG.js → registry-433S5F3Y.js} +2 -2
- package/dist/templates/plugin-quick-starter/.gitignore +66 -0
- package/dist/templates/plugin-quick-starter/.npmignore +5 -0
- package/dist/templates/plugin-quick-starter/package.json +11 -3
- package/dist/templates/plugin-quick-starter/src/__tests__/plugin.test.ts +499 -146
- package/dist/templates/plugin-quick-starter/src/__tests__/test-utils.ts +316 -115
- package/dist/templates/plugin-quick-starter/src/plugin.ts +7 -13
- package/dist/templates/plugin-starter/.gitignore +66 -0
- package/dist/templates/plugin-starter/.npmignore +5 -0
- package/dist/templates/plugin-starter/README.md +1 -1
- package/dist/templates/plugin-starter/package.json +11 -3
- package/dist/templates/plugin-starter/src/__tests__/integration.test.ts +13 -13
- package/dist/templates/plugin-starter/src/__tests__/plugin.test.ts +556 -129
- package/dist/templates/plugin-starter/src/__tests__/test-utils.ts +347 -115
- package/dist/templates/plugin-starter/src/plugin.ts +18 -22
- package/dist/templates/project-starter/.gitignore +57 -0
- package/dist/templates/project-starter/.npmignore +11 -0
- package/dist/templates/project-starter/README.md +1 -1
- package/dist/templates/project-starter/package.json +4 -4
- package/dist/templates/project-starter/src/__tests__/env.test.ts +3 -1
- package/dist/templates/project-starter/src/__tests__/file-structure.test.ts +3 -2
- package/dist/templates/project-starter/src/__tests__/integration.test.ts +1 -1
- package/dist/templates/project-starter/tsup.config.ts +2 -1
- package/dist/templates/project-tee-starter/.dockerignore +64 -14
- package/dist/templates/project-tee-starter/.gitignore +57 -0
- package/dist/templates/project-tee-starter/.npmignore +6 -0
- package/dist/templates/project-tee-starter/Dockerfile +9 -5
- package/dist/templates/project-tee-starter/GUIDE.md +103 -42
- package/dist/templates/project-tee-starter/README.md +39 -19
- package/dist/templates/project-tee-starter/__tests__/build-order.test.ts +62 -0
- package/dist/templates/project-tee-starter/__tests__/character.test.ts +19 -17
- package/dist/templates/project-tee-starter/__tests__/config.test.ts +10 -3
- package/dist/templates/project-tee-starter/__tests__/env.test.ts +2 -1
- package/dist/templates/project-tee-starter/__tests__/file-structure.test.ts +14 -3
- package/dist/templates/project-tee-starter/__tests__/frontend.test.ts +459 -0
- package/dist/templates/project-tee-starter/__tests__/plugin.test.ts +4 -2
- package/dist/templates/project-tee-starter/__tests__/routes.test.ts +15 -6
- package/dist/templates/project-tee-starter/__tests__/tee-validation.test.ts +295 -0
- package/dist/templates/project-tee-starter/__tests__/vite-config-utils.ts +39 -0
- package/dist/templates/project-tee-starter/docker-compose.yaml +5 -2
- package/dist/templates/{plugin-starter/dist → project-tee-starter}/index.html +3 -3
- package/dist/templates/project-tee-starter/package.json +34 -14
- package/dist/templates/project-tee-starter/postcss.config.js +3 -0
- package/dist/templates/project-tee-starter/scripts/install-test-deps.js +52 -0
- package/dist/templates/project-tee-starter/scripts/test-all.sh +82 -0
- package/dist/templates/project-tee-starter/src/frontend/index.css +106 -0
- package/dist/templates/project-tee-starter/src/frontend/index.html +20 -0
- package/dist/templates/project-tee-starter/src/frontend/index.tsx +370 -0
- package/dist/templates/project-tee-starter/src/frontend/panels.tsx +17 -0
- package/dist/templates/project-tee-starter/src/frontend/utils.ts +6 -0
- package/dist/templates/project-tee-starter/src/index.ts +6 -6
- package/dist/templates/project-tee-starter/src/plugin.ts +209 -59
- package/dist/templates/project-tee-starter/tailwind.config.js +62 -0
- package/dist/templates/project-tee-starter/tsconfig.build.json +2 -2
- package/dist/templates/project-tee-starter/tsconfig.json +8 -5
- package/dist/templates/project-tee-starter/tsup.config.ts +3 -2
- package/dist/templates/project-tee-starter/vite.config.ts +39 -0
- package/dist/url-utils-CKc_Ebt_.d.ts +35 -0
- package/dist/{utils-H66532NB.js → utils-DBLSDYBF.js} +2 -2
- package/package.json +12 -7
- package/templates/plugin-quick-starter/.gitignore +66 -0
- package/templates/plugin-quick-starter/.npmignore +5 -0
- package/templates/plugin-quick-starter/package.json +11 -3
- package/templates/plugin-quick-starter/src/__tests__/plugin.test.ts +499 -146
- package/templates/plugin-quick-starter/src/__tests__/test-utils.ts +316 -115
- package/templates/plugin-quick-starter/src/plugin.ts +7 -13
- package/templates/plugin-starter/.gitignore +66 -0
- package/templates/plugin-starter/.npmignore +5 -0
- package/templates/plugin-starter/README.md +1 -1
- package/templates/plugin-starter/package.json +11 -3
- package/templates/plugin-starter/src/__tests__/integration.test.ts +13 -13
- package/templates/plugin-starter/src/__tests__/plugin.test.ts +556 -129
- package/templates/plugin-starter/src/__tests__/test-utils.ts +347 -115
- package/templates/plugin-starter/src/plugin.ts +18 -22
- package/templates/project-starter/.gitignore +57 -0
- package/templates/project-starter/.npmignore +11 -0
- package/templates/project-starter/README.md +1 -1
- package/templates/project-starter/package.json +4 -4
- package/templates/project-starter/src/__tests__/env.test.ts +3 -1
- package/templates/project-starter/src/__tests__/file-structure.test.ts +3 -2
- package/templates/project-starter/src/__tests__/integration.test.ts +1 -1
- package/templates/project-starter/tsup.config.ts +2 -1
- package/templates/project-tee-starter/.dockerignore +64 -14
- package/templates/project-tee-starter/.gitignore +57 -0
- package/templates/project-tee-starter/.npmignore +6 -0
- package/templates/project-tee-starter/Dockerfile +9 -5
- package/templates/project-tee-starter/GUIDE.md +103 -42
- package/templates/project-tee-starter/README.md +39 -19
- package/templates/project-tee-starter/__tests__/build-order.test.ts +62 -0
- package/templates/project-tee-starter/__tests__/character.test.ts +19 -17
- package/templates/project-tee-starter/__tests__/config.test.ts +10 -3
- package/templates/project-tee-starter/__tests__/env.test.ts +2 -1
- package/templates/project-tee-starter/__tests__/file-structure.test.ts +14 -3
- package/templates/project-tee-starter/__tests__/frontend.test.ts +459 -0
- package/templates/project-tee-starter/__tests__/plugin.test.ts +4 -2
- package/templates/project-tee-starter/__tests__/routes.test.ts +15 -6
- package/templates/project-tee-starter/__tests__/tee-validation.test.ts +295 -0
- package/templates/project-tee-starter/__tests__/vite-config-utils.ts +39 -0
- package/templates/project-tee-starter/docker-compose.yaml +5 -2
- package/templates/{plugin-starter/dist → project-tee-starter}/index.html +3 -3
- package/templates/project-tee-starter/package.json +34 -14
- package/templates/project-tee-starter/postcss.config.js +3 -0
- package/templates/project-tee-starter/scripts/install-test-deps.js +52 -0
- package/templates/project-tee-starter/scripts/test-all.sh +82 -0
- package/templates/project-tee-starter/src/frontend/index.css +106 -0
- package/templates/project-tee-starter/src/frontend/index.html +20 -0
- package/templates/project-tee-starter/src/frontend/index.tsx +370 -0
- package/templates/project-tee-starter/src/frontend/panels.tsx +17 -0
- package/templates/project-tee-starter/src/frontend/utils.ts +6 -0
- package/templates/project-tee-starter/src/index.ts +6 -6
- package/templates/project-tee-starter/src/plugin.ts +209 -59
- package/templates/project-tee-starter/tailwind.config.js +62 -0
- package/templates/project-tee-starter/tsconfig.build.json +2 -2
- package/templates/project-tee-starter/tsconfig.json +8 -5
- package/templates/project-tee-starter/tsup.config.ts +3 -2
- package/templates/project-tee-starter/vite.config.ts +39 -0
- package/dist/chunk-4O6EZU37.js +0 -14
- package/dist/migration-guides/advanced-migration-guide.md +0 -459
- package/dist/migration-guides/completion-requirements.md +0 -379
- package/dist/migration-guides/integrated-migration-loop.md +0 -392
- package/dist/migration-guides/migration-guide.md +0 -712
- package/dist/migration-guides/prompt-and-generation-guide.md +0 -702
- package/dist/migration-guides/state-and-providers-guide.md +0 -544
- package/dist/migration-guides/testing-guide.md +0 -1021
- package/dist/templates/plugin-starter/dist/assets/index-CgkejLs_.css +0 -1
- package/dist/templates/plugin-starter/dist/assets/index-D1cHX53P.js +0 -49
- package/dist/templates/plugin-starter/dist/index.js +0 -387
- package/dist/templates/plugin-starter/dist/index.js.map +0 -1
- package/templates/plugin-starter/dist/.vite/manifest.json +0 -11
- package/templates/plugin-starter/dist/assets/index-CgkejLs_.css +0 -1
- package/templates/plugin-starter/dist/assets/index-D1cHX53P.js +0 -49
- package/templates/plugin-starter/dist/index.d.ts +0 -14
- package/templates/plugin-starter/dist/index.js +0 -387
- package/templates/plugin-starter/dist/index.js.map +0 -1
|
@@ -4,9 +4,10 @@ import {
|
|
|
4
4
|
runBunCommand
|
|
5
5
|
} from "./chunk-FDEDLANP.js";
|
|
6
6
|
import {
|
|
7
|
+
createApiClientConfig,
|
|
7
8
|
getAgentRuntimeUrl,
|
|
8
|
-
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
getAuthHeaders
|
|
10
|
+
} from "./chunk-GXWWPFBO.js";
|
|
10
11
|
import {
|
|
11
12
|
bunExec,
|
|
12
13
|
bunExecInherit,
|
|
@@ -2761,7 +2762,7 @@ async function getGitHubCredentials() {
|
|
|
2761
2762
|
}
|
|
2762
2763
|
logger10.warn("Invalid GitHub token found in environment variables");
|
|
2763
2764
|
}
|
|
2764
|
-
const { getGitHubToken: getGitHubToken2 } = await import("./registry-
|
|
2765
|
+
const { getGitHubToken: getGitHubToken2 } = await import("./registry-433S5F3Y.js");
|
|
2765
2766
|
const token = await getGitHubToken2() || void 0;
|
|
2766
2767
|
if (token) {
|
|
2767
2768
|
const isValid2 = await validateGitHubToken(token);
|
|
@@ -3057,38 +3058,34 @@ async function pushToGitHub(cwd, repoUrl, branch = "main") {
|
|
|
3057
3058
|
}
|
|
3058
3059
|
|
|
3059
3060
|
// src/utils/handle-error.ts
|
|
3060
|
-
import { logger as
|
|
3061
|
+
import { logger as logger12 } from "@elizaos/core";
|
|
3061
3062
|
|
|
3062
3063
|
// src/commands/agent/index.ts
|
|
3063
3064
|
import { Command } from "commander";
|
|
3064
3065
|
|
|
3065
3066
|
// src/commands/agent/actions/crud.ts
|
|
3066
|
-
import {
|
|
3067
|
-
import {
|
|
3067
|
+
import { AgentsService as AgentsService2, MemoryService } from "@elizaos/api-client";
|
|
3068
|
+
import { asUUID } from "@elizaos/core";
|
|
3069
|
+
import { readFileSync as readFileSync5, writeFileSync } from "fs";
|
|
3068
3070
|
import path11 from "path";
|
|
3069
3071
|
|
|
3070
3072
|
// src/commands/agent/utils/validation.ts
|
|
3071
3073
|
import { z as z2 } from "zod";
|
|
3074
|
+
import { AgentsService } from "@elizaos/api-client";
|
|
3072
3075
|
var AgentBasicSchema = z2.object({
|
|
3073
3076
|
id: z2.string(),
|
|
3074
3077
|
name: z2.string(),
|
|
3075
3078
|
status: z2.string().optional()
|
|
3076
3079
|
}).passthrough();
|
|
3077
3080
|
var AgentsListResponseSchema = z2.object({
|
|
3078
|
-
|
|
3079
|
-
data: z2.object({
|
|
3080
|
-
agents: z2.array(AgentBasicSchema)
|
|
3081
|
-
}).optional()
|
|
3081
|
+
agents: z2.array(AgentBasicSchema)
|
|
3082
3082
|
});
|
|
3083
3083
|
async function getAgents(opts) {
|
|
3084
|
-
const
|
|
3085
|
-
const
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
const rawData = await response.json();
|
|
3090
|
-
const validatedData = AgentsListResponseSchema.parse(rawData);
|
|
3091
|
-
return validatedData.data?.agents || [];
|
|
3084
|
+
const config = createApiClientConfig(opts);
|
|
3085
|
+
const agentsService = new AgentsService(config);
|
|
3086
|
+
const result = await agentsService.listAgents();
|
|
3087
|
+
const validatedData = AgentsListResponseSchema.parse(result);
|
|
3088
|
+
return validatedData.agents;
|
|
3092
3089
|
}
|
|
3093
3090
|
async function resolveAgentId(idOrNameOrIndex, opts) {
|
|
3094
3091
|
const agents = await getAgents(opts);
|
|
@@ -3138,33 +3135,21 @@ async function listAgents(opts) {
|
|
|
3138
3135
|
}
|
|
3139
3136
|
|
|
3140
3137
|
// src/commands/agent/actions/crud.ts
|
|
3141
|
-
async function safeJsonParse(response) {
|
|
3142
|
-
try {
|
|
3143
|
-
return await response.json();
|
|
3144
|
-
} catch (error) {
|
|
3145
|
-
console.error("Failed to parse response as JSON:", error);
|
|
3146
|
-
return null;
|
|
3147
|
-
}
|
|
3148
|
-
}
|
|
3149
|
-
async function handleErrorResponse(response, defaultMessage) {
|
|
3150
|
-
const errorData = await safeJsonParse(response);
|
|
3151
|
-
throw new Error(errorData?.error?.message || defaultMessage);
|
|
3152
|
-
}
|
|
3153
3138
|
async function getAgent(opts) {
|
|
3154
3139
|
try {
|
|
3155
3140
|
const resolvedAgentId = await resolveAgentId(opts.name, opts);
|
|
3156
|
-
const
|
|
3141
|
+
const config = createApiClientConfig(opts);
|
|
3142
|
+
const agentsService = new AgentsService2(config);
|
|
3157
3143
|
console.info(`Getting agent ${resolvedAgentId}`);
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
throw new Error("Failed to parse agent data from server response");
|
|
3144
|
+
let agentId;
|
|
3145
|
+
try {
|
|
3146
|
+
agentId = asUUID(resolvedAgentId);
|
|
3147
|
+
} catch (error) {
|
|
3148
|
+
throw new Error(
|
|
3149
|
+
`Invalid agent ID format: ${resolvedAgentId}. Please provide a valid UUID, agent name, or index.`
|
|
3150
|
+
);
|
|
3166
3151
|
}
|
|
3167
|
-
const agent2 =
|
|
3152
|
+
const agent2 = await agentsService.getAgent(agentId);
|
|
3168
3153
|
if (!agent2) {
|
|
3169
3154
|
throw new Error("No agent data received from server");
|
|
3170
3155
|
}
|
|
@@ -3190,14 +3175,18 @@ async function getAgent(opts) {
|
|
|
3190
3175
|
async function removeAgent(opts) {
|
|
3191
3176
|
try {
|
|
3192
3177
|
const resolvedAgentId = await resolveAgentId(opts.name, opts);
|
|
3193
|
-
const
|
|
3178
|
+
const config = createApiClientConfig(opts);
|
|
3179
|
+
const agentsService = new AgentsService2(config);
|
|
3194
3180
|
console.info(`Removing agent ${resolvedAgentId}`);
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3181
|
+
let agentId;
|
|
3182
|
+
try {
|
|
3183
|
+
agentId = asUUID(resolvedAgentId);
|
|
3184
|
+
} catch (error) {
|
|
3185
|
+
throw new Error(
|
|
3186
|
+
`Invalid agent ID format: ${resolvedAgentId}. Please provide a valid UUID, agent name, or index.`
|
|
3187
|
+
);
|
|
3200
3188
|
}
|
|
3189
|
+
await agentsService.deleteAgent(agentId);
|
|
3201
3190
|
console.log(`Successfully removed agent ${opts.name}`);
|
|
3202
3191
|
return;
|
|
3203
3192
|
} catch (error) {
|
|
@@ -3208,19 +3197,19 @@ async function removeAgent(opts) {
|
|
|
3208
3197
|
async function clearAgentMemories(opts) {
|
|
3209
3198
|
try {
|
|
3210
3199
|
const resolvedAgentId = await resolveAgentId(opts.name, opts);
|
|
3211
|
-
const
|
|
3200
|
+
const config = createApiClientConfig(opts);
|
|
3201
|
+
const memoryService = new MemoryService(config);
|
|
3212
3202
|
console.info(`Clearing all memories for agent ${resolvedAgentId}`);
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3203
|
+
let agentId;
|
|
3204
|
+
try {
|
|
3205
|
+
agentId = asUUID(resolvedAgentId);
|
|
3206
|
+
} catch (error) {
|
|
3207
|
+
throw new Error(
|
|
3208
|
+
`Invalid agent ID format: ${resolvedAgentId}. Please provide a valid UUID, agent name, or index.`
|
|
3209
|
+
);
|
|
3218
3210
|
}
|
|
3219
|
-
const
|
|
3220
|
-
|
|
3221
|
-
console.log(
|
|
3222
|
-
`Successfully cleared ${result?.deletedCount || 0} memories for agent ${opts.name}`
|
|
3223
|
-
);
|
|
3211
|
+
const result = await memoryService.clearAgentMemories(agentId);
|
|
3212
|
+
console.log(`Successfully cleared ${result?.deleted || 0} memories for agent ${opts.name}`);
|
|
3224
3213
|
return;
|
|
3225
3214
|
} catch (error) {
|
|
3226
3215
|
await checkServer(opts);
|
|
@@ -3251,20 +3240,20 @@ async function setAgentConfig(opts) {
|
|
|
3251
3240
|
} else {
|
|
3252
3241
|
throw new Error("Please provide either a config JSON string (-c) or a config file path (-f)");
|
|
3253
3242
|
}
|
|
3254
|
-
const
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
`Failed to update agent configuration: ${response.statusText}`
|
|
3243
|
+
const clientConfig = createApiClientConfig(opts);
|
|
3244
|
+
const agentsService = new AgentsService2(clientConfig);
|
|
3245
|
+
let agentId;
|
|
3246
|
+
try {
|
|
3247
|
+
agentId = asUUID(resolvedAgentId);
|
|
3248
|
+
} catch (error) {
|
|
3249
|
+
throw new Error(
|
|
3250
|
+
`Invalid agent ID format: ${resolvedAgentId}. Please provide a valid UUID, agent name, or index.`
|
|
3263
3251
|
);
|
|
3264
3252
|
}
|
|
3265
|
-
const
|
|
3266
|
-
|
|
3267
|
-
|
|
3253
|
+
const updatedAgent = await agentsService.updateAgent(agentId, config);
|
|
3254
|
+
console.log(
|
|
3255
|
+
`Successfully updated configuration for agent ${updatedAgent?.id || resolvedAgentId}`
|
|
3256
|
+
);
|
|
3268
3257
|
} catch (error) {
|
|
3269
3258
|
await checkServer(opts);
|
|
3270
3259
|
handleError(error);
|
|
@@ -3272,10 +3261,13 @@ async function setAgentConfig(opts) {
|
|
|
3272
3261
|
}
|
|
3273
3262
|
|
|
3274
3263
|
// src/commands/agent/actions/lifecycle.ts
|
|
3275
|
-
import { logger as
|
|
3264
|
+
import { logger as logger11, asUUID as asUUID2 } from "@elizaos/core";
|
|
3276
3265
|
import { existsSync as existsSync10, readFileSync as readFileSync6 } from "fs";
|
|
3277
3266
|
import path12 from "path";
|
|
3267
|
+
import { AgentsService as AgentsService3 } from "@elizaos/api-client";
|
|
3278
3268
|
async function startAgent(options) {
|
|
3269
|
+
const config = createApiClientConfig(options);
|
|
3270
|
+
const agentsService = new AgentsService3(config);
|
|
3279
3271
|
try {
|
|
3280
3272
|
const hasValidInput = options.path || options.remoteCharacter || options.name && options.name !== true && options.name !== "";
|
|
3281
3273
|
if (!hasValidInput) {
|
|
@@ -3296,26 +3288,17 @@ async function startAgent(options) {
|
|
|
3296
3288
|
}
|
|
3297
3289
|
const response = await (async () => {
|
|
3298
3290
|
const payload = {};
|
|
3299
|
-
const headers = { "Content-Type": "application/json" };
|
|
3300
|
-
const baseUrl = getAgentsBaseUrl(options);
|
|
3301
3291
|
let characterName = null;
|
|
3302
3292
|
async function createCharacter(payload2) {
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
logger12.error(`Server returned ${response2.status}: ${errorText}`);
|
|
3311
|
-
return null;
|
|
3312
|
-
}
|
|
3313
|
-
const data2 = await response2.json();
|
|
3314
|
-
if (!data2?.data?.character?.name) {
|
|
3315
|
-
logger12.error(`Unexpected response format:`, data2);
|
|
3293
|
+
try {
|
|
3294
|
+
const agent2 = await agentsService.createAgent(payload2);
|
|
3295
|
+
return agent2.name || agent2.id;
|
|
3296
|
+
} catch (error) {
|
|
3297
|
+
logger11.error(
|
|
3298
|
+
`Failed to create agent: ${error instanceof Error ? error.message : String(error)}`
|
|
3299
|
+
);
|
|
3316
3300
|
return null;
|
|
3317
3301
|
}
|
|
3318
|
-
return data2.data.character.name;
|
|
3319
3302
|
}
|
|
3320
3303
|
if (options.path) {
|
|
3321
3304
|
try {
|
|
@@ -3327,7 +3310,7 @@ async function startAgent(options) {
|
|
|
3327
3310
|
payload.characterJson = JSON.parse(fileContent);
|
|
3328
3311
|
characterName = await createCharacter(payload);
|
|
3329
3312
|
if (!characterName) {
|
|
3330
|
-
|
|
3313
|
+
logger11.error("Failed to create character from file. Check server logs for details.");
|
|
3331
3314
|
}
|
|
3332
3315
|
} catch (error) {
|
|
3333
3316
|
console.error("Error reading or parsing local JSON file:", error);
|
|
@@ -3344,7 +3327,7 @@ async function startAgent(options) {
|
|
|
3344
3327
|
payload.characterPath = options.remoteCharacter;
|
|
3345
3328
|
characterName = await createCharacter(payload);
|
|
3346
3329
|
if (!characterName) {
|
|
3347
|
-
|
|
3330
|
+
logger11.error(
|
|
3348
3331
|
"Failed to create character from remote URL. Check server logs for details."
|
|
3349
3332
|
);
|
|
3350
3333
|
}
|
|
@@ -3355,20 +3338,18 @@ async function startAgent(options) {
|
|
|
3355
3338
|
if (characterName) {
|
|
3356
3339
|
try {
|
|
3357
3340
|
const agentId = await resolveAgentId(characterName, options);
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
headers
|
|
3361
|
-
});
|
|
3341
|
+
const result2 = await agentsService.startAgent(asUUID2(agentId));
|
|
3342
|
+
return { ok: true, json: async () => ({ data: result2 }) };
|
|
3362
3343
|
} catch (error) {
|
|
3363
3344
|
throw error;
|
|
3364
3345
|
}
|
|
3365
3346
|
}
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
}
|
|
3347
|
+
try {
|
|
3348
|
+
const agent2 = await agentsService.createAgent({});
|
|
3349
|
+
return { ok: true, json: async () => ({ data: agent2 }) };
|
|
3350
|
+
} catch (error) {
|
|
3351
|
+
throw error;
|
|
3352
|
+
}
|
|
3372
3353
|
})();
|
|
3373
3354
|
if (!response.ok) {
|
|
3374
3355
|
let errorData = null;
|
|
@@ -3424,6 +3405,8 @@ You can create a new agent with: elizaos create -t agent ${agentName.toLowerCase
|
|
|
3424
3405
|
}
|
|
3425
3406
|
}
|
|
3426
3407
|
async function stopAgent(opts) {
|
|
3408
|
+
const config = createApiClientConfig(opts);
|
|
3409
|
+
const agentsService = new AgentsService3(config);
|
|
3427
3410
|
try {
|
|
3428
3411
|
const hasValidName = opts.name && opts.name !== true && opts.name !== "";
|
|
3429
3412
|
if (!hasValidName && !opts.all) {
|
|
@@ -3434,11 +3417,11 @@ async function stopAgent(opts) {
|
|
|
3434
3417
|
process.exit(1);
|
|
3435
3418
|
}
|
|
3436
3419
|
if (opts.all) {
|
|
3437
|
-
|
|
3420
|
+
logger11.info("Stopping all ElizaOS agents...");
|
|
3438
3421
|
if (process.platform === "win32") {
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3422
|
+
logger11.error("The --all flag requires Unix-like commands (pgrep, kill).");
|
|
3423
|
+
logger11.error("On Windows, please use WSL 2 or stop agents individually with --name.");
|
|
3424
|
+
logger11.error("See: https://learn.microsoft.com/en-us/windows/wsl/install-manual");
|
|
3442
3425
|
process.exit(1);
|
|
3443
3426
|
}
|
|
3444
3427
|
try {
|
|
@@ -3458,9 +3441,9 @@ async function stopAgent(opts) {
|
|
|
3458
3441
|
} catch (pgrepError) {
|
|
3459
3442
|
}
|
|
3460
3443
|
}
|
|
3461
|
-
|
|
3444
|
+
logger11.success("All ElizaOS agents stopped successfully!");
|
|
3462
3445
|
} catch (error) {
|
|
3463
|
-
|
|
3446
|
+
logger11.error(
|
|
3464
3447
|
`Error stopping processes: ${error instanceof Error ? error.message : String(error)}`
|
|
3465
3448
|
);
|
|
3466
3449
|
process.exit(1);
|
|
@@ -3468,14 +3451,9 @@ async function stopAgent(opts) {
|
|
|
3468
3451
|
return;
|
|
3469
3452
|
}
|
|
3470
3453
|
const resolvedAgentId = await resolveAgentId(opts.name, opts);
|
|
3471
|
-
const baseUrl = getAgentsBaseUrl(opts);
|
|
3472
3454
|
console.info(`Stopping agent ${resolvedAgentId}`);
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
const errorData = await response.json();
|
|
3476
|
-
throw new Error(errorData.error?.message || `Failed to stop agent: ${response.statusText}`);
|
|
3477
|
-
}
|
|
3478
|
-
logger12.success(`Successfully stopped agent ${opts.name}`);
|
|
3455
|
+
await agentsService.stopAgent(asUUID2(resolvedAgentId));
|
|
3456
|
+
logger11.success(`Successfully stopped agent ${opts.name}`);
|
|
3479
3457
|
console.log(`Agent ${opts.name} stopped successfully!`);
|
|
3480
3458
|
} catch (error) {
|
|
3481
3459
|
await checkServer(opts);
|
|
@@ -3485,9 +3463,9 @@ async function stopAgent(opts) {
|
|
|
3485
3463
|
|
|
3486
3464
|
// src/commands/agent/index.ts
|
|
3487
3465
|
var agent = new Command().name("agent").description("Manage ElizaOS agents");
|
|
3488
|
-
agent.command("list").alias("ls").description("List available agents").option("-j, --json", "output as JSON").option("-r, --remote-url <url>", "URL of the remote agent runtime").option("-p, --port <port>", "Port to listen on", (val) => Number.parseInt(val)).action(listAgents);
|
|
3489
|
-
agent.command("get").alias("g").description("Get agent details").requiredOption("-n, --name <name>", "agent id, name, or index number from list").option("-j, --json", "display agent configuration as JSON in the console").option("-o, --output [file]", "save agent config to JSON (defaults to {name}.json)").option("-r, --remote-url <url>", "URL of the remote agent runtime").option("-p, --port <port>", "Port to listen on", (val) => Number.parseInt(val)).action(getAgent);
|
|
3490
|
-
agent.command("start").alias("s").description("Start an agent with a character profile").option("-n, --name <name>", "Name of an existing agent to start").option("--path <path>", "Path to local character JSON file").option("--remote-character <url>", "URL to remote character JSON file").option("-r, --remote-url <url>", "URL of the remote agent runtime").option("-p, --port <port>", "Port to listen on", (val) => Number.parseInt(val)).addHelpText(
|
|
3466
|
+
agent.command("list").alias("ls").description("List available agents").option("-j, --json", "output as JSON").option("-r, --remote-url <url>", "URL of the remote agent runtime").option("-p, --port <port>", "Port to listen on", (val) => Number.parseInt(val)).option("--auth-token <token>", "API authentication token").action(listAgents);
|
|
3467
|
+
agent.command("get").alias("g").description("Get agent details").requiredOption("-n, --name <name>", "agent id, name, or index number from list").option("-j, --json", "display agent configuration as JSON in the console").option("-o, --output [file]", "save agent config to JSON (defaults to {name}.json)").option("-r, --remote-url <url>", "URL of the remote agent runtime").option("-p, --port <port>", "Port to listen on", (val) => Number.parseInt(val)).option("--auth-token <token>", "API authentication token").action(getAgent);
|
|
3468
|
+
agent.command("start").alias("s").description("Start an agent with a character profile").option("-n, --name <name>", "Name of an existing agent to start").option("--path <path>", "Path to local character JSON file").option("--remote-character <url>", "URL to remote character JSON file").option("-r, --remote-url <url>", "URL of the remote agent runtime").option("-p, --port <port>", "Port to listen on", (val) => Number.parseInt(val)).option("--auth-token <token>", "API authentication token").addHelpText(
|
|
3491
3469
|
"after",
|
|
3492
3470
|
`
|
|
3493
3471
|
Examples:
|
|
@@ -3520,46 +3498,49 @@ Required configuration:
|
|
|
3520
3498
|
throw error;
|
|
3521
3499
|
}
|
|
3522
3500
|
});
|
|
3523
|
-
agent.command("stop").alias("st").description("Stop an agent").option("-n, --name <name>", "agent id, name, or index number from list").option("--all", "stop all running agents").option("-r, --remote-url <url>", "URL of the remote agent runtime").option("-p, --port <port>", "Port to listen on", (val) => Number.parseInt(val)).action(stopAgent);
|
|
3524
|
-
agent.command("remove").alias("rm").description("Remove an agent").requiredOption("-n, --name <name>", "agent id, name, or index number from list").option("-r, --remote-url <url>", "URL of the remote agent runtime").option("-p, --port <port>", "Port to listen on", (val) => Number.parseInt(val)).action(removeAgent);
|
|
3525
|
-
agent.command("set").description("Update agent configuration").requiredOption("-n, --name <name>", "agent id, name, or index number from list").option("-c, --config <json>", "agent configuration as JSON string").option("-f, --file <path>", "path to agent configuration JSON file").option("-r, --remote-url <url>", "URL of the remote agent runtime").option("-p, --port <port>", "Port to listen on", (val) => Number.parseInt(val)).action(setAgentConfig);
|
|
3526
|
-
agent.command("clear-memories").alias("clear").description("Clear all memories for an agent").requiredOption("-n, --name <name>", "agent id, name, or index number from list").option("-r, --remote-url <url>", "URL of the remote agent runtime").option("-p, --port <port>", "Port to listen on", (val) => Number.parseInt(val)).action(clearAgentMemories);
|
|
3501
|
+
agent.command("stop").alias("st").description("Stop an agent").option("-n, --name <name>", "agent id, name, or index number from list").option("--all", "stop all running agents").option("-r, --remote-url <url>", "URL of the remote agent runtime").option("-p, --port <port>", "Port to listen on", (val) => Number.parseInt(val)).option("--auth-token <token>", "API authentication token").action(stopAgent);
|
|
3502
|
+
agent.command("remove").alias("rm").description("Remove an agent").requiredOption("-n, --name <name>", "agent id, name, or index number from list").option("-r, --remote-url <url>", "URL of the remote agent runtime").option("-p, --port <port>", "Port to listen on", (val) => Number.parseInt(val)).option("--auth-token <token>", "API authentication token").action(removeAgent);
|
|
3503
|
+
agent.command("set").description("Update agent configuration").requiredOption("-n, --name <name>", "agent id, name, or index number from list").option("-c, --config <json>", "agent configuration as JSON string").option("-f, --file <path>", "path to agent configuration JSON file").option("-r, --remote-url <url>", "URL of the remote agent runtime").option("-p, --port <port>", "Port to listen on", (val) => Number.parseInt(val)).option("--auth-token <token>", "API authentication token").action(setAgentConfig);
|
|
3504
|
+
agent.command("clear-memories").alias("clear").description("Clear all memories for an agent").requiredOption("-n, --name <name>", "agent id, name, or index number from list").option("-r, --remote-url <url>", "URL of the remote agent runtime").option("-p, --port <port>", "Port to listen on", (val) => Number.parseInt(val)).option("--auth-token <token>", "API authentication token").action(clearAgentMemories);
|
|
3527
3505
|
|
|
3528
3506
|
// src/utils/handle-error.ts
|
|
3529
3507
|
import colors3 from "yoctocolors";
|
|
3530
3508
|
function handleError(error) {
|
|
3531
3509
|
const isNoSpace = error instanceof Error && (error.message.includes("no space left on device") || error.message.includes("ENOSPC")) || typeof error === "string" && (error.includes("no space left on device") || error.includes("ENOSPC"));
|
|
3532
3510
|
if (isNoSpace) {
|
|
3533
|
-
|
|
3511
|
+
logger12.error(
|
|
3534
3512
|
colors3.red("ERROR: No space left on device! Please free up disk space and try again.")
|
|
3535
3513
|
);
|
|
3536
3514
|
if (error instanceof Error) {
|
|
3537
|
-
|
|
3538
|
-
|
|
3515
|
+
logger12.error(colors3.red(error.message));
|
|
3516
|
+
logger12.error(colors3.red(error.stack || ""));
|
|
3539
3517
|
} else {
|
|
3540
|
-
|
|
3518
|
+
logger12.error(colors3.red(String(error)));
|
|
3541
3519
|
}
|
|
3542
3520
|
} else {
|
|
3543
|
-
|
|
3521
|
+
logger12.error("An error occurred:", error);
|
|
3544
3522
|
if (error instanceof Error) {
|
|
3545
|
-
|
|
3546
|
-
|
|
3523
|
+
logger12.error("Error details:", error.message);
|
|
3524
|
+
logger12.error("Stack trace:", error.stack);
|
|
3547
3525
|
} else {
|
|
3548
|
-
|
|
3549
|
-
|
|
3526
|
+
logger12.error("Unknown error type:", typeof error);
|
|
3527
|
+
logger12.error("Error value:", error);
|
|
3550
3528
|
}
|
|
3551
3529
|
}
|
|
3552
3530
|
process.exit(1);
|
|
3553
3531
|
}
|
|
3554
3532
|
async function checkServer(opts) {
|
|
3555
3533
|
try {
|
|
3556
|
-
const
|
|
3534
|
+
const authHeaders = getAuthHeaders(opts);
|
|
3535
|
+
const response = await fetch(`${getAgentRuntimeUrl(opts)}/api/agents`, {
|
|
3536
|
+
headers: authHeaders
|
|
3537
|
+
});
|
|
3557
3538
|
if (!response.ok) {
|
|
3558
3539
|
throw new Error(`Server responded with ${response.status}: ${response.statusText}`);
|
|
3559
3540
|
}
|
|
3560
|
-
|
|
3541
|
+
logger12.success("ElizaOS server is running");
|
|
3561
3542
|
} catch (error) {
|
|
3562
|
-
|
|
3543
|
+
logger12.error("Unable to connect to ElizaOS server, likely not running or not accessible!");
|
|
3563
3544
|
process.exit(1);
|
|
3564
3545
|
}
|
|
3565
3546
|
}
|
|
@@ -3633,17 +3614,17 @@ ${bottomBorder}`);
|
|
|
3633
3614
|
}
|
|
3634
3615
|
|
|
3635
3616
|
// src/utils/install-plugin.ts
|
|
3636
|
-
import { logger as
|
|
3617
|
+
import { logger as logger17 } from "@elizaos/core";
|
|
3637
3618
|
import { existsSync as existsSync14 } from "fs";
|
|
3638
3619
|
import path17 from "path";
|
|
3639
3620
|
|
|
3640
3621
|
// src/utils/load-plugin.ts
|
|
3641
|
-
import { logger as
|
|
3622
|
+
import { logger as logger14 } from "@elizaos/core";
|
|
3642
3623
|
import { existsSync as existsSync12, readFileSync as readFileSync8 } from "fs";
|
|
3643
3624
|
import path15 from "path";
|
|
3644
3625
|
|
|
3645
3626
|
// src/utils/plugin-context.ts
|
|
3646
|
-
import { logger as
|
|
3627
|
+
import { logger as logger13 } from "@elizaos/core";
|
|
3647
3628
|
import { existsSync as existsSync11, readFileSync as readFileSync7 } from "fs";
|
|
3648
3629
|
import path14 from "path";
|
|
3649
3630
|
function normalizeForComparison(name) {
|
|
@@ -3661,7 +3642,7 @@ function detectPluginContext(pluginName) {
|
|
|
3661
3642
|
try {
|
|
3662
3643
|
packageInfo = JSON.parse(readFileSync7(packageJsonPath, "utf-8"));
|
|
3663
3644
|
} catch (error) {
|
|
3664
|
-
|
|
3645
|
+
logger13.debug(`Failed to parse package.json: ${error}`);
|
|
3665
3646
|
return { isLocalDevelopment: false };
|
|
3666
3647
|
}
|
|
3667
3648
|
const normalizedRequestedPlugin = normalizeForComparison(pluginName);
|
|
@@ -3673,9 +3654,9 @@ function detectPluginContext(pluginName) {
|
|
|
3673
3654
|
const mainEntry = packageInfo.main || "dist/index.js";
|
|
3674
3655
|
const localPath = path14.resolve(cwd, mainEntry);
|
|
3675
3656
|
const needsBuild = !existsSync11(localPath);
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3657
|
+
logger13.debug(`Detected local plugin development: ${pluginName}`);
|
|
3658
|
+
logger13.debug(`Expected output: ${localPath}`);
|
|
3659
|
+
logger13.debug(`Needs build: ${needsBuild}`);
|
|
3679
3660
|
return {
|
|
3680
3661
|
isLocalDevelopment: true,
|
|
3681
3662
|
localPath,
|
|
@@ -3691,41 +3672,41 @@ async function ensurePluginBuilt(context) {
|
|
|
3691
3672
|
}
|
|
3692
3673
|
const { packageInfo, localPath } = context;
|
|
3693
3674
|
if (packageInfo.scripts?.build) {
|
|
3694
|
-
|
|
3675
|
+
logger13.info("Plugin not built, attempting to build...");
|
|
3695
3676
|
try {
|
|
3696
3677
|
await buildProject(process.cwd(), true);
|
|
3697
3678
|
if (localPath && existsSync11(localPath)) {
|
|
3698
|
-
|
|
3679
|
+
logger13.success("Plugin built successfully");
|
|
3699
3680
|
return true;
|
|
3700
3681
|
} else {
|
|
3701
|
-
|
|
3682
|
+
logger13.error(`Build completed but expected output not found: ${localPath}`);
|
|
3702
3683
|
return false;
|
|
3703
3684
|
}
|
|
3704
3685
|
} catch (error) {
|
|
3705
|
-
|
|
3686
|
+
logger13.error(`Build failed: ${error}`);
|
|
3706
3687
|
return false;
|
|
3707
3688
|
}
|
|
3708
3689
|
}
|
|
3709
|
-
|
|
3710
|
-
|
|
3690
|
+
logger13.error(`Plugin not built and no build script found in package.json`);
|
|
3691
|
+
logger13.info(`Add a "build" script to package.json or run 'bun run build' manually`);
|
|
3711
3692
|
return false;
|
|
3712
3693
|
}
|
|
3713
3694
|
function provideLocalPluginGuidance(pluginName, context) {
|
|
3714
3695
|
if (!context.isLocalDevelopment) {
|
|
3715
3696
|
return;
|
|
3716
3697
|
}
|
|
3717
|
-
|
|
3698
|
+
logger13.info(`
|
|
3718
3699
|
Local plugin development detected for: ${pluginName}`);
|
|
3719
3700
|
if (context.needsBuild) {
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3701
|
+
logger13.info("To fix this issue:");
|
|
3702
|
+
logger13.info("1. Build the plugin: bun run build");
|
|
3703
|
+
logger13.info("2. Verify the output exists at: " + context.localPath);
|
|
3704
|
+
logger13.info("3. Re-run the test command");
|
|
3724
3705
|
} else {
|
|
3725
|
-
|
|
3726
|
-
|
|
3706
|
+
logger13.info("Plugin appears to be built but failed to load.");
|
|
3707
|
+
logger13.info("Try rebuilding: bun run build");
|
|
3727
3708
|
}
|
|
3728
|
-
|
|
3709
|
+
logger13.info("\nFor more information, see the plugin development guide.");
|
|
3729
3710
|
}
|
|
3730
3711
|
|
|
3731
3712
|
// src/utils/load-plugin.ts
|
|
@@ -3780,7 +3761,7 @@ async function readPackageJson(repository) {
|
|
|
3780
3761
|
return JSON.parse(readFileSync8(packageJsonPath, "utf-8"));
|
|
3781
3762
|
}
|
|
3782
3763
|
} catch (error) {
|
|
3783
|
-
|
|
3764
|
+
logger14.debug(`Failed to read package.json for '${repository}':`, error);
|
|
3784
3765
|
}
|
|
3785
3766
|
return null;
|
|
3786
3767
|
}
|
|
@@ -3799,10 +3780,10 @@ async function tryImporting(importPath, strategy, repository) {
|
|
|
3799
3780
|
try {
|
|
3800
3781
|
const pathToImport = normalizeImportPath(importPath);
|
|
3801
3782
|
const module = await import(pathToImport);
|
|
3802
|
-
|
|
3783
|
+
logger14.success(`Successfully loaded plugin '${repository}' using ${strategy} (${importPath})`);
|
|
3803
3784
|
return module;
|
|
3804
3785
|
} catch (error) {
|
|
3805
|
-
|
|
3786
|
+
logger14.debug(`Import failed using ${strategy} ('${importPath}'):`, error);
|
|
3806
3787
|
return null;
|
|
3807
3788
|
}
|
|
3808
3789
|
}
|
|
@@ -3813,17 +3794,17 @@ var importStrategies = [
|
|
|
3813
3794
|
tryImport: async (repository) => {
|
|
3814
3795
|
const context = detectPluginContext(repository);
|
|
3815
3796
|
if (context.isLocalDevelopment) {
|
|
3816
|
-
|
|
3797
|
+
logger14.debug(`Detected local development for plugin: ${repository}`);
|
|
3817
3798
|
const isBuilt = await ensurePluginBuilt(context);
|
|
3818
3799
|
if (!isBuilt) {
|
|
3819
3800
|
provideLocalPluginGuidance(repository, context);
|
|
3820
3801
|
return null;
|
|
3821
3802
|
}
|
|
3822
3803
|
if (context.localPath && existsSync12(context.localPath)) {
|
|
3823
|
-
|
|
3804
|
+
logger14.info(`Loading local development plugin: ${repository}`);
|
|
3824
3805
|
return tryImporting(context.localPath, "local development plugin", repository);
|
|
3825
3806
|
}
|
|
3826
|
-
|
|
3807
|
+
logger14.warn(`Plugin built but output not found at expected path: ${context.localPath}`);
|
|
3827
3808
|
provideLocalPluginGuidance(repository, context);
|
|
3828
3809
|
return null;
|
|
3829
3810
|
}
|
|
@@ -3857,7 +3838,7 @@ var importStrategies = [
|
|
|
3857
3838
|
tryImport: async (repository) => {
|
|
3858
3839
|
const globalPath = path15.resolve(getGlobalNodeModulesPath(), repository);
|
|
3859
3840
|
if (!existsSync12(path15.dirname(globalPath))) {
|
|
3860
|
-
|
|
3841
|
+
logger14.debug(
|
|
3861
3842
|
`Global node_modules directory not found at ${path15.dirname(globalPath)}, skipping for ${repository}`
|
|
3862
3843
|
);
|
|
3863
3844
|
return null;
|
|
@@ -3907,23 +3888,23 @@ function getStrategiesForPlugin(repository) {
|
|
|
3907
3888
|
async function loadPluginModule(repository) {
|
|
3908
3889
|
const isElizaOS = isElizaOSPackageName(repository);
|
|
3909
3890
|
const strategies = getStrategiesForPlugin(repository);
|
|
3910
|
-
|
|
3891
|
+
logger14.debug(
|
|
3911
3892
|
`Loading ${isElizaOS ? "ElizaOS" : "third-party"} plugin: ${repository} (${strategies.length} strategies)`
|
|
3912
3893
|
);
|
|
3913
3894
|
for (const strategy of strategies) {
|
|
3914
3895
|
const result = await strategy.tryImport(repository);
|
|
3915
3896
|
if (result) return result;
|
|
3916
3897
|
}
|
|
3917
|
-
|
|
3898
|
+
logger14.warn(`Failed to load plugin module '${repository}' using all relevant strategies.`);
|
|
3918
3899
|
return null;
|
|
3919
3900
|
}
|
|
3920
3901
|
|
|
3921
3902
|
// src/utils/package-manager.ts
|
|
3922
|
-
import { logger as
|
|
3903
|
+
import { logger as logger15 } from "@elizaos/core";
|
|
3923
3904
|
import { existsSync as existsSync13 } from "fs";
|
|
3924
3905
|
import path16 from "path";
|
|
3925
3906
|
async function getPackageManager() {
|
|
3926
|
-
|
|
3907
|
+
logger15.debug("[PackageManager] Using bun as the package manager for ElizaOS CLI");
|
|
3927
3908
|
return "bun";
|
|
3928
3909
|
}
|
|
3929
3910
|
async function isGlobalInstallation() {
|
|
@@ -3944,7 +3925,7 @@ function getInstallCommand(isGlobal) {
|
|
|
3944
3925
|
async function removeFromBunLock(packageName, directory) {
|
|
3945
3926
|
const lockFilePath = path16.join(directory, "bun.lock");
|
|
3946
3927
|
if (!existsSync13(lockFilePath)) {
|
|
3947
|
-
|
|
3928
|
+
logger15.debug(`No bun.lock file found at ${lockFilePath}, skipping removal`);
|
|
3948
3929
|
return;
|
|
3949
3930
|
}
|
|
3950
3931
|
try {
|
|
@@ -3952,18 +3933,18 @@ async function removeFromBunLock(packageName, directory) {
|
|
|
3952
3933
|
cwd: directory
|
|
3953
3934
|
});
|
|
3954
3935
|
if (result.success) {
|
|
3955
|
-
|
|
3936
|
+
logger15.debug(`Successfully removed ${packageName} from bun.lock`);
|
|
3956
3937
|
} else {
|
|
3957
3938
|
if (result.stderr?.includes("not found") || result.stderr?.includes("No such package")) {
|
|
3958
|
-
|
|
3939
|
+
logger15.debug(`Package ${packageName} not found in lockfile (expected for cleanup)`);
|
|
3959
3940
|
} else {
|
|
3960
|
-
|
|
3941
|
+
logger15.warn(
|
|
3961
3942
|
`Failed to remove ${packageName} from bun.lock: ${result.stderr || "Unknown error"}`
|
|
3962
3943
|
);
|
|
3963
3944
|
}
|
|
3964
3945
|
}
|
|
3965
3946
|
} catch (error) {
|
|
3966
|
-
|
|
3947
|
+
logger15.warn(`Unexpected error removing ${packageName} from bun.lock: ${error.message}`);
|
|
3967
3948
|
}
|
|
3968
3949
|
}
|
|
3969
3950
|
async function executeInstallation(packageName, versionOrTag = "", directory = process.cwd()) {
|
|
@@ -3981,11 +3962,11 @@ async function executeInstallation(packageName, versionOrTag = "", directory = p
|
|
|
3981
3962
|
return { success: true, installedIdentifier };
|
|
3982
3963
|
} catch (error) {
|
|
3983
3964
|
if (error.code === "ENOENT" || error.message?.includes("bun: command not found")) {
|
|
3984
|
-
|
|
3965
|
+
logger15.warn(
|
|
3985
3966
|
`Installation failed - bun command not found. ${displayBunInstallationTipCompact()}`
|
|
3986
3967
|
);
|
|
3987
3968
|
} else {
|
|
3988
|
-
|
|
3969
|
+
logger15.warn(`Installation failed for ${finalSpecifier}: ${error.message}`);
|
|
3989
3970
|
}
|
|
3990
3971
|
return { success: false, installedIdentifier: null };
|
|
3991
3972
|
}
|
|
@@ -4002,21 +3983,21 @@ async function executeInstallationWithFallback(packageName, versionOrTag = "", d
|
|
|
4002
3983
|
if (result.success || !githubFallback) {
|
|
4003
3984
|
return result;
|
|
4004
3985
|
}
|
|
4005
|
-
|
|
3986
|
+
logger15.debug(`npm installation failed, attempting GitHub fallback: ${githubFallback}`);
|
|
4006
3987
|
await removeFromBunLock(packageName, directory);
|
|
4007
3988
|
const githubSpecifier = `github:${githubFallback}${versionOrTag ? `#${versionOrTag}` : ""}`;
|
|
4008
3989
|
return await executeInstallation(githubSpecifier, "", directory);
|
|
4009
3990
|
}
|
|
4010
3991
|
|
|
4011
3992
|
// src/utils/plugin-discovery.ts
|
|
4012
|
-
import { logger as
|
|
3993
|
+
import { logger as logger16 } from "@elizaos/core";
|
|
4013
3994
|
async function fetchPluginRegistry() {
|
|
4014
3995
|
try {
|
|
4015
3996
|
const resp = await fetch(
|
|
4016
3997
|
"https://raw.githubusercontent.com/elizaos-plugins/registry/refs/heads/main/generated-registry.json"
|
|
4017
3998
|
);
|
|
4018
3999
|
if (!resp.ok) {
|
|
4019
|
-
|
|
4000
|
+
logger16.error(`Failed to fetch plugin registry: ${resp.statusText}`);
|
|
4020
4001
|
throw new Error(`Failed to fetch registry: ${resp.statusText}`);
|
|
4021
4002
|
}
|
|
4022
4003
|
const raw = await resp.json();
|
|
@@ -4040,54 +4021,54 @@ function getCliDirectory() {
|
|
|
4040
4021
|
}
|
|
4041
4022
|
return null;
|
|
4042
4023
|
} catch (error) {
|
|
4043
|
-
|
|
4024
|
+
logger17.error("Failed to determine CLI directory:", error);
|
|
4044
4025
|
return null;
|
|
4045
4026
|
}
|
|
4046
4027
|
}
|
|
4047
4028
|
async function verifyPluginImport(repository, context) {
|
|
4048
4029
|
const loadedModule = await loadPluginModule(repository);
|
|
4049
4030
|
if (loadedModule) {
|
|
4050
|
-
|
|
4031
|
+
logger17.debug(`Successfully verified plugin ${repository} ${context} after installation.`);
|
|
4051
4032
|
return true;
|
|
4052
4033
|
} else {
|
|
4053
|
-
|
|
4034
|
+
logger17.warn(`Plugin ${repository} installed ${context} but could not be loaded/verified.`);
|
|
4054
4035
|
return false;
|
|
4055
4036
|
}
|
|
4056
4037
|
}
|
|
4057
4038
|
async function attemptInstallation(packageName, versionString, directory, context, skipVerification = false) {
|
|
4058
|
-
|
|
4039
|
+
logger17.debug(`Attempting to install plugin ${context}...`);
|
|
4059
4040
|
try {
|
|
4060
4041
|
const installResult = await executeInstallation(packageName, versionString, directory);
|
|
4061
4042
|
if (!installResult.success || !installResult.installedIdentifier) {
|
|
4062
|
-
|
|
4043
|
+
logger17.warn(`Installation failed for plugin ${context}`);
|
|
4063
4044
|
return false;
|
|
4064
4045
|
}
|
|
4065
4046
|
if (packageName.startsWith("github:")) {
|
|
4066
4047
|
return true;
|
|
4067
4048
|
}
|
|
4068
4049
|
if (skipVerification || process.env.ELIZA_SKIP_PLUGIN_VERIFY) {
|
|
4069
|
-
|
|
4050
|
+
logger17.info(
|
|
4070
4051
|
`Installation successful for ${installResult.installedIdentifier}, skipping verification`
|
|
4071
4052
|
);
|
|
4072
4053
|
return true;
|
|
4073
4054
|
}
|
|
4074
|
-
|
|
4055
|
+
logger17.debug(
|
|
4075
4056
|
`Installation successful for ${installResult.installedIdentifier}, verifying import...`
|
|
4076
4057
|
);
|
|
4077
4058
|
return await verifyPluginImport(installResult.installedIdentifier, context);
|
|
4078
4059
|
} catch (installError) {
|
|
4079
|
-
|
|
4060
|
+
logger17.warn(
|
|
4080
4061
|
`Error during installation attempt ${context}: ${installError instanceof Error ? installError.message : String(installError)}`
|
|
4081
4062
|
);
|
|
4082
4063
|
return false;
|
|
4083
4064
|
}
|
|
4084
4065
|
}
|
|
4085
4066
|
async function installPlugin(packageName, cwd, versionSpecifier, skipVerification = false) {
|
|
4086
|
-
|
|
4067
|
+
logger17.debug(`Installing plugin: ${packageName}`);
|
|
4087
4068
|
const context = detectPluginContext(packageName);
|
|
4088
4069
|
if (context.isLocalDevelopment) {
|
|
4089
|
-
|
|
4090
|
-
|
|
4070
|
+
logger17.warn(`Prevented self-installation of plugin ${packageName}`);
|
|
4071
|
+
logger17.info(
|
|
4091
4072
|
`You're developing this plugin locally. Use 'bun run build' to build it instead of installing.`
|
|
4092
4073
|
);
|
|
4093
4074
|
return false;
|
|
@@ -4129,7 +4110,7 @@ async function installPlugin(packageName, cwd, versionSpecifier, skipVerificatio
|
|
|
4129
4110
|
}
|
|
4130
4111
|
}
|
|
4131
4112
|
if (!key) {
|
|
4132
|
-
|
|
4113
|
+
logger17.warn(
|
|
4133
4114
|
`Plugin ${packageName} not found in registry cache, attempting direct installation`
|
|
4134
4115
|
);
|
|
4135
4116
|
return await attemptInstallation(
|
|
@@ -4173,7 +4154,7 @@ async function installPlugin(packageName, cwd, versionSpecifier, skipVerificatio
|
|
|
4173
4154
|
const spec = `github:${info.git.repo}${githubVersion ? `#${githubVersion}` : ""}`;
|
|
4174
4155
|
return await attemptInstallation(spec, "", cliDir, "in CLI directory", skipVerification);
|
|
4175
4156
|
}
|
|
4176
|
-
|
|
4157
|
+
logger17.error(`Failed to install plugin ${packageName}`);
|
|
4177
4158
|
return false;
|
|
4178
4159
|
}
|
|
4179
4160
|
|
|
@@ -4181,7 +4162,7 @@ async function installPlugin(packageName, cwd, versionSpecifier, skipVerificatio
|
|
|
4181
4162
|
import { spawn } from "child_process";
|
|
4182
4163
|
import { existsSync as existsSync15 } from "fs";
|
|
4183
4164
|
import path18 from "path";
|
|
4184
|
-
import { logger as
|
|
4165
|
+
import { logger as logger18 } from "@elizaos/core";
|
|
4185
4166
|
function isRunningFromLocalCli() {
|
|
4186
4167
|
try {
|
|
4187
4168
|
const currentScriptPath = process.argv[1];
|
|
@@ -4197,7 +4178,7 @@ function isRunningFromLocalCli() {
|
|
|
4197
4178
|
const isInLocalCli = path18.resolve(currentScriptPath) === path18.resolve(expectedLocalCliPath);
|
|
4198
4179
|
return isInLocalCli;
|
|
4199
4180
|
} catch (error) {
|
|
4200
|
-
|
|
4181
|
+
logger18.debug("Error checking if running from local CLI:", error);
|
|
4201
4182
|
return false;
|
|
4202
4183
|
}
|
|
4203
4184
|
}
|
|
@@ -4235,7 +4216,7 @@ function setupLocalEnvironment() {
|
|
|
4235
4216
|
}
|
|
4236
4217
|
async function delegateToLocalCli(localCliPath) {
|
|
4237
4218
|
return new Promise((resolve2, reject) => {
|
|
4238
|
-
|
|
4219
|
+
logger18.info("Using local @elizaos/cli installation");
|
|
4239
4220
|
const nodeExecutable = process.execPath;
|
|
4240
4221
|
const args = process.argv.slice(2);
|
|
4241
4222
|
const env = setupLocalEnvironment();
|
|
@@ -4255,7 +4236,7 @@ async function delegateToLocalCli(localCliPath) {
|
|
|
4255
4236
|
resolve2();
|
|
4256
4237
|
});
|
|
4257
4238
|
childProcess.on("error", (error) => {
|
|
4258
|
-
|
|
4239
|
+
logger18.error(`Failed to start local CLI: ${error.message}`);
|
|
4259
4240
|
reject(error);
|
|
4260
4241
|
});
|
|
4261
4242
|
const forwardSignal = (signal) => {
|
|
@@ -4305,27 +4286,31 @@ function isTestOrCiEnvironment() {
|
|
|
4305
4286
|
async function tryDelegateToLocalCli() {
|
|
4306
4287
|
try {
|
|
4307
4288
|
if (isTestOrCiEnvironment()) {
|
|
4308
|
-
|
|
4289
|
+
logger18.debug("Running in test or CI environment, skipping local CLI delegation");
|
|
4309
4290
|
return false;
|
|
4310
4291
|
}
|
|
4311
4292
|
const args = process.argv.slice(2);
|
|
4312
4293
|
if (args.length > 0 && args[0] === "update") {
|
|
4313
|
-
|
|
4294
|
+
logger18.debug("Update command detected, skipping local CLI delegation");
|
|
4295
|
+
return false;
|
|
4296
|
+
}
|
|
4297
|
+
if (args.length > 0 && (args[0] === "-v" || args[0] === "--version")) {
|
|
4298
|
+
logger18.debug("Version command detected, skipping local CLI delegation");
|
|
4314
4299
|
return false;
|
|
4315
4300
|
}
|
|
4316
4301
|
if (isRunningFromLocalCli()) {
|
|
4317
|
-
|
|
4302
|
+
logger18.debug("Already running from local CLI, continuing execution");
|
|
4318
4303
|
return false;
|
|
4319
4304
|
}
|
|
4320
4305
|
const localCliPath = getLocalCliPath();
|
|
4321
4306
|
if (!localCliPath) {
|
|
4322
|
-
|
|
4307
|
+
logger18.debug("No local CLI found, using global installation");
|
|
4323
4308
|
return false;
|
|
4324
4309
|
}
|
|
4325
4310
|
if (process.env._ELIZA_CLI_DELEGATION_DEPTH) {
|
|
4326
4311
|
const depth = parseInt(process.env._ELIZA_CLI_DELEGATION_DEPTH, 10);
|
|
4327
4312
|
if (depth > 0) {
|
|
4328
|
-
|
|
4313
|
+
logger18.debug("Delegation depth exceeded, preventing infinite loop");
|
|
4329
4314
|
return false;
|
|
4330
4315
|
}
|
|
4331
4316
|
}
|
|
@@ -4333,8 +4318,8 @@ async function tryDelegateToLocalCli() {
|
|
|
4333
4318
|
await delegateToLocalCli(localCliPath);
|
|
4334
4319
|
return true;
|
|
4335
4320
|
} catch (error) {
|
|
4336
|
-
|
|
4337
|
-
|
|
4321
|
+
logger18.error("Error during local CLI delegation:", error);
|
|
4322
|
+
logger18.info("Falling back to global CLI installation");
|
|
4338
4323
|
return false;
|
|
4339
4324
|
}
|
|
4340
4325
|
}
|
|
@@ -4353,7 +4338,7 @@ function getCliContext() {
|
|
|
4353
4338
|
// src/utils/module-loader.ts
|
|
4354
4339
|
import { createRequire } from "module";
|
|
4355
4340
|
import { pathToFileURL } from "url";
|
|
4356
|
-
import { logger as
|
|
4341
|
+
import { logger as logger19 } from "@elizaos/core";
|
|
4357
4342
|
import path19 from "path";
|
|
4358
4343
|
import { existsSync as existsSync16 } from "fs";
|
|
4359
4344
|
var ModuleLoader = class {
|
|
@@ -4372,10 +4357,10 @@ var ModuleLoader = class {
|
|
|
4372
4357
|
detectProjectPath() {
|
|
4373
4358
|
const monorepoRoot = UserEnvironment.getInstance().findMonorepoRoot(process.cwd());
|
|
4374
4359
|
if (monorepoRoot) {
|
|
4375
|
-
|
|
4360
|
+
logger19.debug(`Using monorepo root: ${monorepoRoot}`);
|
|
4376
4361
|
return monorepoRoot;
|
|
4377
4362
|
}
|
|
4378
|
-
|
|
4363
|
+
logger19.debug(`Using current working directory: ${process.cwd()}`);
|
|
4379
4364
|
return process.cwd();
|
|
4380
4365
|
}
|
|
4381
4366
|
/**
|
|
@@ -4388,29 +4373,29 @@ var ModuleLoader = class {
|
|
|
4388
4373
|
*/
|
|
4389
4374
|
async load(moduleName) {
|
|
4390
4375
|
if (this.asyncCache.has(moduleName)) {
|
|
4391
|
-
|
|
4376
|
+
logger19.debug(`Using cached module: ${moduleName}`);
|
|
4392
4377
|
return this.asyncCache.get(moduleName);
|
|
4393
4378
|
}
|
|
4394
4379
|
try {
|
|
4395
4380
|
const localModulePath = path19.join(this.projectPath, "node_modules", moduleName);
|
|
4396
4381
|
const isLocalModule = existsSync16(localModulePath);
|
|
4397
4382
|
if (isLocalModule) {
|
|
4398
|
-
|
|
4383
|
+
logger19.info(`Using local ${moduleName} installation`);
|
|
4399
4384
|
} else {
|
|
4400
|
-
|
|
4385
|
+
logger19.info(`Using global ${moduleName} installation`);
|
|
4401
4386
|
}
|
|
4402
4387
|
const modulePath = this.require.resolve(moduleName);
|
|
4403
|
-
|
|
4388
|
+
logger19.debug(`Loading ${moduleName} from: ${modulePath}`);
|
|
4404
4389
|
if (isLocalModule && !modulePath.includes(this.projectPath)) {
|
|
4405
|
-
|
|
4390
|
+
logger19.warn(`Expected local module but resolved to global: ${modulePath}`);
|
|
4406
4391
|
}
|
|
4407
4392
|
const module = await import(pathToFileURL(modulePath).href);
|
|
4408
4393
|
this.asyncCache.set(moduleName, module);
|
|
4409
|
-
|
|
4394
|
+
logger19.info(`Loaded ${moduleName} from ${isLocalModule ? "local" : "global"} installation`);
|
|
4410
4395
|
return module;
|
|
4411
4396
|
} catch (error) {
|
|
4412
4397
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
4413
|
-
|
|
4398
|
+
logger19.error(`Failed to load module ${moduleName}: ${errorMessage}`);
|
|
4414
4399
|
throw new Error(
|
|
4415
4400
|
`Cannot find module '${moduleName}' in project at ${this.projectPath}.
|
|
4416
4401
|
Please ensure it's installed by running:
|
|
@@ -4430,29 +4415,29 @@ Original error: ${errorMessage}`
|
|
|
4430
4415
|
*/
|
|
4431
4416
|
loadSync(moduleName) {
|
|
4432
4417
|
if (this.syncCache.has(moduleName)) {
|
|
4433
|
-
|
|
4418
|
+
logger19.debug(`Using cached module: ${moduleName}`);
|
|
4434
4419
|
return this.syncCache.get(moduleName);
|
|
4435
4420
|
}
|
|
4436
4421
|
try {
|
|
4437
4422
|
const localModulePath = path19.join(this.projectPath, "node_modules", moduleName);
|
|
4438
4423
|
const isLocalModule = existsSync16(localModulePath);
|
|
4439
4424
|
if (isLocalModule) {
|
|
4440
|
-
|
|
4425
|
+
logger19.info(`Using local ${moduleName} installation`);
|
|
4441
4426
|
} else {
|
|
4442
|
-
|
|
4427
|
+
logger19.info(`Using global ${moduleName} installation`);
|
|
4443
4428
|
}
|
|
4444
4429
|
const modulePath = this.require.resolve(moduleName);
|
|
4445
|
-
|
|
4430
|
+
logger19.debug(`Loading ${moduleName} from: ${modulePath}`);
|
|
4446
4431
|
if (isLocalModule && !modulePath.includes(this.projectPath)) {
|
|
4447
|
-
|
|
4432
|
+
logger19.warn(`Expected local module but resolved to global: ${modulePath}`);
|
|
4448
4433
|
}
|
|
4449
4434
|
const module = this.require(modulePath);
|
|
4450
4435
|
this.syncCache.set(moduleName, module);
|
|
4451
|
-
|
|
4436
|
+
logger19.info(`Loaded ${moduleName} from ${isLocalModule ? "local" : "global"} installation`);
|
|
4452
4437
|
return module;
|
|
4453
4438
|
} catch (error) {
|
|
4454
4439
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
4455
|
-
|
|
4440
|
+
logger19.error(`Failed to load module ${moduleName}: ${errorMessage}`);
|
|
4456
4441
|
throw new Error(
|
|
4457
4442
|
`Cannot find module '${moduleName}' in project at ${this.projectPath}.
|
|
4458
4443
|
Please ensure it's installed by running:
|
|
@@ -4538,22 +4523,22 @@ async function findNextAvailablePort(startPort) {
|
|
|
4538
4523
|
}
|
|
4539
4524
|
|
|
4540
4525
|
// src/utils/publisher.ts
|
|
4541
|
-
import { logger as
|
|
4526
|
+
import { logger as logger20 } from "@elizaos/core";
|
|
4542
4527
|
async function testPublishToNpm(cwd) {
|
|
4543
4528
|
try {
|
|
4544
4529
|
await bunExec("npm", ["whoami"]);
|
|
4545
|
-
|
|
4546
|
-
|
|
4530
|
+
logger20.info("[\u2713] Logged in to npm");
|
|
4531
|
+
logger20.info("Testing build...");
|
|
4547
4532
|
await bunExec("npm", ["run", "build", "--dry-run"], { cwd });
|
|
4548
|
-
|
|
4533
|
+
logger20.info("[\u2713] Build test successful");
|
|
4549
4534
|
await bunExec("npm", ["access", "ls-packages"], { cwd });
|
|
4550
|
-
|
|
4535
|
+
logger20.info("[\u2713] Have publish permissions");
|
|
4551
4536
|
return true;
|
|
4552
4537
|
} catch (error) {
|
|
4553
|
-
|
|
4538
|
+
logger20.error("Test failed:", error);
|
|
4554
4539
|
if (error instanceof Error) {
|
|
4555
|
-
|
|
4556
|
-
|
|
4540
|
+
logger20.error(`Error message: ${error.message}`);
|
|
4541
|
+
logger20.error(`Error stack: ${error.stack}`);
|
|
4557
4542
|
}
|
|
4558
4543
|
return false;
|
|
4559
4544
|
}
|
|
@@ -4562,53 +4547,53 @@ async function testPublishToGitHub(packageJson, username) {
|
|
|
4562
4547
|
try {
|
|
4563
4548
|
const credentials = await getGitHubCredentials();
|
|
4564
4549
|
if (!credentials) {
|
|
4565
|
-
|
|
4550
|
+
logger20.error("Failed to get GitHub credentials");
|
|
4566
4551
|
return false;
|
|
4567
4552
|
}
|
|
4568
4553
|
const token = credentials.token;
|
|
4569
|
-
|
|
4554
|
+
logger20.info("[\u2713] GitHub credentials found");
|
|
4570
4555
|
const response = await fetch("https://api.github.com/user", {
|
|
4571
4556
|
headers: { Authorization: `token ${token}` }
|
|
4572
4557
|
});
|
|
4573
4558
|
if (!response.ok) {
|
|
4574
|
-
|
|
4559
|
+
logger20.error("Invalid GitHub token or insufficient permissions");
|
|
4575
4560
|
return false;
|
|
4576
4561
|
}
|
|
4577
|
-
|
|
4562
|
+
logger20.info("[\u2713] GitHub token is valid");
|
|
4578
4563
|
if (packageJson.packageType === "project") {
|
|
4579
|
-
|
|
4564
|
+
logger20.info("[\u2713] Project validation complete - GitHub token is valid");
|
|
4580
4565
|
return true;
|
|
4581
4566
|
}
|
|
4582
4567
|
const settings = await getRegistrySettings();
|
|
4583
4568
|
const [registryOwner, registryRepo] = settings.defaultRegistry.split("/");
|
|
4584
|
-
|
|
4569
|
+
logger20.info(`Testing with registry: ${registryOwner}/${registryRepo}`);
|
|
4585
4570
|
const hasFork = await forkExists(token, registryRepo, username);
|
|
4586
|
-
|
|
4571
|
+
logger20.info(hasFork ? "[\u2713] Fork exists" : "[\u2713] Can create fork");
|
|
4587
4572
|
if (!hasFork) {
|
|
4588
|
-
|
|
4573
|
+
logger20.info("Creating fork...");
|
|
4589
4574
|
const forkCreated = await forkRepository(token, registryOwner, registryRepo);
|
|
4590
4575
|
if (!forkCreated) {
|
|
4591
|
-
|
|
4576
|
+
logger20.error("Failed to create fork");
|
|
4592
4577
|
return false;
|
|
4593
4578
|
}
|
|
4594
|
-
|
|
4579
|
+
logger20.info("[\u2713] Fork created");
|
|
4595
4580
|
await new Promise((resolve2) => setTimeout(resolve2, 3e3));
|
|
4596
4581
|
}
|
|
4597
4582
|
const branchName = `test-${packageJson.name.replace(/^@[^/]+\//, "")}-${packageJson.version}`;
|
|
4598
4583
|
const hasBranch = await branchExists(token, username, registryRepo, branchName);
|
|
4599
|
-
|
|
4584
|
+
logger20.info(hasBranch ? "[\u2713] Test branch exists" : "[\u2713] Can create branch");
|
|
4600
4585
|
if (!hasBranch) {
|
|
4601
|
-
|
|
4586
|
+
logger20.info("Creating branch...");
|
|
4602
4587
|
const branchCreated = await createBranch(token, username, registryRepo, branchName, "main");
|
|
4603
4588
|
if (!branchCreated) {
|
|
4604
|
-
|
|
4589
|
+
logger20.error("Failed to create branch");
|
|
4605
4590
|
return false;
|
|
4606
4591
|
}
|
|
4607
|
-
|
|
4592
|
+
logger20.info("[\u2713] Branch created");
|
|
4608
4593
|
}
|
|
4609
4594
|
const simpleName = packageJson.name.replace(/^@[^/]+\//, "").replace(/[^a-zA-Z0-9-]/g, "-");
|
|
4610
4595
|
const testPath = `test-files/${simpleName}-test.json`;
|
|
4611
|
-
|
|
4596
|
+
logger20.info(`Attempting to create test file: ${testPath} in branch: ${branchName}`);
|
|
4612
4597
|
const dirCreated = await ensureDirectory(
|
|
4613
4598
|
token,
|
|
4614
4599
|
`${username}/${registryRepo}`,
|
|
@@ -4616,7 +4601,7 @@ async function testPublishToGitHub(packageJson, username) {
|
|
|
4616
4601
|
branchName
|
|
4617
4602
|
);
|
|
4618
4603
|
if (!dirCreated) {
|
|
4619
|
-
|
|
4604
|
+
logger20.warn("Failed to create test directory, but continuing with file creation");
|
|
4620
4605
|
}
|
|
4621
4606
|
const canUpdate = await updateFile(
|
|
4622
4607
|
token,
|
|
@@ -4629,53 +4614,53 @@ async function testPublishToGitHub(packageJson, username) {
|
|
|
4629
4614
|
// Use the test branch instead of main
|
|
4630
4615
|
);
|
|
4631
4616
|
if (!canUpdate) {
|
|
4632
|
-
|
|
4617
|
+
logger20.error("Cannot update files in repository");
|
|
4633
4618
|
return false;
|
|
4634
4619
|
}
|
|
4635
|
-
|
|
4620
|
+
logger20.info("[\u2713] Can create and update files");
|
|
4636
4621
|
return true;
|
|
4637
4622
|
} catch (error) {
|
|
4638
|
-
|
|
4623
|
+
logger20.error("Test failed:", error);
|
|
4639
4624
|
return false;
|
|
4640
4625
|
}
|
|
4641
4626
|
}
|
|
4642
4627
|
async function publishToNpm(cwd) {
|
|
4643
4628
|
try {
|
|
4644
4629
|
await bunExec("npm", ["whoami"]);
|
|
4645
|
-
|
|
4630
|
+
logger20.info("Building package...");
|
|
4646
4631
|
await bunExecInherit("npm", ["run", "build"], { cwd });
|
|
4647
|
-
|
|
4632
|
+
logger20.info("Publishing to npm...");
|
|
4648
4633
|
await bunExecInherit("npm", ["publish"], { cwd });
|
|
4649
4634
|
return true;
|
|
4650
4635
|
} catch (error) {
|
|
4651
|
-
|
|
4636
|
+
logger20.error("Failed to publish to npm:", error);
|
|
4652
4637
|
return false;
|
|
4653
4638
|
}
|
|
4654
4639
|
}
|
|
4655
4640
|
async function publishToGitHub(cwd, packageJson, username, skipRegistry = false, isTest = false) {
|
|
4656
4641
|
const credentials = await getGitHubCredentials();
|
|
4657
4642
|
if (!credentials) {
|
|
4658
|
-
|
|
4643
|
+
logger20.error("Failed to get GitHub credentials");
|
|
4659
4644
|
return false;
|
|
4660
4645
|
}
|
|
4661
4646
|
const token = credentials.token;
|
|
4662
4647
|
if (!packageJson.packageType) {
|
|
4663
|
-
|
|
4648
|
+
logger20.error(
|
|
4664
4649
|
'Package type is required. Set "packageType" to either "plugin" or "project" in package.json'
|
|
4665
4650
|
);
|
|
4666
4651
|
return false;
|
|
4667
4652
|
}
|
|
4668
4653
|
if (packageJson.packageType !== "plugin" && packageJson.packageType !== "project") {
|
|
4669
|
-
|
|
4654
|
+
logger20.error(
|
|
4670
4655
|
`Invalid package type: ${packageJson.packageType}. Must be either "plugin" or "project"`
|
|
4671
4656
|
);
|
|
4672
4657
|
return false;
|
|
4673
4658
|
}
|
|
4674
4659
|
if (isTest) {
|
|
4675
|
-
|
|
4660
|
+
logger20.info("Running in test mode - no actual changes will be made");
|
|
4676
4661
|
}
|
|
4677
4662
|
if (skipRegistry) {
|
|
4678
|
-
|
|
4663
|
+
logger20.info("Registry updates will be skipped as requested with --skip-registry flag");
|
|
4679
4664
|
}
|
|
4680
4665
|
if (!isTest) {
|
|
4681
4666
|
const repoName = packageJson.name.replace(/^@[^/]+\//, "");
|
|
@@ -4688,24 +4673,24 @@ async function publishToGitHub(cwd, packageJson, username, skipRegistry = false,
|
|
|
4688
4673
|
} else {
|
|
4689
4674
|
topic = "elizaos-plugins";
|
|
4690
4675
|
}
|
|
4691
|
-
|
|
4676
|
+
logger20.info(`Checking/creating GitHub repository: ${username}/${repoName}`);
|
|
4692
4677
|
const repoResult = await createGitHubRepository(token, repoName, description, false, [topic]);
|
|
4693
4678
|
if (!repoResult.success) {
|
|
4694
|
-
|
|
4679
|
+
logger20.error(`Failed to create GitHub repository: ${repoResult.message}`);
|
|
4695
4680
|
return false;
|
|
4696
4681
|
}
|
|
4697
|
-
|
|
4682
|
+
logger20.info(`Using repository: ${repoResult.repoUrl}`);
|
|
4698
4683
|
const repoUrl = `https://${token}@github.com/${username}/${repoName}.git`;
|
|
4699
|
-
|
|
4684
|
+
logger20.info("Pushing code to GitHub...");
|
|
4700
4685
|
const pushSuccess = await pushToGitHub(cwd, repoUrl);
|
|
4701
4686
|
if (!pushSuccess) {
|
|
4702
|
-
|
|
4687
|
+
logger20.error("Failed to push code to GitHub repository.");
|
|
4703
4688
|
return false;
|
|
4704
4689
|
}
|
|
4705
|
-
|
|
4690
|
+
logger20.success("Successfully pushed code to GitHub repository");
|
|
4706
4691
|
if (packageJson.packageType === "project" || skipRegistry) {
|
|
4707
4692
|
const reason = packageJson.packageType === "project" ? "Projects do not need registry updates" : "Registry updates skipped as requested with --skip-registry flag";
|
|
4708
|
-
|
|
4693
|
+
logger20.info(`${packageJson.name} published to GitHub successfully. ${reason}`);
|
|
4709
4694
|
return {
|
|
4710
4695
|
success: true,
|
|
4711
4696
|
prUrl: repoResult.repoUrl
|
|
@@ -4714,7 +4699,7 @@ async function publishToGitHub(cwd, packageJson, username, skipRegistry = false,
|
|
|
4714
4699
|
}
|
|
4715
4700
|
if (packageJson.packageType === "project" || skipRegistry) {
|
|
4716
4701
|
if (isTest) {
|
|
4717
|
-
|
|
4702
|
+
logger20.info("Test successful - project would be published to GitHub only");
|
|
4718
4703
|
}
|
|
4719
4704
|
return true;
|
|
4720
4705
|
}
|
|
@@ -4723,33 +4708,33 @@ async function publishToGitHub(cwd, packageJson, username, skipRegistry = false,
|
|
|
4723
4708
|
const hasFork = await forkExists(token, registryRepo, username);
|
|
4724
4709
|
let forkFullName;
|
|
4725
4710
|
if (!hasFork && !isTest) {
|
|
4726
|
-
|
|
4711
|
+
logger20.info(`Creating fork of ${settings.defaultRegistry}...`);
|
|
4727
4712
|
const fork = await forkRepository(token, registryOwner, registryRepo);
|
|
4728
4713
|
if (!fork) {
|
|
4729
|
-
|
|
4714
|
+
logger20.error("Failed to fork registry repository.");
|
|
4730
4715
|
return false;
|
|
4731
4716
|
}
|
|
4732
4717
|
forkFullName = fork;
|
|
4733
4718
|
await new Promise((resolve2) => setTimeout(resolve2, 2e3));
|
|
4734
4719
|
} else {
|
|
4735
4720
|
forkFullName = `${username}/${registryRepo}`;
|
|
4736
|
-
|
|
4721
|
+
logger20.info(`Using existing fork: ${forkFullName}`);
|
|
4737
4722
|
}
|
|
4738
4723
|
const entityType = packageJson.packageType;
|
|
4739
4724
|
const packageNameWithoutScope = packageJson.name.replace(/^@[^/]+\//, "");
|
|
4740
4725
|
let branchName;
|
|
4741
4726
|
if (entityType === "plugin" && packageNameWithoutScope.startsWith("plugin-")) {
|
|
4742
4727
|
branchName = `${packageNameWithoutScope}-${packageJson.version}`;
|
|
4743
|
-
|
|
4728
|
+
logger20.info(`Using package name directly to avoid duplicate plugin prefix: ${branchName}`);
|
|
4744
4729
|
} else {
|
|
4745
4730
|
branchName = `${entityType}-${packageNameWithoutScope}-${packageJson.version}`;
|
|
4746
4731
|
}
|
|
4747
4732
|
const hasBranch = await branchExists(token, username, registryRepo, branchName);
|
|
4748
4733
|
if (!hasBranch && !isTest) {
|
|
4749
|
-
|
|
4734
|
+
logger20.info(`Creating branch ${branchName}...`);
|
|
4750
4735
|
const created = await createBranch(token, username, registryRepo, branchName);
|
|
4751
4736
|
if (!created) {
|
|
4752
|
-
|
|
4737
|
+
logger20.error("Failed to create branch.");
|
|
4753
4738
|
return false;
|
|
4754
4739
|
}
|
|
4755
4740
|
}
|
|
@@ -4762,10 +4747,10 @@ async function publishToGitHub(cwd, packageJson, username, skipRegistry = false,
|
|
|
4762
4747
|
const githubRepo = `github:${username}/${packageName}`;
|
|
4763
4748
|
const index = JSON.parse(indexContent);
|
|
4764
4749
|
if (index[registryPackageName]) {
|
|
4765
|
-
|
|
4750
|
+
logger20.warn(`Package ${registryPackageName} already exists in registry`);
|
|
4766
4751
|
return false;
|
|
4767
4752
|
}
|
|
4768
|
-
|
|
4753
|
+
logger20.info(`Adding registry entry: ${registryPackageName} -> ${githubRepo}`);
|
|
4769
4754
|
const lines = indexContent.split("\n");
|
|
4770
4755
|
const newEntry = ` "${registryPackageName}": "${githubRepo}",`;
|
|
4771
4756
|
let insertIndex = -1;
|
|
@@ -4794,7 +4779,7 @@ async function publishToGitHub(cwd, packageJson, username, skipRegistry = false,
|
|
|
4794
4779
|
}
|
|
4795
4780
|
}
|
|
4796
4781
|
if (insertIndex === -1) {
|
|
4797
|
-
|
|
4782
|
+
logger20.error("Could not find insertion point in index.json");
|
|
4798
4783
|
return false;
|
|
4799
4784
|
}
|
|
4800
4785
|
lines.splice(insertIndex, 0, newEntry);
|
|
@@ -4809,15 +4794,15 @@ async function publishToGitHub(cwd, packageJson, username, skipRegistry = false,
|
|
|
4809
4794
|
branchName
|
|
4810
4795
|
);
|
|
4811
4796
|
if (!indexUpdated) {
|
|
4812
|
-
|
|
4797
|
+
logger20.error("Failed to update registry index.");
|
|
4813
4798
|
return false;
|
|
4814
4799
|
}
|
|
4815
4800
|
} else {
|
|
4816
|
-
|
|
4801
|
+
logger20.error("Could not fetch index.json from registry");
|
|
4817
4802
|
return false;
|
|
4818
4803
|
}
|
|
4819
4804
|
} catch (error) {
|
|
4820
|
-
|
|
4805
|
+
logger20.error(
|
|
4821
4806
|
`Failed to update index.json: ${error instanceof Error ? error.message : String(error)}`
|
|
4822
4807
|
);
|
|
4823
4808
|
return false;
|
|
@@ -4839,20 +4824,20 @@ Submitted by: @${username}`,
|
|
|
4839
4824
|
"main"
|
|
4840
4825
|
);
|
|
4841
4826
|
if (!prUrl) {
|
|
4842
|
-
|
|
4827
|
+
logger20.error("Failed to create pull request.");
|
|
4843
4828
|
return false;
|
|
4844
4829
|
}
|
|
4845
|
-
|
|
4830
|
+
logger20.success(`Pull request created: ${prUrl}`);
|
|
4846
4831
|
return {
|
|
4847
4832
|
success: true,
|
|
4848
4833
|
prUrl
|
|
4849
4834
|
};
|
|
4850
4835
|
} else {
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4836
|
+
logger20.info("Test successful - all checks passed");
|
|
4837
|
+
logger20.info("Would create:");
|
|
4838
|
+
logger20.info(`- Branch: ${branchName}`);
|
|
4839
|
+
logger20.info(`- Registry entry: ${registryPackageName} -> github:${username}/${packageName}`);
|
|
4840
|
+
logger20.info(`- Pull request: Add ${registryPackageName} to registry`);
|
|
4856
4841
|
}
|
|
4857
4842
|
return true;
|
|
4858
4843
|
}
|
|
@@ -4867,17 +4852,17 @@ async function resolveImport(importPath, config) {
|
|
|
4867
4852
|
|
|
4868
4853
|
// src/utils/test-runner.ts
|
|
4869
4854
|
import {
|
|
4870
|
-
logger as
|
|
4855
|
+
logger as logger21
|
|
4871
4856
|
} from "@elizaos/core";
|
|
4872
4857
|
import * as fs9 from "fs";
|
|
4873
4858
|
import * as path20 from "path";
|
|
4874
4859
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
4875
4860
|
var safeLogger = {
|
|
4876
|
-
debug:
|
|
4877
|
-
info:
|
|
4878
|
-
warn:
|
|
4879
|
-
error:
|
|
4880
|
-
success:
|
|
4861
|
+
debug: logger21?.debug || console.log,
|
|
4862
|
+
info: logger21?.info || console.log,
|
|
4863
|
+
warn: logger21?.warn || console.warn,
|
|
4864
|
+
error: logger21?.error || console.error,
|
|
4865
|
+
success: logger21?.success || console.log
|
|
4881
4866
|
};
|
|
4882
4867
|
var TestRunner = class {
|
|
4883
4868
|
runtime;
|
|
@@ -5151,7 +5136,7 @@ Test Summary: ${this.stats.passed} passed, ${this.stats.failed} failed, ${this.s
|
|
|
5151
5136
|
};
|
|
5152
5137
|
|
|
5153
5138
|
// src/utils/registry/index.ts
|
|
5154
|
-
import { logger as
|
|
5139
|
+
import { logger as logger22 } from "@elizaos/core";
|
|
5155
5140
|
import dotenv3 from "dotenv";
|
|
5156
5141
|
import { HttpsProxyAgent } from "https-proxy-agent";
|
|
5157
5142
|
import { existsSync as existsSync18, promises as fs10 } from "fs";
|
|
@@ -5229,7 +5214,7 @@ async function getGitHubToken() {
|
|
|
5229
5214
|
return env.GITHUB_TOKEN;
|
|
5230
5215
|
}
|
|
5231
5216
|
} catch (error) {
|
|
5232
|
-
|
|
5217
|
+
logger22.debug(
|
|
5233
5218
|
`Error reading GitHub token: ${error instanceof Error ? error.message : String(error)}`
|
|
5234
5219
|
);
|
|
5235
5220
|
}
|
|
@@ -5255,9 +5240,9 @@ async function setGitHubToken(token) {
|
|
|
5255
5240
|
}
|
|
5256
5241
|
await fs10.writeFile(ENV_FILE, newContent);
|
|
5257
5242
|
process.env.GITHUB_TOKEN = token;
|
|
5258
|
-
|
|
5243
|
+
logger22.debug("GitHub token saved successfully");
|
|
5259
5244
|
} catch (error) {
|
|
5260
|
-
|
|
5245
|
+
logger22.error(
|
|
5261
5246
|
`Failed to save GitHub token: ${error instanceof Error ? error.message : String(error)}`
|
|
5262
5247
|
);
|
|
5263
5248
|
}
|
|
@@ -5300,16 +5285,16 @@ async function saveRegistryCache(registry) {
|
|
|
5300
5285
|
try {
|
|
5301
5286
|
await ensureElizaDir2();
|
|
5302
5287
|
await fs10.writeFile(REGISTRY_CACHE_FILE, JSON.stringify(registry, null, 2));
|
|
5303
|
-
|
|
5288
|
+
logger22.debug("Registry cache saved successfully");
|
|
5304
5289
|
} catch (error) {
|
|
5305
|
-
|
|
5290
|
+
logger22.debug(
|
|
5306
5291
|
`Failed to save registry cache: ${error instanceof Error ? error.message : String(error)}`
|
|
5307
5292
|
);
|
|
5308
5293
|
}
|
|
5309
5294
|
}
|
|
5310
5295
|
async function getLocalRegistryIndex() {
|
|
5311
5296
|
try {
|
|
5312
|
-
|
|
5297
|
+
logger22.debug("Fetching registry from public GitHub URL");
|
|
5313
5298
|
const response = await fetch(RAW_REGISTRY_URL);
|
|
5314
5299
|
if (response.ok) {
|
|
5315
5300
|
const rawData = await response.json();
|
|
@@ -5321,12 +5306,12 @@ async function getLocalRegistryIndex() {
|
|
|
5321
5306
|
}
|
|
5322
5307
|
}
|
|
5323
5308
|
await saveRegistryCache(result);
|
|
5324
|
-
|
|
5309
|
+
logger22.debug("Successfully fetched registry from public GitHub URL");
|
|
5325
5310
|
return result;
|
|
5326
5311
|
}
|
|
5327
5312
|
}
|
|
5328
5313
|
} catch (error) {
|
|
5329
|
-
|
|
5314
|
+
logger22.debug(
|
|
5330
5315
|
`Failed to fetch registry from public URL: ${error instanceof Error ? error.message : String(error)}`
|
|
5331
5316
|
);
|
|
5332
5317
|
}
|
|
@@ -5334,11 +5319,11 @@ async function getLocalRegistryIndex() {
|
|
|
5334
5319
|
if (existsSync18(REGISTRY_CACHE_FILE)) {
|
|
5335
5320
|
const cacheContent = await fs10.readFile(REGISTRY_CACHE_FILE, "utf-8");
|
|
5336
5321
|
const cachedRegistry = JSON.parse(cacheContent);
|
|
5337
|
-
|
|
5322
|
+
logger22.debug("Using cached registry index");
|
|
5338
5323
|
return cachedRegistry;
|
|
5339
5324
|
}
|
|
5340
5325
|
} catch (error) {
|
|
5341
|
-
|
|
5326
|
+
logger22.debug(
|
|
5342
5327
|
`Failed to read registry cache: ${error instanceof Error ? error.message : String(error)}`
|
|
5343
5328
|
);
|
|
5344
5329
|
}
|
|
@@ -5355,7 +5340,7 @@ async function getLocalRegistryIndex() {
|
|
|
5355
5340
|
}
|
|
5356
5341
|
return { ...DEFAULT_REGISTRY, ...localRegistry };
|
|
5357
5342
|
} catch (error) {
|
|
5358
|
-
|
|
5343
|
+
logger22.debug(
|
|
5359
5344
|
`Failed to discover local plugins: ${error instanceof Error ? error.message : String(error)}`
|
|
5360
5345
|
);
|
|
5361
5346
|
}
|
|
@@ -5366,7 +5351,7 @@ async function getRegistryIndex() {
|
|
|
5366
5351
|
const settings = await getRegistrySettings();
|
|
5367
5352
|
const credentials = await getGitHubCredentials();
|
|
5368
5353
|
if (!credentials) {
|
|
5369
|
-
|
|
5354
|
+
logger22.error("GitHub credentials not found. Please run login first.");
|
|
5370
5355
|
process.exit(1);
|
|
5371
5356
|
}
|
|
5372
5357
|
const [owner, repo] = settings.defaultRegistry.split("/");
|
|
@@ -5423,7 +5408,7 @@ async function getPluginRepository(pluginName) {
|
|
|
5423
5408
|
const registry = await getLocalRegistryIndex();
|
|
5424
5409
|
for (const name of possibleNames) {
|
|
5425
5410
|
if (registry[name]) {
|
|
5426
|
-
|
|
5411
|
+
logger22.debug(`Found plugin in registry as: ${name}`);
|
|
5427
5412
|
return registry[name];
|
|
5428
5413
|
}
|
|
5429
5414
|
}
|
|
@@ -5436,7 +5421,7 @@ async function getPluginRepository(pluginName) {
|
|
|
5436
5421
|
}
|
|
5437
5422
|
return null;
|
|
5438
5423
|
} catch (error) {
|
|
5439
|
-
|
|
5424
|
+
logger22.debug(
|
|
5440
5425
|
`Error getting plugin repository: ${error instanceof Error ? error.message : String(error)}`
|
|
5441
5426
|
);
|
|
5442
5427
|
return null;
|
|
@@ -5447,7 +5432,7 @@ async function repoHasBranch(repoUrl, branchName) {
|
|
|
5447
5432
|
const { stdout } = await bunExecSimple("git", ["ls-remote", "--heads", repoUrl, branchName]);
|
|
5448
5433
|
return stdout.includes(branchName);
|
|
5449
5434
|
} catch (error) {
|
|
5450
|
-
|
|
5435
|
+
logger22.warn(
|
|
5451
5436
|
`Failed to check for branch ${branchName} in ${repoUrl}: ${error instanceof Error ? error.message : String(error)}`
|
|
5452
5437
|
);
|
|
5453
5438
|
return false;
|
|
@@ -5470,7 +5455,7 @@ async function getPluginMetadata(pluginName) {
|
|
|
5470
5455
|
const settings = await getRegistrySettings();
|
|
5471
5456
|
const credentials = await getGitHubCredentials();
|
|
5472
5457
|
if (!credentials) {
|
|
5473
|
-
|
|
5458
|
+
logger22.error("GitHub credentials not found. Please run login first.");
|
|
5474
5459
|
process.exit(1);
|
|
5475
5460
|
}
|
|
5476
5461
|
const [owner, repo] = settings.defaultRegistry.split("/");
|
|
@@ -5499,7 +5484,7 @@ async function getPluginMetadata(pluginName) {
|
|
|
5499
5484
|
}
|
|
5500
5485
|
return metadata;
|
|
5501
5486
|
} catch (error) {
|
|
5502
|
-
|
|
5487
|
+
logger22.error("Failed to fetch plugin metadata:", error);
|
|
5503
5488
|
return null;
|
|
5504
5489
|
}
|
|
5505
5490
|
}
|
|
@@ -5513,7 +5498,7 @@ async function getPluginVersion(pluginName, version) {
|
|
|
5513
5498
|
return packageDetails.latestVersion;
|
|
5514
5499
|
}
|
|
5515
5500
|
} catch (error) {
|
|
5516
|
-
|
|
5501
|
+
logger22.debug(
|
|
5517
5502
|
`Error getting package details: ${error instanceof Error ? error.message : String(error)}`
|
|
5518
5503
|
);
|
|
5519
5504
|
}
|
|
@@ -5547,11 +5532,11 @@ async function getPackageDetails(packageName) {
|
|
|
5547
5532
|
try {
|
|
5548
5533
|
return JSON.parse(text4);
|
|
5549
5534
|
} catch {
|
|
5550
|
-
|
|
5535
|
+
logger22.warn(`Invalid JSON response received from registry for package ${packageName}:`, text4);
|
|
5551
5536
|
return null;
|
|
5552
5537
|
}
|
|
5553
5538
|
} catch (error) {
|
|
5554
|
-
|
|
5539
|
+
logger22.warn(
|
|
5555
5540
|
`Failed to fetch package details from registry: ${error instanceof Error ? error.message : String(error)}`
|
|
5556
5541
|
);
|
|
5557
5542
|
return null;
|
|
@@ -5568,14 +5553,14 @@ async function getBestPluginVersion(packageName, runtimeVersion) {
|
|
|
5568
5553
|
const [runtimeMajor, runtimeMinor] = runtimeVersion.split(".").map(Number);
|
|
5569
5554
|
const [packageMajor, packageMinor] = packageDetails.runtimeVersion.split(".").map(Number);
|
|
5570
5555
|
if (runtimeMajor !== packageMajor) {
|
|
5571
|
-
|
|
5556
|
+
logger22.warn(
|
|
5572
5557
|
`Plugin ${packageName} was built for runtime v${packageDetails.runtimeVersion}, but you're using v${runtimeVersion}`
|
|
5573
5558
|
);
|
|
5574
|
-
|
|
5559
|
+
logger22.warn("This may cause compatibility issues.");
|
|
5575
5560
|
return packageDetails.latestVersion;
|
|
5576
5561
|
}
|
|
5577
5562
|
if (runtimeMinor !== packageMinor) {
|
|
5578
|
-
|
|
5563
|
+
logger22.warn(
|
|
5579
5564
|
`Plugin ${packageName} was built for runtime v${packageDetails.runtimeVersion}, you're using v${runtimeVersion}`
|
|
5580
5565
|
);
|
|
5581
5566
|
}
|
|
@@ -5637,7 +5622,7 @@ async function initializeDataDir() {
|
|
|
5637
5622
|
async function validateDataDir() {
|
|
5638
5623
|
const status = await checkDataDir();
|
|
5639
5624
|
if (!status.exists) {
|
|
5640
|
-
|
|
5625
|
+
logger22.warn("ElizaOS data directory not found. Initializing...");
|
|
5641
5626
|
await initializeDataDir();
|
|
5642
5627
|
return false;
|
|
5643
5628
|
}
|
|
@@ -5647,22 +5632,22 @@ async function validateDataDir() {
|
|
|
5647
5632
|
const envContent = await fs10.readFile(envPath, "utf-8");
|
|
5648
5633
|
const parsedEnv = dotenv3.parse(envContent);
|
|
5649
5634
|
if (!parsedEnv.GITHUB_TOKEN) {
|
|
5650
|
-
|
|
5635
|
+
logger22.warn("GitHub token not found in environment");
|
|
5651
5636
|
isValid = false;
|
|
5652
5637
|
}
|
|
5653
5638
|
} else {
|
|
5654
|
-
|
|
5639
|
+
logger22.warn(".env file not found");
|
|
5655
5640
|
isValid = false;
|
|
5656
5641
|
}
|
|
5657
5642
|
if (!status.env.hasAllKeys) {
|
|
5658
|
-
|
|
5643
|
+
logger22.warn(`Missing environment variables: ${status.env.missingKeys.join(", ")}`);
|
|
5659
5644
|
isValid = false;
|
|
5660
5645
|
}
|
|
5661
5646
|
if (!status.settings.exists) {
|
|
5662
|
-
|
|
5647
|
+
logger22.warn("Registry settings file not found");
|
|
5663
5648
|
isValid = false;
|
|
5664
5649
|
} else if (!status.settings.hasAllKeys) {
|
|
5665
|
-
|
|
5650
|
+
logger22.warn(`Missing settings: ${status.settings.missingKeys.join(", ")}`);
|
|
5666
5651
|
isValid = false;
|
|
5667
5652
|
}
|
|
5668
5653
|
return isValid;
|