@bevyra/avatar 1.0.0 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -3
- package/index.d.ts +1 -0
- package/index.js +6 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# @bevyra/avatar
|
|
2
2
|
|
|
3
|
-
Run a licensed BeVyra avatar on the same machine as your Node.js app. Supply your own ASR, LLM and TTS.
|
|
3
|
+
Run a licensed BeVyra avatar on the same machine as your Node.js app. Supply your own ASR, LLM and TTS. The currently published renderer wheel requires CPython 3.12 on Linux x86_64. This package installs that wheel on first use; no repository clone is required.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
6
|
npm install @bevyra/avatar
|
|
7
7
|
export BEVYRA_API_KEY=your_project_key
|
|
8
8
|
npx bevyra-avatar activate
|
|
9
9
|
npx bevyra-avatar list
|
|
10
|
-
npx bevyra-avatar assign 1 noora
|
|
10
|
+
npx bevyra-avatar assign 1 noora # only on plans with avatar slots
|
|
11
11
|
npx bevyra-avatar download noora
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
`assign` applies to plans with avatar slots. `download` obtains signed URLs through BeVyra's API and
|
|
14
|
+
`assign` applies to plans with avatar slots. `download` obtains signed URLs through BeVyra's API, verifies files, and stores revisioned assets in `~/.local/share/bevyra-avatar` by default. Set `BEVYRA_AVATAR_HOME` to use another user-writable location. No AWS credentials are needed. One account may activate one installation across all its API keys; repeated downloads there are allowed. Each avatar session checks authorization with the API.
|
|
15
15
|
|
|
16
16
|
```js
|
|
17
17
|
import { AvatarClient } from '@bevyra/avatar';
|
|
@@ -23,9 +23,16 @@ const session = await client.connect('noora');
|
|
|
23
23
|
const clauseId = session.sendAudio(pcm16At16kHz);
|
|
24
24
|
for await (const event of session.events()) {
|
|
25
25
|
// clause.audio precedes binary PCM; clause.frame precedes binary JPEG.
|
|
26
|
+
// idle.frame precedes binary JPEG; idle.done ends each requested batch.
|
|
26
27
|
// Frame N is scheduled at audio time N * 40 ms.
|
|
27
28
|
if (event.type === 'clause.done' && event.clauseId === clauseId) break;
|
|
28
29
|
}
|
|
30
|
+
// Request recorded silence once the speech clause has finished.
|
|
31
|
+
session.idle(4);
|
|
32
|
+
for await (const event of session.events()) {
|
|
33
|
+
// idle.frame precedes its binary JPEG; present frames 40 ms apart.
|
|
34
|
+
if (event.type === 'idle.done') break;
|
|
35
|
+
}
|
|
29
36
|
session.close(); client.close();
|
|
30
37
|
```
|
|
31
38
|
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import path from "node:path";
|
|
|
6
6
|
import readline from "node:readline";
|
|
7
7
|
import WebSocket from "ws";
|
|
8
8
|
|
|
9
|
-
const VERSION = "1.0.
|
|
9
|
+
const VERSION = "1.0.4";
|
|
10
10
|
|
|
11
11
|
function python() {
|
|
12
12
|
if (process.env.BEVYRA_PYTHON) return { executable: process.env.BEVYRA_PYTHON, prefix: [] };
|
|
@@ -95,6 +95,11 @@ export class AvatarSession {
|
|
|
95
95
|
this.socket.send(JSON.stringify({ type: "clause.end", clauseId }));
|
|
96
96
|
return clauseId;
|
|
97
97
|
}
|
|
98
|
+
idle(count = 4) {
|
|
99
|
+
if (!Number.isInteger(count) || count < 1 || count > 9)
|
|
100
|
+
throw new RangeError("Idle request must contain 1–9 recorded frames");
|
|
101
|
+
this.socket.send(JSON.stringify({ type: "session.idle", count }));
|
|
102
|
+
}
|
|
98
103
|
interrupt() { this.generation++; this.socket.send(JSON.stringify({ type: "session.interrupt", generation: this.generation })); }
|
|
99
104
|
close() { this.socket.close(); }
|
|
100
105
|
async *events() { while (!this.closed || this.pending.length) { const event = this.pending.length ? this.pending.shift() : await new Promise(resolve => this.waiters.push(resolve)); if (event === null) return; yield event; } }
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bevyra/avatar",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "API-authorized local BeVyra avatar service for Node.js",
|
|
5
5
|
"homepage": "https://bevyra.ai/docs",
|
|
6
6
|
"bugs": {"url": "https://bevyra.ai/docs"},
|
|
7
7
|
"type": "module",
|
|
8
8
|
"exports": {".": {"types": "./index.d.ts", "default": "./index.js"}},
|
|
9
|
-
"bin": {"bevyra-avatar": "
|
|
9
|
+
"bin": {"bevyra-avatar": "cli.js"},
|
|
10
10
|
"files": ["index.js", "index.d.ts", "cli.js", "README.md"],
|
|
11
11
|
"scripts": {"test": "node --test test/local.test.mjs", "pack:check": "npm pack --dry-run --json"},
|
|
12
12
|
"engines": {"node": ">=20"},
|