-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/8times4/eliza into HEAD
- Loading branch information
Showing
21 changed files
with
1,520 additions
and
33,593 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
* | ||
|
||
!dist/** | ||
!package.json | ||
!readme.md | ||
!tsup.config.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "@ai16z/plugin-buttplug", | ||
"version": "0.1.4-alpha.3", | ||
"main": "dist/index.js", | ||
"type": "module", | ||
"types": "dist/index.d.ts", | ||
"dependencies": { | ||
"@ai16z/eliza": "workspace:*", | ||
"tsup": "^8.3.5", | ||
"buttplug": "^3.2.2", | ||
"net": "^1.0.2" | ||
}, | ||
"scripts": { | ||
"build": "tsup --format esm --dts", | ||
"test-via-bun": "bun test/simulate.ts" | ||
}, | ||
"peerDependencies": { | ||
"whatwg-url": "7.1.0" | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
packages/plugin-buttplug/src/buttplug-user-device-config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"version": { | ||
"major": 2, | ||
"minor": 6 | ||
}, | ||
"user-configs": { | ||
"specifiers": { | ||
"lovense": { | ||
"websocket": { | ||
"names": ["LVSDevice"] | ||
} | ||
}, | ||
"tcode-v03": { | ||
"websocket": { | ||
"names": ["TCodeDevice"] | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { IAgentRuntime } from "@ai16z/eliza"; | ||
import { z } from "zod"; | ||
|
||
export const buttplugEnvSchema = z | ||
.object({ | ||
INTIFACE_URL: z.string().default("ws://localhost:12345"), | ||
INTIFACE_NAME: z.string().default("Eliza Buttplug Client"), | ||
DEVICE_NAME: z.string().default("Lovense Nora"), | ||
}) | ||
.refine( | ||
(data) => { | ||
return ( | ||
data.INTIFACE_URL.startsWith("ws://") || | ||
data.INTIFACE_URL.startsWith("wss://") | ||
); | ||
}, | ||
{ | ||
message: | ||
"INTIFACE_URL must be a valid WebSocket URL (ws:// or wss://)", | ||
} | ||
); | ||
|
||
export type ButtplugConfig = z.infer<typeof buttplugEnvSchema>; | ||
|
||
export async function validateButtplugConfig( | ||
runtime: IAgentRuntime | ||
): Promise<ButtplugConfig> { | ||
try { | ||
const config = { | ||
INTIFACE_URL: | ||
runtime.getSetting("INTIFACE_URL") || process.env.INTIFACE_URL, | ||
INTIFACE_NAME: | ||
runtime.getSetting("INTIFACE_NAME") || | ||
process.env.INTIFACE_NAME, | ||
DEVICE_NAME: | ||
runtime.getSetting("DEVICE_NAME") || process.env.DEVICE_NAME, | ||
}; | ||
|
||
return buttplugEnvSchema.parse(config); | ||
} catch (error) { | ||
if (error instanceof z.ZodError) { | ||
const errorMessages = error.errors | ||
.map((err) => `${err.path.join(".")}: ${err.message}`) | ||
.join("\n"); | ||
throw new Error( | ||
`Buttplug configuration validation failed:\n${errorMessages}` | ||
); | ||
} | ||
throw error; | ||
} | ||
} |
Oops, something went wrong.