Skip to content

Commit b72b518

Browse files
committed
lint and version
1 parent 05272a1 commit b72b518

File tree

994 files changed

+1169
-99
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

994 files changed

+1169
-99
lines changed

packages/cli/package.json

+6-9
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515
"url": "https://github.com/elizaOS/eliza.git",
1616
"directory": "packages/cli"
1717
},
18-
"files": [
19-
"dist",
20-
"templates"
21-
],
18+
"files": ["dist", "templates"],
2219
"keywords": [],
2320
"type": "module",
2421
"exports": {
@@ -30,15 +27,12 @@
3027
},
3128
"scripts": {
3229
"cli": "bun build src/index.ts --outdir dist --watch",
33-
"build": "tsup --format esm --dts",
30+
"build": "tsup --format esm --dts && bun run src/scripts/copy-client-dist.ts",
3431
"watch": "tsc --watch",
3532
"dev": "tsup --format esm --dts --watch",
3633
"typecheck": "tsc --noEmit",
3734
"start:cli": "bun run build && node dist/index.js",
3835
"release": "changeset version",
39-
"pub:beta": "tsup --format esm && bun publish --no-git-checks --access public --tag beta",
40-
"pub:next": "tsup --format esm && bun publish --no-git-checks --access public --tag next",
41-
"pub:release": "tsup --format esm && bun publish --access public",
4236
"test": "vitest run",
4337
"test:dev": "REGISTRY_URL=http://localhost:3333 vitest run"
4438
},
@@ -48,7 +42,10 @@
4842
"@babel/parser": "^7.22.6",
4943
"@babel/plugin-transform-typescript": "^7.22.5",
5044
"@elizaos/core": "workspace:*",
51-
"@elizaos/plugin-sql": "workspace:*",
45+
"@elizaos/plugin-sql": "*:workspace",
46+
"@elizaos/client": "*:workspace",
47+
"@elizaos/plugin-starter": "*:workspace",
48+
"@elizaos/project-starter": "*:workspace",
5249
"@noble/curves": "^1.8.1",
5350
"axios": "^1.7.9",
5451
"chalk": "5.2.0",

packages/cli/src/commands/init.ts

+32-1
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,37 @@ export const init = new Command()
256256
// Copy project template
257257
await copyTemplate("project", targetDir, name);
258258

259+
// Create a database directory in the user's home folder, similar to start.ts
260+
let dbPath = "../../pglite"; // Default fallback path
261+
try {
262+
// Get the user's home directory
263+
const homeDir = os.homedir();
264+
const elizaDir = path.join(homeDir, ".eliza");
265+
const elizaDbDir = path.join(elizaDir, "db");
266+
267+
// Check if .eliza directory exists, create if not
268+
if (!existsSync(elizaDir)) {
269+
logger.info(`Creating .eliza directory at: ${elizaDir}`);
270+
await fs.mkdir(elizaDir, { recursive: true });
271+
}
272+
273+
// Check if db directory exists in .eliza, create if not
274+
if (!existsSync(elizaDbDir)) {
275+
logger.info(`Creating db directory at: ${elizaDbDir}`);
276+
await fs.mkdir(elizaDbDir, { recursive: true });
277+
}
278+
279+
// Use the db directory path
280+
dbPath = elizaDbDir;
281+
logger.info(`Using database directory: ${dbPath}`);
282+
} catch (error) {
283+
logger.warn(
284+
"Failed to create database directory in home directory, using fallback location:",
285+
error,
286+
);
287+
// On failure, use the fallback path
288+
}
289+
259290
// Create project configuration
260291
const config = rawConfigSchema.parse({
261292
$schema: "https://elizaos.com/schema.json",
@@ -267,7 +298,7 @@ export const init = new Command()
267298
url: process.env.POSTGRES_URL || "",
268299
}
269300
: {
270-
path: "../../pglite",
301+
path: dbPath,
271302
},
272303
},
273304
plugins: {

packages/cli/src/commands/start.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -519,11 +519,14 @@ const startAgents = async () => {
519519
}
520520

521521
// Display link to the client UI
522-
const clientPath = path.join(
523-
__dirname,
524-
"../../../..",
525-
"packages/client/dist",
526-
);
522+
// First try to find it in the CLI package dist/client directory
523+
let clientPath = path.join(__dirname, "../../client");
524+
525+
// If not found, fall back to the old relative path for development
526+
if (!fs.existsSync(clientPath)) {
527+
clientPath = path.join(__dirname, "../../../..", "packages/client/dist");
528+
}
529+
527530
if (fs.existsSync(clientPath)) {
528531
logger.success(
529532
`Client UI is available at http://localhost:${serverPort}/client`,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { copyClientDist } from "../utils/copy-template.js";
2+
3+
async function main() {
4+
console.log("Running copy-client-dist script...");
5+
await copyClientDist();
6+
console.log("Script completed");
7+
}
8+
9+
main().catch((error) => {
10+
console.error("Error running copy-client-dist script:", error);
11+
process.exit(1);
12+
});

packages/cli/src/server/index.ts

+19-13
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,16 @@ export class AgentServer {
5959
);
6060

6161
// Initialize the database
62-
this.database.init().then(() => {
63-
logger.success("Database initialized successfully");
64-
this.initializeServer(options);
65-
}).catch((error) => {
66-
logger.error("Failed to initialize database:", error);
67-
throw error;
68-
});
62+
this.database
63+
.init()
64+
.then(() => {
65+
logger.success("Database initialized successfully");
66+
this.initializeServer(options);
67+
})
68+
.catch((error) => {
69+
logger.error("Failed to initialize database:", error);
70+
throw error;
71+
});
6972
} catch (error) {
7073
logger.error("Failed to initialize AgentServer:", error);
7174
throw error;
@@ -97,12 +100,15 @@ export class AgentServer {
97100
this.app.use("/media/uploads", express.static(uploadsPath));
98101
this.app.use("/media/generated", express.static(generatedPath));
99102

100-
// Serve client application from packages/client/dist
101-
const clientPath = path.join(
102-
__dirname,
103-
"../../..",
104-
"packages/client/dist",
105-
);
103+
// Serve client application
104+
// First try to find it in the CLI package dist/client directory
105+
let clientPath = path.join(__dirname, "../client");
106+
107+
// If not found, fall back to the old relative path for development
108+
if (!fs.existsSync(clientPath)) {
109+
clientPath = path.join(__dirname, "../../..", "packages/client/dist");
110+
}
111+
106112
if (fs.existsSync(clientPath)) {
107113
logger.debug(
108114
`Found client build at ${clientPath}, serving it at /client and root path`,

packages/cli/src/utils/copy-template.ts

+30-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { promises as fs } from "node:fs";
1+
import { promises as fs, existsSync } from "node:fs";
22
import path from "node:path";
33
import { logger } from "./logger";
44
import { getPackageVersion } from "./get-package-info";
@@ -26,10 +26,9 @@ export async function copyDir(
2626
continue;
2727
}
2828

29-
// Skip node_modules, dist directories and .git directories
29+
// Skip node_modules, .git directories and other build artifacts
3030
if (
3131
entry.name === "node_modules" ||
32-
entry.name === "dist" ||
3332
entry.name === ".git" ||
3433
entry.name === "content_cache" ||
3534
entry.name === "data" ||
@@ -125,3 +124,31 @@ export async function copyTemplate(
125124

126125
logger.success(`${templateType} template copied successfully`);
127126
}
127+
128+
/**
129+
* Copy client dist files to the CLI package dist directory
130+
*/
131+
export async function copyClientDist() {
132+
logger.info("Copying client dist files to CLI package");
133+
134+
// Determine source and destination paths
135+
const srcClientDist = path.resolve(process.cwd(), "packages/client/dist");
136+
const destClientDist = path.resolve(
137+
process.cwd(),
138+
"packages/cli/dist/client",
139+
);
140+
141+
// Create destination directory
142+
await fs.mkdir(destClientDist, { recursive: true });
143+
144+
// Check if source exists
145+
if (!existsSync(srcClientDist)) {
146+
logger.error(`Client dist not found at ${srcClientDist}`);
147+
return;
148+
}
149+
150+
// Copy client dist files
151+
await copyDir(srcClientDist, destClientDist);
152+
153+
logger.success("Client dist files copied successfully");
154+
}

packages/client/src/lib/info.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version": "1.0.0-alpha.2"}
1+
{ "version": "1.0.0-alpha.3" }

packages/core/package.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616
}
1717
}
1818
},
19-
"files": [
20-
"dist"
21-
],
19+
"files": ["dist"],
2220
"scripts": {
2321
"build": "tsup --format esm --dts",
2422
"watch": "tsc --watch",

packages/plugin-anthropic/package.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@
1414
}
1515
}
1616
},
17-
"files": [
18-
"dist"
19-
],
17+
"files": ["dist"],
2018
"dependencies": {
2119
"@ai-sdk/anthropic": "^1.1.6",
22-
"@elizaos/core": "^1.0.0-alpha.3",
20+
"@elizaos/core": "workspace:*",
2321
"fastembed": "^1.0.0",
2422
"tsup": "8.4.0",
2523
"zod": "3.21.4"

packages/plugin-discord/package.json

+2-7
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
}
1616
}
1717
},
18-
"files": [
19-
"dist"
20-
],
18+
"files": ["dist"],
2119
"dependencies": {
2220
"@discordjs/opus": "github:discordjs/opus",
2321
"@discordjs/rest": "2.4.0",
@@ -37,10 +35,7 @@
3735
"dev": "tsup --format esm --dts --watch",
3836
"test": "vitest run"
3937
},
40-
"trustedDependencies": [
41-
"@discordjs/opus",
42-
"@discordjs/voice"
43-
],
38+
"trustedDependencies": ["@discordjs/opus", "@discordjs/voice"],
4439
"peerDependencies": {
4540
"whatwg-url": "7.1.0"
4641
},

packages/plugin-elevenlabs/package.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@
1414
}
1515
}
1616
},
17-
"files": [
18-
"dist"
19-
],
17+
"files": ["dist"],
2018
"dependencies": {
21-
"@elizaos/core": "^1.0.0-alpha.3",
19+
"@elizaos/core": "workspace:*",
2220
"tsup": "8.4.0"
2321
},
2422
"scripts": {

packages/plugin-local-ai/package.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
}
1515
}
1616
},
17-
"files": [
18-
"dist"
19-
],
17+
"files": ["dist"],
2018
"dependencies": {
2119
"@anush008/tokenizers": "^0.0.0",
2220
"@aws-sdk/client-s3": "^3.749.0",
@@ -25,7 +23,7 @@
2523
"@echogarden/espeak-ng-emscripten": "0.3.3",
2624
"@echogarden/kissfft-wasm": "0.2.0",
2725
"@echogarden/speex-resampler-wasm": "0.2.1",
28-
"@elizaos/core": "^1.0.0-alpha.3",
26+
"@elizaos/core": "workspace:*",
2927
"@huggingface/hub": "^1.0.1",
3028
"@huggingface/inference": "^3.3.4",
3129
"@huggingface/transformers": "^3.3.3",

packages/plugin-node/package.json

+3-11
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,15 @@
1515
}
1616
}
1717
},
18-
"files": [
19-
"dist",
20-
"scripts",
21-
"package.json",
22-
"LICENSE",
23-
"tsup.config.ts"
24-
],
18+
"files": ["dist", "scripts", "package.json", "LICENSE", "tsup.config.ts"],
2519
"dependencies": {
2620
"@aws-sdk/client-s3": "^3.705.0",
2721
"@aws-sdk/s3-request-presigner": "^3.705.0",
2822
"@cliqz/adblocker-playwright": "1.34.0",
2923
"@echogarden/espeak-ng-emscripten": "0.3.3",
3024
"@echogarden/kissfft-wasm": "0.2.0",
3125
"@echogarden/speex-resampler-wasm": "0.2.1",
32-
"@elizaos/core": "^1.0.0-alpha.3",
26+
"@elizaos/core": "workspace:*",
3327
"@opendocsg/pdf2md": "0.1.32",
3428
"@types/uuid": "10.0.0",
3529
"alawmulaw": "6.0.0",
@@ -77,9 +71,7 @@
7771
"yargs": "17.7.2",
7872
"youtube-dl-exec": "3.0.15"
7973
},
80-
"trustedDependencies": [
81-
"youtube-dl-exec"
82-
],
74+
"trustedDependencies": ["youtube-dl-exec"],
8375
"devDependencies": {
8476
"@types/node": "22.8.4",
8577
"tsup": "8.4.0"

packages/plugin-openai/package.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@
1414
}
1515
}
1616
},
17-
"files": [
18-
"dist"
19-
],
17+
"files": ["dist"],
2018
"dependencies": {
2119
"@ai-sdk/openai": "^1.1.9",
2220
"@ai-sdk/ui-utils": "1.1.9",
23-
"@elizaos/core": "^1.0.0-alpha.3",
21+
"@elizaos/core": "workspace:*",
2422
"ai": "^4.1.25",
2523
"js-tiktoken": "^1.0.18",
2624
"tsup": "8.4.0",

packages/plugin-solana/package.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
}
1616
}
1717
},
18-
"files": [
19-
"dist"
20-
],
18+
"files": ["dist"],
2119
"dependencies": {
2220
"@coral-xyz/anchor": "0.30.1",
2321
"@elizaos/core": "workspace:*",

packages/plugin-sql/package.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,10 @@
1818
}
1919
}
2020
},
21-
"files": [
22-
"dist"
23-
],
21+
"files": ["dist"],
2422
"dependencies": {
2523
"@electric-sql/pglite": "^0.2.17",
26-
"@elizaos/core": "^1.0.0-alpha.3",
24+
"@elizaos/core": "workspace:*",
2725
"@types/pg": "8.11.10",
2826
"drizzle-kit": "^0.30.4",
2927
"drizzle-orm": "^0.39.1",

packages/plugin-starter/package.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@
1515
}
1616
}
1717
},
18-
"files": [
19-
"dist"
20-
],
18+
"files": ["dist"],
2119
"dependencies": {
22-
"@elizaos/core": "^1.0.0-alpha.3",
20+
"@elizaos/core": "workspace:*",
2321
"zod": "3.21.4"
2422
},
2523
"devDependencies": {

0 commit comments

Comments
 (0)