@voicemesh/dsh-voice 0.1.0-beta.5 → 0.1.0-beta.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/README.md +7 -5
- package/cordis.patch.yml +0 -3
- package/icon.svg +5 -5
- package/lib/client.js +166 -166
- package/node_modules/@deepseek-ai/dsh-voice-client/lib/client.js +155 -155
- package/node_modules/@deepseek-ai/dsh-voice-client/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-voice-host/lib/index.js +92 -4
- package/node_modules/@deepseek-ai/dsh-voice-host/package.json +1 -1
- package/package.json +3 -3
- package/provenance.json +1 -1
|
@@ -26574,6 +26574,94 @@ async function listOpenaiSpeechModels(key, kind, signal) {
|
|
|
26574
26574
|
return familyIndex(a) - familyIndex(b) || b.localeCompare(a);
|
|
26575
26575
|
});
|
|
26576
26576
|
}
|
|
26577
|
+
const endpoints = {
|
|
26578
|
+
"/voice-credentials": ["status", "save"],
|
|
26579
|
+
"/voice-local": [
|
|
26580
|
+
"models",
|
|
26581
|
+
"wake-keywords",
|
|
26582
|
+
"install-size",
|
|
26583
|
+
"install",
|
|
26584
|
+
"install-status",
|
|
26585
|
+
"wake-readiness"
|
|
26586
|
+
],
|
|
26587
|
+
"/voice-sts": [
|
|
26588
|
+
"models",
|
|
26589
|
+
"voices",
|
|
26590
|
+
"voice-preview",
|
|
26591
|
+
"pipeline-models",
|
|
26592
|
+
"probe"
|
|
26593
|
+
],
|
|
26594
|
+
"/voice-pipeline": ["exchange", "tool"]
|
|
26595
|
+
};
|
|
26596
|
+
function registerVoiceRpc(connection, channel, handler) {
|
|
26597
|
+
const methods = endpoints[channel];
|
|
26598
|
+
if (!methods) throw new Error("Unknown voice RPC channel");
|
|
26599
|
+
const disposers = methods.map((endpoint) => {
|
|
26600
|
+
const method = `${channel.slice(1)}/${endpoint}`;
|
|
26601
|
+
return connection.fetch.register({
|
|
26602
|
+
path: `/api/${method}`,
|
|
26603
|
+
methods: ["POST"],
|
|
26604
|
+
requestBody: "buffered",
|
|
26605
|
+
async fetch(request) {
|
|
26606
|
+
if (request.headers.get("content-type")?.split(";", 1)[0]?.trim().toLowerCase() !== "application/json") return new Response("content type must be application/json", { status: 415 });
|
|
26607
|
+
let input;
|
|
26608
|
+
try {
|
|
26609
|
+
input = await request.json();
|
|
26610
|
+
} catch {
|
|
26611
|
+
return new Response("body is not JSON", { status: 400 });
|
|
26612
|
+
}
|
|
26613
|
+
const message = input;
|
|
26614
|
+
const rpcId = typeof message?.rpcId === "string" ? message.rpcId : "invalid-request";
|
|
26615
|
+
const failure2 = (code, text) => Response.json({
|
|
26616
|
+
type: "server-response",
|
|
26617
|
+
rpcId,
|
|
26618
|
+
result: {
|
|
26619
|
+
ok: false,
|
|
26620
|
+
error: {
|
|
26621
|
+
code,
|
|
26622
|
+
message: text,
|
|
26623
|
+
details: {}
|
|
26624
|
+
}
|
|
26625
|
+
}
|
|
26626
|
+
});
|
|
26627
|
+
if (!message || typeof message !== "object" || Array.isArray(message) || message.type !== "client-request" || typeof message.rpcId !== "string" || typeof message.method !== "string") return failure2("gateway/bad-request", "invalid client-request message");
|
|
26628
|
+
if (message.method !== method) return failure2("gateway/bad-request", "method does not match endpoint");
|
|
26629
|
+
let result;
|
|
26630
|
+
try {
|
|
26631
|
+
result = await handler(endpoint, message.payload, request.signal);
|
|
26632
|
+
} catch {
|
|
26633
|
+
return failure2("voice/rpc", "Voice operation failed");
|
|
26634
|
+
}
|
|
26635
|
+
if (!result.ok || !result.attachments?.length) return Response.json({
|
|
26636
|
+
type: "server-response",
|
|
26637
|
+
rpcId,
|
|
26638
|
+
result
|
|
26639
|
+
});
|
|
26640
|
+
const { attachments, ...success } = result;
|
|
26641
|
+
const form = new FormData();
|
|
26642
|
+
const metadata2 = attachments.map((attachment, index) => {
|
|
26643
|
+
const part = `bytes-${index}`;
|
|
26644
|
+
form.set(part, new Blob([new Uint8Array(attachment.bytes)]));
|
|
26645
|
+
return {
|
|
26646
|
+
kind: attachment.kind,
|
|
26647
|
+
codec: "bytes",
|
|
26648
|
+
part
|
|
26649
|
+
};
|
|
26650
|
+
});
|
|
26651
|
+
form.set("metadata", JSON.stringify({
|
|
26652
|
+
type: "server-response",
|
|
26653
|
+
rpcId,
|
|
26654
|
+
result: success,
|
|
26655
|
+
attachments: metadata2
|
|
26656
|
+
}));
|
|
26657
|
+
return new Response(form);
|
|
26658
|
+
}
|
|
26659
|
+
});
|
|
26660
|
+
});
|
|
26661
|
+
return async () => {
|
|
26662
|
+
await Promise.all(disposers.map((dispose) => dispose()));
|
|
26663
|
+
};
|
|
26664
|
+
}
|
|
26577
26665
|
function deepFreeze(value) {
|
|
26578
26666
|
const seen = /* @__PURE__ */ new WeakSet();
|
|
26579
26667
|
const pending = [{
|
|
@@ -33366,7 +33454,7 @@ function apply(ctx, config2) {
|
|
|
33366
33454
|
});
|
|
33367
33455
|
ctx.effect(() => () => local.dispose(), "voice-host: local model workers");
|
|
33368
33456
|
ctx.inject(["connection"], (connected) => {
|
|
33369
|
-
connected.effect(() => connected.connection
|
|
33457
|
+
connected.effect(() => registerVoiceRpc(connected.connection, "/voice-credentials", async (endpoint, payload) => {
|
|
33370
33458
|
try {
|
|
33371
33459
|
return {
|
|
33372
33460
|
ok: true,
|
|
@@ -33383,7 +33471,7 @@ function apply(ctx, config2) {
|
|
|
33383
33471
|
};
|
|
33384
33472
|
}
|
|
33385
33473
|
}), "voice-host: credential setup");
|
|
33386
|
-
connected.effect(() => connected.connection
|
|
33474
|
+
connected.effect(() => registerVoiceRpc(connected.connection, "/voice-local", async (endpoint) => {
|
|
33387
33475
|
if (endpoint !== "models") return {
|
|
33388
33476
|
ok: false,
|
|
33389
33477
|
error: {
|
|
@@ -33418,7 +33506,7 @@ function apply(ctx, config2) {
|
|
|
33418
33506
|
connected.effect(() => () => {
|
|
33419
33507
|
lifetime.abort();
|
|
33420
33508
|
}, "voice-host: STS probe cancellation");
|
|
33421
|
-
connected.effect(() => connected.connection
|
|
33509
|
+
connected.effect(() => registerVoiceRpc(connected.connection, "/voice-sts", async (endpoint, payload, signal) => {
|
|
33422
33510
|
if (endpoint === "voices" && typeof payload === "object" && payload !== null && "provider" in payload && payload.provider === "kokoro") try {
|
|
33423
33511
|
const models = (await local.models()).filter((model) => model.kind === "tts");
|
|
33424
33512
|
return {
|
|
@@ -33544,7 +33632,7 @@ function apply(ctx, config2) {
|
|
|
33544
33632
|
], (connected) => {
|
|
33545
33633
|
mountPipelineTts(connected, `${config2.ttsPath}/stream`, connect, config2.stsMaxQueuedBytes ?? 1048576, config2.stsProbeTimeoutMs ?? 15e3, config2.deepgramKey);
|
|
33546
33634
|
const pipelineTool = createPipelineTools(connected);
|
|
33547
|
-
connected.effect(() => connected.connection
|
|
33635
|
+
connected.effect(() => registerVoiceRpc(connected.connection, "/voice-pipeline", async (endpoint, payload, signal) => {
|
|
33548
33636
|
if (endpoint === "tool") try {
|
|
33549
33637
|
return {
|
|
33550
33638
|
ok: true,
|
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.8",
|
|
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.8",
|
|
66
|
+
"@deepseek-ai/dsh-voice-client": "0.1.0-beta.8"
|
|
67
67
|
},
|
|
68
68
|
"bundledDependencies": [
|
|
69
69
|
"@deepseek-ai/dsh-voice-host",
|
package/provenance.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
{
|
|
8
8
|
"name": "@deepseek-ai/dsh-voice-host",
|
|
9
9
|
"sourceVersion": "0.1.2-alpha.4",
|
|
10
|
-
"hostSha256": "
|
|
10
|
+
"hostSha256": "b63c1b8e68f0faf2120f4dae213a189ea72de3da43874a523364966253ac0649"
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
13
|
"name": "@deepseek-ai/dsh-voice-client",
|