Skip to content

Commit

Permalink
Merge branch 'develop' into supabase-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
antman1p authored Jan 20, 2025
2 parents f056847 + 3a69164 commit 7a70e4d
Show file tree
Hide file tree
Showing 79 changed files with 5,945 additions and 1,626 deletions.
10 changes: 8 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ SUPABASE_ANON_KEY=
# Comma separated list of remote character urls (optional)
REMOTE_CHARACTER_URLS=

# Stores characters set by using the direct API in the data/character folder for further load when the app restarts
USE_CHARACTER_STORAGE=false

# Logging
DEFAULT_LOG_LEVEL=warn
LOG_JSON_FORMAT=false # Print everything in logger as json; false by default
Expand All @@ -31,6 +34,9 @@ DISCORD_APPLICATION_ID=
DISCORD_API_TOKEN= # Bot token
DISCORD_VOICE_CHANNEL_ID= # The ID of the voice channel the bot should join (optional)

# Devin Configuration
DEVIN_API_TOKEN= # Get your API key from docs.devin.ai/tutorials/api-integration

# Farcaster Neynar Configuration
FARCASTER_FID= # The FID associated with the account your are sending casts from
FARCASTER_NEYNAR_API_KEY= # Neynar API key: https://neynar.com/
Expand Down Expand Up @@ -89,7 +95,7 @@ MEDIUM_OPENAI_MODEL= # Default: gpt-4o
LARGE_OPENAI_MODEL= # Default: gpt-4o
EMBEDDING_OPENAI_MODEL= # Default: text-embedding-3-small
IMAGE_OPENAI_MODEL= # Default: dall-e-3
USE_OPENAI_EMBEDDING= # Set to TRUE for OpenAI/1536, leave blank for local
USE_OPENAI_EMBEDDING=TRUE # Set to TRUE for OpenAI/1536, leave blank for local

# Community Plugin for OpenAI Configuration
ENABLE_OPEN_AI_COMMUNITY_PLUGIN=false
Expand Down Expand Up @@ -368,9 +374,9 @@ COINBASE_GENERATED_WALLET_HEX_SEED= # Not your address but the wallet hex seed f
COINBASE_NOTIFICATION_URI= # For webhook plugin the uri you want to send the webhook to for dummy ones use https://webhook.site

# Coinbase AgentKit
COINBASE_AGENT_KIT_NETWORK= # defaults to 'base-sepolia'
CDP_API_KEY_NAME=
CDP_API_KEY_PRIVATE_KEY=
CDP_AGENT_KIT_NETWORK=base-sepolia # Optional: Defaults to base-sepolia

# Coinbase Charity Configuration
IS_CHARITABLE=false # Set to true to enable charity donations
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/integrationTests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,19 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: "23.3.0"
cache: "pnpm"
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'

- name: Clean up
run: pnpm clean
- name: Configure pnpm
run: |
pnpm config set store-dir ~/.pnpm-store
pnpm config set prefer-offline true
pnpm config set node-linker hoisted
pnpm config set shamefully-hoist true
pnpm config list
- name: Install dependencies
run: pnpm install -r --no-frozen-lockfile
run: pnpm install -r --no-frozen-lockfile --prefer-offline

- name: Build packages
run: pnpm build
Expand Down
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div align="center">

📖 [Documentation](https://elizaos.github.io/eliza/) | 🎯 [Examples](https://github.com/thejoven/awesome-eliza)
📑 [Technical Report](https://arxiv.org/pdf/2501.06781) | 📖 [Documentation](https://elizaos.github.io/eliza/) | 🎯 [Examples](https://github.com/thejoven/awesome-eliza)

</div>

Expand Down Expand Up @@ -157,12 +157,25 @@ pnpm install --include=optional sharp
- [GitHub Issues](https://github.com/elizaos/eliza/issues). Best for: bugs you encounter using Eliza, and feature proposals.
- [Discord](https://discord.gg/ai16z). Best for: sharing your applications and hanging out with the community.

## Citation

We now have a [paper](https://arxiv.org/pdf/2501.06781) you can cite for the Eliza OS:
```bibtex
@article{walters2025eliza,
title={Eliza: A Web3 friendly AI Agent Operating System},
author={Walters, Shaw and Gao, Sam and Nerd, Shakker and Da, Feng and Williams, Warren and Meng, Ting-Chien and Han, Hunter and He, Frank and Zhang, Allen and Wu, Ming and others},
journal={arXiv preprint arXiv:2501.06781},
year={2025}
}
```

## Contributors

<a href="https://github.com/elizaos/eliza/graphs/contributors">
<img src="https://contrib.rocks/image?repo=elizaos/eliza" />
<img src="https://contrib.rocks/image?repo=elizaos/eliza" alt="Eliza project contributors" />
</a>


## Star History

[![Star History Chart](https://api.star-history.com/svg?repos=elizaos/eliza&type=Date)](https://star-history.com/#elizaos/eliza&Date)
2 changes: 2 additions & 0 deletions agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,12 @@
"@elizaos/plugin-hyperliquid": "workspace:*",
"@elizaos/plugin-akash": "workspace:*",
"@elizaos/plugin-quai": "workspace:*",
"@elizaos/plugin-lightning": "workspace:*",
"@elizaos/plugin-b2": "workspace:*",
"@elizaos/plugin-nft-collections": "workspace:*",
"@elizaos/plugin-pyth-data": "workspace:*",
"@elizaos/plugin-openai": "workspace:*",
"@elizaos/plugin-devin": "workspace:*",
"readline": "1.3.0",
"ws": "8.18.0",
"yargs": "17.7.2"
Expand Down
69 changes: 57 additions & 12 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ import { TelegramClientInterface } from "@elizaos/client-telegram";
import { TwitterClientInterface } from "@elizaos/client-twitter";
import { FarcasterClientInterface } from "@elizaos/client-farcaster";
import { DirectClient } from "@elizaos/client-direct";
import { agentKitPlugin } from "@elizaos/plugin-agentkit";
// import { ReclaimAdapter } from "@elizaos/plugin-reclaim";
import { PrimusAdapter } from "@elizaos/plugin-primus";
import { lightningPlugin } from "@elizaos/plugin-lightning";
import { elizaCodeinPlugin, onchainJson } from "@elizaos/plugin-iq6900";

import {
Expand Down Expand Up @@ -105,7 +107,10 @@ import { hyperliquidPlugin } from "@elizaos/plugin-hyperliquid";
import { echoChambersPlugin } from "@elizaos/plugin-echochambers";
import { dexScreenerPlugin } from "@elizaos/plugin-dexscreener";
import { pythDataPlugin } from "@elizaos/plugin-pyth-data";

import { openaiPlugin } from '@elizaos/plugin-openai';
import { devinPlugin } from '@elizaos/plugin-devin';


import { zksyncEraPlugin } from "@elizaos/plugin-zksync-era";
import Database from "better-sqlite3";
Expand Down Expand Up @@ -207,7 +212,9 @@ export async function loadCharacterFromOnchain(): Promise<Character[]> {

// .id isn't really valid
const characterId = character.id || character.name;
const characterPrefix = `CHARACTER.${characterId.toUpperCase().replace(/ /g, "_")}.`;
const characterPrefix = `CHARACTER.${characterId
.toUpperCase()
.replace(/ /g, "_")}.`;

const characterSettings = Object.entries(process.env)
.filter(([key]) => key.startsWith(characterPrefix))
Expand Down Expand Up @@ -250,7 +257,6 @@ export async function loadCharacterFromOnchain(): Promise<Character[]> {
}
}


async function loadCharactersFromUrl(url: string): Promise<Character[]> {
try {
const response = await fetch(url);
Expand Down Expand Up @@ -280,7 +286,9 @@ async function jsonToCharacter(

// .id isn't really valid
const characterId = character.id || character.name;
const characterPrefix = `CHARACTER.${characterId.toUpperCase().replace(/ /g, "_")}.`;
const characterPrefix = `CHARACTER.${characterId
.toUpperCase()
.replace(/ /g, "_")}.`;
const characterSettings = Object.entries(process.env)
.filter(([key]) => key.startsWith(characterPrefix))
.reduce((settings, [key, value]) => {
Expand Down Expand Up @@ -381,17 +389,39 @@ function commaSeparatedStringToArray(commaSeparated: string): string[] {
return commaSeparated?.split(",").map((value) => value.trim());
}

async function readCharactersFromStorage(characterPaths: string[]): Promise<string[]> {
try {
const uploadDir = path.join(process.cwd(), "data", "characters");
await fs.promises.mkdir(uploadDir, { recursive: true });
const fileNames = await fs.promises.readdir(uploadDir);
fileNames.forEach(fileName => {
characterPaths.push(path.join(uploadDir, fileName));
});
} catch (err) {
elizaLogger.error(`Error reading directory: ${err.message}`);
}

return characterPaths;
};

export async function loadCharacters(
charactersArg: string
): Promise<Character[]> {
const characterPaths = commaSeparatedStringToArray(charactersArg);

let characterPaths = commaSeparatedStringToArray(charactersArg);

if(process.env.USE_CHARACTER_STORAGE === "true") {
characterPaths = await readCharactersFromStorage(characterPaths);
}

const loadedCharacters: Character[] = [];

if (characterPaths?.length > 0) {
for (const characterPath of characterPaths) {
try {
const character: Character =
await loadCharacterTryPath(characterPath);
const character: Character = await loadCharacterTryPath(
characterPath
);
loadedCharacters.push(character);
} catch (e) {
process.exit(1);
Expand Down Expand Up @@ -554,9 +584,10 @@ export function getTokenForProvider(
settings.VENICE_API_KEY
);
case ModelProviderName.ATOMA:
return (
character.settings?.secrets?.ATOMASDK_BEARER_AUTH ||
settings.ATOMASDK_BEARER_AUTH
return (
character.settings?.secrets?.ATOMASDK_BEARER_AUTH ||
settings.ATOMASDK_BEARER_AUTH
);
case ModelProviderName.NVIDIA:
return (
character.settings?.secrets?.NVIDIA_API_KEY ||
Expand Down Expand Up @@ -869,6 +900,10 @@ export async function createAgent(
? elizaCodeinPlugin
: null,
bootstrapPlugin,
getSecret(character, "CDP_API_KEY_NAME") &&
getSecret(character, "CDP_API_KEY_PRIVATE_KEY")
? agentKitPlugin
: null,
getSecret(character, "DEXSCREENER_API_KEY")
? dexScreenerPlugin
: null,
Expand Down Expand Up @@ -1045,9 +1080,18 @@ export async function createAgent(
getSecret(character, "PYTH_MAINNET_PROGRAM_KEY")
? pythDataPlugin
: null,
getSecret(character, "OPENAI_API_KEY") && getSecret(character, "ENABLE_OPEN_AI_COMMUNITY_PLUGIN")
getSecret(character, "LND_TLS_CERT") &&
getSecret(character, "LND_MACAROON") &&
getSecret(character, "LND_SOCKET")
? lightningPlugin
: null,
getSecret(character, "OPENAI_API_KEY") &&
getSecret(character, "ENABLE_OPEN_AI_COMMUNITY_PLUGIN")
? openaiPlugin
: null,
getSecret(character, "DEVIN_API_TOKEN")
? devinPlugin
: null,
].filter(Boolean),
providers: [],
actions: [],
Expand Down Expand Up @@ -1225,7 +1269,9 @@ const startAgents = async () => {
characters = await loadCharacterFromOnchain();
}

if ((!onchainJson && charactersArg) || hasValidRemoteUrls()) {
const notOnchainJson = !onchainJson || onchainJson == "null";

if ((notOnchainJson && charactersArg) || hasValidRemoteUrls()) {
characters = await loadCharacters(charactersArg);
}

Expand Down Expand Up @@ -1291,4 +1337,3 @@ if (
console.error("unhandledRejection", err);
});
}

Loading

0 comments on commit 7a70e4d

Please sign in to comment.