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

fix: Fix buttplug.io integration and merge #612

Merged
merged 9 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -91,6 +91,9 @@ STARKNET_ADDRESS=
STARKNET_PRIVATE_KEY=
STARKNET_RPC_URL=

# Intiface Configuration
INTIFACE_WEBSOCKET_URL=ws://localhost:12345


# Farcaster
FARCASTER_HUB_URL=
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ node_modules
.env.production
concatenated-output.ts
embedding-cache.json
packages/plugin-buttplug/intiface-engine

.DS_Store

Expand Down
1 change: 1 addition & 0 deletions agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@ai16z/eliza": "workspace:*",
"@ai16z/plugin-bootstrap": "workspace:*",
"@ai16z/plugin-conflux": "workspace:*",
"@ai16z/plugin-buttplug": "workspace:*",
"@ai16z/plugin-image-generation": "workspace:*",
"@ai16z/plugin-node": "workspace:*",
"@ai16z/plugin-solana": "workspace:*",
Expand Down
402 changes: 0 additions & 402 deletions agent/src/character.ts

This file was deleted.

37 changes: 20 additions & 17 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,43 +1,45 @@
import { PostgresDatabaseAdapter } from "@ai16z/adapter-postgres";
import { SqliteDatabaseAdapter } from "@ai16z/adapter-sqlite";
import { AutoClientInterface } from "@ai16z/client-auto";
import { DirectClientInterface } from "@ai16z/client-direct";
import { DiscordClientInterface } from "@ai16z/client-discord";
import { AutoClientInterface } from "@ai16z/client-auto";
import { TelegramClientInterface } from "@ai16z/client-telegram";
import { TwitterClientInterface } from "@ai16z/client-twitter";
import {
DbCacheAdapter,
defaultCharacter,
FsCacheAdapter,
ICacheManager,
IDatabaseCacheAdapter,
stringToUuid,
AgentRuntime,
CacheManager,
Character,
DbCacheAdapter,
FsCacheAdapter,
IAgentRuntime,
ICacheManager,
IDatabaseAdapter,
IDatabaseCacheAdapter,
ModelProviderName,
defaultCharacter,
elizaLogger,
settings,
IDatabaseAdapter,
stringToUuid,
validateCharacterConfig,
} from "@ai16z/eliza";
import { bootstrapPlugin } from "@ai16z/plugin-bootstrap";
import { confluxPlugin } from "@ai16z/plugin-conflux";
import { solanaPlugin } from "@ai16z/plugin-solana";
import { zgPlugin } from "@ai16z/plugin-0g";
import { type NodePlugin, createNodePlugin } from "@ai16z/plugin-node";
import { bootstrapPlugin } from "@ai16z/plugin-bootstrap";
import { buttplugPlugin } from "@ai16z/plugin-buttplug";
import {
coinbaseCommercePlugin,
coinbaseMassPaymentsPlugin,
} from "@ai16z/plugin-coinbase";
import { confluxPlugin } from "@ai16z/plugin-conflux";
import {
createNodePlugin,
} from "@ai16z/plugin-node";
import { solanaPlugin } from "@ai16z/plugin-solana";
import Database from "better-sqlite3";
import fs from "fs";
import readline from "readline";
import yargs from "yargs";
import path from "path";
import readline from "readline";
import { fileURLToPath } from "url";
import { character } from "./character.ts";
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 @@ -238,7 +240,7 @@ function getSecret(character: Character, secret: string) {
return character.settings.secrets?.[secret] || process.env[secret];
}

let nodePlugin: NodePlugin | undefined;
let nodePlugin: any | undefined;

export function createAgent(
character: Character,
Expand Down Expand Up @@ -275,6 +277,7 @@ export function createAgent(
getSecret(character, "COINBASE_PRIVATE_KEY")
? coinbaseMassPaymentsPlugin
: null,
getSecret(character, "BUTTPLUG_API_KEY") ? buttplugPlugin : null,
].filter(Boolean),
providers: [],
actions: [],
Expand Down Expand Up @@ -338,7 +341,7 @@ const startAgents = async () => {

let charactersArg = args.characters || args.character;

let characters = [character];
let characters = [defaultCharacter];

if (charactersArg) {
characters = await loadCharacters(charactersArg);
Expand Down
91 changes: 91 additions & 0 deletions docs/api/interfaces/IButtplugService.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
[@ai16z/eliza v1.0.0](../index.md) / IButtplugService

# Interface: IButtplugService

## Extends

- [`Service`](../classes/Service.md)

## Methods

### vibrate()

> **vibrate**(`strength`, `duration`): `Promise`\<`void`\>

#### Parameters

• **strength**: `number`

• **duration**: `number`

#### Returns

`Promise`\<`void`\>

#### Defined in

[packages/plugin-buttplug/src/index.ts:14](https://github.com/ai16z/eliza/blob/main/packages/plugin-buttplug/src/index.ts#L14)

---

### rotate()

> **rotate**(`strength`, `duration`): `Promise`\<`void`\>

#### Parameters

• **strength**: `number`

• **duration**: `number`

#### Returns

`Promise`\<`void`\>

#### Defined in

[packages/plugin-buttplug/src/index.ts:15](https://github.com/ai16z/eliza/blob/main/packages/plugin-buttplug/src/index.ts#L15)

---

---

### getBatteryLevel()

> **getBatteryLevel**(): `Promise`\<`number`\>

#### Returns

`Promise`\<`number`\>

#### Defined in

[packages/plugin-buttplug/src/index.ts:17](https://github.com/ai16z/eliza/blob/main/packages/plugin-buttplug/src/index.ts#L17)

---

### isConnected()

> **isConnected**(): `boolean`

#### Returns

`boolean`

#### Defined in

[packages/plugin-buttplug/src/index.ts:15](https://github.com/ai16z/eliza/blob/main/packages/plugin-buttplug/src/index.ts#L15)

---

### getDevices()

> **getDevices**(): `any`[]

#### Returns

`any`[]

#### Defined in

[packages/plugin-buttplug/src/index.ts:16](https://github.com/ai16z/eliza/blob/main/packages/plugin-buttplug/src/index.ts#L16)
18 changes: 16 additions & 2 deletions docs/docs/packages/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,20 @@ Integrates Solana blockchain functionality:
- `walletProvider` - Wallet management
- `trustScoreProvider` - Transaction trust metrics

#### 5. Buttplug Plugin (`@eliza/plugin-buttplug`)

Integrates Buttplug.io for intimate toy control:

**Services:**

- `ButtplugService` - Buttplug.io integration itself

**Actions:**

- `VIBRATE` - Control vibration intensity and duration of connected devices
- `ROTATE` - Control rotation intensity and duration of connected devices
- `BATTERY` - Get the battery level of connected devices

## Using Plugins

### Installation
Expand All @@ -99,10 +113,10 @@ pnpm add @eliza/plugin-[name]
```typescript
import { bootstrapPlugin } from "@eliza/plugin-bootstrap";
import { imageGenerationPlugin } from "@eliza/plugin-image-generation";

import { buttplugPlugin } from "@eliza/plugin-buttplug";
const character = {
// ... other character config
plugins: [bootstrapPlugin, imageGenerationPlugin],
plugins: [bootstrapPlugin, imageGenerationPlugin, buttplugPlugin],
};
```

Expand Down
Loading
Loading