CodeWhale icon indicating copy to clipboard operation
CodeWhale copied to clipboard

Feature: model-triggerable desktop notification tool

Open punkcanyang opened this issue 6 months ago • 3 comments

Summary

DeepSeek TUI has a notification system (notifications.rs) that fires after long agent turns, but the LLM itself has no way to trigger a desktop notification on demand. This is a design gap compared to Claude Code and Codex, where the model can proactively alert the user (e.g., "5 seconds elapsed, ready for input").

Current state

  • crates/tui/src/tui/notifications.rs implements OSC 9 / BEL notifications
  • notify_done() is called only from the engine's turn-completion path
  • resolve_method() auto-detects the terminal and picks OSC 9 or BEL
  • There is no tool or internal API exposed to the model for triggering notifications

Use cases

  • Timer / reminder: "ping me in 30 seconds"
  • Background task completion: "I finished processing that large file, come back"
  • Async workflow: model spawns sub-agents, wants to notify user when they return
  • "Let me think about this for a moment" → notification when ready

Possible implementation

  1. New tool (notify_user or desktop_notification) — model calls it with a message string and optional delay. Writes the OSC 9 / BEL escape to stdout (or calls terminal-notifier on macOS, notify-send on Linux, WinRT toast on Windows).
  2. Reuse existing notify_done infrastructure — expose it via a tool that calls notify_done(Method::Auto, ...) directly.
  3. Config-driven — a [notifications].model_triggerable = true toggle.

The tool should respect the user's existing notification configuration (method, threshold, etc.) and degrade gracefully on unsupported platforms.

punkcanyang avatar May 09 '26 16:05 punkcanyang

I think https://github.com/rullerzhou-afk/clawd-on-desk is a solid source of inspiration. If needed,could probably port it over to DeepSeekTUI, but it might have to draw some whale animations for it haha.

THINKER-ONLY avatar May 10 '26 05:05 THINKER-ONLY

It would be good to have a notification, we need a tool to indicate when the work reaches a certain stage. I'll take a look

punkcanyang avatar May 10 '26 06:05 punkcanyang

Implemented in v0.8.27 (releasing shortly).

The new built-in notify tool is always-loaded (no ToolSearch round-trip), with this contract:

{ "title": "build done", "body": "all 2620 tests passed" }

Delivery routes through the existing tui::notifications infrastructure, so your [notifications].method config in ~/.deepseek/config.toml drives behavior:

  • iTerm2 / Ghostty / WezTerm → OSC 9 (banner + sound)
  • macOS / Linux fallback → BEL
  • Windows → off by default (opt-in to BEL + MessageBeep)
  • method = "off" → silent no-op (the tool still succeeds)

The tool description steers the model toward "long task done / needs attention" use cases and away from chatter. Title and body are length-capped (80 / 200 chars on character boundaries, so multi-byte glyphs aren't sliced) and tmux passthrough is detected via $TMUX so OSC 9 reaches the outer terminal.

notify-rust was not added — reusing the existing tui::notifications pipeline avoids a new external dependency and keeps the user's existing config the single source of truth.

Once v0.8.27 ships, please update with one of:

  • npm: npm install -g deepseek-tui@latest
  • brew: brew upgrade deepseek-tui
  • cargo: cargo install --force deepseek-tui-cli

Thanks for the request — and to @THINKER-ONLY and @punkcanyang for the references and offer to take it on. Reopen if you want a richer notification surface (icon, action buttons, native toast) and we can layer that on next.

Hmbown avatar May 10 '26 15:05 Hmbown