feat: enable /voice mode with native audio binaries

Restore voice input by:
- Copying official cpal-based audio-capture.node binaries (6 platforms)
- Replacing SoX subprocess stub with native .node loader
- Adding VOICE_MODE to default build features

All voice source files in src/ already match the official CLI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
unraid
2026-04-03 21:14:32 +08:00
parent eb86e34094
commit 7ae94327fb
11 changed files with 318 additions and 136 deletions

View File

@@ -1,5 +1,35 @@
# DEV-LOG
## Enable Voice Mode / VOICE_MODE (2026-04-03)
恢复 `/voice` 语音输入功能。`src/` 下所有 voice 相关源码已与官方一致0 行差异),问题出在:① `VOICE_MODE` 编译开关未开,命令不显示;② `audio-capture-napi` 是 SoX 子进程 stubWindows 不支持),缺少官方原生 `.node` 二进制。
**新增文件:**
| 文件 | 说明 |
|------|------|
| `vendor/audio-capture/{platform}/audio-capture.node` | 6 个平台的原生音频二进制cpal来自参考项目 |
| `vendor/audio-capture-src/index.ts` | 原生模块加载器(按 `${arch}-${platform}` 动态 require `.node` |
**修改文件:**
| 文件 | 变更 |
|------|------|
| `packages/audio-capture-napi/src/index.ts` | SoX 子进程 stub → 原生 `.node` 加载器(含 `process.cwd()` workspace 路径 fallback |
| `scripts/dev.ts` | `DEFAULT_FEATURES``"VOICE_MODE"` |
| `build.ts` | `DEFAULT_BUILD_FEATURES``"VOICE_MODE"` |
| `docs/features/voice-mode.md` | 追加恢复计划章节(第八节) |
**验证结果:**
- `isNativeAudioAvailable()``true`Windows x64 原生 `.node` 加载成功)
- `feature('VOICE_MODE')``ENABLED`
- `bun run build` → voice 代码编入产物
**运行时前置条件:** claude.ai OAuth 登录 + 麦克风权限
---
## Enable Remote Control / BRIDGE_MODE (2026-04-03)
**PR**: [claude-code-best/claude-code#60](https://github.com/claude-code-best/claude-code/pull/60)