dsh-notes-plugin 0.1.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/README.md ADDED
@@ -0,0 +1,128 @@
1
+ # dsh-notes
2
+
3
+ [![npm version](https://img.shields.io/npm/v/dsh-notes.svg)](https://www.npmjs.com/package/dsh-notes)
4
+ [![npm downloads](https://img.shields.io/npm/dw/dsh-notes.svg)](https://www.npmjs.com/package/dsh-notes)
5
+ [![node](https://img.shields.io/node/v/dsh-notes.svg)](https://www.npmjs.com/package/dsh-notes)
6
+ [![license](https://img.shields.io/npm/l/dsh-notes.svg)](https://github.com/PPawnsir/dsh-notes-plugin/blob/main/LICENSE)
7
+ ![category](https://img.shields.io/badge/awesome--dsh--plugin-workflow-blue)
8
+
9
+ DeepSeek Harness 会话感知本地笔记 —— 把会话里的决策与约定沉淀成本地 Markdown 笔记,自动注入系统提示、可派发给活跃会话执行。
10
+
11
+ ## 解决什么问题
12
+
13
+ Agent 会话里的结论是「一次性」的:一个方案为什么这么选、项目有哪些硬约定、下午冒出来的待办,全都散落在对话流里;上下文一压缩、会话一关,这些知识就没了。下一个会话的 agent 不知道上周定过什么,用户也得反复复述约定。
14
+
15
+ dsh-notes 把这件事变成可积累的本地资产:
16
+
17
+ | 问题 | 解法 |
18
+ | --- | --- |
19
+ | 结论聊完就丢 | 面板内 `Enter` 即存为本地 Markdown(`~/.dsh/notes`),选区文字一键摘录,永不出本机 |
20
+ | 笔记越记越乱 | LLM 异步识别主题并回填标题/分类,`kind`(笔记/决策/待办/链接/引用)与 `status`(进行中/置顶/已解决/已取代)两个正交维度管理 |
21
+ | agent 不知道约定 | 打开「⚡ 注入为约定」开关,笔记内容自动注入 Agent 系统提示(`order 130`),范围可选本工作区 / 全局 / 指定会话 |
22
+ | 待办没人执行 | 一键把待办派发给任意**活跃**会话(`Agent.send` 注入「召回上下文 + 具体要求」并唤醒对方开始工作),派发历史可标记完成 |
23
+ | 事后找不到 | 面板即时搜索 + 全文兜底并集检索、`note_search` 工具按 tag/topic/kind 过滤、归档按会话或标签合并、软删除可恢复 |
24
+
25
+ ## 安装
26
+
27
+ > 宿主要求:Node ≥ 22;DSH ≥ `0.1.5-rc.1`(已通过 `peerDependencies` 声明,含预发布分支的版本范围见 package.json)
28
+
29
+ ```sh
30
+ dsh plugin --profile web add dsh-notes
31
+ ```
32
+
33
+ 重启 DSH 后生效:会话头部出现「**智能笔记**」按钮(✎,带计数徽标),点击打开/关闭面板;桌面角落另有可拖拽的悬浮气泡入口。
34
+
35
+ ## 升级 / 卸载
36
+
37
+ ```sh
38
+ dsh plugin --profile web add dsh-notes@latest # 升级(重启 DSH)
39
+ dsh plugin --profile web remove dsh-notes # 卸载(不删数据)
40
+ ```
41
+
42
+ ## 功能清单
43
+
44
+ - **快速记录**:顶栏 `+` 图标(或 `Ctrl+N`)展开输入框,`Enter` 即存、`Shift+Enter` 换行;LLM 异步识别主题并回填标题,不阻塞交互
45
+ - **选区记录**:选中页面任意文字浮出「快速记录」按钮,一键存为 `quote` 类型笔记(也可在同一浮层写「备注」,由 LLM 提取标签/类型/注入意图)
46
+ - **同会话合并**:10 分钟窗口内的连续速记按时间戳自动合并成一条,避免碎片化
47
+ - **类型与状态**:`kind` = 笔记 / 决策 / 待办 / 链接 / 引用;`status` = 进行中 / 置顶 / 已解决 / 已取代(置顶单独分组,已解决降透明度)
48
+ - **约定注入**:详情区「⚡ 注入为约定」独立开关(不依赖标签),范围逐级浮层多选——本工作区 / 全局 / 勾选多个会话(会话按工作区分组、显示会话名,自动排除子 agent 与已归档会话)
49
+ - **任务派发**:待办一键派发到活跃会话或新建会话,可补充具体要求;派发记录(会话名/要求/时间/是否完成)落在笔记的 `dispatches` 字段里,正文不被污染;目标会话系统提示持续注入该待办直到标记完成
50
+ - **检索**:面板搜索框(本地即时过滤 + 250ms 防抖全文兜底,取并集)、kind 筛选 chips、`note_search` 工具
51
+ - **键盘流**:`Ctrl+K` 搜索、`Ctrl+N` 新建、`j/k`/`↑↓` 移动、`Enter` 打开、`Esc` 关闭(输入框内不抢键)
52
+ - **归档整理**:速记按会话合并、手动笔记按标签合并,原笔记软删除(`.bak` 备份)可恢复
53
+ - **Apple Notes 质感**:0 圆角列表项、纯背景选中、hover 才显操作、自动保存(底部提示「已自动保存 HH:MM」)、暗色模式适配
54
+ - **性能**:内存缓存(写入同步回填,列表命中零磁盘读)+ 正文按需加载 + 懒加载分页(每屏 50 条);面板位置/尺寸/列宽持久化到 `localStorage`
55
+
56
+ ## Agent 工具(3 个)
57
+
58
+ | 工具 | 作用 |
59
+ | --- | --- |
60
+ | `note_search` | 自由文本 + `tag` / `topic` / `kind` 过滤检索(返回瘦身列表,正文用 `note_get` 取) |
61
+ | `note_get` | 按 id 读完整正文 + 全部元数据(含派发历史) |
62
+ | `note_manage` | 单一入口 CRUD + 整理 + 派发:`create` / `list` / `update` / `delete` / `restore` / `archive` / `dispatch` |
63
+
64
+ `note_manage { action: 'dispatch', id, targetSessionId? }`:不传 `targetSessionId` 时返回当前活跃会话列表供选择,传了则把该待办注入目标会话并唤醒它开始工作。
65
+
66
+ ## 数据位置
67
+
68
+ 笔记是 `~/.dsh/notes/` 下的独立 Markdown 文件(YAML front-matter + 正文),**纯本地、不上传**;卸载插件不删数据。
69
+
70
+ ```
71
+ ~/.dsh/notes/
72
+ n-xxxxxxxx.md # 一条笔记 = 一个文件
73
+ n-xxxxxxxx.md.bak # 归档/覆盖时的备份
74
+ perf-report.json # 面板性能遥测(可随时删除)
75
+ ```
76
+
77
+ 首次启动若检测到旧的开发版笔记目录(`<repo>/notes/`),会**一次性复制**缺失的文件到 `~/.dsh/notes`(只复制、不删除,同名跳过)。
78
+
79
+ ```yaml
80
+ ---
81
+ id: n-xxxxxxxx
82
+ title: 标题
83
+ topic: 主题 # LLM 自动识别
84
+ workspace: 工作区名 # 取会话 cwd 目录名
85
+ tags: tag1, tag2
86
+ kind: note # note/decision/todo/link/quote
87
+ status: active # active/pinned/resolved/superseded
88
+ inject: false # 是否作为约定注入系统提示
89
+ injectTo: [] # 注入范围多选:[] = 本工作区 / [global] / [会话短id,...]
90
+ createdAt: ISO-8601
91
+ updatedAt: ISO-8601
92
+ sessionId: 来源会话
93
+ cwd: 来源工作目录
94
+ dispatches: [] # 派发历史(会话/要求/时间/done)
95
+ mergedFrom: [] # 归档合并来源 id
96
+ archivedAt: ""
97
+ deleted: "false" # 软删除标记
98
+ ---
99
+
100
+ 正文 Markdown
101
+ ```
102
+
103
+ 向后兼容:旧文件缺 `inject`/`kind`/`status`/`injectTo` 字段时自动兜底(无 `inject` 时回退按 `tags` 含 `convention` 判定)。
104
+
105
+ ## 权限与实现
106
+
107
+ - **Host 端**:`inject: ['fs', 'sandboxPolicy']`,只需笔记读写与写策略;`llm` / `agents` / `systemPrompt` / `sessionPersistence` / `workspaceRegistry` 均按需 `ctx.get` + 存在性守卫,缺失时对应功能降级(如无 LLM 时不自动分类)
108
+ - **Client 端**:`inject: ['slots']`,注册 4 个 Slot 注入点——会话头部按钮(`conversation.session.header.actions`,order 40)、悬浮气泡(`shell.overlay` 199)、浮窗面板(200)、选区捕获(201)
109
+ - **通信**:client 经 `fetch('/dsh-notes')` POST `{method, args}` 调用 host 的 RPC(19 个业务方法 + 1 个存活探测 `notes-ping`);样式经 `notes-css` 下发并注入 `<style>`,零外部运行时依赖
110
+
111
+ ## 源码与开发
112
+
113
+ - 仓库:<https://github.com/PPawnsir/dsh-notes-plugin>
114
+ - 本包(`packages/dsh-notes/`)由开发版 bootstrap 插件生成:`index.mjs` 为 host 端 ESM 静态包,`lib/client.js` 由 `scripts/build-dist.cjs` 从 `client-impl.js` 机械转换(带转换计数断言,漏改即中止)
115
+ - 回归测试(内存 mock,不触碰真实笔记):
116
+
117
+ ```sh
118
+ node scripts/build-dist.cjs # 改完 client-impl.js 后刷新 lib/client.js
119
+ node --check packages/dsh-notes/index.mjs
120
+ node --check packages/dsh-notes/lib/client.js
121
+ node check.js # 151 例回归(host 全链路 + 静态包 + client UI 面)
122
+ ```
123
+
124
+ 详见 [DEVELOPMENT.md](https://github.com/PPawnsir/dsh-notes-plugin/blob/main/DEVELOPMENT.md) 与 [tests/e2e.md](https://github.com/PPawnsir/dsh-notes-plugin/blob/main/tests/e2e.md)。
125
+
126
+ ## License
127
+
128
+ MIT
@@ -0,0 +1,5 @@
1
+ # dsh-notes-plugin bundle patch: inserts the plugin row into the web composition.
2
+ # Install with `dsh plugin --profile <name> add <path>`.
3
+ - insert:
4
+ - id: notes
5
+ name: dsh-notes-plugin