dsh-memory-eternal 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/LICENSE +21 -0
- package/PUBLISH.md +100 -0
- package/README.md +148 -0
- package/assets/preview.html +139 -0
- package/assets/screen/memory-preview.html +139 -0
- package/assets/screen/memory-preview.png +0 -0
- package/cordis.patch.yml +15 -0
- package/docs/ARCHITECTURE.md +87 -0
- package/index.js +283 -0
- package/lib/capture.js +221 -0
- package/lib/client.js +47 -0
- package/lib/vault.js +386 -0
- package/package.json +82 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 EternalNight996
|
|
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/PUBLISH.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# 发布到插件市场(npm + GitHub)指南
|
|
2
|
+
|
|
3
|
+
参考 [dsh-ui-three-body](https://github.com/EternalNight996/dsh-ui-three-body) 的发布范式与 [dsh-market](https://github.com/dsh-market/dsh-market) 的收录机制整理。本插件已按该范式配置好,按下面顺序走即可。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 0. 先看懂:插件是怎么被「发现」的
|
|
8
|
+
|
|
9
|
+
DSH 插件市场(`dshmarket`)不是人工审核制,而是**自动同步**两类来源:
|
|
10
|
+
|
|
11
|
+
1. **npm 包**:`keywords` 里带 `dsh-plugin` 的包(市场优先用 npm tarball 安装,快)。
|
|
12
|
+
2. **GitHub 仓库**:打了 `dsh-plugin` topic 的仓库(提供 README、截图、star 数、五维评分素材)。
|
|
13
|
+
|
|
14
|
+
所以「上传到插件市场」= ① 推 GitHub 并打 `dsh-plugin` topic + ② 发 npm。两条都做,收录与安装体验最好。
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 1. 配置核对
|
|
19
|
+
|
|
20
|
+
本插件 `package.json` 已具备市场收录所需字段:
|
|
21
|
+
|
|
22
|
+
- `name: dsh-memory-eternal`(npm 包名,全小写唯一)
|
|
23
|
+
- `main: index.js`(host 半边入口)
|
|
24
|
+
- `exports` 含 `./client`(client 半边,`dsh.client` 靠它自动挂载)与 `./cordis.patch.yml`(bundle 补丁层)
|
|
25
|
+
- `files` 白名单:`index.js`, `lib`, `assets`, `docs`, `cordis.patch.yml`, `README.md`, `PUBLISH.md`, `LICENSE`
|
|
26
|
+
- `keywords` 含 **`dsh-plugin`**(市场收录关键)+ `deepseek-harness`、`dsh` 等
|
|
27
|
+
- `dsh.client`:platform web + 显式 inject 列表
|
|
28
|
+
- `dsh.bundle.patch`:指向 `cordis.patch.yml`(host 行自动挂载)
|
|
29
|
+
- `scripts.prepublishOnly`:发布前自动重构建 client
|
|
30
|
+
|
|
31
|
+
## 2. 本地先验证(发布前必做)
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm i
|
|
35
|
+
npm test # 29 个单测全绿
|
|
36
|
+
npm run build # 生成 lib/client.js
|
|
37
|
+
|
|
38
|
+
# 装进当前 profile 试跑
|
|
39
|
+
npx @deepseek-ai/dsh plugin --profile web add F:/absolute/path/to/dsh-memory-eternal
|
|
40
|
+
# 重启 dsh web → 设置 → 记忆:看到知识库页面
|
|
41
|
+
# 聊几轮 → ~/.dsh/memory-vault/03-Knowledge/ 出现自动沉淀的知识卡
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## 3. 上传 GitHub
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
cd dsh-memory-eternal
|
|
48
|
+
git init
|
|
49
|
+
git add .
|
|
50
|
+
git commit -m "feat: 记忆核心(Memory Core)DSH 插件 v0.1.0 —— 对话自动沉淀 + 图形化知识库"
|
|
51
|
+
|
|
52
|
+
# 在 GitHub 网页上先建空仓库 dsh-memory-eternal,然后:
|
|
53
|
+
git remote add origin https://github.com/<你的用户名>/dsh-memory-eternal.git
|
|
54
|
+
git branch -M main
|
|
55
|
+
git push -u origin main
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**关键一步**:在 GitHub 仓库页 → ⚙️ Settings → Topics,添加 `dsh-plugin`(再加 `deepseek-harness`、`memory`、`knowledge-graph` 等)。这是市场自动收录 GitHub 源的识别标志。
|
|
59
|
+
|
|
60
|
+
> README 里的截图放 `assets/screen/` 并在 README 引用(市场会自动从 README 提取截图)。
|
|
61
|
+
|
|
62
|
+
## 4. 上传 npm
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npm login # 首次:输入 npm 账号(去 npmjs.com 注册)
|
|
66
|
+
npm publish # 触发 prepublishOnly 自动 build,然后发布
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
发布成功后:
|
|
70
|
+
|
|
71
|
+
- npm 地址:`https://www.npmjs.com/package/dsh-memory-eternal`
|
|
72
|
+
- 用户可一条命令安装:`npx @deepseek-ai/dsh plugin --profile web add dsh-memory-eternal`
|
|
73
|
+
|
|
74
|
+
常见坑:
|
|
75
|
+
|
|
76
|
+
- **包名被占**:`npm publish` 报 `403 Forbidden` 通常是名字冲突,改个名字。
|
|
77
|
+
- **未构建就发布**:`prepublishOnly` 已兜底重构建 client,别删这行。
|
|
78
|
+
- **`.npmignore`**:本项目用 `files` 白名单,比 `.npmignore` 更省心,别两个都写。
|
|
79
|
+
|
|
80
|
+
## 5. 进入插件市场(收录)
|
|
81
|
+
|
|
82
|
+
发布 npm + 打 GitHub topic 后,市场 registry 会周期性同步。若想主动加速/确认收录,可到 [dsh-market](https://github.com/2BingLing/dsh-market) 或 [dsh-plugin-marketplace](https://github.com/AwesomeHou/dsh-plugin-marketplace) 的收录入口提交。
|
|
83
|
+
|
|
84
|
+
五维评分靠 README 质量:**用途一句话 + 真实截图 + 安装命令 + 目录结构 + 待办**(本插件 README 已按此结构写好)。
|
|
85
|
+
|
|
86
|
+
## 6. 更新版本
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npm version patch # 0.1.0 → 0.1.1(自动改 package.json + git tag)
|
|
90
|
+
npm publish # 重新发布
|
|
91
|
+
git push --follow-tags # 同步 tag 到 GitHub
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## 一句话总览
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
本地验证 → GitHub 建仓打 dsh-plugin topic → npm login + npm publish → 市场自动收录
|
|
100
|
+
```
|
package/README.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# 记忆核心(dsh-memory-eternal)
|
|
2
|
+
|
|
3
|
+
> 🧠 **给 DeepSeek Harness 装上「第二大脑」**:把 [boujoy-harness](https://github.com/asen-goat-mine/boujoy-harness) 的记忆模块搬进任意 DSH——对话结束后**自动**把值得长期复用的内容压缩成知识卡,写入本地 Markdown Vault(去重、可检索、可 git 管理);设置页提供**图形化知识库**:统计概览、CJK 检索、知识卡网格、**知识图谱**。Agent 通过 `memory_recall` 工具按需召回历史上下文。**一条命令安装,零人工干预,不改 dsh 源码。**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<img src="assets/screen/memory-preview.png" width="720" alt="记忆核心设置页:统计 + 搜索 + 知识卡 + 知识图谱" />
|
|
9
|
+
<br/>
|
|
10
|
+
<em>设置 → 记忆:左侧统计概览,中部知识卡网格(kind 筛选 + 检索),右侧知识图谱(节点=卡片,连线=[[链接]]/共享标签)</em>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## ✨ 为什么值得装
|
|
16
|
+
|
|
17
|
+
| 亮点 | 说明 |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| 🤖 **全自动沉淀** | 每轮对话结束自动触发(监听 `agent/turn-stopping`),模型判定「是否值得保存」并压缩成 300-800 字知识卡——**无需任何手动操作** |
|
|
20
|
+
| 📚 **本地 Markdown Vault** | 知识卡是带 frontmatter 的普通 `.md` 文件,默认落在 `~/.dsh/memory-vault`,可手动编辑、可 git 版本管理、可被任何工具读取,不锁进私有数据库 |
|
|
21
|
+
| 🚫 **智能去重** | 双层去重:词法 Jaccard bigram(0.62 阈值,移植 boujoy)+ **语义去重**(把已有卡片索引喂给模型,由模型决定「新建 vs 追加到已有卡」,对 LLM 改写免疫) |
|
|
22
|
+
| 🔍 **CJK 感知检索** | 中文整词 + 字符 bigram 命中,短查询「强化学习」「蒸馏」也能在长文里命中,无需全文搜索引擎 |
|
|
23
|
+
| 🕸 **知识图谱** | 卡片间的 `[[wikilink]]` 与共享标签自动连线,SVG 图谱点击节点直达卡片阅读 |
|
|
24
|
+
| 🧠 **自动召回** | 注入 system prompt 告知 Agent 它拥有记忆核心,并注册 `memory_recall` 工具——需要项目背景/历史决策/领域知识时自动检索 |
|
|
25
|
+
| 🔒 **本地优先** | 所有内容留在你的本机 Vault;不设遥测、不传云端。模型请求仍走你已配置好的 provider |
|
|
26
|
+
| ⚙️ **一键安装** | 与 `dsh-ui-three-body` 同款插件机制,`npx @deepseek-ai/dsh plugin add dsh-memory-eternal` 即可 |
|
|
27
|
+
|
|
28
|
+
**适合**:想要让 DSH 记住项目背景与历史决策的人 / 想给对话沉淀可检索知识库的人 / Obsidian 式 Markdown Vault 爱好者 / 在意数据归属(本地文件 > 云端数据库)的人。
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 🚀 安装
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# 已发布后(npm)
|
|
36
|
+
npx @deepseek-ai/dsh plugin --profile web add dsh-memory-eternal
|
|
37
|
+
|
|
38
|
+
# 从 GitHub
|
|
39
|
+
npx @deepseek-ai/dsh plugin --profile web add github:EternalNight996/dsh-memory-eternal
|
|
40
|
+
|
|
41
|
+
# 本地联调(link 本地目录,改代码即时生效)
|
|
42
|
+
npx @deepseek-ai/dsh plugin --profile web add F:/MyApp/eternal/dsh-memory-eternal
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
装完**重启 dsh web**:设置 → 记忆 出现知识库页面;此后每轮对话自动沉淀知识卡。
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 🧠 自动沉淀(零人工干预)
|
|
50
|
+
|
|
51
|
+
对话每轮结束 → 插件提取增量消息 → 调用当前模型压缩 → 双层去重 → 写入 Vault:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
你的对话
|
|
55
|
+
│
|
|
56
|
+
▼
|
|
57
|
+
agent/turn-stopping ──► 提取本轮 user/assistant 消息
|
|
58
|
+
│
|
|
59
|
+
▼
|
|
60
|
+
LLM 判定(值得保存?)──否──► 丢弃
|
|
61
|
+
│是
|
|
62
|
+
▼
|
|
63
|
+
语义去重(喂给模型已有卡片索引)
|
|
64
|
+
├─ 同一主题 ──► append_to:追加「更新记录」到已有卡(不建重复卡)
|
|
65
|
+
└─ 新主题 ────► 写新知识卡到 02-06 对应目录
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
知识卡格式(frontmatter + markdown 正文):
|
|
69
|
+
|
|
70
|
+
```markdown
|
|
71
|
+
---
|
|
72
|
+
kind: knowledge
|
|
73
|
+
title: 数据库索引原理与B+树加速机制
|
|
74
|
+
tags: [数据库, 索引, B+树, 查询优化]
|
|
75
|
+
created: 2026-08-21T12:01:51.636Z
|
|
76
|
+
updated: 2026-08-21T12:01:51.636Z
|
|
77
|
+
source: session:session-xxxx
|
|
78
|
+
---
|
|
79
|
+
# 数据库索引原理与B+树加速机制
|
|
80
|
+
|
|
81
|
+
## 核心定义
|
|
82
|
+
- 索引是数据库为加速查找而额外维护的数据结构...
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Vault 目录结构(与 boujoy 一致):
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
~/.dsh/memory-vault/
|
|
89
|
+
├── 00-System/ # 系统(未来扩展:Active-Context 等)
|
|
90
|
+
├── 02-Projects/ # 项目背景 / 进度
|
|
91
|
+
├── 03-Knowledge/ # 通用知识 / 技术方案 / 设计决策(默认)
|
|
92
|
+
├── 04-Content/ # 内容素材 / 资料
|
|
93
|
+
├── 05-Prompts/ # 提示词 / 工作流
|
|
94
|
+
└── 06-Business/ # 业务 / 商业
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## 🕸 图形化知识库(设置 → 记忆)
|
|
98
|
+
|
|
99
|
+
- **统计概览**:总卡数、近 7 天新增、标签数、知识卡数
|
|
100
|
+
- **检索**:中文片段即时搜索(280ms 防抖)
|
|
101
|
+
- **知识卡网格**:kind 筛选(全部/项目/知识/内容/提示词/业务),点击卡片阅读全文(frontmatter 一并展示)
|
|
102
|
+
- **知识图谱**:节点 = 知识卡(按 kind 着色分区),连线 = `[[wikilink]]` 或共享标签;点击节点直达卡片
|
|
103
|
+
|
|
104
|
+
## 🔧 设置
|
|
105
|
+
|
|
106
|
+
| 设置项 | 默认 | 说明 |
|
|
107
|
+
| --- | --- | --- |
|
|
108
|
+
| 启用 | 开 | 总开关 |
|
|
109
|
+
| 自动沉淀 | 开 | 每轮对话结束自动捕获 |
|
|
110
|
+
| 自动召回 | 开 | 注入 system prompt + `memory_recall` 工具 |
|
|
111
|
+
| 记忆库目录 | 空 | 留空 = `~/.dsh/memory-vault`;可指向任意目录(如 Obsidian Vault) |
|
|
112
|
+
| 去重阈值 | 0.62 | 词法去重 Jaccard 相似度阈值(与 boujoy 一致) |
|
|
113
|
+
| 捕获最小长度 | 200 | 少于该字符数的对话不触发捕获 |
|
|
114
|
+
| 日配额 | 60 | 每天最多自动写卡数,防止烧 token |
|
|
115
|
+
|
|
116
|
+
## 🛠 开发 / 构建 / 测试
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
npm i
|
|
120
|
+
npm test # 29 个单元测试:vault 去重/检索/图谱 + capture 管线 + API 形状
|
|
121
|
+
npm run build # 打包 client(改 src/client 后需要;改 index.js / lib 无需构建)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
目录结构:
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
dsh-memory-eternal/
|
|
128
|
+
├── index.js # host 半边:设置 + turn-stopping 钩子 + 工具 + JSON API
|
|
129
|
+
├── lib/
|
|
130
|
+
│ ├── vault.js # Markdown Vault 存储层(frontmatter/去重/检索/图谱,纯 Node 可单测)
|
|
131
|
+
│ └── capture.js # 自动沉淀管线(LLM 压缩 + 语义去重)
|
|
132
|
+
├── src/client/index.tsx # client 半边:设置页(统计/搜索/卡片/图谱)
|
|
133
|
+
├── build.mjs # esbuild 打包 client → lib/client.js
|
|
134
|
+
├── cordis.patch.yml # bundle 补丁层(自动挂载 host 行)
|
|
135
|
+
└── tests/ # node:test 单测
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## 📦 发布记录
|
|
139
|
+
|
|
140
|
+
- **v0.1.0**:首个可用版本。自动沉淀(turn-stopping 钩子 + LLM 压缩 + 双层去重)、`memory_recall` 工具、system prompt 召回段、Markdown Vault(02-06 分类 + frontmatter)、CJK 检索、知识图谱、设置页图形化知识库。
|
|
141
|
+
|
|
142
|
+
## 📄 License
|
|
143
|
+
|
|
144
|
+
MIT
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
> 让 DSH 拥有第二大脑:**对话自动沉淀,知识随手可查。** 🧠
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="zh">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>记忆核心预览</title>
|
|
6
|
+
<style>
|
|
7
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
8
|
+
body { font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; background: #f5f6f8; color: #1f2937; padding: 32px; }
|
|
9
|
+
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 18px 20px; }
|
|
10
|
+
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
|
|
11
|
+
.stat { text-align: center; }
|
|
12
|
+
.stat b { display: block; font-size: 26px; }
|
|
13
|
+
.stat span { font-size: 12px; color: #6b7280; }
|
|
14
|
+
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
|
|
15
|
+
.toolbar input { flex: 1; padding: 8px 12px; border-radius: 8px; border: 1px solid #d1d5db; font-size: 13px; }
|
|
16
|
+
.btn { border: 1px solid #d1d5db; background: #fff; border-radius: 8px; padding: 7px 14px; font-size: 12px; cursor: pointer; }
|
|
17
|
+
.chips { display: flex; gap: 6px; margin-bottom: 14px; }
|
|
18
|
+
.chip { border: 1px solid #d1d5db; background: #fff; border-radius: 999px; padding: 4px 12px; font-size: 12px; color: #6b7280; }
|
|
19
|
+
.chip.active { color: #111; font-weight: 600; border-color: #111; }
|
|
20
|
+
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
|
|
21
|
+
.kcard { border: 1px solid #e5e7eb; border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; background: #fff; cursor: pointer; }
|
|
22
|
+
.kcard h4 { font-size: 14px; }
|
|
23
|
+
.kcard p { font-size: 12px; color: #6b7280; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
|
|
24
|
+
.kcard footer { margin-top: auto; display: flex; justify-content: space-between; font-size: 11px; color: #9ca3af; }
|
|
25
|
+
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
|
|
26
|
+
.tags { display: flex; gap: 4px; }
|
|
27
|
+
.tag { font-size: 10px; padding: 1px 7px; border-radius: 999px; background: #f3f4f6; color: #6b7280; }
|
|
28
|
+
.title { font-size: 20px; font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 10px; }
|
|
29
|
+
.subtitle { font-size: 12px; color: #6b7280; margin-bottom: 18px; }
|
|
30
|
+
.wrap { max-width: 980px; margin: 0 auto; }
|
|
31
|
+
.layout { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: stretch; }
|
|
32
|
+
.graph-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 14px; }
|
|
33
|
+
.graph-card h3 { font-size: 13px; margin-bottom: 8px; color: #374151; }
|
|
34
|
+
</style>
|
|
35
|
+
</head>
|
|
36
|
+
<body>
|
|
37
|
+
<div class="wrap">
|
|
38
|
+
<div class="title">🧠 记忆核心 <span style="font-size:13px;color:#6b7280;font-weight:400">Memory Core · 设置 → 记忆</span></div>
|
|
39
|
+
<div class="subtitle">对话自动沉淀知识卡到本地 Markdown Vault · 双层去重 · CJK 检索 · 知识图谱</div>
|
|
40
|
+
|
|
41
|
+
<div class="card" style="margin-bottom:14px">
|
|
42
|
+
<div class="stats">
|
|
43
|
+
<div class="stat"><b style="color:#3b82f6">42</b><span>知识卡</span></div>
|
|
44
|
+
<div class="stat"><b style="color:#22c55e">9</b><span>近 7 天新增</span></div>
|
|
45
|
+
<div class="stat"><b style="color:#eab308">31</b><span>标签</span></div>
|
|
46
|
+
<div class="stat"><b style="color:#8b5cf6">3</b><span>项目</span></div>
|
|
47
|
+
</div>
|
|
48
|
+
<div class="toolbar">
|
|
49
|
+
<input type="text" placeholder="搜索记忆(支持中文片段)…" value="B+树 索引">
|
|
50
|
+
<button class="btn">搜索</button>
|
|
51
|
+
<button class="btn">刷新</button>
|
|
52
|
+
<button class="btn" style="background:#111;color:#fff;border-color:#111">🕸 知识图谱</button>
|
|
53
|
+
</div>
|
|
54
|
+
<div class="chips">
|
|
55
|
+
<button class="chip active">全部</button>
|
|
56
|
+
<button class="chip">项目</button>
|
|
57
|
+
<button class="chip">知识</button>
|
|
58
|
+
<button class="chip">内容</button>
|
|
59
|
+
<button class="chip">提示词</button>
|
|
60
|
+
<button class="chip">业务</button>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<div class="layout">
|
|
65
|
+
<div>
|
|
66
|
+
<div class="grid">
|
|
67
|
+
<div class="kcard">
|
|
68
|
+
<h4><span class="dot" style="background:#22c55e"></span>数据库索引原理与B+树加速机制</h4>
|
|
69
|
+
<p>索引是数据库为加速查找而额外维护的数据结构…复杂度从 O(n) 降到 O(log n),一次查询只需 3~4 次磁盘 I/O。</p>
|
|
70
|
+
<div class="tags"><span class="tag">数据库</span><span class="tag">索引</span><span class="tag">B+树</span><span class="tag">查询优化</span></div>
|
|
71
|
+
<footer><span>知识</span><span>08-21 20:04</span></footer>
|
|
72
|
+
</div>
|
|
73
|
+
<div class="kcard">
|
|
74
|
+
<h4><span class="dot" style="background:#22c55e"></span>B+树磁盘IO模型与覆盖索引回表优化</h4>
|
|
75
|
+
<p>磁盘随机读 5-10ms,内存纳秒级,相差 5-6 个数量级;覆盖索引避免回表,范围查询顺序读相邻叶子…</p>
|
|
76
|
+
<div class="tags"><span class="tag">MySQL</span><span class="tag">B+树</span><span class="tag">覆盖索引</span></div>
|
|
77
|
+
<footer><span>知识</span><span>08-21 20:06</span></footer>
|
|
78
|
+
</div>
|
|
79
|
+
<div class="kcard">
|
|
80
|
+
<h4><span class="dot" style="background:#3b82f6"></span>项目极光 · 技术选型</h4>
|
|
81
|
+
<p>项目代号:极光(Aurora)。数据库最终选用 PostgreSQL;前端用 Vite 构建。迁移成本可控…</p>
|
|
82
|
+
<div class="tags"><span class="tag">项目</span><span class="tag">PostgreSQL</span></div>
|
|
83
|
+
<footer><span>项目</span><span>08-21 19:59</span></footer>
|
|
84
|
+
</div>
|
|
85
|
+
<div class="kcard">
|
|
86
|
+
<h4><span class="dot" style="background:#22c55e"></span>Redis 缓存策略:TTL与雪崩防护</h4>
|
|
87
|
+
<p>缓存热点数据 TTL 10 分钟,穿透用空值缓存,随机过期防雪崩,大 key 分段缓存降低序列化开销…</p>
|
|
88
|
+
<div class="tags"><span class="tag">Redis</span><span class="tag">缓存</span></div>
|
|
89
|
+
<footer><span>知识</span><span>08-21 18:30</span></footer>
|
|
90
|
+
</div>
|
|
91
|
+
<div class="kcard">
|
|
92
|
+
<h4><span class="dot" style="background:#06b6d4"></span>DSH 插件发布范式(PUBLISH 工作流)</h4>
|
|
93
|
+
<p>npm keywords 带 dsh-plugin + GitHub 打 topic → 市场自动收录;prepublishOnly 自动 build client…</p>
|
|
94
|
+
<div class="tags"><span class="tag">DSH</span><span class="tag">插件</span></div>
|
|
95
|
+
<footer><span>提示词</span><span>08-20 22:11</span></footer>
|
|
96
|
+
</div>
|
|
97
|
+
<div class="kcard">
|
|
98
|
+
<h4><span class="dot" style="background:#f43f5e"></span>知识图谱可视化方案</h4>
|
|
99
|
+
<p>SVG 圆形布局按 kind 分区着色;wikilink 与共享标签连线;点击节点打开卡片阅读全文…</p>
|
|
100
|
+
<div class="tags"><span class="tag">可视化</span><span class="tag">图谱</span></div>
|
|
101
|
+
<footer><span>内容</span><span>08-19 15:02</span></footer>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
<div class="graph-card">
|
|
106
|
+
<h3>🕸 知识图谱 · 12 节点 · 9 连线</h3>
|
|
107
|
+
<svg viewBox="0 0 440 380" width="100%" role="img">
|
|
108
|
+
<defs>
|
|
109
|
+
<marker id="arrow" markerWidth="6" markerHeight="6" refX="5" refY="3" orient="auto"><path d="M0,0 L6,3 L0,6 Z" fill="#d1d5db"/></marker>
|
|
110
|
+
</defs>
|
|
111
|
+
<!-- edges -->
|
|
112
|
+
<line x1="220" y1="60" x2="90" y2="180" stroke="#d1d5db" stroke-width="1.2"/>
|
|
113
|
+
<line x1="220" y1="60" x2="350" y2="180" stroke="#d1d5db" stroke-width="1.2"/>
|
|
114
|
+
<line x1="90" y1="180" x2="220" y2="300" stroke="#d1d5db" stroke-width="1.2" stroke-dasharray="4 3"/>
|
|
115
|
+
<line x1="350" y1="180" x2="220" y2="300" stroke="#d1d5db" stroke-width="1.2"/>
|
|
116
|
+
<line x1="90" y1="180" x2="40" y2="300" stroke="#d1d5db" stroke-width="1.2" stroke-dasharray="4 3"/>
|
|
117
|
+
<line x1="350" y1="180" x2="400" y2="300" stroke="#d1d5db" stroke-width="1.2" stroke-dasharray="4 3"/>
|
|
118
|
+
<line x1="220" y1="300" x2="40" y2="300" stroke="#d1d5db" stroke-width="1" stroke-dasharray="2 3"/>
|
|
119
|
+
<line x1="220" y1="300" x2="400" y2="300" stroke="#d1d5db" stroke-width="1" stroke-dasharray="2 3"/>
|
|
120
|
+
<!-- nodes -->
|
|
121
|
+
<g transform="translate(220 60)"><circle r="11" fill="#22c55e"/><text x="15" y="4" font-size="11" fill="#374151">数据库索引原理</text></g>
|
|
122
|
+
<g transform="translate(90 180)"><circle r="9" fill="#22c55e"/><text x="13" y="3" font-size="10" fill="#374151">B+树IO模型</text></g>
|
|
123
|
+
<g transform="translate(350 180)"><circle r="9" fill="#22c55e"/><text x="-60" y="-8" font-size="10" fill="#374151">Redis缓存策略</text></g>
|
|
124
|
+
<g transform="translate(220 300)"><circle r="12" fill="#3b82f6"/><text x="16" y="4" font-size="11" fill="#374151">项目极光</text></g>
|
|
125
|
+
<g transform="translate(40 300)"><circle r="8" fill="#06b6d4"/><text x="12" y="3" font-size="10" fill="#374151">发布范式</text></g>
|
|
126
|
+
<g transform="translate(400 300)"><circle r="8" fill="#f43f5e"/><text x="-52" y="-10" font-size="10" fill="#374151">图谱方案</text></g>
|
|
127
|
+
</svg>
|
|
128
|
+
<div style="display:flex;gap:10px;flex-wrap:wrap;font-size:11px;color:#6b7280;margin-top:6px">
|
|
129
|
+
<span><span class="dot" style="background:#3b82f6"></span>项目</span>
|
|
130
|
+
<span><span class="dot" style="background:#22c55e"></span>知识</span>
|
|
131
|
+
<span><span class="dot" style="background:#f43f5e"></span>内容</span>
|
|
132
|
+
<span><span class="dot" style="background:#06b6d4"></span>提示词</span>
|
|
133
|
+
<span style="opacity:.7">连线=[[链接]]或共享标签 · 点击节点阅读卡片</span>
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
</body>
|
|
139
|
+
</html>
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="zh">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>记忆核心预览</title>
|
|
6
|
+
<style>
|
|
7
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
8
|
+
body { font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; background: #f5f6f8; color: #1f2937; padding: 32px; }
|
|
9
|
+
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 18px 20px; }
|
|
10
|
+
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
|
|
11
|
+
.stat { text-align: center; }
|
|
12
|
+
.stat b { display: block; font-size: 26px; }
|
|
13
|
+
.stat span { font-size: 12px; color: #6b7280; }
|
|
14
|
+
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
|
|
15
|
+
.toolbar input { flex: 1; padding: 8px 12px; border-radius: 8px; border: 1px solid #d1d5db; font-size: 13px; }
|
|
16
|
+
.btn { border: 1px solid #d1d5db; background: #fff; border-radius: 8px; padding: 7px 14px; font-size: 12px; cursor: pointer; }
|
|
17
|
+
.chips { display: flex; gap: 6px; margin-bottom: 14px; }
|
|
18
|
+
.chip { border: 1px solid #d1d5db; background: #fff; border-radius: 999px; padding: 4px 12px; font-size: 12px; color: #6b7280; }
|
|
19
|
+
.chip.active { color: #111; font-weight: 600; border-color: #111; }
|
|
20
|
+
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
|
|
21
|
+
.kcard { border: 1px solid #e5e7eb; border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; background: #fff; cursor: pointer; }
|
|
22
|
+
.kcard h4 { font-size: 14px; }
|
|
23
|
+
.kcard p { font-size: 12px; color: #6b7280; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
|
|
24
|
+
.kcard footer { margin-top: auto; display: flex; justify-content: space-between; font-size: 11px; color: #9ca3af; }
|
|
25
|
+
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
|
|
26
|
+
.tags { display: flex; gap: 4px; }
|
|
27
|
+
.tag { font-size: 10px; padding: 1px 7px; border-radius: 999px; background: #f3f4f6; color: #6b7280; }
|
|
28
|
+
.title { font-size: 20px; font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 10px; }
|
|
29
|
+
.subtitle { font-size: 12px; color: #6b7280; margin-bottom: 18px; }
|
|
30
|
+
.wrap { max-width: 980px; margin: 0 auto; }
|
|
31
|
+
.layout { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: stretch; }
|
|
32
|
+
.graph-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 14px; }
|
|
33
|
+
.graph-card h3 { font-size: 13px; margin-bottom: 8px; color: #374151; }
|
|
34
|
+
</style>
|
|
35
|
+
</head>
|
|
36
|
+
<body>
|
|
37
|
+
<div class="wrap">
|
|
38
|
+
<div class="title">🧠 记忆核心 <span style="font-size:13px;color:#6b7280;font-weight:400">Memory Core · 设置 → 记忆</span></div>
|
|
39
|
+
<div class="subtitle">对话自动沉淀知识卡到本地 Markdown Vault · 双层去重 · CJK 检索 · 知识图谱</div>
|
|
40
|
+
|
|
41
|
+
<div class="card" style="margin-bottom:14px">
|
|
42
|
+
<div class="stats">
|
|
43
|
+
<div class="stat"><b style="color:#3b82f6">42</b><span>知识卡</span></div>
|
|
44
|
+
<div class="stat"><b style="color:#22c55e">9</b><span>近 7 天新增</span></div>
|
|
45
|
+
<div class="stat"><b style="color:#eab308">31</b><span>标签</span></div>
|
|
46
|
+
<div class="stat"><b style="color:#8b5cf6">3</b><span>项目</span></div>
|
|
47
|
+
</div>
|
|
48
|
+
<div class="toolbar">
|
|
49
|
+
<input type="text" placeholder="搜索记忆(支持中文片段)…" value="B+树 索引">
|
|
50
|
+
<button class="btn">搜索</button>
|
|
51
|
+
<button class="btn">刷新</button>
|
|
52
|
+
<button class="btn" style="background:#111;color:#fff;border-color:#111">🕸 知识图谱</button>
|
|
53
|
+
</div>
|
|
54
|
+
<div class="chips">
|
|
55
|
+
<button class="chip active">全部</button>
|
|
56
|
+
<button class="chip">项目</button>
|
|
57
|
+
<button class="chip">知识</button>
|
|
58
|
+
<button class="chip">内容</button>
|
|
59
|
+
<button class="chip">提示词</button>
|
|
60
|
+
<button class="chip">业务</button>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<div class="layout">
|
|
65
|
+
<div>
|
|
66
|
+
<div class="grid">
|
|
67
|
+
<div class="kcard">
|
|
68
|
+
<h4><span class="dot" style="background:#22c55e"></span>数据库索引原理与B+树加速机制</h4>
|
|
69
|
+
<p>索引是数据库为加速查找而额外维护的数据结构…复杂度从 O(n) 降到 O(log n),一次查询只需 3~4 次磁盘 I/O。</p>
|
|
70
|
+
<div class="tags"><span class="tag">数据库</span><span class="tag">索引</span><span class="tag">B+树</span><span class="tag">查询优化</span></div>
|
|
71
|
+
<footer><span>知识</span><span>08-21 20:04</span></footer>
|
|
72
|
+
</div>
|
|
73
|
+
<div class="kcard">
|
|
74
|
+
<h4><span class="dot" style="background:#22c55e"></span>B+树磁盘IO模型与覆盖索引回表优化</h4>
|
|
75
|
+
<p>磁盘随机读 5-10ms,内存纳秒级,相差 5-6 个数量级;覆盖索引避免回表,范围查询顺序读相邻叶子…</p>
|
|
76
|
+
<div class="tags"><span class="tag">MySQL</span><span class="tag">B+树</span><span class="tag">覆盖索引</span></div>
|
|
77
|
+
<footer><span>知识</span><span>08-21 20:06</span></footer>
|
|
78
|
+
</div>
|
|
79
|
+
<div class="kcard">
|
|
80
|
+
<h4><span class="dot" style="background:#3b82f6"></span>项目极光 · 技术选型</h4>
|
|
81
|
+
<p>项目代号:极光(Aurora)。数据库最终选用 PostgreSQL;前端用 Vite 构建。迁移成本可控…</p>
|
|
82
|
+
<div class="tags"><span class="tag">项目</span><span class="tag">PostgreSQL</span></div>
|
|
83
|
+
<footer><span>项目</span><span>08-21 19:59</span></footer>
|
|
84
|
+
</div>
|
|
85
|
+
<div class="kcard">
|
|
86
|
+
<h4><span class="dot" style="background:#22c55e"></span>Redis 缓存策略:TTL与雪崩防护</h4>
|
|
87
|
+
<p>缓存热点数据 TTL 10 分钟,穿透用空值缓存,随机过期防雪崩,大 key 分段缓存降低序列化开销…</p>
|
|
88
|
+
<div class="tags"><span class="tag">Redis</span><span class="tag">缓存</span></div>
|
|
89
|
+
<footer><span>知识</span><span>08-21 18:30</span></footer>
|
|
90
|
+
</div>
|
|
91
|
+
<div class="kcard">
|
|
92
|
+
<h4><span class="dot" style="background:#06b6d4"></span>DSH 插件发布范式(PUBLISH 工作流)</h4>
|
|
93
|
+
<p>npm keywords 带 dsh-plugin + GitHub 打 topic → 市场自动收录;prepublishOnly 自动 build client…</p>
|
|
94
|
+
<div class="tags"><span class="tag">DSH</span><span class="tag">插件</span></div>
|
|
95
|
+
<footer><span>提示词</span><span>08-20 22:11</span></footer>
|
|
96
|
+
</div>
|
|
97
|
+
<div class="kcard">
|
|
98
|
+
<h4><span class="dot" style="background:#f43f5e"></span>知识图谱可视化方案</h4>
|
|
99
|
+
<p>SVG 圆形布局按 kind 分区着色;wikilink 与共享标签连线;点击节点打开卡片阅读全文…</p>
|
|
100
|
+
<div class="tags"><span class="tag">可视化</span><span class="tag">图谱</span></div>
|
|
101
|
+
<footer><span>内容</span><span>08-19 15:02</span></footer>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
<div class="graph-card">
|
|
106
|
+
<h3>🕸 知识图谱 · 12 节点 · 9 连线</h3>
|
|
107
|
+
<svg viewBox="0 0 440 380" width="100%" role="img">
|
|
108
|
+
<defs>
|
|
109
|
+
<marker id="arrow" markerWidth="6" markerHeight="6" refX="5" refY="3" orient="auto"><path d="M0,0 L6,3 L0,6 Z" fill="#d1d5db"/></marker>
|
|
110
|
+
</defs>
|
|
111
|
+
<!-- edges -->
|
|
112
|
+
<line x1="220" y1="60" x2="90" y2="180" stroke="#d1d5db" stroke-width="1.2"/>
|
|
113
|
+
<line x1="220" y1="60" x2="350" y2="180" stroke="#d1d5db" stroke-width="1.2"/>
|
|
114
|
+
<line x1="90" y1="180" x2="220" y2="300" stroke="#d1d5db" stroke-width="1.2" stroke-dasharray="4 3"/>
|
|
115
|
+
<line x1="350" y1="180" x2="220" y2="300" stroke="#d1d5db" stroke-width="1.2"/>
|
|
116
|
+
<line x1="90" y1="180" x2="40" y2="300" stroke="#d1d5db" stroke-width="1.2" stroke-dasharray="4 3"/>
|
|
117
|
+
<line x1="350" y1="180" x2="400" y2="300" stroke="#d1d5db" stroke-width="1.2" stroke-dasharray="4 3"/>
|
|
118
|
+
<line x1="220" y1="300" x2="40" y2="300" stroke="#d1d5db" stroke-width="1" stroke-dasharray="2 3"/>
|
|
119
|
+
<line x1="220" y1="300" x2="400" y2="300" stroke="#d1d5db" stroke-width="1" stroke-dasharray="2 3"/>
|
|
120
|
+
<!-- nodes -->
|
|
121
|
+
<g transform="translate(220 60)"><circle r="11" fill="#22c55e"/><text x="15" y="4" font-size="11" fill="#374151">数据库索引原理</text></g>
|
|
122
|
+
<g transform="translate(90 180)"><circle r="9" fill="#22c55e"/><text x="13" y="3" font-size="10" fill="#374151">B+树IO模型</text></g>
|
|
123
|
+
<g transform="translate(350 180)"><circle r="9" fill="#22c55e"/><text x="-60" y="-8" font-size="10" fill="#374151">Redis缓存策略</text></g>
|
|
124
|
+
<g transform="translate(220 300)"><circle r="12" fill="#3b82f6"/><text x="16" y="4" font-size="11" fill="#374151">项目极光</text></g>
|
|
125
|
+
<g transform="translate(40 300)"><circle r="8" fill="#06b6d4"/><text x="12" y="3" font-size="10" fill="#374151">发布范式</text></g>
|
|
126
|
+
<g transform="translate(400 300)"><circle r="8" fill="#f43f5e"/><text x="-52" y="-10" font-size="10" fill="#374151">图谱方案</text></g>
|
|
127
|
+
</svg>
|
|
128
|
+
<div style="display:flex;gap:10px;flex-wrap:wrap;font-size:11px;color:#6b7280;margin-top:6px">
|
|
129
|
+
<span><span class="dot" style="background:#3b82f6"></span>项目</span>
|
|
130
|
+
<span><span class="dot" style="background:#22c55e"></span>知识</span>
|
|
131
|
+
<span><span class="dot" style="background:#f43f5e"></span>内容</span>
|
|
132
|
+
<span><span class="dot" style="background:#06b6d4"></span>提示词</span>
|
|
133
|
+
<span style="opacity:.7">连线=[[链接]]或共享标签 · 点击节点阅读卡片</span>
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
</body>
|
|
139
|
+
</html>
|
|
Binary file
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# 记忆核心(dsh-memory-eternal)bundle 补丁层。
|
|
2
|
+
# 安装后由 package.json 的 dsh.bundle.patch 自动生效;后层
|
|
3
|
+
# (profile 自己的 cordis.patch.yml / --patch)可按 id 覆盖或禁用本行。
|
|
4
|
+
#
|
|
5
|
+
# 客户端 UI(设置 → 记忆:统计 / 搜索 / 知识图谱)由 package.json 的
|
|
6
|
+
# dsh.client 元数据自动挂载,无需在此声明任何 client 行。
|
|
7
|
+
|
|
8
|
+
- insert:
|
|
9
|
+
- id: memory-eternal
|
|
10
|
+
name: dsh-memory-eternal
|
|
11
|
+
config:
|
|
12
|
+
enabled: true
|
|
13
|
+
autoCapture: true
|
|
14
|
+
autoRecall: true
|
|
15
|
+
vaultDir: ''
|