wn_speak — tool-driven speech mode (tooltalk) #27

Closed
opened 2026-10-31 00:01:26 +00:00 by dsh · 6 comments
Owner

Third operating mode next to auto-read and click-to-read.

mode who decides what it is
auto plugin accessibility — everything is spoken
click operator convenience — point at something
tooltalk agent attention routing — only what deserves ears

Contract

wn_speak(text, kind) — kind is announce (short, may preempt) or report (long, queues).

  • Plain prose only. No code blocks, URLs, symbol runs. Non-prose is summarised, not read ("a 40-line Python function"). The model writes for the ear; the engine does not guess.
  • Source is derived server-side from the session/workspace context. The model NEVER passes a project name — it would hallucinate or forget, and a wrong label is worse than no label.
  • Every announcement is prefixed with the source server-side (Projekt A: …). Doubles as prompt-injection mitigation: injected text can never sound like the operator.
  • Length cap per call, hard rate limit per session.

Queue rules (mandatory — double voice is still reproducible)

  • announce may preempt a running report.
  • report queues behind anything playing; cap the queue.
  • Any turn that called wn_speak suppresses auto-read for that turn.

Overlay behaviour in tooltalk

  • Height grows upward, variable. Whale-girl is bottom-anchored and slides with it.
  • Does not auto-close; gets a small x.
  • Timestamp per announcement; a +N pending badge instead of a growing stack; expand on tap.
  • Dim after a few minutes, do not close (closing loses the notification).

Breaking change

Making speak/overlay the default for v0.1.0 flips auto-read off for existing users. Needs README + settings migration note.

Acceptance

  1. A toolcall produces audio tagged with the correct workspace, with auto-read suppressed for that turn.
  2. Two sessions announcing simultaneously do not talk over each other; announce preempts report.
  3. Overlay shows source + timestamp, survives dismissal-free for the session, and offers x.
  4. A code block passed to wn_speak is 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.

Third operating mode next to **auto-read** and **click-to-read**. | mode | who decides | what it is | |---|---|---| | auto | plugin | accessibility — everything is spoken | | click | operator | convenience — point at something | | **tooltalk** | **agent** | **attention routing — only what deserves ears** | ## Contract `wn_speak(text, kind)` — `kind` is `announce` (short, may preempt) or `report` (long, queues). - **Plain prose only.** No code blocks, URLs, symbol runs. Non-prose is summarised, not read ("a 40-line Python function"). The model writes for the ear; the engine does not guess. - **Source is derived server-side** from the session/workspace context. The model NEVER passes a project name — it would hallucinate or forget, and a wrong label is worse than no label. - Every announcement is **prefixed with the source** server-side (`Projekt A: …`). Doubles as prompt-injection mitigation: injected text can never sound like the operator. - Length cap per call, hard rate limit per session. ## Queue rules (mandatory — double voice is still reproducible) - `announce` may preempt a running `report`. - `report` queues behind anything playing; cap the queue. - Any turn that called `wn_speak` suppresses auto-read **for that turn**. ## Overlay behaviour in tooltalk - Height grows **upward**, variable. Whale-girl is bottom-anchored and slides with it. - Does **not** auto-close; gets a small `x`. - Timestamp per announcement; a `+N` pending badge instead of a growing stack; expand on tap. - Dim after a few minutes, do not close (closing loses the notification). ## Breaking change Making speak/overlay the default for v0.1.0 flips auto-read off for existing users. Needs README + settings migration note. ## Acceptance 1. A toolcall produces audio tagged with the correct workspace, with auto-read suppressed for that turn. 2. Two sessions announcing simultaneously do not talk over each other; `announce` preempts `report`. 3. Overlay shows source + timestamp, survives dismissal-free for the session, and offers `x`. 4. A code block passed to `wn_speak` is 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.
Author
Owner

Feasibility review (from the implementation side): this is the strongest idea in the backlog and it is implementable without a new transport.

  • The host half can register wn_speak with defineTool + ctx.tools.register. ToolRunContext exposes the calling agent/session (exec.agent.session), so the source prefix can be derived server-side exactly as specified.
  • For delivery, declare output.presentationMeta(args, value) on the tool. That payload is persisted on the tool/result event (event.data.meta) and the client already receives those entries. The client can scan tool/result meta for the wn_speak marker and enqueue speech/announcements — no side channel, no polling, replay-safe.
  • This changes a hard rule: today lib/index.js is apply(){} 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.
  • Turn suppression: the tool result needs the turn identity (or the client must infer it). Verify that tool/result carries data.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.
  • announce preempts report is a real spool change: add priority classes, not just stop/clear; keep the panel's current queue semantics intact.
  • The overlay is a separate surface from the speaking panel: history, timestamps, +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.

**Feasibility review (from the implementation side):** this is the strongest idea in the backlog and it is implementable without a new transport. - The host half can register `wn_speak` with `defineTool` + `ctx.tools.register`. `ToolRunContext` exposes the calling agent/session (`exec.agent.session`), so the **source prefix can be derived server-side** exactly as specified. - For delivery, declare `output.presentationMeta(args, value)` on the tool. That payload is persisted on the `tool/result` event (`event.data.meta`) and the client already receives those entries. The client can scan `tool/result` meta for the `wn_speak` marker and enqueue speech/announcements — no side channel, no polling, replay-safe. - This **changes a hard rule**: today `lib/index.js` is `apply(){}` 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. - Turn suppression: the tool result needs the turn identity (or the client must infer it). Verify that `tool/result` carries `data.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. - `announce` preempts `report` is a real spool change: add priority classes, not just stop/clear; keep the panel's current queue semantics intact. - The overlay is a **separate surface** from the speaking panel: history, timestamps, `+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.
Author
Owner

Root cause found and fixed (b73cf9b). This was not a playback/autoplay bug.

src/client.js created the capture with onMessage but never passed onAnnouncement. createCapture defaults that callback to a no-op, so handleAnnouncement — 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 calls state.speakMessage directly and bypasses the capture. That is exactly the "received but silent" shape: announcement received was logged by the capture, then nothing else. The handler was already covered by test/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.js with a fake DSH session feed and a synthetic tool/result carrying meta.whaleNoises:

  • before: wn_speak result observed → announcement received → stop (spool empty, nothing spoken)
  • after: announcement received → announcement handling {"contextState":"running"} → announcement download check {"downloaded":true} → announcement queued {"itemId":"item-1"} → speak start {"chars":47} → speak done {"spoken":1} → spool spoken: ["dsh-whale-noises · harness: The build is green."]

Fix: one line in src/client.js wires onAnnouncement to state.handleAnnouncement, plus a regression test in test/client-apply.test.mjs that pushes a synthetic tool/result through the real session capture (not the handler in isolation) and asserts the announcement reaches the spool with the source: text prefix and suppresses auto-read for its turn. npm run check green, 168 tests. CHANGELOG entry and an AGENTS.md gotcha added. Commits b73cf9b (fix), 7b81bc2/41cfa08 (docs) pushed to master.

Still open: audible confirmation in a real browser. The plugin is not installed in the web profile on this laptop, and installing is a profile change plus a dsh web restart, so that step needs the operator. After that: the rest of #27 (3-state mode toggle, announcement tray, announce→report preemption) and removing the temporary debug logs — kept deliberately until the audible check passes.

**Root cause found and fixed (`b73cf9b`).** This was not a playback/autoplay bug. `src/client.js` created the capture with `onMessage` but never passed `onAnnouncement`. `createCapture` defaults that callback to a no-op, so `handleAnnouncement` — 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 calls `state.speakMessage` directly and bypasses the capture. That is exactly the "received but silent" shape: `announcement received` was logged by the capture, then nothing else. The handler was already covered by `test/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.js` with a fake DSH session feed and a synthetic `tool/result` carrying `meta.whaleNoises`: - before: `wn_speak result observed` → `announcement received` → stop (spool empty, nothing spoken) - after: `announcement received` → `announcement handling {"contextState":"running"}` → `announcement download check {"downloaded":true}` → `announcement queued {"itemId":"item-1"}` → `speak start {"chars":47}` → `speak done {"spoken":1}` → spool `spoken: ["dsh-whale-noises · harness: The build is green."]` **Fix:** one line in `src/client.js` wires `onAnnouncement` to `state.handleAnnouncement`, plus a regression test in `test/client-apply.test.mjs` that pushes a synthetic `tool/result` through the *real* session capture (not the handler in isolation) and asserts the announcement reaches the spool with the `source: text` prefix and suppresses auto-read for its turn. `npm run check` green, **168 tests**. CHANGELOG entry and an AGENTS.md gotcha added. Commits `b73cf9b` (fix), `7b81bc2`/`41cfa08` (docs) pushed to `master`. **Still open:** audible confirmation in a real browser. The plugin is not installed in the `web` profile on this laptop, and installing is a profile change plus a `dsh web` restart, so that step needs the operator. After that: the rest of #27 (3-state mode toggle, announcement tray, `announce`→`report` preemption) and removing the temporary debug logs — kept deliberately until the audible check passes.
Author
Owner

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 by dsh-persona the same way). The host half now registers:

  • tool:wn-speak at 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), announce vs report, prose-for-the-ear rules, and "do not restate the source".
  • A sharper wn_speak tool description with the same proactive-use nudge.
  • inject is now ['tools', 'systemPrompt']; deployments without the prompt registry skip the section with a warning and keep the tool working.
  • Tests: 189 total, incl. registration/fallback/short-text checks.

Host-side note: this is lib/index.js, so it activates on the next dsh web start (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.

**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 by `dsh-persona` the same way). The host half now registers: - `tool:wn-speak` at 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), `announce` vs `report`, prose-for-the-ear rules, and "do not restate the source". - A sharper `wn_speak` tool description with the same proactive-use nudge. - `inject` is now `['tools', 'systemPrompt']`; deployments without the prompt registry skip the section with a warning and keep the tool working. - Tests: 189 total, incl. registration/fallback/short-text checks. **Host-side note:** this is `lib/index.js`, so it activates on the next `dsh web` start (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.
Author
Owner

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.

**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.
Author
Owner

Status after the control-surface slices. Done: wn_speak announcement 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-side Voice channel system-prompt guidance for agent motivation.

Left in #27: announce preempting a running report (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.

**Status after the control-surface slices.** Done: `wn_speak` announcement 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-side `Voice channel` system-prompt guidance for agent motivation. Left in #27: `announce` preempting a running `report` (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.
Author
Owner

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.

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.
dsh closed this issue 2026-11-06 10:49:58 +00:00
Sign in to join this conversation.
No description provided.