mirror of
https://github.com/Kynde/dais.git
synced 2026-10-20 08:32:28 +02:00
The daemon watches logind's PrepareForSleep on the system bus (a dbus-monitor subprocess, argv vector like the ear) and forces voice-off on BOTH edges: at the sleep edge, and re-checked at resume — the pre-sleep write races the freeze since no delay inhibitor is held, so resume is the guarantee that opening the lid never resumes listening. Only acts (and notifies "Voice off · suspending") when the mic was open; an already-closed mic stays silent. A latch recording in flight is discarded, not transcribed — same "off means OFF" rule as a deliberate stop. The line fold (sleep-edge) is pure and tested; the daemon runs fine without dbus-monitor (stderr note, watch disabled). Deliberately not configurable.
79 lines
3.8 KiB
Clojure
79 lines
3.8 KiB
Clojure
{;; Router: how an utterance is classified.
|
|
;; :whole-match command iff the WHOLE utterance matches (default)
|
|
;; :prefix commands must start with :prefix word; rest is dictation
|
|
;; :key-armed everything is dictation unless armed via `dais-ctl arm`
|
|
:router {:strategy :whole-match
|
|
:prefix "do"
|
|
;; Extra whole-utterance commands (merged over built-in defaults).
|
|
;; Entries map a phrase to either {:keys [...]} (key sequence) or
|
|
;; {:text "..." :submit true/false} (typed reply).
|
|
;; A command may carry :lang to bind it to a transcription language;
|
|
;; untagged commands belong to :asr :language (the base, "en" here) and
|
|
;; only match while that language is active. A phrase is only matchable
|
|
;; when the model is transcribing in its language, so e.g. "ääni pois"
|
|
;; below is reachable only under :language "fi".
|
|
:commands
|
|
{"send the brief"
|
|
{:text "Voice input notice: parts of my input arrive via speech-to-text and may contain recognition errors or noise. Read /home/k/dais/BRIEF.md for how to cope (verify unclear intent, match dictated identifiers against the repo, ignore noise fragments, prefer numbered options)."
|
|
:submit false}
|
|
"ääni pois" {:control :voice-off :lang "fi"}}}
|
|
|
|
;; Dictation submit behavior: :no-enter | :enter-auto | :enter-always
|
|
:enter-mode :no-enter
|
|
|
|
;; Target slots. :type :tmux needs :pane "session:window.pane";
|
|
;; :type :focus delivers to the focused app via ydotool.
|
|
:targets {1 {:type :focus}
|
|
2 {:type :tmux :pane "app:claude.0"}
|
|
3 {:type :tmux :pane "system:claude.0"}}
|
|
:active-slot 1
|
|
|
|
:tmux ["tmux"]
|
|
|
|
:focus {:ydotool ["/usr/bin/ydotool"]
|
|
;; nil -> $XDG_RUNTIME_DIR/.ydotool_socket (the client default)
|
|
:ydotool-socket nil
|
|
:key-delay-ms 2}
|
|
|
|
:notifications {:enabled true :timeout-ms 2500}
|
|
|
|
;; Mic hygiene: force voice-off after a VAD session hears nothing for this
|
|
;; many minutes (decimals ok, nil/0 disables). Suspend/lid-close ALWAYS
|
|
;; forces voice-off (both at sleep and re-checked at resume) — waking the
|
|
;; laptop never resumes listening; deliberately not configurable.
|
|
:vad-idle-off-min 5
|
|
|
|
;; Confidence gate: an utterance whose mean avg_logprob is below this floor is
|
|
;; NOT delivered — it's flagged ("Uncertain — say again?") so you just repeat.
|
|
;; Distinct from the :vad avg_logprob_min hard drop (kills hallucinated noise);
|
|
;; this one catches real-but-garbled speech AFTER it routed to typing/keys.
|
|
;; Controls ("voice off", "unmute") always pass. nil disables (deliver as-is).
|
|
;; Speech usually lands well above -0.6; start around -0.8 and tune by feel.
|
|
:confidence-min-logprob nil
|
|
|
|
;; The resident ear worker (capture/VAD/ASR). :cmd is absolute so a
|
|
;; systemd/KDE-launched daemon needs no user PATH.
|
|
:ear {:enabled? true
|
|
:cmd ["/home/k/bin/pixi" "run" "-q" "ear"]
|
|
:dir "ear"}
|
|
;; :source pins a PipeWire input node (`pactl list sources short`);
|
|
;; omit it to follow the system default source (headset plug/unplug works).
|
|
;;
|
|
;; :language is the startup/base language; :languages is the selectable set
|
|
;; (dais-ctl/dais-top cycle these plus "auto" = per-utterance detect). Switching
|
|
;; needs a MULTILINGUAL model — "*.en" checkpoints only do English; for Finnish
|
|
;; use e.g. "small" or (better Finnish, slower) "medium".
|
|
:asr {:model "small.en" :device "cpu" :compute-type "int8"
|
|
:language "en" :languages ["en" "fi"]}
|
|
|
|
;; VAD endpointing + false-trigger gates (JSON-serialized to the ear's
|
|
;; --tuning; underscore keys match the worker's DEFAULT_TUNING).
|
|
:vad {"threshold" 0.5
|
|
"release" 0.35
|
|
"min_speech_ms" 300
|
|
"silence_ms" 700
|
|
"pre_roll_ms" 300
|
|
"max_utterance_s" 30
|
|
"no_speech_prob_max" 0.7
|
|
"avg_logprob_min" -1.2}}
|