Introduction

DeepSeek Harness (DSH) integrates agent capabilities into applications. Developers often need to obtain context outside the DSH environment. This plugin fills that gap, enabling system-level text selection without requiring an additional browser.

Plugin Positioning

Select text in any Windows application and use DeepSeek Harness’s own agent to explain or translate it. The result appears in a native always-on-top floating window (GDI+, with zero dependencies and no extra processes).

Core Capabilities

  1. System-level gesture detection
    A companion process polls the mouse state and recognizes “text selection by dragging (displacement ≥ 5 px)” and “double-click word selection.” Gesture landings do not trigger its own click events.

  2. Text selection (UI Automation first)
    The primary path uses UI Automation to read the selected text and its surrounding paragraph, without injecting any keystrokes. If UI Automation cannot read the selection, it falls back to injecting Ctrl+C once. Only one menu is shown for a single selection.

  3. Native always-on-top floating window (GDI+)
    The companion process creates a native Win32 layered window and renders it with GDI+. It supports dragging and resizing from all four edges and corners. No browser dependency is required.

  4. Agent integration
    It does not register tools visible to the model. Instead, it uses the Harness host’s ctx.agents to run a real conversation turn. Each text selection creates a new session, with the result displayed in a streaming manner.

Installation and Enablement

Installation command:

dsh plugin --profile web add "github:fyisgod/dsh-selection-tools"

After installation, restart dsh web for the changes to take effect.

Typical Usage

  1. Select text in any Windows application (by dragging / double-clicking).
  2. A menu appears at the lower-right corner of the selection. Click “Explain” or “Translate.”
  3. The answer window streams the result and supports manually stopping, copying, or closing.

Technical Details

  • No clipboard interference: UI Automation is preferred; Ctrl+C is only a fallback. It also validates clipboard sequence-number changes to confirm a successful copy.
  • Translation logic: If the source text contains CJK characters, translate it into English; otherwise, translate it into Chinese. Words or phrases are output as dictionary entries. For sentences or paragraphs, provide the full translation first, then explain key terms.
  • Zero external dependencies: The companion process uses the bundled koffi FFI in DSH to call user32/gdi32/gdiplus and does not install any runtime.

Configuration and Extension

You can modify the translation direction, model, and reasoning level in DSH Settings -> Selection Tool. The plugin provides the following API endpoints:
* POST /api/dsh-selection-tools/run: SSE streaming output.
* POST /api/dsh-selection-tools/stop: Stop the current session.
* GET /api/dsh-selection-tools/system/status: Query the status of the companion process.

Conclusion

This plugin is a client-side tool in the DeepSeek Harness ecosystem. It provides non-intrusive text-selection interaction through native windows and UI Automation. See the links below for source code and documentation.
- GitHub Repository
- Community Directory