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: add coinbase plugin starting with cb commerce functionality #513

Merged
merged 38 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
f60c536
Implement Coinbase Commerce Provider
monilpat Nov 20, 2024
eed9bce
add plugin to readme
monilpat Nov 21, 2024
e98b8a5
Testing Coinbase Plugin
monilpat Nov 21, 2024
8f975ab
test: add linter to all packages and enable vitest
snobbee Nov 21, 2024
6d65551
Build plugin
monilpat Nov 22, 2024
90f5676
wrap in try to allow non node env to build
antpb Nov 22, 2024
73a4bfd
consistent error
antpb Nov 22, 2024
a0c2bb8
fix other eliza error
antpb Nov 22, 2024
b856146
docs: add template and client configuration guide
oguzserdar Nov 22, 2024
26fab78
Integrate coinbase plugin and test and get it working
monilpat Nov 22, 2024
d33edac
Remove unnecessary console.logs
monilpat Nov 22, 2024
f2dde70
Merge pull request #510 from oguzserdar/main
jkbrooks Nov 22, 2024
10aa5d6
Merge pull request #508 from antpb/fix/gracefully-pull-node-dep
jkbrooks Nov 22, 2024
b763a62
add precommit
ponderingdemocritus Nov 22, 2024
421fe0b
husky
ponderingdemocritus Nov 22, 2024
9e9836b
prettier
ponderingdemocritus Nov 22, 2024
37f1c33
feat: husky
ponderingdemocritus Nov 22, 2024
bb643af
feat: commit
ponderingdemocritus Nov 22, 2024
de3f5af
feat: style
ponderingdemocritus Nov 22, 2024
c5177f6
fix: ecogarden type
ponderingdemocritus Nov 22, 2024
02b5145
Merge pull request #514 from ai16z/feat/pre-commit
ponderingdemocritus Nov 22, 2024
8d32603
fix: lint
ponderingdemocritus Nov 22, 2024
e31e666
Merge pull request #515 from ai16z/fix/trim
ponderingdemocritus Nov 22, 2024
83ec1de
Merge branch 'main' into test/add-linter-to-all-packages
snobbee Nov 22, 2024
2335a92
Create SECURITY.md
awidearray Nov 22, 2024
62ef92a
fix: typo
snobbee Nov 22, 2024
79bdabb
test: fix linter errors and add linter to pre-commit hook
snobbee Nov 22, 2024
502d386
fix: lint
snobbee Nov 22, 2024
cf06999
ci: add linter to ci workflow
snobbee Nov 22, 2024
6e05c0f
Merge pull request #490 from snobbee/test/add-linter-to-all-packages
ponderingdemocritus Nov 22, 2024
8e5658a
Implement Coinbase Commerce Provider
monilpat Nov 20, 2024
0b4e85d
add plugin to readme
monilpat Nov 21, 2024
60bdca3
Testing Coinbase Plugin
monilpat Nov 21, 2024
e96e0cc
Build plugin
monilpat Nov 22, 2024
7ef4502
Integrate coinbase plugin and test and get it working
monilpat Nov 22, 2024
4d383c2
Remove unnecessary console.logs
monilpat Nov 22, 2024
932ba8b
chore: merge conflicts
monilpat Nov 22, 2024
d4835c5
Update package.json
monilpat Nov 22, 2024
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
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,6 @@ SERVER_PORT=3000
# Starknet
STARKNET_ADDRESS=
STARKNET_PRIVATE_KEY=

# Coinbase Commerce
COINBASE_COMMERCE_KEY=
1 change: 1 addition & 0 deletions agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@ai16z/plugin-node": "workspace:*",
"@ai16z/plugin-solana": "workspace:*",
"@ai16z/plugin-starknet": "workspace:*",
"@ai16z/plugin-coinbase": "workspace:*",
"readline": "^1.3.0",
"ws": "^8.18.0",
"yargs": "17.7.2"
Expand Down
5 changes: 5 additions & 0 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
import { bootstrapPlugin } from "@ai16z/plugin-bootstrap";
import { solanaPlugin } from "@ai16z/plugin-solana";
import { nodePlugin } from "@ai16z/plugin-node";
import { coinbaseCommercePlugin } from "@ai16z/plugin-coinbase";
import Database from "better-sqlite3";
import fs from "fs";
import readline from "readline";
Expand Down Expand Up @@ -228,6 +229,10 @@ export async function createAgent(
bootstrapPlugin,
nodePlugin,
character.settings.secrets?.WALLET_PUBLIC_KEY ? solanaPlugin : null,
character.settings.secrets?.COINBASE_COMMERCE_KEY ||
process.env.COINBASE_COMMERCE_KEY
? coinbaseCommercePlugin
: null,
].filter(Boolean),
providers: [],
actions: [],
Expand Down
105 changes: 105 additions & 0 deletions docs/docs/packages/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,111 @@ const character = {
};
```

Here is the updated README with the Coinbase Commerce plugin information added:

---

# 🧩 Plugins

## Overview

Eliza's plugin system provides a modular way to extend the core functionality with additional features, actions, evaluators, and providers. Plugins are self-contained modules that can be easily added or removed to customize your agent's capabilities.

## Core Plugin Concepts

### Plugin Structure

Each plugin in Eliza must implement the `Plugin` interface with the following properties:

```typescript
interface Plugin {
name: string; // Unique identifier for the plugin
description: string; // Brief description of plugin functionality
actions?: Action[]; // Custom actions provided by the plugin
evaluators?: Evaluator[]; // Custom evaluators for behavior assessment
providers?: Provider[]; // Context providers for message generation
services?: Service[]; // Additional services (optional)
}
```

### Available Plugins

#### 1. Bootstrap Plugin (`@eliza/plugin-bootstrap`)

The bootstrap plugin provides essential baseline functionality:

**Actions:**

- `continue` - Continue the current conversation flow
- `followRoom` - Follow a room for updates
- `unfollowRoom` - Unfollow a room
- `ignore` - Ignore specific messages
- `muteRoom` - Mute notifications from a room
- `unmuteRoom` - Unmute notifications from a room

**Evaluators:**

- `fact` - Evaluate factual accuracy
- `goal` - Assess goal completion

**Providers:**

- `boredom` - Manages engagement levels
- `time` - Provides temporal context
- `facts` - Supplies factual information

#### 2. Image Generation Plugin (`@eliza/plugin-image-generation`)

Enables AI image generation capabilities:

**Actions:**

- `GENERATE_IMAGE` - Create images based on text descriptions
- Supports multiple image generation services (Anthropic, Together)
- Auto-generates captions for created images

#### 3. Node Plugin (`@eliza/plugin-node`)

Provides core Node.js-based services:

**Services:**

- `BrowserService` - Web browsing capabilities
- `ImageDescriptionService` - Image analysis
- `LlamaService` - LLM integration
- `PdfService` - PDF processing
- `SpeechService` - Text-to-speech
- `TranscriptionService` - Speech-to-text
- `VideoService` - Video processing

#### 4. Solana Plugin (`@eliza/plugin-solana`)

Integrates Solana blockchain functionality:

**Evaluators:**

- `trustEvaluator` - Assess transaction trust scores

**Providers:**

- `walletProvider` - Wallet management
- `trustScoreProvider` - Transaction trust metrics

#### 5. Coinbase Commerce Plugin (`@eliza/plugin-coinbase-commerce`)

Integrates Coinbase Commerce for payment and transaction management:

**Actions:**

- `CREATE_CHARGE` - Create a payment charge using Coinbase Commerce
- `GET_ALL_CHARGES` - Fetch all payment charges
- `GET_CHARGE_DETAILS` - Retrieve details for a specific charge

**Description:**
This plugin enables Eliza to interact with the Coinbase Commerce API to create and manage payment charges, providing seamless integration with cryptocurrency-based payment systems.

---

### Writing Custom Plugins

Create a new plugin by implementing the Plugin interface:
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "eliza",
"type": "module",
"scripts": {
"preinstall": "npx only-allow pnpm",
"build": "bash ./scripts/build.sh",
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/generation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,9 @@ export const generateObjectV2 = async ({

const provider = runtime.modelProvider;
const model = models[provider].model[modelClass];
if (!model) {
throw new Error(`Unsupported model class: ${modelClass}`);
}
const temperature = models[provider].settings.temperature;
const frequency_penalty = models[provider].settings.frequency_penalty;
const presence_penalty = models[provider].settings.presence_penalty;
Expand All @@ -933,7 +936,7 @@ export const generateObjectV2 = async ({
const apiKey = runtime.token;

try {
context = await trimTokens(context, max_context_length, modelClass);
context = await trimTokens(context, max_context_length, "gpt-4o");
monilpat marked this conversation as resolved.
Show resolved Hide resolved

const modelOptions: ModelSettings = {
prompt: context,
Expand Down
6 changes: 6 additions & 0 deletions packages/plugin-coinbase/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*

!dist/**
!package.json
!readme.md
!tsup.config.ts
Loading