@lokutor/sdk 1.1.7 → 1.1.8
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/dist/index.d.mts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +6 -3
- package/dist/index.mjs +6 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -90,11 +90,12 @@ interface VoiceAgentOptions {
|
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
92
92
|
* Viseme data for lip-sync animation
|
|
93
|
+
* Format: {"v": index, "c": character, "t": timestamp}
|
|
93
94
|
*/
|
|
94
95
|
interface Viseme {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
v: number;
|
|
97
|
+
c: string;
|
|
98
|
+
t: number;
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
/**
|
|
@@ -117,10 +118,12 @@ declare class VoiceAgentClient {
|
|
|
117
118
|
private isConnected;
|
|
118
119
|
private messages;
|
|
119
120
|
private visemeListeners;
|
|
121
|
+
private wantVisemes;
|
|
120
122
|
constructor(config: LokutorConfig & {
|
|
121
123
|
prompt: string;
|
|
122
124
|
voice?: VoiceStyle;
|
|
123
125
|
language?: Language;
|
|
126
|
+
visemes?: boolean;
|
|
124
127
|
onVisemes?: (visemes: Viseme[]) => void;
|
|
125
128
|
});
|
|
126
129
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -90,11 +90,12 @@ interface VoiceAgentOptions {
|
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
92
92
|
* Viseme data for lip-sync animation
|
|
93
|
+
* Format: {"v": index, "c": character, "t": timestamp}
|
|
93
94
|
*/
|
|
94
95
|
interface Viseme {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
v: number;
|
|
97
|
+
c: string;
|
|
98
|
+
t: number;
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
/**
|
|
@@ -117,10 +118,12 @@ declare class VoiceAgentClient {
|
|
|
117
118
|
private isConnected;
|
|
118
119
|
private messages;
|
|
119
120
|
private visemeListeners;
|
|
121
|
+
private wantVisemes;
|
|
120
122
|
constructor(config: LokutorConfig & {
|
|
121
123
|
prompt: string;
|
|
122
124
|
voice?: VoiceStyle;
|
|
123
125
|
language?: Language;
|
|
126
|
+
visemes?: boolean;
|
|
124
127
|
onVisemes?: (visemes: Viseme[]) => void;
|
|
125
128
|
});
|
|
126
129
|
/**
|
package/dist/index.js
CHANGED
|
@@ -65,8 +65,8 @@ var Language = /* @__PURE__ */ ((Language2) => {
|
|
|
65
65
|
return Language2;
|
|
66
66
|
})(Language || {});
|
|
67
67
|
var AUDIO_CONFIG = {
|
|
68
|
-
SAMPLE_RATE:
|
|
69
|
-
SPEAKER_SAMPLE_RATE:
|
|
68
|
+
SAMPLE_RATE: 16e3,
|
|
69
|
+
SPEAKER_SAMPLE_RATE: 44100,
|
|
70
70
|
CHANNELS: 1,
|
|
71
71
|
CHUNK_DURATION_MS: 20,
|
|
72
72
|
get CHUNK_SIZE() {
|
|
@@ -103,6 +103,7 @@ var VoiceAgentClient = class {
|
|
|
103
103
|
isConnected = false;
|
|
104
104
|
messages = [];
|
|
105
105
|
visemeListeners = [];
|
|
106
|
+
wantVisemes = false;
|
|
106
107
|
constructor(config) {
|
|
107
108
|
this.apiKey = config.apiKey;
|
|
108
109
|
this.prompt = config.prompt;
|
|
@@ -114,6 +115,7 @@ var VoiceAgentClient = class {
|
|
|
114
115
|
this.onVisemesCallback = config.onVisemes;
|
|
115
116
|
this.onStatus = config.onStatus;
|
|
116
117
|
this.onError = config.onError;
|
|
118
|
+
this.wantVisemes = config.visemes || false;
|
|
117
119
|
}
|
|
118
120
|
/**
|
|
119
121
|
* Connect to the Lokutor Voice Agent server
|
|
@@ -165,7 +167,8 @@ var VoiceAgentClient = class {
|
|
|
165
167
|
this.ws.send(JSON.stringify({ type: "prompt", data: this.prompt }));
|
|
166
168
|
this.ws.send(JSON.stringify({ type: "voice", data: this.voice }));
|
|
167
169
|
this.ws.send(JSON.stringify({ type: "language", data: this.language }));
|
|
168
|
-
|
|
170
|
+
this.ws.send(JSON.stringify({ type: "visemes", data: this.wantVisemes }));
|
|
171
|
+
console.log(`\u2699\uFE0F Configured: voice=${this.voice}, language=${this.language}, visemes=${this.wantVisemes}`);
|
|
169
172
|
}
|
|
170
173
|
/**
|
|
171
174
|
* Send raw PCM audio data to the server
|
package/dist/index.mjs
CHANGED
|
@@ -21,8 +21,8 @@ var Language = /* @__PURE__ */ ((Language2) => {
|
|
|
21
21
|
return Language2;
|
|
22
22
|
})(Language || {});
|
|
23
23
|
var AUDIO_CONFIG = {
|
|
24
|
-
SAMPLE_RATE:
|
|
25
|
-
SPEAKER_SAMPLE_RATE:
|
|
24
|
+
SAMPLE_RATE: 16e3,
|
|
25
|
+
SPEAKER_SAMPLE_RATE: 44100,
|
|
26
26
|
CHANNELS: 1,
|
|
27
27
|
CHUNK_DURATION_MS: 20,
|
|
28
28
|
get CHUNK_SIZE() {
|
|
@@ -59,6 +59,7 @@ var VoiceAgentClient = class {
|
|
|
59
59
|
isConnected = false;
|
|
60
60
|
messages = [];
|
|
61
61
|
visemeListeners = [];
|
|
62
|
+
wantVisemes = false;
|
|
62
63
|
constructor(config) {
|
|
63
64
|
this.apiKey = config.apiKey;
|
|
64
65
|
this.prompt = config.prompt;
|
|
@@ -70,6 +71,7 @@ var VoiceAgentClient = class {
|
|
|
70
71
|
this.onVisemesCallback = config.onVisemes;
|
|
71
72
|
this.onStatus = config.onStatus;
|
|
72
73
|
this.onError = config.onError;
|
|
74
|
+
this.wantVisemes = config.visemes || false;
|
|
73
75
|
}
|
|
74
76
|
/**
|
|
75
77
|
* Connect to the Lokutor Voice Agent server
|
|
@@ -121,7 +123,8 @@ var VoiceAgentClient = class {
|
|
|
121
123
|
this.ws.send(JSON.stringify({ type: "prompt", data: this.prompt }));
|
|
122
124
|
this.ws.send(JSON.stringify({ type: "voice", data: this.voice }));
|
|
123
125
|
this.ws.send(JSON.stringify({ type: "language", data: this.language }));
|
|
124
|
-
|
|
126
|
+
this.ws.send(JSON.stringify({ type: "visemes", data: this.wantVisemes }));
|
|
127
|
+
console.log(`\u2699\uFE0F Configured: voice=${this.voice}, language=${this.language}, visemes=${this.wantVisemes}`);
|
|
125
128
|
}
|
|
126
129
|
/**
|
|
127
130
|
* Send raw PCM audio data to the server
|