dsh-listener 0.3.10
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/CHANGELOG.md +93 -0
- package/LICENSE +21 -0
- package/README.md +67 -0
- package/THIRD_PARTY_NOTICES.md +52 -0
- package/cordis.patch.yml +3 -0
- package/docs/PUBLISHING.md +34 -0
- package/docs/UPDATES.md +83 -0
- package/docs/VALIDATION.md +76 -0
- package/lib/client.js +1095 -0
- package/lib/index.js +784 -0
- package/lib/pcm-worklet.js +38 -0
- package/package.json +99 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Native Web Audio runs at 16 kHz. Only PCM16 mono crosses the plugin transport.
|
|
2
|
+
class ListenerPCM extends AudioWorkletProcessor {
|
|
3
|
+
constructor() {
|
|
4
|
+
super()
|
|
5
|
+
this.samples = new Int16Array(1600)
|
|
6
|
+
this.offset = 0
|
|
7
|
+
this.active = true
|
|
8
|
+
this.port.onmessage = event => {
|
|
9
|
+
if (event.data === 'stop') {
|
|
10
|
+
this.active = false
|
|
11
|
+
this.flush()
|
|
12
|
+
this.port.postMessage({ stopped: true })
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
flush() {
|
|
17
|
+
if (!this.offset) return
|
|
18
|
+
const bytes = new ArrayBuffer(this.offset * 2)
|
|
19
|
+
const view = new DataView(bytes)
|
|
20
|
+
for (let i = 0; i < this.offset; i++) view.setInt16(i * 2, this.samples[i], true)
|
|
21
|
+
this.port.postMessage(bytes, [bytes])
|
|
22
|
+
this.offset = 0
|
|
23
|
+
}
|
|
24
|
+
process(inputs) {
|
|
25
|
+
if (!this.active) return false
|
|
26
|
+
const channels = inputs[0]
|
|
27
|
+
if (!channels || !channels[0]) return true
|
|
28
|
+
for (let i = 0; i < channels[0].length; i++) {
|
|
29
|
+
let sample = 0
|
|
30
|
+
for (const channel of channels) sample += channel[i] / channels.length
|
|
31
|
+
sample = Math.max(-1, Math.min(1, sample))
|
|
32
|
+
this.samples[this.offset++] = Math.round(sample * (sample < 0 ? 32768 : 32767))
|
|
33
|
+
if (this.offset === this.samples.length) this.flush()
|
|
34
|
+
}
|
|
35
|
+
return true
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
registerProcessor('dsh-listener-pcm', ListenerPCM)
|
package/package.json
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-listener",
|
|
3
|
+
"version": "0.3.10",
|
|
4
|
+
"description": "DeepSeek Harness 云端语音输入插件,支持快捷键录音、阿里云百炼实时识别,并将文字追加到当前会话草稿。",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/gone1724/dsh-listener.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/gone1724/dsh-listener#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/gone1724/dsh-listener/issues"
|
|
13
|
+
},
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public",
|
|
16
|
+
"registry": "https://registry.npmjs.org",
|
|
17
|
+
"tag": "latest"
|
|
18
|
+
},
|
|
19
|
+
"type": "module",
|
|
20
|
+
"main": "lib/index.js",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": "./lib/index.js",
|
|
23
|
+
"./package.json": "./package.json",
|
|
24
|
+
"./client": "./lib/client.js",
|
|
25
|
+
"./cordis.patch.yml": "./cordis.patch.yml"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"lib",
|
|
29
|
+
"cordis.patch.yml",
|
|
30
|
+
"README.md",
|
|
31
|
+
"CHANGELOG.md",
|
|
32
|
+
"docs/VALIDATION.md",
|
|
33
|
+
"docs/UPDATES.md",
|
|
34
|
+
"docs/PUBLISHING.md",
|
|
35
|
+
"LICENSE",
|
|
36
|
+
"THIRD_PARTY_NOTICES.md"
|
|
37
|
+
],
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": "^22.19.0 || >=24.0.0"
|
|
40
|
+
},
|
|
41
|
+
"keywords": [
|
|
42
|
+
"dsh-plugin",
|
|
43
|
+
"deepseek-harness",
|
|
44
|
+
"voice-input",
|
|
45
|
+
"dashscope",
|
|
46
|
+
"asr"
|
|
47
|
+
],
|
|
48
|
+
"dsh": {
|
|
49
|
+
"bundle": {
|
|
50
|
+
"patch": "./cordis.patch.yml"
|
|
51
|
+
},
|
|
52
|
+
"client": {
|
|
53
|
+
"platform": "web",
|
|
54
|
+
"inject": [
|
|
55
|
+
"@deepseek-ai/dsh-client-ui-conversation",
|
|
56
|
+
"@deepseek-ai/dsh-client-ui-settings",
|
|
57
|
+
"@deepseek-ai/dsh-client-ui-renderer"
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"@deepseek-ai/dsh-hmr": "0.2.0-rc.2",
|
|
63
|
+
"@deepseek-ai/dsh-plugin-manager": "0.2.0-rc.2",
|
|
64
|
+
"ws": "^8.18.3"
|
|
65
|
+
},
|
|
66
|
+
"peerDependencies": {
|
|
67
|
+
"@deepseek-ai/cordis": "4.0.4",
|
|
68
|
+
"@deepseek-ai/dsh-client-connection": "0.2.0-rc.2",
|
|
69
|
+
"@deepseek-ai/dsh-client-ui-conversation": "0.2.0-rc.2",
|
|
70
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.2.0-rc.2",
|
|
71
|
+
"@deepseek-ai/dsh-client-ui-session": "0.2.0-rc.2",
|
|
72
|
+
"@deepseek-ai/dsh-client-ui-settings": "0.2.0-rc.2",
|
|
73
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.2.0-rc.2",
|
|
74
|
+
"@deepseek-ai/dsh-credentials": "0.2.0-rc.2",
|
|
75
|
+
"@deepseek-ai/dsh-host-webserver": "0.2.0-rc.2",
|
|
76
|
+
"@deepseek-ai/dsh-settings": "0.2.0-rc.2",
|
|
77
|
+
"@deepseek-ai/schemastery": "3.18.4",
|
|
78
|
+
"react": "^18.2.0"
|
|
79
|
+
},
|
|
80
|
+
"devDependencies": {
|
|
81
|
+
"@deepseek-ai/cordis": "4.0.4",
|
|
82
|
+
"@deepseek-ai/dsh": "0.2.0-rc.2",
|
|
83
|
+
"@deepseek-ai/dsh-client-ui-session": "0.2.0-rc.2",
|
|
84
|
+
"@deepseek-ai/schemastery": "3.18.4",
|
|
85
|
+
"@types/node": "^22.0.0",
|
|
86
|
+
"@types/react": "^18.3.0",
|
|
87
|
+
"@types/ws": "^8.18.1",
|
|
88
|
+
"esbuild": "^0.25.0",
|
|
89
|
+
"typescript": "^5.9.3",
|
|
90
|
+
"vitest": "^3.2.0"
|
|
91
|
+
},
|
|
92
|
+
"scripts": {
|
|
93
|
+
"build": "node scripts/build.mjs",
|
|
94
|
+
"typecheck": "tsc --noEmit",
|
|
95
|
+
"test": "vitest run",
|
|
96
|
+
"check": "pnpm typecheck && pnpm test && pnpm build",
|
|
97
|
+
"verify:package": "pnpm pack --pack-destination output && node scripts/verify-package.mjs"
|
|
98
|
+
}
|
|
99
|
+
}
|