dsh-inpage-translator: One-click Full-page Translation on Agent-opened Pages

Preface

When letting an agent open a web page to read material in DeepSeek Harness (DSH), the common approach is to screenshot the whole page or extract fragments before handing them to the model. Foreign-language pages often force you to open a separate translation extension or copy-paste, which feels disconnected from “this page right in front of me.” dsh-inpage-translator takes a different path: it places a resident floating-button inside the browser page the agent is already viewing; one click swaps visible text in place for translations, another click restores the original; translation goes through the host’s already-configured LLM, and the plugin itself holds no API key. Below we cover what it is, what it does, how to install it, how to use it, and the boundaries you need to accept.

What Is This

dsh-inpage-translator (in-page translation) is published by maintainer 7gzgn and is categorized as a networking tool in the DSH community directory. In one sentence: it automatically installs a “🈯 translate” button onto every content-bearing page the agent opens, replacing every visible text node with its translation in one click, and reverting on another click; long pages are chunked, repeated strings are translated only once, and translation is completed by the host’s LLM service.

Unlike the author’s earlier plugins that “only touch the local machine, files, or windows,” this is the first DSH plugin the README notes that directly modifies the DOM of “unfamiliar web pages”; by design it only changes text and only adds inline styles, and it does not inject external <style> tags, to reduce the surface of conflicts with page CSPs.

Core Features

Resident Button and Background Patrol

The plugin’s background scans all live browser sessions roughly every 1.5 seconds and automatically installs the translation button into pages that have content; after navigation the button disappears with the injection, and the patrol reinstalls it. The button’s position can be remembered per site in localStorage (key dsh-ipt-pos); after dragging, it stays in place across navigation or reopening.

The overlay uses position: fixed with an extremely high z-index, with styles written on the element itself, not relying on the page’s style sheets.

Click to Translate and Restore

Gesture Result
Single click Switch between original ↔ translated
Long press (~320ms) Enter drag mode
Dragged within 48px of the left/right edge Docks into a slim edge handle (showing only 🈯)
Click the docked handle Expands into a capsule shape; does not trigger translation

A release at the end of a drag will not accidentally trigger translation.

Text Processing and LLM Calls

  1. Uses a TreeWalker to traverse text nodes, tags translatable parent elements (e.g., data-dsh-pt) and records the original text.
  2. The same string is sent for translation only once; an in-process LRU cache keyed by “language + original text” and model route is maintained (the README notes roughly 4000 entries as of v0.2.2), so a second translation on the same page or repeated copy across pages can significantly reduce model calls.
  3. Chunked parallel translation (the README notes 3-way parallelism); translations are generated via ctx.get('llm') through resolveCallConfig → prepareCall → stream, consistent in shape with prior host examples such as dsh-meme and dsh-better-sidebar.
  4. Writes back textContent by index; on restore, all original text is restored.

The tool receipt includes fields such as number of strings sent for translation, number filled back, number of model calls, character count and cap, number of unique strings, cache hits, over-limit discards, fallback original text, number of cross-origin iframes, and warnings. The README stresses no silent discards and no fabricated numbers.

Tool Action translate_page

You or the agent can call the plugin’s tool. Common action values:

translate_page action=install        # Ensure the button is present and wait for the user to click (default: wait 60 seconds)
translate_page action=translate      # Do not wait for a click; translate immediately
translate_page action=restore        # Return to the original text
translate_page action=status         # Read-only status (includes a list of live sessions)
translate_page action=sessions       # Read-only: list all live browser sessions

Since v0.2, install is no longer a mandatory precondition: the patrol installs the button automatically; install suits scenarios where you want to “wait for the user to click once within the same call.”

Optional parameters include: target (default zh, also en / ja / ko / ru), mode (default replace, with optional bilingual), maxChars (if omitted, adapts based on the page’s unique text volume within roughly 4000–24000 characters), waitSec, session (if omitted, the most active session is chosen), provider, model.

Dependencies

  • Built-in browser (ctx.get('browser')): raises an explicit error when missing.
  • Host LLM service (ctx.get('llm')): the plugin does not read API keys and does not issue its own external fetch HTTP requests.

package.json marks the current version as 0.2.4, license MIT, Node >= 18; it is marked compatible with DSH releases such as 0.2.0-rc.2 and 0.2.1-rc.2 in the compatibility field (subject to dsh.compatibility inside the plugin package).

Installation and Activation

Once listed in the marketplace, you can search for dsh-inpage-translator inside DSH to install it. The manual method given in the README (Windows example) is as follows:

New-Item -ItemType Junction -Path "$env:USERPROFILE\.dsh\profiles\desktop\node_modules\dsh-inpage-translator" -Target "D:\dsh\projects\dsh-inpage-translator"
# In the profile's package.json: add "dsh-inpage-translator": "link:D:/dsh/projects/dsh-inpage-translator" to dependencies
# And add "dsh-inpage-translator" to dsh.profile.bundles (it won't load if omitted) → restart DSH

The DSH ecosystem is “everything is a plugin”; the SkillHub directory page is a community site with no official affiliation with DeepSeek / High-Flyer. Before installing, please inspect the GitHub repository source and license yourself. The plugin runs with the current DSH process’s permissions, executes scripts inside pages, and calls the local LLM.

Typical Usage

When humans read foreign-language pages, the workflow described in the README is:

  1. Let the agent open the target page (the button usually appears automatically);
  2. Click “🈯 translate”;
  3. After about one or two seconds, visible text becomes the translation;
  4. When you need to compare with the original, click the button again, or have the agent run translate_page action=restore.

If you want to actively translate the whole page in conversation without waiting for a click:

translate_page action=translate

To specify a language or bilingual side-by-side display (parameter names per the README):

translate_page action=translate target=en mode=bilingual

Suitable Scenarios and Caveats

Suitable for: foreign-language documentation, forums, and product pages that the agent has opened with the DSH built-in browser, when you want “what you see is what you translate” and are willing to hand page text to the locally configured model.

Boundaries (as stated in the README; please accept them before use):

Boundary Explanation
Not a toolbar button The host’s built-in browser toolbar has no third-party extension point, so the button can only be built into a page overlay.
Cross-origin iframes Only the current document’s DOM; text inside cross-origin iframes cannot be translated, and the receipt reports the count. Same-origin iframes are also not within the whole-page scope for now.
Visible text nodes Does not process text in images/canvas/background images; does not change the values of <input> / <textarea>.
Character cap When maxChars is not passed, it adapts automatically; the excess is reported and skipped; passing a positive number applies a hard truncation.
DOM rewritten by page scripts Tagging may wrap content in spans; if the page rewrites the DOM, translations may be overwritten, and you can rerun translation.
Privacy Page content goes to the provider you configured; for sensitive pages, judge for yourself whether to translate.

On security, the README states that the plugin does not send external requests, does not create local HTTP services, and does not store credentials; position memory is written only to localStorage under dsh-ipt-pos and does not store page body text.

Closing

dsh-inpage-translator brings “whole-page translation” into DSH plugins and the host LLM: a resident button, click to translate, click again to restore, repeated copy and caching ease quota pressure, and receipt fields make it easy to verify whether the translation is complete. For further information, visit the community directory 7gzgn/dsh-inpage-translator and the source repository github.com/7gzgn/dsh-inpage-translator.

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

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

Xiaoye