From 20d745ee7f8d8a875f66c7ec5a221d0e51f2321c Mon Sep 17 00:00:00 2001 From: Lucas Proxmox Date: Wed, 7 Oct 2026 15:48:59 +0200 Subject: [PATCH] feat(voice): local mode, the Mac's own (Siri) voice (0.29.0) `/devscope:voice model local` sets engine "system": speech uses macOS `say` without -v, i.e. the System voice from Accessibility > Spoken Content, Siri voices included, at the configured speed; no audio is fetched from the server (auto voice summaries still are). `model ` and `model default` set the engine back to auto. `model` and `status` show it. Co-Authored-By: Claude Opus 5.5 (1M context) --- .claude-plugin/marketplace.json | 2 +- .claude-plugin/plugin.json | 2 +- CHANGELOG.md | 10 +++++++ CLAUDE.md | 3 +- README.md | 3 +- commands/voice.md | 4 +-- scripts/voice/cli.sh | 49 +++++++++++++++++++++++---------- tests/voice/run.sh | 13 ++++++++- 8 files changed, 65 insertions(+), 21 deletions(-) diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 8a38ad6..379ecda 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -10,7 +10,7 @@ { "name": "devscope", "description": "Real-time developer activity monitoring for Claude Code sessions", - "version": "0.28.0", + "version": "0.29.0", "author": { "name": "Lucas Dow", "email": "lucdow7@gmail.com" diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index 02f49c7..fc7e2a9 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "devscope", - "version": "0.28.0", + "version": "0.29.0", "description": "Real-time developer activity monitoring for Claude Code sessions", "author": { "name": "Lucas Dow", diff --git a/CHANGELOG.md b/CHANGELOG.md index eabefbe..a2b6955 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). +## [0.29.0] - 2026-10-07 + +### Added +- **Local mode: `/devscope:voice model local`** speaks with this computer's own + voice (`say` on macOS) instead of the server's. It uses the System voice, so + choosing a Siri voice in System Settings > Accessibility > Spoken Content + makes DevScope speak with Siri. Summaries for auto voice still come from the + server; only the voice is local. `model ` or `model default` + switches back. `model` lists `local` with the server's voices. + ## [0.28.0] - 2026-10-07 ### Changed diff --git a/CLAUDE.md b/CLAUDE.md index d27f58b..1b2b545 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -212,7 +212,8 @@ claude plugin disable devscope@devscope # Disable the backend fails; three or more due within 15 s become one sentence. Speech uses the server voice by default (`/api/ai/voice-audio`; the server picks among its named voices: on the homelab Chatterbox Turbo on the B580, with Kokoro as fallback; voice.json `model` asks for one by name - via `/devscope:voice model`, sent as `model`, omitted for the server's default; `voice` is a Kokoro + via `/devscope:voice model`, sent as `model`, omitted for the server's default; `model local` sets + `engine: system` instead, i.e. macOS `say` with the System voice (Siri voices included), no `-v`; `voice` is a Kokoro voice name, default `am_michael`; `speed` 1.2× by default, presets slow 1.0 / normal 1.2 / fast 1.5, or any number 0.5-2, via `/devscope:voice speed`, applied to every engine), never for `private` sessions; if the server has no voice or is unreachable it falls back to Piper if installed (`/devscope:voice setup`), diff --git a/README.md b/README.md index 1e03ca6..1d2356c 100644 --- a/README.md +++ b/README.md @@ -209,7 +209,8 @@ Running several sessions, or working in another window? `/devscope:voice on` mak - **Only when you've lost track.** It speaks after a grace delay (30 s for permission prompts and questions, 10 s for failed turns). Answer in time and it stays silent. If you don't, it reminds you every 5 minutes, up to 3 times. - **Across all sessions.** Announcements play one at a time, and three or more at once become one sentence ("three sessions need you: ..."). - **Summaries follow your privacy mode.** Sentences are written by DevScope's AI from what your privacy mode already sends. `private` sessions never leave your machine and use a local template. -- **Natural voice, nothing to install.** Speech is voiced by your DevScope server. Which voices it offers is up to the server; the homelab offers **Chatterbox Turbo** (the default, on its GPU) and **Kokoro** (on its CPU, also the fallback when the GPU is busy). `/devscope:voice model` lists them, `/devscope:voice model kokoro` picks one for you, `model default` goes back to the server's choice. Speed with `/devscope:voice speed`, volume with `volume` in `voice.json`. `private` sessions, and any time the server can't be reached, use a local voice instead: [Piper](https://github.com/rhasspy/piper) if you ran `/devscope:voice setup` (Linux; `pipx install piper-tts` on macOS), otherwise the system voice (`say`, `spd-say`, `espeak`). +- **Natural voice, nothing to install.** Speech is voiced by your DevScope server. Which voices it offers is up to the server; the homelab offers **Chatterbox Turbo** (the default, on its GPU) and **Kokoro** (on its CPU, also the fallback when the GPU is busy). `/devscope:voice model` lists them, `/devscope:voice model kokoro` picks one for you, `model default` goes back to the server's choice. +- **Local mode, for Macs.** `/devscope:voice model local` speaks with this computer's own voice instead (`say` on macOS), with no audio from the server. It uses your System voice, so to hear a Siri voice pick one in System Settings → Accessibility → Spoken Content → System voice. The DevScope server still writes the auto voice summaries; only the voice is local. `model chatterbox` (or another server voice) switches back. Speed with `/devscope:voice speed`, volume with `volume` in `voice.json`. `private` sessions, and any time the server can't be reached, use a local voice instead: [Piper](https://github.com/rhasspy/piper) if you ran `/devscope:voice setup` (Linux; `pipx install piper-tts` on macOS), otherwise the system voice (`say`, `spd-say`, `espeak`). Other commands: `off`, `mute 1h`, `unmute`, `test`, `status`, `finished on` (also announce finished turns after 2 min), `speed slow|normal|fast` (1.0×, 1.2× or 1.5×, for every voice; or any number from 0.5 to 2, e.g. `speed 1.35`), `stop` (end speech in progress). Settings live in `~/.config/devscope/voice.json`. diff --git a/commands/voice.md b/commands/voice.md index 7ac6914..ce03225 100644 --- a/commands/voice.md +++ b/commands/voice.md @@ -1,7 +1,7 @@ --- allowed-tools: Read, Grep, Glob, Bash(git diff:*), Bash(git status:*), Bash(git log:*), Bash(bash:*) description: DevScope voice: explain a topic out loud, auto voice after every reply, announcements when a session waits on you (explain, auto, verbosity, speed, on, off, mute, stop, test, setup) -argument-hint: "[explain [--short|--long] |model [chatterbox|kokoro|default]|auto [on|off]|auto-default [on|off]|verbosity [explain|auto] [short|normal|long]|when-locked [quiet|play]|speed [slow|normal|fast|1.35]|status|on|off|mute 1h|unmute|stop|test|setup|finished on|off]" +argument-hint: "[explain [--short|--long] |model [chatterbox|kokoro|local|default]|auto [on|off]|auto-default [on|off]|verbosity [explain|auto] [short|normal|long]|when-locked [quiet|play]|speed [slow|normal|fast|1.35]|status|on|off|mute 1h|unmute|stop|test|setup|finished on|off]" --- ## Your task @@ -18,7 +18,7 @@ bash "${CLAUDE_PLUGIN_ROOT}/scripts/voice/cli.sh" $ARGUMENTS Show the output to the user in a few short lines. Do not run anything else. -The default engine is `server`: the DevScope server voices speech. `model` lists the server's voices (on the homelab: chatterbox, the default, and kokoro), `model ` picks one, `model default` goes back to the server's choice; when the chosen voice is busy or down, the server uses its next one. If the engine is `system` or `none`, mention that it needs a DevScope API key (`/devscope:setup`), and that `/devscope:voice setup` installs Piper as an offline fallback (Linux; on macOS use `pipx install piper-tts`). +The default engine is `server`: the DevScope server voices speech. `model` lists the voices (on the homelab: chatterbox, the default, and kokoro, plus `local`), `model ` picks one, `model local` speaks with this computer's own voice (macOS `say`: the System voice from Accessibility > Spoken Content, Siri voices included; summaries still come from the server), `model default` goes back to the server's choice; when the chosen voice is busy or down, the server uses its next one. If the engine is `system` or `none`, mention that it needs a DevScope API key (`/devscope:setup`), and that `/devscope:voice setup` installs Piper as an offline fallback (Linux; on macOS use `pipx install piper-tts`). Three features: - **Explain** (`explain [topic]`): see *Explain mode* below. diff --git a/scripts/voice/cli.sh b/scripts/voice/cli.sh index 4a9e875..0939387 100755 --- a/scripts/voice/cli.sh +++ b/scripts/voice/cli.sh @@ -2,7 +2,7 @@ # /devscope:voice — turn the voice announcer and auto voice (a spoken summary of every reply) on/off, # mute, test, stop speech, install the Piper voice; `say` speaks text from # stdin (/devscope:voice explain). -# Usage: cli.sh [status|on|off|mute <30s|15m|1h>|unmute|test|setup|finished on|off|auto [on|off]|auto-default [on|off]|speed [slow|normal|fast|<0.5-2>]|verbosity [explain|auto] [short|normal|long]|when-locked [quiet|play]|model [name|default]|stop|say] +# Usage: cli.sh [status|on|off|mute <30s|15m|1h>|unmute|test|setup|finished on|off|auto [on|off]|auto-default [on|off]|speed [slow|normal|fast|<0.5-2>]|verbosity [explain|auto] [short|normal|long]|when-locked [quiet|play]|model [name|local|default]|stop|say] set -uo pipefail VOICE_DIR="$(cd "$(dirname "$0")" && pwd)" # shellcheck disable=SC1091 @@ -17,8 +17,10 @@ status() { local mute pending echo "Voice announcer: $(_ds_voice_enabled && echo on || echo off)" echo "Engine: $(_ds_voice_engine) (setting: $(_ds_voice_conf .engine auto))" - [ "$(_ds_voice_engine)" = "server" ] && \ - echo "Server voice: $(_ds_voice_conf .model "server default") via $DEVSCOPE_URL (private sessions and outages use a local voice)" + case "$(_ds_voice_engine)/$(_ds_voice_conf .engine auto)" in + server/*) echo "Voice: $(current_voice) via $DEVSCOPE_URL (private sessions and outages use a local voice)" ;; + */system) echo "Voice: $(current_voice)" ;; + esac echo "Speed: $(_ds_voice_speed_text)" echo "Delays: permission $(_ds_voice_delay permission)s, question $(_ds_voice_delay question)s," \ "failed $(_ds_voice_delay failed)s, finished $(_ds_voice_delay finished)s" \ @@ -93,33 +95,52 @@ auto_default() { esac } -# Which of the server's voices speaks: model [name|default]. No name lists them. +# Which voice speaks: model [name|local|default]. A server voice by name, or +# `local` for this computer's own voice (`say` on macOS, which speaks with the +# System voice set in Accessibility > Spoken Content, a Siri voice included). +# No name lists the choices. +LOCAL_HINT="On a Mac it uses your System voice: System Settings > Accessibility > Spoken Content > System voice (pick a Siri voice there to hear Siri)." + +current_voice() { + if [ "$(_ds_voice_conf .engine auto)" = system ]; then + echo "local (this computer's own voice)" + else + echo "$(_ds_voice_conf .model "server default")" + fi +} + model() { local name="${1:-}" offered + if [ "$name" = local ]; then + _ds_voice_set '.engine = "system"' + echo "Voice: local. Speech uses this computer's own voice; the DevScope server still writes the summaries." + echo "$LOCAL_HINT" + return 0 + fi offered=$(_ds_api GET /api/ai/voice-models "" 5 2>/dev/null | jq -r '.models // [] | join(" ")' 2>/dev/null) if [ -z "$name" ]; then - echo "Server voice: $(_ds_voice_conf .model "server default")" + echo "Voice: $(current_voice)" if [ -n "$offered" ]; then - echo "This server offers: $offered (the first is its default)" + echo "Choices: $offered (server voices, the first is its default), or local (this computer's own voice)" else - echo "Could not list the server's voices; run '/devscope:setup' if the API key is missing." + echo "Choices: local (this computer's own voice). Could not list the server's voices; run '/devscope:setup' if the API key is missing." fi return 0 fi if [ "$name" = default ]; then - _ds_voice_set 'del(.model)' - echo "Server voice: server default${offered:+ (${offered%% *})}" + _ds_voice_set 'del(.model) | .engine = "auto"' + echo "Voice: server default${offered:+ (${offered%% *})}" return 0 fi case "$name" in - *[!a-z0-9-]*) echo "Usage: model [name|default]"; return 1 ;; + *[!a-z0-9-]*) echo "Usage: model [name|local|default]"; return 1 ;; esac if [ -n "$offered" ] && ! printf ' %s ' "$offered" | grep -q " $name "; then - echo "This server has no voice named '$name'. It offers: $offered" + echo "This server has no voice named '$name'. Choices: $offered, or local" return 1 fi - _ds_voice_set --arg m "$name" '.model = $m' - echo "Server voice: $name" + _ds_voice_set --arg m "$name" '.model = $m | .engine = "auto"' + echo "Voice: $name" } # What happens while the screen is locked: quiet (default) holds announcements @@ -283,6 +304,6 @@ case "${1:-status}" in "${DEVSCOPE_PRIVACY:-standard}" ;; setup) setup ;; *) - echo "Usage: /devscope:voice [status|on|off|mute <30s|15m|1h>|unmute|test|setup|finished on|off|auto [on|off]|auto-default [on|off]|speed [slow|normal|fast|<0.5-2>]|verbosity [explain|auto] [short|normal|long]|when-locked [quiet|play]|model [name|default]|stop]" + echo "Usage: /devscope:voice [status|on|off|mute <30s|15m|1h>|unmute|test|setup|finished on|off|auto [on|off]|auto-default [on|off]|speed [slow|normal|fast|<0.5-2>]|verbosity [explain|auto] [short|normal|long]|when-locked [quiet|play]|model [name|local|default]|stop]" exit 1 ;; esac diff --git a/tests/voice/run.sh b/tests/voice/run.sh index a8fe2c7..7f6755a 100644 --- a/tests/voice/run.sh +++ b/tests/voice/run.sh @@ -302,11 +302,22 @@ reset; "$S/voice/cli.sh" when-locked play >/dev/null; touch "$LOCK" [[ "$("$S/voice/cli.sh" status)" == *"Screen: locked; when locked: quiet"* ]] && ok "status shows the screen and the setting" || bad "status screen" "$("$S/voice/cli.sh" status | grep Screen)" "$S/voice/cli.sh" when-locked loud >/dev/null && bad "bad when-locked" "accepted" || ok "when-locked rejects an unknown value" respond '{"models": ["chatterbox", "kokoro"]}' -[[ "$("$S/voice/cli.sh" model)" == *"This server offers: chatterbox kokoro"* ]] && [ "$(last .path)" = /api/ai/voice-models ] && ok "model lists the server's voices" || bad "model list" "$("$S/voice/cli.sh" model)" +[[ "$("$S/voice/cli.sh" model)" == *"Choices: chatterbox kokoro (server voices, the first is its default), or local"* ]] && [ "$(last .path)" = /api/ai/voice-models ] && ok "model lists the server's voices" || bad "model list" "$("$S/voice/cli.sh" model)" "$S/voice/cli.sh" model kokoro >/dev/null; [ "$(jq -r .model "$CONF")" = kokoro ] && ok "model kokoro is stored" || bad "model set" "$(cat "$CONF")" "$S/voice/cli.sh" model piper >/dev/null && bad "unknown model" "accepted" || ok "model rejects a voice the server does not offer" "$S/voice/cli.sh" model "../x" >/dev/null && bad "bad model" "accepted" || ok "model rejects a malformed name" "$S/voice/cli.sh" model default >/dev/null; [ "$(jq -r '.model // "unset"' "$CONF")" = unset ] && ok "model default clears the choice" || bad "model default" "$(cat "$CONF")" +# model local: this computer's own voice (macOS say, the System voice, Siri included). +[[ "$("$S/voice/cli.sh" model local)" == *"Spoken Content"* ]] && [ "$(jq -r .engine "$CONF")" = system ] && ok "model local switches to the computer's voice" || bad "model local" "$(cat "$CONF")" +[[ "$("$S/voice/cli.sh" status)" == *"Voice: local (this computer's own voice)"* ]] && ok "status shows local" || bad "status local" "$("$S/voice/cli.sh" status | grep -i voice:)" +mkdir -p "$TMP/saybin"; printf '#!/bin/sh\necho "$*" >> "%s"\n' "$TMP/said" > "$TMP/saybin/say"; chmod +x "$TMP/saybin/say" +reset; rm -f "$TMP/said" "$LOCK" +( unset DS_VOICE_SPEAK_LOG; export PATH="$TMP/saybin:$PATH"; . "$S/_helpers.sh"; . "$S/voice/lib.sh"; _ds_voice_speak_long "Devscope: tests pass. Shall I open the PR?" standard ) +[ "$(cat "$TMP/said" 2>/dev/null)" = "-r 210 Devscope: tests pass. Shall I open the PR?" ] && [ "$(hits)" = 0 ] && ok "local: say speaks at the set speed, no server request" || bad "local say" "$(cat "$TMP/said" 2>/dev/null) hits=$(hits)" +respond '{"models": ["chatterbox", "kokoro"]}' +"$S/voice/cli.sh" model chatterbox >/dev/null; [ "$(jq -r '.engine + "/" + .model' "$CONF")" = auto/chatterbox ] && ok "a server voice after local turns the server back on" || bad "back to server" "$(cat "$CONF")" +"$S/voice/cli.sh" model local >/dev/null; "$S/voice/cli.sh" model default >/dev/null +[ "$(jq -r '.engine + "/" + (.model // "unset")' "$CONF")" = auto/unset ] && ok "model default leaves local too" || bad "default after local" "$(cat "$CONF")" rm -f "$LOCK" # 12. Auto voice: reply summaries, independent of the announcer, on every finished turn.