@voicemesh/dsh-voice 0.0.0-stage → 0.1.0-beta.5
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/LICENSE +21 -0
- package/LICENSE-COMPOSER +21 -0
- package/NOTICE +9 -0
- package/README.md +99 -2
- package/THIRD_PARTY_LICENSES +350 -0
- package/cordis.patch.yml +28 -0
- package/icon.svg +7 -0
- package/lib/client.js +28832 -0
- package/lib/host.js +1 -0
- package/lib/index.js +2 -0
- package/locale/en.json +6 -0
- package/locale/host/en.json +6 -0
- package/node_modules/@deepseek-ai/dsh-voice-client/lib/client.js +28677 -0
- package/node_modules/@deepseek-ai/dsh-voice-client/lib/index.js +9 -0
- package/node_modules/@deepseek-ai/dsh-voice-client/package.json +30 -0
- package/node_modules/@deepseek-ai/dsh-voice-host/lib/index.js +34304 -0
- package/node_modules/@deepseek-ai/dsh-voice-host/lib/local-runtime/package-lock.json +273 -0
- package/node_modules/@deepseek-ai/dsh-voice-host/lib/local-runtime/package.json +14 -0
- package/node_modules/@deepseek-ai/dsh-voice-host/lib/local-runtime/scripts/install_models.py +149 -0
- package/node_modules/@deepseek-ai/dsh-voice-host/lib/local-runtime/worker.mjs +76 -0
- package/node_modules/@deepseek-ai/dsh-voice-host/package.json +14 -0
- package/package.json +70 -4
- package/provenance.json +17 -0
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dsh-voice/local-runtime",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"lockfileVersion": 3,
|
|
5
|
+
"requires": true,
|
|
6
|
+
"packages": {
|
|
7
|
+
"": {
|
|
8
|
+
"name": "@dsh-voice/local-runtime",
|
|
9
|
+
"version": "0.1.0",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"sherpa-onnx-node": "1.13.8",
|
|
12
|
+
"vosk-koffi": "1.1.1"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"node_modules/agent-base": {
|
|
16
|
+
"version": "6.0.2",
|
|
17
|
+
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
|
|
18
|
+
"integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"debug": "4"
|
|
22
|
+
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">= 6.0.0"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"node_modules/debug": {
|
|
28
|
+
"version": "4.4.3",
|
|
29
|
+
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
|
30
|
+
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"ms": "^2.1.3"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=6.0"
|
|
37
|
+
},
|
|
38
|
+
"peerDependenciesMeta": {
|
|
39
|
+
"supports-color": {
|
|
40
|
+
"optional": true
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"node_modules/follow-redirects": {
|
|
45
|
+
"version": "1.16.0",
|
|
46
|
+
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.0.tgz",
|
|
47
|
+
"integrity": "sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw==",
|
|
48
|
+
"funding": [
|
|
49
|
+
{
|
|
50
|
+
"type": "individual",
|
|
51
|
+
"url": "https://github.com/sponsors/RubenVerborgh"
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
"license": "MIT",
|
|
55
|
+
"engines": {
|
|
56
|
+
"node": ">=4.0"
|
|
57
|
+
},
|
|
58
|
+
"peerDependenciesMeta": {
|
|
59
|
+
"debug": {
|
|
60
|
+
"optional": true
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"node_modules/https-proxy-agent": {
|
|
65
|
+
"version": "5.0.1",
|
|
66
|
+
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
|
|
67
|
+
"integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==",
|
|
68
|
+
"license": "MIT",
|
|
69
|
+
"dependencies": {
|
|
70
|
+
"agent-base": "6",
|
|
71
|
+
"debug": "4"
|
|
72
|
+
},
|
|
73
|
+
"engines": {
|
|
74
|
+
"node": ">= 6"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"node_modules/koffi": {
|
|
78
|
+
"version": "2.16.3",
|
|
79
|
+
"resolved": "https://registry.npmjs.org/koffi/-/koffi-2.16.3.tgz",
|
|
80
|
+
"integrity": "sha512-E9y1AsgYGlaxMhcZzHr8y96QF2U5XzA12GGVAfbWqIubTwPNMXQarfBzePNXHe0xtIEtNd6ifAv3GAKYGUeBAQ==",
|
|
81
|
+
"hasInstallScript": true,
|
|
82
|
+
"license": "MIT",
|
|
83
|
+
"funding": {
|
|
84
|
+
"url": "https://liberapay.com/Koromix"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"node_modules/mime-db": {
|
|
88
|
+
"version": "1.52.0",
|
|
89
|
+
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
|
90
|
+
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
|
91
|
+
"license": "MIT",
|
|
92
|
+
"engines": {
|
|
93
|
+
"node": ">= 0.6"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"node_modules/mime-types": {
|
|
97
|
+
"version": "2.1.35",
|
|
98
|
+
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
|
99
|
+
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
|
100
|
+
"license": "MIT",
|
|
101
|
+
"dependencies": {
|
|
102
|
+
"mime-db": "1.52.0"
|
|
103
|
+
},
|
|
104
|
+
"engines": {
|
|
105
|
+
"node": ">= 0.6"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"node_modules/ms": {
|
|
109
|
+
"version": "2.1.3",
|
|
110
|
+
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
|
111
|
+
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
|
112
|
+
"license": "MIT"
|
|
113
|
+
},
|
|
114
|
+
"node_modules/nodejs-file-downloader": {
|
|
115
|
+
"version": "4.13.0",
|
|
116
|
+
"resolved": "https://registry.npmjs.org/nodejs-file-downloader/-/nodejs-file-downloader-4.13.0.tgz",
|
|
117
|
+
"integrity": "sha512-nI2fKnmJWWFZF6SgMPe1iBodKhfpztLKJTtCtNYGhm/9QXmWa/Pk9Sv00qHgzEvNLe1x7hjGDRor7gcm/ChaIQ==",
|
|
118
|
+
"license": "ISC",
|
|
119
|
+
"dependencies": {
|
|
120
|
+
"follow-redirects": "^1.15.6",
|
|
121
|
+
"https-proxy-agent": "^5.0.0",
|
|
122
|
+
"mime-types": "^2.1.27",
|
|
123
|
+
"sanitize-filename": "^1.6.3"
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"node_modules/pend": {
|
|
127
|
+
"version": "1.2.0",
|
|
128
|
+
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
|
|
129
|
+
"integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==",
|
|
130
|
+
"license": "MIT"
|
|
131
|
+
},
|
|
132
|
+
"node_modules/sanitize-filename": {
|
|
133
|
+
"version": "1.6.4",
|
|
134
|
+
"resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.4.tgz",
|
|
135
|
+
"integrity": "sha512-9ZyI08PsvdQl2r/bBIGubpVdR3RR9sY6RDiWFPreA21C/EFlQhmgo20UZlNjZMMZNubusLhAQozkA0Od5J21Eg==",
|
|
136
|
+
"license": "WTFPL OR ISC",
|
|
137
|
+
"dependencies": {
|
|
138
|
+
"truncate-utf8-bytes": "^1.0.0"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"node_modules/sherpa-onnx-darwin-arm64": {
|
|
142
|
+
"version": "1.13.8",
|
|
143
|
+
"resolved": "https://registry.npmjs.org/sherpa-onnx-darwin-arm64/-/sherpa-onnx-darwin-arm64-1.13.8.tgz",
|
|
144
|
+
"integrity": "sha512-FPNgJMgnWVl/KhRTIhG3KL3A4Om63Rn4YKXc9/uHY7SzLcvqLJLc/h7UBWJwduXvv7K18t5NpxHR6XgXn4sjWw==",
|
|
145
|
+
"cpu": [
|
|
146
|
+
"arm64"
|
|
147
|
+
],
|
|
148
|
+
"license": "Apache-2.0",
|
|
149
|
+
"optional": true,
|
|
150
|
+
"os": [
|
|
151
|
+
"darwin"
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
"node_modules/sherpa-onnx-darwin-x64": {
|
|
155
|
+
"version": "1.13.8",
|
|
156
|
+
"resolved": "https://registry.npmjs.org/sherpa-onnx-darwin-x64/-/sherpa-onnx-darwin-x64-1.13.8.tgz",
|
|
157
|
+
"integrity": "sha512-7BLRpjM6w4f9W46/nmkmq8lEKUayhebvcpslCVQ+6QN2uReYlZEMDZlSpXMjme+hUFrPfRz8P3UNq8ep/4d19g==",
|
|
158
|
+
"cpu": [
|
|
159
|
+
"x64"
|
|
160
|
+
],
|
|
161
|
+
"license": "Apache-2.0",
|
|
162
|
+
"optional": true,
|
|
163
|
+
"os": [
|
|
164
|
+
"darwin"
|
|
165
|
+
]
|
|
166
|
+
},
|
|
167
|
+
"node_modules/sherpa-onnx-linux-arm64": {
|
|
168
|
+
"version": "1.13.8",
|
|
169
|
+
"resolved": "https://registry.npmjs.org/sherpa-onnx-linux-arm64/-/sherpa-onnx-linux-arm64-1.13.8.tgz",
|
|
170
|
+
"integrity": "sha512-Tlg7a70b/Wge3OF8IgTHF9jhSVCsLyKQKhwc4BsJ5A+dL/SrFtGBjzuHp4XeLhiiOT7afCxX5PdSn/D4c8Lnuw==",
|
|
171
|
+
"cpu": [
|
|
172
|
+
"arm64"
|
|
173
|
+
],
|
|
174
|
+
"license": "Apache-2.0",
|
|
175
|
+
"optional": true,
|
|
176
|
+
"os": [
|
|
177
|
+
"linux"
|
|
178
|
+
]
|
|
179
|
+
},
|
|
180
|
+
"node_modules/sherpa-onnx-linux-x64": {
|
|
181
|
+
"version": "1.13.8",
|
|
182
|
+
"resolved": "https://registry.npmjs.org/sherpa-onnx-linux-x64/-/sherpa-onnx-linux-x64-1.13.8.tgz",
|
|
183
|
+
"integrity": "sha512-6plnhjagsSeTntCgnlag86hWbs/uZE9Crms1LgOb68/1nKsIQjMd+WG519m+aPwT6TrsBOiEMzrx41t8sL5L5g==",
|
|
184
|
+
"cpu": [
|
|
185
|
+
"x64"
|
|
186
|
+
],
|
|
187
|
+
"license": "Apache-2.0",
|
|
188
|
+
"optional": true,
|
|
189
|
+
"os": [
|
|
190
|
+
"linux"
|
|
191
|
+
]
|
|
192
|
+
},
|
|
193
|
+
"node_modules/sherpa-onnx-node": {
|
|
194
|
+
"version": "1.13.8",
|
|
195
|
+
"resolved": "https://registry.npmjs.org/sherpa-onnx-node/-/sherpa-onnx-node-1.13.8.tgz",
|
|
196
|
+
"integrity": "sha512-MsDMBdhLFTZ1GwvcGSSQhnS7g/EA8OMH6IYysCVUOM7j8Icty9KRc0E6YT1A5fWBsZwRfKOeh88QC95aRvS8ag==",
|
|
197
|
+
"license": "Apache-2.0",
|
|
198
|
+
"optionalDependencies": {
|
|
199
|
+
"sherpa-onnx-darwin-arm64": "^1.13.8",
|
|
200
|
+
"sherpa-onnx-darwin-x64": "^1.13.8",
|
|
201
|
+
"sherpa-onnx-linux-arm64": "^1.13.8",
|
|
202
|
+
"sherpa-onnx-linux-x64": "^1.13.8",
|
|
203
|
+
"sherpa-onnx-win-ia32": "^1.13.8",
|
|
204
|
+
"sherpa-onnx-win-x64": "^1.13.8"
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
"node_modules/sherpa-onnx-win-ia32": {
|
|
208
|
+
"version": "1.13.8",
|
|
209
|
+
"resolved": "https://registry.npmjs.org/sherpa-onnx-win-ia32/-/sherpa-onnx-win-ia32-1.13.8.tgz",
|
|
210
|
+
"integrity": "sha512-H0Ojln9hfvM+pxWqW0cnjB/XK8/JPq4/k0IWu2JpY5Z458M3zv+XC3Hu+wmot3AoH/K1Bgt23n/tTKtPV9x8qg==",
|
|
211
|
+
"cpu": [
|
|
212
|
+
"ia32"
|
|
213
|
+
],
|
|
214
|
+
"license": "Apache-2.0",
|
|
215
|
+
"optional": true,
|
|
216
|
+
"os": [
|
|
217
|
+
"win32"
|
|
218
|
+
]
|
|
219
|
+
},
|
|
220
|
+
"node_modules/sherpa-onnx-win-x64": {
|
|
221
|
+
"version": "1.13.8",
|
|
222
|
+
"resolved": "https://registry.npmjs.org/sherpa-onnx-win-x64/-/sherpa-onnx-win-x64-1.13.8.tgz",
|
|
223
|
+
"integrity": "sha512-oZF1c9VPOKtMwn83Bboc5XSWL+76BRoyB3eUuVnCknBKxwSULZU2Foia9VHWzU+n4I12rPsP6z6H9Rp1hD9o8g==",
|
|
224
|
+
"cpu": [
|
|
225
|
+
"x64"
|
|
226
|
+
],
|
|
227
|
+
"license": "Apache-2.0",
|
|
228
|
+
"optional": true,
|
|
229
|
+
"os": [
|
|
230
|
+
"win32"
|
|
231
|
+
]
|
|
232
|
+
},
|
|
233
|
+
"node_modules/truncate-utf8-bytes": {
|
|
234
|
+
"version": "1.0.2",
|
|
235
|
+
"resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz",
|
|
236
|
+
"integrity": "sha512-95Pu1QXQvruGEhv62XCMO3Mm90GscOCClvrIUwCM0PYOXK3kaF3l3sIHxx71ThJfcbM2O5Au6SO3AWCSEfW4mQ==",
|
|
237
|
+
"license": "WTFPL",
|
|
238
|
+
"dependencies": {
|
|
239
|
+
"utf8-byte-length": "^1.0.1"
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
"node_modules/utf8-byte-length": {
|
|
243
|
+
"version": "1.0.5",
|
|
244
|
+
"resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.5.tgz",
|
|
245
|
+
"integrity": "sha512-Xn0w3MtiQ6zoz2vFyUVruaCL53O/DwUvkEeOvj+uulMm0BkUGYWmBYVyElqZaSLhY6ZD0ulfU3aBra2aVT4xfA==",
|
|
246
|
+
"license": "(WTFPL OR MIT)"
|
|
247
|
+
},
|
|
248
|
+
"node_modules/vosk-koffi": {
|
|
249
|
+
"version": "1.1.1",
|
|
250
|
+
"resolved": "https://registry.npmjs.org/vosk-koffi/-/vosk-koffi-1.1.1.tgz",
|
|
251
|
+
"integrity": "sha512-upZi+G6bKugFzuqY5Wd0ay9eZmYfx5IbyWfSLVFS0rATxWd5TkF6T0syXPYxhKfW9YP/qyQjItJ2OO63L3o4cw==",
|
|
252
|
+
"hasInstallScript": true,
|
|
253
|
+
"license": "MIT",
|
|
254
|
+
"dependencies": {
|
|
255
|
+
"koffi": "^2.8.6",
|
|
256
|
+
"nodejs-file-downloader": "^4.12.1",
|
|
257
|
+
"yauzl": "^3.1.2"
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
"node_modules/yauzl": {
|
|
261
|
+
"version": "3.4.0",
|
|
262
|
+
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-3.4.0.tgz",
|
|
263
|
+
"integrity": "sha512-jIH9yLR9wqr0wOS0TpBvo/g/2UgZH5qePVbjgRliiF0BYvOZyaBknKsF+x9Iht0O6sqgnB93rCICdOZFecJuDw==",
|
|
264
|
+
"license": "MIT",
|
|
265
|
+
"dependencies": {
|
|
266
|
+
"pend": "~1.2.0"
|
|
267
|
+
},
|
|
268
|
+
"engines": {
|
|
269
|
+
"node": ">=12"
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dsh-voice/local-runtime",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "Optional native Vosk and Kokoro inference worker for the DSH voice plugin.",
|
|
7
|
+
"exports": {
|
|
8
|
+
"./worker": "./worker.mjs"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"vosk-koffi": "1.1.1",
|
|
12
|
+
"sherpa-onnx-node": "1.13.8"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"""Install optional English/Chinese model packs; voice names come from provider metadata."""
|
|
2
|
+
import argparse
|
|
3
|
+
import html
|
|
4
|
+
import json
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
import re
|
|
7
|
+
import tarfile
|
|
8
|
+
import urllib.request
|
|
9
|
+
import zipfile
|
|
10
|
+
import shutil
|
|
11
|
+
import subprocess
|
|
12
|
+
import tempfile
|
|
13
|
+
import time
|
|
14
|
+
import sys
|
|
15
|
+
import hashlib
|
|
16
|
+
|
|
17
|
+
BASE = "https://alphacephei.com/vosk/models/"
|
|
18
|
+
KOKORO = "kokoro-{precision}multi-lang-"
|
|
19
|
+
KOKORO_SOURCE = "https://k2-fsa.github.io/sherpa/onnx/tts/all/Chinese-English/kokoro-multi-lang-"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def progress(phase, downloaded=0, total=0):
|
|
23
|
+
print(json.dumps({"phase": phase, "downloaded": downloaded, "total": total}), flush=True)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def install(root, name, url):
|
|
27
|
+
target = root / name
|
|
28
|
+
if target.is_dir():
|
|
29
|
+
return target
|
|
30
|
+
with tempfile.TemporaryDirectory(prefix=".install-", dir=root) as temp:
|
|
31
|
+
staging = Path(temp)
|
|
32
|
+
archive = staging / url.rsplit("/", 1)[1]
|
|
33
|
+
progress("downloading")
|
|
34
|
+
with urllib.request.urlopen(url, timeout=60) as response, archive.open("wb") as output:
|
|
35
|
+
total = int(response.headers.get("Content-Length", 0))
|
|
36
|
+
count, last = 0, 0
|
|
37
|
+
while chunk := response.read(1024 * 1024):
|
|
38
|
+
output.write(chunk)
|
|
39
|
+
count += len(chunk)
|
|
40
|
+
if time.monotonic() - last > 0.25:
|
|
41
|
+
progress("downloading", count, total)
|
|
42
|
+
last = time.monotonic()
|
|
43
|
+
progress("downloading", count, total)
|
|
44
|
+
progress("extracting")
|
|
45
|
+
if archive.suffix == ".zip":
|
|
46
|
+
with zipfile.ZipFile(archive) as source:
|
|
47
|
+
for member in source.namelist():
|
|
48
|
+
if not (staging / member).resolve().is_relative_to(staging.resolve()):
|
|
49
|
+
raise ValueError("Archive contains an unsafe path")
|
|
50
|
+
source.extractall(staging)
|
|
51
|
+
else:
|
|
52
|
+
with tarfile.open(archive) as source:
|
|
53
|
+
source.extractall(staging, filter="data")
|
|
54
|
+
extracted = staging / name
|
|
55
|
+
if not extracted.is_dir():
|
|
56
|
+
raise ValueError("Archive does not contain the selected model")
|
|
57
|
+
extracted.rename(target)
|
|
58
|
+
return target
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def voice_metadata(page):
|
|
62
|
+
"""Read provider speaker IDs; prefix conventions supply locale and gender."""
|
|
63
|
+
locales = {
|
|
64
|
+
"a": ("en-US", "American"), "b": ("en-GB", "British"),
|
|
65
|
+
"z": ("zh-CN", "Chinese"), "e": ("es-ES", "Spanish"),
|
|
66
|
+
"f": ("fr-FR", "French"), "h": ("hi-IN", "Indian"),
|
|
67
|
+
"i": ("it-IT", "Italian"), "j": ("ja-JP", "Japanese"),
|
|
68
|
+
"p": ("pt-BR", "Brazilian"),
|
|
69
|
+
}
|
|
70
|
+
voices = []
|
|
71
|
+
for sid, code in re.findall(r"<td>(\d+) -> ([a-z]{2}_[a-z0-9_]+)</td>", html.unescape(page)):
|
|
72
|
+
prefix, name = code.split("_", 1)
|
|
73
|
+
locale, region = locales[prefix[0]]
|
|
74
|
+
label = name.replace("_", " ").title() if not name.isdigit() else code.upper().replace("_", " ")
|
|
75
|
+
voices.append({"id": sid, "name": label, "languages": [locale],
|
|
76
|
+
"gender": "female" if prefix[1] == "f" else "male", "region": region})
|
|
77
|
+
if not voices or len({v["id"] for v in voices}) != len(voices):
|
|
78
|
+
raise ValueError("Provider voice metadata is missing or ambiguous")
|
|
79
|
+
return voices
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def main():
|
|
83
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
84
|
+
parser.add_argument("directory", type=Path)
|
|
85
|
+
parser.add_argument("--kind", choices=["stt", "tts", "both"], default="both")
|
|
86
|
+
parser.add_argument("--runtime", type=Path)
|
|
87
|
+
parser.add_argument("--languages", nargs="+", choices=["en", "zh"], default=["en", "zh"])
|
|
88
|
+
parser.add_argument("--kokoro-version", choices=["v1_0", "v1_1"], default="v1_0")
|
|
89
|
+
parser.add_argument("--precision", choices=["fp32", "int8"], default="fp32")
|
|
90
|
+
args = parser.parse_args()
|
|
91
|
+
args.directory.mkdir(parents=True, exist_ok=True)
|
|
92
|
+
if args.runtime:
|
|
93
|
+
progress("runtime")
|
|
94
|
+
npm = shutil.which("npm")
|
|
95
|
+
if not npm:
|
|
96
|
+
raise RuntimeError("Node.js and npm are required to install local speech")
|
|
97
|
+
fingerprint = hashlib.sha256((args.runtime / "package-lock.json").read_bytes()).hexdigest()
|
|
98
|
+
marker = args.runtime / ".installed-lock"
|
|
99
|
+
if not marker.exists() or marker.read_text() != fingerprint or not (args.runtime / "node_modules").is_dir():
|
|
100
|
+
subprocess.run([npm, "ci", "--no-audit", "--no-fund"], cwd=args.runtime,
|
|
101
|
+
stdout=sys.stderr, stderr=sys.stderr, check=True)
|
|
102
|
+
marker.write_text(fingerprint)
|
|
103
|
+
|
|
104
|
+
for language in (args.languages if args.kind != "tts" else []):
|
|
105
|
+
model, name, locale = (
|
|
106
|
+
("vosk-model-small-en-us-0.15", "Vosk English (US), small", "en-US")
|
|
107
|
+
if language == "en" else ("vosk-model-small-cn-0.22", "Vosk Chinese, small", "zh-CN")
|
|
108
|
+
)
|
|
109
|
+
directory = install(args.directory, model, BASE + model + ".zip")
|
|
110
|
+
(directory / "voice-model.json").write_text(json.dumps({
|
|
111
|
+
"kind": "stt", "name": name, "languages": [locale], "sourceUrl": BASE,
|
|
112
|
+
}, indent=2) + "\n", encoding="utf-8")
|
|
113
|
+
if args.kind == "stt":
|
|
114
|
+
progress("complete")
|
|
115
|
+
return
|
|
116
|
+
model_id = KOKORO.format(precision="int8-" if args.precision == "int8" else "") + args.kokoro_version
|
|
117
|
+
source_url = KOKORO_SOURCE + args.kokoro_version + ".html"
|
|
118
|
+
directory = install(args.directory, model_id,
|
|
119
|
+
"https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/" + model_id + ".tar.bz2")
|
|
120
|
+
with urllib.request.urlopen(source_url, timeout=30) as response:
|
|
121
|
+
voices = voice_metadata(response.read().decode())
|
|
122
|
+
(directory / "voice-model.json").write_text(json.dumps({
|
|
123
|
+
"kind": "tts", "name": "Kokoro " + args.kokoro_version.replace("_", ".") + " " + args.precision.upper(), "languages": sorted({locale for voice in voices for locale in voice["languages"]}),
|
|
124
|
+
"sourceUrl": source_url, "voices": voices,
|
|
125
|
+
"kokoro": {"model": "model.int8.onnx" if args.precision == "int8" else "model.onnx", "voices": "voices.bin", "tokens": "tokens.txt",
|
|
126
|
+
"dataDir": "espeak-ng-data", "lexicon": "lexicon-us-en.txt,lexicon-zh.txt", "dictDir": "dict"},
|
|
127
|
+
}, indent=2) + "\n", encoding="utf-8")
|
|
128
|
+
progress("complete")
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
if __name__ == "__main__":
|
|
132
|
+
if sys.version_info < (3, 12):
|
|
133
|
+
raise RuntimeError("Python 3.12 or newer is required")
|
|
134
|
+
if len(sys.argv) < 2 or sys.argv[1].startswith("-"):
|
|
135
|
+
main()
|
|
136
|
+
else:
|
|
137
|
+
root = Path(sys.argv[1])
|
|
138
|
+
root.mkdir(parents=True, exist_ok=True)
|
|
139
|
+
with (root / ".install.lock").open("a+b") as lock:
|
|
140
|
+
if sys.platform == "win32":
|
|
141
|
+
import msvcrt
|
|
142
|
+
lock.write(b"0")
|
|
143
|
+
lock.flush()
|
|
144
|
+
lock.seek(0)
|
|
145
|
+
msvcrt.locking(lock.fileno(), msvcrt.LK_NBLCK, 1)
|
|
146
|
+
else:
|
|
147
|
+
import fcntl
|
|
148
|
+
fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
|
149
|
+
main()
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/** Optional native inference worker. Only the host-selected installed model is loaded. */
|
|
2
|
+
import { parentPort, workerData } from 'node:worker_threads'
|
|
3
|
+
import { createRequire } from 'node:module'
|
|
4
|
+
const require = createRequire(import.meta.url)
|
|
5
|
+
const { kind, model, threads } = workerData
|
|
6
|
+
let recognizer
|
|
7
|
+
let engine
|
|
8
|
+
let completed = ''
|
|
9
|
+
let disposing = false
|
|
10
|
+
let generating = false
|
|
11
|
+
try {
|
|
12
|
+
if (kind === 'stt') {
|
|
13
|
+
const vosk = require('vosk-koffi')
|
|
14
|
+
vosk.setLogLevel(-1)
|
|
15
|
+
engine = new vosk.Model(model.path)
|
|
16
|
+
recognizer = new vosk.Recognizer({ model: engine, sampleRate: 16000 })
|
|
17
|
+
parentPort.postMessage({ type: 'ready' })
|
|
18
|
+
} else {
|
|
19
|
+
const { OfflineTts } = require('sherpa-onnx-node')
|
|
20
|
+
engine = new OfflineTts({ model: { kokoro: model.kokoro, numThreads: threads, provider: 'cpu' }, maxNumSentences: 1 })
|
|
21
|
+
parentPort.postMessage({ type: 'ready', sampleRate: engine.sampleRate, speakers: engine.numSpeakers })
|
|
22
|
+
}
|
|
23
|
+
} catch (error) {
|
|
24
|
+
parentPort.postMessage({ type: 'error', error: error.message })
|
|
25
|
+
parentPort.close()
|
|
26
|
+
}
|
|
27
|
+
const join = (...texts) => texts.filter(Boolean).join(' ').trim()
|
|
28
|
+
const close = () => {
|
|
29
|
+
recognizer?.free()
|
|
30
|
+
if (kind === 'stt') engine?.free()
|
|
31
|
+
recognizer = undefined
|
|
32
|
+
engine = undefined
|
|
33
|
+
parentPort.close()
|
|
34
|
+
}
|
|
35
|
+
parentPort.on('message', async (request) => {
|
|
36
|
+
try {
|
|
37
|
+
if (request.type === 'dispose') {
|
|
38
|
+
disposing = true
|
|
39
|
+
if (!generating) close()
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
if (disposing) return
|
|
43
|
+
if (kind === 'stt') {
|
|
44
|
+
if (request.type === 'audio') {
|
|
45
|
+
const endpoint = recognizer.acceptWaveform(Buffer.from(request.audio))
|
|
46
|
+
if (endpoint) completed = join(completed, recognizer.result().text)
|
|
47
|
+
const text = join(completed, endpoint ? '' : recognizer.partialResult().partial)
|
|
48
|
+
parentPort.postMessage({ id: request.id, type: 'result', text })
|
|
49
|
+
} else if (request.type === 'final') {
|
|
50
|
+
const text = join(completed, recognizer.finalResult().text)
|
|
51
|
+
recognizer.reset()
|
|
52
|
+
completed = ''
|
|
53
|
+
parentPort.postMessage({ id: request.id, type: 'result', text })
|
|
54
|
+
}
|
|
55
|
+
} else if (request.type === 'speak') {
|
|
56
|
+
if (generating) throw new Error('Local synthesis is already active')
|
|
57
|
+
generating = true
|
|
58
|
+
const send = samples => {
|
|
59
|
+
if (!disposing && samples.length) parentPort.postMessage({ id: request.id, type: 'chunk', samples, sampleRate: engine.sampleRate })
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
await engine.generateAsync({ text: request.text, sid: request.speaker, speed: 1, onProgress: ({ samples }) => {
|
|
63
|
+
if (disposing) return 0
|
|
64
|
+
send(samples)
|
|
65
|
+
return 1
|
|
66
|
+
} })
|
|
67
|
+
if (!disposing) {
|
|
68
|
+
parentPort.postMessage({ id: request.id, type: 'audio' })
|
|
69
|
+
}
|
|
70
|
+
} finally {
|
|
71
|
+
generating = false
|
|
72
|
+
if (disposing) close()
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
} catch (error) { if (!disposing) parentPort.postMessage({ id: request.id, type: 'error', error: error.message }) }
|
|
76
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@deepseek-ai/dsh-voice-host",
|
|
3
|
+
"version": "0.1.0-beta.5",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"description": "Connects speech recognition, conversational models, and voice playback for live voice conversations.",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./lib/index.js",
|
|
10
|
+
"./package.json": "./package.json"
|
|
11
|
+
},
|
|
12
|
+
"peerDependencies": {},
|
|
13
|
+
"peerDependenciesMeta": {}
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,72 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voicemesh/dsh-voice",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
}
|
|
3
|
+
"version": "0.1.0-beta.5",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"type": "module",
|
|
8
|
+
"description": "Talk with your coding agent using live speech; first use may require installing local speech models or configuring a supported cloud provider.",
|
|
9
|
+
"icon": "./icon.svg",
|
|
10
|
+
"author": {
|
|
11
|
+
"name": "Hopeton Palmer",
|
|
12
|
+
"url": "https://github.com/hopetonp"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/hopetonp/voicemesh-dsh-voice.git"
|
|
17
|
+
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"homepage": "https://github.com/hopetonp/voicemesh-dsh-voice#readme",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/hopetonp/voicemesh-dsh-voice/issues"
|
|
22
|
+
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=22.19"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"icon.svg",
|
|
28
|
+
"lib",
|
|
29
|
+
"locale",
|
|
30
|
+
"cordis.patch.yml",
|
|
31
|
+
"provenance.json",
|
|
32
|
+
"README.md",
|
|
33
|
+
"LICENSE",
|
|
34
|
+
"LICENSE-COMPOSER",
|
|
35
|
+
"NOTICE",
|
|
36
|
+
"THIRD_PARTY_LICENSES"
|
|
37
|
+
],
|
|
38
|
+
"exports": {
|
|
39
|
+
".": "./lib/index.js",
|
|
40
|
+
"./host": "./lib/host.js",
|
|
41
|
+
"./client": "./lib/client.js",
|
|
42
|
+
"./locale/*.json": "./locale/*.json",
|
|
43
|
+
"./host/locale/*.json": "./locale/host/*.json",
|
|
44
|
+
"./package.json": "./package.json"
|
|
45
|
+
},
|
|
46
|
+
"dsh": {
|
|
47
|
+
"bundle": {
|
|
48
|
+
"patch": "./cordis.patch.yml"
|
|
49
|
+
},
|
|
50
|
+
"client": {
|
|
51
|
+
"inject": [
|
|
52
|
+
"@deepseek-ai/dsh-api-remotes",
|
|
53
|
+
"@deepseek-ai/dsh-api-session-controller",
|
|
54
|
+
"@deepseek-ai/dsh-client-locale",
|
|
55
|
+
"@deepseek-ai/dsh-client-ui-chat",
|
|
56
|
+
"@deepseek-ai/dsh-client-ui-conversation",
|
|
57
|
+
"@deepseek-ai/dsh-client-ui-layout",
|
|
58
|
+
"@deepseek-ai/dsh-client-ui-renderer",
|
|
59
|
+
"@deepseek-ai/dsh-client-ui-session"
|
|
60
|
+
],
|
|
61
|
+
"platform": "web"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"dependencies": {
|
|
65
|
+
"@deepseek-ai/dsh-voice-host": "0.1.0-beta.5",
|
|
66
|
+
"@deepseek-ai/dsh-voice-client": "0.1.0-beta.5"
|
|
67
|
+
},
|
|
68
|
+
"bundledDependencies": [
|
|
69
|
+
"@deepseek-ai/dsh-voice-host",
|
|
70
|
+
"@deepseek-ai/dsh-voice-client"
|
|
71
|
+
]
|
|
72
|
+
}
|
package/provenance.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "@voicemesh/composer",
|
|
4
|
+
"sourceVersion": "0.2.17",
|
|
5
|
+
"buildSha256": "6d9585f5af628b650f3cb3462612b216c5d639fd57c15069039f2b6b9f896faf"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"name": "@deepseek-ai/dsh-voice-host",
|
|
9
|
+
"sourceVersion": "0.1.2-alpha.4",
|
|
10
|
+
"hostSha256": "51b1301880563a2edbcc44bdaf17f261f081c14acab344d0d3447f88fb7c444f"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "@deepseek-ai/dsh-voice-client",
|
|
14
|
+
"sourceVersion": "0.1.7-alpha.2",
|
|
15
|
+
"hostSha256": "176b533e4d22d2ece6eb8e29848da0f3108b4dcb79034207fdb222953f00eae7"
|
|
16
|
+
}
|
|
17
|
+
]
|