Ariver
2026-07-12 3797b4105ecd1f5af071a337dd67718cd3776c0d
CODEGRAPH.md
@@ -1,99 +1,34 @@
# CODEGRAPH
# PrivateVoice-independent-developer CODEGRAPH
## Project
最后整理:2026-07-11
- Product: Wails v3 / Go desktop dictation app.
- Git root: `/Users/ar/Projects/PrivateVoice/03-O`.
- Source root: `/Users/ar/Projects/PrivateVoice/03-O/C1.source/privatevoice.src`.
- Current branch purpose: R221 recovery freeze for `2.2.2 build20260703.0335`, restoring reviewed `2.2.1` fixes into the current active source and producing four real-user test candidate packages.
- Protected behavior: existing macOS App Store, local DMG, Monterey compatibility, Windows preview, model download safety, and paste/clipboard protection must not be changed without a scoped task and QA plan.
## 工程范围
## Automatic Codebase Memory
- 项目根:`/Users/ar/Projects/PrivateVoice-independent-developer`
- Git 根:`/Users/ar/Projects/PrivateVoice-independent-developer/03-O`
- 分支:`independent-developer`
- 源码冻结基线:`a075aec123e1f7118f138738f196c2995aa96f98`;项目初始化元数据提交见 `git log`。
- 基线标签:`v2.2.2-build20260703.0335-real-user-test`
- 源码根:`/Users/ar/Projects/PrivateVoice-independent-developer/03-O/C1.source/privatevoice.src`
- 自动图谱:`/Users/ar/Projects/PrivateVoice-independent-developer/03-O/.codebase-memory/`;只辅助定位。
- Status: `enabled`.
- Tool: `codebase-memory-mcp` 0.8.1.
- Current project name after path unification: `Users-ar-Projects-PrivateVoice-03-O`.
- Current artifact note: `.codebase-memory/artifact.json` must record project `Users-ar-Projects-PrivateVoice-03-O` before each freeze / release package.
- Shared artifact: `.codebase-memory/graph.db.zst`; metadata: `.codebase-memory/artifact.json`.
- Scope: `/Users/ar/Projects/PrivateVoice/03-O`.
- Refresh command: `codebase-memory-mcp cli index_repository '{"repo_path":"/Users/ar/Projects/PrivateVoice/03-O"}'`.
- Current `indexed_at`, commit, node count, and edge count are recorded in `.codebase-memory/artifact.json`.
- Excluded by indexer: `.git`, `K3.运营与发布资料/legacy-运营资料/PrivateVoice-26.0604上架`, `K3.运营与发布资料/legacy-运营资料/运营文档`, `C1.source/privatevoice-2.2.1-recovered.src`, `C1.source/privatevoice.src/frontend/dist`, `C1.source/privatevoice.src/frontend/node_modules`.
- Query example after regenerating graph from Git root: `codebase-memory-mcp cli search_graph '{"project":"Users-ar-Projects-PrivateVoice-03-O","query":"model registry","limit":5}'`.
- This automatic graph is an exploration aid only; it does not replace source reading, tests, QA evidence, or this `CODEGRAPH.md`.
- Refresh rule: regenerate `.codebase-memory/` before each source freeze, version freeze, formal rollback-capable test package, or release package; daily Coder work-in-progress changes do not force a refresh.
- Freeze record requirement: record the refresh command, `.codebase-memory/artifact.json` path, indexed commit, freeze commit, and whether the two commits match or differ only by `.codebase-memory/` artifact updates.
## 核心入口
## Core Entrypoints
- 启动与应用 wiring:`C1.source/privatevoice.src/main.go`、`app.go`。
- macOS 文字输出:`C1.source/privatevoice.src/internal/input/paste_darwin.go`。
- 音频:`C1.source/privatevoice.src/internal/audio/recorder.go`。
- macOS 热键:`C1.source/privatevoice.src/internal/hotkey/hotkey_darwin.go`。
- 本地 ASR:`C1.source/privatevoice.src/internal/engine/engine_darwin.go`。
- 本地 DMG:`C1.source/privatevoice.src/scripts/build-local-macos.sh`。
- Developer ID / notarization:`C1.source/privatevoice.src/scripts/build-release-macos.sh`。
- `C1.source/privatevoice.src/main.go`: process startup, data migration, logger, single-instance guard.
- `C1.source/privatevoice.src/app.go`: Wails app wiring, settings window, tray, recorder, hotkey loop, ASR init, paste orchestration.
- `C1.source/privatevoice.src/embed.go`: embeds frontend assets and app/tray icons.
## 当前基线保护
## Language And Model Registry
- 本项目当前只代表 2.2.2 / 20260703.0335 旧代码;不得把后续 MAS AX router、MAS sandbox 实验或 2.2.3 改造直接复制进来。
- 既有 macOS、Windows preview、模型下载安全、paste/clipboard 保护行为未经独立任务和 QA 计划不得改动。
- Developer ID 直接输入、签名、公证、安装、更新与回滚是后续独立任务,不得从历史文档直接宣称已完成。
- `C1.source/privatevoice.src/internal/model/profile.go`: model and language IDs, model profile shape, install status types.
- `C1.source/privatevoice.src/internal/model/registry.go`: language profile order, model profiles, language profiles, and normalization.
- `C1.source/privatevoice.src/internal/modelselection/selection.go`: resolves current language and model, including manual-model fallback.
- Round 6 Cantonese path:
  - Language ID: `yue-HK`, displayed as `粤语`.
  - Default model: `sensevoice-yue-2025-09-09`.
  - Backend: SenseVoice with `LanguageParam="yue"`.
  - The Cantonese language profile intentionally has no upgrade models, so Qwen3-ASR and X-ASR are not shown as Cantonese-specific options.
## 自动图谱与维护
## Platform Modules
- Audio: `C1.source/privatevoice.src/internal/audio/recorder.go`
- Hotkey:
  - macOS: `C1.source/privatevoice.src/internal/hotkey/hotkey_darwin.go`
  - Windows: `C1.source/privatevoice.src/internal/hotkey/hotkey_windows.go`
- Text input:
  - macOS: `C1.source/privatevoice.src/internal/input/paste_darwin.go`
  - Windows: `C1.source/privatevoice.src/internal/input/paste_windows.go`
- ASR engine:
  - macOS: `C1.source/privatevoice.src/internal/engine/engine_darwin.go`
  - Windows: `C1.source/privatevoice.src/internal/engine/engine_windows.go`
  - Linux: `C1.source/privatevoice.src/internal/engine/engine_linux.go`
- Overlay:
  - macOS: `C1.source/privatevoice.src/internal/overlay/overlay_darwin.go`
  - Windows: `C1.source/privatevoice.src/internal/overlay/overlay_windows.go`
## Windows Preview Scope
- Windows preview supports `SenseVoice` only.
- Non-SenseVoice models remain visible in settings but are disabled through `model.IsModelSupportedInCurrentBuild`.
- Windows unsupported reason: `windows_preview_unsupported`.
- Windows overlay remains native Win32/GDI+, with a larger translucent spectrum-style capsule indicator for recording states.
- Build script: `C1.source/privatevoice.src/scripts/build-windows-preview.sh`.
- Evidence verifier: `C1.source/privatevoice.src/scripts/verify-windows-qa-evidence.sh`.
## macOS Package Scope
- Local DMG script: `C1.source/privatevoice.src/scripts/build-local-macos.sh`.
- Universal DMG script: `C1.source/privatevoice.src/scripts/build-local-macos-universal.sh`.
- Monterey compatibility script: `C1.source/privatevoice.src/scripts/build-local-macos-monterey.sh`.
- Developer ID / notarization script: `C1.source/privatevoice.src/scripts/build-release-macos.sh`.
- Mainline macOS local packages keep `LSMinimumSystemVersion=14.0`.
- Monterey-compatible packages remain a separate build line.
## Standard Verification Commands
Run from `C1.source/privatevoice.src`:
```bash
npm --prefix frontend run build
go test ./...
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ go test -exec=/usr/bin/true ./...
./scripts/build-windows-preview.sh
./scripts/build-local-macos.sh arm64
./scripts/build-local-macos.sh x86_64
./scripts/build-local-macos-universal.sh
./scripts/verify-windows-qa-evidence.sh /path/to/qa-evidence-YYYYMMDD-HHMMSS.zip
```
## Known Gaps
- Windows runtime QA must still be performed on Windows 10/11 hardware before calling Windows stable.
- macOS 2.2.2 real-user test DMGs are locally signed and not notarized.
- Monterey compatibility was not revalidated for the 2.2.2 package set.
- Independent-site sales still need Developer ID release packaging, download page, authorization/activation, update strategy, support path, release manifest, and rollback policy.
- 生成命令:`codebase-memory-mcp cli index_repository '{"repo_path":"/Users/ar/Projects/PrivateVoice-independent-developer/03-O"}'`
- `CODEGRAPH.md` 是人工代码地图;每次源码冻结、版本冻结或发布候选前更新并记录 indexed commit。