Skip to content

Commit 7c83578

Browse files
committed
Merge branch 'main' of https://github.com/8times4/eliza into HEAD
2 parents 1670600 + 60da90b commit 7c83578

21 files changed

+1520
-33593
lines changed

.env.example

+3
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ STARKNET_ADDRESS=
9191
STARKNET_PRIVATE_KEY=
9292
STARKNET_RPC_URL=
9393

94+
# Intiface Configuration
95+
INTIFACE_WEBSOCKET_URL=ws://localhost:12345
96+
9497

9598
# Farcaster
9699
FARCASTER_HUB_URL=

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ node_modules
55
.env.production
66
concatenated-output.ts
77
embedding-cache.json
8+
packages/plugin-buttplug/intiface-engine
89

910
.DS_Store
1011

agent/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"@ai16z/eliza": "workspace:*",
2323
"@ai16z/plugin-bootstrap": "workspace:*",
2424
"@ai16z/plugin-conflux": "workspace:*",
25+
"@ai16z/plugin-buttplug": "workspace:*",
2526
"@ai16z/plugin-image-generation": "workspace:*",
2627
"@ai16z/plugin-node": "workspace:*",
2728
"@ai16z/plugin-solana": "workspace:*",

agent/src/character.ts

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const character: Character = {
88
// modelProvider: ModelProviderName.OPENAI,
99
// settings: {
1010
// secrets: {},
11+
// buttplug: true,
1112
// voice: {
1213
// model: "en_US-hfc_female-medium",
1314
// },

agent/src/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@ import { bootstrapPlugin } from "@ai16z/plugin-bootstrap";
2626
import { confluxPlugin } from "@ai16z/plugin-conflux";
2727
import { solanaPlugin } from "@ai16z/plugin-solana";
2828
import { zgPlugin } from "@ai16z/plugin-0g";
29-
import { type NodePlugin, createNodePlugin } from "@ai16z/plugin-node";
29+
import { nodePlugin, type NodePlugin, createNodePlugin } from "@ai16z/plugin-node";
3030
import {
3131
coinbaseCommercePlugin,
3232
coinbaseMassPaymentsPlugin,
3333
} from "@ai16z/plugin-coinbase";
34+
import { buttplugPlugin } from "@ai16z/plugin-buttplug";
3435
import Database from "better-sqlite3";
3536
import fs from "fs";
3637
import readline from "readline";
@@ -275,6 +276,7 @@ export function createAgent(
275276
getSecret(character, "COINBASE_PRIVATE_KEY")
276277
? coinbaseMassPaymentsPlugin
277278
: null,
279+
getSecret(character, "BUTTPLUG_API_KEY") ? buttplugPlugin : null,
278280
].filter(Boolean),
279281
providers: [],
280282
actions: [],
+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
[@ai16z/eliza v1.0.0](../index.md) / IButtplugService
2+
3+
# Interface: IButtplugService
4+
5+
## Extends
6+
7+
- [`Service`](../classes/Service.md)
8+
9+
## Methods
10+
11+
### vibrate()
12+
13+
> **vibrate**(`strength`, `duration`): `Promise`\<`void`\>
14+
15+
#### Parameters
16+
17+
**strength**: `number`
18+
19+
**duration**: `number`
20+
21+
#### Returns
22+
23+
`Promise`\<`void`\>
24+
25+
#### Defined in
26+
27+
[packages/plugin-buttplug/src/index.ts:14](https://github.com/ai16z/eliza/blob/main/packages/plugin-buttplug/src/index.ts#L14)
28+
29+
---
30+
31+
### rotate()
32+
33+
> **rotate**(`strength`, `duration`): `Promise`\<`void`\>
34+
35+
#### Parameters
36+
37+
**strength**: `number`
38+
39+
**duration**: `number`
40+
41+
#### Returns
42+
43+
`Promise`\<`void`\>
44+
45+
#### Defined in
46+
47+
[packages/plugin-buttplug/src/index.ts:15](https://github.com/ai16z/eliza/blob/main/packages/plugin-buttplug/src/index.ts#L15)
48+
49+
---
50+
51+
---
52+
53+
### getBatteryLevel()
54+
55+
> **getBatteryLevel**(): `Promise`\<`number`\>
56+
57+
#### Returns
58+
59+
`Promise`\<`number`\>
60+
61+
#### Defined in
62+
63+
[packages/plugin-buttplug/src/index.ts:17](https://github.com/ai16z/eliza/blob/main/packages/plugin-buttplug/src/index.ts#L17)
64+
65+
---
66+
67+
### isConnected()
68+
69+
> **isConnected**(): `boolean`
70+
71+
#### Returns
72+
73+
`boolean`
74+
75+
#### Defined in
76+
77+
[packages/plugin-buttplug/src/index.ts:15](https://github.com/ai16z/eliza/blob/main/packages/plugin-buttplug/src/index.ts#L15)
78+
79+
---
80+
81+
### getDevices()
82+
83+
> **getDevices**(): `any`[]
84+
85+
#### Returns
86+
87+
`any`[]
88+
89+
#### Defined in
90+
91+
[packages/plugin-buttplug/src/index.ts:16](https://github.com/ai16z/eliza/blob/main/packages/plugin-buttplug/src/index.ts#L16)

docs/docs/packages/plugins.md

+16-2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,20 @@ Integrates Solana blockchain functionality:
8484
- `walletProvider` - Wallet management
8585
- `trustScoreProvider` - Transaction trust metrics
8686

87+
#### 5. Buttplug Plugin (`@eliza/plugin-buttplug`)
88+
89+
Integrates Buttplug.io for intimate toy control:
90+
91+
**Services:**
92+
93+
- `ButtplugService` - Buttplug.io integration itself
94+
95+
**Actions:**
96+
97+
- `VIBRATE` - Control vibration intensity and duration of connected devices
98+
- `ROTATE` - Control rotation intensity and duration of connected devices
99+
- `BATTERY` - Get the battery level of connected devices
100+
87101
## Using Plugins
88102

89103
### Installation
@@ -99,10 +113,10 @@ pnpm add @eliza/plugin-[name]
99113
```typescript
100114
import { bootstrapPlugin } from "@eliza/plugin-bootstrap";
101115
import { imageGenerationPlugin } from "@eliza/plugin-image-generation";
102-
116+
import { buttplugPlugin } from "@eliza/plugin-buttplug";
103117
const character = {
104118
// ... other character config
105-
plugins: [bootstrapPlugin, imageGenerationPlugin],
119+
plugins: [bootstrapPlugin, imageGenerationPlugin, buttplugPlugin],
106120
};
107121
```
108122

packages/core/src/types.ts

+2
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,7 @@ export type Character = {
666666
/** Optional configuration */
667667
settings?: {
668668
secrets?: { [key: string]: string };
669+
buttplug?: boolean;
669670
voice?: {
670671
model?: string;
671672
url?: string;
@@ -1092,6 +1093,7 @@ export enum ServiceType {
10921093
BROWSER = "browser",
10931094
SPEECH_GENERATION = "speech_generation",
10941095
PDF = "pdf",
1096+
BUTTPLUG = "buttplug",
10951097
}
10961098

10971099
export enum LoggingLevel {

packages/plugin-buttplug/.npmignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*
2+
3+
!dist/**
4+
!package.json
5+
!readme.md
6+
!tsup.config.ts

packages/plugin-buttplug/package.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "@ai16z/plugin-buttplug",
3+
"version": "0.1.4-alpha.3",
4+
"main": "dist/index.js",
5+
"type": "module",
6+
"types": "dist/index.d.ts",
7+
"dependencies": {
8+
"@ai16z/eliza": "workspace:*",
9+
"tsup": "^8.3.5",
10+
"buttplug": "^3.2.2",
11+
"net": "^1.0.2"
12+
},
13+
"scripts": {
14+
"build": "tsup --format esm --dts",
15+
"test-via-bun": "bun test/simulate.ts"
16+
},
17+
"peerDependencies": {
18+
"whatwg-url": "7.1.0"
19+
}
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": {
3+
"major": 2,
4+
"minor": 6
5+
},
6+
"user-configs": {
7+
"specifiers": {
8+
"lovense": {
9+
"websocket": {
10+
"names": ["LVSDevice"]
11+
}
12+
},
13+
"tcode-v03": {
14+
"websocket": {
15+
"names": ["TCodeDevice"]
16+
}
17+
}
18+
}
19+
}
20+
}
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { IAgentRuntime } from "@ai16z/eliza";
2+
import { z } from "zod";
3+
4+
export const buttplugEnvSchema = z
5+
.object({
6+
INTIFACE_URL: z.string().default("ws://localhost:12345"),
7+
INTIFACE_NAME: z.string().default("Eliza Buttplug Client"),
8+
DEVICE_NAME: z.string().default("Lovense Nora"),
9+
})
10+
.refine(
11+
(data) => {
12+
return (
13+
data.INTIFACE_URL.startsWith("ws://") ||
14+
data.INTIFACE_URL.startsWith("wss://")
15+
);
16+
},
17+
{
18+
message:
19+
"INTIFACE_URL must be a valid WebSocket URL (ws:// or wss://)",
20+
}
21+
);
22+
23+
export type ButtplugConfig = z.infer<typeof buttplugEnvSchema>;
24+
25+
export async function validateButtplugConfig(
26+
runtime: IAgentRuntime
27+
): Promise<ButtplugConfig> {
28+
try {
29+
const config = {
30+
INTIFACE_URL:
31+
runtime.getSetting("INTIFACE_URL") || process.env.INTIFACE_URL,
32+
INTIFACE_NAME:
33+
runtime.getSetting("INTIFACE_NAME") ||
34+
process.env.INTIFACE_NAME,
35+
DEVICE_NAME:
36+
runtime.getSetting("DEVICE_NAME") || process.env.DEVICE_NAME,
37+
};
38+
39+
return buttplugEnvSchema.parse(config);
40+
} catch (error) {
41+
if (error instanceof z.ZodError) {
42+
const errorMessages = error.errors
43+
.map((err) => `${err.path.join(".")}: ${err.message}`)
44+
.join("\n");
45+
throw new Error(
46+
`Buttplug configuration validation failed:\n${errorMessages}`
47+
);
48+
}
49+
throw error;
50+
}
51+
}

0 commit comments

Comments
 (0)