Skip to content

Commit bdc7b83

Browse files
authored
Merge branch 'develop' into logger-improvement
2 parents d8e25cb + 5ae8feb commit bdc7b83

File tree

42 files changed

+1126
-542
lines changed

Some content is hidden

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

42 files changed

+1126
-542
lines changed

.env.example

+10-3
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ VITE_SERVER_PORT=${SERVER_PORT}
1515
SUPABASE_URL=
1616
SUPABASE_ANON_KEY=
1717

18-
# Remote character url (optional)
19-
REMOTE_CHARACTER_URL=
18+
# Comma separated list of remote character urls (optional)
19+
REMOTE_CHARACTER_URLS=
2020

2121
###############################
2222
#### Client Configurations ####
@@ -87,6 +87,13 @@ EMBEDDING_OPENAI_MODEL= # Default: text-embedding-3-small
8787
IMAGE_OPENAI_MODEL= # Default: dall-e-3
8888
USE_OPENAI_EMBEDDING= # Set to TRUE for OpenAI/1536, leave blank for local
8989

90+
# Atoma SDK Configuration
91+
ATOMASDK_BEARER_AUTH= # Atoma SDK Bearer Auth token
92+
ATOMA_API_URL= # Default: https://api.atoma.network/v1
93+
SMALL_ATOMA_MODEL= # Default: meta-llama/Llama-3.3-70B-Instruct
94+
MEDIUM_ATOMA_MODEL= # Default: meta-llama/Llama-3.3-70B-Instruct
95+
LARGE_ATOMA_MODEL= # Default: meta-llama/Llama-3.3-70B-Instruct
96+
9097
# Eternal AI's Decentralized Inference API
9198
ETERNALAI_URL=
9299
ETERNALAI_MODEL= # Default: "NousResearch/Hermes-3-Llama-3.1-70B-FP8"
@@ -366,7 +373,7 @@ SQUID_SDK_URL=https://apiplus.squidrouter.com # Default: https://apiplus.squidro
366373
SQUID_INTEGRATOR_ID= # get integrator id through https://docs.squidrouter.com/
367374
SQUID_EVM_ADDRESS=
368375
SQUID_EVM_PRIVATE_KEY=
369-
SQUID_API_THROTTLE_INTERVAL= # Default: 0; Used to throttle API calls to avoid rate limiting (in ms)
376+
SQUID_API_THROTTLE_INTERVAL=1000 # Default: 1000; Used to throttle API calls to avoid rate limiting (in ms)
370377

371378
# TEE Configuration
372379
# TEE_MODE options:

agent/src/index.ts

+28-14
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ import { openWeatherPlugin } from "@elizaos/plugin-open-weather";
8787
import { quaiPlugin } from "@elizaos/plugin-quai";
8888
import { sgxPlugin } from "@elizaos/plugin-sgx";
8989
import { solanaPlugin } from "@elizaos/plugin-solana";
90-
import { solanaAgentkitPlguin } from "@elizaos/plugin-solana-agentkit";
90+
import { solanaAgentkitPlugin } from "@elizaos/plugin-solana-agentkit";
9191
import { squidRouterPlugin } from "@elizaos/plugin-squid-router";
9292
import { stargazePlugin } from "@elizaos/plugin-stargaze";
9393
import { storyPlugin } from "@elizaos/plugin-story";
@@ -245,12 +245,15 @@ async function loadCharacter(filePath: string): Promise<Character> {
245245
return jsonToCharacter(filePath, character);
246246
}
247247

248+
function commaSeparatedStringToArray(commaSeparated: string): string[] {
249+
return commaSeparated?.split(",").map(value => value.trim())
250+
}
251+
252+
248253
export async function loadCharacters(
249254
charactersArg: string
250255
): Promise<Character[]> {
251-
let characterPaths = charactersArg
252-
?.split(",")
253-
.map((filePath) => filePath.trim());
256+
let characterPaths = commaSeparatedStringToArray(charactersArg)
254257
const loadedCharacters: Character[] = [];
255258

256259
if (characterPaths?.length > 0) {
@@ -322,17 +325,16 @@ export async function loadCharacters(
322325
}
323326
}
324327

325-
if (loadedCharacters.length === 0) {
326-
if (
327-
process.env.REMOTE_CHARACTER_URL != "" &&
328-
process.env.REMOTE_CHARACTER_URL.startsWith("http")
329-
) {
330-
const character = await loadCharacterFromUrl(
331-
process.env.REMOTE_CHARACTER_URL
332-
);
328+
if (hasValidRemoteUrls()) {
329+
elizaLogger.info("Loading characters from remote URLs");
330+
let characterUrls = commaSeparatedStringToArray(process.env.REMOTE_CHARACTER_URLS)
331+
for (const characterUrl of characterUrls) {
332+
const character = await loadCharacterFromUrl(characterUrl);
333333
loadedCharacters.push(character);
334334
}
335+
}
335336

337+
if (loadedCharacters.length === 0) {
336338
elizaLogger.info("No characters found, using default character");
337339
loadedCharacters.push(defaultCharacter);
338340
}
@@ -474,6 +476,11 @@ export function getTokenForProvider(
474476
character.settings?.secrets?.VENICE_API_KEY ||
475477
settings.VENICE_API_KEY
476478
);
479+
case ModelProviderName.ATOMA:
480+
return (
481+
character.settings?.secrets?.ATOMASDK_BEARER_AUTH ||
482+
settings.ATOMASDK_BEARER_AUTH
483+
);
477484
case ModelProviderName.AKASH_CHAT_API:
478485
return (
479486
character.settings?.secrets?.AKASH_CHAT_API_KEY ||
@@ -786,7 +793,7 @@ export async function createAgent(
786793
? solanaPlugin
787794
: null,
788795
getSecret(character, "SOLANA_PRIVATE_KEY")
789-
? solanaAgentkitPlguin
796+
? solanaAgentkitPlugin
790797
: null,
791798
getSecret(character, "AUTONOME_JWT_TOKEN") ? autonomePlugin : null,
792799
(getSecret(character, "NEAR_ADDRESS") ||
@@ -1099,14 +1106,21 @@ const checkPortAvailable = (port: number): Promise<boolean> => {
10991106
});
11001107
};
11011108

1109+
1110+
const hasValidRemoteUrls = () =>
1111+
process.env.REMOTE_CHARACTER_URLS &&
1112+
process.env.REMOTE_CHARACTER_URLS !== "" &&
1113+
process.env.REMOTE_CHARACTER_URLS.startsWith("http");
1114+
1115+
11021116
const startAgents = async () => {
11031117
const directClient = new DirectClient();
11041118
let serverPort = parseInt(settings.SERVER_PORT || "3000");
11051119
const args = parseArguments();
11061120
let charactersArg = args.characters || args.character;
11071121
let characters = [defaultCharacter];
11081122

1109-
if (charactersArg) {
1123+
if (charactersArg || hasValidRemoteUrls()) {
11101124
characters = await loadCharacters(charactersArg);
11111125
}
11121126

client/src/lib/api.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const fetcher = async ({
2525

2626
if (method === "POST") {
2727
if (body instanceof FormData) {
28-
// @ts-expect-error - Supressing potentially undefined options header
28+
// @ts-expect-error - Suppressing potentially undefined options header
2929
delete options.headers["Content-Type"];
3030
options.body = body;
3131
} else {

docs/community/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ ElizaOS empowers developers of all skill levels to harness the potential of AI a
2727

2828
## Governance
2929

30-
ai16z originates as being an AI agent led DAO. Similar to how we can influence the autonomous agents on memecoins to buy, we intend to bring similar functionality for token holders to actively participate in the decision-making process and shape the future of the project. Community members can pitch ideas, provide insights, and influence investment strategies based on their expertise and track record.
30+
ai16z originates as being an AI agent-led DAO. Similar to how we can influence the autonomous agents on memecoins to buy, we intend to bring similar functionality for token holders to actively participate in the decision-making process and shape the future of the project. Community members can pitch ideas, provide insights, and influence investment strategies based on their expertise and track record.
3131

3232
## Explore and Contribute
3333

docs/docs/core/actions.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ interface Action {
164164
- **validate**: Determines if the action can be executed
165165
- **handler**: Implements the action's behavior
166166
- **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)
167+
- **suppressInitialMessage**: When true, suppress the initial response message before processing the action. Useful for actions that generate their own responses (like image generation)
168168

169169
---
170170

@@ -179,7 +179,7 @@ const continueAction: Action = {
179179
name: "CONTINUE",
180180
similes: ["ELABORATE", "KEEP_TALKING"],
181181
description:
182-
"Used when the message requires a follow-up. Don't use when the conversation is finished.",
182+
"Used when the message requires a follow-up. Don't use it when the conversation is finished.",
183183
validate: async (runtime, message) => {
184184
// Validation logic
185185
return true;

docs/docs/quickstart.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ You set which model to use inside the character JSON file
130130
pnpm start --character="characters/trump.character.json"
131131
```
132132

133-
You can also load multiple characters with the characters option with a comma separated list:
133+
You can also load multiple characters with the characters option with a comma-separated list:
134134

135135
```bash
136136
pnpm start --characters="characters/trump.character.json,characters/tate.character.json"

packages/client-direct/src/api.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export function createApiRouter(
109109
};
110110
if (!agentId) return;
111111

112-
let agent: AgentRuntime = agents.get(agentId);
112+
const agent: AgentRuntime = agents.get(agentId);
113113

114114
if (agent) {
115115
agent.stop();
@@ -127,7 +127,7 @@ export function createApiRouter(
127127
};
128128
if (!agentId) return;
129129

130-
let agent: AgentRuntime = agents.get(agentId);
130+
const agent: AgentRuntime = agents.get(agentId);
131131

132132
// update character
133133
if (agent) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import eslintGlobalConfig from "../../eslint.config.mjs";
2+
3+
export default [...eslintGlobalConfig];

packages/client-instagram/src/index.ts

+46-44
Original file line numberDiff line numberDiff line change
@@ -6,50 +6,52 @@ import { InstagramInteractionService } from "./services/interaction";
66
import { InstagramPostService } from "./services/post";
77

88
export const InstagramClientInterface: Client = {
9-
async start(runtime: IAgentRuntime) {
10-
try {
11-
// Validate configuration
12-
const config = await validateInstagramConfig(runtime);
13-
elizaLogger.log("Instagram client configuration validated");
14-
15-
// Initialize client and get initial state
16-
const state = await initializeClient(runtime, config);
17-
elizaLogger.log("Instagram client initialized");
18-
19-
// Create services
20-
const postService = new InstagramPostService(runtime, state);
21-
const interactionService = new InstagramInteractionService(runtime, state);
22-
23-
// Start services
24-
if (!config.INSTAGRAM_DRY_RUN) {
25-
await postService.start();
26-
elizaLogger.log("Instagram post service started");
27-
28-
if (config.INSTAGRAM_ENABLE_ACTION_PROCESSING) {
29-
await interactionService.start();
30-
elizaLogger.log("Instagram interaction service started");
9+
async start(runtime: IAgentRuntime) {
10+
try {
11+
// Validate configuration
12+
const config = await validateInstagramConfig(runtime);
13+
elizaLogger.log("Instagram client configuration validated");
14+
15+
// Initialize client and get initial state
16+
const state = await initializeClient(runtime, config);
17+
elizaLogger.log("Instagram client initialized");
18+
19+
// Create services
20+
const postService = new InstagramPostService(runtime, state);
21+
const interactionService = new InstagramInteractionService(
22+
runtime,
23+
state
24+
);
25+
26+
// Start services
27+
if (!config.INSTAGRAM_DRY_RUN) {
28+
await postService.start();
29+
elizaLogger.log("Instagram post service started");
30+
31+
if (config.INSTAGRAM_ENABLE_ACTION_PROCESSING) {
32+
await interactionService.start();
33+
elizaLogger.log("Instagram interaction service started");
34+
}
35+
} else {
36+
elizaLogger.log("Instagram client running in dry-run mode");
37+
}
38+
39+
// Return manager instance
40+
return {
41+
post: postService,
42+
interaction: interactionService,
43+
state,
44+
};
45+
} catch (error) {
46+
elizaLogger.error("Failed to start Instagram client:", error);
47+
throw error;
3148
}
32-
} else {
33-
elizaLogger.log("Instagram client running in dry-run mode");
34-
}
35-
36-
// Return manager instance
37-
return {
38-
post: postService,
39-
interaction: interactionService,
40-
state
41-
};
42-
43-
} catch (error) {
44-
elizaLogger.error("Failed to start Instagram client:", error);
45-
throw error;
46-
}
47-
},
48-
49-
async stop(runtime: IAgentRuntime) {
50-
elizaLogger.log("Stopping Instagram client services...");
51-
// Cleanup will be handled by the services themselves
52-
}
49+
},
50+
51+
async stop(_runtime: IAgentRuntime) {
52+
elizaLogger.log("Stopping Instagram client services...");
53+
// Cleanup will be handled by the services themselves
54+
},
5355
};
5456

55-
export default InstagramClientInterface;
57+
export default InstagramClientInterface;

0 commit comments

Comments
 (0)