@voicemesh/dsh-voice 0.1.0-beta.11 → 0.1.0-beta.13
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 +13 -11
- package/lib/client.js +187 -148
- package/node_modules/@deepseek-ai/dsh-voice-client/lib/client.js +187 -148
- package/node_modules/@deepseek-ai/dsh-voice-client/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-voice-host/lib/index.js +113 -11
- package/node_modules/@deepseek-ai/dsh-voice-host/package.json +1 -1
- package/package.json +3 -3
- package/provenance.json +3 -3
|
@@ -9398,6 +9398,7 @@ const slotSchema = _enum$1([
|
|
|
9398
9398
|
"xai-sts",
|
|
9399
9399
|
"gemini-sts",
|
|
9400
9400
|
"openai-sts",
|
|
9401
|
+
"deepseek-tts",
|
|
9401
9402
|
"conversational"
|
|
9402
9403
|
]);
|
|
9403
9404
|
const requestSchema$4 = object$2({
|
|
@@ -9416,7 +9417,8 @@ const refs = {
|
|
|
9416
9417
|
xai: "DSH_VOICE_XAI_KEY",
|
|
9417
9418
|
"xai-sts": "DSH_VOICE_XAI_STS_KEY",
|
|
9418
9419
|
"gemini-sts": "DSH_VOICE_GEMINI_STS_KEY",
|
|
9419
|
-
"openai-sts": "DSH_VOICE_OPENAI_STS_KEY"
|
|
9420
|
+
"openai-sts": "DSH_VOICE_OPENAI_STS_KEY",
|
|
9421
|
+
"deepseek-tts": "DSH_VOICE_DEEPSEEK_TTS_KEY"
|
|
9420
9422
|
};
|
|
9421
9423
|
function conversationalBase(value) {
|
|
9422
9424
|
const url2 = new URL(value);
|
|
@@ -9461,12 +9463,14 @@ async function credentialedVoiceRequest(ctx, input, deepgramRef = refs.deepgram)
|
|
|
9461
9463
|
"xai",
|
|
9462
9464
|
"gemini",
|
|
9463
9465
|
"openai",
|
|
9464
|
-
"openai-live"
|
|
9466
|
+
"openai-live",
|
|
9467
|
+
"deepseek"
|
|
9465
9468
|
]),
|
|
9466
9469
|
mode: _enum$1(["sts", "tts"]).optional()
|
|
9467
9470
|
}).parse(input);
|
|
9468
9471
|
if (typeof input !== "object" || input === null || "key" in input) throw new Error("Browser voice requests cannot supply keys");
|
|
9469
|
-
|
|
9472
|
+
if (selected.provider === "deepseek" && selected.mode !== "tts") throw new Error("DeepSeek supports TTS only");
|
|
9473
|
+
const key = await readVoiceCredential(ctx, selected.provider === "deepseek" ? "deepseek-tts" : selected.provider === "openai-live" ? "openai-sts" : selected.provider === "fish" ? "fish" : selected.provider === "deepgram" ? "deepgram" : selected.provider === "xai" && selected.mode === "tts" ? "xai" : `${selected.provider}-sts`, void 0, deepgramRef);
|
|
9470
9474
|
return {
|
|
9471
9475
|
...input,
|
|
9472
9476
|
key: key ?? ""
|
|
@@ -20858,7 +20862,8 @@ object$1({
|
|
|
20858
20862
|
object$1({ route: _enum([
|
|
20859
20863
|
"voice",
|
|
20860
20864
|
"coding",
|
|
20861
|
-
"clarify"
|
|
20865
|
+
"clarify",
|
|
20866
|
+
"ignore"
|
|
20862
20867
|
]) });
|
|
20863
20868
|
const transcript = object$1({
|
|
20864
20869
|
event_id: string(),
|
|
@@ -21275,7 +21280,7 @@ async function geminiModels$1(key, signal) {
|
|
|
21275
21280
|
signal,
|
|
21276
21281
|
redirect: "error"
|
|
21277
21282
|
});
|
|
21278
|
-
if (!response.ok) throw new Error(
|
|
21283
|
+
if (!response.ok) throw new Error(`Gemini model discovery failed (HTTP ${response.status})`);
|
|
21279
21284
|
const page = pageSchema$1.parse(await response.json());
|
|
21280
21285
|
for (const model of page.models ?? []) models.set(model.name, model);
|
|
21281
21286
|
token = page.nextPageToken || void 0;
|
|
@@ -23735,6 +23740,13 @@ var LiveDelegation$1 = class {
|
|
|
23735
23740
|
return;
|
|
23736
23741
|
}
|
|
23737
23742
|
if (!eligible()) return;
|
|
23743
|
+
if (route === "ignore") {
|
|
23744
|
+
if (!classification.ignore) throw new Error("Ignoring speech is not configured");
|
|
23745
|
+
this.deliver(async () => {
|
|
23746
|
+
await this.append("session.thinking.append", id, classification.ignore, eligible);
|
|
23747
|
+
});
|
|
23748
|
+
return;
|
|
23749
|
+
}
|
|
23738
23750
|
if (route === "voice" || route === "clarify") {
|
|
23739
23751
|
const response = route === "voice" ? classification.voice : classification.clarify;
|
|
23740
23752
|
this.deliver(async () => {
|
|
@@ -24012,7 +24024,8 @@ const voiceRequest = object$2({
|
|
|
24012
24024
|
"openai",
|
|
24013
24025
|
"openai-live",
|
|
24014
24026
|
"gemini",
|
|
24015
|
-
"fish"
|
|
24027
|
+
"fish",
|
|
24028
|
+
"deepseek"
|
|
24016
24029
|
]),
|
|
24017
24030
|
mode: _enum$1(["sts", "tts"]),
|
|
24018
24031
|
key: string$1().max(4096),
|
|
@@ -24084,6 +24097,15 @@ function parseDocumentVoices(provider, body, mode = "sts", model = "") {
|
|
|
24084
24097
|
}
|
|
24085
24098
|
async function discoverVoices(input, signal, maxBytes) {
|
|
24086
24099
|
const request = voiceRequest.parse(input);
|
|
24100
|
+
if (request.provider === "deepseek") {
|
|
24101
|
+
if (request.mode !== "tts") throw new Error("DeepSeek supports TTS only");
|
|
24102
|
+
return {
|
|
24103
|
+
voices: [metadata("stella", "Stella"), metadata("tide", "Tide")],
|
|
24104
|
+
source: "documentation",
|
|
24105
|
+
sourceUrl: "https://api-docs.deepseek.com/guides/tts/",
|
|
24106
|
+
fetchedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
24107
|
+
};
|
|
24108
|
+
}
|
|
24087
24109
|
if (request.provider === "fish") {
|
|
24088
24110
|
if (request.mode !== "tts" || !request.key.trim()) throw new Error("Fish voices require TTS mode and a key");
|
|
24089
24111
|
const voices2 = /* @__PURE__ */ new Map();
|
|
@@ -24173,6 +24195,51 @@ async function discoverVoices(input, signal, maxBytes) {
|
|
|
24173
24195
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
24174
24196
|
};
|
|
24175
24197
|
}
|
|
24198
|
+
const DEEPSEEK_TTS_URL = "https://api.deepseek.com/v1/tools/tts";
|
|
24199
|
+
const DEEPSEEK_TTS_SAMPLE_RATE = 24e3;
|
|
24200
|
+
const DEEPSEEK_TTS_VOICES = ["stella", "tide"];
|
|
24201
|
+
async function synthesizeDeepseekTts(text, voice, key, signal, maxBytes, fetchImpl = fetch) {
|
|
24202
|
+
if (text.trim() === "" || [...text].length > 1e4 || Buffer.byteLength(JSON.stringify({
|
|
24203
|
+
text,
|
|
24204
|
+
voice_id: voice,
|
|
24205
|
+
format: "pcm"
|
|
24206
|
+
})) > 64 * 1024) throw new Error("DeepSeek TTS input exceeds its limit");
|
|
24207
|
+
if (!DEEPSEEK_TTS_VOICES.includes(voice)) throw new Error("Unsupported DeepSeek TTS voice");
|
|
24208
|
+
if (key.trim() === "") throw new Error("DeepSeek TTS key is not configured");
|
|
24209
|
+
const response = await fetchImpl(DEEPSEEK_TTS_URL, {
|
|
24210
|
+
method: "POST",
|
|
24211
|
+
redirect: "error",
|
|
24212
|
+
signal,
|
|
24213
|
+
headers: {
|
|
24214
|
+
Authorization: `Bearer ${key}`,
|
|
24215
|
+
"Content-Type": "application/json",
|
|
24216
|
+
Accept: "audio/pcm"
|
|
24217
|
+
},
|
|
24218
|
+
body: JSON.stringify({
|
|
24219
|
+
text,
|
|
24220
|
+
voice_id: voice,
|
|
24221
|
+
format: "pcm"
|
|
24222
|
+
})
|
|
24223
|
+
});
|
|
24224
|
+
if (!response.ok || response.body === null || response.headers.get("content-type")?.split(";", 1)[0]?.trim().toLowerCase() !== "audio/pcm") throw new Error("DeepSeek TTS request failed");
|
|
24225
|
+
const reader = response.body.getReader();
|
|
24226
|
+
const chunks = [];
|
|
24227
|
+
let size = 0;
|
|
24228
|
+
try {
|
|
24229
|
+
while (true) {
|
|
24230
|
+
const result = await reader.read();
|
|
24231
|
+
if (result.done) break;
|
|
24232
|
+
size += result.value.byteLength;
|
|
24233
|
+
if (size > maxBytes) throw new Error("DeepSeek TTS response exceeds its limit");
|
|
24234
|
+
chunks.push(result.value);
|
|
24235
|
+
}
|
|
24236
|
+
} finally {
|
|
24237
|
+
await reader.cancel();
|
|
24238
|
+
reader.releaseLock();
|
|
24239
|
+
}
|
|
24240
|
+
if (size === 0 || size % 2 !== 0) throw new Error("DeepSeek TTS returned invalid PCM audio");
|
|
24241
|
+
return Buffer.concat(chunks);
|
|
24242
|
+
}
|
|
24176
24243
|
const phrases = [
|
|
24177
24244
|
"Hey, I'm ready to hit the ground running, so let me know what you'd like me to focus on.",
|
|
24178
24245
|
"Let's turn that idea into something useful, one thoughtful step at a time.",
|
|
@@ -24225,7 +24292,10 @@ async function previewVoice(input, signal, maxBytes, timeoutMs, connect, onAudio
|
|
|
24225
24292
|
});
|
|
24226
24293
|
else chunks.push(aligned);
|
|
24227
24294
|
};
|
|
24228
|
-
if (request.mode === "tts") {
|
|
24295
|
+
if (request.mode === "tts") if (request.provider === "deepseek") {
|
|
24296
|
+
sampleRate = DEEPSEEK_TTS_SAMPLE_RATE;
|
|
24297
|
+
append(await synthesizeDeepseekTts(phrase, request.voice, request.key, signal, maxBytes));
|
|
24298
|
+
} else {
|
|
24229
24299
|
const synth = request.provider === "kokoro" ? local?.synthesizer(request.voice, append) : buildSynthesizer(request.provider === "xai" ? "grok" : request.provider, connect, () => request.key, async (url2, options) => {
|
|
24230
24300
|
const response = await fetch(url2, {
|
|
24231
24301
|
...options,
|
|
@@ -24253,7 +24323,8 @@ async function previewVoice(input, signal, maxBytes, timeoutMs, connect, onAudio
|
|
|
24253
24323
|
signal.removeEventListener("abort", abort);
|
|
24254
24324
|
synth.dispose();
|
|
24255
24325
|
}
|
|
24256
|
-
}
|
|
24326
|
+
}
|
|
24327
|
+
else {
|
|
24257
24328
|
if (request.provider === "deepgram" || request.provider === "fish") throw new Error("Unsupported STS provider");
|
|
24258
24329
|
const provider = request.provider === "openai" ? openaiStsProvider : request.provider === "gemini" ? geminiStsProvider : xaiStsProvider;
|
|
24259
24330
|
sampleRate = provider.outputSampleRate;
|
|
@@ -24339,6 +24410,7 @@ Connection: close\r
|
|
|
24339
24410
|
"xai",
|
|
24340
24411
|
"deepgram",
|
|
24341
24412
|
"fish",
|
|
24413
|
+
"deepseek",
|
|
24342
24414
|
"kokoro"
|
|
24343
24415
|
]),
|
|
24344
24416
|
mode: _enum$1(["sts", "tts"]),
|
|
@@ -30796,6 +30868,8 @@ var StsRecording = class {
|
|
|
30796
30868
|
appendRecord;
|
|
30797
30869
|
pending = [];
|
|
30798
30870
|
writing = false;
|
|
30871
|
+
inputDisplayStreams = /* @__PURE__ */ new Map();
|
|
30872
|
+
lastInputTranscript;
|
|
30799
30873
|
persist(append) {
|
|
30800
30874
|
const operation = Promise.withResolvers();
|
|
30801
30875
|
this.pending.push({
|
|
@@ -30824,6 +30898,11 @@ var StsRecording = class {
|
|
|
30824
30898
|
}
|
|
30825
30899
|
this.writing = false;
|
|
30826
30900
|
}
|
|
30901
|
+
/** End input transcript grouping when the provider begins an assistant response. */
|
|
30902
|
+
beginAssistantResponse() {
|
|
30903
|
+
this.inputDisplayStreams.clear();
|
|
30904
|
+
this.lastInputTranscript = void 0;
|
|
30905
|
+
}
|
|
30827
30906
|
/**
|
|
30828
30907
|
* @param conversationId - identity retained across records for this voice conversation.
|
|
30829
30908
|
* @param session - the authenticated, linked Session owning the voice history.
|
|
@@ -30959,14 +31038,26 @@ var StsRecording = class {
|
|
|
30959
31038
|
* Written as an ignorable plugin record, never through Session.append: a Session
|
|
30960
31039
|
* event type the installed Harness does not know makes validateStoredEvents refuse
|
|
30961
31040
|
* the whole log on reopen, and append() cannot set the `ignorable` marker that
|
|
30962
|
-
* lets readers skip the event instead.
|
|
31041
|
+
* lets readers skip the event instead. Cumulative input items share a display stream
|
|
31042
|
+
* when a new provider item extends the previous input text; an assistant transcript ends that grouping.
|
|
30963
31043
|
*/
|
|
30964
31044
|
async recordTranscript(role3, text, signal, streamId = "final", phase = "final", interrupted = false) {
|
|
30965
31045
|
signal.throwIfAborted();
|
|
30966
31046
|
const value = text.trim();
|
|
30967
31047
|
if (value === "") return;
|
|
31048
|
+
let displayStreamId = streamId;
|
|
31049
|
+
if (role3 === "assistant") this.beginAssistantResponse();
|
|
31050
|
+
else {
|
|
31051
|
+
displayStreamId = this.inputDisplayStreams.get(streamId) ?? streamId;
|
|
31052
|
+
if (!this.inputDisplayStreams.has(streamId) && this.lastInputTranscript !== void 0 && value.length > this.lastInputTranscript.text.length && value.startsWith(this.lastInputTranscript.text)) displayStreamId = this.lastInputTranscript.displayStreamId;
|
|
31053
|
+
this.inputDisplayStreams.set(streamId, displayStreamId);
|
|
31054
|
+
this.lastInputTranscript = {
|
|
31055
|
+
text: value,
|
|
31056
|
+
displayStreamId
|
|
31057
|
+
};
|
|
31058
|
+
}
|
|
30968
31059
|
await this.persist(() => {
|
|
30969
|
-
const record2 = transcriptRecord(this.conversationId, role3, value,
|
|
31060
|
+
const record2 = transcriptRecord(this.conversationId, role3, value, displayStreamId, phase, interrupted);
|
|
30970
31061
|
this.appendRecord(this.session, record2.type, record2.data);
|
|
30971
31062
|
});
|
|
30972
31063
|
signal.throwIfAborted();
|
|
@@ -32058,6 +32149,7 @@ ${liveListeningInstructions}`,
|
|
|
32058
32149
|
responseActive = true;
|
|
32059
32150
|
}
|
|
32060
32151
|
if (event.type === "response.created") {
|
|
32152
|
+
recorder?.beginAssistantResponse();
|
|
32061
32153
|
responseActive = true;
|
|
32062
32154
|
playbackBusy = true;
|
|
32063
32155
|
playbackResponse = object$2({ id: string$1() }).parse(event.response).id;
|
|
@@ -32820,6 +32912,7 @@ function apply(ctx, config2) {
|
|
|
32820
32912
|
if (engine === "vosk" || engine === "kokoro") return null;
|
|
32821
32913
|
if (engine === "openai" || engine === "gemini") return readVoiceCredential(ctx, `${engine}-sts`);
|
|
32822
32914
|
if (engine === "fish") return readVoiceCredential(ctx, "fish");
|
|
32915
|
+
if (engine === "deepseek") return readVoiceCredential(ctx, "deepseek-tts");
|
|
32823
32916
|
if (engineNeedsXai(engine)) return readVoiceCredential(ctx, "xai");
|
|
32824
32917
|
return readVoiceCredential(ctx, "deepgram", void 0, config2.deepgramKey);
|
|
32825
32918
|
};
|
|
@@ -33168,7 +33261,7 @@ Connection: close\r
|
|
|
33168
33261
|
res.statusCode = 400;
|
|
33169
33262
|
res.end(JSON.stringify({
|
|
33170
33263
|
ok: false,
|
|
33171
|
-
error: `no ${ttsEngine === "gemini" ? "Gemini" : ttsEngine === "openai" ? "OpenAI" : ttsEngine === "fish" ? "Fish Audio" : engineNeedsXai(ttsEngine) ? "xAI" : "Deepgram"} key available`
|
|
33264
|
+
error: `no ${ttsEngine === "deepseek" ? "DeepSeek TTS" : ttsEngine === "gemini" ? "Gemini" : ttsEngine === "openai" ? "OpenAI" : ttsEngine === "fish" ? "Fish Audio" : engineNeedsXai(ttsEngine) ? "xAI" : "Deepgram"} key available`
|
|
33172
33265
|
}));
|
|
33173
33266
|
return;
|
|
33174
33267
|
}
|
|
@@ -33176,6 +33269,15 @@ Connection: close\r
|
|
|
33176
33269
|
try {
|
|
33177
33270
|
res.statusCode = 200;
|
|
33178
33271
|
res.setHeader("Content-Type", "audio/l16");
|
|
33272
|
+
if (ttsEngine === "deepseek") {
|
|
33273
|
+
const controller = new AbortController();
|
|
33274
|
+
res.on?.("close", () => controller.abort());
|
|
33275
|
+
const pcm = await synthesizeDeepseekTts(text, voice ?? "stella", key ?? "", controller.signal, config2.maxBodyBytes);
|
|
33276
|
+
res.setHeader("X-Voice-Sample-Rate", String(DEEPSEEK_TTS_SAMPLE_RATE));
|
|
33277
|
+
res.write?.(pcm);
|
|
33278
|
+
res.end();
|
|
33279
|
+
return;
|
|
33280
|
+
}
|
|
33179
33281
|
let total = 0;
|
|
33180
33282
|
const http = async (url2, { headers, body: body2 }) => {
|
|
33181
33283
|
const r = await fetch(url2, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voicemesh/dsh-voice",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.13",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@deepseek-ai/dsh-voice-host": "0.1.0-beta.
|
|
66
|
-
"@deepseek-ai/dsh-voice-client": "0.1.0-beta.
|
|
65
|
+
"@deepseek-ai/dsh-voice-host": "0.1.0-beta.13",
|
|
66
|
+
"@deepseek-ai/dsh-voice-client": "0.1.0-beta.13"
|
|
67
67
|
},
|
|
68
68
|
"bundledDependencies": [
|
|
69
69
|
"@deepseek-ai/dsh-voice-host",
|
package/provenance.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
3
|
"name": "@voicemesh/composer",
|
|
4
|
-
"sourceVersion": "0.2.
|
|
5
|
-
"buildSha256": "
|
|
4
|
+
"sourceVersion": "0.2.20",
|
|
5
|
+
"buildSha256": "bb660aed2935e2424a7cf62d552d368ccc30f028b12fe2689d1e47cc2f81ca23"
|
|
6
6
|
},
|
|
7
7
|
{
|
|
8
8
|
"name": "@deepseek-ai/dsh-voice-host",
|
|
9
9
|
"sourceVersion": "0.1.2-alpha.4",
|
|
10
|
-
"hostSha256": "
|
|
10
|
+
"hostSha256": "cca7315d045ea52b4236dc58e3259e5e5b2fe11d6a39fa447b565e2027edfa76"
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
13
|
"name": "@deepseek-ai/dsh-voice-client",
|