dsh-mic-dictation 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/README.md +146 -48
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,77 +1,175 @@
1
- # dsh-mic-dictation
1
+ # 🎤 dsh-mic-dictation
2
2
 
3
- DeepSeek Harness 原生客户端插件:在 Web 提问栏的 **Full access 左侧** 插入一个麦克风按钮,点一下直接说话,识别文字写进提问框。
3
+ <p align="center">
4
+ <a href="https://www.npmjs.com/package/dsh-mic-dictation"><img src="https://img.shields.io/npm/v/dsh-mic-dictation" alt="npm version"></a>
5
+ <a href="https://github.com/Kilganon725/dsh-mic-dictation/releases"><img src="https://img.shields.io/github/v/release/Kilganon725/dsh-mic-dictation" alt="GitHub release"></a>
6
+ <a href="https://github.com/Kilganon725/dsh-mic-dictation/blob/main/LICENSE"><img src="https://img.shields.io/github/license/Kilganon725/dsh-mic-dictation" alt="License"></a>
7
+ </p>
4
8
 
5
- - 浏览器原生 `SpeechRecognition`,中文识别(`zh-CN`)
6
- - 无需外部 API Key
7
- - 纯客户端插件:host 半是空 `apply`,浏览器半通过 `dsh.client` 清单发货
8
- - 用 `MutationObserver` 盯住 DSH 的 React DOM,把按钮稳定地放在 Full access(访问模式)按钮左边
9
+ **dsh-mic-dictation** 是一个 DeepSeek Harness 原生客户端插件:它在 Web 提问栏的 **Full access 左侧** 加一个麦克风按钮,让你直接用电脑麦克风说话布置任务,识别出的文字会自动写进提问框。
9
10
 
10
- ## 目录
11
+ - 🎙️ 浏览器原生语音识别,中文优先(`zh-CN`)
12
+ - 🔌 纯客户端插件,安装即用,无需改 DSH 源码
13
+ - 🔐 不索取、不存储任何 API Key 或账号信息
14
+ - ♻️ 自动跟随 React 重渲染,按钮始终待在 Full access 左边
15
+ - 🧹 HMR / 插件卸载时自动清理按钮、样式与监听器
11
16
 
12
- ```text
13
- dsh-mic-dictation/
14
- ├── package.json # 插件清单 + dsh.client / dsh.bundle 声明
15
- ├── cordis.patch.yml # bundle patch:把本插件插入 web profile
16
- ├── lib/
17
- │ ├── index.js # host half(空 apply)
18
- │ ├── index.d.ts
19
- │ ├── client.js # 浏览器 half(lazy-CJS factory bundle)
20
- │ └── client.d.ts
21
- ├── README.md
22
- └── LICENSE
23
- ```
17
+ ---
18
+
19
+ ## 效果演示
20
+
21
+ <div align="center">
22
+ <img src="docs/images/screenshot-composer.png" width="720" alt="提问栏麦克风按钮演示">
23
+ <p><sub>麦克风按钮出现在 Full access 左侧</sub></p>
24
+ </div>
25
+
26
+ <div align="center">
27
+ <img src="docs/images/screenshot-install.png" width="720" alt="安装命令演示">
28
+ <p><sub>安装后重启 dsh web 即可使用</sub></p>
29
+ </div>
30
+
31
+ > 说明:以上为产品演示图;实际界面以你的 DSH 版本与主题为准。
32
+
33
+ ---
34
+
35
+ ## 环境要求
24
36
 
25
- ## 安装到自己的 DeepSeek Harness
37
+ | 项目 | 要求 |
38
+ | --- | --- |
39
+ | DeepSeek Harness | Web profile(`dsh web`) |
40
+ | 浏览器 | Chrome / Edge / Safari |
41
+ | 页面地址 | localhost 或 127.0.0.1(浏览器安全上下文要求) |
42
+ | 网络 | Chrome 语音识别依赖 Google 语音服务,需联网 |
43
+ | 包管理器 | 安装插件需要 pnpm(`dsh plugin` 内部调用 pnpm) |
26
44
 
27
- 先发布到 npm 或 GitHub,然后用户在自己的终端里执行:
45
+ ---
46
+
47
+ ## 安装
48
+
49
+ ### 从 npm 安装(推荐)
28
50
 
29
51
  ```bash
30
- # 从 npm 安装
31
52
  dsh plugin --profile web add dsh-mic-dictation
53
+ ```
54
+
55
+ ### 从 GitHub 安装
32
56
 
33
- # 或从 GitHub 安装(pnpm 会直接安装该仓库)
34
- dsh plugin --profile web add github:你的用户名/dsh-mic-dictation
57
+ ```bash
58
+ # 安装最新 main 分支
59
+ dsh plugin --profile web add github:Kilganon725/dsh-mic-dictation
60
+
61
+ # 或安装指定版本
62
+ dsh plugin --profile web add github:Kilganon725/dsh-mic-dictation#v0.1.0
35
63
  ```
36
64
 
37
- 重启 Web:
65
+ ### 启动
38
66
 
39
67
  ```bash
40
68
  dsh web
41
69
  ```
42
70
 
43
- 刷新页面后,首次点麦克风并允许浏览器使用麦克风即可。
71
+ 刷新页面后,提问栏 **Full access 左侧** 会出现麦克风按钮。首次点击时,浏览器会请求麦克风权限,选择 **允许**。
44
72
 
45
- > 说明:当前 DSH 版本的「插件市场」是**只读清单**(设置 → 插件列表);安装入口是 `dsh plugin --profile web add ...`。等官方市场 UI 上线后,只要这个包发布在 npm/GitHub,就能被市场检索到。
73
+ ---
46
74
 
47
- ## 发布到 GitHub / npm
75
+ ## 使用方法
48
76
 
49
- ### GitHub
77
+ 1. 点击提问栏左侧的 🎤 按钮。
78
+ 2. 直接说话,例如:`帮我整理一下桌面上的 DeepSeek Harness 项目`。
79
+ 3. 识别中的文字会实时显示在按钮提示里,最终结果自动写入提问框。
80
+ 4. 再点一次按钮停止识别,然后正常按发送。
50
81
 
51
- 1. 把这个目录推到新仓库。
52
- 2. 用户安装:`dsh plugin --profile web add github:OWNER/dsh-mic-dictation`。
53
- 3. 仓库里必须保留 `cordis.patch.yml`、`lib/client.js` 和 `package.json`;它们是发布内容,不是构建产物。
82
+ ---
54
83
 
55
- ### npm
84
+ ## 它是怎么工作的
56
85
 
57
- ```bash
58
- npm login
59
- npm publish --access public
86
+ ```text
87
+ 浏览器 SpeechRecognition
88
+ │
89
+ ▼
90
+ 识别出文字
91
+ │
92
+ ▼
93
+ 原生 value setter + input 事件写入 textarea
94
+ │
95
+ ▼
96
+ DSH React 状态机接管草稿,正常发送
97
+ ```
98
+
99
+ 插件通过 `MutationObserver` 定位 `[data-composer-card]` 里的 Full access / 访问模式按钮,并把麦克风按钮插到它的正前方,所以位置精确且稳定。
100
+
101
+ ---
102
+
103
+ ## 隐私说明
104
+
105
+ - 插件**不收集**你的语音、文字或任何会话数据。
106
+ - 语音识别由浏览器原生的 `SpeechRecognition` / `webkitSpeechRecognition` 完成;Chrome 会把音频发送到 Google 语音服务进行识别。
107
+ - 如果你对语音数据敏感,请不要在使用本插件时口述敏感信息。
108
+
109
+ ---
110
+
111
+ ## 常见问题
112
+
113
+ <details>
114
+ <summary>按钮没有出现?</summary>
115
+
116
+ 确认你运行的是 Web profile(`dsh web`),并且刷新了页面。检查插件是否已启用:设置 → 插件列表,应能看到 `dsh-mic-dictation`。
117
+ </details>
118
+
119
+ <details>
120
+ <summary>点击后提示麦克风权限被拒绝?</summary>
121
+
122
+ 在浏览器地址栏左侧的权限图标里,把麦克风权限改为「允许」,然后刷新页面重试。
123
+ </details>
124
+
125
+ <details>
126
+ <summary>识别不到中文?</summary>
127
+
128
+ 当前识别语言固定为 `zh-CN`。如果你的系统没有中文语音识别支持,可修改 `lib/client.js` 中的 `rec.lang` 后重新安装。
129
+ </details>
130
+
131
+ <details>
132
+ <summary>为什么 Firefox 用不了?</summary>
133
+
134
+ Firefox 对 `SpeechRecognition` 支持不完整,请使用 Chrome、Edge 或 Safari。
135
+ </details>
136
+
137
+ ---
138
+
139
+ ## 开发
140
+
141
+ 本仓库是已构建好的客户端 bundle,不需要额外构建步骤。
142
+
143
+ ```text
144
+ dsh-mic-dictation/
145
+ ├── package.json # 插件清单 + dsh.client / dsh.bundle 声明
146
+ ├── cordis.patch.yml # bundle patch:把本插件插入 web profile
147
+ ├── lib/
148
+ │ ├── index.js # host half(空 apply)
149
+ │ ├── client.js # 浏览器 half(lazy-CJS factory bundle)
150
+ │ └── *.d.ts # 类型声明
151
+ └── docs/images/ # 演示图
60
152
  ```
61
153
 
62
- 之后用户直接 `dsh plugin --profile web add dsh-mic-dictation`。
154
+ 如果你想改按钮样式、识别语言或行为,编辑 `lib/client.js`,提交后发一个新版本即可。
63
155
 
64
- ## 工作原理
156
+ ---
157
+
158
+ ## 发布新版本
159
+
160
+ ```bash
161
+ # 更新版本号
162
+ npm version patch
163
+
164
+ # 推送到 GitHub
165
+ git push origin main --tags
166
+
167
+ # 发布到 npm(需要已登录 npm 且通过 2FA)
168
+ npm publish --access public
169
+ ```
65
170
 
66
- 1. `cordis.patch.yml` 把 `dsh-mic-dictation` 作为一个 Loader entry 插进 profile。
67
- 2. host 扫描该 entry,读到 `package.json` 的 `dsh.client` 声明,把 `exports["./client"]`(`lib/client.js`)作为客户端 bundle 提供给浏览器。
68
- 3. 浏览器用 `window.__ModuleLoader__.load({ id, factory })` 注册这个 lazy-CJS 模块。
69
- 4. `apply(ctx)` 在页面启动后挂载一个 DOM controller,找到 `[data-composer-card]` 里的 Full access / 访问模式按钮,把麦克风按钮插到它前面。
70
- 5. 语音识别结果通过原生 value setter + `input` 事件写入 textarea,React 正常接管草稿。
171
+ ---
71
172
 
72
- ## 限制
173
+ ## License
73
174
 
74
- - 需要 Chrome / Edge / Safari(`SpeechRecognition` / `webkitSpeechRecognition`)。
75
- - 需要页面运行在 localhost / 127.0.0.1(浏览器的安全上下文要求)。
76
- - Chrome 的语音识别依赖 Google 语音服务,需要联网。
77
- - 如果 DSH 前端升级改变了 `data-composer-card` 或访问模式按钮的 `aria-label`,需要同步调整 `lib/client.js` 里的选择器。
175
+ [MIT](./LICENSE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mic-dictation",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "DeepSeek Harness client plugin: a microphone dictation button to the left of the Full access control in the web composer.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -43,4 +43,4 @@
43
43
  "dictation",
44
44
  "speech-recognition"
45
45
  ]
46
- }
46
+ }