Skip to content

Commit 8eed22d

Browse files
export work cleanup
1 parent 2ba0aaf commit 8eed22d

21 files changed

+78
-74
lines changed

core/src/actions/ask_claude.ts core/src/actions/askClaude.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const claudeHandlerTemplate = `{{attachments}}
1919
2020
# Instructions: Claude, I need your help in assisting the user with their last request. Please provide a helpful, thorough response. I have no arms, so you'll have to write out any implements and take care not to omit or leave TODOs for later. Also, please don't acknowledge the request, just do it.`;
2121

22-
export default {
22+
export const askClaude: Action = {
2323
name: "ASK_CLAUDE",
2424
similes: ["CLAUDE", "CALL_CLAUDE", "ANTHROPIC", "SONNET", "OPUS"],
2525
description:

core/src/actions/continue.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Based on the following conversation, should {{agentName}} continue? YES or NO
3030
3131
Should {{agentName}} continue? ` + booleanFooter;
3232

33-
export default {
33+
export const continueAction: Action = {
3434
name: "CONTINUE",
3535
similes: ["ELABORATE", "KEEP_TALKING"],
3636
description:

core/src/actions/follow_room.ts core/src/actions/followRoom.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Respond with YES if:
2424
Otherwise, respond with NO.
2525
` + booleanFooter;
2626

27-
export default {
27+
export const followRoom: Action = {
2828
name: "FOLLOW_ROOM",
2929
similes: [
3030
"FOLLOW_CHAT",

core/src/actions/ignore.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
type Action,
66
} from "../core/types.ts";
77

8-
export default {
8+
export const ignore: Action = {
99
name: "IGNORE",
1010
similes: ["STOP_TALKING", "STOP_CHATTING", "STOP_CONVERSATION"],
1111
validate: async (_runtime: IAgentRuntime, _message: Memory) => {

core/src/actions/imageGeneration.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
} from "../core/types.ts";
88
import { generateCaption, generateImage } from "./imageGenerationUtils.ts";
99

10-
export default {
10+
export const imageGeneration: Action = {
1111
name: "IMAGE_GEN",
1212
similes: ["GENERATE_IMAGE", "CREATE_IMAGE", "MAKE_PICTURE"],
1313
description: "Generate an image based on a prompt",

core/src/actions/index.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
export * from "./ask_claude.ts";
2-
export * from "./follow_room.ts";
1+
export * from "./askClaude.ts";
2+
export * from "./followRoom.ts";
33
export * from "./imageGeneration.ts";
4-
export * from "./mute_room.ts";
4+
export * from "./muteRoom.ts";
55
export * from "./swap.ts";
6-
export * from "./unfollow_room.ts";
7-
export * from "./unmute_room.ts";
8-
export * from "./mute_room.ts";
6+
export * from "./unfollowRoom.ts";
7+
export * from "./unmuteRoom.ts";
8+
export * from "./muteRoom.ts";
99
export * from "./continue.ts";
10-
export * from "./follow_room.ts";
10+
export * from "./followRoom.ts";
1111
export * from "./ignore.ts";
1212
export * from "./imageGenerationUtils.ts";
1313
export * from "./pumpfun.ts";
1414
export * from "./swap.ts";
15-
export * from "./swapUtils.ts";
16-
export * from "./take_order.ts";
15+
export * from "./takeOrder.ts";
16+
export * from "./none.ts";

core/src/actions/mute_room.ts core/src/actions/muteRoom.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Respond with YES if:
2525
Otherwise, respond with NO.
2626
` + booleanFooter;
2727

28-
export default {
28+
export const muteRoom: Action = {
2929
name: "MUTE_ROOM",
3030
similes: [
3131
"MUTE_CHAT",

core/src/actions/none.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
type Action,
66
} from "../core/types.ts";
77

8-
export default {
8+
export const none: Action = {
99
name: "NONE",
1010
similes: [
1111
"NO_ACTION",

core/src/actions/swap.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async function promptConfirmation(): Promise<boolean> {
4141
return confirmSwap;
4242
}
4343

44-
export default {
44+
export const executeSwap: Action = {
4545
name: "EXECUTE_SWAP",
4646
similes: ["SWAP_TOKENS", "TOKEN_SWAP", "TRADE_TOKENS", "EXCHANGE_TOKENS"],
4747
validate: async (runtime: IAgentRuntime, message: Memory) => {
File renamed without changes.

core/src/actions/unfollow_room.ts core/src/actions/unfollowRoom.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Respond with YES if:
2424
Otherwise, respond with NO.
2525
` + booleanFooter;
2626

27-
export default {
27+
export const unfollowRoom: Action = {
2828
name: "UNFOLLOW_ROOM",
2929
similes: [
3030
"UNFOLLOW_CHAT",

core/src/actions/unmute_room.ts core/src/actions/unmuteRoom.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Respond with YES if:
2424
Otherwise, respond with NO.
2525
` + booleanFooter;
2626

27-
export default {
27+
export const unmuteRoom: Action = {
2828
name: "UNMUTE_ROOM",
2929
similes: [
3030
"UNMUTE_CHAT",

core/src/core/actions.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { names, uniqueNamesGenerator } from "unique-names-generator";
22
import { Action, ActionExample } from "./types.ts";
33

4-
// import cont from "../actions/continue.ts";
5-
import ignore from "../actions/ignore.ts";
6-
import none from "../actions/none.ts";
4+
import * as DefaultActions from "../actions/index.ts";
75

8-
export const defaultActions: Action[] = [/* cont, */ ignore, none];
6+
export const defaultActions: Action[] = [
7+
DefaultActions.ignore,
8+
DefaultActions.none,
9+
];
910

1011
/**
1112
* Composes a set of example conversations based on provided actions and a specified count.

core/src/core/providers.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import time from "../providers/time.ts";
1+
import { timeProvider } from "../providers/time.ts";
22
import { IAgentRuntime, State, type Memory, type Provider } from "./types.ts";
33

4-
export const defaultProviders: Provider[] = [time];
4+
export const defaultProviders: Provider[] = [timeProvider];
55

66
/**
77
* Formats provider outputs into a string which can be injected into the context.

core/src/index.ts

+38-41
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,26 @@
22
export * from "./actions/index.ts";
33
export * from "./clients/index.ts";
44
export * from "./adapters/index.ts";
5+
export * from "./providers/index.ts";
6+
7+
import * as Action from "./actions/index.ts";
8+
import * as Client from "./clients/index.ts";
9+
import * as Adapter from "./adapters/index.ts";
10+
import * as Provider from "./providers/index.ts";
511

612
import Database from "better-sqlite3";
713
import fs from "fs";
814
import yargs from "yargs";
9-
import askClaude from "./actions/ask_claude.ts";
10-
import follow_room from "./actions/follow_room.ts";
11-
import imageGeneration from "./actions/imageGeneration.ts";
12-
import mute_room from "./actions/mute_room.ts";
13-
import swap from "./actions/swap.ts";
14-
import unfollow_room from "./actions/unfollow_room.ts";
15-
import unmute_room from "./actions/unmute_room.ts";
16-
import { PostgresDatabaseAdapter } from "./adapters/postgres.ts";
17-
import { SqliteDatabaseAdapter } from "./adapters/sqlite.ts";
18-
import DirectClient from "./clients/direct/index.ts";
19-
import { DiscordClient } from "./clients/discord/index.ts";
20-
import { TelegramClient } from "./clients/telegram/src/index.ts"; // Added Telegram import
21-
import { TwitterGenerationClient } from "./clients/twitter/generate.ts";
22-
import { TwitterInteractionClient } from "./clients/twitter/interactions.ts";
23-
import { TwitterSearchClient } from "./clients/twitter/search.ts";
15+
2416
import { wait } from "./clients/twitter/utils.ts";
2517
import { defaultActions } from "./core/actions.ts";
2618
import defaultCharacter from "./core/defaultCharacter.ts";
2719
import { AgentRuntime } from "./core/runtime.ts";
2820
import settings from "./core/settings.ts";
2921
import { Character, IAgentRuntime, ModelProvider } from "./core/types.ts"; // Added IAgentRuntime
30-
import boredomProvider from "./providers/boredom.ts";
31-
import timeProvider from "./providers/time.ts";
32-
import walletProvider from "./providers/wallet.ts";
22+
3323
import readline from "readline";
34-
import orderbook from "./providers/order_book.ts";
35-
import tokenProvider from "./providers/token.ts";
24+
3625
interface Arguments {
3726
character?: string;
3827
characters?: string;
@@ -76,7 +65,7 @@ const characterPaths = argv.characters?.split(",").map((path) => path.trim());
7665

7766
const characters = [];
7867

79-
const directClient = new DirectClient();
68+
const directClient = new Client.DirectClient();
8069
directClient.start(3000);
8170

8271
if (characterPaths?.length > 0) {
@@ -112,11 +101,11 @@ async function startAgent(character: Character) {
112101
let db;
113102
if (process.env.POSTGRES_URL) {
114103
// const db = new SqliteDatabaseAdapter(new Database("./db.sqlite"));
115-
db = new PostgresDatabaseAdapter({
104+
db = new Adapter.PostgresDatabaseAdapter({
116105
connectionString: process.env.POSTGRES_URL,
117106
});
118107
} else {
119-
db = new SqliteDatabaseAdapter(new Database("./db.sqlite"));
108+
db = new Adapter.SqliteDatabaseAdapter(new Database("./db.sqlite"));
120109
// Debug adapter
121110
// const loggingDb = createLoggingDatabaseAdapter(db);
122111
}
@@ -127,16 +116,20 @@ async function startAgent(character: Character) {
127116
modelProvider: character.modelProvider,
128117
evaluators: [],
129118
character,
130-
providers: [timeProvider, boredomProvider, walletProvider],
119+
providers: [
120+
Provider.timeProvider,
121+
Provider.boredomProvider,
122+
Provider.walletProvider,
123+
],
131124
actions: [
132125
...defaultActions,
133-
askClaude,
134-
follow_room,
135-
unfollow_room,
136-
unmute_room,
137-
mute_room,
138-
imageGeneration,
139-
swap,
126+
Action.askClaude,
127+
Action.followRoom,
128+
Action.unfollowRoom,
129+
Action.unmuteRoom,
130+
Action.muteRoom,
131+
Action.imageGeneration,
132+
Action.executeSwap,
140133
],
141134
});
142135

@@ -147,17 +140,17 @@ async function startAgent(character: Character) {
147140
evaluators: [],
148141
character,
149142
providers: [
150-
timeProvider,
151-
boredomProvider,
152-
walletProvider,
153-
orderbook,
154-
tokenProvider,
143+
Provider.timeProvider,
144+
Provider.boredomProvider,
145+
Provider.walletProvider,
146+
Provider.orderBookProvider,
147+
Provider.tokenProvider,
155148
],
156149
actions: [...defaultActions],
157150
});
158151

159152
function startDiscord(runtime: IAgentRuntime) {
160-
const discordClient = new DiscordClient(runtime);
153+
const discordClient = new Client.DiscordClient(runtime);
161154
return discordClient;
162155
}
163156

@@ -177,7 +170,7 @@ async function startAgent(character: Character) {
177170

178171
try {
179172
console.log("Creating new TelegramClient instance...");
180-
const telegramClient = new TelegramClient(runtime, botToken);
173+
const telegramClient = new Client.TelegramClient(runtime, botToken);
181174

182175
console.log("Calling start() on TelegramClient...");
183176
await telegramClient.start();
@@ -197,13 +190,17 @@ async function startAgent(character: Character) {
197190

198191
async function startTwitter(runtime) {
199192
console.log("Starting search client");
200-
const twitterSearchClient = new TwitterSearchClient(runtime);
193+
const twitterSearchClient = new Client.TwitterSearchClient(runtime);
201194
await wait();
202195
console.log("Starting interaction client");
203-
const twitterInteractionClient = new TwitterInteractionClient(runtime);
196+
const twitterInteractionClient = new Client.TwitterInteractionClient(
197+
runtime
198+
);
204199
await wait();
205200
console.log("Starting generation client");
206-
const twitterGenerationClient = new TwitterGenerationClient(runtime);
201+
const twitterGenerationClient = new Client.TwitterGenerationClient(
202+
runtime
203+
);
207204

208205
return {
209206
twitterInteractionClient,

core/src/providers/boredom.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ const negativeWords = [
272272
"fuck up",
273273
];
274274

275-
const boredom: Provider = {
275+
const boredomProvider: Provider = {
276276
get: async (runtime: IAgentRuntime, message: Memory, state?: State) => {
277277
const agentId = runtime.agentId;
278278
const agentName = state?.agentName || "The agent";
@@ -340,4 +340,4 @@ const boredom: Provider = {
340340
},
341341
};
342342

343-
export default boredom;
343+
export { boredomProvider };

core/src/providers/index.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export * from "./boredom.ts";
2+
export * from "./time.ts";
3+
export * from "./wallet.ts";
4+
export * from "./orderBook.ts";
5+
export * from "./token.ts";
6+
export * from "./balances.ts";

core/src/providers/order_book.ts core/src/providers/orderBook.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface Order {
1111
price: number;
1212
}
1313

14-
const orderbook: Provider = {
14+
const orderBookProvider: Provider = {
1515
get: async (runtime: IAgentRuntime, message: Memory, _state?: State) => {
1616
const userId = message.userId;
1717

@@ -40,4 +40,4 @@ const orderbook: Provider = {
4040
},
4141
};
4242

43-
export default orderbook;
43+
export { orderBookProvider };

core/src/providers/time.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { IAgentRuntime, Memory, Provider, State } from "../core/types.ts";
22

3-
const time: Provider = {
3+
const timeProvider: Provider = {
44
get: async (_runtime: IAgentRuntime, _message: Memory, _state?: State) => {
55
const currentDate = new Date();
66
const currentTime = currentDate.toLocaleTimeString("en-US");
@@ -9,4 +9,4 @@ const time: Provider = {
99
},
1010
};
1111

12-
export default time;
12+
export { timeProvider };

core/src/providers/token.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -756,4 +756,4 @@ const tokenProvider: Provider = {
756756
},
757757
};
758758

759-
export default tokenProvider;
759+
export { tokenProvider };

core/src/providers/wallet.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -285,4 +285,4 @@ const walletProvider: Provider = {
285285
};
286286

287287
// Module exports
288-
export default walletProvider;
288+
export { walletProvider };

0 commit comments

Comments
 (0)