dsh-live-voice 0.3.2 → 0.4.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 (70) hide show
  1. package/README.md +48 -14
  2. package/lib/client.js +6474 -3396
  3. package/lib/server.js +29 -6
  4. package/package.json +9 -30
  5. package/src/app/AGENTS.md +1 -1
  6. package/src/app/ARCHITECTURE.md +1 -1
  7. package/src/app/client/apply.tsx +242 -35
  8. package/src/app/client/composerSelection.ts +92 -0
  9. package/src/app/client/i18n/catalogs/base.ts +35 -0
  10. package/src/app/client/i18n/catalogs/en.ts +43 -3
  11. package/src/app/client/i18n/catalogs/es.ts +51 -11
  12. package/src/app/client/i18n/catalogs/fr.ts +52 -11
  13. package/src/app/client/i18n/catalogs/hi.ts +50 -11
  14. package/src/app/client/i18n/catalogs/pt-BR.ts +52 -11
  15. package/src/app/client/i18n/catalogs/zh.ts +50 -11
  16. package/src/modules/AGENTS.md +1 -1
  17. package/src/modules/conversation/ARCHITECTURE.md +6 -2
  18. package/src/modules/conversation/components/AutoPlaybackToggle.tsx +31 -0
  19. package/src/modules/conversation/components/ConversationControls.tsx +23 -8
  20. package/src/modules/conversation/components/ConversationStatusBar.tsx +91 -93
  21. package/src/modules/conversation/components/DeliveryModeButton.tsx +3 -3
  22. package/src/modules/conversation/components/MeetingControls.tsx +40 -0
  23. package/src/modules/conversation/components/MicrophoneButton.tsx +15 -2
  24. package/src/modules/conversation/components/PlaybackControls.tsx +20 -5
  25. package/src/modules/conversation/components/RecognitionBar.tsx +14 -0
  26. package/src/modules/conversation/components/ScrollingSpeechCaption.tsx +100 -0
  27. package/src/modules/conversation/components/SpeechStatusBar.tsx +99 -0
  28. package/src/modules/conversation/components/Waveform.tsx +8 -3
  29. package/src/modules/conversation/components/conversationStatus.ts +1 -3
  30. package/src/modules/conversation/components/createConversationComponents.tsx +1 -1
  31. package/src/modules/conversation/components/index.ts +1 -0
  32. package/src/modules/conversation/components/speechCaption.ts +27 -0
  33. package/src/modules/conversation/models/chat.ts +15 -2
  34. package/src/modules/conversation/models/meeting.ts +256 -0
  35. package/src/modules/conversation/models/meetingTranscript.ts +63 -0
  36. package/src/modules/core/ARCHITECTURE.md +1 -1
  37. package/src/modules/core/coordinator.ts +353 -81
  38. package/src/modules/core/developerExtension.ts +26 -0
  39. package/src/modules/core/diagnostics.ts +153 -0
  40. package/src/modules/core/filters.ts +20 -15
  41. package/src/modules/core/markdownSpeech.ts +154 -0
  42. package/src/modules/core/settings.ts +17 -13
  43. package/src/modules/core/sharedAudio.ts +88 -0
  44. package/src/modules/core/speechDefaults.ts +21 -0
  45. package/src/modules/recognition/engines/browser/BrowserRecognitionEngine.ts +8 -1
  46. package/src/modules/recognition/engines/whisper/WhisperRecognitionEngine.ts +10 -3
  47. package/src/modules/settings/components/LiveVoiceSettings.tsx +17 -3
  48. package/src/modules/settings/components/SettingsHeader.tsx +1 -1
  49. package/src/modules/settings/models/settingsStorage.ts +11 -3
  50. package/src/modules/settings/sections/conversation/ConversationDelaySettings.tsx +8 -3
  51. package/src/modules/settings/sections/conversation/DeliverySettings.tsx +25 -2
  52. package/src/modules/settings/sections/recognition/RecognitionEngineSettings.tsx +2 -1
  53. package/src/modules/settings/sections/speak/SpeechEngineSettings.tsx +12 -1
  54. package/src/modules/speak/engines/audio/HostAudioEngine.ts +19 -2
  55. package/src/modules/speak/engines/browser/BrowserSpeakingEngine.ts +33 -2
  56. package/src/shared/design-system/buttons/ToggleButton.tsx +8 -1
  57. package/src/shared/design-system/icons/icons.ts +6 -0
  58. package/src/styles/index.ts +13 -3
  59. package/CHANGELOG.md +0 -240
  60. package/DEVELOPMENT.md +0 -83
  61. package/PLAN.md +0 -296
  62. package/docs/ARCHITECTURE.md +0 -33
  63. package/docs/CHOOSING-AN-ENGINE.md +0 -120
  64. package/docs/CONFIGURATION.md +0 -163
  65. package/docs/REVIEW.md +0 -35
  66. package/docs/VOICE-LIFECYCLE.md +0 -63
  67. package/scripts/build.ts +0 -62
  68. package/scripts/check-dist.mjs +0 -38
  69. package/scripts/preview-ui.ts +0 -31
  70. package/scripts/probe-browser.ts +0 -46
@@ -23,12 +23,14 @@ const zh: LiveVoiceTranslation = {
23
23
  'dsh-live-voice.commons.input.listening': '正在聆听',
24
24
  'dsh-live-voice.commons.input.listeningBadge': '聆听中',
25
25
  'dsh-live-voice.commons.manual': '手动',
26
+ 'dsh-live-voice.commons.milliseconds': '{milliseconds} 毫秒',
26
27
  'dsh-live-voice.commons.off': '关闭',
27
28
  'dsh-live-voice.commons.on': '开启',
28
- 'dsh-live-voice.commons.pluginName': 'Live Voice',
29
+ 'dsh-live-voice.commons.pluginName': '实时语音',
29
30
  'dsh-live-voice.commons.queue': '队列',
30
31
  'dsh-live-voice.commons.repository.starLabel': '在 GitHub 上为我们加星',
31
- 'dsh-live-voice.commons.repository.starLink': '在 GitHub 上为 DSH Live Voice 加星',
32
+ 'dsh-live-voice.commons.repository.starLink': '在 GitHub 上为 DSH 实时语音 加星',
33
+ 'dsh-live-voice.commons.second': '1 秒',
32
34
  'dsh-live-voice.commons.seconds': '{seconds} 秒',
33
35
  'dsh-live-voice.commons.send': '发送',
34
36
  'dsh-live-voice.commons.status.ready': '语音已就绪',
@@ -40,9 +42,27 @@ const zh: LiveVoiceTranslation = {
40
42
  'dsh-live-voice.commons.update.version': '有可用更新:{version}',
41
43
  'dsh-live-voice.commons.version.compatibility': '兼容 DSH v{version}',
42
44
  'dsh-live-voice.commons.version.compatibilityLink': '兼容 DSH v{version}。打开发布页面',
43
- 'dsh-live-voice.commons.version.label': 'DSH Live Voice v{version}',
44
- 'dsh-live-voice.commons.version.link': 'DSH Live Voice v{version}。打开版本发布列表',
45
+ 'dsh-live-voice.commons.version.label': 'DSH 实时语音 v{version}',
46
+ 'dsh-live-voice.commons.version.link': 'DSH 实时语音 v{version}。打开版本发布列表',
45
47
  'dsh-live-voice.commons.version.title': '版本信息',
48
+ 'dsh-live-voice.meeting.failed': '语音识别失败。',
49
+ 'dsh-live-voice.meeting.help': '独立来源;请从编辑器手动发送转写内容。',
50
+ 'dsh-live-voice.meeting.httpRequired': '会议模式需要 Qwen 或 Whisper HTTP。',
51
+ 'dsh-live-voice.meeting.inactive': '未启用',
52
+ 'dsh-live-voice.meeting.listening': '正在聆听',
53
+ 'dsh-live-voice.meeting.microphone': '麦克风',
54
+ 'dsh-live-voice.meeting.noAudio': '未共享音频。请在共享对话框中启用音频。',
55
+ 'dsh-live-voice.meeting.processing': '正在转写…',
56
+ 'dsh-live-voice.meeting.shared': '共享音频',
57
+ 'dsh-live-voice.meeting.start': '启动来源',
58
+ 'dsh-live-voice.meeting.startShared': '开始共享音频',
59
+ 'dsh-live-voice.meeting.starting': '正在启动…',
60
+ 'dsh-live-voice.meeting.stop': '停止来源',
61
+ 'dsh-live-voice.meeting.stopShared': '停止共享音频',
62
+ 'dsh-live-voice.meeting.timestamps': '转写时间戳',
63
+ 'dsh-live-voice.meeting.timestampsBadge': '时间戳',
64
+ 'dsh-live-voice.meeting.title': '会议模式',
65
+ 'dsh-live-voice.meeting.unavailable': '语音识别不可用。',
46
66
  'dsh-live-voice.recognition.autoSend.countdownHelp':
47
67
  '识别出最终语句后开始倒计时。再次说话或编辑文本会取消倒计时。',
48
68
  'dsh-live-voice.recognition.browser.autoInstallPack': '需要时自动安装此浏览器语言包',
@@ -64,7 +84,7 @@ const zh: LiveVoiceTranslation = {
64
84
  'dsh-live-voice.recognition.dictation.cancel': '取消听写',
65
85
  'dsh-live-voice.recognition.engine.label': '识别引擎',
66
86
  'dsh-live-voice.recognition.headphoneMode.help':
67
- '开放麦克风会在播放回复时继续聆听。检测到你说话时,播放会暂停,并仅在你选择恢复时继续。',
87
+ '播放时麦克风保持开启。识别到非回声语音后,可在设定延迟后暂停播放;麦克风和共享会议音频持续静音达到该时长后恢复。手动暂停后需点击恢复。',
68
88
  'dsh-live-voice.recognition.headphoneMode.label': '耳机 — 开放麦克风',
69
89
  'dsh-live-voice.recognition.holdToTalk.enabled': '按住 Control 键说话',
70
90
  'dsh-live-voice.recognition.holdToTalk.help':
@@ -80,7 +100,8 @@ const zh: LiveVoiceTranslation = {
80
100
  'dsh-live-voice.recognition.microphone.device': '输入设备',
81
101
  'dsh-live-voice.recognition.microphone.failure': '麦克风:{reason}',
82
102
  'dsh-live-voice.recognition.microphone.ignore': '忽略消息输入框的语音输入',
83
- 'dsh-live-voice.recognition.microphone.inputStatus': '麦克风输入:{state}',
103
+ 'dsh-live-voice.recognition.microphone.inputStatus':
104
+ '音频输入:{state}。忽略仅丢弃听写,不会停止采集:语音打断仍然有效;启用后,配置的语音命令仍可使用。通过消息输入框中的音源按钮停止采集。',
84
105
  'dsh-live-voice.recognition.microphone.label': '麦克风',
85
106
  'dsh-live-voice.recognition.microphone.permissionHelp':
86
107
  '仅在你开始听写或语音对话时才会请求麦克风权限。',
@@ -125,7 +146,7 @@ const zh: LiveVoiceTranslation = {
125
146
  'dsh-live-voice.recognition.silenceDetection.pauseLabel': '发送前停顿',
126
147
  'dsh-live-voice.recognition.silenceDetection.title': '静音检测设置',
127
148
  'dsh-live-voice.recognition.speakerMode.help':
128
- '门控聆听会在播放回复时释放麦克风,防止扬声器音频被识别。使用“接管麦克风”可打断播放。',
149
+ '播放时释放麦克风以减少扬声器反馈。接管麦克风可手动打断;共享会议音频中识别到的非回声参与者语音也可暂停播放,持续静音后恢复。',
129
150
  'dsh-live-voice.recognition.speakerMode.label': '扬声器 — 门控聆听',
130
151
  'dsh-live-voice.recognition.status.answer': '正在识别回答…',
131
152
  'dsh-live-voice.recognition.status.awaitingAnswer': '正在聆听你的回答…',
@@ -152,6 +173,12 @@ const zh: LiveVoiceTranslation = {
152
173
  'dsh-live-voice.settings.autoSend.countdown': '{remaining} 后发送…',
153
174
  'dsh-live-voice.settings.autoSend.delay': '静音后发送',
154
175
  'dsh-live-voice.settings.close': '关闭语音设置',
176
+ 'dsh-live-voice.settings.delivery.dshEnterHelp':
177
+ '实时语音 根据您的回答,为引导和加入队列选择正确的操作。这不会更改 DSH 设置;请填写当前 DSH 的行为,并在该行为变化时更新此回答。',
178
+ 'dsh-live-voice.settings.delivery.dshEnterQuestion':
179
+ '在您的 DSH 中,智能体忙碌时按 Enter 会怎样?',
180
+ 'dsh-live-voice.settings.delivery.dshEnterQueue': '将消息加入队列',
181
+ 'dsh-live-voice.settings.delivery.dshEnterSteer': '发送消息以引导智能体',
155
182
  'dsh-live-voice.settings.delivery.label': '发送模式',
156
183
  'dsh-live-voice.settings.delivery.manualLabel': '关闭 — 审阅后手动发送',
157
184
  'dsh-live-voice.settings.delivery.queueLabel': '队列 — 静音后自动加入队列',
@@ -163,12 +190,12 @@ const zh: LiveVoiceTranslation = {
163
190
  'dsh-live-voice.settings.filters.title': '过滤',
164
191
  'dsh-live-voice.settings.general.title': '常规',
165
192
  'dsh-live-voice.settings.persistence.loadError':
166
- '无法从服务器加载 Live Voice 设置。请刷新后重试。',
167
- 'dsh-live-voice.settings.persistence.saveError': '无法在服务器上保存 Live Voice 设置。请重试。',
193
+ '无法从服务器加载 实时语音 设置。请刷新后重试。',
194
+ 'dsh-live-voice.settings.persistence.saveError': '无法在服务器上保存 实时语音 设置。请重试。',
168
195
  'dsh-live-voice.settings.tabs.conversation': '对话',
169
196
  'dsh-live-voice.settings.tabs.recognition': '语音识别',
170
197
  'dsh-live-voice.settings.tabs.speak': '语音合成',
171
- 'dsh-live-voice.settings.title': 'Live Voice 设置',
198
+ 'dsh-live-voice.settings.title': '实时语音 设置',
172
199
  'dsh-live-voice.settings.whisper.hostHelp':
173
200
  '主机级设置。仅允许无需身份验证的回环 HTTP URL(localhost、127.0.0.1、[::1])。回环地址指 DSH 主机,而非此浏览器。所有健康检查和音频请求都通过需要身份验证的后端执行。',
174
201
  'dsh-live-voice.speak.agentContext.enabled': '启用代理语音上下文',
@@ -177,6 +204,8 @@ const zh: LiveVoiceTranslation = {
177
204
  '此英文指令仅在语音对话处于活动状态且启用自动朗读助手回复时发送给代理。',
178
205
  'dsh-live-voice.speak.agentContext.label': '代理语音上下文',
179
206
  'dsh-live-voice.speak.agentContext.restore': '恢复默认值',
207
+ 'dsh-live-voice.speak.autoPlayback.disable': '关闭助手自动朗读',
208
+ 'dsh-live-voice.speak.autoPlayback.enable': '开启助手自动朗读',
180
209
  'dsh-live-voice.speak.autoPlayback.enabled': '自动朗读新的助手消息',
181
210
  'dsh-live-voice.speak.autoPlayback.help':
182
211
  '语音对话期间,助手的语句会自动朗读。你说话时会等待,不会播放。',
@@ -192,6 +221,11 @@ const zh: LiveVoiceTranslation = {
192
221
  'dsh-live-voice.speak.browser.outputHelp':
193
222
  '浏览器语音合成可能忽略所选输出设备;此浏览器 API 通常使用系统默认设备。',
194
223
  'dsh-live-voice.speak.browser.voice': '浏览器本地语音',
224
+ 'dsh-live-voice.speak.captions.approximate': '近似语音字幕',
225
+ 'dsh-live-voice.speak.captions.loading': '正在准备语音音频',
226
+ 'dsh-live-voice.speak.captions.position': '语音片段 {index}/{total}',
227
+ 'dsh-live-voice.speak.captions.progress': '近似语音进度',
228
+ 'dsh-live-voice.speak.captions.title': '语音与实时字幕',
195
229
  'dsh-live-voice.speak.engine.label': '语音合成引擎',
196
230
  'dsh-live-voice.speak.engine.playbackHelp':
197
231
  'Qwen 和 macOS say 在 DSH 主机上合成语音;压缩的 AAC/M4A 音频在此浏览器中播放。浏览器语音则在此设备上合成并播放。',
@@ -206,16 +240,20 @@ const zh: LiveVoiceTranslation = {
206
240
  'dsh-live-voice.speak.macos.label': 'macOS say — 在主机播放',
207
241
  'dsh-live-voice.speak.macos.name': 'macOS say',
208
242
  'dsh-live-voice.speak.macos.outputHelp': 'macOS say 使用 DSH 主机上选定的输出设备。',
243
+ 'dsh-live-voice.speak.macos.voice': 'macOS say 音色',
244
+ 'dsh-live-voice.speak.macos.voiceHelp':
245
+ '输入 say -v 使用的准确音色名称。留空以使用 macOS 默认音色。在主机终端运行 say -v "?" 查看音色列表。',
209
246
  'dsh-live-voice.speak.output.checking': '正在检查语音输出…',
210
247
  'dsh-live-voice.speak.output.device': '输出设备',
211
248
  'dsh-live-voice.speak.output.fallbackName': '音频输出',
212
249
  'dsh-live-voice.speak.output.stopTest': '停止语音测试',
213
250
  'dsh-live-voice.speak.output.test': '测试所选语音输出',
214
- 'dsh-live-voice.speak.output.testPhrase': 'DSH Live Voice。所选语音输出工作正常。',
251
+ 'dsh-live-voice.speak.output.testPhrase': 'DSH 实时语音。所选语音输出工作正常。',
215
252
  'dsh-live-voice.speak.output.testing': '正在测试语音…',
216
253
  'dsh-live-voice.speak.playback.message': '朗读消息',
217
254
  'dsh-live-voice.speak.playback.next': '跳至下一语音片段',
218
255
  'dsh-live-voice.speak.playback.pause': '暂停朗读',
256
+ 'dsh-live-voice.speak.playback.previous': '上一语音片段',
219
257
  'dsh-live-voice.speak.playback.resume': '恢复朗读',
220
258
  'dsh-live-voice.speak.playback.stop': '停止朗读',
221
259
  'dsh-live-voice.speak.playback.stopAll': '停止全部朗读',
@@ -248,6 +286,7 @@ const zh: LiveVoiceTranslation = {
248
286
  'dsh-live-voice.speak.responseDelay.help':
249
287
  '你停止说话后,助手会等待此时长的连续静音,然后自动播放语音。再次说话会重新开始等待。',
250
288
  'dsh-live-voice.speak.responseDelay.label': '助手响应延迟',
289
+ 'dsh-live-voice.speak.responseDelay.none': '无延迟',
251
290
  'dsh-live-voice.speak.segmentGap.help': '在连续语音片段之间等待此毫秒数。默认值为 400 ms。',
252
291
  'dsh-live-voice.speak.segmentGap.label': '语音片段之间的停顿',
253
292
  'dsh-live-voice.speak.status.paused': '语音已暂停',
@@ -2,4 +2,4 @@
2
2
 
3
3
  Read the nearest module's `ARCHITECTURE.md` before changing its behavior. `src/modules` owns product policy, feature UI, models, providers, and services. Modules may use `src/shared` and the centralized `src/app/client/i18n` API, but must not register DSH slots or host routes; composition belongs to `src/app`.
4
4
 
5
- Preserve local-first STT and TTS options without claiming DSH itself is offline. Track capture/recognition, synthesis/playback, and agent generation separately. Preserve pause, resume, cancel, ownership, interruption, and stale asynchronous result semantics. Avoid logging raw audio or transcripts by default. Consult [VOICE-LIFECYCLE.md](../../docs/VOICE-LIFECYCLE.md) for the behavioral contract and [root guidance](../../AGENTS.md) for testing and authorization.
5
+ Preserve local-first STT and TTS options without claiming DSH itself is offline. Track capture/recognition, synthesis/playback, and agent generation separately. Preserve pause, resume, cancel, ownership, interruption, and stale asynchronous result semantics. Avoid logging raw audio or transcripts by default. Consult [VOICE-LIFECYCLE.md](../../../../docs/VOICE-LIFECYCLE.md) for the behavioral contract and [root guidance](../../../../AGENTS.md) for testing and authorization.
@@ -1,7 +1,11 @@
1
1
  # Conversation module
2
2
 
3
- Dictation is append-only at the current composer end. Final chunks preserve existing and manually edited text; provisional hypotheses never rewrite the editor. Client synchronization must accept a new manual publication even when the previous voice echo was skipped, while ignoring unchanged stale slot snapshots. Explicit Clear and normal submit actions are separate from dictation.
3
+ Dictation is append-only at the current composer end. Final chunks preserve existing and manually edited text; provisional hypotheses never rewrite the editor. Client synchronization must accept a new manual publication even when the previous voice echo was skipped, while ignoring unchanged stale slot snapshots. Explicit Clear and normal submit actions are separate from dictation. Appends preserve the active caret, directional selection, focus and scroll; `app/client/composerSelection.ts` restores DOM bookmarks after the synchronous DSH editor write and publishes selectionchange through the editor bridge.
4
4
 
5
5
  `models/chat.ts` interprets DSH chat turns and pending questions. `hooks/useConversationController.ts` subscribes to session state; `hooks/useConversationActions.ts` maps user actions onto the controller. `components/` renders composer controls, microphone state, playback controls, status, and waveform; `createConversationComponents.tsx` composes them for the application slot boundary.
6
6
 
7
- Keep UI components session-facing rather than importing host engines or registering slots. Preserve the DSH composer contract: `useInput` provides subscribed input and `inputActions.setDraft()` updates the composer; a recognition result must not be lost to stale interim updates. History pagination must not count as a new user turn. Do not treat sending, recognition, playback, or agent generation as one state. See [voice lifecycle](../../../docs/VOICE-LIFECYCLE.md) before changing interruption or turn-taking.
7
+ Live Voice’s persisted `dshBusyEnterBehavior` is a user-reported fact about DSH, not a DSH configuration write. Delivery matching that behavior uses `inputActions.submit()`; the opposite uses the accelerated Ctrl+Enter gesture. Read the current answer at submission time for every delivery source; Queue is the compatibility default. DSH remains responsible for idle/unsupported-steering behavior.
8
+
9
+ Microphone and shared-input bars share `ConversationStatusBar` and separate `VoiceCoordinator` input-policy instances. `MeetingController.input()` adapts shared capture callbacks into that policy without owning duplicate playback. Per-source Ignore, commands, delivery mode, and timestamps remain independent. The application composer bridge cancels competing delivery intent on new accepted text and rearms an eligible source only when both inputs are idle and transcription is complete. Assistant playback and pending-question handling are delegated to the committed session controller.
10
+
11
+ Keep UI components session-facing rather than importing host engines or registering slots. Preserve the DSH composer contract: `useInput` provides subscribed input and `inputActions.setDraft()` updates the composer; a recognition result must not be lost to stale interim updates. History pagination must not count as a new user turn. Do not treat sending, recognition, playback, or agent generation as one state. See [voice lifecycle](../../../../../docs/VOICE-LIFECYCLE.md) before changing interruption or turn-taking.
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { useLanguage } from '../../../app/client/i18n/index.js';
3
+ import { IconButton } from '../../../shared/design-system/index.js';
4
+ export function AutoPlaybackToggle({ state, invoke, error }: any) {
5
+ const { scoped: commons } = useLanguage((ctx) => ctx.commons);
6
+ const { scoped: speak } = useLanguage((ctx) => ctx.speak);
7
+ const active = state.settings.announceAssistantMessages !== false;
8
+ const count = state.speechSegmentsRemaining || 0;
9
+ const title =
10
+ count > 0
11
+ ? (speak as any).autoPlayback[count === 1 ? 'remainingOne' : 'remainingOther']({
12
+ state: active ? (commons as any).on() : (commons as any).off(),
13
+ count,
14
+ })
15
+ : (speak as any).autoPlayback.status({
16
+ state: active ? (commons as any).on() : (commons as any).off(),
17
+ });
18
+ return (
19
+ <IconButton
20
+ className="dlv-composer-toggle"
21
+ aria-pressed={active}
22
+ data-toggle-active={String(active)}
23
+ label={(speak as any).autoPlayback.label()}
24
+ title={error || (speak as any).autoPlayback[active ? 'disable' : 'enable']() + ' — ' + title}
25
+ icon={active ? 'speaker' : 'speakerOff'}
26
+ role="switch"
27
+ aria-checked={active}
28
+ onClick={() => invoke('updateSettings', { announceAssistantMessages: !active })}
29
+ />
30
+ );
31
+ }
@@ -3,6 +3,7 @@ import { useLanguage } from '../../../app/client/i18n/index.js';
3
3
  import { ErrorMessage } from '../../../shared/design-system/index.js';
4
4
  import { useConversationActions, useConversationController } from '../hooks/index.js';
5
5
  import { MicrophoneButton } from './MicrophoneButton.js';
6
+ import { AutoPlaybackToggle } from './AutoPlaybackToggle.js';
6
7
 
7
8
  export type ConversationControlsProps = { controller: any };
8
9
  export function ConversationControls({ controller }: ConversationControlsProps) {
@@ -11,23 +12,37 @@ export function ConversationControls({ controller }: ConversationControlsProps)
11
12
  const state = useConversationController<any>(controller);
12
13
  const { invoke, error, clearError } = useConversationActions(controller);
13
14
  const busy = state.conversation || state.listening || state.starting || state.recognizing;
14
- if (busy) return null;
15
+
15
16
  const capability = state.capabilities?.recognition;
16
17
  const capture = state.capabilities?.capture;
17
18
  const pending = !capability || !capture;
18
19
  const unavailable = capability?.supported === false || capture?.supported === false;
19
20
  const reason = capture?.supported === false ? capture.reason : capability?.reason;
20
- const label = pending
21
- ? (recognition as any).microphone.checking()
22
- : unavailable
23
- ? reason || (recognition as any).status.unavailable()
24
- : (commons as any).conversation.start();
21
+ const label = busy
22
+ ? (commons as any).conversation.end()
23
+ : pending
24
+ ? (recognition as any).microphone.checking()
25
+ : unavailable
26
+ ? reason || (recognition as any).status.unavailable()
27
+ : (commons as any).conversation.start();
25
28
  return (
26
29
  <>
30
+ <AutoPlaybackToggle state={state} invoke={invoke} error={error} />
27
31
  <MicrophoneButton
28
32
  label={label}
29
- disabled={pending}
30
- onClick={() => invoke(unavailable ? 'explainRecognition' : 'startConversation')}
33
+ disabled={!busy && pending}
34
+ aria-pressed={Boolean(busy)}
35
+ onClick={() =>
36
+ invoke(
37
+ busy
38
+ ? state.conversation
39
+ ? 'endConversation'
40
+ : 'cancelDictation'
41
+ : unavailable
42
+ ? 'explainRecognition'
43
+ : 'startConversation',
44
+ )
45
+ }
31
46
  />
32
47
  <ErrorMessage
33
48
  error={error}
@@ -1,28 +1,35 @@
1
1
  import React from 'react';
2
2
  import { useLanguage } from '../../../app/client/i18n/index.js';
3
- import { ErrorMessage, IconButton } from '../../../shared/design-system/index.js';
3
+ import { ErrorMessage, IconButton, ToggleButton } from '../../../shared/design-system/index.js';
4
4
  import { useConversationActions, useConversationController } from '../hooks/index.js';
5
5
  import { DeliveryModeButton } from './DeliveryModeButton.js';
6
- import { PlaybackControls } from './PlaybackControls.js';
7
- import { Waveform } from './Waveform.js';
6
+ import { SpeechStatusBar } from './SpeechStatusBar.js';
7
+ import { RecognitionBar } from './RecognitionBar.js';
8
8
  import { resolveConversationStatus } from './conversationStatus.js';
9
9
 
10
10
  export type ConversationStatusBarProps = {
11
11
  controller: any;
12
12
  questionOnly?: boolean;
13
+ includeSpeech?: boolean;
13
14
  overlay?: boolean;
14
15
  overlayStyle?: React.CSSProperties;
16
+ sourceIcon?: 'mic' | 'meeting';
17
+ sourceLabel?: string;
15
18
  };
16
19
  export function ConversationStatusBar({
17
20
  controller,
18
21
  questionOnly = false,
22
+ includeSpeech = true,
19
23
  overlay = false,
20
24
  overlayStyle,
25
+ sourceIcon = 'mic',
26
+ sourceLabel,
21
27
  }: ConversationStatusBarProps) {
22
28
  const { scoped: commons } = useLanguage((ctx) => ctx.commons);
23
29
  const { scoped: recognition } = useLanguage((ctx) => ctx.recognition);
24
30
  const { scoped: settings } = useLanguage((ctx) => ctx.settings);
25
31
  const { scoped: speak } = useLanguage((ctx) => ctx.speak);
32
+ const { scoped: meeting } = useLanguage((ctx) => ctx.meeting);
26
33
  const state = useConversationController<any>(controller);
27
34
  const { invoke, error, clearError } = useConversationActions(controller);
28
35
  const [now, setNow] = React.useState(Date.now());
@@ -32,9 +39,18 @@ export function ConversationStatusBar({
32
39
  const timer = setInterval(() => setNow(Date.now()), 200);
33
40
  return () => clearInterval(timer);
34
41
  }, [state.autoSendAt]);
35
- const capture = state.starting || state.listening || state.recognizing;
42
+ const capture = state.starting || state.listening || state.recognizing || state.pendingTranscriptions > 0;
36
43
  if (questionOnly && !state.answeringQuestion) return null;
37
- if (!state.conversation && !capture && !state.speaking && !state.paused && !state.error && !error)
44
+ if (
45
+ !state.conversation &&
46
+ !capture &&
47
+ !state.speaking &&
48
+ !state.paused &&
49
+ !state.speechRunActive &&
50
+ !(state.speechSegmentsRemaining > 0) &&
51
+ !state.error &&
52
+ !error
53
+ )
38
54
  return null;
39
55
  const remaining = state.autoSendAt
40
56
  ? Math.max(1, Math.ceil((state.autoSendAt - now) / 1000))
@@ -45,102 +61,84 @@ export function ConversationStatusBar({
45
61
  settings,
46
62
  speak,
47
63
  });
48
- const autoPlayback = state.settings.announceAssistantMessages !== false;
49
- const playbackTitle =
50
- state.speechSegmentsRemaining > 0
51
- ? (speak as any).autoPlayback[
52
- state.speechSegmentsRemaining === 1 ? 'remainingOne' : 'remainingOther'
53
- ]({
54
- state: autoPlayback ? (commons as any).on() : (commons as any).off(),
55
- count: state.speechSegmentsRemaining,
56
- })
57
- : (speak as any).autoPlayback.status({
58
- state: autoPlayback ? (commons as any).on() : (commons as any).off(),
59
- });
60
64
  return (
61
65
  <div
62
- className={overlay ? 'dlv-bar-wrap dlv-question-overlay' : 'dlv-bar-wrap'}
66
+ className={
67
+ overlay ? 'dlv-bar-wrap dlv-bar-stack dlv-question-overlay' : 'dlv-bar-wrap dlv-bar-stack'
68
+ }
63
69
  style={overlay ? overlayStyle : undefined}
64
70
  >
65
- <div className="dlv-pill" role="group" aria-label={(commons as any).controls.title()}>
66
- {capture && !state.conversation ? (
67
- <IconButton
68
- label={(recognition as any).dictation.cancel()}
69
- icon="close"
70
- onClick={() => invoke('cancelDictation')}
71
- />
72
- ) : null}
73
- {state.conversation ? (
74
- <IconButton
75
- label={(commons as any).conversation.end()}
76
- icon="close"
77
- onClick={() => invoke('endConversation')}
78
- />
79
- ) : null}
80
- <Waveform controller={controller} enabled={Boolean(state.listening)} />
81
- <span className="dlv-status" role="status" aria-live="polite">
82
- {status}
83
- </span>
84
- <DeliveryModeButton
85
- mode={state.settings.sendingMode || 'manual'}
86
- onChange={(sendingMode) => invoke('updateSettings', { sendingMode })}
87
- />
88
- <IconButton
89
- className={`dlv-live-toggle${state.speechSegmentsRemaining > 0 ? ' dlv-live-toggle-expanded' : ''}`}
90
- label={(speak as any).autoPlayback.label()}
91
- title={playbackTitle}
92
- icon={autoPlayback ? 'speaker' : 'speakerOff'}
93
- visibleLabel={
94
- !autoPlayback
95
- ? (commons as any).toggle.offBadge()
96
- : state.speechSegmentsRemaining > 0
97
- ? String(state.speechSegmentsRemaining)
98
- : (commons as any).on()
71
+ {includeSpeech && <SpeechStatusBar controller={controller} />}
72
+ {(state.conversation || capture || state.error || error) && (
73
+ <RecognitionBar
74
+ controller={controller}
75
+ listening={state.listening}
76
+ label={sourceLabel || (commons as any).controls.title()}
77
+ status={status}
78
+ leading={
79
+ <>
80
+ {state.conversation && !capture ? (
81
+ <IconButton
82
+ label={(recognition as any).microphone.takeControl()}
83
+ icon={sourceIcon}
84
+ onClick={() => invoke('startConversation')}
85
+ />
86
+ ) : null}
87
+ {capture ? (
88
+ <ToggleButton
89
+ className="dlv-mic-state"
90
+ label={
91
+ state.muted
92
+ ? (recognition as any).microphone.resume()
93
+ : (recognition as any).microphone.ignore()
94
+ }
95
+ title={(recognition as any).microphone.inputStatus({
96
+ state: state.muted
97
+ ? (commons as any).input.ignoring()
98
+ : (commons as any).input.listening(),
99
+ })}
100
+ icon={sourceIcon}
101
+ visibleLabel={
102
+ state.muted
103
+ ? (commons as any).input.ignoringBadge()
104
+ : (commons as any).input.listeningBadge()
105
+ }
106
+ pressed={!state.muted}
107
+ data-muted={state.muted ? 'true' : 'false'}
108
+ onClick={() => invoke(state.muted ? 'resumeListeningInput' : 'muteListening')}
109
+ />
110
+ ) : null}
111
+ </>
99
112
  }
100
- role="switch"
101
- aria-checked={autoPlayback}
102
- onClick={() => invoke('updateSettings', { announceAssistantMessages: !autoPlayback })}
103
- />
104
- {remaining ? (
105
- <IconButton
106
- label={(settings as any).autoSend.cancel()}
107
- icon="close"
108
- onClick={() => invoke('cancelAutoSend')}
113
+ >
114
+ <ToggleButton
115
+ icon="filter"
116
+ label={(recognition as any).commands.enabled()}
117
+ visibleLabel={state.settings.voiceCommandsEnabled ? (commons as any).on() : (commons as any).off()}
118
+ pressed={Boolean(state.settings.voiceCommandsEnabled)}
119
+ onClick={() => invoke('updateSettings', { voiceCommandsEnabled: !state.settings.voiceCommandsEnabled })}
109
120
  />
110
- ) : null}
111
- {state.conversation && !capture ? (
112
- <IconButton
113
- label={(recognition as any).microphone.takeControl()}
114
- icon="mic"
115
- onClick={() => invoke('startConversation')}
121
+ <ToggleButton
122
+ className="dlv-timestamp-toggle"
123
+ icon="clock"
124
+ label={(meeting as any).timestamps()}
125
+ visibleLabel={(meeting as any).timestampsBadge()}
126
+ pressed={Boolean(state.timestamps)}
127
+ onClick={() => invoke('toggleTimestamps')}
116
128
  />
117
- ) : null}
118
- {capture ? (
119
- <IconButton
120
- className="dlv-live-toggle dlv-mic-state"
121
- label={
122
- state.muted
123
- ? (recognition as any).microphone.resume()
124
- : (recognition as any).microphone.ignore()
125
- }
126
- title={(recognition as any).microphone.inputStatus({
127
- state: state.muted
128
- ? (commons as any).input.ignoring()
129
- : (commons as any).input.listening(),
130
- })}
131
- icon={state.muted ? 'micOff' : 'mic'}
132
- visibleLabel={
133
- state.muted
134
- ? (commons as any).input.ignoringBadge()
135
- : (commons as any).input.listeningBadge()
136
- }
137
- aria-pressed={Boolean(state.muted)}
138
- data-muted={state.muted ? 'true' : 'false'}
139
- onClick={() => invoke(state.muted ? 'resumeListeningInput' : 'muteListening')}
129
+ <DeliveryModeButton
130
+ mode={state.settings.sendingMode || 'manual'}
131
+ onChange={(sendingMode) => invoke('updateSettings', { sendingMode })}
140
132
  />
141
- ) : null}
142
- <PlaybackControls state={state} invoke={invoke} />
143
- </div>
133
+ {remaining ? (
134
+ <IconButton
135
+ label={(settings as any).autoSend.cancel()}
136
+ icon="close"
137
+ onClick={() => invoke('cancelAutoSend')}
138
+ />
139
+ ) : null}
140
+ </RecognitionBar>
141
+ )}
144
142
  <ErrorMessage
145
143
  error={error || state.error}
146
144
  dismissLabel={(commons as any).dismissError()}
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { useLanguage } from '../../../app/client/i18n/index.js';
3
- import { IconButton } from '../../../shared/design-system/index.js';
3
+ import { ToggleButton } from '../../../shared/design-system/index.js';
4
4
 
5
5
  type Mode = 'manual' | 'queue' | 'steer';
6
6
  export function nextDeliveryMode(mode: Mode | undefined): Mode {
@@ -29,13 +29,13 @@ export function DeliveryModeButton({
29
29
  ? (commons as any).delivery.queueBadge()
30
30
  : (commons as any).toggle.offBadge();
31
31
  return (
32
- <IconButton
32
+ <ToggleButton
33
33
  className="dlv-live-toggle"
34
34
  label={status}
35
35
  title={status}
36
36
  icon={mode === 'queue' ? 'queue' : 'send'}
37
37
  visibleLabel={visible}
38
- aria-pressed={mode !== 'manual'}
38
+ pressed={mode !== 'manual'}
39
39
  data-mode={mode}
40
40
  onClick={() => onChange(nextDeliveryMode(mode))}
41
41
  />
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import { useLanguage } from '../../../app/client/i18n/index.js';
3
+ import { IconButton } from '../../../shared/design-system/index.js';
4
+ import { ConversationStatusBar } from './ConversationStatusBar.js';
5
+ export function MeetingToggle({ meeting, onToggle }: any) {
6
+ const { scoped: copy } = useLanguage((ctx) => ctx.meeting);
7
+ const state: any = React.useSyncExternalStore(meeting.subscribe, meeting.getSnapshot);
8
+ const active = Boolean(state.shared.listening || state.shared.starting);
9
+ return (
10
+ <IconButton
11
+ icon={active ? 'meeting' : 'meetingOff'}
12
+ label={(copy as any).shared()}
13
+ title={(copy as any)[
14
+ state.shared.listening || state.shared.starting ? 'stopShared' : 'startShared'
15
+ ]()}
16
+ className="dlv-composer-toggle"
17
+ data-toggle-active={String(active)}
18
+ aria-pressed={active}
19
+ onClick={onToggle}
20
+ />
21
+ );
22
+ }
23
+ export function MeetingBars({ meeting }: any) {
24
+ const { scoped: copy } = useLanguage((ctx) => ctx.meeting);
25
+ const state: any = React.useSyncExternalStore(meeting.subscribe, meeting.getSnapshot);
26
+ const value = state.shared;
27
+ if (!value.listening && !value.starting && !value.error) return null;
28
+ const label = (copy as any).shared();
29
+ const input = meeting.input('shared');
30
+ return (
31
+ <div className="dlv-meeting-bars">
32
+ <ConversationStatusBar
33
+ controller={input}
34
+ includeSpeech={false}
35
+ sourceIcon="meeting"
36
+ sourceLabel={label}
37
+ />
38
+ </div>
39
+ );
40
+ }
@@ -1,6 +1,19 @@
1
1
  import React from 'react';
2
2
  import { IconButton } from '../../../shared/design-system/index.js';
3
- export type MicrophoneButtonProps = { label: string; disabled?: boolean; onClick(): void };
3
+ export type MicrophoneButtonProps = {
4
+ label: string;
5
+ disabled?: boolean;
6
+ 'aria-pressed'?: boolean;
7
+ onClick(): void;
8
+ };
4
9
  export function MicrophoneButton(props: MicrophoneButtonProps) {
5
- return <IconButton {...props} className="dlv-mic" icon="mic" />;
10
+ const active = Boolean(props['aria-pressed']);
11
+ return (
12
+ <IconButton
13
+ {...props}
14
+ className="dlv-mic dlv-composer-toggle"
15
+ data-toggle-active={String(active)}
16
+ icon={active ? 'mic' : 'micOff'}
17
+ />
18
+ );
6
19
  }
@@ -2,19 +2,34 @@ import React from 'react';
2
2
  import { useLanguage } from '../../../app/client/i18n/index.js';
3
3
  import { IconButton } from '../../../shared/design-system/index.js';
4
4
 
5
- export function PlaybackControls({ state, invoke }: { state: any; invoke(name: string): void }) {
5
+ export function PlaybackControls({
6
+ state,
7
+ invoke,
8
+ navigation = true,
9
+ }: {
10
+ state: any;
11
+ invoke(name: string): void;
12
+ navigation?: boolean;
13
+ }) {
6
14
  const { scoped: speak } = useLanguage((ctx) => ctx.speak);
7
- const capabilities = state.capabilities?.[state.settings?.engine] ?? {};
15
+ const capabilities = state.capabilities?.[state.speechEngine || state.settings?.engine] ?? {};
8
16
  return (
9
17
  <>
10
- {state.speechSegmentsRemaining > 1 ? (
18
+ {navigation && state.speechHasPrevious ? (
19
+ <IconButton
20
+ label={(speak as any).playback.previous()}
21
+ icon="skipPrevious"
22
+ onClick={() => invoke('previousSpeechSegment')}
23
+ />
24
+ ) : null}
25
+ {navigation && state.speechSegmentsRemaining > 1 ? (
11
26
  <IconButton
12
27
  label={(speak as any).playback.next()}
13
28
  icon="skipNext"
14
29
  onClick={() => invoke('skipSpeechSegment')}
15
30
  />
16
31
  ) : null}
17
- {state.speechSegmentsRemaining > 0 && capabilities.pause ? (
32
+ {state.speechSegmentsRemaining > 0 && capabilities.pause && !state.paused ? (
18
33
  <IconButton
19
34
  label={(speak as any).playback.pause()}
20
35
  icon="pause"
@@ -29,7 +44,7 @@ export function PlaybackControls({ state, invoke }: { state: any; invoke(name: s
29
44
  onClick={() => invoke('resumeSpeech')}
30
45
  />
31
46
  ) : null}
32
- {state.speechSegmentsRemaining > 0 ? (
47
+ {state.speechSegmentsRemaining > 0 || state.speechRunActive ? (
33
48
  <IconButton
34
49
  label={(speak as any).playback.stopAll()}
35
50
  icon="stop"