5 Commits
Author SHA1 Message Date
HomerandClaude Fable 5.2 5fcc158763 Wake word, from the review: a heard word always shows, holds end, stop and retry
CI / check (push) Canceled after 0s
1. Heard, but not the assistant and not on screen: Android blocks the
   activity start silently and runCatching called it a success, so nothing
   opened and nothing was posted. The opening is decided from what Android
   allows (wakeOpening: session, activity while an activity of the app is
   started, else a notification); "Heard you. Tap to ask." goes on a channel
   of its own (high importance, fixed words, times out after a minute) and
   the sheet cancels it. Settings says that only the digital assistant app
   opens by voice over other apps, with a row to that system setting.
2. The hold after the word is apart from the sheets' count and ends on a
   process scope in a finally; a starting service clears it.
3. A tap on the state in Settings retries now (WakeStatus.retryNow ->
   WakeListener.retryNow) and restarts the back-off; thirty seconds of
   samples taken in also resets the count of failures.
4. State writes carry the instance's token (WakeStatus.begin): an older
   instance's last "off" no longer overwrites a newer one. Engine.create is
   synchronized and writes the keywords to a file of its own.
5. numTrailingBlanks = 1 means more than one blank frame after the phrase
   (about 80 ms): the comment is corrected, and Settings and the test row
   say to pause after the phrase.
6. Stop no longer calls stopService or stopSelf() under a possible pending
   foreground start: the setting goes off and the loop ends the service with
   stopSelf(lastStartId); a start that arrives after the loop ended begins
   it again.
7. The "tap to listen again" notification is cancelled when the service
   starts.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 10:39:34 +00:00
HomerandClaude Fable 5.2 3046ad154a Wake phrases the model can hear: greeting x name, generated pieces, sensitivity
CI / check (push) Canceled after 0s
"Hey Lembas" could not work well: Lembas is not a word the model knows.

- The phrase is a greeting (Hey, OK, Hello) and a name (Assistant, Computer,
  Google, and ten ordinary names); the default is Hey Assistant and an old
  saved id reads as it.
- Token pieces are generated, not hand-written: fetch-wakeword.py also takes
  the model's bpe.model from the same pinned archive, gen-wake-phrases.py
  encodes every word with it into wake/WakeWords.kt, CI checks the committed
  table against the tokenizer, and WakeWordsTest checks every piece against
  tokens.txt. "OK" is spelled as the model's speech wrote it, OKAY.
  Elizabeth and Benjamin are dropped (four or more single-letter pieces).
- Each keyword line carries a boosting score and a trigger threshold
  (sherpa-onnx's ":boost #threshold"), chosen by a Sensitivity setting:
  Low 1.0/0.35, Normal 1.5/0.25, High 2.0/0.15; short phrases 0.05 stricter.
  numTrailingBlanks is the engine's own 1.
- Settings says the phrase is English whatever the app's language is, and
  that a Google device nearby answers to Google too.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 09:49:47 +00:00
HomerandClaude Fable 5.2 374574b9ce Wake word: the engine loads, and its state is one truth that is shown
CI / check (push) Canceled after 0s
The model was read from the APK with AssetManager.openFd, which throws for a
compressed asset; the assets were compressed, runCatching swallowed it, and
the engine never loaded on any phone.

- The model is copied out by stream, keyed by a version file the fetch
  script writes (a hash of the pinned model); onnx assets are stored.
- WakeState (Off, Starting, Listening, Paused, Failed) in one StateFlow that
  the service, its notification and Settings read. onStartCommand no longer
  posts the default phrase; the notification is written from the state only.
- WakeListener holds the loop apart from Android: an engine that does not
  load and a microphone that does not start or stops are Failed states with
  a reason, logged, retried with back-off; a new phrase cancels and joins the
  old loop before the engine is released.
- A keywords line is checked against tokens.txt before the engine sees it
  (the engine exits the process on an unknown piece).
- The service is not started without the microphone permission, and the app
  looks again each time it comes to the screen.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 09:44:49 +00:00
HomerandClaude Opus 5.5 dc642c62b9 Opt-in wake word: on-device keyword spotting in a microphone foreground service
CI / check (push) Canceled after 0s
- Engine: sherpa-onnx 2.0.1 keyword spotter (Apache-2.0) with the English
  zipformer-gigaspeech-3.3M KWS model (Apache-2.0, int8), fetched hash-pinned by
  scripts/fetch-wakeword.py into app/libs and src/full/assets (gitignored); CI and release run it.
  `full` flavour only (abiFilters arm64-v8a, armeabi-v7a, x86_64); `fdroid` has a stub engine
  and Settings says why. ProGuard keeps com.k2fsa.sherpa.onnx (JNI reads fields by name).
- WakeWordService (foregroundServiceType microphone): persistent notification with Stop; audio
  only to the engine in memory; pauses while the sheet is up (AssistPresence), in battery saver,
  and with the screen off unless Settings says otherwise. On the word: the sheet opens listening
  through LembasAssistService.showSession when LLeMbas is the assistant, else the activity,
  else a "tap to ask" notification.
- No microphone service at boot: WakeBootReceiver posts "tap to listen again"; MainActivity
  restarts a service the phone stopped.
- Settings › Assistant › Wake word: switch (off), four built-in English phrases (BPE-tokenized
  with the model's bpe.model), screen-on only, battery-optimisation page; privacy and cost text.
- The sheet's "no wake word" line now points at the setting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 16:27:51 +00:00
HomerandClaude Opus 5.5 4f09bc41bb LLeMbas for Android 0.1.0 (alpha, unreleased): the first commit
CI / check (push) Canceled after 0s
A native client for a LLeMbas instance on the server's /api/v2, and the
phone's digital assistant.

- Sign in by device code; the token sealed in the Android Keystore; several
  instances.
- Chats and agent chats: the list, a chat with its reply streaming as JSON
  server-sent events (reconnecting, whole blocks), thinking, tool calls,
  steered messages, the plan, jobs, stop, edit, regenerate, continue, the
  model, effort and Plan mode, attachments and dictation.
- Cards in a sheet, answered as the page's form says it; first answer wins.
- Notifications through UnifiedPush, no Google services; an approval can be
  answered from its notification.
- The digital assistant: a VoiceInteractionService with its session (a sheet
  over the current app, "Include screen" off by default), a recognition
  service through the instance's speech-to-text, the lock-screen path that
  asks to unlock before sending, a Quick Settings tile and an Ask shortcut.
- Share to LLeMbas; Moria and Shire from the server's tokens; nine
  languages; a self-updater in the `full` flavour, none in `fdroid`.

Generated and pinned from the server, each checked in CI: the theme
(tokens.lock.json), the contract (contract/lock.json, server 2124ba9), the
strings and the icons. Built and tested only on GitHub Actions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 13:44:30 +00:00