Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/mgunnin/virtualDegen int…
Browse files Browse the repository at this point in the history
…o develop

* 'develop' of https://github.com/mgunnin/virtualDegen: (41 commits)
  Update README.md (elizaOS#2495)
  Update README_CN.md (elizaOS#2489)
  Update README_JA.md (elizaOS#2490)
  feat: introduce Dependency Injection to enhance developer experience (elizaOS#2115)
  chore: corrected the link to the banner (elizaOS#2491)
  chore: update createToken.ts (elizaOS#2493)
  feat: Solana plugin improvement for flawless transfers (elizaOS#2340)
  Update README_DE.md (elizaOS#2483)
  feat: Sui supports the secp256k1/secp256r1 algorithms (elizaOS#2476)
  chore: remove eslint, prettier, tslint and replace with biome (elizaOS#2439)
  chore: let -> const
  fix: lint command
  fix: unused import and type errors
  chore: console -> elizaLogger
  fix: error logging and remove unused import
  fix: remove unused error var
  chore: pnpm lock file
  add openai var
  Revert "Revert "refactor: dockerize smoke tests (elizaOS#2420)" (elizaOS#2459)"
  fix swaps evm plugin (elizaOS#2332)
  ...
  • Loading branch information
mgunnin committed Jan 18, 2025
2 parents f0532ef + b336db0 commit 8ae6ae4
Show file tree
Hide file tree
Showing 914 changed files with 10,482 additions and 4,406 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ SUPABASE_ANON_KEY=
REMOTE_CHARACTER_URLS=

# Logging
DEFAULT_LOG_LEVEL=info
LOG_JSON_FORMAT= # Print everything in logger as json; false by default
DEFAULT_LOG_LEVEL=warn
LOG_JSON_FORMAT=false # Print everything in logger as json; false by default

###############################
#### Client Configurations ####
Expand Down
36 changes: 0 additions & 36 deletions .eslintrc.json

This file was deleted.

10 changes: 6 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ jobs:
- name: Install dependencies
run: pnpm install -r --no-frozen-lockfile

- name: Run Prettier
run: pnpm run prettier --check .
- name: Setup Biome CLI
uses: biomejs/setup-biome@v2
with:
version: latest

- name: Run Linter
run: pnpm run lint
- name: Run Biome
run: biome ci

- name: Create test env file
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
runs-on: ubuntu-latest
container:
image: node:23-bullseye
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
steps:
- uses: actions/checkout@v4

Expand Down
2 changes: 1 addition & 1 deletion agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"@elizaos/plugin-sgx": "workspace:*",
"@elizaos/plugin-solana": "workspace:*",
"@elizaos/plugin-injective": "workspace:*",
"@elizaos/plugin-solana-agentkit": "workspace:*",
"@elizaos/plugin-solana-agent-kit": "workspace:*",
"@elizaos/plugin-squid-router": "workspace:*",
"@elizaos/plugin-stargaze": "workspace:*",
"@elizaos/plugin-starknet": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion agent/src/__tests__/client-type-identification.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Client, IAgentRuntime } from "@elizaos/core";
import type { Client, IAgentRuntime } from "@elizaos/core";
import { describe, it, expect } from "@jest/globals";

// Helper function to identify client types
Expand Down
38 changes: 21 additions & 17 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ import {
AgentRuntime,
CacheManager,
CacheStore,
Character,
Client,
type Character,
type Client,
Clients,
DbCacheAdapter,
defaultCharacter,
elizaLogger,
FsCacheAdapter,
IAgentRuntime,
ICacheManager,
IDatabaseAdapter,
IDatabaseCacheAdapter,
type IAgentRuntime,
type ICacheManager,
type IDatabaseAdapter,
type IDatabaseCacheAdapter,
ModelProviderName,
parseBooleanFromText,
settings,
Expand All @@ -40,6 +40,7 @@ import {
import { zgPlugin } from "@elizaos/plugin-0g";

import { bootstrapPlugin } from "@elizaos/plugin-bootstrap";
import { normalizeCharacter } from "@elizaos/plugin-di";
import createGoatPlugin from "@elizaos/plugin-goat";
// import { intifacePlugin } from "@elizaos/plugin-intiface";
import { ThreeDGenerationPlugin } from "@elizaos/plugin-3d-generation";
Expand Down Expand Up @@ -120,7 +121,7 @@ import { timeProvider } from "../providers/timeProvider";
const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file
const __dirname = path.dirname(__filename); // get the name of the directory

export const wait = (minTime: number = 1000, maxTime: number = 3000) => {
export const wait = (minTime = 1000, maxTime = 3000) => {
const waitTime =
Math.floor(Math.random() * (maxTime - minTime + 1)) + minTime;
return new Promise((resolve) => setTimeout(resolve, waitTime));
Expand Down Expand Up @@ -201,7 +202,7 @@ export async function loadCharacterFromOnchain(): Promise<Character[]> {
const jsonText = onchainJson;

console.log("JSON:", jsonText);
if (jsonText == "null") return [];
if (!jsonText) return [];
const loadedCharacters = [];
try {
const character = JSON.parse(jsonText);
Expand Down Expand Up @@ -304,7 +305,7 @@ async function loadCharacter(filePath: string): Promise<Character> {
if (!content) {
throw new Error(`Character file not found: ${filePath}`);
}
let character = JSON.parse(content);
const character = JSON.parse(content);
return jsonToCharacter(filePath, character);
}

Expand All @@ -315,7 +316,7 @@ function commaSeparatedStringToArray(commaSeparated: string): string[] {
export async function loadCharacters(
charactersArg: string
): Promise<Character[]> {
let characterPaths = commaSeparatedStringToArray(charactersArg);
const characterPaths = commaSeparatedStringToArray(charactersArg);
const loadedCharacters: Character[] = [];

if (characterPaths?.length > 0) {
Expand Down Expand Up @@ -389,7 +390,7 @@ export async function loadCharacters(

if (hasValidRemoteUrls()) {
elizaLogger.info("Loading characters from remote URLs");
let characterUrls = commaSeparatedStringToArray(
const characterUrls = commaSeparatedStringToArray(
process.env.REMOTE_CHARACTER_URLS
);
for (const characterUrl of characterUrls) {
Expand Down Expand Up @@ -1218,19 +1219,22 @@ const hasValidRemoteUrls = () =>

const startAgents = async () => {
const directClient = new DirectClient();
let serverPort = parseInt(settings.SERVER_PORT || "3000");
let serverPort = Number.parseInt(settings.SERVER_PORT || "3000");
const args = parseArguments();
let charactersArg = args.characters || args.character;
const charactersArg = args.characters || args.character;
let characters = [defaultCharacter];

if (process.env.IQ_WALLET_ADDRESS && process.env.IQSOlRPC) {
characters = await loadCharacterFromOnchain();
}

if ((onchainJson == "null" && charactersArg) || hasValidRemoteUrls()) {
if ((!onchainJson && charactersArg) || hasValidRemoteUrls()) {
characters = await loadCharacters(charactersArg);
}

// Normalize characters for injectable plugins
characters = await Promise.all(characters.map(normalizeCharacter));

try {
for (const character of characters) {
await startAgent(character, directClient);
Expand Down Expand Up @@ -1258,7 +1262,7 @@ const startAgents = async () => {

directClient.start(serverPort);

if (serverPort !== parseInt(settings.SERVER_PORT || "3000")) {
if (serverPort !== Number.parseInt(settings.SERVER_PORT || "3000")) {
elizaLogger.log(`Server started on alternate port ${serverPort}`);
}

Expand All @@ -1278,12 +1282,12 @@ if (
parseBooleanFromText(process.env.PREVENT_UNHANDLED_EXIT)
) {
// Handle uncaught exceptions to prevent the process from crashing
process.on("uncaughtException", function (err) {
process.on("uncaughtException", (err) => {
console.error("uncaughtException", err);
});

// Handle unhandled rejections to prevent the process from crashing
process.on("unhandledRejection", function (err) {
process.on("unhandledRejection", (err) => {
console.error("unhandledRejection", err);
});
}
88 changes: 88 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"organizeImports": {
"enabled": false
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"suspicious": {
"noExplicitAny": "warn",
"noArrayIndexKey": "warn",
"noPrototypeBuiltins": "warn",
"noDuplicateObjectKeys": "warn",
"noGlobalIsNan": "warn",
"noDuplicateFontNames": "warn",
"noSelfCompare": "warn",
"noDoubleEquals": "warn",
"noImplicitAnyLet": "warn",
"noAssignInExpressions": "warn",
"noExportsInTest": "warn",
"noConstEnum": "warn",
"noEmptyInterface": "warn"
},
"correctness": {
"noUnusedVariables": "warn",
"noUnreachable": "warn",
"useExhaustiveDependencies": "warn",
"noSwitchDeclarations": "warn",
"noUnnecessaryContinue": "warn",
"noInnerDeclarations": "warn"
},
"style": {
"useConst": "warn",
"useTemplate": "warn",
"useImportType": "warn",
"useNodejsImportProtocol": "warn",
"noUselessElse": "warn",
"useSelfClosingElements": "warn",
"useNumberNamespace": "warn",
"noUnusedTemplateLiteral": "warn",
"noInferrableTypes": "warn",
"noNonNullAssertion": "warn",
"noParameterAssign": "warn",
"useDefaultParameterLast": "warn",
"useExponentiationOperator": "warn",
"noVar": "warn",
"useSingleVarDeclarator": "warn",
"useExportType": "warn"
},
"a11y": {
"useAltText": "warn",
"useFocusableInteractive": "warn",
"useMediaCaption": "warn",
"noSvgWithoutTitle": "warn",
"useKeyWithClickEvents": "warn"
},
"complexity": {
"noForEach": "warn",
"useOptionalChain": "warn",
"useArrowFunction": "warn",
"useFlatMap": "warn",
"useLiteralKeys": "warn",
"noBannedTypes": "warn",
"noStaticOnlyClass": "warn",
"noThisInStatic": "warn",
"noUselessConstructor": "warn",
"noUselessTernary": "warn",
"noUselessSwitchCase": "warn",
"noUselessCatch": "warn"
},
"performance": {
"noDelete": "warn",
"noAccumulatingSpread": "warn"
}
},
"ignore": ["**/dist/**", "**/node_modules/**", "**/coverage/**", "**/*.json"]
},
"formatter": {
"enabled": false
},
"javascript": {
"formatter": {
"quoteStyle": "double",
"semicolons": "always"
}
}
}
Loading

0 comments on commit 8ae6ae4

Please sign in to comment.