Skip to content

Commit

Permalink
Add tipping plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
dayksx committed Jan 17, 2025
1 parent 184cfe5 commit 313850c
Show file tree
Hide file tree
Showing 20 changed files with 1,852 additions and 380 deletions.
3 changes: 2 additions & 1 deletion agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"@elizaos/plugin-quai": "workspace:*",
"@elizaos/plugin-b2": "workspace:*",
"@elizaos/plugin-nft-collections": "workspace:*",
"@elizaos/plugin-tipping": "workspace:*",
"readline": "1.3.0",
"ws": "8.18.0",
"yargs": "17.7.2"
Expand All @@ -111,4 +112,4 @@
"ts-node": "10.9.2",
"tsup": "8.3.5"
}
}
}
15 changes: 7 additions & 8 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ import { tonPlugin } from "@elizaos/plugin-ton";
import { webSearchPlugin } from "@elizaos/plugin-web-search";
import { echoChambersPlugin } from "@elizaos/plugin-echochambers";
import { dexScreenerPlugin } from "@elizaos/plugin-dexscreener";

import { tippingPlugin } from "@elizaos/plugin-tipping";
import { zksyncEraPlugin } from "@elizaos/plugin-zksync-era";
import Database from "better-sqlite3";
import fs from "fs";
Expand All @@ -110,7 +110,6 @@ import path from "path";
import { fileURLToPath } from "url";
import yargs from "yargs";


const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file
const __dirname = path.dirname(__filename); // get the name of the directory

Expand Down Expand Up @@ -246,14 +245,13 @@ async function loadCharacter(filePath: string): Promise<Character> {
}

function commaSeparatedStringToArray(commaSeparated: string): string[] {
return commaSeparated?.split(",").map(value => value.trim())
return commaSeparated?.split(",").map((value) => value.trim());
}


export async function loadCharacters(
charactersArg: string
): Promise<Character[]> {
let characterPaths = commaSeparatedStringToArray(charactersArg)
let characterPaths = commaSeparatedStringToArray(charactersArg);
const loadedCharacters: Character[] = [];

if (characterPaths?.length > 0) {
Expand Down Expand Up @@ -327,7 +325,9 @@ export async function loadCharacters(

if (hasValidRemoteUrls()) {
elizaLogger.info("Loading characters from remote URLs");
let characterUrls = commaSeparatedStringToArray(process.env.REMOTE_CHARACTER_URLS)
let characterUrls = commaSeparatedStringToArray(
process.env.REMOTE_CHARACTER_URLS
);
for (const characterUrl of characterUrls) {
const character = await loadCharacterFromUrl(characterUrl);
loadedCharacters.push(character);
Expand Down Expand Up @@ -940,6 +940,7 @@ export async function createAgent(
getSecret(character, "RESERVOIR_API_KEY")
? createNFTCollectionsPlugin()
: null,
tippingPlugin,
].filter(Boolean),
providers: [],
actions: [],
Expand Down Expand Up @@ -1101,13 +1102,11 @@ const checkPortAvailable = (port: number): Promise<boolean> => {
});
};


const hasValidRemoteUrls = () =>
process.env.REMOTE_CHARACTER_URLS &&
process.env.REMOTE_CHARACTER_URLS !== "" &&
process.env.REMOTE_CHARACTER_URLS.startsWith("http");


const startAgents = async () => {
const directClient = new DirectClient();
let serverPort = parseInt(settings.SERVER_PORT || "3000");
Expand Down
2 changes: 1 addition & 1 deletion client/src/lib/info.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version": "0.1.8+build.1"}
{"version": "0.1.9-alpha.1"}
6 changes: 6 additions & 0 deletions packages/plugin-tipping/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*

!dist/**
!package.json
!readme.md
!tsup.config.ts
160 changes: 160 additions & 0 deletions packages/plugin-tipping/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# @elizaos/plugin-bootstrap

A plugin providing core functionality and basic actions for ElizaOS agents.

## Description
The Bootstrap plugin enables fundamental agent behaviors including conversation management, room interactions, and fact tracking. It provides essential actions and evaluators that form the foundation of agent interactions.

## Installation

```bash
pnpm install @elizaos/plugin-bootstrap
```

## Features

### 1. Conversation Management
- NONE action for basic responses
- CONTINUE action for follow-ups
- IGNORE action for appropriate disengagement
- Built-in conversation flow control

### 2. Room Control
- Follow/Unfollow room functionality
- Mute/Unmute capabilities
- Automatic engagement level tracking
- Smart participation management

### 3. Fact Management
- Automatic fact extraction
- Categorization of claims
- Deduplication of known information
- Support for multiple fact types:
- Permanent facts
- Status updates
- Opinions
- Biographical information

### 4. Goal Tracking
- Track objective progress
- Update goal statuses
- Monitor completion states
- Automatic progress evaluation

## Providers

### 1. Boredom Provider
- Tracks engagement levels
- Provides status messages
- Monitors conversation quality
- Adjusts participation accordingly

### 2. Facts Provider
- Manages fact database
- Retrieves relevant information
- Formats fact summaries
- Maintains fact context

### 3. Time Provider
- Provides UTC timestamps
- Human-readable formatting
- Time-based operation support

## Development

1. Clone the repository
2. Install dependencies:
```bash
pnpm install
```

3. Build the plugin:
```bash
pnpm run build
```

4. Run linting:
```bash
pnpm run lint
```

## Dependencies
- @elizaos/core: workspace:*

## Future Enhancements

1. **Enhanced Conversation Management**
- Advanced context tracking
- Multi-thread conversation support
- Conversation state persistence
- Improved conversation flow control
- Natural language understanding improvements

2. **Advanced Room Control**
- Dynamic room creation and management
- Room permission system
- Advanced moderation tools
- Room analytics and insights
- Cross-room communication features

3. **Expanded Fact Management**
- Enhanced fact verification system
- Fact relationship mapping
- Automated fact updating
- Fact confidence scoring
- Cross-reference system
- Fact expiration management

4. **Goal System Improvements**
- Multi-step goal planning
- Goal dependency tracking
- Progress visualization
- Goal priority management
- Automated milestone tracking
- Goal optimization suggestions

5. **Provider Enhancements**
- Improved boredom detection
- Advanced engagement metrics
- Enhanced fact retrieval algorithms
- Real-time status updates
- Provider performance analytics

6. **Memory Management**
- Enhanced memory prioritization
- Memory compression techniques
- Long-term memory storage
- Memory relationship mapping
- Context-aware recall

7. **Developer Tools**
- Enhanced debugging capabilities
- Testing framework improvements
- Plugin development templates
- Documentation generator
- Performance profiling tools

8. **Integration Features**
- Enhanced plugin interoperability
- External service connectors
- API gateway integration
- Webhook system improvements
- Third-party platform support

We welcome community feedback and contributions to help prioritize these enhancements.

## Contributing

Contributions are welcome! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information.

## Credits

Special thanks to:
- The Eliza Core development team
- The Eliza community for their contributions and feedback


## License

This plugin is part of the Eliza project. See the main project repository for license information.

3 changes: 3 additions & 0 deletions packages/plugin-tipping/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];
33 changes: 33 additions & 0 deletions packages/plugin-tipping/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "@elizaos/plugin-tipping",
"version": "0.1.7",
"type": "module",
"main": "dist/index.js",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"import": {
"@elizaos/source": "./src/index.ts",
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
},
"files": [
"dist"
],
"dependencies": {
"@elizaos/core": "workspace:*",
"tsup": "8.3.5"
},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --format esm --dts --watch",
"lint": "eslint --fix --cache ."
},
"peerDependencies": {
"whatwg-url": "7.1.0"
}
}
1 change: 1 addition & 0 deletions packages/plugin-tipping/src/actions/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./tip.ts";
Loading

0 comments on commit 313850c

Please sign in to comment.