Skip to content

Commit a4516ee

Browse files
authored
Merge branch 'develop' into docs_update
2 parents 254b784 + 6b73c35 commit a4516ee

File tree

36 files changed

+2569
-1399
lines changed

36 files changed

+2569
-1399
lines changed

.env.example

+4
Original file line numberDiff line numberDiff line change
@@ -340,3 +340,7 @@ STORY_PRIVATE_KEY= # Story private key
340340
STORY_API_BASE_URL= # Story API base URL
341341
STORY_API_KEY= # Story API key
342342
PINATA_JWT= # Pinata JWT for uploading files to IPFS
343+
344+
# Cronos zkEVM
345+
CRONOSZKEVM_ADDRESS=
346+
CRONOSZKEVM_PRIVATE_KEY=

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ packages/core/src/providers/cache
4545
packages/core/src/providers/cache/*
4646
cache/*
4747
packages/plugin-coinbase/src/plugins/transactions.csv
48-
packages/plugin-coinbase/package-lock.json
4948

5049
tsup.config.bundled_*.mjs
5150

agent/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
"@elizaos/plugin-multiversx": "workspace:*",
5353
"@elizaos/plugin-near": "workspace:*",
5454
"@elizaos/plugin-zksync-era": "workspace:*",
55+
"@elizaos/plugin-cronoszkevm": "workspace:*",
56+
"@elizaos/plugin-3d-generation": "workspace:*",
5557
"readline": "1.3.0",
5658
"ws": "8.18.0",
5759
"yargs": "17.7.2"

agent/src/index.ts

+25
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import { evmPlugin } from "@elizaos/plugin-evm";
4646
import { storyPlugin } from "@elizaos/plugin-story";
4747
import { flowPlugin } from "@elizaos/plugin-flow";
4848
import { imageGenerationPlugin } from "@elizaos/plugin-image-generation";
49+
import { ThreeDGenerationPlugin } from "@elizaos/plugin-3d-generation";
4950
import { multiversxPlugin } from "@elizaos/plugin-multiversx";
5051
import { nearPlugin } from "@elizaos/plugin-near";
5152
import { nftGenerationPlugin } from "@elizaos/plugin-nft-generation";
@@ -55,6 +56,7 @@ import { suiPlugin } from "@elizaos/plugin-sui";
5556
import { TEEMode, teePlugin } from "@elizaos/plugin-tee";
5657
import { tonPlugin } from "@elizaos/plugin-ton";
5758
import { zksyncEraPlugin } from "@elizaos/plugin-zksync-era";
59+
import { cronosZkEVMPlugin } from "@elizaos/plugin-cronoszkevm";
5860
import { abstractPlugin } from "@elizaos/plugin-abstract";
5961
import Database from "better-sqlite3";
6062
import fs from "fs";
@@ -178,6 +180,25 @@ export async function loadCharacters(
178180
const character = JSON.parse(content);
179181
validateCharacterConfig(character);
180182

183+
// .id isn't really valid
184+
const characterId = character.id || character.name;
185+
const characterPrefix = `CHARACTER.${characterId.toUpperCase().replace(/ /g, "_")}.`;
186+
187+
const characterSettings = Object.entries(process.env)
188+
.filter(([key]) => key.startsWith(characterPrefix))
189+
.reduce((settings, [key, value]) => {
190+
const settingKey = key.slice(characterPrefix.length);
191+
return { ...settings, [settingKey]: value };
192+
}, {});
193+
194+
if (Object.keys(characterSettings).length > 0) {
195+
character.settings = character.settings || {};
196+
character.settings.secrets = {
197+
...characterSettings,
198+
...character.settings.secrets,
199+
};
200+
}
201+
181202
// Handle plugins
182203
if (isAllStrings(character.plugins)) {
183204
elizaLogger.info("Plugins are: ", character.plugins);
@@ -516,6 +537,7 @@ export async function createAgent(
516537
getSecret(character, "HEURIST_API_KEY")
517538
? imageGenerationPlugin
518539
: null,
540+
getSecret(character, "FAL_API_KEY") ? ThreeDGenerationPlugin : null,
519541
...(getSecret(character, "COINBASE_API_KEY") &&
520542
getSecret(character, "COINBASE_PRIVATE_KEY")
521543
? [
@@ -544,6 +566,9 @@ export async function createAgent(
544566
getSecret(character, "APTOS_PRIVATE_KEY") ? aptosPlugin : null,
545567
getSecret(character, "MVX_PRIVATE_KEY") ? multiversxPlugin : null,
546568
getSecret(character, "ZKSYNC_PRIVATE_KEY") ? zksyncEraPlugin : null,
569+
getSecret(character, "CRONOSZKEVM_PRIVATE_KEY")
570+
? cronosZkEVMPlugin
571+
: null,
547572
getSecret(character, "TON_PRIVATE_KEY") ? tonPlugin : null,
548573
getSecret(character, "SUI_PRIVATE_KEY") ? suiPlugin : null,
549574
getSecret(character, "STORY_PRIVATE_KEY") ? storyPlugin : null,

docs/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ You can run Grok models by setting the `XAI_MODEL` environment variable to `grok
6767

6868
### Run with OpenAI
6969

70-
You can run OpenAI models by setting the `XAI_MODEL` environment variable to `gpt-4o-mini` or `gpt-4o`
70+
You can run OpenAI models by setting the `XAI_MODEL` environment variable to `gpt-4-mini` or `gpt-4o`
7171

7272
## Additional Requirements
7373

docs/docs/core/actions.md

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ interface Action {
3131
examples: ActionExample[][];
3232
handler: Handler;
3333
validate: Validator;
34+
suppressInitialMessage?: boolean;
3435
}
3536
```
3637

@@ -151,6 +152,7 @@ interface Action {
151152
state?: State,
152153
) => Promise<void>;
153154
examples: ActionExample[][];
155+
suppressInitialMessage?: boolean;
154156
}
155157
```
156158

@@ -162,6 +164,7 @@ interface Action {
162164
- **validate**: Determines if the action can be executed
163165
- **handler**: Implements the action's behavior
164166
- **examples**: Demonstrates proper usage patterns
167+
- **suppressInitialMessage**: When true, suppresses the initial response message before processing the action. Useful for actions that generate their own responses (like image generation)
165168

166169
---
167170

docs/docs/guides/secrets-management.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ A comprehensive guide for managing secrets, API keys, and sensitive configuratio
1212

1313
Eliza uses a hierarchical environment variable system:
1414

15-
1. Character-specific secrets (highest priority)
16-
2. Environment variables
17-
3. Default values (lowest priority)
15+
1. Character-specific namespaced environment variables (highest priority)
16+
2. Character-specific secrets
17+
3. Environment variables
18+
4. Default values (lowest priority)
1819

1920
### Secret Types
2021

@@ -96,6 +97,8 @@ Define secrets in character files:
9697
}
9798
```
9899

100+
Alternatively, you can use the `CHARACTER.YOUR_CHARACTER_NAME.SECRET_NAME` format inside your `.env` file.
101+
99102
Access secrets in code:
100103

101104
```typescript

docs/docs/packages/agent.md

+14
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,15 @@ export async function initializeClients(
160160

161161
### Token Management
162162

163+
Tokens can be configured in two ways:
164+
165+
1. Using namespaced environment variables:
166+
```env
167+
CHARACTER.YOUR_CHARACTER_NAME.OPENAI_API_KEY=sk-...
168+
CHARACTER.YOUR_CHARACTER_NAME.ANTHROPIC_API_KEY=sk-...
169+
```
170+
171+
2. Using character settings:
163172
```typescript
164173
export function getTokenForProvider(
165174
provider: ModelProviderName,
@@ -181,6 +190,11 @@ export function getTokenForProvider(
181190
}
182191
```
183192

193+
The system will check for tokens in the following order:
194+
1. Character-specific namespaced env variables
195+
2. Character settings from JSON
196+
3. Global environment variables
197+
184198
### Database Selection
185199

186200
```typescript

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"preinstall": "npx only-allow pnpm",
55
"build": "turbo run build --filter=!eliza-docs",
66
"build-docker": "turbo run build",
7+
"cleanstart": "if [ -f agent/data/db.sqlite ]; then rm agent/data/db.sqlite; fi && pnpm --filter \"@elizaos/agent\" start --isRoot",
8+
"cleanstart:debug": "if [ -f agent/data/db.sqlite ]; then rm agent/data/db.sqlite; fi && cross-env NODE_ENV=development VERBOSE=true DEBUG=eliza:* pnpm --filter \"@elizaos/agent\" start --isRoot",
79
"start": "pnpm --filter \"@elizaos/agent\" start --isRoot",
810
"start:client": "pnpm --dir client dev",
911
"start:debug": "cross-env NODE_ENV=development VERBOSE=true DEBUG=eliza:* pnpm --filter \"@elizaos/agent\" start --isRoot",

packages/client-direct/src/index.ts

+18-3
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,13 @@ export class DirectClient {
222222

223223
await runtime.evaluate(memory, state);
224224

225+
// Check if we should suppress the initial message
226+
const action = runtime.actions.find(
227+
(a) => a.name === response.action
228+
);
229+
const shouldSuppressInitialMessage =
230+
action?.suppressInitialMessage;
231+
225232
const _result = await runtime.processActions(
226233
memory,
227234
[responseMessage],
@@ -232,10 +239,18 @@ export class DirectClient {
232239
}
233240
);
234241

235-
if (message) {
236-
res.json([response, message]);
242+
if (!shouldSuppressInitialMessage) {
243+
if (message) {
244+
res.json([response, message]);
245+
} else {
246+
res.json([response]);
247+
}
237248
} else {
238-
res.json([response]);
249+
if (message) {
250+
res.json([message]);
251+
} else {
252+
res.json([]);
253+
}
239254
}
240255
}
241256
);

packages/client-twitter/src/interactions.ts

+10-9
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,18 @@ Recent interactions between {{agentName}} and other users:
3939
4040
{{recentPosts}}
4141
42-
# Task: Generate a post/reply in the voice, style and perspective of {{agentName}} (@{{twitterUserName}}) while using the thread of tweets as additional context:
42+
# TASK: Generate a post/reply in the voice, style and perspective of {{agentName}} (@{{twitterUserName}}) while using the thread of tweets as additional context:
43+
4344
Current Post:
4445
{{currentPost}}
4546
4647
Thread of Tweets You Are Replying To:
4748
{{formattedConversation}}
4849
49-
{{actions}}
50-
# Task: Generate a post in the voice, style and perspective of {{agentName}} (@{{twitterUserName}}). You MUST include an action if the current post text includes a prompt that is similar to one of the available actions mentioned here:
50+
# INSTRUCTIONS: Generate a post in the voice, style and perspective of {{agentName}} (@{{twitterUserName}}). You MUST include an action if the current post text includes a prompt that is similar to one of the available actions mentioned here:
5151
{{actionNames}}
52+
{{actions}}
53+
5254
Here is the current post text again. Remember to include an action if the current post text includes a prompt that asks for one of the available actions mentioned above (does not need to be exact)
5355
{{currentPost}}
5456
` + messageCompletionFooter;
@@ -69,18 +71,17 @@ For other users:
6971
- {{agentName}} should STOP if conversation is concluded
7072
- {{agentName}} is in a room with other users and wants to be conversational, but not annoying.
7173
72-
{{recentPosts}}
73-
74-
IMPORTANT: For users not in the priority list, {{agentName}} (@{{twitterUserName}}) should err on the side of IGNORE rather than RESPOND if in doubt.
74+
IMPORTANT:
75+
- {{agentName}} (aka @{{twitterUserName}}) is particularly sensitive about being annoying, so if there is any doubt, it is better to IGNORE than to RESPOND.
76+
- For users not in the priority list, {{agentName}} (@{{twitterUserName}}) should err on the side of IGNORE rather than RESPOND if in doubt.
7577
78+
Recent Posts:
7679
{{recentPosts}}
7780
78-
IMPORTANT: {{agentName}} (aka @{{twitterUserName}}) is particularly sensitive about being annoying, so if there is any doubt, it is better to IGNORE than to RESPOND.
79-
81+
Current Post:
8082
{{currentPost}}
8183
8284
Thread of Tweets You Are Replying To:
83-
8485
{{formattedConversation}}
8586
8687
# INSTRUCTIONS: Respond with [RESPOND] if {{agentName}} should respond, or [IGNORE] if {{agentName}} should not respond to the last message and [STOP] if {{agentName}} should stop participating in the conversation.

packages/client-twitter/src/post.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,10 @@ export class TwitterPostClient {
171171
if (postImmediately) {
172172
await this.generateNewTweet();
173173
}
174-
generateNewTweetLoop();
175174

176175
// Add check for ENABLE_ACTION_PROCESSING before starting the loop
177176
const enableActionProcessing =
178-
this.runtime.getSetting("ENABLE_ACTION_PROCESSING") ?? false;
177+
this.runtime.getSetting("ENABLE_ACTION_PROCESSING") === "true" || false;
179178

180179
if (enableActionProcessing) {
181180
processActionsLoop().catch((error) => {
@@ -184,10 +183,11 @@ export class TwitterPostClient {
184183
error
185184
);
186185
});
187-
generateNewTweetLoop();
188186
} else {
189187
elizaLogger.log("Action processing loop disabled by configuration");
190188
}
189+
190+
generateNewTweetLoop();
191191
}
192192

193193
constructor(client: ClientBase, runtime: IAgentRuntime) {

0 commit comments

Comments
 (0)