Skip to content
Back to search

dsh-annotation

DSH Web 选中批注插件:选文字→批注→回车随消息发送;气泡隐藏批注块(零闪烁);回复按 Annotation N 逐条对照(可悬浮芯片)。官方 bundle,零核心改动

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/omdsh-dev--dsh-annotation/badge.svg)](/listings/omdsh-dev--dsh-annotation)

HTML

<a href="/listings/omdsh-dev--dsh-annotation"><img src="/api/listings/omdsh-dev--dsh-annotation/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

# Public npm package (works without an npm account)
dsh plugin --profile web add @changfenhuang/dsh-annotation
# Or install directly from the public GitHub source
dsh plugin --profile web add git+https://github.com/omdsh-dev/dsh-annotation.git
# local path install (development / debugging)
cd /path/to/dsh-annotation
dsh plugin --profile web add .
# restart the web service — see "Restarting the web service" below

To add it only as a Node dependency in an existing project:

npm install @changfenhuang/dsh-annotation

> `npm install` only adds the dependency; it does not register the plugin with DSH. Use `dsh plugin add` above when installing it into DSH.

Migrating from the old `@omdsh-dev` package name

If you installed the plugin before v1.4.2, remove the old dependency before installing the renamed package:

dsh plugin --profile web remove @omdsh-dev/dsh-annotation
dsh plugin --profile web add @changfenhuang/dsh-annotation

If `dsh web` still fails and mentions `@omdsh-dev/dsh-annotation`, remove only the stale `dsh-annotation` entry that uses that old name from `~/.dsh/profiles/web/cordis.patch.yml`. The plugin now supplies the `@changfenhuang/dsh-annotation` entry itself.

| Do | Don't | |----|------| | Only `dsh plugin add` / only write `bundles` | **Never** insert the same id again in the profile/home `cordis.patch.yml` |

Self-check:

dsh --profile web --dump-config | rg "id: dsh-annotation"   # must be exactly 1 line
dsh web --no-open   # open the printed one-time token URL in a browser

In the browser console, `window.__DSH_BOOT__.entries.find(({ id }) => id === '@changfenhuang/dsh-annotation')` must return an entry with a `url`. dsh 0.1.2 no longer exposes the old bare per-plugin URL.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 156 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # dsh-annotation
  2. <div align="center">
  3. **English** · [简体中文](./README.zh-CN.md)
  4. </div>
  5. <p align="center">Selection-annotation plugin for DSH Web: select text → annotate → press Enter to send it along with your message; the model replies to each annotation by number.</p>
  6. <p align="center"><strong>🌐 <a href="https://omdsh-dev.github.io/dsh-annotation/">Live Product Site — Explore dsh-annotation in DSH</a></strong></p>
  7. <p align="center">
  8. <img src="https://badgen.net/badge/license/MIT/blue" alt="license">
  9. </p>
  10. <img width="2940" height="1770" alt="image" src="https://github.com/user-attachments/assets/c3186efc-44d3-4e7f-9523-1902d9d037e9" />
  11. <img width="2940" height="1770" alt="image" src="https://github.com/user-attachments/assets/0b48ac02-4648-4b94-8d8f-344f8b7c25b4" />
  12. <img width="2940" height="1770" alt="image" src="https://github.com/user-attachments/assets/8b2610d0-3d00-41be-b314-bac2fe616787" />
  13. <img width="2940" height="1770" alt="image" src="https://github.com/user-attachments/assets/9b66deea-3786-4296-9b0d-52873a15f5e1" />
  14. Select any text in an assistant reply to annotate it (the annotation body may be left empty = just mark the passage). Annotations accumulate across messages and turns. An **Annotations ×N** chip appears next to the input box — hover to view all annotations, remove them one by one. Press Enter and the annotation block goes to the model together with whatever question is in the input box. **The annotation block never shows up as text in your own message bubble** — only the question plus the chip (content visible on hover; hidden before paint, zero flicker). The model replies with `Annotation 1: …` … `Annotation N: …`, one per annotation, and every Annotation label in the reply is a hoverable chip showing the annotated passage and your note.
  15. Form: official **bundle plugin** (`dsh.bundle` + a `dsh.client` declaration in package.json, injected into the browser via client-modules; the Node half is an empty implementation). **Zero core changes** — no DSH files are touched; `cordis.patch.yml` only inserts its own id once, and the profile patch stays `[]`.
  16. ## Features
  17. Sidebar file annotations (DSH 0.1.6-alpha.1): select plain text, Markdown, or code in a workspace file preview and use the same annotate, save, and Enter-to-send flow. The editor and model-facing quote include the file path. After reloading and reopening the original file, its markers are restored; identical passages in different files remain separate. PDF, images, and HTML inside iframes are not covered.
  18. | Feature | Description |
  19. |---|---|
  20. | Select-to-annotate | Select assistant text → toolbar "Annotate" → write your note (may be empty); dismiss by clicking elsewhere or pressing Esc |
  21. | Numbered marker + highlight | A blue numbered marker + highlight anchored to the passage, viewport-anchored with collision avoidance, never lost when scrolled out of view |
  22. | Cross-turn collection | Any number of annotations accumulate across messages/turns, numbered from 1 |
  23. | "Annotations ×N" chip | Small chip beside the input box; hover shows every annotation, deletable individually |
  24. | Enter sends with your message | Annotation block + the question in the input box are sent to the model together (the model receives the full content) |
  25. | Hidden in your bubble | The annotation block is removed from your bubble's DOM the moment you send (before the browser paints), leaving only the question + the chip (hover to view); historical messages self-heal after a refresh |
  26. | Numbered reply correspondence | A format instruction is injected into the message so the model replies `Annotation 1: …` … `Annotation N: …` one by one |
  27. | Reply annotation chips | `Annotation N:` in the reply renders as hoverable chips showing the passage + your note |
  28. ## Interaction flow
  29. ```
  30. Select assistant text ──▶ Toolbar "Annotate" ──▶ Write note / save empty ──▶ Blue numbered marker + highlight
  31. ▲ │
  32. └────────────── any number, accumulate across turns ◀────┘
  33. │
  34. ▼
  35. "Annotations ×N" chip beside the input (hover to view / delete)
  36. │
  37. Press Enter
  38. ▼
  39. Model receives: annotation block (number + passage + note) + your question
  40. Your bubble: question only + "Annotations ×N" chip (zero flicker)
  41. Model reply: Annotation 1: … Annotation 2: … (hoverable chips)
  42. ```
  43. ## Install (official bundle path · the only one)
  44. ```sh
  45. # Public npm package (works without an npm account)
  46. dsh plugin --profile web add @changfenhuang/dsh-annotation
  47. # Or install directly from the public GitHub source
  48. dsh plugin --profile web add git+https://github.com/omdsh-dev/dsh-annotation.git
  49. # local path install (development / debugging)
  50. cd /path/to/dsh-annotation
  51. dsh plugin --profile web add .
  52. # restart the web service — see "Restarting the web service" below
  53. ```
  54. To add it only as a Node dependency in an existing project:
  55. ```sh
  56. npm install @changfenhuang/dsh-annotation
  57. ```
  58. > `npm install` only adds the dependency; it does not register the plugin with DSH. Use `dsh plugin add` above when installing it into DSH.
  59. ### Migrating from the old `@omdsh-dev` package name
  60. If you installed the plugin before v1.4.2, remove the old dependency before installing the renamed package:
  61. ```sh
  62. dsh plugin --profile web remove @omdsh-dev/dsh-annotation
  63. dsh plugin --profile web add @changfenhuang/dsh-annotation
  64. ```
  65. If `dsh web` still fails and mentions `@omdsh-dev/dsh-annotation`, remove only the stale `dsh-annotation` entry that uses that old name from `~/.dsh/profiles/web/cordis.patch.yml`. The plugin now supplies the `@changfenhuang/dsh-annotation` entry itself.
  66. | Do | Don't |
  67. |----|------|
  68. | Only `dsh plugin add` / only write `bundles` | **Never** insert the same id again in the profile/home `cordis.patch.yml` |
  69. Self-check:
  70. ```sh
  71. dsh --profile web --dump-config | rg "id: dsh-annotation" # must be exactly 1 line
  72. dsh web --no-open # open the printed one-time token URL in a browser
  73. ```
  74. In the browser console, `window.__DSH_BOOT__.entries.find(({ id }) => id === '@changfenhuang/dsh-annotation')` must return an entry with a `url`. dsh 0.1.2 no longer exposes the old bare per-plugin URL.
  75. ## Restarting the web service
  76. Pick the command for your platform:
  77. ```sh
  78. # macOS (launchd)
  79. launchctl kickstart -k "gui/$(id -u)/com.dsh.web"
  80. # WSL / Linux with systemd user services
  81. # The unit name may differ by install method; check with:
  82. # systemctl --user list-units | rg dsh
  83. systemctl --user restart dsh-web
  84. ```
  85. Environments without a service manager (e.g. some containers) often need **no restart at all**: `client.js` is served per request with no caching, so a hard refresh (Cmd/Ctrl+Shift+R) picks up plugin changes. The self-check commands above are platform-neutral.
  86. ## Architecture notes
  87. - **Pure browser-side**: everything lives in `client.js` (a hand-written CJS bundle, no build step, served no-cache per request)
  88. - **Message format** (the literal protocol block sent to the model; follows the DSH `locale` preference — zh or en):
  89. ```
  90. zh: 我批注了以下 N 处内容…\n\n1. 原文\n 批注:…\n\n请用「Annotation 1:…」…\n\n提问:
  91. en: I annotated the following N passage(s)…\n\n1. quote\n Note: …\n\nPlease respond… "Annotation 1: …"…\n\nAsk:
  92. ```
  93. The zh delimiter is 「提问:」(ask:) rather than 「问题:」(question:) — the heading line "回答我的问题:" also contains the latter, and the bubble-hiding surgery would misfire on it; the en delimiter is `Ask:`. Hiding and reverse-parsing accept both languages plus the legacy 「问题:」 marker.
  94. - **Bubble hiding**: user bubbles are plain-text rendered (a single MessageText node, not markdown); a MutationObserver in the microtask phase (before paint) splits at the last `\n提问:`, cuts the annotation block, and attaches the chip; a 1 s polling fallback plus historical-message repair after refresh
  95. - **Reply chips**: after streaming settles (`data-streaming` removed), each `Annotation N:` is replaced with a hoverable chip; item data is stored on the most recent user message carrying the annotation tag (`tag.__annotationItems`) and rebuilt after refresh; **snapshot the text nodes collected by the TreeWalker before touching the DOM, then replace one by one** — replacing a child mid-walk invalidates the walker pointer and only the first node gets processed
  96. - **Locale-aware**: UI copy and the protocol block follow DSH's `locale` service (`zh`/`en`, live switch); historical bubbles stay parseable across languages; missing locale service falls back to zh
  97. - **IME-safe**: the Enter interception carries `isComposing` / keyCode 229 guards; never hard-edits the composer textarea's DOM; `setDraft` only assembles the annotation block at the last moment before submit and never clobbers the user's draft
  98. - **No reliance on send-completion event chains**: bubble decoration uses MutationObserver + polling (`watchInputDraft` can be ineffective before the session is loaded at init; it is only a staging entry)
  99. - **Focus-chat compatible**: works inside the focus conversation view of [dsh-focus-chat](https://github.com/dingyi222666/dsh-focus-chat) — assistant rows there are `[data-focus-flow]` containers with a `*_assistant` CSS-Modules class (plus `data-streaming` while running); selection, annotation, reply chips, and re-anchoring all work in the focus tab alongside the main chat view
  100. ## Developer testing
  101. [CI and DSH host testing](./docs/testing.md#english)
  102. ## Version history
  103. | Version | Highlights |
  104. |---|---|
  105. | v1.4.x | Locale-aware: zh/en UI copy and annotation protocol block, live switch via DSH `locale` service |
  106. | v1.3.x | Numbered reply correspondence: format-instruction injection + hoverable `Annotation N:` chips (TreeWalker snapshot fix) |
  107. | v1.2.x | Hidden annotation block in bubble: MutationObserver microtask zero-flicker + polling fallback + historical-message repair |
  108. | v1.x | Self-contained annotation flow (replaces the v0.9 chip design): capture-Enter assembles the block and sends it with the message |
  109. | v0.9.x | Early chip design (insertReference + slash codec), superseded by v1.x |
  110. ## Friendly links
  111. - [Linux.do](https://linux.do)
  112. ## License
  113. MIT

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.