dsh-mindmark 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.en.md +88 -0
- package/README.md +99 -2
- package/client.js +2296 -0
- package/cordis.patch.yml +14 -0
- package/docs/demo.gif +0 -0
- package/icon.svg +9 -0
- package/index.js +566 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +56 -6
- package/src/inject.js +191 -0
- package/src/lessons.js +187 -0
- package/src/store.js +747 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 BaiKe-Zhang
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.en.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# dsh-mindmark
|
|
2
|
+
|
|
3
|
+
**Show the model your mind: mark up its answer the way you would in Word.**
|
|
4
|
+
|
|
5
|
+
English | [中文](README.md)
|
|
6
|
+
|
|
7
|
+
A [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) plugin. Select any passage of an answer and **highlight, underline, strike, comment on or rewrite** it. On the next turn the model receives your markup as context: not just its own answer, but the answer as you want it understood. It confirms back when it has handled every mark. After a few annotations, one click asks the model to distill them into **long-term preferences** in your global `AGENTS.md`, which every new conversation then follows.
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
## What it feels like
|
|
12
|
+
|
|
13
|
+
1. Select text in any answer. The Chat view's own selection bar appears with this plugin's actions:
|
|
14
|
+
**Quote · Highlight · Underline · Strike · Comment · Rewrite · Remove marks**.
|
|
15
|
+
2. Highlight, underline and strike apply immediately; comment and rewrite open a small input (confirm with the button or Ctrl+Enter).
|
|
16
|
+
3. Send your next message. The model adjusts its answer to your marks, then calls the `annotations` tool to confirm they are handled.
|
|
17
|
+
4. The composer gains an **Annotation feed** switch with a pending-count badge:
|
|
18
|
+
- **Brief**: the next turn sends only the annotated passages with a little context;
|
|
19
|
+
- **Full**: the next turn sends the whole answer as a revision view with inline markers.
|
|
20
|
+
5. The marker icon in the session header opens the panel: every annotation with its state (pending / handled by the assistant / auto-settled), per-item delete, mark handled, send again, and **Keep as habit**, which asks the model to distill the marks into lasting preferences. Distilled preferences are listed there and can be removed.
|
|
21
|
+
|
|
22
|
+
## What each mark tells the model
|
|
23
|
+
|
|
24
|
+
| Mark | Meaning |
|
|
25
|
+
|---|---|
|
|
26
|
+
| Highlight | This is what I want: keep it and strengthen this direction |
|
|
27
|
+
| Underline | Not enough here: expand, clarify or justify |
|
|
28
|
+
| Strike | Drop this next time |
|
|
29
|
+
| Comment | Act on the note and respond to each one |
|
|
30
|
+
| Rewrite | Treat my wording as the correct version |
|
|
31
|
+
|
|
32
|
+
## How the model sees and answers your marks
|
|
33
|
+
|
|
34
|
+
- **Pre-step injection.** At the start of every turn the Host renders the conversation's pending annotations into one user-role context message entered right after your prompt, through the official `agent/pre-step` hook. Like every other context plugin it lands in the session log, so you can inspect it in the Trajectory view.
|
|
35
|
+
- **Protocol section.** While annotations are pending, a short system-prompt section explains the five marks and the confirmation rule.
|
|
36
|
+
- **Confirmation signal.** The model calls the `annotations` tool (`action: resolve`, optional `ids`) when done. Confirmed marks stop being injected and show as "handled by the assistant"; unconfirmed ones come back next turn, up to `maxInjections` (default 3) before they settle automatically.
|
|
37
|
+
- **Long-term preferences.** "Keep as habit" prefills a distillation request. The model reviews the marks and calls `annotations` with `action: distill`, which writes one-sentence preferences into a managed block of `$DSH_HOME/AGENTS.md` (`<!-- dsh-mindmark:start -->` … `<!-- dsh-mindmark:end -->`; everything outside the block is preserved). The official workspace-instructions plugin feeds that file to every new session. `lessons` lists, `forget` removes; the panel can remove too.
|
|
38
|
+
|
|
39
|
+
## Install
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
dsh plugin --profile web add dsh-mindmark
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Or in the Harness plugin page → **Add plugin** → `dsh-mindmark`; for local development use `link:<absolute path>`. A Client-side change needs a Harness restart.
|
|
46
|
+
|
|
47
|
+
Options in `cordis.patch.yml`:
|
|
48
|
+
|
|
49
|
+
| Field | Default | Meaning |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| `defaultMode` | `brief` | Injection view for new sessions (`brief` / `full`); the composer switch overrides it per session |
|
|
52
|
+
| `maxInjections` | `3` | How many turns an unconfirmed mark is re-sent before it settles |
|
|
53
|
+
|
|
54
|
+
## Layout
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
dsh-mindmark/
|
|
58
|
+
├── package.json # dsh.bundle.patch + dsh.client(platform: web)
|
|
59
|
+
├── cordis.patch.yml # one profile row (defaultMode / maxInjections)
|
|
60
|
+
├── index.js # Host: HTTP route, annotations tool, pre-step injection, protocol section
|
|
61
|
+
├── src/store.js # annotation persistence (state, injection counters, per-session mode, message capture)
|
|
62
|
+
├── src/inject.js # injection text: brief view / full revision view
|
|
63
|
+
├── src/lessons.js # long-term preferences: the managed AGENTS.md block
|
|
64
|
+
├── client.js # Client: selection bar, mode switch, panel, CSS highlight painting
|
|
65
|
+
├── locale/{en,zh}.json # plugin-page name and description
|
|
66
|
+
└── test/ # node:test suites (store, HTTP, injection, listener, lessons)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Design notes
|
|
70
|
+
|
|
71
|
+
- **Selection UX reuses the official seam.** The plugin registers into `conversation.chat.text-interaction` (taking over the built-in Quote surface while keeping the Quote action), so the Chat view positions the bar and keeps it attached while scrolling.
|
|
72
|
+
- **No dependency on host DOM structure.** Each mark stores the selected text, surrounding context and the scroll container's CSS path, and is re-anchored by scoring every occurrence of the quote; message-level offsets and the full message text are captured from the official `data-text-interaction-source` element for the full revision view.
|
|
73
|
+
- **Painting uses the CSS Custom Highlight API** with pending/handled colours per mark; no nodes are inserted into message DOM.
|
|
74
|
+
- **HTTP channel:** `/plugins/dsh-mindmark/annotations` (GET and POST: list / add / remove / clear / resolve / reopen / set-mode / forget-lesson).
|
|
75
|
+
- Annotations live in `$DSH_HOME/annotations/state.json`, grouped by session, independent of the session log.
|
|
76
|
+
- No `@deepseek-ai/*` imports, Node built-ins only, so the bundle loads straight from a linked directory.
|
|
77
|
+
|
|
78
|
+
## Limits
|
|
79
|
+
|
|
80
|
+
- Rewrite tells the model what you changed; the model's own history is left untouched by design.
|
|
81
|
+
- In full mode overlapping marks fall back to the brief list.
|
|
82
|
+
- Marks are painted only for messages currently rendered; virtualised messages re-anchor when scrolled back.
|
|
83
|
+
- Multi-agent sessions get no special handling: marks are stored per session.
|
|
84
|
+
- Message anchoring relies on the Chat view's `data-chat-node-key` attribute; if upstream renames it, the plugin degrades to text anchoring (affects full mode only).
|
|
85
|
+
|
|
86
|
+
## License
|
|
87
|
+
|
|
88
|
+
MIT
|
package/README.md
CHANGED
|
@@ -1,3 +1,100 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-mindmark · 思维标注
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**把你的想法直接标在回答上,让模型看见你怎么想。**
|
|
4
|
+
|
|
5
|
+
[English](README.en.md) | 中文
|
|
6
|
+
|
|
7
|
+
像在 Word 里一样,对助手的回答做**高亮 / 下划线 / 删除 / 批注 / 改写**。
|
|
8
|
+
你的标注会在下一轮作为上下文送给模型:它看到的不再只是自己的回答,而是「你修改后希望它理解的样子」;处理完后它会回传确认。
|
|
9
|
+
标注积累几条后,一键让模型把它们归纳成**长期偏好**,写进你的全局 `AGENTS.md`,新对话自动遵守。
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
## 用起来是什么样
|
|
14
|
+
|
|
15
|
+
1. 在任意一条回答里选中一段文字,Harness 自带的选区浮条会出现,里面是本插件的操作:
|
|
16
|
+
**引用 · 高亮 · 下划线 · 删除 · 批注 · 改写 · 清除标记**。
|
|
17
|
+
2. 高亮/下划线/删除点一下即生效;批注和改写会展开一个小输入框,写完按「确定」(或 Ctrl+Enter)。
|
|
18
|
+
3. 发下一条消息。模型会先按你的标注调整回答,再调用 `annotations` 工具确认「已处理」。
|
|
19
|
+
4. 输入框左侧有「标注注入」开关,可在**精简**和**完整**之间切换,并显示待处理数量:
|
|
20
|
+
- 精简:下一轮只发送被标注的段落和少量上下文;
|
|
21
|
+
- 完整:下一轮发送整条回答的修订视图(标记内嵌在原文里)。
|
|
22
|
+
5. 顶栏右上角的标注图标打开面板:看全部标注、状态(待处理 / 助手已处理 / 自动收起)、单条删除、
|
|
23
|
+
标为已处理、重新提交;底部「沉淀为习惯」让模型把标注归纳成长期偏好,面板里能看到并移除已沉淀的偏好。
|
|
24
|
+
|
|
25
|
+
## 五种标注对助手的含义
|
|
26
|
+
|
|
27
|
+
| 操作 | 含义 |
|
|
28
|
+
|---|---|
|
|
29
|
+
| 高亮 | 这是我要的:保留并强化这个方向 |
|
|
30
|
+
| 下划线 | 这里不够:展开、澄清或给出依据 |
|
|
31
|
+
| 删除 | 去掉:下一版不要再出现 |
|
|
32
|
+
| 批注 | 按批注内容处理,并逐条回应 |
|
|
33
|
+
| 改写 | 以用户改写后的文字为准 |
|
|
34
|
+
|
|
35
|
+
## 助手怎么「看到」并回应标注
|
|
36
|
+
|
|
37
|
+
- **步骤前注入**:每一轮开始时,Host 把当前对话里所有待处理的标注渲染成一条用户上下文消息,
|
|
38
|
+
紧跟在你的消息之后进入模型(走官方 `agent/pre-step` 钩子,像其它上下文插件一样落进会话日志,可在「轨迹」里看到)。
|
|
39
|
+
- **协议段落**:对话有待处理标注时,系统提示词里多一小段,解释五种标注的含义和确认方式。
|
|
40
|
+
- **回传信号**:助手处理完后调用 `annotations` 工具(`action: resolve`,可带 `ids`)确认;
|
|
41
|
+
已确认的标注不再注入,面板里显示「助手已处理」。没确认的会在下一轮再次出现,
|
|
42
|
+
连续 `maxInjections`(默认 3)轮未确认则自动收起,避免无限重发。
|
|
43
|
+
- **沉淀为长期偏好**:面板里的「沉淀为习惯」会把一条归纳请求填进输入框;模型回顾标注后调用
|
|
44
|
+
`annotations` 工具的 `distill` 动作,把每条一句的偏好写进 `$DSH_HOME/AGENTS.md` 的一个受管区块
|
|
45
|
+
(`<!-- dsh-mindmark:start -->` … `<!-- dsh-mindmark:end -->`,区块外内容原样保留)。
|
|
46
|
+
官方的工作区指令插件会把这个文件喂给每个新会话。`lessons` 列出、`forget` 移除;面板里也能逐条移除。
|
|
47
|
+
|
|
48
|
+
## 安装
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
dsh plugin --profile web add dsh-mindmark
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
或者在 Harness 的插件页 → **添加插件** → 填 `dsh-mindmark`;本地开发用 `link:<本目录绝对路径>`。
|
|
55
|
+
Client 半边改动后需要重启 Harness。
|
|
56
|
+
|
|
57
|
+
`cordis.patch.yml` 里可配:
|
|
58
|
+
|
|
59
|
+
| 字段 | 默认 | 说明 |
|
|
60
|
+
|---|---|---|
|
|
61
|
+
| `defaultMode` | `brief` | 新会话的注入模式(`brief` 精简 / `full` 完整),输入框开关按会话覆盖 |
|
|
62
|
+
| `maxInjections` | `3` | 一条未确认的标注最多重发几轮,超过自动收起 |
|
|
63
|
+
|
|
64
|
+
## 结构
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
dsh-mindmark/
|
|
68
|
+
├── package.json # dsh.bundle.patch + dsh.client(platform: web)
|
|
69
|
+
├── cordis.patch.yml # 往 profile 插件树插入一行(可配 defaultMode / maxInjections)
|
|
70
|
+
├── index.js # Host:HTTP 路由、annotations 工具、pre-step 注入、协议段落
|
|
71
|
+
├── src/store.js # 标注持久化(状态、注入计数、按会话的模式、消息全文捕获)
|
|
72
|
+
├── src/inject.js # 注入文本:精简视图 / 完整修订视图
|
|
73
|
+
├── src/lessons.js # 长期偏好:AGENTS.md 受管区块的读写
|
|
74
|
+
├── client.js # Client:选区浮条、模式开关、面板、CSS 高亮绘制
|
|
75
|
+
├── locale/{en,zh}.json # 插件管理页里的名称与描述
|
|
76
|
+
└── test/ # node:test 单测(store + HTTP + 注入 + 监听器 + lessons)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## 实现要点
|
|
80
|
+
|
|
81
|
+
- **选区交互复用官方机制**:注册 `conversation.chat.text-interaction` 槽位(接管内置「引用」的面板并保留引用按钮),
|
|
82
|
+
浮条由 Chat 视图自己定位、随滚动移动,不再自己监听鼠标。
|
|
83
|
+
- **不依赖宿主 DOM 结构**:标注记录选中原文 + 前后文 + 滚动容器 CSS 路径,恢复时按原文和前后文打分重新定位;
|
|
84
|
+
另外在消息正文(官方的 `data-text-interaction-source` 元素)里记录偏移并捕获全文,供完整模式渲染修订视图。
|
|
85
|
+
- **绘制用 CSS Custom Highlight API**,五种样式各有待处理/已处理两种颜色;不往消息 DOM 里插节点。
|
|
86
|
+
- **HTTP 通道**:`/plugins/dsh-mindmark/annotations`,GET 与 POST(list / add / remove / clear / resolve / reopen / set-mode / forget-lesson)。
|
|
87
|
+
- 标注存在 `$DSH_HOME/annotations/state.json`,按会话分组;与会话日志无关,删会话不会自动删标注。
|
|
88
|
+
- 不 import 任何 `@deepseek-ai/*` 包,只用 Node 内置模块,所以能从链接目录直接加载。
|
|
89
|
+
|
|
90
|
+
## 限制
|
|
91
|
+
|
|
92
|
+
- 改写只能让助手「知道你改成了什么」,助手看到的历史仍是它原来的回答;这是有意为之,不改会话日志。
|
|
93
|
+
- 完整模式按消息全文内嵌标记,重叠的标注会退回到精简列出。
|
|
94
|
+
- 标注只对当前渲染在页面里的消息绘制;长对话里被虚拟化滚出屏幕的消息,滚回来时重新定位。
|
|
95
|
+
- 多智能体场景未做特别处理:标注按会话存储,子会话各自独立。
|
|
96
|
+
- 消息锚定依赖 Chat 视图的 `data-chat-node-key` 属性;上游改名时退化为纯文本锚定(只影响完整模式)。
|
|
97
|
+
|
|
98
|
+
## 许可
|
|
99
|
+
|
|
100
|
+
MIT
|