Skip to content

Commit 3dcc5d8

Browse files
authored
Merge branch 'develop' into plugin-chainbase
2 parents 2ce489a + 5f1ab1c commit 3dcc5d8

File tree

56 files changed

+2576
-749
lines changed

Some content is hidden

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

56 files changed

+2576
-749
lines changed

.env.example

+220-221
Large diffs are not rendered by default.

README.md

+42-28
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@
2323
## ✨ Features
2424

2525
- 🛠️ Full-featured Discord, Twitter and Telegram connectors
26-
- 🔗 Support for every model (Llama, Grok, OpenAI, Anthropic, etc.)
26+
- 🔗 Support for every model (Llama, Grok, OpenAI, Anthropic, Gemini, etc.)
2727
- 👥 Multi-agent and room support
2828
- 📚 Easily ingest and interact with your documents
2929
- 💾 Retrievable memory and document store
3030
- 🚀 Highly extensible - create your own actions and clients
31-
- ☁️ Supports many models (local Llama, OpenAI, Anthropic, Groq, etc.)
3231
- 📦 Just works!
3332

3433
## Video Tutorials
@@ -62,33 +61,21 @@ cp .env.example .env
6261
pnpm i && pnpm build && pnpm start
6362
```
6463

65-
Once the agent is running, you should see the message to run "pnpm start:client" at the end.
66-
Open another terminal and move to same directory and then run below command and follow the URL to chat to your agent.
67-
68-
```bash
69-
pnpm start:client
70-
```
71-
72-
Then read the [Documentation](https://elizaos.github.io/eliza/) to learn how to customize your Eliza.
73-
7464
### Manually Start Eliza (Only recommended if you know what you are doing)
7565

66+
#### Checkout the latest release
67+
7668
```bash
7769
# Clone the repository
7870
git clone https://github.com/elizaos/eliza.git
7971

80-
# Checkout the latest release
8172
# This project iterates fast, so we recommend checking out the latest release
8273
git checkout $(git describe --tags --abbrev=0)
8374
# If the above doesn't checkout the latest release, this should work:
8475
# git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
8576
```
8677

87-
### Start Eliza with Gitpod
88-
89-
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/elizaos/eliza/tree/main)
90-
91-
### Edit the .env file
78+
#### Edit the .env file
9279

9380
Copy .env.example to .env and fill in the appropriate values.
9481

@@ -98,6 +85,32 @@ cp .env.example .env
9885

9986
Note: .env is optional. If you're planning to run multiple distinct agents, you can pass secrets through the character JSON
10087

88+
89+
#### Start Eliza
90+
91+
```bash
92+
pnpm i
93+
pnpm build
94+
pnpm start
95+
96+
# The project iterates fast, sometimes you need to clean the project if you are coming back to the project
97+
pnpm clean
98+
```
99+
100+
### Interact via Browser
101+
102+
```
103+
Once the agent is running, you should see the message to run "pnpm start:client" at the end.
104+
Open another terminal and move to same directory and then run below command and follow the URL to chat to your agent.
105+
106+
```bash
107+
pnpm start:client
108+
```
109+
110+
Then read the [Documentation](https://elizaos.github.io/eliza/) to learn how to customize your Eliza.
111+
112+
----
113+
101114
### Automatically Start Eliza
102115

103116
The start script provides an automated way to set up and run Eliza:
@@ -110,7 +123,9 @@ For detailed instructions on using the start script, including character managem
110123

111124
> **Note**: The start script handles all dependencies, environment setup, and character management automatically.
112125
113-
### Edit the character file
126+
----
127+
128+
### Modify Character
114129

115130
1. Open `packages/core/src/defaultCharacter.ts` to modify the default character. Uncomment and edit.
116131

@@ -120,16 +135,7 @@ For detailed instructions on using the start script, including character managem
120135
3. Connect with X (Twitter)
121136
- change `"clients": []` to `"clients": ["twitter"]` in the character file to connect with X
122137

123-
### Manually Start Eliza
124-
125-
```bash
126-
pnpm i
127-
pnpm build
128-
pnpm start
129-
130-
# The project iterates fast, sometimes you need to clean the project if you are coming back to the project
131-
pnpm clean
132-
```
138+
---
133139

134140
#### Additional Requirements
135141

@@ -138,6 +144,14 @@ You may need to install Sharp. If you see an error when starting up, try install
138144
```
139145
pnpm install --include=optional sharp
140146
```
147+
---
148+
149+
150+
### Start Eliza with Gitpod
151+
152+
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/elizaos/eliza/tree/main)
153+
154+
---
141155

142156
### Community & contact
143157

agent/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"@elizaos/plugin-flow": "workspace:*",
5151
"@elizaos/plugin-gitbook": "workspace:*",
5252
"@elizaos/plugin-story": "workspace:*",
53+
"@elizaos/plugin-gitcoin-passport": "workspace:*",
5354
"@elizaos/plugin-goat": "workspace:*",
5455
"@elizaos/plugin-lensNetwork": "workspace:*",
5556
"@elizaos/plugin-icp": "workspace:*",

agent/src/index.ts

+54-11
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { SqliteDatabaseAdapter } from "@elizaos/adapter-sqlite";
55
import { SupabaseDatabaseAdapter } from "@elizaos/adapter-supabase";
66
import { AutoClientInterface } from "@elizaos/client-auto";
77
import { DiscordClientInterface } from "@elizaos/client-discord";
8-
import { FarcasterAgentClient } from "@elizaos/client-farcaster";
8+
import { FarcasterClientInterface } from "@elizaos/client-farcaster";
99
import { LensAgentClient } from "@elizaos/client-lens";
1010
import { SlackClientInterface } from "@elizaos/client-slack";
1111
import { TelegramClientInterface } from "@elizaos/client-telegram";
@@ -32,6 +32,7 @@ import {
3232
settings,
3333
stringToUuid,
3434
validateCharacterConfig,
35+
parseBooleanFromText,
3536
} from "@elizaos/core";
3637
import { zgPlugin } from "@elizaos/plugin-0g";
3738

@@ -70,6 +71,7 @@ import { flowPlugin } from "@elizaos/plugin-flow";
7071
import { fuelPlugin } from "@elizaos/plugin-fuel";
7172
import { genLayerPlugin } from "@elizaos/plugin-genlayer";
7273
import { giphyPlugin } from "@elizaos/plugin-giphy";
74+
import { gitcoinPassportPlugin } from "@elizaos/plugin-gitcoin-passport";
7375
import { hyperliquidPlugin } from "@elizaos/plugin-hyperliquid";
7476
import { imageGenerationPlugin } from "@elizaos/plugin-image-generation";
7577
import { lensPlugin } from "@elizaos/plugin-lensNetwork";
@@ -183,12 +185,17 @@ function mergeCharacters(base: Character, child: Character): Character {
183185
};
184186
return mergeObjects(base, child);
185187
}
186-
async function loadCharacter(filePath: string): Promise<Character> {
187-
const content = tryLoadFile(filePath);
188-
if (!content) {
189-
throw new Error(`Character file not found: ${filePath}`);
190-
}
191-
let character = JSON.parse(content);
188+
189+
async function loadCharacterFromUrl(url: string): Promise<Character> {
190+
const response = await fetch(url);
191+
const character = await response.json();
192+
return jsonToCharacter(url, character);
193+
}
194+
195+
async function jsonToCharacter(
196+
filePath: string,
197+
character: any
198+
): Promise<Character> {
192199
validateCharacterConfig(character);
193200

194201
// .id isn't really valid
@@ -226,6 +233,15 @@ async function loadCharacter(filePath: string): Promise<Character> {
226233
return character;
227234
}
228235

236+
async function loadCharacter(filePath: string): Promise<Character> {
237+
const content = tryLoadFile(filePath);
238+
if (!content) {
239+
throw new Error(`Character file not found: ${filePath}`);
240+
}
241+
let character = JSON.parse(content);
242+
return jsonToCharacter(filePath, character);
243+
}
244+
229245
export async function loadCharacters(
230246
charactersArg: string
231247
): Promise<Character[]> {
@@ -304,6 +320,16 @@ export async function loadCharacters(
304320
}
305321

306322
if (loadedCharacters.length === 0) {
323+
if (
324+
process.env.REMOTE_CHARACTER_URL != "" &&
325+
process.env.REMOTE_CHARACTER_URL.startsWith("http")
326+
) {
327+
const character = await loadCharacterFromUrl(
328+
process.env.REMOTE_CHARACTER_URL
329+
);
330+
loadedCharacters.push(character);
331+
}
332+
307333
elizaLogger.info("No characters found, using default character");
308334
loadedCharacters.push(defaultCharacter);
309335
}
@@ -585,10 +611,8 @@ export async function initializeClients(
585611
}
586612

587613
if (clientTypes.includes(Clients.FARCASTER)) {
588-
// why is this one different :(
589-
const farcasterClient = new FarcasterAgentClient(runtime);
614+
const farcasterClient = await FarcasterClientInterface.start(runtime);
590615
if (farcasterClient) {
591-
farcasterClient.start();
592616
clients.farcaster = farcasterClient;
593617
}
594618
}
@@ -826,7 +850,7 @@ export async function createAgent(
826850
getSecret(character, "ABSTRACT_PRIVATE_KEY")
827851
? abstractPlugin
828852
: null,
829-
getSecret(character, "B2_PRIVATE_KEY") ? b2Plugin: null,
853+
getSecret(character, "B2_PRIVATE_KEY") ? b2Plugin : null,
830854
getSecret(character, "BINANCE_API_KEY") &&
831855
getSecret(character, "BINANCE_SECRET_KEY")
832856
? binancePlugin
@@ -869,6 +893,9 @@ export async function createAgent(
869893
getSecret(character, "LETZAI_API_KEY") ? letzAIPlugin : null,
870894
getSecret(character, "STARGAZE_ENDPOINT") ? stargazePlugin : null,
871895
getSecret(character, "GIPHY_API_KEY") ? giphyPlugin : null,
896+
getSecret(character, "PASSPORT_API_KEY")
897+
? gitcoinPassportPlugin
898+
: null,
872899
getSecret(character, "GENLAYER_PRIVATE_KEY")
873900
? genLayerPlugin
874901
: null,
@@ -1111,3 +1138,19 @@ startAgents().catch((error) => {
11111138
elizaLogger.error("Unhandled error in startAgents:", error);
11121139
process.exit(1);
11131140
});
1141+
1142+
// Prevent unhandled exceptions from crashing the process if desired
1143+
if (
1144+
process.env.PREVENT_UNHANDLED_EXIT &&
1145+
parseBooleanFromText(process.env.PREVENT_UNHANDLED_EXIT)
1146+
) {
1147+
// Handle uncaught exceptions to prevent the process from crashing
1148+
process.on("uncaughtException", function (err) {
1149+
console.error("uncaughtException", err);
1150+
});
1151+
1152+
// Handle unhandled rejections to prevent the process from crashing
1153+
process.on("unhandledRejection", function (err) {
1154+
console.error("unhandledRejection", err);
1155+
});
1156+
}

client/src/components/chat.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,13 @@ export default function Page({ agentId }: { agentId: UUID }) {
6161

6262
const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
6363
if (e.key === "Enter" && !e.shiftKey) {
64+
e.preventDefault();
65+
if (e.nativeEvent.isComposing) return;
6466
handleSendMessage(e as unknown as React.FormEvent<HTMLFormElement>);
6567
}
6668
};
6769

70+
6871
const handleSendMessage = (e: React.FormEvent<HTMLFormElement>) => {
6972
e.preventDefault();
7073
if (!input) return;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
title: "Weekly Contributor Meeting Notes"
3+
date: 2024-12-10
4+
description: "Notes from the first ai16z Eliza contributor meeting, addressing key challenges in stability, plugins, and codebase organization, with proposed solutions for improvement."
5+
---
6+
7+
# Weekly Contributor Meeting Notes
8+
9+
(December 10, 2024 4:00 PM PST)
10+
11+
**Taming the Beast, The Quest for AI Agent Stability**
12+
13+
14+
## Summary
15+
16+
This first weekly meeting of maintainers and contributors for the ai16z Eliza repo, organized by Odilitime. The discussion revolved around improving the stability, maintainability, and organization of the rapidly growing project.
17+
18+
**Key Issues and Concerns:**
19+
20+
* **Instability and Breakages:** Frequent crashes and bugs were reported, especially after merging new code. Main was breaking repeatedly despite fixes.
21+
* **Plugin Management:** There was a hold on merging new plugins due to concerns about quality, maintainability, and the need for a more robust process.
22+
* **Code Quality and Modularity:** Concerns were raised about the overall quality and modularity of the codebase, particularly regarding how plugins were integrated. The lack of clear separation between core logic and plugins was causing issues.
23+
* **Testing:** The absence of comprehensive testing, especially for plugins and adapters, was identified as a major problem contributing to instability.
24+
* **Documentation:** The documentation was incomplete and outdated, making it difficult for new contributors to understand the project and how to use plugins.
25+
* **Organization and Planning:** The need for better organization, planning, and communication was highlighted, particularly for coordinating contributions and defining a clear roadmap.
26+
* **Contributor Incentives:** The discussion touched on how to properly incentivize and reward contributors, with considerations for retroactive rewards and avoiding a "mercenary" culture.
27+
28+
**Proposed Solutions and Action Items:**
29+
30+
* **Branching Strategy:** Enforce pushing new features to the `develop` branch instead of `main` to prevent constant breakages. Close PRs targeting `main` that are not bug fixes.
31+
* **Plugin V2 API:** Consider creating a new V2 API for plugins that better distinguishes between clients and adapters, allowing for a cleaner separation of concerns.
32+
* **Monorepo Tools:** Explore using monorepo tools like Turbo or NX to better manage dependencies and potentially break down the project into smaller, more manageable modules.
33+
* **Testing Framework:** Develop a testing framework to make it easier to write tests for plugins, adapters, and other components. Implement end-to-end tests to ensure basic functionality.
34+
* **Plugin Requirements:** Draft new requirements for plugins, including contact information for maintainers and possibly a migration path to a V2 API.
35+
* **JSON Configuration:** Allow specifying plugins in the character JSON configuration file to enable easier multi-tenant agent setup.
36+
* **Documentation Improvement:** Prioritize improving the documentation, potentially with the help of an AI agent to keep it up-to-date.
37+
* **Organization and Communication:** Use GitHub issues more effectively for tracking tasks and discussions. Consider using tools like Gorse to visualize code contributions.
38+
* **Contributor Roles:** Clarify roles and responsibilities, particularly regarding release engineering, architecture, and DevOps.
39+
* **Contributor Rewards:** Develop a system for rewarding contributors, potentially using quadratic funding and considering retroactive rewards.
40+
* **Regular Meetings:** Establish regular meetings (weekly, as suggested) to improve communication and coordination among maintainers and contributors.
41+
* **AI Agents:** Utilize AI agents to assist with documentation, onboarding, and other tasks.
42+
43+
**Participants:**
44+
45+
The meeting involved several key participants, including Odilitime (the organizer), Jin, 0x8664,and several others who actively contributed to the discussion.
46+
47+
**Overall Tone:**
48+
49+
The tone of the meeting was constructive and collaborative, with participants expressing a shared desire to improve the Eliza Repo and address the challenges of its rapid growth. There was a sense of urgency to implement solutions and establish better processes to ensure the project's long-term success.
50+
51+
52+
## Quotables
53+
54+
1. **"We kind of put a hold on merging new plugins and I started going through the repo last night and actually flagging which PRs are just straight up new plugins." (00:01:55)**
55+
* This is a hot take because it signals a significant shift in the project's approach to handling new plugins. It implies that the previous process was not sustainable, and the decision to halt new plugin merges could be controversial among contributors eager to add their work. It raises questions about the criteria for accepting plugins and the long-term vision for plugin integration.
56+
57+
2. **"Yeah, what I would love if we can manage- it is to get people pushing to develop and not main because main keeps like- we fix main and then it re breaks and this is the same." (00:02:19)**
58+
* This highlights a major pain point in the development process and suggests a stricter control over the `main` branch. This could be controversial as it restricts contributors' ability to directly merge into `main` and might be perceived as a slowdown in development, even though the intention is to increase stability.
59+
60+
3. **"So one thing we were kind of thinking about is, you know, how we could potentially segment the repository because there's functionally like the core of this repository is agent folder, right?" (00:08:05)**
61+
* This is a hot take as it proposes a fundamental change to the structure of the repository. Segmenting the repository could be a significant undertaking and might face resistance or debate about the best way to implement modularity. It suggests a potential shift from a monolithic architecture to a more modular one, which has implications for development and maintenance.
62+
63+
4. **"I think we could use some kind of organization, I know Rudolph and other folks are doing, and then the ability to execute against it. I'm not sure if there's any kind of, you know, documents we have any, you know, Google Sheets, you know, any sort of structure so that we can kind of not lose things in the discord." (00:16:55)**
64+
* This take openly criticizes the current state of organization and communication within the project. The call for a more structured approach, moving beyond Discord chats, implies that the current methods are insufficient and potentially hindering progress. This could spark debate about the best tools and processes for project management.
65+
66+
5. **"If you're doing things that are adding value, I do want to do some stuff with quadratic funding in the future. Because right now, it's just very deterministic, based on objective data." (00:39:45)**
67+
* The introduction of quadratic funding is a hot take, especially within an open-source context. It's a relatively novel approach to funding that can be complex to implement and may be met with skepticism or misunderstanding. The discussion around contributor rewards and avoiding a "mercenary" culture adds another layer of complexity and potential controversy to this topic. It's unclear how this would work, given that quadratic funding typically requires tokens, and they stated they are not creating a token.
68+
69+
These takes represent key areas of change, potential conflict, and important decisions that will shape the future of the ai16z Eliza project. They often challenge the status quo, propose significant changes, and touch on sensitive topics like code quality, project organization, and contributor compensation.

0 commit comments

Comments
 (0)