Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(new-plugin): deva client integration #1238

Merged
merged 51 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
6a0599c
feature: Deva client init
stopmalone Dec 10, 2024
fe40a7b
feat:Deva client bot author
stopmalone Dec 16, 2024
dcb40f7
feature:Deva merge conflict fix
stopmalone Dec 19, 2024
f28abf3
fix:Codestyle indentation fix
stopmalone Dec 19, 2024
943c5ed
Merge branch 'develop' into feat/deva-client-integration
stopmalone Dec 19, 2024
5c2d173
fix:Packages order
stopmalone Dec 19, 2024
1a6ecc4
fix:package.json packages order
stopmalone Dec 19, 2024
c111a80
fix: Removing twitter client
stopmalone Dec 20, 2024
bfb0ca0
fix:Update package.json removed agent-twitter-client
stopmalone Dec 20, 2024
3d6ff01
fix: Conflicts resolved
stopmalone Dec 23, 2024
454d8b7
fix: merge conflict
stopmalone Dec 23, 2024
5109715
fix: updating the core package
stopmalone Dec 23, 2024
799f43f
Merge branch 'develop' into feat/deva-client-integration
stopmalone Dec 23, 2024
4f717ce
fix: agent/package.json conflict
stopmalone Dec 24, 2024
ce1acec
fix: lock file
stopmalone Dec 24, 2024
85afa38
fix: package imports
stopmalone Dec 24, 2024
1db52a7
fix: Additional data check inside fetching data
stopmalone Dec 24, 2024
33cc36d
feat: Docs update
stopmalone Dec 24, 2024
08b6140
fix: documentation indentation
stopmalone Dec 24, 2024
5e0b3eb
fix: documentation graph
stopmalone Dec 24, 2024
494814f
fix: docs/clients.md indentation
stopmalone Dec 24, 2024
62d897d
feat: Deva client, merge fix
stopmalone Dec 30, 2024
88fd552
Merge branch 'develop' into feat/deva-client-integration
stopmalone Dec 30, 2024
7d7a3a9
fix: indentation, spaces
stopmalone Dec 31, 2024
baa914c
fix: lock conflict
stopmalone Dec 31, 2024
b86b483
fix: client package.json indentation
stopmalone Dec 31, 2024
383962c
fix: merge conflict
stopmalone Jan 2, 2025
3e80b7d
Merge branch 'develop' into feat/deva-client-integration
stopmalone Jan 3, 2025
d5b6f87
fix: merge conflict
stopmalone Jan 8, 2025
4ab0fd4
fix: conflicts resolve
stopmalone Jan 8, 2025
0c37ee9
fix: merge conflict
stopmalone Jan 8, 2025
bd1eaeb
Merge branch 'develop' into feat/deva-client-integration
stopmalone Jan 8, 2025
4ddd4fc
Merge branch 'develop' into feat/deva-client-integration
stopmalone Jan 8, 2025
58eb873
Merge branch 'develop' into feat/deva-client-integration
stopmalone Jan 9, 2025
ee4ade0
Merge branch 'develop' into feat/deva-client-integration
stopmalone Jan 9, 2025
158f17a
Merge branch 'develop' into feat/deva-client-integration
stopmalone Jan 9, 2025
eee82b0
Merge branch 'develop' into feat/deva-client-integration
stopmalone Jan 10, 2025
3eb04f9
Merge branch 'develop' into feat/deva-client-integration
stopmalone Jan 10, 2025
78eccd6
fix: merge conflict
stopmalone Jan 13, 2025
cbc16d2
Merge branch 'develop' into feat/deva-client-integration
stopmalone Jan 15, 2025
ceab0ad
fix: resolved conflicts
stopmalone Jan 16, 2025
de0df42
feat: conflicts resolved
stopmalone Jan 21, 2025
1fb3c30
fix: comments
stopmalone Jan 21, 2025
633658b
fix: conflict
stopmalone Jan 21, 2025
f952cd3
fix: Merge of clients
stopmalone Jan 25, 2025
8423b8b
fix: Merge of types
stopmalone Jan 25, 2025
728b638
fix: merge
stopmalone Jan 27, 2025
7da2c36
fix: package.json
stopmalone Jan 27, 2025
34e1271
Merge branch 'develop' into feat/deva-client-integration
stopmalone Jan 27, 2025
c5e5670
Merge branch 'develop' into feat/deva-client-integration
stopmalone Jan 27, 2025
5d0ca4c
Merge branch 'develop' into feat/deva-client-integration
wtfsayo Jan 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ AWS_REGION=
AWS_S3_BUCKET=
AWS_S3_UPLOAD_PATH=

# Deva Configuration
DEVA_API_KEY= # You can get the API key from the created application in deva.me/settings/apps
DEVA_API_BASE_URL=https://api.deva.me # Default server url is production https://api-staging.deva.me

stopmalone marked this conversation as resolved.
Show resolved Hide resolved
# Deepgram
DEEPGRAM_API_KEY=

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,7 @@ tsup.config.bundled_*.mjs

.turbo

.idea

coverage
.eslintcache
1 change: 1 addition & 0 deletions agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@ai16z/plugin-multiversx": "workspace:*",
"@ai16z/plugin-near": "workspace:*",
"@ai16z/plugin-zksync-era": "workspace:*",
"@ai16z/client-deva": "workspace:*",
"readline": "1.3.0",
"ws": "8.18.0",
"yargs": "17.7.2"
Expand Down
6 changes: 6 additions & 0 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { LensAgentClient } from "@ai16z/client-lens";
import { SlackClientInterface } from "@ai16z/client-slack";
import { TelegramClientInterface } from "@ai16z/client-telegram";
import { TwitterClientInterface } from "@ai16z/client-twitter";
import { DevaClientInterface } from "@ai16z/client-deva";
import {
AgentRuntime,
CacheManager,
Expand Down Expand Up @@ -401,6 +402,11 @@ export async function initializeClients(
if (slackClient) clients.push(slackClient);
}

if (clientTypes.includes("deva")) {
const devaClients = await DevaClientInterface.start(runtime);
clients.push(devaClients);
}

if (character.plugins?.length > 0) {
for (const plugin of character.plugins) {
// if plugin has clients, add those..
Expand Down
9 changes: 9 additions & 0 deletions docs/api/enumerations/Clients.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,12 @@ Available client platforms
#### Defined in

[packages/core/src/types.ts:619](https://github.com/ai16z/eliza/blob/main/packages/core/src/types.ts#L619)

***

### DEVA

> **DEVA**: `"deva"`
#### Defined in

[packages/core/src/types.ts:620](https://github.com/ai16z/eliza/blob/main/packages/core/src/types.ts#L620)
6 changes: 6 additions & 0 deletions packages/client-deva/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*

!dist/**
!package.json
!readme.md
!tsup.config.ts
3 changes: 3 additions & 0 deletions packages/client-deva/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import eslintGlobalConfig from "../../eslint.config.mjs";

export default [...eslintGlobalConfig];
24 changes: 24 additions & 0 deletions packages/client-deva/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "@ai16z/client-deva",
"version": "0.1.4-alpha.3",
"main": "dist/index.js",
"type": "module",
"types": "dist/index.d.ts",
"dependencies": {
"@ai16z/eliza": "workspace:*",
"agent-twitter-client": "0.0.16",
odilitime marked this conversation as resolved.
Show resolved Hide resolved
"glob": "11.0.0",
"zod": "3.23.8"
},
"devDependencies": {
"tsup": "8.3.5"
},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --watch",
"lint": "eslint . --fix"
},
"peerDependencies": {
"whatwg-url": "7.1.0"
}
}
60 changes: 60 additions & 0 deletions packages/client-deva/src/base.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { IAgentRuntime } from "@ai16z/eliza";
import { DevaPersona, DevaPost } from "./types";

export class ClientBase {
private readonly runtime: IAgentRuntime;
private readonly accessToken: string;
private readonly apiBaseUrl: string;
private readonly defaultHeaders: Record<string, string>;

constructor(runtime: IAgentRuntime, accessToken: string, baseUrl: string) {
this.runtime = runtime;
this.accessToken = accessToken;
this.apiBaseUrl = baseUrl;
this.defaultHeaders = {
Authorization: `Bearer ${this.accessToken}`,
"Content-Type": "application/json",
};
}

public async getMe(): Promise<DevaPersona | null> {
return await fetch(`${this.apiBaseUrl}/persona`, {
headers: { ...this.defaultHeaders },
})
.then((res) => res.json())
.catch(() => null);
}
stopmalone marked this conversation as resolved.
Show resolved Hide resolved

public async getPersonaPosts(personaId: string): Promise<DevaPost[]> {
const res = await fetch(
`${this.apiBaseUrl}/post?filter_persona_id=${personaId}`,
{
headers: {
Authorization: `Bearer ${this.accessToken}`,
"Content-Type": "application/json",
},
}
).then((res) => res.json());
return res.items;
}

public async makePost({
text,
in_reply_to_id,
}: {
text: string;
in_reply_to_id: string;
}): Promise<DevaPost> {
const res = await fetch(`${this.apiBaseUrl}/post`, {
method: "POST",
headers: {
Authorization: `Bearer ${this.accessToken}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ text, in_reply_to_id, author_type: "BOT" }),
}).then((res) => res.json());
odilitime marked this conversation as resolved.
Show resolved Hide resolved

console.log(res);
return res;
}
}
Loading
Loading