Voice input could never have worked. `ChatPanel` reached for `SpeechRecognition`, which WebView2 does not provide, so the only branch ever taken was the one reporting "当前 WebView 不支持语音输入" — and the architecture had specified a different route all along (`01_Architecture_Design.md:1057-1063`): press to record, upload the audio, let AstrBot transcribe it. That is what this does. `MediaRecorder` captures to Opus in WebM, the audio is uploaded through the same attachment boundary as any other file, and it is sent with no text of its own — the audio *is* the message, and the server's speech-to-text stage turns it into one. The `record` segment this produces comes for free from the message-composition fix earlier today. The slot is fixed at the start of the recording, so a recording finished after the user switched tabs still reaches the conversation they were speaking to (`:1065` binds the microphone to the focused instance). Failures are mapped rather than reported raw. Refused permission, no microphone, and a microphone held by another program need three different actions from the user; the old code told them "check microphone permissions" for all of them. A WebView2 build with no audio codec is detected before the microphone is opened rather than by letting `MediaRecorder` throw. The microphone track is stopped on every exit path, including a failed encode and a recorder that cannot be constructed. Leaving it live is what keeps Windows' recording indicator on after the user has finished speaking, and each of those paths has a test that fails without it. One thing this cannot settle without a real build: WebView2 raises a `PermissionRequested` event for the microphone that the host application handles, and Tauri registers a handler only when its `clipboard` option is enabled, which this app does not enable. So WebView2's own default decides whether the prompt appears, is auto-granted, or is auto-denied. The failure mapping exists so that whichever it turns out to be, the user is told something they can act on. Frontend tests 47 -> 59. All five mutations of the new assertions were confirmed to fail. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|---|---|---|
| .forgejo/workflows | ||
| assets | ||
| crates | ||
| docs | ||
| src | ||
| src-tauri | ||
| tests | ||
| .editorconfig | ||
| .gitignore | ||
| .node-version | ||
| .npmrc | ||
| .prettierignore | ||
| AGENTS.md | ||
| AstrBot_Desktop_Codex_Forgejo_Predevelopment_Workflow.md | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CHANGELOG.md | ||
| eslint.config.js | ||
| index.html | ||
| package.json | ||
| pet.html | ||
| playwright.config.ts | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| README.md | ||
| rust-toolchain.toml | ||
| tsconfig.app.json | ||
| tsconfig.json | ||
| tsconfig.node.json | ||
| vite.config.ts | ||
AstrBot Desktop
AstrBot Desktop is a Windows companion and local-assistance client built with Tauri 2, React, TypeScript, Vite, and Rust.
The MVP supports two isolated active AstrBot connection slots:
companionfor chat, proactive messages, voice, and game companionship;operationsfor user-authorized, policy-controlled diagnostics and recoverable file operations.
Security boundaries
- Credentials remain in Windows secure storage and are never exposed to React.
- Server tool requests are proposals; the Rust policy layer makes the final decision.
- The application does not provide arbitrary PowerShell, CMD, or shell execution.
- NAS transfers use
plan -> dry run -> copy -> verify -> commitand preserve source files on failure.
Current phase
The repository is in the P00 bootstrap and high-risk Spike phase. See docs/implementation-plan.md and docs/progress.md.
Authoritative documents
AGENTS.mddocs/01_Architecture_Design.mddocs/02_Codex_Implementation_Tasks.mdAstrBot_Desktop_Codex_Forgejo_Predevelopment_Workflow.md
Development prerequisites
- Windows 11
- Node.js and pnpm
- Rust stable with the MSVC target
- Visual Studio 2022 Build Tools with Desktop development with C++
- WebView2 Evergreen Runtime
Local commands
pnpm install --frozen-lockfile
pnpm check:frontend
pnpm test:e2e
pnpm rust:fmt
pnpm rust:clippy
pnpm rust:test
pnpm rust:check
pnpm tauri:dev
pnpm tauri:build
On Windows, Cargo build output can be redirected away from a NAS workspace:
$env:CARGO_TARGET_DIR = "$env:LOCALAPPDATA\Temp\AstrBot-Desktop-target"
The 30-minute connection soak and the controlled Windows UIA/capture smoke are ignored by the normal suite and must be invoked explicitly as documented in tests/README.md. The UIA/capture smoke opens only a generated, non-sensitive standard dialog and never writes captured pixels to disk.
P00 results and unresolved environment boundaries are recorded in docs/spikes and docs/progress.md.