@elizaos/cli 1.2.11-beta.7 → 1.2.11-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-BVMPDDVC.js → chunk-3LVXQ7VC.js} +101 -16
- package/dist/{chunk-LBWSLIF4.js → chunk-NS5R6Z74.js} +2 -2
- package/dist/{chunk-P2EDLOL3.js → chunk-TVVBQLSH.js} +1 -1
- package/dist/commands/agent/actions/index.js +1 -1
- package/dist/commands/agent/index.js +1 -1
- package/dist/commands/create/actions/index.js +2 -2
- package/dist/commands/create/index.js +3 -3
- package/dist/index.js +138 -112
- package/dist/{registry-RLIFZR6O.js → registry-NSUZGLOY.js} +1 -1
- package/dist/templates/plugin-quick-starter/package.json +1 -1
- package/dist/templates/plugin-starter/package.json +1 -1
- package/dist/templates/project-starter/package.json +4 -4
- package/dist/templates/project-tee-starter/package.json +3 -3
- package/dist/{utils-4MMOCB4V.js → utils-TV5USNZM.js} +3 -1
- package/package.json +5 -5
- package/templates/plugin-quick-starter/package.json +1 -1
- package/templates/plugin-starter/package.json +1 -1
- package/templates/project-starter/package.json +4 -4
- package/templates/project-tee-starter/package.json +3 -3
|
@@ -2761,7 +2761,7 @@ async function getGitHubCredentials() {
|
|
|
2761
2761
|
}
|
|
2762
2762
|
logger10.warn("Invalid GitHub token found in environment variables");
|
|
2763
2763
|
}
|
|
2764
|
-
const { getGitHubToken: getGitHubToken2 } = await import("./registry-
|
|
2764
|
+
const { getGitHubToken: getGitHubToken2 } = await import("./registry-NSUZGLOY.js");
|
|
2765
2765
|
const token = await getGitHubToken2() || void 0;
|
|
2766
2766
|
if (token) {
|
|
2767
2767
|
const isValid2 = await validateGitHubToken(token);
|
|
@@ -4186,8 +4186,15 @@ function isRunningFromLocalCli() {
|
|
|
4186
4186
|
try {
|
|
4187
4187
|
const currentScriptPath = process.argv[1];
|
|
4188
4188
|
if (!currentScriptPath) return false;
|
|
4189
|
-
const
|
|
4190
|
-
|
|
4189
|
+
const expectedLocalCliPath = path18.join(
|
|
4190
|
+
process.cwd(),
|
|
4191
|
+
"node_modules",
|
|
4192
|
+
"@elizaos",
|
|
4193
|
+
"cli",
|
|
4194
|
+
"dist",
|
|
4195
|
+
"index.js"
|
|
4196
|
+
);
|
|
4197
|
+
const isInLocalCli = path18.resolve(currentScriptPath) === path18.resolve(expectedLocalCliPath);
|
|
4191
4198
|
return isInLocalCli;
|
|
4192
4199
|
} catch (error) {
|
|
4193
4200
|
logger19.debug("Error checking if running from local CLI:", error);
|
|
@@ -4262,12 +4269,14 @@ async function delegateToLocalCli(localCliPath) {
|
|
|
4262
4269
|
forwardSignal("SIGTERM");
|
|
4263
4270
|
});
|
|
4264
4271
|
}
|
|
4265
|
-
function
|
|
4266
|
-
const
|
|
4272
|
+
function isTestOrCiEnvironment() {
|
|
4273
|
+
const testAndCiIndicators = [
|
|
4267
4274
|
process.env.NODE_ENV === "test",
|
|
4268
4275
|
process.env.ELIZA_TEST_MODE === "true",
|
|
4269
4276
|
process.env.ELIZA_TEST_MODE === "1",
|
|
4270
4277
|
process.env.ELIZA_CLI_TEST_MODE === "true",
|
|
4278
|
+
process.env.ELIZA_SKIP_LOCAL_CLI_DELEGATION === "true",
|
|
4279
|
+
process.env.ELIZA_DISABLE_LOCAL_CLI_DELEGATION === "true",
|
|
4271
4280
|
process.env.BUN_TEST === "true",
|
|
4272
4281
|
process.env.VITEST === "true",
|
|
4273
4282
|
process.env.JEST_WORKER_ID !== void 0,
|
|
@@ -4276,14 +4285,32 @@ function isTestEnvironment() {
|
|
|
4276
4285
|
// Check if we're running under a test runner
|
|
4277
4286
|
process.argv[1]?.includes("test") === true,
|
|
4278
4287
|
// Check if parent process is a test runner
|
|
4279
|
-
process.env.npm_lifecycle_event === "test"
|
|
4288
|
+
process.env.npm_lifecycle_event === "test",
|
|
4289
|
+
// CI environment detection
|
|
4290
|
+
process.env.CI === "true",
|
|
4291
|
+
process.env.CONTINUOUS_INTEGRATION === "true",
|
|
4292
|
+
process.env.GITHUB_ACTIONS === "true",
|
|
4293
|
+
process.env.GITLAB_CI === "true",
|
|
4294
|
+
process.env.JENKINS_URL !== void 0,
|
|
4295
|
+
process.env.TRAVIS === "true",
|
|
4296
|
+
process.env.CIRCLECI === "true",
|
|
4297
|
+
process.env.BUILDKITE === "true",
|
|
4298
|
+
process.env.DRONE === "true",
|
|
4299
|
+
process.env.TEAMCITY_VERSION !== void 0,
|
|
4300
|
+
process.env.APPVEYOR === "true",
|
|
4301
|
+
process.env.CODEBUILD_BUILD_ID !== void 0
|
|
4280
4302
|
];
|
|
4281
|
-
return
|
|
4303
|
+
return testAndCiIndicators.some((indicator) => indicator === true);
|
|
4282
4304
|
}
|
|
4283
4305
|
async function tryDelegateToLocalCli() {
|
|
4284
4306
|
try {
|
|
4285
|
-
if (
|
|
4286
|
-
logger19.debug("Running in test environment, skipping local CLI delegation");
|
|
4307
|
+
if (isTestOrCiEnvironment()) {
|
|
4308
|
+
logger19.debug("Running in test or CI environment, skipping local CLI delegation");
|
|
4309
|
+
return false;
|
|
4310
|
+
}
|
|
4311
|
+
const args = process.argv.slice(2);
|
|
4312
|
+
if (args.length > 0 && args[0] === "update") {
|
|
4313
|
+
logger19.debug("Update command detected, skipping local CLI delegation");
|
|
4287
4314
|
return false;
|
|
4288
4315
|
}
|
|
4289
4316
|
if (isRunningFromLocalCli()) {
|
|
@@ -4295,6 +4322,14 @@ async function tryDelegateToLocalCli() {
|
|
|
4295
4322
|
logger19.debug("No local CLI found, using global installation");
|
|
4296
4323
|
return false;
|
|
4297
4324
|
}
|
|
4325
|
+
if (process.env._ELIZA_CLI_DELEGATION_DEPTH) {
|
|
4326
|
+
const depth = parseInt(process.env._ELIZA_CLI_DELEGATION_DEPTH, 10);
|
|
4327
|
+
if (depth > 0) {
|
|
4328
|
+
logger19.debug("Delegation depth exceeded, preventing infinite loop");
|
|
4329
|
+
return false;
|
|
4330
|
+
}
|
|
4331
|
+
}
|
|
4332
|
+
process.env._ELIZA_CLI_DELEGATION_DEPTH = "1";
|
|
4298
4333
|
await delegateToLocalCli(localCliPath);
|
|
4299
4334
|
return true;
|
|
4300
4335
|
} catch (error) {
|
|
@@ -4323,11 +4358,12 @@ import path19 from "path";
|
|
|
4323
4358
|
import { existsSync as existsSync16 } from "fs";
|
|
4324
4359
|
var ModuleLoader = class {
|
|
4325
4360
|
require;
|
|
4326
|
-
|
|
4361
|
+
asyncCache = /* @__PURE__ */ new Map();
|
|
4362
|
+
syncCache = /* @__PURE__ */ new Map();
|
|
4327
4363
|
projectPath;
|
|
4328
4364
|
constructor(projectPath) {
|
|
4329
4365
|
this.projectPath = projectPath || this.detectProjectPath();
|
|
4330
|
-
this.require = createRequire(pathToFileURL(this.projectPath
|
|
4366
|
+
this.require = createRequire(pathToFileURL(path19.join(this.projectPath, "package.json")).href);
|
|
4331
4367
|
this.setupEnvironment();
|
|
4332
4368
|
}
|
|
4333
4369
|
/**
|
|
@@ -4351,9 +4387,9 @@ var ModuleLoader = class {
|
|
|
4351
4387
|
* @throws Error if the module cannot be found in the project
|
|
4352
4388
|
*/
|
|
4353
4389
|
async load(moduleName) {
|
|
4354
|
-
if (this.
|
|
4390
|
+
if (this.asyncCache.has(moduleName)) {
|
|
4355
4391
|
logger20.debug(`Using cached module: ${moduleName}`);
|
|
4356
|
-
return this.
|
|
4392
|
+
return this.asyncCache.get(moduleName);
|
|
4357
4393
|
}
|
|
4358
4394
|
try {
|
|
4359
4395
|
const localModulePath = path19.join(this.projectPath, "node_modules", moduleName);
|
|
@@ -4369,8 +4405,52 @@ var ModuleLoader = class {
|
|
|
4369
4405
|
logger20.warn(`Expected local module but resolved to global: ${modulePath}`);
|
|
4370
4406
|
}
|
|
4371
4407
|
const module = await import(pathToFileURL(modulePath).href);
|
|
4372
|
-
this.
|
|
4373
|
-
logger20.
|
|
4408
|
+
this.asyncCache.set(moduleName, module);
|
|
4409
|
+
logger20.info(
|
|
4410
|
+
`Loaded ${moduleName} from ${isLocalModule ? "local" : "global"} installation`
|
|
4411
|
+
);
|
|
4412
|
+
return module;
|
|
4413
|
+
} catch (error) {
|
|
4414
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
4415
|
+
logger20.error(`Failed to load module ${moduleName}: ${errorMessage}`);
|
|
4416
|
+
throw new Error(
|
|
4417
|
+
`Cannot find module '${moduleName}' in project at ${this.projectPath}.
|
|
4418
|
+
Please ensure it's installed by running:
|
|
4419
|
+
bun add ${moduleName}
|
|
4420
|
+
|
|
4421
|
+
Original error: ${errorMessage}`
|
|
4422
|
+
);
|
|
4423
|
+
}
|
|
4424
|
+
}
|
|
4425
|
+
/**
|
|
4426
|
+
* Synchronously load a module from the project's node_modules directory.
|
|
4427
|
+
* Uses caching to ensure the same instance is returned for repeated calls.
|
|
4428
|
+
*
|
|
4429
|
+
* @param moduleName - The name of the module to load (e.g., '@elizaos/server')
|
|
4430
|
+
* @returns The loaded module
|
|
4431
|
+
* @throws Error if the module cannot be found in the project
|
|
4432
|
+
*/
|
|
4433
|
+
loadSync(moduleName) {
|
|
4434
|
+
if (this.syncCache.has(moduleName)) {
|
|
4435
|
+
logger20.debug(`Using cached module: ${moduleName}`);
|
|
4436
|
+
return this.syncCache.get(moduleName);
|
|
4437
|
+
}
|
|
4438
|
+
try {
|
|
4439
|
+
const localModulePath = path19.join(this.projectPath, "node_modules", moduleName);
|
|
4440
|
+
const isLocalModule = existsSync16(localModulePath);
|
|
4441
|
+
if (isLocalModule) {
|
|
4442
|
+
logger20.info(`Using local ${moduleName} installation`);
|
|
4443
|
+
} else {
|
|
4444
|
+
logger20.info(`Using global ${moduleName} installation`);
|
|
4445
|
+
}
|
|
4446
|
+
const modulePath = this.require.resolve(moduleName);
|
|
4447
|
+
logger20.debug(`Loading ${moduleName} from: ${modulePath}`);
|
|
4448
|
+
if (isLocalModule && !modulePath.includes(this.projectPath)) {
|
|
4449
|
+
logger20.warn(`Expected local module but resolved to global: ${modulePath}`);
|
|
4450
|
+
}
|
|
4451
|
+
const module = this.require(modulePath);
|
|
4452
|
+
this.syncCache.set(moduleName, module);
|
|
4453
|
+
logger20.info(
|
|
4374
4454
|
`Loaded ${moduleName} from ${isLocalModule ? "local" : "global"} installation`
|
|
4375
4455
|
);
|
|
4376
4456
|
return module;
|
|
@@ -4412,7 +4492,8 @@ Original error: ${errorMessage}`
|
|
|
4412
4492
|
* Clear the module cache. Useful for testing or hot reloading scenarios.
|
|
4413
4493
|
*/
|
|
4414
4494
|
clearCache() {
|
|
4415
|
-
this.
|
|
4495
|
+
this.asyncCache.clear();
|
|
4496
|
+
this.syncCache.clear();
|
|
4416
4497
|
}
|
|
4417
4498
|
/**
|
|
4418
4499
|
* Get the resolved path for a module without loading it.
|
|
@@ -4435,6 +4516,9 @@ function getModuleLoader() {
|
|
|
4435
4516
|
async function loadModule(moduleName) {
|
|
4436
4517
|
return getModuleLoader().load(moduleName);
|
|
4437
4518
|
}
|
|
4519
|
+
function loadModuleSync(moduleName) {
|
|
4520
|
+
return getModuleLoader().loadSync(moduleName);
|
|
4521
|
+
}
|
|
4438
4522
|
|
|
4439
4523
|
// src/utils/port-handling.ts
|
|
4440
4524
|
import net from "net";
|
|
@@ -5726,6 +5810,7 @@ export {
|
|
|
5726
5810
|
ModuleLoader,
|
|
5727
5811
|
getModuleLoader,
|
|
5728
5812
|
loadModule,
|
|
5813
|
+
loadModuleSync,
|
|
5729
5814
|
isPortFree,
|
|
5730
5815
|
findNextAvailablePort,
|
|
5731
5816
|
testPublishToNpm,
|
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
selectEmbeddingModel,
|
|
10
10
|
validateCreateOptions,
|
|
11
11
|
validateProjectName
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-TVVBQLSH.js";
|
|
13
13
|
import {
|
|
14
14
|
displayBanner,
|
|
15
15
|
handleError
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-3LVXQ7VC.js";
|
|
17
17
|
|
|
18
18
|
// src/commands/create/index.ts
|
|
19
19
|
import { Command } from "commander";
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
setupAIModelConfig,
|
|
9
9
|
setupEmbeddingModelConfig,
|
|
10
10
|
setupProjectEnvironment
|
|
11
|
-
} from "../../../chunk-
|
|
12
|
-
import "../../../chunk-
|
|
11
|
+
} from "../../../chunk-TVVBQLSH.js";
|
|
12
|
+
import "../../../chunk-3LVXQ7VC.js";
|
|
13
13
|
import "../../../chunk-FDEDLANP.js";
|
|
14
14
|
import "../../../chunk-4O6EZU37.js";
|
|
15
15
|
import "../../../chunk-D3Q2UZLZ.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
create
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-NS5R6Z74.js";
|
|
4
|
+
import "../../chunk-TVVBQLSH.js";
|
|
5
|
+
import "../../chunk-3LVXQ7VC.js";
|
|
6
6
|
import "../../chunk-FDEDLANP.js";
|
|
7
7
|
import "../../chunk-4O6EZU37.js";
|
|
8
8
|
import "../../chunk-D3Q2UZLZ.js";
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import {
|
|
3
3
|
create
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NS5R6Z74.js";
|
|
5
5
|
import {
|
|
6
6
|
getElizaCharacter
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-TVVBQLSH.js";
|
|
8
8
|
import {
|
|
9
|
-
ModuleLoader,
|
|
10
9
|
TestRunner,
|
|
11
10
|
UserEnvironment,
|
|
12
11
|
agent,
|
|
@@ -21,6 +20,7 @@ import {
|
|
|
21
20
|
findNextAvailablePort,
|
|
22
21
|
getCliInstallTag,
|
|
23
22
|
getGitHubCredentials,
|
|
23
|
+
getModuleLoader,
|
|
24
24
|
getPackageManager,
|
|
25
25
|
getRegistrySettings,
|
|
26
26
|
getVersion,
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
testPublishToNpm,
|
|
44
44
|
tryDelegateToLocalCli,
|
|
45
45
|
validateDataDir
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-3LVXQ7VC.js";
|
|
47
47
|
import {
|
|
48
48
|
configureEmojis,
|
|
49
49
|
emoji,
|
|
@@ -248,108 +248,136 @@ async function watchDirectory(dir, onChange, config2 = {}) {
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
// src/commands/dev/utils/server-manager.ts
|
|
251
|
-
import { spawn } from "child_process";
|
|
252
251
|
import * as path3 from "path";
|
|
253
|
-
var
|
|
254
|
-
process
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
this.process = null;
|
|
268
|
-
await new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
269
|
-
return true;
|
|
270
|
-
}
|
|
271
|
-
return false;
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Starts the server process with the given arguments
|
|
275
|
-
*/
|
|
276
|
-
async start(args = []) {
|
|
277
|
-
await this.stop();
|
|
278
|
-
console.info("Starting server...");
|
|
279
|
-
const nodeExecutable = process.execPath;
|
|
280
|
-
const localCliPath = path3.join(
|
|
281
|
-
process.cwd(),
|
|
282
|
-
"node_modules",
|
|
283
|
-
"@elizaos",
|
|
284
|
-
"cli",
|
|
285
|
-
"dist",
|
|
286
|
-
"index.js"
|
|
287
|
-
);
|
|
252
|
+
var serverState = {
|
|
253
|
+
process: null,
|
|
254
|
+
isRunning: false
|
|
255
|
+
};
|
|
256
|
+
async function getLocalCliPath() {
|
|
257
|
+
const localCliPath = path3.join(
|
|
258
|
+
process.cwd(),
|
|
259
|
+
"node_modules",
|
|
260
|
+
"@elizaos",
|
|
261
|
+
"cli",
|
|
262
|
+
"dist",
|
|
263
|
+
"index.js"
|
|
264
|
+
);
|
|
265
|
+
try {
|
|
288
266
|
const fs14 = await import("fs");
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
267
|
+
return fs14.existsSync(localCliPath) ? localCliPath : null;
|
|
268
|
+
} catch {
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function setupEnvironment() {
|
|
273
|
+
const env2 = { ...process.env };
|
|
274
|
+
const localModulesPath = path3.join(process.cwd(), "node_modules");
|
|
275
|
+
if (env2.NODE_PATH) {
|
|
276
|
+
env2.NODE_PATH = `${localModulesPath}${path3.delimiter}${env2.NODE_PATH}`;
|
|
277
|
+
} else {
|
|
278
|
+
env2.NODE_PATH = localModulesPath;
|
|
279
|
+
}
|
|
280
|
+
const localBinPath = path3.join(process.cwd(), "node_modules", ".bin");
|
|
281
|
+
if (env2.PATH) {
|
|
282
|
+
env2.PATH = `${localBinPath}${path3.delimiter}${env2.PATH}`;
|
|
283
|
+
} else {
|
|
284
|
+
env2.PATH = localBinPath;
|
|
285
|
+
}
|
|
286
|
+
env2.FORCE_COLOR = "1";
|
|
287
|
+
return env2;
|
|
288
|
+
}
|
|
289
|
+
async function startServerProcess(args = []) {
|
|
290
|
+
await stopServerProcess();
|
|
291
|
+
console.info("Starting server...");
|
|
292
|
+
const nodeExecutable = process.execPath;
|
|
293
|
+
const localCliPath = await getLocalCliPath();
|
|
294
|
+
let scriptPath;
|
|
295
|
+
if (localCliPath) {
|
|
296
|
+
console.info("Using local @elizaos/cli installation");
|
|
297
|
+
scriptPath = localCliPath;
|
|
298
|
+
} else {
|
|
299
|
+
scriptPath = process.argv[1];
|
|
300
|
+
}
|
|
301
|
+
const env2 = setupEnvironment();
|
|
302
|
+
const childProcess = Bun.spawn([nodeExecutable, scriptPath, "start", ...args], {
|
|
303
|
+
stdio: ["inherit", "inherit", "inherit"],
|
|
304
|
+
env: env2,
|
|
305
|
+
cwd: process.cwd()
|
|
306
|
+
});
|
|
307
|
+
serverState.process = childProcess;
|
|
308
|
+
serverState.isRunning = true;
|
|
309
|
+
childProcess.exited.then((exitCode) => {
|
|
310
|
+
if (exitCode !== 0) {
|
|
311
|
+
console.warn(`Server process exited with code ${exitCode}`);
|
|
306
312
|
} else {
|
|
307
|
-
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
if (code !== 0) {
|
|
321
|
-
console.warn(`Server process exited with code ${code}`);
|
|
322
|
-
} else {
|
|
323
|
-
console.info("Server process exited normally");
|
|
324
|
-
}
|
|
325
|
-
} else if (signal) {
|
|
326
|
-
console.info(`Server process was killed with signal ${signal}`);
|
|
327
|
-
}
|
|
328
|
-
this.process = null;
|
|
329
|
-
});
|
|
330
|
-
this.process.on("error", (err) => {
|
|
331
|
-
console.error(`Server process error: ${err.message}`);
|
|
332
|
-
this.process = null;
|
|
333
|
-
});
|
|
313
|
+
console.info("Server process exited normally");
|
|
314
|
+
}
|
|
315
|
+
serverState.process = null;
|
|
316
|
+
serverState.isRunning = false;
|
|
317
|
+
}).catch((error) => {
|
|
318
|
+
console.error(`Server process error: ${error.message}`);
|
|
319
|
+
serverState.process = null;
|
|
320
|
+
serverState.isRunning = false;
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
async function stopServerProcess() {
|
|
324
|
+
if (!serverState.process || !serverState.isRunning) {
|
|
325
|
+
return false;
|
|
334
326
|
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
327
|
+
console.info("Stopping current server process...");
|
|
328
|
+
try {
|
|
329
|
+
const killed = serverState.process.kill("SIGTERM");
|
|
330
|
+
if (!killed) {
|
|
331
|
+
console.warn("Failed to kill server process, trying force kill...");
|
|
332
|
+
serverState.process.kill("SIGKILL");
|
|
333
|
+
}
|
|
334
|
+
serverState.process = null;
|
|
335
|
+
serverState.isRunning = false;
|
|
336
|
+
await new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
337
|
+
return true;
|
|
338
|
+
} catch (error) {
|
|
339
|
+
console.error(`Error stopping server process: ${error}`);
|
|
340
|
+
serverState.process = null;
|
|
341
|
+
serverState.isRunning = false;
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
async function restartServerProcess(args = []) {
|
|
346
|
+
console.info("Restarting server...");
|
|
347
|
+
await startServerProcess(args);
|
|
348
|
+
}
|
|
349
|
+
function isServerRunning() {
|
|
350
|
+
return serverState.isRunning && serverState.process !== null;
|
|
351
|
+
}
|
|
352
|
+
function getServerProcess() {
|
|
353
|
+
return serverState.process;
|
|
354
|
+
}
|
|
355
|
+
var createServerManager = () => ({
|
|
356
|
+
async start(args = []) {
|
|
357
|
+
return startServerProcess(args);
|
|
358
|
+
},
|
|
359
|
+
async stop() {
|
|
360
|
+
return stopServerProcess();
|
|
361
|
+
},
|
|
338
362
|
async restart(args = []) {
|
|
339
|
-
|
|
340
|
-
|
|
363
|
+
return restartServerProcess(args);
|
|
364
|
+
},
|
|
365
|
+
get process() {
|
|
366
|
+
return getServerProcess();
|
|
367
|
+
},
|
|
368
|
+
isRunning() {
|
|
369
|
+
return isServerRunning();
|
|
341
370
|
}
|
|
342
|
-
};
|
|
343
|
-
var
|
|
371
|
+
});
|
|
372
|
+
var serverManager = null;
|
|
344
373
|
function getServerManager() {
|
|
345
|
-
if (!
|
|
346
|
-
|
|
374
|
+
if (!serverManager) {
|
|
375
|
+
serverManager = createServerManager();
|
|
347
376
|
}
|
|
348
|
-
return
|
|
377
|
+
return serverManager;
|
|
349
378
|
}
|
|
350
379
|
async function stopServer() {
|
|
351
|
-
|
|
352
|
-
return await server.stop();
|
|
380
|
+
return stopServerProcess();
|
|
353
381
|
}
|
|
354
382
|
|
|
355
383
|
// src/commands/dev/actions/dev-server.ts
|
|
@@ -357,7 +385,7 @@ import { logger } from "@elizaos/core";
|
|
|
357
385
|
async function startDevMode(options) {
|
|
358
386
|
const cwd = process.cwd();
|
|
359
387
|
const context = createDevContext(cwd);
|
|
360
|
-
const
|
|
388
|
+
const serverManager2 = getServerManager();
|
|
361
389
|
const { directoryType } = context;
|
|
362
390
|
const isProject = directoryType.type === "elizaos-project";
|
|
363
391
|
const isPlugin2 = directoryType.type === "elizaos-plugin";
|
|
@@ -408,17 +436,17 @@ async function startDevMode(options) {
|
|
|
408
436
|
}
|
|
409
437
|
const rebuildAndRestart = async () => {
|
|
410
438
|
try {
|
|
411
|
-
await
|
|
439
|
+
await serverManager2.stop();
|
|
412
440
|
await performRebuild(context);
|
|
413
441
|
console.log("\u2713 Rebuild successful, restarting...");
|
|
414
|
-
await
|
|
442
|
+
await serverManager2.start(cliArgs);
|
|
415
443
|
} catch (error) {
|
|
416
444
|
console.error(
|
|
417
445
|
`Error during rebuild and restart: ${error instanceof Error ? error.message : String(error)}`
|
|
418
446
|
);
|
|
419
|
-
if (!
|
|
447
|
+
if (!serverManager2.process) {
|
|
420
448
|
console.info("Attempting to restart server regardless of build failure...");
|
|
421
|
-
await
|
|
449
|
+
await serverManager2.start(cliArgs);
|
|
422
450
|
}
|
|
423
451
|
}
|
|
424
452
|
};
|
|
@@ -427,7 +455,7 @@ async function startDevMode(options) {
|
|
|
427
455
|
console.info(`Running in ${modeDescription} mode`);
|
|
428
456
|
await performInitialBuild(context);
|
|
429
457
|
}
|
|
430
|
-
await
|
|
458
|
+
await serverManager2.start(cliArgs);
|
|
431
459
|
if (isProject || isPlugin2 || isMonorepo) {
|
|
432
460
|
await watchDirectory(context.watchDirectory, rebuildAndRestart);
|
|
433
461
|
console.log("Dev mode is active! The server will restart when files change.");
|
|
@@ -4686,9 +4714,7 @@ async function startAgents(options) {
|
|
|
4686
4714
|
const postgresUrl = await configureDatabaseSettings(options.configure);
|
|
4687
4715
|
if (postgresUrl) process.env.POSTGRES_URL = postgresUrl;
|
|
4688
4716
|
const pgliteDataDir = postgresUrl ? void 0 : await resolvePgliteDir();
|
|
4689
|
-
const
|
|
4690
|
-
const projectPath = monorepoRoot || process.cwd();
|
|
4691
|
-
const moduleLoader = new ModuleLoader(projectPath);
|
|
4717
|
+
const moduleLoader = getModuleLoader();
|
|
4692
4718
|
const serverModule = await moduleLoader.load("@elizaos/server");
|
|
4693
4719
|
const { AgentServer, jsonToCharacter, loadCharacterTryPath } = serverModule;
|
|
4694
4720
|
const __filename = fileURLToPath4(import.meta.url);
|
|
@@ -4789,7 +4815,7 @@ var start = new Command7().name("start").description("Build and start the Eliza
|
|
|
4789
4815
|
let characters = [];
|
|
4790
4816
|
let projectAgents = [];
|
|
4791
4817
|
if (options.character && options.character.length > 0) {
|
|
4792
|
-
const moduleLoader =
|
|
4818
|
+
const moduleLoader = getModuleLoader();
|
|
4793
4819
|
const serverModule = await moduleLoader.load("@elizaos/server");
|
|
4794
4820
|
const { loadCharacterTryPath } = serverModule;
|
|
4795
4821
|
for (const charPath of options.character) {
|
|
@@ -4847,13 +4873,13 @@ import { Command as Command9 } from "commander";
|
|
|
4847
4873
|
|
|
4848
4874
|
// src/commands/tee/phala-wrapper.ts
|
|
4849
4875
|
import { Command as Command8 } from "commander";
|
|
4850
|
-
import { spawn
|
|
4876
|
+
import { spawn } from "child_process";
|
|
4851
4877
|
import { elizaLogger } from "@elizaos/core";
|
|
4852
4878
|
var phalaCliCommand = new Command8("phala").description("Official Phala Cloud CLI - Manage TEE deployments on Phala Cloud").allowUnknownOption().helpOption(false).action(async (_, command) => {
|
|
4853
4879
|
const args = command.args;
|
|
4854
4880
|
try {
|
|
4855
4881
|
elizaLogger.info("Running Phala CLI command:", ["phala", ...args].join(" "));
|
|
4856
|
-
const phalaProcess =
|
|
4882
|
+
const phalaProcess = spawn("npx", ["--yes", "phala", ...args], {
|
|
4857
4883
|
stdio: "inherit",
|
|
4858
4884
|
shell: true
|
|
4859
4885
|
});
|
|
@@ -4955,7 +4981,7 @@ async function installPluginDependencies(projectInfo) {
|
|
|
4955
4981
|
};
|
|
4956
4982
|
await fs11.promises.writeFile(packageJsonPath, JSON.stringify(packageJsonContent, null, 2));
|
|
4957
4983
|
}
|
|
4958
|
-
const { installPlugin: installPlugin2 } = await import("./utils-
|
|
4984
|
+
const { installPlugin: installPlugin2 } = await import("./utils-TV5USNZM.js");
|
|
4959
4985
|
for (const dependency of project.pluginModule.dependencies) {
|
|
4960
4986
|
await installPlugin2(dependency, pluginsDir);
|
|
4961
4987
|
const dependencyPath = path25.join(pluginsDir, "node_modules", dependency);
|
|
@@ -4974,7 +5000,7 @@ async function installPluginDependencies(projectInfo) {
|
|
|
4974
5000
|
|
|
4975
5001
|
// src/commands/test/actions/component-tests.ts
|
|
4976
5002
|
import { logger as logger23 } from "@elizaos/core";
|
|
4977
|
-
import { spawn as
|
|
5003
|
+
import { spawn as spawn2 } from "child_process";
|
|
4978
5004
|
import path27 from "path";
|
|
4979
5005
|
|
|
4980
5006
|
// src/utils/testing/tsc-validator.ts
|
|
@@ -5053,7 +5079,7 @@ async function runComponentTests(testPath, options, projectInfo) {
|
|
|
5053
5079
|
const baseDir = monorepoRoot ?? process.cwd();
|
|
5054
5080
|
const targetPath = testPath ? path27.resolve(baseDir, testPath) : process.cwd();
|
|
5055
5081
|
logger23.info(`Executing: bun ${args.join(" ")} in ${targetPath}`);
|
|
5056
|
-
const child =
|
|
5082
|
+
const child = spawn2("bun", args, {
|
|
5057
5083
|
stdio: "inherit",
|
|
5058
5084
|
shell: false,
|
|
5059
5085
|
cwd: targetPath,
|
|
@@ -5098,7 +5124,7 @@ async function runE2eTests(testPath, options, projectInfo) {
|
|
|
5098
5124
|
try {
|
|
5099
5125
|
const runtimes = [];
|
|
5100
5126
|
const projectAgents = [];
|
|
5101
|
-
const moduleLoader =
|
|
5127
|
+
const moduleLoader = getModuleLoader();
|
|
5102
5128
|
const serverModule = await moduleLoader.load("@elizaos/server");
|
|
5103
5129
|
const { AgentServer, jsonToCharacter, loadCharacterTryPath } = serverModule;
|
|
5104
5130
|
const elizaDir = path28.join(process.cwd(), ".eliza");
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@elizaos/cli": "1.2.11-beta.
|
|
32
|
-
"@elizaos/core": "1.2.11-beta.
|
|
33
|
-
"@elizaos/plugin-bootstrap": "1.2.11-beta.
|
|
34
|
-
"@elizaos/plugin-sql": "1.2.11-beta.
|
|
31
|
+
"@elizaos/cli": "1.2.11-beta.8",
|
|
32
|
+
"@elizaos/core": "1.2.11-beta.8",
|
|
33
|
+
"@elizaos/plugin-bootstrap": "1.2.11-beta.8",
|
|
34
|
+
"@elizaos/plugin-sql": "1.2.11-beta.8",
|
|
35
35
|
"@tanstack/react-query": "^5.29.0",
|
|
36
36
|
"clsx": "^2.1.1",
|
|
37
37
|
"react": "^18.3.1",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"GUIDE.md"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@elizaos/cli": "1.2.11-beta.
|
|
37
|
-
"@elizaos/core": "1.2.11-beta.
|
|
36
|
+
"@elizaos/cli": "1.2.11-beta.8",
|
|
37
|
+
"@elizaos/core": "1.2.11-beta.8",
|
|
38
38
|
"@elizaos/plugin-redpill": "1.0.3",
|
|
39
|
-
"@elizaos/plugin-sql": "1.2.11-beta.
|
|
39
|
+
"@elizaos/plugin-sql": "1.2.11-beta.8",
|
|
40
40
|
"@phala/dstack-sdk": "0.1.11",
|
|
41
41
|
"@solana/web3.js": "1.98.2",
|
|
42
42
|
"viem": "2.30.1",
|
|
@@ -71,6 +71,7 @@ import {
|
|
|
71
71
|
loadConfig,
|
|
72
72
|
loadEnvironment,
|
|
73
73
|
loadModule,
|
|
74
|
+
loadModuleSync,
|
|
74
75
|
loadPluginModule,
|
|
75
76
|
logHeader,
|
|
76
77
|
migrateCliToBun,
|
|
@@ -115,7 +116,7 @@ import {
|
|
|
115
116
|
updateFile,
|
|
116
117
|
validateGitHubToken,
|
|
117
118
|
writeEnvFile
|
|
118
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-3LVXQ7VC.js";
|
|
119
120
|
import {
|
|
120
121
|
runBunCommand
|
|
121
122
|
} from "./chunk-FDEDLANP.js";
|
|
@@ -195,6 +196,7 @@ export {
|
|
|
195
196
|
loadConfig,
|
|
196
197
|
loadEnvironment,
|
|
197
198
|
loadModule,
|
|
199
|
+
loadModuleSync,
|
|
198
200
|
loadPluginModule,
|
|
199
201
|
logHeader,
|
|
200
202
|
migrateCliToBun,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elizaos/cli",
|
|
3
|
-
"version": "1.2.11-beta.
|
|
3
|
+
"version": "1.2.11-beta.9",
|
|
4
4
|
"description": "elizaOS CLI - Manage your AI agents and plugins",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -69,14 +69,14 @@
|
|
|
69
69
|
"typescript": "5.8.3",
|
|
70
70
|
"vite": "^6.3.5"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "b2fd132ee191a206b6202503b9742ae4c6d28b6c",
|
|
73
73
|
"dependencies": {
|
|
74
74
|
"@anthropic-ai/claude-code": "^1.0.35",
|
|
75
75
|
"@anthropic-ai/sdk": "^0.54.0",
|
|
76
76
|
"@clack/prompts": "^0.11.0",
|
|
77
|
-
"@elizaos/core": "1.2.11-beta.
|
|
78
|
-
"@elizaos/plugin-sql": "1.2.11-beta.
|
|
79
|
-
"@elizaos/server": "1.2.11-beta.
|
|
77
|
+
"@elizaos/core": "1.2.11-beta.9",
|
|
78
|
+
"@elizaos/plugin-sql": "1.2.11-beta.9",
|
|
79
|
+
"@elizaos/server": "1.2.11-beta.9",
|
|
80
80
|
"bun": "^1.2.17",
|
|
81
81
|
"chalk": "^5.3.0",
|
|
82
82
|
"chokidar": "^4.0.3",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@elizaos/cli": "1.2.11-beta.
|
|
32
|
-
"@elizaos/core": "1.2.11-beta.
|
|
33
|
-
"@elizaos/plugin-bootstrap": "1.2.11-beta.
|
|
34
|
-
"@elizaos/plugin-sql": "1.2.11-beta.
|
|
31
|
+
"@elizaos/cli": "1.2.11-beta.8",
|
|
32
|
+
"@elizaos/core": "1.2.11-beta.8",
|
|
33
|
+
"@elizaos/plugin-bootstrap": "1.2.11-beta.8",
|
|
34
|
+
"@elizaos/plugin-sql": "1.2.11-beta.8",
|
|
35
35
|
"@tanstack/react-query": "^5.29.0",
|
|
36
36
|
"clsx": "^2.1.1",
|
|
37
37
|
"react": "^18.3.1",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"GUIDE.md"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@elizaos/cli": "1.2.11-beta.
|
|
37
|
-
"@elizaos/core": "1.2.11-beta.
|
|
36
|
+
"@elizaos/cli": "1.2.11-beta.8",
|
|
37
|
+
"@elizaos/core": "1.2.11-beta.8",
|
|
38
38
|
"@elizaos/plugin-redpill": "1.0.3",
|
|
39
|
-
"@elizaos/plugin-sql": "1.2.11-beta.
|
|
39
|
+
"@elizaos/plugin-sql": "1.2.11-beta.8",
|
|
40
40
|
"@phala/dstack-sdk": "0.1.11",
|
|
41
41
|
"@solana/web3.js": "1.98.2",
|
|
42
42
|
"viem": "2.30.1",
|