Skip to content

Commit 5eb2ecc

Browse files
authored
Merge branch 'develop' into patch-1
2 parents 0db64b3 + cd61663 commit 5eb2ecc

File tree

142 files changed

+11750
-1724
lines changed

Some content is hidden

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

142 files changed

+11750
-1724
lines changed

.env.example

+17-1
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,9 @@ CHARITY_ADDRESS_ETH=0x750EF1D7a0b4Ab1c97B7A623D7917CcEb5ea779C
268268
CHARITY_ADDRESS_ARB=0x1234567890123456789012345678901234567890
269269
CHARITY_ADDRESS_POL=0x1234567890123456789012345678901234567890
270270

271+
# thirdweb
272+
THIRDWEB_SECRET_KEY= # Create key on thirdweb developer dashboard: https://thirdweb.com/
273+
271274
# Conflux Configuration
272275
CONFLUX_CORE_PRIVATE_KEY=
273276
CONFLUX_CORE_SPACE_RPC_URL=
@@ -396,6 +399,9 @@ STORY_API_BASE_URL= # Story API base URL
396399
STORY_API_KEY= # Story API key
397400
PINATA_JWT= # Pinata JWT for uploading files to IPFS
398401

402+
# Cosmos
403+
COSMOS_RECOVERY_PHRASE= # 12 words recovery phrase (need to be in quotes, because of spaces)
404+
COSMOS_AVAILABLE_CHAINS= # mantrachaintestnet2,cosmos # Array of chains
399405
# Cronos zkEVM
400406
CRONOSZKEVM_ADDRESS=
401407
CRONOSZKEVM_PRIVATE_KEY=
@@ -407,11 +413,21 @@ FUEL_WALLET_PRIVATE_KEY=
407413
TOKENIZER_MODEL= # Specify the tokenizer model to be used.
408414
TOKENIZER_TYPE= # Options: tiktoken (for OpenAI models) or auto (AutoTokenizer from Hugging Face for non-OpenAI models). Default: tiktoken.
409415

416+
417+
# Spheron
418+
SPHERON_PRIVATE_KEY=
419+
SPHERON_PROVIDER_PROXY_URL=
420+
SPHERON_WALLET_ADDRESS=
421+
410422
# Stargaze NFT marketplace from Cosmos (You can use https://graphql.mainnet.stargaze-apis.com/graphql)
411423
STARGAZE_ENDPOINT=
412424

413425
# GenLayer
414-
GENLAYER_PRIVATE_KEY=0x0000000000000000000000000000000000000000000000000000000000000000 # Private key of the GenLayer account to use for the agent
426+
GENLAYER_PRIVATE_KEY= # Private key of the GenLayer account to use for the agent in this format (0x0000000000000000000000000000000000000000000000000000000000000000)
415427

416428
# OpenWeather
417429
OPEN_WEATHER_API_KEY= # OpenWeather API key
430+
431+
# Allora
432+
ALLORA_API_KEY= # Allora API key, format: UP-f8db7d6558ab432ca0d92716
433+
ALLORA_CHAIN_SLUG= # must be one of mainnet, testnet. If not specified, it will use testnet by default

agent/package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"@elizaos/plugin-binance": "workspace:*",
3838
"@elizaos/plugin-avail": "workspace:*",
3939
"@elizaos/plugin-bootstrap": "workspace:*",
40-
"@ai16z/plugin-cosmos": "workspace:*",
40+
"@elizaos/plugin-cosmos": "workspace:*",
4141
"@elizaos/plugin-intiface": "workspace:*",
4242
"@elizaos/plugin-coinbase": "workspace:*",
4343
"@elizaos/plugin-coinprice": "workspace:*",
@@ -69,9 +69,12 @@
6969
"@elizaos/plugin-fuel": "workspace:*",
7070
"@elizaos/plugin-avalanche": "workspace:*",
7171
"@elizaos/plugin-web-search": "workspace:*",
72+
"@elizaos/plugin-thirdweb": "workspace:*",
7273
"@elizaos/plugin-genlayer": "workspace:*",
7374
"@elizaos/plugin-open-weather": "workspace:*",
75+
"@elizaos/plugin-obsidian": "workspace:*",
7476
"@elizaos/plugin-arthera": "workspace:*",
77+
"@elizaos/plugin-allora": "workspace:*",
7578
"readline": "1.3.0",
7679
"ws": "8.18.0",
7780
"yargs": "17.7.2"
@@ -83,4 +86,4 @@
8386
"ts-node": "10.9.2",
8487
"tsup": "8.3.5"
8588
}
86-
}
89+
}

agent/src/index.ts

+17-11
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import { DirectClient } from "@elizaos/client-direct";
3838
import { ThreeDGenerationPlugin } from "@elizaos/plugin-3d-generation";
3939
import { abstractPlugin } from "@elizaos/plugin-abstract";
4040
import { aptosPlugin } from "@elizaos/plugin-aptos";
41+
import { alloraPlugin } from "@elizaos/plugin-allora";
4142
import { avalanchePlugin } from "@elizaos/plugin-avalanche";
4243
import { binancePlugin } from "@elizaos/plugin-binance";
4344
import {
@@ -53,6 +54,7 @@ import { confluxPlugin } from "@elizaos/plugin-conflux";
5354
import { cronosZkEVMPlugin } from "@elizaos/plugin-cronoszkevm";
5455
import { echoChambersPlugin } from "@elizaos/plugin-echochambers";
5556
import { evmPlugin } from "@elizaos/plugin-evm";
57+
import { createCosmosPlugin } from "@elizaos/plugin-cosmos";
5658
import { flowPlugin } from "@elizaos/plugin-flow";
5759
import { fuelPlugin } from "@elizaos/plugin-fuel";
5860
import { genLayerPlugin } from "@elizaos/plugin-genlayer";
@@ -69,14 +71,14 @@ import { TEEMode, teePlugin } from "@elizaos/plugin-tee";
6971
import { teeMarlinPlugin } from "@elizaos/plugin-tee-marlin";
7072
import { tonPlugin } from "@elizaos/plugin-ton";
7173
import { webSearchPlugin } from "@elizaos/plugin-web-search";
74+
import { echoChamberPlugin } from "@elizaos/plugin-echochambers";
75+
import { thirdwebPlugin } from "@elizaos/plugin-thirdweb";
7276
import { zksyncEraPlugin } from "@elizaos/plugin-zksync-era";
73-
7477
import { availPlugin } from "@elizaos/plugin-avail";
7578
import { openWeatherPlugin } from "@elizaos/plugin-open-weather";
76-
7779
import { artheraPlugin } from "@elizaos/plugin-arthera";
7880
import { stargazePlugin } from "@elizaos/plugin-stargaze";
79-
81+
import { obsidianPlugin } from "@elizaos/plugin-obsidian";
8082
import Database from "better-sqlite3";
8183
import fs from "fs";
8284
import net from "net";
@@ -514,11 +516,7 @@ export async function createAgent(
514516
cache: ICacheManager,
515517
token: string
516518
): Promise<AgentRuntime> {
517-
elizaLogger.success(
518-
elizaLogger.successesTitle,
519-
"Creating runtime for character",
520-
character.name
521-
);
519+
elizaLogger.log(`Creating runtime for character ${character.name}`);
522520

523521
nodePlugin ??= createNodePlugin();
524522

@@ -590,6 +588,9 @@ export async function createAgent(
590588
getSecret(character, "WALLET_PUBLIC_KEY")?.startsWith("0x"))
591589
? evmPlugin
592590
: null,
591+
getSecret(character, "COSMOS_RECOVERY_PHRASE") &&
592+
getSecret(character, "COSMOS_AVAILABLE_CHAINS") &&
593+
createCosmosPlugin(),
593594
(getSecret(character, "SOLANA_PUBLIC_KEY") ||
594595
(getSecret(character, "WALLET_PUBLIC_KEY") &&
595596
!getSecret(character, "WALLET_PUBLIC_KEY")?.startsWith(
@@ -647,6 +648,7 @@ export async function createAgent(
647648
: null,
648649
getSecret(character, "TEE_MARLIN") ? teeMarlinPlugin : null,
649650
getSecret(character, "TON_PRIVATE_KEY") ? tonPlugin : null,
651+
getSecret(character, "THIRDWEB_SECRET_KEY") ? thirdwebPlugin : null,
650652
getSecret(character, "SUI_PRIVATE_KEY") ? suiPlugin : null,
651653
getSecret(character, "STORY_PRIVATE_KEY") ? storyPlugin : null,
652654
getSecret(character, "FUEL_PRIVATE_KEY") ? fuelPlugin : null,
@@ -661,14 +663,18 @@ export async function createAgent(
661663
getSecret(character, "GENLAYER_PRIVATE_KEY")
662664
? genLayerPlugin
663665
: null,
664-
getSecret(character, "AVAIL_SEED") ? availPlugin : null,
665-
getSecret(character, "AVAIL_APP_ID") ? availPlugin : null,
666+
getSecret(character, "AVAIL_SEED") &&
667+
getSecret(character, "AVAIL_APP_ID")
668+
? availPlugin
669+
: null,
666670
getSecret(character, "OPEN_WEATHER_API_KEY")
667671
? openWeatherPlugin
668672
: null,
669-
getSecret(character, "ARTHERA_PRIVATE_KEY")?.startsWith("0x")
673+
getSecret(character, "OBSIDIAN_API_TOKEN") ? obsidianPlugin : null,
674+
getSecret(character, "ARTHERA_PRIVATE_KEY")?.startsWith("0x")
670675
? artheraPlugin
671676
: null,
677+
getSecret(character, "ALLORA_API_KEY") ? alloraPlugin : null,
672678
].filter(Boolean),
673679
providers: [],
674680
actions: [],

characters/cosmosHelper.character.json

+10-26
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
"clients": [],
44
"modelProvider": "groq",
55
"settings": {
6-
"secrets": {},
76
"voice": {
87
"model": "en_US-male-medium"
98
},
109
"chains": {
1110
"cosmos": ["axelar", "carbon", "mantrachaintestnet2"]
1211
}
1312
},
14-
"plugins": ["@ai16z/plugin-cosmos","@ai16z/plugin-bootstrap"],
13+
"plugins": [],
1514
"bio": [
1615
"Expert in Cosmos ecosystem.",
1716
"Knowledgeable in CosmWasm and Stargate.",
@@ -24,37 +23,22 @@
2423
"Supports projects and interactions within the Cosmos ecosystem."
2524
],
2625
"knowledge": [
27-
"knows EXACT cost to families under Kamala ($29,000)",
28-
"understands REAL border numbers (worse than reported)",
29-
"saw what really happened in Minneapolis 2020",
30-
"remembers who begged for help (and when)",
31-
"knows why Iran's president targeting us",
32-
"understands Secret Service allocation (and why they do it)",
33-
"knows REAL rally numbers (they hide them)",
34-
"saw the TRUTH about China Virus response",
35-
"understands states' rights better than anyone",
36-
"knows why they're letting in illegal guns",
37-
"remembers when America was AFFORDABLE",
38-
"understands the REAL election interference",
39-
"knows why they're scared of WorldLibertyFi",
40-
"saw what they did to women's sports",
41-
"understands the REAL Middle East situation",
42-
"knows why missiles flying everywhere now",
43-
"remembers perfect peace under Trump presidency",
44-
"understands Democrat election strategy (letting in MILLIONS)",
45-
"knows Kamala's REAL tax plans (coming for everything)",
46-
"saw what they did to Minneapolis (and other cities)"
26+
"Knows how Cosmos blockchain works",
27+
"Knows what actions should he call for token transfer, swapping or bridging",
28+
"Knows that users might want to do specific actions multiple times and should help them by doing it again.",
29+
"Should always ask for confirmation before calling an COSMOS_TRANSFER, COSMOS_BRIDGE, COSMOS_SWAP actions.",
30+
"Should call actions COSMOS_TRANSFER, COSMOS_BRIDGE, COSMOS_SWAP only after previous confirmation."
4731
],
4832
"messageExamples": [
4933
[
5034
{
5135
"user": "{{user1}}",
52-
"content": { "text": "Can you explain the Cosmos Hub?" }
36+
"content": { "text": "Show my balances of my wallet on {{mantrachaintestnet2}}" }
5337
},
5438
{
5539
"user": "CosmosHelper",
5640
"content": {
57-
"text": "The Cosmos Hub is the central blockchain in the Cosmos ecosystem, facilitating interoperability between connected blockchains."
41+
"text": "Your balances on chain {{mantrachaintestnet2}} are: \n - 13456.124 OM\n - 1222 ONDO\n 0.122122 USDY"
5842
}
5943
}
6044
],
@@ -97,12 +81,12 @@
9781
[
9882
{
9983
"user": "{{user1}}",
100-
"content": { "text": "What are validators?" }
84+
"content": { "text": "Make transfer 0.0001 OM to mantra13248w8dtnn07sxc3gq4l3ts4rvfyat6fks0ecj on mantrachaintestnet2" }
10185
},
10286
{
10387
"user": "CosmosHelper",
10488
"content": {
105-
"text": "Validators are responsible for securing the network by validating transactions and producing new blocks. They earn rewards through staking."
89+
"text": "Sure, your transfer i being processed."
10690
}
10791
}
10892
]

docs/docs/packages/plugins.md

+30
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,36 @@ cargo run --ip-addr <ip>:<port>
742742
docker run --init -p 127.0.0.1:1350:1350 marlinorg/attestation-server-custom-mock
743743
```
744744
745+
### 12. Allora Plugin (`@elizaos/allora-plugin`)
746+
747+
The [Allora Network](https://allora.network) plugin seamlessly empowers Eliza agents with real-time, advanced, self-improving AI inferences, delivering high-performance insights without introducing any additional complexity.
748+
749+
#### Setup and Configuration
750+
751+
1. Add the plugin to your character's configuration
752+
753+
```typescript
754+
import { alloraPlugin } from "@eliza/plugin-allora";
755+
756+
const character = {
757+
plugins: [alloraPlugin],
758+
};
759+
```
760+
761+
2. Set the following environment variables:
762+
- `ALLORA_API_KEY`: Create an API key by [creating an account](https://developer.upshot.xyz/signup).
763+
764+
#### Actions
765+
766+
- `GET_INFERENCE`: Retrieves predictions for a specific topic.
767+
768+
Example interactions:
769+
770+
```
771+
User: "What is the predicted ETH price in 5 minutes?"
772+
Agent: "I'll get the inference now..."
773+
Agent: "Inference provided by Allora Network on topic ETH 5min Prediction (ID: 13): 3393.364326646801085508"
774+
745775
### Writing Custom Plugins
746776

747777
Create a new plugin by implementing the Plugin interface:

packages/adapter-sqlite/src/index.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,19 @@ export class SqliteDatabaseAdapter
215215
const content = JSON.stringify(memory.content);
216216
const createdAt = memory.createdAt ?? Date.now();
217217

218+
let embeddingValue: Float32Array = new Float32Array(384);
219+
// If embedding is not available, we just load an array with a length of 384
220+
if (memory?.embedding && memory?.embedding?.length > 0) {
221+
embeddingValue = new Float32Array(memory.embedding);
222+
}
223+
218224
// Insert the memory with the appropriate 'unique' value
219225
const sql = `INSERT OR REPLACE INTO memories (id, type, content, embedding, userId, roomId, agentId, \`unique\`, createdAt) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`;
220226
this.db.prepare(sql).run(
221227
memory.id ?? v4(),
222228
tableName,
223229
content,
224-
new Float32Array(memory.embedding!), // Store as Float32Array
230+
embeddingValue,
225231
memory.userId,
226232
memory.roomId,
227233
memory.agentId,
@@ -707,4 +713,4 @@ export class SqliteDatabaseAdapter
707713
return false;
708714
}
709715
}
710-
}
716+
}

packages/client-telegram/src/messageManager.ts

+5-15
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Result: [RESPOND]
5252
{{user1}}: stfu bot
5353
Result: [STOP]
5454
55-
{{user1}}: Hey {{agent}}, can you help me with something
55+
{{user1}}: Hey {{agentName}}, can you help me with something
5656
Result: [RESPOND]
5757
5858
{{user1}}: {{agentName}} stfu plz
@@ -63,7 +63,7 @@ Result: [STOP]
6363
{{user1}}: no. i need help from someone else
6464
Result: [IGNORE]
6565
66-
{{user1}}: Hey {{agent}}, can I ask you a question
66+
{{user1}}: Hey {{agentName}}, can I ask you a question
6767
{{agentName}}: Sure, what is it
6868
{{user1}}: can you ask claude to create a basic react module that demonstrates a counter
6969
Result: [RESPOND]
@@ -103,28 +103,22 @@ The goal is to decide whether {{agentName}} should respond to the last message.
103103
104104
{{recentMessages}}
105105
106-
Thread of Tweets You Are Replying To:
107-
108-
{{formattedConversation}}
109-
110106
# INSTRUCTIONS: Choose the option that best describes {{agentName}}'s response to the last message. Ignore messages if they are addressed to someone else.
111107
` + shouldRespondFooter;
112108

113109
const telegramMessageHandlerTemplate =
114110
// {{goals}}
115-
`# Action Examples
111+
`
116112
{{actionExamples}}
117113
(Action examples are for reference only. Do not use the information from them in your response.)
118114
119115
# Knowledge
120116
{{knowledge}}
121117
122-
# Task: Generate dialog and actions for the character {{agentName}}.
123-
About {{agentName}}:
118+
# About {{agentName}}:
124119
{{bio}}
125120
{{lore}}
126121
127-
Examples of {{agentName}}'s dialog and actions:
128122
{{characterMessageExamples}}
129123
130124
{{providers}}
@@ -140,11 +134,7 @@ Note that {{agentName}} is capable of reading/seeing/hearing various forms of me
140134
141135
{{recentMessages}}
142136
143-
# Task: Generate a post/reply in the voice, style and perspective of {{agentName}} (@{{twitterUserName}}) while using the thread of tweets as additional context:
144-
Current Post:
145-
{{currentPost}}
146-
Thread of Tweets You Are Replying To:
147-
137+
# Task: Generate a reply in the voice, style and perspective of {{agentName}} while using the thread above as additional context. You are replying on Telegram.
148138
{{formattedConversation}}
149139
` + messageCompletionFooter;
150140

0 commit comments

Comments
 (0)