mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-17 13:50:39 -07:00
Ships the Capture release end to end. Global-hotkey dictation with synthetic paste into the focused app on macOS and Windows, an on-screen pill across recording / transcribing / refining, customizable push-to- talk and toggle chords, and an accessibility-permission prompt scoped to Settings → Captures with inline re-check feedback. Voice profiles gain optional personalities that power compose / rewrite / respond actions via a local Qwen3 LLM — shared with refinement, so there is one local LLM in the app, not two. Refinement hardened with deterministic Whisper-loop collapse before the LLM sees the transcript, per-capture flag snapshots for re-runs, and a ten-transcript evaluation harness across every bundled refinement size. Version bump 0.4.5 → 0.5.0. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
43 lines
1.5 KiB
Rust
43 lines
1.5 KiB
Rust
//! Platform permission gate for the auto-paste pipeline.
|
|
//!
|
|
//! On macOS, posting synthetic keyboard events and reading focused-UI state
|
|
//! via the AX API both require the host process to be listed under System
|
|
//! Settings → Privacy & Security → Accessibility. Without that trust,
|
|
//! `CGEventPost` silently drops events and `AXUIElementCopyAttributeValue`
|
|
//! returns an error. We surface a boolean check up front so the paste
|
|
//! pipeline can short-circuit with a clear "grant permission" message
|
|
//! instead of running through the full save → write → post → restore dance
|
|
//! with nothing to show for it.
|
|
//!
|
|
//! Windows has no equivalent user-facing permission — `SendInput` and
|
|
//! UIAutomation work for any non-elevated target out of the box. (UAC /
|
|
//! UIPI still blocks sending input *into* an elevated target window from a
|
|
//! non-elevated process, but that's per-target, not a global switch, and
|
|
//! there's no Settings pane to send users to.) So the Windows branch just
|
|
//! returns `true`.
|
|
|
|
#[cfg(target_os = "macos")]
|
|
mod ffi {
|
|
#[link(name = "ApplicationServices", kind = "framework")]
|
|
extern "C" {
|
|
/// Returns true when the current process is listed in Accessibility.
|
|
/// No prompt side-effect.
|
|
pub fn AXIsProcessTrusted() -> bool;
|
|
}
|
|
}
|
|
|
|
#[cfg(target_os = "macos")]
|
|
pub fn is_trusted() -> bool {
|
|
unsafe { ffi::AXIsProcessTrusted() }
|
|
}
|
|
|
|
#[cfg(target_os = "windows")]
|
|
pub fn is_trusted() -> bool {
|
|
true
|
|
}
|
|
|
|
#[cfg(not(any(target_os = "macos", target_os = "windows")))]
|
|
pub fn is_trusted() -> bool {
|
|
false
|
|
}
|