Skip to content

Commit

Permalink
Merge branch 'develop' into thirdweb
Browse files Browse the repository at this point in the history
  • Loading branch information
iankm authored Dec 25, 2024
2 parents eff0426 + d928b8e commit 14f870f
Show file tree
Hide file tree
Showing 17 changed files with 557 additions and 106 deletions.
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ TOGETHER_API_KEY=
# Server Configuration
SERVER_PORT=3000

# Abstract Configuration
ABSTRACT_ADDRESS=
ABSTRACT_PRIVATE_KEY=
ABSTRACT_RPC_URL=https://api.testnet.abs.xyz

# Starknet Configuration
STARKNET_ADDRESS=
STARKNET_PRIVATE_KEY=
Expand Down
88 changes: 88 additions & 0 deletions .github/workflows/generate-readme-translations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Generate Readme Translations
on:
push:
branches:
- "1222--README-ci-auto-translation"

jobs:
translation:
runs-on: ubuntu-latest
strategy:
matrix:
language: [
{code: 'CN', name: 'Chinese'},
{code: 'DE', name: 'German'},
{code: 'ES', name: 'Spanish'},
{code: 'FR', name: 'French'},
{code: 'HE', name: 'Hebrew'},
{code: 'IT', name: 'Italian'},
{code: 'JA', name: 'Japanese'},
{code: 'KOR', name: 'Korean'},
{code: 'PTBR', name: 'Portuguese (Brazil)'},
{code: 'RU', name: 'Russian'},
{code: 'TH', name: 'Thai'},
{code: 'TR', name: 'Turkish'},
{code: 'VI', name: 'Vietnamese'}
]
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: main
token: ${{ secrets.GH_TOKEN }}

- name: Translate to ${{ matrix.language.name }}
uses: 0xjord4n/[email protected]
id: aixion
with:
config: >
{
"provider": "openai",
"provider_options": {
"api_key": "${{ secrets.OPENAI_API_KEY }}"
},
"messages": [
{
"role": "system",
"content": "You will be provided with a markdown file in English, and your task is to translate it into ${{ matrix.language.name }}."
},
{
"role": "user",
"content_path": "README.md"
}
],
"save_path": "README_${{ matrix.language.code }}.md",
"model": "gpt-4o"
}
# Upload each translated file as an artifact
- name: Upload translation
uses: actions/upload-artifact@v4
with:
name: readme-${{ matrix.language.code }}
path: README_${{ matrix.language.code }}.md

commit:
needs: translation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
token: ${{ secrets.GH_TOKEN }}

# Download all translation artifacts
- name: Download all translations
uses: actions/download-artifact@v4
with:
pattern: readme-*
merge-multiple: true

- name: Commit all translations
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: update all README translations"
branch: main
file_pattern: "README_*.md"
commit_author: "GitHub Action <[email protected]>"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ concatenated-output.ts
embedding-cache.json
packages/plugin-buttplug/intiface-engine

.idea
.DS_Store

dist/
Expand Down
68 changes: 35 additions & 33 deletions agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,40 +17,42 @@
"exec": "node --enable-source-maps --loader ts-node/esm src/index.ts"
},
"dependencies": {
"@ai16z/adapter-postgres": "workspace:*",
"@ai16z/adapter-sqlite": "workspace:*",
"@ai16z/client-auto": "workspace:*",
"@ai16z/client-direct": "workspace:*",
"@ai16z/client-discord": "workspace:*",
"@ai16z/client-farcaster": "workspace:*",
"@ai16z/client-lens": "workspace:*",
"@ai16z/client-telegram": "workspace:*",
"@ai16z/client-twitter": "workspace:*",
"@ai16z/client-slack": "workspace:*",
"@ai16z/eliza": "workspace:*",
"@ai16z/plugin-0g": "workspace:*",
"@ai16z/plugin-aptos": "workspace:*",
"@ai16z/plugin-bootstrap": "workspace:*",
"@ai16z/plugin-intiface": "workspace:*",
"@ai16z/plugin-coinbase": "workspace:*",
"@ai16z/plugin-conflux": "workspace:*",
"@ai16z/plugin-evm": "workspace:*",
"@ai16z/plugin-flow": "workspace:*",
"@ai16z/plugin-story": "workspace:*",
"@ai16z/plugin-goat": "workspace:*",
"@ai16z/plugin-icp": "workspace:*",
"@ai16z/plugin-image-generation": "workspace:*",
"@ai16z/plugin-nft-generation": "workspace:*",
"@ai16z/plugin-node": "workspace:*",
"@ai16z/plugin-solana": "workspace:*",
"@ai16z/plugin-starknet": "workspace:*",
"@ai16z/plugin-ton": "workspace:*",
"@ai16z/plugin-sui": "workspace:*",
"@ai16z/plugin-tee": "workspace:*",
"@elizaos/adapter-postgres": "workspace:*",
"@elizaos/adapter-redis": "workspace:*",
"@elizaos/adapter-sqlite": "workspace:*",
"@elizaos/client-auto": "workspace:*",
"@elizaos/client-direct": "workspace:*",
"@elizaos/client-discord": "workspace:*",
"@elizaos/client-farcaster": "workspace:*",
"@elizaos/client-lens": "workspace:*",
"@elizaos/client-telegram": "workspace:*",
"@elizaos/client-twitter": "workspace:*",
"@elizaos/client-slack": "workspace:*",
"@elizaos/core": "workspace:*",
"@elizaos/plugin-0g": "workspace:*",
"@elizaos/plugin-abstract": "workspace:*",
"@elizaos/plugin-aptos": "workspace:*",
"@elizaos/plugin-bootstrap": "workspace:*",
"@elizaos/plugin-intiface": "workspace:*",
"@elizaos/plugin-coinbase": "workspace:*",
"@elizaos/plugin-conflux": "workspace:*",
"@elizaos/plugin-evm": "workspace:*",
"@elizaos/plugin-flow": "workspace:*",
"@elizaos/plugin-story": "workspace:*",
"@elizaos/plugin-goat": "workspace:*",
"@elizaos/plugin-icp": "workspace:*",
"@elizaos/plugin-image-generation": "workspace:*",
"@elizaos/plugin-nft-generation": "workspace:*",
"@elizaos/plugin-node": "workspace:*",
"@elizaos/plugin-solana": "workspace:*",
"@elizaos/plugin-starknet": "workspace:*",
"@ai16z/plugin-thirdweb": "workspace:*",
"@ai16z/plugin-multiversx": "workspace:*",
"@ai16z/plugin-near": "workspace:*",
"@ai16z/plugin-zksync-era": "workspace:*",
"@elizaos/plugin-ton": "workspace:*",
"@elizaos/plugin-sui": "workspace:*",
"@elizaos/plugin-tee": "workspace:*",
"@elizaos/plugin-multiversx": "workspace:*",
"@elizaos/plugin-near": "workspace:*",
"@elizaos/plugin-zksync-era": "workspace:*",
"readline": "1.3.0",
"ws": "8.18.0",
"yargs": "17.7.2"
Expand Down
63 changes: 19 additions & 44 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,23 @@ import {
tokenContractPlugin,
tradePlugin,
webhookPlugin,
} from "@ai16z/plugin-coinbase";
import { confluxPlugin } from "@ai16z/plugin-conflux";
import { evmPlugin } from "@ai16z/plugin-evm";
import { storyPlugin } from "@ai16z/plugin-story";
import { flowPlugin } from "@ai16z/plugin-flow";
import { imageGenerationPlugin } from "@ai16z/plugin-image-generation";
import { multiversxPlugin } from "@ai16z/plugin-multiversx";
import { nearPlugin } from "@ai16z/plugin-near";
import { nftGenerationPlugin } from "@ai16z/plugin-nft-generation";
import { createNodePlugin } from "@ai16z/plugin-node";
import { solanaPlugin } from "@ai16z/plugin-solana";
import { suiPlugin } from "@ai16z/plugin-sui";
import { TEEMode, teePlugin } from "@ai16z/plugin-tee";
import { tonPlugin } from "@ai16z/plugin-ton";
} from "@elizaos/plugin-coinbase";
import { confluxPlugin } from "@elizaos/plugin-conflux";
import { evmPlugin } from "@elizaos/plugin-evm";
import { storyPlugin } from "@elizaos/plugin-story";
import { flowPlugin } from "@elizaos/plugin-flow";
import { imageGenerationPlugin } from "@elizaos/plugin-image-generation";
import { multiversxPlugin } from "@elizaos/plugin-multiversx";
import { nearPlugin } from "@elizaos/plugin-near";
import { nftGenerationPlugin } from "@elizaos/plugin-nft-generation";
import { createNodePlugin } from "@elizaos/plugin-node";
import { solanaPlugin } from "@elizaos/plugin-solana";
import { suiPlugin } from "@elizaos/plugin-sui";
import { TEEMode, teePlugin } from "@elizaos/plugin-tee";
import { tonPlugin } from "@elizaos/plugin-ton";
import { zksyncEraPlugin } from "@elizaos/plugin-zksync-era";
import { abstractPlugin } from "@elizaos/plugin-abstract";
import { thirdwebPlugin } from "@ai16z/plugin-thirdweb";
import { zksyncEraPlugin } from "@ai16z/plugin-zksync-era";
import Database from "better-sqlite3";
import fs from "fs";
import path from "path";
Expand Down Expand Up @@ -387,12 +388,8 @@ export async function initializeClients(

if (clientTypes.includes(Clients.TWITTER)) {
const twitterClient = await TwitterClientInterface.start(runtime);

if (twitterClient) {
clients.twitter = twitterClient;
(twitterClient as any).enableSearch = !isFalsish(
getSecret(character, "TWITTER_SEARCH_ENABLE")
);
}
}

Expand Down Expand Up @@ -434,31 +431,6 @@ export async function initializeClients(
return clients;
}

function isFalsish(input: any): boolean {
// If the input is exactly NaN, return true
if (Number.isNaN(input)) {
return true;
}

// Convert input to a string if it's not null or undefined
const value = input == null ? "" : String(input);

// List of common falsish string representations
const falsishValues = [
"false",
"0",
"no",
"n",
"off",
"null",
"undefined",
"",
];

// Check if the value (trimmed and lowercased) is in the falsish list
return falsishValues.includes(value.trim().toLowerCase());
}

function getSecret(character: Character, secret: string) {
return character.settings?.secrets?.[secret] || process.env[secret];
}
Expand Down Expand Up @@ -563,6 +535,9 @@ export async function createAgent(
? webhookPlugin
: null,
getSecret(character, "EVM_PROVIDER_URL") ? goatPlugin : null,
getSecret(character, "ABSTRACT_PRIVATE_KEY")
? abstractPlugin
: null,
getSecret(character, "FLOW_ADDRESS") &&
getSecret(character, "FLOW_PRIVATE_KEY")
? flowPlugin
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/advanced/eliza-in-tee.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const quote = await provider.generateAttestation(reportData);
Before getting started with Eliza, ensure you have:

- [Docker Desktop](https://www.docker.com/products/docker-desktop/) or [Orbstack](https://orbstack.dev/) (Orbstack is recommended)
- For Mac/Windows: Check the prerequisites from [Quickstart Guide](./quickstart.md)
- For Mac/Windows: Check the prerequisites from [Quickstart Guide](../quickstart.md)
- For Linux: You just need Docker

---
Expand Down Expand Up @@ -144,7 +144,7 @@ To set up your environment for TEE development:
1. **Configure Eliza Agent**
Go through the [configuration guide](./configuration.md) to set up your Eliza agent.
Go through the [configuration guide](../guides/configuration.md) to set up your Eliza agent.
2. **Start the TEE Simulator**
Follow the simulator setup instructions above based on your TEE mode.
Expand Down
5 changes: 4 additions & 1 deletion packages/client-twitter/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ export const TwitterClientInterface: Client = {

elizaLogger.log("Twitter client started");

const manager = new TwitterManager(runtime, this.enableSearch);
const manager = new TwitterManager(runtime, runtime.getSetting("TWITTER_SEARCH_ENABLE").toLowerCase() === "true");

await manager.client.init();

await manager.post.start();

if (manager.search)
await manager.search.start();

await manager.interaction.start();

await manager.search?.start();
Expand Down
8 changes: 5 additions & 3 deletions packages/client-twitter/src/search.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SearchMode } from "agent-twitter-client";
import { composeContext } from "@elizaos/core";
import {composeContext, elizaLogger} from "@elizaos/core";
import { generateMessageResponse, generateText } from "@elizaos/core";
import { messageCompletionFooter } from "@elizaos/core";
import {
Expand Down Expand Up @@ -59,10 +59,12 @@ export class TwitterSearchClient {
}

private engageWithSearchTermsLoop() {
this.engageWithSearchTerms();
this.engageWithSearchTerms().then();
const randomMinutes = (Math.floor(Math.random() * (120 - 60 + 1)) + 60);
elizaLogger.log(`Next twitter search scheduled in ${randomMinutes} minutes`);
setTimeout(
() => this.engageWithSearchTermsLoop(),
(Math.floor(Math.random() * (120 - 60 + 1)) + 60) * 60 * 1000
randomMinutes * 60 * 1000
);
}

Expand Down
19 changes: 19 additions & 0 deletions packages/plugin-abstract/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "@elizaos/plugin-abstract",
"version": "0.1.7-alpha.1",
"main": "dist/index.js",
"type": "module",
"types": "dist/index.d.ts",
"dependencies": {
"@elizaos/core": "workspace:*",
"tsup": "^8.3.5",
"web3": "^4.15.0",
"viem": "2.21.53"
},
"scripts": {
"build": "tsup --format esm --dts"
},
"peerDependencies": {
"whatwg-url": "7.1.0"
}
}
Loading

0 comments on commit 14f870f

Please sign in to comment.