diff --git a/agent/tsconfig.json b/agent/tsconfig.json index e61ebc27ce4..a959a90103c 100644 --- a/agent/tsconfig.json +++ b/agent/tsconfig.json @@ -9,6 +9,11 @@ "node" ] }, + "ts-node": { + "experimentalSpecifierResolution": "node", + "transpileOnly": true, + "esm": true, + }, "include": [ "src" ] diff --git a/package.json b/package.json index fef7142766c..8006b831573 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "start": "pnpm --filter \"@ai16z/agent\" start --isRoot", "start:client": "pnpm --dir client start --isRoot", "start:debug": "cross-env NODE_ENV=development VERBOSE=true DEBUG=eliza:* pnpm --filter \"@ai16z/agent\" start --isRoot", - "dev": "turbo check-types dev --concurrency 25", + "dev": "bash ./scripts/dev.sh", + "dev:build": "turbo run build --filter=!eliza-docs", "lint": "bash ./scripts/lint.sh", "prettier-check": "npx prettier --check .", "prettier": "npx prettier --write .", diff --git a/packages/adapter-sqljs/package.json b/packages/adapter-sqljs/package.json index 568f56e1298..d1785e2e4d3 100644 --- a/packages/adapter-sqljs/package.json +++ b/packages/adapter-sqljs/package.json @@ -15,7 +15,7 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix" }, "peerDependencies": { diff --git a/packages/adapter-supabase/package.json b/packages/adapter-supabase/package.json index 07dcb70df7c..5970a01bb2d 100644 --- a/packages/adapter-supabase/package.json +++ b/packages/adapter-supabase/package.json @@ -13,7 +13,7 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix" }, "peerDependencies": { diff --git a/packages/client-auto/package.json b/packages/client-auto/package.json index a1e2b6877d4..04794b18adf 100644 --- a/packages/client-auto/package.json +++ b/packages/client-auto/package.json @@ -18,7 +18,7 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix" }, "peerDependencies": { diff --git a/packages/client-direct/package.json b/packages/client-direct/package.json index b701166386e..7efb2e05d8d 100644 --- a/packages/client-direct/package.json +++ b/packages/client-direct/package.json @@ -21,7 +21,7 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix" }, "peerDependencies": { diff --git a/packages/client-discord/package.json b/packages/client-discord/package.json index 5c1ded02753..d8cbd5f69e4 100644 --- a/packages/client-discord/package.json +++ b/packages/client-discord/package.json @@ -20,7 +20,7 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix" }, "trustedDependencies": { diff --git a/packages/client-farcaster/package.json b/packages/client-farcaster/package.json index 95e7a3d53d0..afb7429890d 100644 --- a/packages/client-farcaster/package.json +++ b/packages/client-farcaster/package.json @@ -14,7 +14,7 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch" + "dev": "tsup --format esm --dts --watch" }, "peerDependencies": {} } diff --git a/packages/client-github/package.json b/packages/client-github/package.json index 6501680e727..107c2c20dd5 100644 --- a/packages/client-github/package.json +++ b/packages/client-github/package.json @@ -17,7 +17,7 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix" } } diff --git a/packages/client-telegram/package.json b/packages/client-telegram/package.json index 0e49a4f2f63..d9f9a58a703 100644 --- a/packages/client-telegram/package.json +++ b/packages/client-telegram/package.json @@ -15,7 +15,7 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix" } } diff --git a/packages/client-twitter/package.json b/packages/client-twitter/package.json index 4d71932b126..1f6fcdca33e 100644 --- a/packages/client-twitter/package.json +++ b/packages/client-twitter/package.json @@ -15,7 +15,7 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix" }, "peerDependencies": { diff --git a/packages/plugin-0g/package.json b/packages/plugin-0g/package.json index 607d7aca091..32d76c3cd5f 100644 --- a/packages/plugin-0g/package.json +++ b/packages/plugin-0g/package.json @@ -12,7 +12,7 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch", + "dev": "tsup --format esm --dts --watch", "test": "vitest" } } diff --git a/packages/plugin-bootstrap/package.json b/packages/plugin-bootstrap/package.json index fff6728493e..56e660a40a4 100644 --- a/packages/plugin-bootstrap/package.json +++ b/packages/plugin-bootstrap/package.json @@ -11,7 +11,7 @@ "devDependencies": {}, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix" }, "peerDependencies": { diff --git a/packages/plugin-buttplug/package.json b/packages/plugin-buttplug/package.json index 1292740a63f..e9f7ed891a0 100644 --- a/packages/plugin-buttplug/package.json +++ b/packages/plugin-buttplug/package.json @@ -12,6 +12,7 @@ }, "scripts": { "build": "tsup --format esm --dts", + "dev": "tsup --format esm --dts --watch", "test-via-bun": "bun test/simulate.ts" }, "peerDependencies": { diff --git a/packages/plugin-coinbase/package.json b/packages/plugin-coinbase/package.json index 5d5c8859c5e..c69f9f68a96 100644 --- a/packages/plugin-coinbase/package.json +++ b/packages/plugin-coinbase/package.json @@ -13,7 +13,7 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix" } } diff --git a/packages/plugin-conflux/package.json b/packages/plugin-conflux/package.json index c1bb22f059f..097250b9960 100644 --- a/packages/plugin-conflux/package.json +++ b/packages/plugin-conflux/package.json @@ -10,6 +10,6 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch" + "dev": "tsup --format esm --dts --watch" } } diff --git a/packages/plugin-evm/package.json b/packages/plugin-evm/package.json index 3654ad90039..0892ddc1263 100644 --- a/packages/plugin-evm/package.json +++ b/packages/plugin-evm/package.json @@ -14,7 +14,8 @@ "viem": "2.21.53" }, "scripts": { - "build": "tsup --format esm --dts" + "build": "tsup --format esm --dts", + "dev": "tsup --format esm --dts --watch" }, "peerDependencies": { "whatwg-url": "7.1.0" diff --git a/packages/plugin-goat/package.json b/packages/plugin-goat/package.json index 88c73c51040..af731b421aa 100644 --- a/packages/plugin-goat/package.json +++ b/packages/plugin-goat/package.json @@ -13,7 +13,8 @@ "viem": "^2.21.45" }, "scripts": { - "build": "tsup --format esm --dts" + "build": "tsup --format esm --dts", + "dev": "tsup --format esm --dts --watch" }, "peerDependencies": { "whatwg-url": "7.1.0" diff --git a/packages/plugin-icp/package.json b/packages/plugin-icp/package.json index 39e3ff9c13b..0297ff820b4 100644 --- a/packages/plugin-icp/package.json +++ b/packages/plugin-icp/package.json @@ -12,7 +12,8 @@ "@dfinity/principal": "2.1.3" }, "scripts": { - "build": "tsup --format esm --dts" + "build": "tsup --format esm --dts", + "dev": "tsup --format esm --dts --watch" }, "devDependencies": { "@types/jest": "29.5.14", diff --git a/packages/plugin-image-generation/package.json b/packages/plugin-image-generation/package.json index b458d5c7fcb..9305c51be9c 100644 --- a/packages/plugin-image-generation/package.json +++ b/packages/plugin-image-generation/package.json @@ -11,6 +11,7 @@ "devDependencies": {}, "scripts": { "build": "tsup --format esm --dts", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix" }, "peerDependencies": { diff --git a/packages/plugin-node/package.json b/packages/plugin-node/package.json index bc154661539..82c987e2e1a 100644 --- a/packages/plugin-node/package.json +++ b/packages/plugin-node/package.json @@ -65,7 +65,7 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix", "postinstall": "node scripts/postinstall.js" }, diff --git a/packages/plugin-solana/package.json b/packages/plugin-solana/package.json index ecf43d2816e..d2119b81099 100644 --- a/packages/plugin-solana/package.json +++ b/packages/plugin-solana/package.json @@ -21,6 +21,7 @@ "devDependencies": {}, "scripts": { "build": "tsup --format esm --dts", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix", "test": "vitest run" }, diff --git a/packages/plugin-starknet/package.json b/packages/plugin-starknet/package.json index 0ceedafc94a..8a1ce10f94d 100644 --- a/packages/plugin-starknet/package.json +++ b/packages/plugin-starknet/package.json @@ -17,6 +17,7 @@ "devDependencies": {}, "scripts": { "build": "tsup --format esm --dts", + "dev": "tsup --format esm --dts --watch", "test": "vitest run", "test:watch": "vitest", "lint": "eslint . --fix" diff --git a/packages/plugin-tee/package.json b/packages/plugin-tee/package.json index b94711a69da..bd7193f05ff 100644 --- a/packages/plugin-tee/package.json +++ b/packages/plugin-tee/package.json @@ -19,7 +19,7 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch" + "dev": "tsup --format esm --dts --watch" }, "peerDependencies": { "whatwg-url": "7.1.0" diff --git a/packages/plugin-trustdb/package.json b/packages/plugin-trustdb/package.json index 7e1870cfb31..d1a1da681bf 100644 --- a/packages/plugin-trustdb/package.json +++ b/packages/plugin-trustdb/package.json @@ -13,6 +13,7 @@ }, "scripts": { "build": "tsup --format esm --dts", + "dev": "tsup --format esm --dts --watch", "test": "vitest run", "test:watch": "vitest", "lint": "eslint . --fix" diff --git a/packages/plugin-video-generation/package.json b/packages/plugin-video-generation/package.json index fd0048175e0..7a1f75f02b1 100644 --- a/packages/plugin-video-generation/package.json +++ b/packages/plugin-video-generation/package.json @@ -11,7 +11,7 @@ "devDependencies": {}, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix" }, "peerDependencies": { diff --git a/packages/plugin-web-search/package.json b/packages/plugin-web-search/package.json index c62cb487d0b..843583bfe51 100644 --- a/packages/plugin-web-search/package.json +++ b/packages/plugin-web-search/package.json @@ -9,7 +9,8 @@ "tsup": "8.3.5" }, "scripts": { - "build": "tsup --format esm --dts" + "build": "tsup --format esm --dts", + "dev": "tsup --format esm --dts --watch" }, "peerDependencies": { "whatwg-url": "7.1.0" diff --git a/packages/plugin-whatsapp/package.json b/packages/plugin-whatsapp/package.json index 61aef5448e0..d0322ca8573 100644 --- a/packages/plugin-whatsapp/package.json +++ b/packages/plugin-whatsapp/package.json @@ -5,7 +5,8 @@ "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": { - "build": "tsc", + "build": "tsup --format esm --dts", + "dev": "tsup --format esm --dts --watch", "test": "jest", "lint": "eslint . --fix" }, diff --git a/packages/plugin-whatsapp/tsconfig.json b/packages/plugin-whatsapp/tsconfig.json index 060b2973f03..f21178232b8 100644 --- a/packages/plugin-whatsapp/tsconfig.json +++ b/packages/plugin-whatsapp/tsconfig.json @@ -1,15 +1,8 @@ { + "extends": "../core/tsconfig.json", "compilerOptions": { - "target": "es2018", - "module": "commonjs", - "declaration": true, "outDir": "./dist", - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "moduleResolution": "node", - "resolveJsonModule": true, + "rootDir": "src", "baseUrl": ".", "types": [ "node", @@ -17,7 +10,7 @@ ] }, "include": [ - "src/**/*" + "src/**/*.ts" ], "exclude": [ "node_modules", diff --git a/scripts/dev.sh b/scripts/dev.sh index c8c83490cce..f474900905d 100644 --- a/scripts/dev.sh +++ b/scripts/dev.sh @@ -1,14 +1,73 @@ +#!/bin/bash + echo "Passing arguments: $*" -npx concurrently --raw \ - "pnpm --dir packages/core dev -- $*" \ - "pnpm --dir client dev -- $*" \ - "pnpm --dir packages/client-telegram dev -- $*" \ - "pnpm --dir packages/client-discord dev -- $*" \ - "pnpm --dir packages/client-twitter dev -- $*" \ - "pnpm --dir packages/client-direct dev -- $*" \ - "pnpm --dir packages/plugin-bootstrap dev -- $*" \ - "pnpm --dir packages/plugin-node dev -- $*" \ - "pnpm --dir packages/adapter-sqlite dev -- $*" \ - "pnpm --dir packages/adapter-postgres dev -- $*" \ - "pnpm --dir packages/plugin-buttplug dev -- $*" \ - "node -e \"setTimeout(() => process.exit(0), 5000)\" && pnpm --dir agent dev -- $*" \ No newline at end of file + +# Base packages directory +PACKAGES_DIR="./packages" + +# Check if the packages directory exists +if [ ! -d "$PACKAGES_DIR" ]; then + echo "Error: Directory $PACKAGES_DIR does not exist." + exit 1 +fi + +# Function to check if an item is in an array +is_in_array() { + local item="$1" + shift + for element; do + if [[ "$element" == "$item" ]]; then + return 0 + fi + done + return 1 +} + +# Initialize an array to hold package-specific commands +COMMANDS=() + +# Ensure "core" package runs first +if [ -d "$PACKAGES_DIR/core" ]; then + COMMANDS+=("pnpm --dir $PACKAGES_DIR/core dev -- $*") +else + echo "Warning: 'core' package not found in $PACKAGES_DIR." +fi + +# List of folders to exclude +EXCLUDED_FOLDERS=("create-eliza-app" "debug_audio" "content_cache") + +# Iterate over all other subdirectories in the packages folder +for PACKAGE in "$PACKAGES_DIR"/*; do + PACKAGE_NAME=$(basename "$PACKAGE") + + # Skip excluded folders and "core" + if [ -d "$PACKAGE" ] && ! is_in_array "$PACKAGE_NAME" "${EXCLUDED_FOLDERS[@]}" && [ "$PACKAGE_NAME" != "core" ]; then + COMMANDS+=("pnpm --dir $PACKAGE dev -- $*") + fi +done + +# Add specific commands for other directories or cases +if [ -d "./client" ]; then + COMMANDS+=("pnpm --dir client dev -- $*") +else + echo "Warning: 'client' directory not found." +fi + +if [ -d "./agent" ]; then + COMMANDS+=("node -e \"setTimeout(() => process.exit(0), 5000)\" && pnpm --dir agent dev -- $*") +else + echo "Warning: 'agent' directory not found." +fi + +# Run build command first +if ! pnpm dev:build; then + echo "Build failed. Exiting." + exit 1 +fi + +# Run all commands concurrently +if [ ${#COMMANDS[@]} -gt 0 ]; then + npx concurrently --raw "${COMMANDS[@]}" +else + echo "No valid packages to run." +fi