dsh-selection-assistant: Invoke the DSH Model via Text Selection in Any Application

Introduction

When using DeepSeek Harness (DSH) for daily development, the model’s capabilities often remain confined to DSH’s own window: when you select a paragraph in a browser, document, or chat tool and want to translate, explain, or summarize it, you often have to copy and paste it into DSH. There are some “text selection assistant” products in the desktop environment, similar in form to Cherry Studio’s text selection assistant. dsh-selection-assistant is a bundle plugin for DSH: when you select text in any app on Windows or macOS, a floating toolbar pops up via a local native assistant, delegating the actions to the model currently configured in DSH, with the results displayed in a separate result window via streaming. Below is an explanation of positioning, capabilities, installation, usage, and notes.

What is it

Repository: evanliu3594/dsh-selection-assistant, maintainer evanliu3594, category Model Inference. Description: Selection assistant plugin for deepseek harness; current package version 0.2.5, license MIT.

It solves the problem of “cross-app text selection → one-click model action”: the host side runs inside the DSH plugin process, responsible for settings, model invocation, and the loopback HTTP; the true global input listener, drawing of the floating toolbar, and result window are handled by a separate native helper (PowerShell + WPF on Windows, Swift + AppKit on macOS). Linux is not supported.

Core Features

After selecting text with the mouse in any app such as a browser, Word, PDF reader, or chat software:

  1. By default, hold Ctrl (Control on macOS) for about 0.5 seconds (adjustable 200–1500ms); a floating toolbar appears next to the mouse. You can also change it to “appear immediately on selection” or trigger via a hotkey in settings.
  2. Toolbar actions map to model invocations: by default, translate, explain, summarize, search, and copy are enabled; polish is disabled by default and can be enabled in settings.
  3. Translation is routed based on “Target Language / Alternate Language”: the local side first determines the language of the selected text; if it is not the target language, it translates to the target language; if it is already the target language, it translates to the alternate language; if the target and alternate are the same, it prompts “Target language overlaps with source language” and does not invoke the model; if the language cannot be determined, it is left to the model.
  4. The result window streams the output of DeepSeek (or other models you route in DSH), supporting copy, regenerate, resize, and pinning; it can follow the toolbar, stay on top, and automatically close when losing focus.
  5. The model defaults to the DSH default model, but you can specify the service, model, inference strength, and temperature separately in “Settings → Selection Assistant”.

Regarding dependencies: Requires DSH 0.2.x desktop version with the llm service; no extra API keys or administrator privileges are needed (Windows 10/11; macOS 13.1 and above). macOS additionally requires Accessibility permissions and Xcode Command Line Tools (for compiling SelectionAssistant.app).

Installation and Enablement

Install this bundle in DSH, choose one of the following methods.

Method 1: Have the Agent use plugin_manager install_bundle, pointing target to the repository:

target: https://github.com/evanliu3594/dsh-selection-assistant

Method 2: Command line (desktop profile):

dsh plugin --profile desktop add https://github.com/evanliu3594/dsh-selection-assistant

The plugin manager usually applies the installation via hot reload; returning application: applied indicates it is effective. If there is no “Selection Assistant” entry in settings, a full restart of DeepSeek Harness is required; refreshing the page is not enough.

On the first load, the plugin will:

  1. Create settings and logs in %USERPROFILE%\.dsh\selection-assistant\ (Windows) or ~/.dsh/selection-assistant/ (macOS);
  2. Start the assistant communication service on a random port of 127.0.0.1;
  3. On Windows, launch helper/SelectionAssistant.ps1 (PowerShell 7 preferred, otherwise Windows PowerShell 5.1);
  4. On macOS, check helper/macos/bin/SelectionAssistant.app; if necessary, run sh scripts/build-macos-helper.sh to compile and then start it via LaunchServices.

Open Settings → Selection Assistant and confirm that the status card shows “Running”. If macOS has not authorized Accessibility, click the status card to open the system “Privacy & Security → Accessibility” and check SelectionAssistant (may appear as “划词助手” / Text Selection Assistant); the authorized object is the helper app itself, not the DeepSeek Harness main program.

Typical Usage

  1. Select a paragraph of text in any app.
  2. Hold Ctrl (Control on macOS) for about 0.5 seconds, until the toolbar appears (default method).
  3. Click buttons such as translate, explain, summarize, search, or copy.
  4. Check the output in the result window below the toolbar: Esc to close, R to regenerate, C to copy.
  5. When you need to pin the window, click the pin in the result window’s title bar; after pinning, it stays on top; clicking it again restores the settings for pinning and closing on blur.

Settings are saved in settings.json under the data directory. After saving, only the assistant process restarts, not DSH. Settings sections include trigger method, translation language, toolbar style, result window behavior, actions and prompts, model override, search engine, and advanced items (assistant path, log level, preview toolbar, etc.).

Architecture and Security Boundaries (Brief)

The data flow is roughly: select text in any app → Native assistant (global hook / long press / copy word) → Local loopback HTTP (random port + random token per start) → DSH Host plugin (Node, ctx.llm) → Configured model routing.

In terms of security design: the loopback service binds only to 127.0.0.1, and requests require Authorization: Bearer; text selection uses “save clipboard → copy shortcut → read clipboard → restore” and does not read UI Automation or take screenshots; the plugin does not store credentials separately, and model invocation reuses the DSH account and routing; the assistant logs do not contain clipboard content. On macOS, only Accessibility is requested, not screen recording or full disk access.

Applicable Scenarios and Notes

Who is it for: Users who frequently read English documents, tech posts, or chat snippets in non-DSH windows and wish to use the same set of DSH models for translation, explanation, and summarization without repeatedly switching applications. The plugin runs with the permissions of the current DSH process and the helper it launches; you should review the repository source code and the MIT license yourself before installing.

Known Limitations (selected):

  • Only Windows 10/11 and macOS 13.1+; does not support Cherry Studio’s “Ask Agent / Reference to Chat”; the result window will not return to the DSH session.
  • Text selection relies on the clipboard and copy shortcuts; text may not be retrieved on some sandboxed or App Store apps or when the clipboard is occupied.
  • The local judgment of translation language is heuristic; short sentences in Latin-based languages may not be judged accurately and fall back to the model.
  • Recompiling the helper on macOS changes the ad-hoc signature, and Accessibility authorization may require being re-added.

Troubleshooting can start from “Settings → Selection Assistant → Advanced → View Logs” and the helper.log and plugin.log in the data directory; common phenomena (PowerShell not found, Accessibility issues, no response to long press, model credential errors, etc.) have corresponding handling in the troubleshooting table in the repository README.

Conclusion

dsh-selection-assistant connects DSH’s model inference to the system-level text selection flow: the native assistant handles cross-app UI, the host plugin handles configuration and llm invocation, and settings are centralized in the same entry point of the DSH desktop version. Community plugin directory page: skillhub.cn/plugins/evanliu3594/dsh-selection-assistant; source code and full documentation: github.com/evanliu3594/dsh-selection-assistant.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye