Skip to content

Commit 8ae6ae4

Browse files
committed
Merge branch 'develop' of https://github.com/mgunnin/virtualDegen into 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) ...
2 parents f0532ef + b336db0 commit 8ae6ae4

File tree

914 files changed

+10482
-4406
lines changed

Some content is hidden

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

914 files changed

+10482
-4406
lines changed

.env.example

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ SUPABASE_ANON_KEY=
1919
REMOTE_CHARACTER_URLS=
2020

2121
# Logging
22-
DEFAULT_LOG_LEVEL=info
23-
LOG_JSON_FORMAT= # Print everything in logger as json; false by default
22+
DEFAULT_LOG_LEVEL=warn
23+
LOG_JSON_FORMAT=false # Print everything in logger as json; false by default
2424

2525
###############################
2626
#### Client Configurations ####

.eslintrc.json

-36
This file was deleted.

.github/workflows/ci.yaml

+6-4
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ jobs:
2222
- name: Install dependencies
2323
run: pnpm install -r --no-frozen-lockfile
2424

25-
- name: Run Prettier
26-
run: pnpm run prettier --check .
25+
- name: Setup Biome CLI
26+
uses: biomejs/setup-biome@v2
27+
with:
28+
version: latest
2729

28-
- name: Run Linter
29-
run: pnpm run lint
30+
- name: Run Biome
31+
run: biome ci
3032

3133
- name: Create test env file
3234
run: |

.github/workflows/smoke-tests.yml

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ jobs:
1212
runs-on: ubuntu-latest
1313
container:
1414
image: node:23-bullseye
15+
env:
16+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
1517
steps:
1618
- uses: actions/checkout@v4
1719

agent/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
"@elizaos/plugin-sgx": "workspace:*",
8484
"@elizaos/plugin-solana": "workspace:*",
8585
"@elizaos/plugin-injective": "workspace:*",
86-
"@elizaos/plugin-solana-agentkit": "workspace:*",
86+
"@elizaos/plugin-solana-agent-kit": "workspace:*",
8787
"@elizaos/plugin-squid-router": "workspace:*",
8888
"@elizaos/plugin-stargaze": "workspace:*",
8989
"@elizaos/plugin-starknet": "workspace:*",

agent/src/__tests__/client-type-identification.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Client, IAgentRuntime } from "@elizaos/core";
1+
import type { Client, IAgentRuntime } from "@elizaos/core";
22
import { describe, it, expect } from "@jest/globals";
33

44
// Helper function to identify client types

agent/src/index.ts

+21-17
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ import {
2020
AgentRuntime,
2121
CacheManager,
2222
CacheStore,
23-
Character,
24-
Client,
23+
type Character,
24+
type Client,
2525
Clients,
2626
DbCacheAdapter,
2727
defaultCharacter,
2828
elizaLogger,
2929
FsCacheAdapter,
30-
IAgentRuntime,
31-
ICacheManager,
32-
IDatabaseAdapter,
33-
IDatabaseCacheAdapter,
30+
type IAgentRuntime,
31+
type ICacheManager,
32+
type IDatabaseAdapter,
33+
type IDatabaseCacheAdapter,
3434
ModelProviderName,
3535
parseBooleanFromText,
3636
settings,
@@ -40,6 +40,7 @@ import {
4040
import { zgPlugin } from "@elizaos/plugin-0g";
4141

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

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

203204
console.log("JSON:", jsonText);
204-
if (jsonText == "null") return [];
205+
if (!jsonText) return [];
205206
const loadedCharacters = [];
206207
try {
207208
const character = JSON.parse(jsonText);
@@ -304,7 +305,7 @@ async function loadCharacter(filePath: string): Promise<Character> {
304305
if (!content) {
305306
throw new Error(`Character file not found: ${filePath}`);
306307
}
307-
let character = JSON.parse(content);
308+
const character = JSON.parse(content);
308309
return jsonToCharacter(filePath, character);
309310
}
310311

@@ -315,7 +316,7 @@ function commaSeparatedStringToArray(commaSeparated: string): string[] {
315316
export async function loadCharacters(
316317
charactersArg: string
317318
): Promise<Character[]> {
318-
let characterPaths = commaSeparatedStringToArray(charactersArg);
319+
const characterPaths = commaSeparatedStringToArray(charactersArg);
319320
const loadedCharacters: Character[] = [];
320321

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

390391
if (hasValidRemoteUrls()) {
391392
elizaLogger.info("Loading characters from remote URLs");
392-
let characterUrls = commaSeparatedStringToArray(
393+
const characterUrls = commaSeparatedStringToArray(
393394
process.env.REMOTE_CHARACTER_URLS
394395
);
395396
for (const characterUrl of characterUrls) {
@@ -1218,19 +1219,22 @@ const hasValidRemoteUrls = () =>
12181219

12191220
const startAgents = async () => {
12201221
const directClient = new DirectClient();
1221-
let serverPort = parseInt(settings.SERVER_PORT || "3000");
1222+
let serverPort = Number.parseInt(settings.SERVER_PORT || "3000");
12221223
const args = parseArguments();
1223-
let charactersArg = args.characters || args.character;
1224+
const charactersArg = args.characters || args.character;
12241225
let characters = [defaultCharacter];
12251226

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

1230-
if ((onchainJson == "null" && charactersArg) || hasValidRemoteUrls()) {
1231+
if ((!onchainJson && charactersArg) || hasValidRemoteUrls()) {
12311232
characters = await loadCharacters(charactersArg);
12321233
}
12331234

1235+
// Normalize characters for injectable plugins
1236+
characters = await Promise.all(characters.map(normalizeCharacter));
1237+
12341238
try {
12351239
for (const character of characters) {
12361240
await startAgent(character, directClient);
@@ -1258,7 +1262,7 @@ const startAgents = async () => {
12581262

12591263
directClient.start(serverPort);
12601264

1261-
if (serverPort !== parseInt(settings.SERVER_PORT || "3000")) {
1265+
if (serverPort !== Number.parseInt(settings.SERVER_PORT || "3000")) {
12621266
elizaLogger.log(`Server started on alternate port ${serverPort}`);
12631267
}
12641268

@@ -1278,12 +1282,12 @@ if (
12781282
parseBooleanFromText(process.env.PREVENT_UNHANDLED_EXIT)
12791283
) {
12801284
// Handle uncaught exceptions to prevent the process from crashing
1281-
process.on("uncaughtException", function (err) {
1285+
process.on("uncaughtException", (err) => {
12821286
console.error("uncaughtException", err);
12831287
});
12841288

12851289
// Handle unhandled rejections to prevent the process from crashing
1286-
process.on("unhandledRejection", function (err) {
1290+
process.on("unhandledRejection", (err) => {
12871291
console.error("unhandledRejection", err);
12881292
});
12891293
}

biome.json

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
3+
"organizeImports": {
4+
"enabled": false
5+
},
6+
"linter": {
7+
"enabled": true,
8+
"rules": {
9+
"recommended": true,
10+
"suspicious": {
11+
"noExplicitAny": "warn",
12+
"noArrayIndexKey": "warn",
13+
"noPrototypeBuiltins": "warn",
14+
"noDuplicateObjectKeys": "warn",
15+
"noGlobalIsNan": "warn",
16+
"noDuplicateFontNames": "warn",
17+
"noSelfCompare": "warn",
18+
"noDoubleEquals": "warn",
19+
"noImplicitAnyLet": "warn",
20+
"noAssignInExpressions": "warn",
21+
"noExportsInTest": "warn",
22+
"noConstEnum": "warn",
23+
"noEmptyInterface": "warn"
24+
},
25+
"correctness": {
26+
"noUnusedVariables": "warn",
27+
"noUnreachable": "warn",
28+
"useExhaustiveDependencies": "warn",
29+
"noSwitchDeclarations": "warn",
30+
"noUnnecessaryContinue": "warn",
31+
"noInnerDeclarations": "warn"
32+
},
33+
"style": {
34+
"useConst": "warn",
35+
"useTemplate": "warn",
36+
"useImportType": "warn",
37+
"useNodejsImportProtocol": "warn",
38+
"noUselessElse": "warn",
39+
"useSelfClosingElements": "warn",
40+
"useNumberNamespace": "warn",
41+
"noUnusedTemplateLiteral": "warn",
42+
"noInferrableTypes": "warn",
43+
"noNonNullAssertion": "warn",
44+
"noParameterAssign": "warn",
45+
"useDefaultParameterLast": "warn",
46+
"useExponentiationOperator": "warn",
47+
"noVar": "warn",
48+
"useSingleVarDeclarator": "warn",
49+
"useExportType": "warn"
50+
},
51+
"a11y": {
52+
"useAltText": "warn",
53+
"useFocusableInteractive": "warn",
54+
"useMediaCaption": "warn",
55+
"noSvgWithoutTitle": "warn",
56+
"useKeyWithClickEvents": "warn"
57+
},
58+
"complexity": {
59+
"noForEach": "warn",
60+
"useOptionalChain": "warn",
61+
"useArrowFunction": "warn",
62+
"useFlatMap": "warn",
63+
"useLiteralKeys": "warn",
64+
"noBannedTypes": "warn",
65+
"noStaticOnlyClass": "warn",
66+
"noThisInStatic": "warn",
67+
"noUselessConstructor": "warn",
68+
"noUselessTernary": "warn",
69+
"noUselessSwitchCase": "warn",
70+
"noUselessCatch": "warn"
71+
},
72+
"performance": {
73+
"noDelete": "warn",
74+
"noAccumulatingSpread": "warn"
75+
}
76+
},
77+
"ignore": ["**/dist/**", "**/node_modules/**", "**/coverage/**", "**/*.json"]
78+
},
79+
"formatter": {
80+
"enabled": false
81+
},
82+
"javascript": {
83+
"formatter": {
84+
"quoteStyle": "double",
85+
"semicolons": "always"
86+
}
87+
}
88+
}

0 commit comments

Comments
 (0)