diff --git a/docs/VOICE-PLAN.md b/docs/VOICE-PLAN.md index ace149592..36f2c1c63 100644 --- a/docs/VOICE-PLAN.md +++ b/docs/VOICE-PLAN.md @@ -52,7 +52,7 @@ Superseded by [the voice bar](#the-voice-bar-0261). Kept for the facts and for w ## Facts (Pixel 7 Pro, 2026-10-31) -- **Engine:** Voxtype 1.1.1 (`voxtype-bin`; `wtype` installed) runs as a systemd user daemon (`voxtype.service`) with Omarchy's config (`/usr/share/omarchy/default/voxtype/config.toml`): Whisper `base.en` is the default model, output `type`, `max_duration_secs = 60`, `state_file = "auto"`, `[hotkey] enabled = false`. Voice settings > Longest recording (omamobile-shell 0.2.73) sets `audio.max_duration_secs` in the user's config to 1, 2, 5 or 10 minutes, and the bar counts down to it; the wait after Done grows with the recording. +- **Engine:** Voxtype 1.1.1 (`voxtype-bin`; `wtype` installed) runs as a systemd user daemon (`voxtype.service`) with Omarchy's config (`/usr/share/omarchy/default/voxtype/config.toml`): Whisper `base.en` is the default model, output `type`, `max_duration_secs = 60`, `state_file = "auto"`, `[hotkey] enabled = false`. From omamobile-shell 0.2.82 the root image ships it ready: `voxtype-bin` in `rootfs/packages.base`, base.en in `omamobile-voice` 0.1.0 (`/usr/share/omamobile/voice/models`, fetched at build time from a pinned whisper.cpp commit and sha256), and `omamobile-setup-user` doing what `omarchy-voxtype-install` does once per user without the download (Omarchy's config, a link to the model in `~/.local/share/voxtype/models`, `systemctl --user enable voxtype.service`, Omarchy's install invitation marked done). Voice settings > Longest recording (omamobile-shell 0.2.73) sets `audio.max_duration_secs` in the user's config to 1, 2, 5 or 10 minutes, and the bar counts down to it; the wait after Done grows with the recording. - **Control:** `voxtype record start|stop|toggle|cancel`. `record start` takes `--type | --clipboard | --paste | --file[=PATH]`, `--model ` (for this recording only: any downloaded model; the daemon keeps it loaded), `--no-osd`, `--auto-submit` and `--smart-auto-submit` (`voxtype record start --help` on the phone). - **State:** `$XDG_RUNTIME_DIR/voxtype/state` holds `idle`, `recording`, `streaming` or `transcribing`. `voxtype-audio-bridge` prints one NDJSON frame per audio block (`{"peak","rms","vad","ts_ms"}`) from the daemon's `audio.sock`. Voxtype's own `voxtype-shared/{StateReader,AudioBridge}.qml` show how to read both; the plugin follows them and doesn't import them. - **OSD:** Voxtype's GTK overlay anchors bottom centre, over the dock and the home pill, so every recording the shell starts passes `--no-osd`. diff --git a/docs/release-notes/2026-11-DRAFT.md b/docs/release-notes/2026-11-DRAFT.md index 6aff56f5c..afc02579a 100644 --- a/docs/release-notes/2026-11-DRAFT.md +++ b/docs/release-notes/2026-11-DRAFT.md @@ -42,7 +42,7 @@ From [docs/DEVICES.md](../DEVICES.md) on the release day: ### New in the last weeks -- **Voice input:** a voice bar on the keyboard with live words as you speak, on-device speech recognition, and a setting for the longest recording. +- **Voice input, ready out of the box:** a voice bar on the keyboard with live words as you speak, on-device speech recognition, and a setting for the longest recording. Voxtype and its English speech model (Whisper base.en) come in the image, so dictation works from the first login with no setup step and no download, offline too. - **Media controls** with album art in the notification shade and on the lock screen. - **Lock screen:** a glance view (time, date, weather, notifications), the battery level, and a clock that follows the bar's 12/24-hour setting. - **Fluid home and drawer gestures**, pill gestures, and hiding or showing the keyboard from the home pill. diff --git a/packages/omamobile-shell/PKGBUILD b/packages/omamobile-shell/PKGBUILD index 783187520..399c75680 100644 --- a/packages/omamobile-shell/PKGBUILD +++ b/packages/omamobile-shell/PKGBUILD @@ -15,7 +15,9 @@ depends=(omarchy omamobile-apps 'omamobile-omarchy>=0.1.11' omamobile-owl-widget # Both are in Omarchy's base package list, which root images install. foot xdg-terminal-exec # guard for hand-built/partial installations xdg-desktop-portal-gnome) # the file chooser (portal/hyprland-portals.conf) -optdepends=('fprintd: fingerprint setup and unlock (with omamobile-fingerprint)') +optdepends=('fprintd: fingerprint setup and unlock (with omamobile-fingerprint)' + 'omamobile-voice: the speech model for voice input, so Voxtype works with no download (the root image has it)' + 'voxtype-bin: voice input (the root image has it; or Install > AI > Dictation)') backup=(etc/xdg/xdg-desktop-portal/hyprland-portals.conf) install=omamobile-shell.install diff --git a/packages/omamobile-shell/README.md b/packages/omamobile-shell/README.md index e56372ce2..a49d28484 100644 --- a/packages/omamobile-shell/README.md +++ b/packages/omamobile-shell/README.md @@ -16,7 +16,7 @@ Omarchy Mobile's phone profile for Omarchy's own shell. It isn't a fork: these a | `plugins/omamobile.back` | The back gesture: swipe in from a side edge for Escape | | `plugins/omamobile.update` | The update sheet: Omarchy's update for a phone, through `omamobile-update` (package `omamobile-omarchy`) | | `plugins/omamobile.voice` | The voice bar, through Voxtype: hold the pill in an app or the search bar on the home screen (or the keyboard's Mic key, Power + Volume Up, the Dictation tile, whose chevron opens the settings); it types into the app, sends to the agent in its terminal, or asks it from the home screen (docs/VOICE-PLAN.md) | -| `bin/omamobile-voice-preview` | The voice bar's live preview: a second capture of the microphone (in memory only), transcribed in chunks with tiny.en and Whisper's context cut to the chunk while Voxtype records, one JSON line per pass; the bar shows the words in the theme's muted colour until the daemon's final text replaces them. Voxtype 1.1.1 can't hand its own partial text over (docs/VOICE-PLAN.md, phase 3) | +| `bin/omamobile-voice-preview` | The voice bar's live preview: a second capture of the microphone (in memory only), transcribed in chunks with tiny.en (base.en when tiny.en isn't downloaded) and Whisper's context cut to the chunk while Voxtype records, one JSON line per pass; the bar shows the words in the theme's muted colour until the daemon's final text replaces them. Voxtype 1.1.1 can't hand its own partial text over (docs/VOICE-PLAN.md, phase 3) | | `plugins/omamobile.access` | The permission sheet: "Allow Camera to use the camera?" with the app's icon and two large buttons, in place of xdg-desktop-portal-gtk's desktop dialog | | `plugins/omamobile.fingerprint` | The under-display fingerprint sensor: target during verification, enrollment screen | | `profile/shell.json` | The phone layout the setup seeds once | @@ -50,6 +50,44 @@ which normal root images install. The explicit dependencies are a guard for hand-built or partial installations: both agent launch and installing a selection need Omarchy's terminal launcher. +## Voice input + +Voice works out of the box on a fresh install: no Install > AI > Dictation +step and no download. The root image installs Voxtype (`voxtype-bin` from +[omarchy], in `rootfs/packages.base`) and Whisper's base.en speech model +(`packages/omamobile-voice`, 141 MiB in `/usr/share/omamobile/voice/models`). +The model counts twice in the image: the image also carries its own copy of +the [omamobile] repository (`/var/lib/omamobile/repo`, for offline +reinstalls), where the package archive is another 141 MiB that won't +compress. With voxtype-bin (71 MB installed, its archive is in Omarchy's +repository, not ours) the root image grows by about 370 MB unpacked and +about 325 MB compressed (2.8 GB before). + +At the user's first setup `omamobile-setup-user` does what Omarchy's +`omarchy-voxtype-install` does, minus the download: it copies Omarchy's +Voxtype config, links the shipped model into +`~/.local/share/voxtype/models` (the only place Voxtype looks), enables +the packaged `voxtype.service` user daemon (it starts with the graphical +session) and marks Omarchy's "Install Dictation" invitation done. The +config and the link happen once per user, and a config or model the user +already has stays; the enable is retried at each login until it works +(firstboot may run without a user manager). The settings' Fast (tiny.en, +75 MB) and Accurate (small.en) models still download on request; without +tiny.en the live preview uses base.en, with a pass every 2.5 s instead of +1.2 s. Phones installed before this keep their setup: `omamobile-voice` is +an optional dependency, and Omarchy's own install works as before. + +To remove dictation completely: Remove > Dictation (Omarchy's +`omarchy-voxtype-remove`) takes out voxtype-bin, the user's Voxtype config +and the model link, and setup leaves it removed; the shipped model stays +until `sudo pacman -R omamobile-voice` frees its 141 MiB. Installing +Dictation again through Omarchy's menu then downloads base.en itself. + +Building `omamobile-voice` needs huggingface.co the first time on a build +machine: the model comes from a pinned commit of whisper.cpp's model +repository with a pinned sha256, and makepkg keeps it in its source cache +afterwards. + ## File dialogs Open, save and choose-a-folder requests through the portal (Qt, GTK, Electron and Flatpak apps alike) get Nautilus's libadwaita file chooser from xdg-desktop-portal-gnome, not xdg-desktop-portal-gtk's GTK 3 desktop chooser, whose Places sidebar took half of the 480 px width. Nautilus's chooser folds its sidebar away at phone width and has touch-sized rows; `hypr/phone.lua` tiles it, even when it has a parent window, so it fills the screen between the bar and the on-screen keyboard. Only FileChooser goes to the gnome backend: its other interfaces need gnome-shell. It runs without gnome-shell (its Mutter service channel is missing, so it falls back to a plain Wayland connection). xdg-desktop-portal-gtk stays as the fallback and for its other interfaces. GTK apps that would draw their own chooser in-process are sent to the portal too (`GTK_USE_PORTAL=1` for GTK 3, `GDK_DEBUG=portals` for GTK 4, in `environment.d/20-omamobile-osk.conf`); Qt Widgets apps keep Omarchy's `QT_QPA_PLATFORMTHEME=gtk3` for now. diff --git a/packages/omamobile-shell/bin/omamobile-setup-user b/packages/omamobile-shell/bin/omamobile-setup-user index 5c34f0880..bb61fbdce 100755 --- a/packages/omamobile-shell/bin/omamobile-setup-user +++ b/packages/omamobile-shell/bin/omamobile-setup-user @@ -402,8 +402,8 @@ if omarchy-done ensure omamobile-back-plugin; then add_plugin omamobile.back fi # Voice input (omamobile.voice): hold the home pill to ask the agent, the -# keyboard strip's mic key to dictate, through Voxtype when it is -# installed (Install > AI > Dictation); without it the sheet says so. +# keyboard strip's mic key to dictate, through Voxtype (in the root image, +# set up below; or Install > AI > Dictation); without it the sheet says so. if omarchy-done ensure omamobile-voice-plugin; then add_plugin omamobile.voice fi @@ -415,6 +415,45 @@ if omarchy-done ensure omamobile-menu-voice; then sed -i '0,/^{/s//{\n "setup.voice": {"icon":"\xf3\xb0\x8d\xac","label":"Voice","description":"Speech model and how voice input starts","action":"omarchy-shell shell summon omamobile.voice '"'"'{\\"page\\":\\"settings\\"}'"'"'"},/' "$extension" fi fi +# Voice out of the box: the root image ships voxtype-bin (rootfs/packages.base) +# and Whisper's base.en (omamobile-voice, in /usr/share/omamobile/voice/models), +# so a new user gets what Omarchy's Install > AI > Dictation +# (omarchy-voxtype-install) sets up, without its 142 MB download: Omarchy's +# Voxtype config, the model in Voxtype's models directory (a link to the +# shipped file; Voxtype looks only in ~/.local/share/voxtype/models) and the +# packaged user daemon enabled, so it starts with the graphical session. +# Omarchy's "Install Dictation" invitation is marked done, as its install +# would leave it. Only with both installed. The config, the link and the +# invitation happen once per user: a config or a model the user already has +# stays, and one they delete later isn't brought back. The enable has its +# own marker, set only when it succeeds, so a failed one (firstboot carries +# on without a user manager) is tried again at the next login. A user who +# removes Dictation (Remove > Dictation takes voxtype-bin out) gets nothing. +voxconf=~/.config/voxtype/config.toml +voxmodels=${OMAMOBILE_VOICE_MODELS:-/usr/share/omamobile/voice/models} +if command -v "${OMAMOBILE_VOXTYPE:-voxtype}" >/dev/null && [[ -f $voxmodels/ggml-base.en.bin ]]; then + if omarchy-done ensure omamobile-voxtype-setup; then + omarchy-done mark voxtype-install-invitation + voxdefault=${OMARCHY_PATH:-/usr/share/omarchy}/default/voxtype/config.toml + if [[ ! -f $voxconf && -f $voxdefault ]]; then + { mkdir -p "${voxconf%/*}" && cp "$voxdefault" "$voxconf"; } || + echo "omamobile-setup-user: could not copy Omarchy's Voxtype config" >&2 + fi + mkdir -p ~/.local/share/voxtype/models || true + for model in "$voxmodels"/ggml-*.bin; do + [[ -e ~/.local/share/voxtype/models/${model##*/} ]] || + ln -sfn "$model" ~/.local/share/voxtype/models/"${model##*/}" || + echo "omamobile-setup-user: could not link ${model##*/}" >&2 + done + fi + if omarchy-done check omamobile-voxtype-setup && ! omarchy-done check omamobile-voxtype-enabled; then + if systemctl --user enable voxtype.service; then + omarchy-done mark omamobile-voxtype-enabled + else + echo "omamobile-setup-user: could not enable voxtype.service; trying again at the next login" >&2 + fi + fi +fi # Voxtype on the phone (docs/VOICE-PLAN.md, phase 3): Omarchy's base.en # stays the model, with Whisper's audio context cut to the clip's length # (context_window_optimization, for clips under 22.5 s). On the Pixel 7 Pro @@ -429,7 +468,6 @@ fi # marker by more than a minute): a model the user chose since stays. # Voxtype ignores a per-recording `--model` it hasn't prepared, so this is # the daemon's own config; it restarts once, and only if it was running. -voxconf=~/.config/voxtype/config.toml voxdone=~/.local/state/omarchy/done if [[ -f $voxconf ]]; then voxrestart=0 diff --git a/packages/omamobile-shell/plugins/omamobile.quicksettings/tile-state.sh b/packages/omamobile-shell/plugins/omamobile.quicksettings/tile-state.sh index 0dea1403d..807b6b6ca 100755 --- a/packages/omamobile-shell/plugins/omamobile.quicksettings/tile-state.sh +++ b/packages/omamobile-shell/plugins/omamobile.quicksettings/tile-state.sh @@ -20,7 +20,8 @@ # data_status the operator and technology, when registered # dictation voxtype: on while recording, busy while transcribing, off # when idle; down when its user service isn't running, none -# without voxtype (it is an optional Omarchy install) +# without voxtype (in the root image; Remove > Dictation +# takes it out) t() { timeout 3 "$@" 2>/dev/null; } have() { command -v "$1" >/dev/null 2>&1; } diff --git a/packages/omamobile-shell/plugins/omamobile.voice/Voice.qml b/packages/omamobile-shell/plugins/omamobile.voice/Voice.qml index f6b097acc..9f068233d 100644 --- a/packages/omamobile-shell/plugins/omamobile.voice/Voice.qml +++ b/packages/omamobile-shell/plugins/omamobile.voice/Voice.qml @@ -14,7 +14,8 @@ import "Readable.js" as Readable import "../omamobile.launcher/LauncherModel.js" as LauncherModel // Voice input for the phone (docs/VOICE-PLAN.md): one voice bar, through -// Voxtype's user daemon (voxtype.service, Omarchy's Install > AI > +// Voxtype's user daemon (voxtype.service; in the root image, set up by +// omamobile-setup-user with the shipped base.en; or Omarchy's Install > AI > // Dictation). Speech is turned into text on the phone. // // The ways in, as on Android: a hold on the pill in an app, or on the @@ -525,7 +526,7 @@ Item { id: startProc onExited: function(exitCode) { if (exitCode !== 0 && root.phase === "starting") - root.fail("Voxtype isn't running. Install it with Install > AI > Dictation, or start voxtype.service.") + root.fail("Voxtype isn't running. Start voxtype.service, or install it with Install > AI > Dictation.") } } diff --git a/packages/omamobile-shell/test/setup-user.sh b/packages/omamobile-shell/test/setup-user.sh index d963b7c95..04ea7620e 100644 --- a/packages/omamobile-shell/test/setup-user.sh +++ b/packages/omamobile-shell/test/setup-user.sh @@ -25,7 +25,8 @@ fake gsettings 'echo "gsettings $*" >>"$HOME/calls" if [[ $1 == list-keys && $2 == org.gnome.nautilus.preferences ]]; then printf "default-folder-viewer\n"; [[ -n ${GSETTINGS_NO_CLICK_POLICY:-} ]] || printf "click-policy\n" fi' -fake systemctl 'echo "systemctl $*" >>"$HOME/calls"' +# systemctl: logs calls; fails while $HOME/systemctl-fails exists (no user manager) +fake systemctl 'echo "systemctl $*" >>"$HOME/calls"; [[ ! -e $HOME/systemctl-fails ]]' fake chromium 'echo "Chromium 153.0.0.0"' fake omamobile-keyboard-theme 'echo "omamobile-keyboard-theme $*" >>"$HOME/calls"' for f in monitors looknfeel autostart; do echo "-- $f" >"$H/.config/hypr/$f.lua"; done @@ -56,6 +57,8 @@ run() { env -i HOME="${RUN_HOME:-$H}" PATH="$F:/usr/bin:/bin" XDG_RUNTIME_DIR="$t" OMAMOBILE_SHELL_SHARE="$pkg" OMAMOBILE_SYSTEM_APPLICATIONS="$A" \ OMAMOBILE_DT="${RUN_DT:-$t/dt-gs201-cheetah}" OMAMOBILE_SQUEEKBOARD_SHARE="$pkg/squeekboard/keyboards" \ GSETTINGS_NO_CLICK_POLICY="${GSETTINGS_NO_CLICK_POLICY:-}" \ + OMAMOBILE_VOICE_MODELS="${RUN_VOICE_MODELS:-$t/no-voice-models}" OMAMOBILE_VOXTYPE="${RUN_VOXTYPE:-voxtype}" \ + OMARCHY_PATH="${RUN_OMARCHY_PATH:-$t/omarchy}" \ bash bin/omamobile-setup-user "$@" >"$t/out" 2>&1 || { cat "$t/out"; fail "omamobile-setup-user runs"; } } run @@ -238,6 +241,63 @@ assert voice["label"] == "Voice" and voice["icon"] == "\U000f036c", voice PY pass "voxtype: base.en with the context cut, 0.2.62's tiny.en undone once, a user's choices kept" +# Voice out of the box (omamobile-voice): with voxtype and the shipped +# base.en, a new user gets Omarchy's config, a link to the model and the +# daemon enabled, once, and Omarchy's install invitation marked done; a +# user's own config and model stay; nothing without voxtype or the model. +VM=$t/voice-models; mkdir -p "$VM" "$t/omarchy/default/voxtype" +echo model >"$VM/ggml-base.en.bin" +printf 'state_file = "auto"\n\n[whisper]\nmodel = "base.en"\nlanguage = "en"\n' >"$t/omarchy/default/voxtype/config.toml" +fake voxtype 'echo "voxtype $*" >>"$HOME/calls"' +hn=$t/voice-new; vhome "$hn"; rm -rf "$hn/.config/voxtype" "$hn/.local/share/voxtype" +RUN_HOME=$hn RUN_VOICE_MODELS=$VM run +[[ $(readlink "$hn/.local/share/voxtype/models/ggml-base.en.bin") == "$VM/ggml-base.en.bin" ]] || fail "the shipped base.en is linked into Voxtype's models directory" +vc "$hn" | grep -cx 'model = "base.en"' >/dev/null || fail "Omarchy's Voxtype config is copied for a new user" +vc "$hn" | grep -cx 'context_window_optimization = true' >/dev/null || fail "the new config gets the context cut too" +[[ $(grep -cx 'systemctl --user enable voxtype.service' "$hn/calls") == 1 ]] || fail "voxtype.service is enabled once" +[[ -e $hn/.local/state/omarchy/done/voxtype-install-invitation ]] || fail "Omarchy's Install Dictation invitation is marked done" +if grep -c '^voxtype ' "$hn/calls" >/dev/null 2>&1; then fail "nothing is downloaded (no voxtype setup)"; fi +rm "$hn/.local/share/voxtype/models/ggml-base.en.bin" +RUN_HOME=$hn RUN_VOICE_MODELS=$VM run +[[ ! -e $hn/.local/share/voxtype/models/ggml-base.en.bin ]] || fail "a model the user removed stays removed (once)" +[[ $(grep -cx 'systemctl --user enable voxtype.service' "$hn/calls") == 1 ]] || fail "voxtype.service is enabled only once" +# A user with Voxtype set up already: config and downloaded model stay +ho=$t/voice-own; vhome "$ho"; echo own >"$ho/.local/share/voxtype/models/ggml-base.en.bin" +printf '[whisper]\nmodel = "tiny.en"\n' >"$ho/.config/voxtype/config.toml" +RUN_HOME=$ho RUN_VOICE_MODELS=$VM run +[[ ! -L $ho/.local/share/voxtype/models/ggml-base.en.bin && $(cat "$ho/.local/share/voxtype/models/ggml-base.en.bin") == own ]] || fail "a downloaded model stays" +vc "$ho" | grep -cx 'model = "tiny.en"' >/dev/null || fail "the user's Voxtype config stays" +# A failed enable (firstboot without a user manager) is tried again at the +# next login, and only until it works; the once-only parts don't repeat +hr=$t/voice-retry; vhome "$hr"; rm -rf "$hr/.config/voxtype" "$hr/.local/share/voxtype"; touch "$hr/systemctl-fails" +RUN_HOME=$hr RUN_VOICE_MODELS=$VM run +[[ -L $hr/.local/share/voxtype/models/ggml-base.en.bin && -f $hr/.config/voxtype/config.toml ]] || fail "a failed enable still leaves the config and the link" +[[ ! -e $hr/.local/state/omarchy/done/omamobile-voxtype-enabled ]] || fail "a failed enable isn't marked done" +rm "$hr/systemctl-fails" "$hr/.config/voxtype/config.toml" +RUN_HOME=$hr RUN_VOICE_MODELS=$VM run +[[ $(grep -cx 'systemctl --user enable voxtype.service' "$hr/calls") == 2 ]] || fail "the enable is tried again at the next login" +[[ -e $hr/.local/state/omarchy/done/omamobile-voxtype-enabled ]] || fail "a working enable is marked done" +[[ ! -e $hr/.config/voxtype/config.toml ]] || fail "the retry doesn't copy the config again" +RUN_HOME=$hr RUN_VOICE_MODELS=$VM run +[[ $(grep -cx 'systemctl --user enable voxtype.service' "$hr/calls") == 2 ]] || fail "no enable after it worked" +# Dictation removed (voxtype gone) before an enable worked: nothing is retried +hd=$t/voice-removed; vhome "$hd"; rm -rf "$hd/.config/voxtype" "$hd/.local/share/voxtype"; touch "$hd/systemctl-fails" +RUN_HOME=$hd RUN_VOICE_MODELS=$VM run +rm -f "$hd/systemctl-fails"; rm -rf "$hd/.config/voxtype" "$hd/.local/share/voxtype" +RUN_HOME=$hd RUN_VOICE_MODELS=$VM RUN_VOXTYPE=$t/no-voxtype run +[[ $(grep -cx 'systemctl --user enable voxtype.service' "$hd/calls") == 1 ]] || fail "without voxtype the enable isn't retried" +[[ ! -e $hd/.local/share/voxtype && ! -e $hd/.config/voxtype ]] || fail "a user who removed Dictation gets nothing back" +# Without voxtype, or without the model package: nothing, and no marker +for case in novox nomodel; do + hx=$t/voice-$case; vhome "$hx"; rm -rf "$hx/.config/voxtype" "$hx/.local/share/voxtype" + if [[ $case == novox ]]; then RUN_HOME=$hx RUN_VOICE_MODELS=$VM RUN_VOXTYPE=$t/no-voxtype run; else RUN_HOME=$hx run; fi + [[ ! -e $hx/.local/share/voxtype && ! -e $hx/.config/voxtype && ! -e $hx/.local/state/omarchy/done/omamobile-voxtype-setup ]] || + fail "$case: Voxtype is left alone" + if grep -c 'enable voxtype' "$hx/calls" >/dev/null 2>&1; then fail "$case: voxtype.service isn't enabled"; fi +done +rm "$F/voxtype" +pass "voice out of the box: Omarchy's config and the shipped base.en once, the daemon enabled until it works, a removal kept" + # The keyboard: every layout the package carries linked (the terminal's, and # each language's from squeekboard/generate), the theme written at every # login, its gtk.css import and theme-set hook added once (H ran three times). diff --git a/packages/omamobile-shell/version b/packages/omamobile-shell/version index e36317a11..af8feae39 100644 --- a/packages/omamobile-shell/version +++ b/packages/omamobile-shell/version @@ -1 +1 @@ -0.2.81 +0.2.82 diff --git a/packages/omamobile-voice/LICENSE.whisper b/packages/omamobile-voice/LICENSE.whisper new file mode 100644 index 000000000..3e5f26bf4 --- /dev/null +++ b/packages/omamobile-voice/LICENSE.whisper @@ -0,0 +1,29 @@ +The speech model in this package is OpenAI's Whisper base.en, converted to +the ggml format by the whisper.cpp project +(https://huggingface.co/ggerganov/whisper.cpp). Both are under the MIT +license, and both notices follow: Whisper's (https://github.com/openai/whisper) +for the weights, whisper.cpp's (https://github.com/ggml-org/whisper.cpp) for +the ggml conversion. + +MIT License + +Copyright (c) 2022 OpenAI +Copyright (c) 2023-2026 The ggml authors + +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. diff --git a/packages/omamobile-voice/PKGBUILD b/packages/omamobile-voice/PKGBUILD new file mode 100644 index 000000000..88870f2a6 --- /dev/null +++ b/packages/omamobile-voice/PKGBUILD @@ -0,0 +1,44 @@ +# SPDX-License-Identifier: MIT +# Maintainer: Derek Ross +# +# Voice dictation out of the box: Whisper's base.en speech model, the one +# Omarchy's Install > AI > Dictation downloads for Voxtype, fetched at build +# time from a pinned commit of whisper.cpp's model repository and checked +# against its sha256 (nothing binary is committed here). The root image +# installs this next to voxtype-bin (rootfs/packages.base), and +# omamobile-setup-user (omamobile-shell) links the model into each user's +# ~/.local/share/voxtype/models, the only place Voxtype looks, and enables +# the daemon. The weights are OpenAI's Whisper (MIT), converted to ggml by +# whisper.cpp (MIT). +# The build needs huggingface.co the first time: makepkg keeps the file in +# SRCDEST (tools/build-packages: $ALARM_CACHE/src) under a commit-named file, +# so later builds and version bumps don't fetch it again, but a new build +# machine or a cleared cache does, and an outage there stops the build. +# makepkg has no fallback for one source; a copy on our own server would +# replace this URL (same file name, same sha256). +pkgname=omamobile-voice +pkgver=$(cat "${startdir:-.}/version") +pkgrel=1 +_commit=5359861c739e955e79d9a303bcbc70fb988958b1 +_model=ggml-base.en.bin +pkgdesc="Omarchy Mobile: Whisper's base.en speech model for Voxtype, so voice input works with no download" +arch=(any) +url="https://huggingface.co/ggerganov/whisper.cpp" +license=(MIT) +# Not a hard dependency: Omarchy's Remove > Dictation removes voxtype-bin +# with pacman -Rns, and this package must not refuse that. +optdepends=('voxtype-bin: the dictation engine that uses this model (in the root image)') +source=("$_model-$_commit::https://huggingface.co/ggerganov/whisper.cpp/resolve/$_commit/$_model" + LICENSE.whisper) +noextract=("$_model-$_commit") +sha256sums=('a03779c86df3323075f5e796cb2ce5029f00ec8869eee3fdfb897afe36c6d002' + SKIP) + +check() { + "$startdir/test/all" +} + +package() { + install -Dm644 "$srcdir/$_model-$_commit" "$pkgdir/usr/share/omamobile/voice/models/$_model" + install -Dm644 "$srcdir/LICENSE.whisper" "$pkgdir/usr/share/licenses/$pkgname/LICENSE.whisper" +} diff --git a/packages/omamobile-voice/test/all b/packages/omamobile-voice/test/all new file mode 100755 index 000000000..7467fe3df --- /dev/null +++ b/packages/omamobile-voice/test/all @@ -0,0 +1,55 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# omamobile-voice without the network: the model's source is pinned (a commit +# and a sha256, never a moving branch), it lands where omamobile-setup-user +# looks for it, and the root image installs both it and Voxtype. +# OMAMOBILE_VOICE_FETCH=1 also asks the server that the pinned file is still +# the one the sha256 names (a HEAD request, no download). +set -euo pipefail +here=$(cd -- "$(dirname -- "$0")/.." && pwd) +repo=$(cd -- "$here/../.." && pwd) +n=0 +ok() { n=$((n + 1)); echo "ok $n - $1"; } +fail() { echo "not ok - $1" >&2; exit 1; } +list() { sed -e 's/#.*//' -e 's/[[:space:]]//g' "$1" | grep -v '^$'; } + +bash -n "$here/PKGBUILD" || fail "PKGBUILD parses" +# shellcheck disable=SC1091 +eval "$(startdir=$here bash -c 'source "$startdir/PKGBUILD" + printf "pkgname=%q pkgver=%q commit=%q model=%q url0=%q sum0=%q\n" "$pkgname" "$pkgver" "$_commit" "$_model" "${source[0]}" "${sha256sums[0]}" + printf "deps=%q\n" "${depends[*]:-}"')" +[[ $pkgname == omamobile-voice && $pkgver == "$(cat "$here/version")" ]] || fail "name and version" +ok "PKGBUILD parses, version from ./version" + +[[ $commit =~ ^[0-9a-f]{40}$ ]] || fail "the source is pinned to a full commit, not a branch: $commit" +[[ $url0 == "$model-$commit::https://huggingface.co/ggerganov/whisper.cpp/resolve/$commit/$model" ]] || fail "the model's URL names the pinned commit: $url0" +[[ $sum0 =~ ^[0-9a-f]{64}$ ]] || fail "the model has a real sha256, not SKIP" +[[ $model == ggml-base.en.bin ]] || fail "base.en, Omarchy's and the shell's default model" +ok "the model is pinned: commit ${commit:0:12}, sha256 ${sum0:0:12}" + +[[ " $deps " != *" voxtype-bin "* ]] || fail "voxtype-bin is not a hard dependency (Remove > Dictation must work)" +ok "voxtype-bin is optional, so Omarchy's Remove > Dictation can remove it" + +grep -c 'pkgdir/usr/share/omamobile/voice/models/\$_model' "$here/PKGBUILD" >/dev/null || fail "installed to /usr/share/omamobile/voice/models" +# The rest needs the repository around the package (makepkg's check() in +# the build container has only the package's own directory) +if [[ ! -f $repo/rootfs/packages.base ]]; then + ok "# skip: the root image's lists and omamobile-shell (no repository here)" + exit 0 +fi +grep -c 'OMAMOBILE_VOICE_MODELS:-/usr/share/omamobile/voice/models}' "$repo/packages/omamobile-shell/bin/omamobile-setup-user" >/dev/null || + fail "omamobile-setup-user looks in the same directory" +ok "the model's directory is the one omamobile-setup-user links from" + +list "$repo/rootfs/packages.omamobile" | grep -cx omamobile-voice >/dev/null || fail "the root image installs omamobile-voice" +list "$repo/rootfs/packages.base" | grep -cx voxtype-bin >/dev/null || fail "the root image installs voxtype-bin" +for p in voxtype-bin wtype; do + if list "$repo/rootfs/packages.omarchy-skip" | grep -cx "$p" >/dev/null; then fail "packages.omarchy-skip leaves out $p"; fi +done +ok "the root image installs Voxtype and the model; wtype (Omarchy's list) isn't skipped" + +if [[ ${OMAMOBILE_VOICE_FETCH:-0} == 1 ]]; then + etag=$(curl -sfIL "${url0#*::}" | tr -d '\r' | sed -n 's/^x-linked-etag: "\(.*\)"$/\1/Ip' | head -1) + [[ $etag == "$sum0" ]] || fail "the server's file is the pinned sha256 (got: ${etag:-nothing})" + ok "the server's file matches the pinned sha256" +fi diff --git a/packages/omamobile-voice/version b/packages/omamobile-voice/version new file mode 100644 index 000000000..6e8bf73aa --- /dev/null +++ b/packages/omamobile-voice/version @@ -0,0 +1 @@ +0.1.0 diff --git a/rootfs/packages.base b/rootfs/packages.base index 276e5b6f8..90b18412f 100644 --- a/rootfs/packages.base +++ b/rootfs/packages.base @@ -26,3 +26,7 @@ archlinuxarm-keyring omarchy-keyring omarchy omarchy-settings +# Voice dictation out of the box (packages/omamobile-shell README, Voice +# input): Voxtype from [omarchy], what Install > AI > Dictation adds. Here, +# not in packages.omamobile, which takes [omamobile] packages only. +voxtype-bin diff --git a/rootfs/packages.omamobile b/rootfs/packages.omamobile index 912a2dd33..ffb4aada3 100644 --- a/rootfs/packages.omamobile +++ b/rootfs/packages.omamobile @@ -11,6 +11,8 @@ omamobile-keyring omamobile-firstboot omamobile-omarchy omamobile-shell +# Whisper's base.en for Voxtype, so voice works with no download +omamobile-voice omacam omamobile-apps omamobile-mirror diff --git a/tests/rootfs-smoke b/tests/rootfs-smoke index 171a11cd3..baa66e701 100755 --- a/tests/rootfs-smoke +++ b/tests/rootfs-smoke @@ -102,6 +102,15 @@ if exists /usr/lib/omamobile-omarchy/lock-pam; then pass "the lock's PAM file (omarchy-lock-password) is in the image" fi +# Voice out of the box (images from before it have no omamobile-voice): the +# engine, its user daemon and the speech model omamobile-setup-user links +if grep -q '^omamobile-voice ' <<<"$manifest"; then + exists /usr/bin/voxtype || fail "voxtype is installed with omamobile-voice" + exists /usr/lib/systemd/user/voxtype.service || fail "Voxtype's user unit is installed" + exists /usr/share/omamobile/voice/models/ggml-base.en.bin || fail "the base.en speech model is in the image" + pass "voice out of the box: voxtype, its user unit and base.en" +fi + exists /etc/pacman.d/gnupg && fail "no pacman keyring (it holds a private key)" d "ls /etc/ssh" | grep -q ssh_host_ && fail "no SSH host keys" [[ $(cat_ /etc/machine-id) == uninitialized ]] || fail "machine id uninitialized"