Introduction¶
Assistant replies in DSH sessions often come with tables, reference images, and long paragraphs at the same time. Direct copying and forwarding results in messy tables, images reduced to small previews, and long text spamming the screen; using system screenshots, content above or below is lost due to the current viewport or scrolling. The problem this plugin solves is to re-layout this “already generated reply” according to paper suitable for reading, outputting a complete long PNG directly to the clipboard.
What is this¶
geopanret/dsh-chat-share-image is a DSH client plugin, maintained by Geopanret, categorized as a client plugin. It does not change the conversation logic; it only adds a camera button to the button area of each completed assistant reply (the row of Copy / Good Answer / Problematic Answer): a click renders the complete content of that reply into a long PNG image and writes it to the system clipboard. The Host side is a shell; all logic runs in the browser, with no network connection, no uploads, zero Host permissions, and no need to restart DSH.
Key Features¶
The following lists the capabilities already documented in the plugin README.
- Complete Content in Image: Renders all content of this reply, not just the current viewport; code blocks, formulas, and long text are all complete.
- Table Re-layout: Removes horizontal scrolling and cell width limits in the screenshot; all columns and text are displayed without missing columns.
- Reference Image Enlargement: The 240/360px small preview in the interface is displayed in full proportion to the original image in the screenshot without cropping.
- Long Text Overflow Prevention: Long URLs and non-breaking words wrap automatically without expanding the canvas beyond boundaries.
- Post-Output Self-Check: After writing the PNG, it is decoded and read back to verify the file is not empty and the PNG dimensions match the canvas, ensuring no bad images are silently output.
- Auto-Splitting for Long Text: If it exceeds the readable height of a single page, it is split into multiple pages based on paragraphs. The 1st page goes to the clipboard, others can be copied or downloaded one by one in the toast; if it exceeds the 6-page limit, it explicitly rejects and suggests splitting.
- Theme Following: Follows the current page’s Dark / Light theme.
- Clipboard Fallback: Download the PNG if the clipboard is unavailable.
Installation and Usage¶
Install from GitHub release (recommended):
dsh plugin --profile desktop add github:Geopanret/dsh-chat-share-image#v0.2.0
First-time installation takes effect via HMR; subsequent changes to client.js are hot-replaced by @deepseek-ai/dsh-client-hmr, no need to restart DSH.
For local development, you can link to the workspace and execute in the DSH session:
plugin_manager action=install_bundle target=D:\PLAYGROUND-DSHo\dsh-chat-share-image
Installation is written to the profile by plugin_manager (~/.dsh/profiles/desktop); do not manually edit package.json / cordis.patch.yml in the profile. Uninstall:
plugin_manager action=remove_bundle target=dsh-chat-share-image
Typical Usage¶
After installing and enabling, click the newly added camera button in the button area on any completed assistant reply. The plugin clones this row on the browser side, applies a paper layout layer that only takes effect for screenshots, and then rasterizes it into a PNG and writes it to the clipboard.
To verify if the plugin itself is working correctly, you can run in the repository root:
node --check client.js
node test/smoke.mjs
A live page test recorded in the README (where agent-browser intercepts navigator.clipboard.write to get PNG bytes) covered scenarios like a real 5-column table long reply split into 1584×12316, reference image enlargement, dark theme, and a super long reply split into 2 pages.
Implementation (Brief)¶
All logic is in client.js on the browser side; the Host side index.js is a shell. The workflow is: Register button entry → Locate reply row DOM by messageId given by slot → Clone and clear real-time layout frozen values → Apply paper layout layer, expand scroll clipping, re-layout tables, enlarge reference images → Inline same-origin / blob / data images and webfonts → Measure off-screen and rasterize via SVG <foreignObject> at 2× clarity → Read back for validation → Write to clipboard or split. The SVG must be passed to <img> as a base64 data URL, because Chromium loading an SVG containing <foreignObject> with a blob URL pollutes the canvas, and toBlob will throw a SecurityError directly.
Use Cases and Notes¶
Suitable for people who need to share replies in DSH: group discussions, internal sync, archival screenshots. This image is not a screenshot of the interface as is, but a version “re-layouted for full readability”; the presentation of tables and images in the screenshot differs from the interface scroll preview.
Note a few points before use:
- The plugin runs with the current dsh process permissions; check the source code and license (marked as MIT in README) before installing.
- Super long replies will be split into multiple PNGs, up to 6 pages; single page is still constrained by 32767px side length / 64 million pixel limit.
- Super long code lines exceeding 2000px width will wrap automatically, preserving content but not original line width.
- Remote images that are cross-origin and lack CORS headers cannot be embedded in canvas; they will show an
[image: alt]placeholder and be counted. - Reply row positioning relies on some
data-*attributes in the responsive internals; when DSH structure changes, the button will show an error instead of crashing, but adaptation is required.
The directory page currently shows 0 stars.
Conclusion¶
The value of this plugin lies in turning “forwarding a reply” from a manual screenshot puzzle into getting a fully layouted, readable long image with one click. Implementation is concentrated on the browser side; the Host side is just a shell. With HMR, no restart is needed after changing client.js.
Directory: https://www.skillhub.cn/plugins/Geopanret/dsh-chat-share-image
GitHub: https://github.com/Geopanret/dsh-chat-share-image