Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/speech.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Native speech

on:
push:
paths:
- crates/speech/**
- Cargo.toml
- Cargo.lock
- .github/workflows/speech.yml
pull_request:
paths:
- crates/speech/**
- Cargo.toml
- Cargo.lock
- .github/workflows/speech.yml

jobs:
native:
name: Speech (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-14, macos-15-intel, windows-2022, ubuntu-latest]
env:
MACOSX_DEPLOYMENT_TARGET: '11.0'
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy -p robius-speech --all-targets -- -D warnings
- run: cargo test -p robius-speech
- name: Apple native lifecycle regressions
if: runner.os == 'macOS'
run: bash crates/speech/swift/tests/run.sh
- name: Compile iOS backends
if: matrix.os == 'macos-14'
run: |
rustup target add aarch64-apple-ios aarch64-apple-ios-sim
cargo check -p robius-speech --target aarch64-apple-ios
cargo check -p robius-speech --target aarch64-apple-ios-sim
- uses: actions/setup-java@v4
if: matrix.os == 'macos-14'
with:
distribution: temurin
java-version: '17'
- name: Android speech lifecycle regressions
if: matrix.os == 'macos-14'
run: python3 crates/speech/tests/android_retry_test.py
140 changes: 130 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ There's also a [status table](#crate--platform-status-table) that shows what eac
* [`robius-share`](crates/share/): opens the native system share sheet so you can share a file or other content with a different app on your system.
* This is implemented using `Intent.createChooser` on Android, `UIActivityViewController` on iOS, `NSSharingServicePicker` on macOS, and the WinRT Share UI on Windows.
* Linux doesn't really have a system share sheet, so we wrote a custom XDG portal connection that still supports every possible type of share payload.
* [`robius-speech`](crates/speech/): streams native speech-to-text results and microphone levels on macOS, iOS, Android, and Windows.
* Provides recording sessions with partial/final transcripts, graceful stop, and cancellation, independently of the UI toolkit.
* Linux doesn't offer any OS-provided speech-to-text functionality, so this crate can't do anything on Linux.
* [`robius-web-auth-session`](crates/web_auth_session/): runs an OAuth/SSO login process in the OS's own in-app browser session, and then sends the result back to your app.
* Currently this is for iOS only, based on `ASWebAuthenticationSession`. There's no other safe/supported way to do web login on iOS, because otherwise iOS will suspend your app while showing the browser.

Expand All @@ -49,6 +52,7 @@ Symbol legend: ✅ fully supported · ⚠️ partial, or has issues · 🚧 unde
| [`robius-location`](crates/location/) | ✅ `CLLocationManager` (CoreLocation) | ✅ `CLLocationManager` (CoreLocation) | ✅ `LocationManager` | ✅ `Geolocator` (`Windows.Devices.Geolocation`, WinRT) | ✅ XDG Location portal, with a `GeoClue` fallback |
| [`robius-open`](crates/open/) | ✅ `NSWorkspace.openURL` | ✅ `UIApplication.openURL` | ✅ `Intent` (`ACTION_VIEW`) | ✅ `Launcher.LaunchUriAsync` (WinRT) | ✅ `xdg-open` |
| [`robius-share`](crates/share/) | ✅ `NSSharingServicePicker` | ✅ `UIActivityViewController` | ✅ `ACTION_SEND` / `ACTION_SEND_MULTIPLE` via `Intent.createChooser` | ✅ WinRT Share UI (`DataTransferManager`) | ✅ XDG portal "Open With" chooser (`OpenURI` / `OpenFile`), or its `SaveFiles` dialog for multi-item payloads; `xdg-open` fallback |
| [`robius-speech`](crates/speech/) | ✅ `SFSpeechRecognizer` + `AVAudioEngine` | ✅ `SFSpeechRecognizer` + `AVAudioEngine` | ✅ `SpeechRecognizer` (needs an installed recognition service) | ✅ SAPI dictation (needs an installed speech language) | ❌ no OS-native speech-to-text service exists |
| [`robius-web-auth-session`](crates/web_auth_session/) | ❌ not supported | ✅ `ASWebAuthenticationSession` | 🚧 planned (custom chrome tabs) | ❌ not supported | ❌ not supported |


Expand Down
3 changes: 3 additions & 0 deletions crates/speech/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/target
/Cargo.lock
__pycache__/
35 changes: 35 additions & 0 deletions crates/speech/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[package]
name = "robius-speech"
version.workspace = true
edition.workspace = true
authors.workspace = true
description = "Native streaming speech-to-text input and microphone capture for Rust apps"
documentation = "https://docs.rs/robius-speech"
homepage.workspace = true
keywords = ["robius", "speech", "dictation", "microphone", "STT"]
categories.workspace = true
license.workspace = true
repository.workspace = true
readme = "README.md"

[lints.rust]
keyword_idents_2024 = "forbid"
non_ascii_idents = "forbid"
non_local_definitions = "forbid"
unsafe_op_in_unsafe_fn = "forbid"
unnameable_types = "warn"
unused_import_braces = "warn"

[lints.clippy]
collapsible_if = "allow"
collapsible_else_if = "allow"
uninlined_format_args = "allow"

[dependencies]

[target.'cfg(target_os = "windows")'.dependencies]
windows = { version = "0.61.3", default-features = false, features = ["Win32_Media_Speech", "Win32_System_Com", "Win32_Globalization"] }

[target.'cfg(target_os = "android")'.dependencies]
jni.workspace = true
robius-android-env.workspace = true
21 changes: 21 additions & 0 deletions crates/speech/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Project Robius Developers

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading
Loading