Draws circles, arrows, boxes and text on the DSH image preview, keeps every mark selectable so it can be dragged, scaled or re-edited later, and attaches the flattened PNG to the composer at the original image resolution.
Install
# from npm (prebuilt)
dsh plugin --profile web add @dsh-plugin/dsh-image-annotate
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:zhishengplus/dsh-image-annotate
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
简体中文 · English
"Move that button 8px to the left." — Which button?
"This overlaps on narrow screens." — So you take another screenshot and draw an arrow on it.
You hand a screenshot to an AI and say "this is broken here" — and it starts guessing where "here" is.
The wording was never the issue. "Here" is something you have to point at. This plugin turns that into two seconds: open the image → circle it → type → Add to composer → send.
| 🖊 Seven tools | Move · Pen · Arrow · Box · Circle · Text · Eraser. Box and Circle form from the whole traced path, so a freehand loop works too |
| 🖐 Editable after drawing | Every mark is a live object: select, drag, scale by a corner handle, double-click to re-edit text, delete, nudge with arrow keys — all undoable |
| 🔤 Text is an object | Double-click to rewrite it (no duplicate layer); the Text tool can drag a placed label directly |
| 🎨 Native look | Toolbar, buttons, toasts and selection chrome are built from DSH design tokens; light and dark themes just work |
| 📨 One click into the composer | Flattened at original resolution and handed to the composer's own paste channel; falls back to drop → clipboard → download |
| 🪶 Zero deps, no build | No @deepseek-ai/* import, no dsh-loader, no bundler output — the npm tarball is 4 files |
| 🖼 Works on every preview | Screenshots in the conversation, draft attachments, tool-result images — same preview, same pen |
- Click any image in a session;
- a round Annotate button appears in the preview's bottom-right (same shape as the native close button) — click it;
- use Circle / Box / Arrow to mark the spot, or Text to write a note on the image;
- not happy with the position? Just drag it (next section);
- hit Add to composer — the image is attached to your input box, the preview closes, and you type your message as usual.
| Shortcut | Action |
|---|---|
V |
Select / move |
1 – 7 |
Move · Pen · Arrow · Box · Circle · Text · Eraser |
E |
Eraser (removes the mark you click) |
Ctrl/⌘ + Z · Ctrl/⌘ + Shift + Z |
Undo · redo |
Delete |
Remove the selection |
Arrow keys (Shift to accelerate) |
Nudge 1px / 10px |
| Text tool | Click on the image → type → Enter (Esc cancels) |
A paint tool burns pixels; this doesn't — every mark stays editable:
| Goal | How |
|---|---|
| Select | Switch to Move (V) and click any mark — the one you just drew is selected automatically |
| Move | Drag it; arrow keys nudge 1px, Shift + arrows 10px |
| Scale | Drag a corner handle of the selection box (text scales its font size too) |
| Re-edit text | Double-click any label and rewrite it — same mark, no duplicate |
| Delete | Delete, or the trash button (it becomes "delete selection" whenever something is selected) |
| Regret | Every step above is one undo away — Ctrl+Z all the way back |
The whole toolbar is assembled from DSH design tokens — no second visual language:
| Part | Native tokens |
|---|---|
| Toolbar surface | --dsw-menu-surface-fill + --dsw-menu-backdrop-filter + --dsw-elevation-panel + --dsw-radius-lg |
| Tool buttons | --dsw-alias-button-tool-bar-fill / -hover · --dsw-alias-interactive-bg-hover |
| Primary action | --dsw-alias-button-primary-fill · --dsw-alias-label-primary-foreground |
| Entry button | The same 36px round button as the preview's close control (--dsw-specific-input-major + 0.5px hairline) |
| Toasts | --dsw-alias-toast-bg / -label + --dsw-shadow-lv3 (top-centred, like the native toast) |
| Selection | --dsw-alias-state-business-primary |
| Palette | Native static colours: red · amber · yellow · green · blue · brand deepseek-450 · black · white |
| What it does | Why it helps | |
|---|---|---|
| Doesn't touch the host | No slot registration, no React tree surgery — it overlays its own canvas + toolbar on the preview DOM and removes both when the preview closes | No state fights with the official UI, immune to re-renders |
| Doesn't depend on internals | No @deepseek-ai/* import, no injected dsh service, no dsh-loader needed |
Internal renames or API changes can't break it |
| Doesn't need a build | The browser half is a hand-written window.__ModuleLoader__.load factory (lib/client.js) — no tsdown/rollup output |
Edit and reload (client-modules HMR keys on mtime); the tarball is 4 files |
- Preview detection — one stable trait: a
div[role="dialog"][aria-modal="true"]directly underbodywhose direct child is an<img>(that'sdsh-client-ui-primitives'ImageLightbox). A throttledMutationObservermounts on appear and destroys on removal. - Coordinate system — all marks are stored in original-image pixels. The overlay scales them to the displayed size; the export draws them at natural size. A 1909×1231 screenshot shown at 1427×920 therefore exports as a 1909×1231 PNG with every mark exactly where you put it.
- Edit model — strokes are plain objects (
{tool, color, points[], x, y, fontSize, textWidth…}). Select / move / scale / re-edit evaluate the object and repaint the frame; a drag recomputes from the "snapshot at pointer-down + delta" each frame instead of accumulating, so nothing drifts. - Delivery — image and marks are flattened into a PNG (
File), then a syntheticpasteevent carrying that file is dispatched to the Lexical input ([data-composer-input]) — the same path a user-pasted screenshot takes. Fallbacks in order: document-leveldrop→ clipboard (with aCtrl+Vhint) → PNG download. - Taint-proof export — the original is re-fetched as a blob and decoded via
createImageBitmapbefore compositing, avoidingtoBlobSecurityErrors on cross-origin previews.
One fun trap: a
position: fixedoverlay withleft: 50%sizes itself against the space right ofleft, so the toolbar wrapped for no visible reason —width: max-contentis the fix (the native Toast CSS documents the same trap).
| Suite | Covers | Result |
|---|---|---|
test/test_annotate.py |
canvas alignment, stroke pixels, undo, circle forming, export size, paste delivery, auto-close | 17 / 17 |
test/test_edit.py |
select, drag, corner-handle scaling, text drag + double-click edit, arrow-key nudge, delete and undo | 19 / 19 |
test/e2e_dsh.py |
a real dsh instance (isolated profile + own port): open preview → circle → drag → label → deliver → assert the attachment is the original 1909×1231 | 21 / 21 |
The first two run against the bundled fixture (test/lightbox-fixture.html, which mirrors the real preview DOM shape); the third needs a disposable instance — see the script header and PUBLISHING.md. CI (.github/workflows/ci.yml) runs the syntax check plus both fixture suites on every push.
__dshImageAnnotate.annotators[0].state // tool / strokes / selected / natural / rect …
localStorage.setItem('@dsh-plugin/dsh-image-annotate.debug', '1') // verbose logs
# from GitHub (works right now)
dsh plugin --profile <PROFILE> add github:zhishengplus/dsh-image-annotate
# from npm, once published
dsh plugin --profile <PROFILE> add @<scope>/dsh-image-annotate
# local development (link a checkout)
dsh plugin --profile <PROFILE> add link:/path/to/dsh-image-annotate
Then make sure it is listed in the profile's package.json:
"dsh": { "profile": { "bundles": [ /* …, */ "<the package name you installed>" ] } }
One DSH restart is required the first time (profile bundles are composed at boot). After that, edits to lib/client.js are picked up by client-modules HMR (keyed on mtime) with a page refresh.
Uninstall: remove the folder from the profile's node_modules and drop the line from dsh.profile.bundles.
| Verified against | dsh 0.2.0-rc.2 (the plugin only relies on the preview's DOM contract, so it should survive most upgrades) |
| Node | ≥ 20 (repository scripts only — the plugin itself runs in the browser) |
| Dependencies | none: no @deepseek-ai/*, no dsh-loader, no third-party runtime |
- Circle / arrow / box / text / eraser, with select, drag, scale, re-edit and delete after drawing
- Original-resolution export + one-click delivery with three fallbacks
- Fully native-token appearance
- Highlighter / mosaic redaction
- Annotation for images opened from the right-hand file browser
- Auto-numbered "annotation list" sent alongside the image
MIT · Not affiliated with or endorsed by DeepSeek
If it ever saves you one “no, this one” reply, a ⭐ is appreciated.
Links
More in this category
zhu1090093659/dsh-web#packages/dsh-task-board★ 10696
Task board for the dsh web GUI: a sidebar multi-column kanban whose cards run in real DSH agent sessions and can also be scheduled with cron expressions, executed host-side even with the browser closed.
zhu1090093659/dsh-web#packages/dsh-web-all★ 10696
Plugin and skin collection for the DSH Web UI: task board, Git graph, right-side panel, remote mobile UI, pet, live token stats, and a skin center.
ccch1mneyyy/dsh-TUI★ 8484
Claude Code-style full-screen terminal UI: pixel-whale header, live status line, and streaming thought expansion.
MeteorNOX/DeepSeek-Balance-Whale-Widget★ 7509
A fixed-corner whale widget for the DSH web GUI — balance, today's usage and per-turn cost with peak/off-peak pricing, editable balance-alert and daily-budget bubbles, a module-based custom bubble queue with A/B weighted choices and random lines or images, 30+ vendor templates (OpenAI, OpenRouter, Kimi, SiliconFlow, Ark, Zhipu, MiniMax and more) with per-model balance and subscription quota, plus task-end sound, imported audio, custom roles and a resource manager. Local-only, no telemetry.
omdsh-dev/DSH-better-sidebar★ 5395
Full sidebar workbench with file rendering and editing, terminal, Git, and subagents; third-party plugins can register new tabs.
omdsh-dev/dsh-genui★ 1082
Interactive UI components rendered inline in replies: layout, charts, forms, quizzes, mermaid, 3D scenes, and an action event loop back to the model.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.