wn_speak — tool-driven speech mode (tooltalk) #27
Labels
No labels
NaNs
area/audio
area/build
area/docs
area/dsh
area/engine
area/security
area/ui
needs-operator
priority/later
priority/next
priority/now
type/bug
type/task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
dsh-plugins/dsh-whale-noises#27
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Third operating mode next to auto-read and click-to-read.
Contract
wn_speak(text, kind)—kindisannounce(short, may preempt) orreport(long, queues).Projekt A: …). Doubles as prompt-injection mitigation: injected text can never sound like the operator.Queue rules (mandatory — double voice is still reproducible)
announcemay preempt a runningreport.reportqueues behind anything playing; cap the queue.wn_speaksuppresses auto-read for that turn.Overlay behaviour in tooltalk
x.+Npending badge instead of a growing stack; expand on tap.Breaking change
Making speak/overlay the default for v0.1.0 flips auto-read off for existing users. Needs README + settings migration note.
Acceptance
announcepreemptsreport.x.wn_speakis not read verbatim.Open question
Per-workspace voice mapping ("hear who is talking before you look") is the natural companion — decided in the voice-selector issue, referenced here.
Feasibility review (from the implementation side): this is the strongest idea in the backlog and it is implementable without a new transport.
wn_speakwithdefineTool+ctx.tools.register.ToolRunContextexposes the calling agent/session (exec.agent.session), so the source prefix can be derived server-side exactly as specified.output.presentationMeta(args, value)on the tool. That payload is persisted on thetool/resultevent (event.data.meta) and the client already receives those entries. The client can scantool/resultmeta for thewn_speakmarker and enqueue speech/announcements — no side channel, no polling, replay-safe.lib/index.jsisapply(){}and the host is static-only. We need a dated decision that the host may expose a tiny messaging tool (no inference, no model bytes, no proxy). I'd record that as D12 before implementation.tool/resultcarriesdata.turn; if not, include a stable call/seq correlation in meta and suppress by the turn of the enclosing settlement. This is the one detail I'd spike first.announcepreemptsreportis a real spool change: add priority classes, not just stop/clear; keep the panel's current queue semantics intact.+N, dim-don't-close. Don't overload the 240 px panel; build an announcement tray and let the character anchor it.Suggested split: (a) host tool + meta + client announcement scan + suppression; (b) priority queue; (c) tray UI. (a) is the risky part and can be proven end-to-end before any visual work.
Root cause found and fixed (
b73cf9b). This was not a playback/autoplay bug.src/client.jscreated the capture withonMessagebut never passedonAnnouncement.createCapturedefaults that callback to a no-op, sohandleAnnouncement— the only code that unlocks audio, checks the downloaded voice and enqueues into the spool — never ran in the real client. Manual read-aloud still worked because it callsstate.speakMessagedirectly and bypasses the capture. That is exactly the "received but silent" shape:announcement receivedwas logged by the capture, then nothing else. The handler was already covered bytest/client-engines.test.mjs, which is why the unit suite stayed green.Evidence from a real browser console — headless Chrome 156 driven over CDP, loading the actual
lib/client.jswith a fake DSH session feed and a synthetictool/resultcarryingmeta.whaleNoises:wn_speak result observed→announcement received→ stop (spool empty, nothing spoken)announcement received→announcement handling {"contextState":"running"}→announcement download check {"downloaded":true}→announcement queued {"itemId":"item-1"}→speak start {"chars":47}→speak done {"spoken":1}→ spoolspoken: ["dsh-whale-noises · harness: The build is green."]Fix: one line in
src/client.jswiresonAnnouncementtostate.handleAnnouncement, plus a regression test intest/client-apply.test.mjsthat pushes a synthetictool/resultthrough the real session capture (not the handler in isolation) and asserts the announcement reaches the spool with thesource: textprefix and suppresses auto-read for its turn.npm run checkgreen, 168 tests. CHANGELOG entry and an AGENTS.md gotcha added. Commitsb73cf9b(fix),7b81bc2/41cfa08(docs) pushed tomaster.Still open: audible confirmation in a real browser. The plugin is not installed in the
webprofile on this laptop, and installing is a profile change plus adsh webrestart, so that step needs the operator. After that: the rest of #27 (3-state mode toggle, announcement tray,announce→reportpreemption) and removing the temporary debug logs — kept deliberately until the audible check passes.Agent motivation — host prompt guidance landed (
ef9273c).The operator reported agents rarely reach for the voice channel. DSH exposes exactly the hook needed:
ctx.systemPrompt.section()(from@deepseek-ai/dsh-system-prompt, used bydsh-personathe same way). The host half now registers:tool:wn-speakat order 2500 (next to the per-tool guidance sections), a ~90-word model-facing note: why the channel exists, when to use it (build/deploy finished or failed, long task completed, test run red, blocking question),announcevsreport, prose-for-the-ear rules, and "do not restate the source".wn_speaktool description with the same proactive-use nudge.injectis now['tools', 'systemPrompt']; deployments without the prompt registry skip the section with a warning and keep the tool working.Host-side note: this is
lib/index.js, so it activates on the nextdsh webstart (no restart forced). Client-only reloads will never show it. Once active, every agent (incl. subagents) sees it globally.Also answered on the issue: the spoken prefix (
workspace · session-title: …) is added on both live and replay paths from server-derived meta; it is deliberate (prompt-injection mitigation). A "brief source" setting (workspace only / none) could be added later if the read-aloud gets repetitive.Optional source prefix landed (
e820477). Operator: with per-project voices, hearing "pad · GLaDeeps: …" every time is redundant (and noisy when 2–3 announcements arrive while watching a session).New setting Spoken source (
announcePrefix):full—workspace · session: text(default, keeps the #27 provenance/no-injection contract),workspace—workspace: text,off— text only (the note still stores and shows its source in the tool-talk panel).Applied to both live announcements and replay. 192 tests.
Status after the control-surface slices. Done:
wn_speakannouncement capture + speech, tool-talk noise panel (#32), 3-state voice mode, spoken source prefix setting, favourites + per-project voices with cross-engine speech (#28), and the host-sideVoice channelsystem-prompt guidance for agent motivation.Left in #27:
announcepreempting a runningreport(spool priority classes), and removing the temporary debug logs (announcement handling,speak start,audio chunk,wn_speak result observed) once the operator has confirmed live use. Everything else is either implemented or deliberately split out.Closing core Tool-Talk:
wn_notify(DSH-facing), paired description/prompt, Noise Panel notes, open-session, per-chat voices, Tool-Talk host switch and Read/Off mode are shipped and tested. Debug logs removed. The only remaining contract item is announce→report preemption, tracked separately in #37.