Skip to content

Commit b97a557

Browse files
committed
Merge branch 'develop' into pr-1126
2 parents bcf308b + 37c2d23 commit b97a557

Some content is hidden

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

73 files changed

+4492
-395
lines changed

.env.example

+12
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ DISCORD_VOICE_CHANNEL_ID= # The ID of the voice channel the bot should joi
99

1010
# AI Model API Keys
1111
OPENAI_API_KEY= # OpenAI API key, starting with sk-
12+
OPENAI_API_URL= # OpenAI API Endpoint (optional), Default: https://api.openai.com/v1
1213
SMALL_OPENAI_MODEL= # Default: gpt-4o-mini
1314
MEDIUM_OPENAI_MODEL= # Default: gpt-4o
1415
LARGE_OPENAI_MODEL= # Default: gpt-4o
@@ -35,6 +36,10 @@ SMALL_HYPERBOLIC_MODEL= # Default: meta-llama/Llama-3.2-3B-Instruct
3536
MEDIUM_HYPERBOLIC_MODEL= # Default: meta-llama/Meta-Llama-3.1-70B-Instruct
3637
LARGE_HYPERBOLIC_MODEL= # Default: meta-llama/Meta-Llama-3.1-405-Instruct
3738

39+
# Livepeer configuration
40+
LIVEPEER_GATEWAY_URL= # Free inference gateways and docs: https://livepeer-eliza.com/
41+
LIVEPEER_IMAGE_MODEL= # Default: ByteDance/SDXL-Lightning
42+
3843
# Speech Synthesis
3944
ELEVENLABS_XI_API_KEY= # API key from elevenlabs
4045

@@ -161,6 +166,10 @@ USE_GAIANET_EMBEDDING= # Set to TRUE for GAIANET/768, leave blank for l
161166
EVM_PRIVATE_KEY=
162167
EVM_PROVIDER_URL=
163168

169+
# Avalanche
170+
AVALANCHE_PRIVATE_KEY=
171+
AVALANCHE_PUBLIC_KEY=
172+
164173
# Solana
165174
SOLANA_PRIVATE_KEY=
166175
SOLANA_PUBLIC_KEY=
@@ -344,3 +353,6 @@ PINATA_JWT= # Pinata JWT for uploading files to IPFS
344353
# Cronos zkEVM
345354
CRONOSZKEVM_ADDRESS=
346355
CRONOSZKEVM_PRIVATE_KEY=
356+
357+
# Fuel Ecosystem (FuelVM)
358+
FUEL_WALLET_PRIVATE_KEY=

agent/jest.config.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/** @type {import('ts-jest').JestConfigWithTsJest} */
2+
export default {
3+
preset: 'ts-jest',
4+
testEnvironment: 'node',
5+
extensionsToTreatAsEsm: ['.ts'],
6+
moduleNameMapper: {
7+
'^(\\.{1,2}/.*)\\.js$': '$1',
8+
},
9+
transform: {
10+
'^.+\\.tsx?$': [
11+
'ts-jest',
12+
{
13+
useESM: true,
14+
},
15+
],
16+
},
17+
};

agent/package.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"scripts": {
77
"start": "node --loader ts-node/esm src/index.ts",
88
"dev": "node --loader ts-node/esm src/index.ts",
9-
"check-types": "tsc --noEmit"
9+
"check-types": "tsc --noEmit",
10+
"test": "jest"
1011
},
1112
"nodemonConfig": {
1213
"watch": [
@@ -56,11 +57,16 @@
5657
"@elizaos/plugin-twitter": "workspace:*",
5758
"@elizaos/plugin-cronoszkevm": "workspace:*",
5859
"@elizaos/plugin-3d-generation": "workspace:*",
60+
"@elizaos/plugin-fuel": "workspace:*",
61+
"@elizaos/plugin-avalanche": "workspace:*",
5962
"readline": "1.3.0",
6063
"ws": "8.18.0",
6164
"yargs": "17.7.2"
6265
},
6366
"devDependencies": {
67+
"@types/jest": "^29.5.14",
68+
"jest": "^29.7.0",
69+
"ts-jest": "^29.2.5",
6470
"ts-node": "10.9.2",
6571
"tsup": "8.3.5"
6672
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { Client, IAgentRuntime } from "@elizaos/core";
2+
import { describe, it, expect } from '@jest/globals';
3+
4+
// Helper function to identify client types
5+
function determineClientType(client: Client): string {
6+
// Check if client has a direct type identifier
7+
if ('type' in client) {
8+
return (client as any).type;
9+
}
10+
11+
// Check constructor name
12+
const constructorName = client.constructor?.name;
13+
if (constructorName && !constructorName.includes('Object')) {
14+
return constructorName.toLowerCase().replace('client', '');
15+
}
16+
17+
// Fallback: Generate a unique identifier
18+
return `client_${Date.now()}`;
19+
}
20+
21+
// Mock client implementations for testing
22+
class MockNamedClient implements Client {
23+
type = "named-client";
24+
async start(_runtime?: IAgentRuntime) { return this; }
25+
async stop(_runtime?: IAgentRuntime) { }
26+
}
27+
28+
class MockConstructorClient implements Client {
29+
async start(_runtime?: IAgentRuntime) { return this; }
30+
async stop(_runtime?: IAgentRuntime) { }
31+
}
32+
33+
const mockPlainClient: Client = {
34+
async start(_runtime?: IAgentRuntime) { return {}; },
35+
async stop(_runtime?: IAgentRuntime) { }
36+
};
37+
38+
describe("Client Type Identification", () => {
39+
it("should identify client type from type property", () => {
40+
const client = new MockNamedClient();
41+
expect(determineClientType(client)).toBe("named-client");
42+
});
43+
44+
it("should identify client type from constructor name", () => {
45+
const client = new MockConstructorClient();
46+
expect(determineClientType(client)).toBe("mockconstructor");
47+
});
48+
49+
it("should generate fallback identifier for plain objects", () => {
50+
const result = determineClientType(mockPlainClient);
51+
expect(result).toMatch(/^client_\d+$/);
52+
});
53+
});

agent/src/index.ts

+31-3
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@ import {
1717
elizaLogger,
1818
FsCacheAdapter,
1919
IAgentRuntime,
20-
ICacheManager,
2120
IDatabaseAdapter,
2221
IDatabaseCacheAdapter,
2322
ModelProviderName,
2423
settings,
2524
stringToUuid,
2625
validateCharacterConfig,
2726
CacheStore,
27+
Client,
28+
ICacheManager,
2829
} from "@elizaos/core";
2930
import { RedisClient } from "@elizaos/adapter-redis";
3031
import { zgPlugin } from "@elizaos/plugin-0g";
@@ -45,6 +46,7 @@ import { confluxPlugin } from "@elizaos/plugin-conflux";
4546
import { evmPlugin } from "@elizaos/plugin-evm";
4647
import { storyPlugin } from "@elizaos/plugin-story";
4748
import { flowPlugin } from "@elizaos/plugin-flow";
49+
import { fuelPlugin } from "@elizaos/plugin-fuel";
4850
import { imageGenerationPlugin } from "@elizaos/plugin-image-generation";
4951
import { ThreeDGenerationPlugin } from "@elizaos/plugin-3d-generation";
5052
import { multiversxPlugin } from "@elizaos/plugin-multiversx";
@@ -58,6 +60,7 @@ import { tonPlugin } from "@elizaos/plugin-ton";
5860
import { zksyncEraPlugin } from "@elizaos/plugin-zksync-era";
5961
import { cronosZkEVMPlugin } from "@elizaos/plugin-cronoszkevm";
6062
import { abstractPlugin } from "@elizaos/plugin-abstract";
63+
import { avalanchePlugin } from "@elizaos/plugin-avalanche";
6164
import Database from "better-sqlite3";
6265
import fs from "fs";
6366
import path from "path";
@@ -437,12 +440,32 @@ export async function initializeClients(
437440
if (slackClient) clients.slack = slackClient; // Use object property instead of push
438441
}
439442

443+
function determineClientType(client: Client): string {
444+
// Check if client has a direct type identifier
445+
if ("type" in client) {
446+
return (client as any).type;
447+
}
448+
449+
// Check constructor name
450+
const constructorName = client.constructor?.name;
451+
if (constructorName && !constructorName.includes("Object")) {
452+
return constructorName.toLowerCase().replace("client", "");
453+
}
454+
455+
// Fallback: Generate a unique identifier
456+
return `client_${Date.now()}`;
457+
}
458+
440459
if (character.plugins?.length > 0) {
441460
for (const plugin of character.plugins) {
442461
if (plugin.clients) {
443462
for (const client of plugin.clients) {
444463
const startedClient = await client.start(runtime);
445-
clients[client.name] = startedClient; // Assuming client has a name property
464+
const clientType = determineClientType(client);
465+
elizaLogger.debug(
466+
`Initializing client of type: ${clientType}`
467+
);
468+
clients[clientType] = startedClient;
446469
}
447470
}
448471
}
@@ -534,7 +557,8 @@ export async function createAgent(
534557
getSecret(character, "FAL_API_KEY") ||
535558
getSecret(character, "OPENAI_API_KEY") ||
536559
getSecret(character, "VENICE_API_KEY") ||
537-
getSecret(character, "HEURIST_API_KEY")
560+
getSecret(character, "HEURIST_API_KEY") ||
561+
getSecret(character, "LIVEPEER_GATEWAY_URL")
538562
? imageGenerationPlugin
539563
: null,
540564
getSecret(character, "FAL_API_KEY") ? ThreeDGenerationPlugin : null,
@@ -572,6 +596,10 @@ export async function createAgent(
572596
getSecret(character, "TON_PRIVATE_KEY") ? tonPlugin : null,
573597
getSecret(character, "SUI_PRIVATE_KEY") ? suiPlugin : null,
574598
getSecret(character, "STORY_PRIVATE_KEY") ? storyPlugin : null,
599+
getSecret(character, "FUEL_PRIVATE_KEY") ? fuelPlugin : null,
600+
getSecret(character, "AVALANCHE_PRIVATE_KEY")
601+
? avalanchePlugin
602+
: null,
575603
].filter(Boolean),
576604
providers: [],
577605
actions: [],

agent/tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"module": "ESNext",
77
"moduleResolution": "Bundler",
88
"types": [
9-
"node"
9+
"node",
10+
"jest"
1011
]
1112
},
1213
"ts-node": {

client/tsconfig.app.json

+13-7
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,36 @@
11
{
22
"compilerOptions": {
3+
"incremental": true,
34
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
45
"target": "ES2020",
56
"useDefineForClassFields": true,
6-
"lib": ["ES2020", "DOM", "DOM.Iterable"],
7+
"lib": [
8+
"ES2020",
9+
"DOM",
10+
"DOM.Iterable"
11+
],
712
"module": "ESNext",
813
"skipLibCheck": true,
9-
1014
/* Bundler mode */
1115
"moduleResolution": "Bundler",
1216
"allowImportingTsExtensions": true,
1317
"isolatedModules": true,
1418
"moduleDetection": "force",
1519
"noEmit": true,
1620
"jsx": "react-jsx",
17-
1821
/* Linting */
1922
"strict": true,
2023
"noUnusedLocals": true,
2124
"noUnusedParameters": true,
2225
"noFallthroughCasesInSwitch": true,
23-
"noUncheckedSideEffectImports": true,
2426
"baseUrl": ".",
2527
"paths": {
26-
"@/*": ["./src/*"]
28+
"@/*": [
29+
"./src/*"
30+
]
2731
}
2832
},
29-
"include": ["src"]
30-
}
33+
"include": [
34+
"src"
35+
]
36+
}

client/tsconfig.node.json

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
{
22
"compilerOptions": {
3+
"incremental": true,
34
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
45
"target": "ES2022",
5-
"lib": ["ES2023"],
6+
"lib": [
7+
"ES2023"
8+
],
69
"module": "ESNext",
710
"skipLibCheck": true,
8-
911
/* Bundler mode */
1012
"moduleResolution": "Bundler",
1113
"allowImportingTsExtensions": true,
1214
"isolatedModules": true,
1315
"moduleDetection": "force",
1416
"noEmit": true,
15-
1617
/* Linting */
1718
"strict": true,
1819
"noUnusedLocals": true,
1920
"noUnusedParameters": true,
20-
"noFallthroughCasesInSwitch": true,
21-
"noUncheckedSideEffectImports": true
21+
"noFallthroughCasesInSwitch": true
2222
},
23-
"include": ["vite.config.ts"]
24-
}
23+
"include": [
24+
"vite.config.ts"
25+
]
26+
}

docs/api/enumerations/ModelProviderName.md

+10
Original file line numberDiff line numberDiff line change
@@ -233,3 +233,13 @@ Available model providers
233233
#### Defined in
234234

235235
[packages/core/src/types.ts:240](https://github.com/elizaOS/eliza/blob/main/packages/core/src/types.ts#L240)
236+
237+
***
238+
239+
### LIVEPEER
240+
241+
> **LIVEPEER**: `"livepeer"`
242+
243+
#### Defined in
244+
245+
[packages/core/src/types.ts:241](https://github.com/elizaOS/eliza/blob/main/packages/core/src/types.ts#L241)

docs/api/type-aliases/Models.md

+4
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ Model configurations by provider
100100

101101
> **akash\_chat\_api**: [`Model`](Model.md)
102102
103+
### livepeer
104+
105+
> **livepeer**: [`Model`](Model.md)
106+
103107
## Defined in
104108

105109
[packages/core/src/types.ts:188](https://github.com/elizaOS/eliza/blob/main/packages/core/src/types.ts#L188)

docs/docs/advanced/fine-tuning.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ Models are categorized into different classes based on their capabilities:
6060

6161
```typescript
6262
enum ModelClass {
63-
SMALL, // Fast, efficient for simple tasks
64-
MEDIUM, // Balanced performance and capability
65-
LARGE, // Most capable but slower/more expensive
66-
EMBEDDING // Specialized for vector embeddings
67-
IMAGE // Image generation capabilities
63+
SMALL, // Fast, efficient for simple tasks
64+
MEDIUM, // Balanced performance and capability
65+
LARGE, // Most capable but slower/more expensive
66+
EMBEDDING, // Specialized for vector embeddings
67+
IMAGE // Image generation capabilities
6868
}
6969
```
7070

docs/docs/api/enumerations/ModelProviderName.md

+10
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,13 @@
119119
#### Defined in
120120

121121
[packages/core/src/types.ts:132](https://github.com/elizaos/eliza/blob/4d1e66cbf7deea87a8a67525670a963cd00108bc/packages/core/src/types.ts#L132)
122+
123+
---
124+
125+
### LIVEPEER
126+
127+
> **LIVEPEER**: `"livepeer"`
128+
129+
#### Defined in
130+
131+
[packages/core/src/types.ts:133](https://github.com/elizaos/eliza/blob/4d1e66cbf7deea87a8a67525670a963cd00108bc/packages/core/src/types.ts#L133)

docs/docs/api/type-aliases/Models.md

+4
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@
5252

5353
> **heurist**: [`Model`](Model.md)
5454
55+
### livepeer
56+
57+
> **livepeer**: [`Model`](Model.md)
58+
5559
## Defined in
5660

5761
[packages/core/src/types.ts:105](https://github.com/elizaos/eliza/blob/7fcf54e7fb2ba027d110afcc319c0b01b3f181dc/packages/core/src/types.ts#L105)

docs/docs/guides/configuration.md

+3
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ TOGETHER_API_KEY=
7272
# Heurist Settings
7373
HEURIST_API_KEY=
7474

75+
# Livepeer Settings
76+
LIVEPEER_GATEWAY_URL=
77+
7578
# Local Model Settings
7679
XAI_MODEL=meta-llama/Llama-3.1-7b-instruct
7780
```

0 commit comments

Comments
 (0)