@mysterycode-liwen/dsh-mail 0.0.0-stage → 1.0.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.md +136 -3
- package/bridge.py +1019 -0
- package/client.js +1880 -0
- package/cordis.patch.yml +8 -0
- package/docs/DETAIL.md +1 -0
- package/docs/preview.svg +21 -0
- package/icon.svg +3 -0
- package/index.js +358 -0
- package/locale/en.json +53 -0
- package/locale/zh.json +53 -0
- package/package.json +64 -6
- package/tools.js +158 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 李文 (mysterycode-liwen)
|
|
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.md
CHANGED
|
@@ -1,3 +1,136 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# 邮件 / Mail
|
|
2
|
+
|
|
3
|
+
[](LICENSE)
|
|
4
|
+
[](https://github.com/deepseek-ai/DeepSeek-Harness)
|
|
5
|
+
|
|
6
|
+
一个 [DeepSeek Harness](https://github.com/deepseek-ai/DeepSeek-Harness) 侧边栏插件:在左侧栏收发 QQ、163、Gmail 等邮箱的邮件。用标准 IMAP 收信、SMTP 发信,账号与授权码保存在本机凭据保险箱,不经过任何第三方服务器。
|
|
7
|
+
|
|
8
|
+
A sidebar plugin for DeepSeek Harness that sends and receives mail from QQ / 163 / Gmail and other IMAP/SMTP accounts. Credentials stay in the local credential vault — nothing is relayed through a third-party server.
|
|
9
|
+
|
|
10
|
+
> ⚠️ QQ / 163 邮箱需要用**授权码**(app password),不是登录密码;Gmail 需要用**应用专用密码**。邮箱服务商要求开启 IMAP/SMTP 服务后才能使用。
|
|
11
|
+
|
|
12
|
+
## 目录
|
|
13
|
+
|
|
14
|
+
- [安装](#安装--install)
|
|
15
|
+
- [快速上手](#快速上手--quick-start)
|
|
16
|
+
- [功能](#功能--features)
|
|
17
|
+
- [AI 助手查询邮箱(需开启)](#ai-助手查询邮箱需开启--ai-assistant-mail-query)
|
|
18
|
+
- [支持的邮箱与服务器](#支持的邮箱与服务器--server-presets)
|
|
19
|
+
- [工作原理](#工作原理--how-it-works)
|
|
20
|
+
- [安全说明](#安全说明--security-notice)
|
|
21
|
+
- [常见问题](#常见问题--faq)
|
|
22
|
+
- [从源码构建](#从源码构建--from-source)
|
|
23
|
+
- [许可](#许可--license)
|
|
24
|
+
|
|
25
|
+
## 安装 / Install
|
|
26
|
+
|
|
27
|
+
从 npm 安装(推荐):
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
dsh plugin --profile desktop add @mysterycode-liwen/dsh-mail
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
也可以在 DeepSeek Harness 的「设置 → 插件 → 插件市场」中搜索 `mail`(市场索引刷新后可见)。
|
|
34
|
+
|
|
35
|
+
从 GitHub 源码安装:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
dsh plugin --profile desktop add github:mysterycode-liwen/dsh-email
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
从本地目录安装(开发用):
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
dsh plugin --profile desktop add link:E:/DeepSeek/dsh-email
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
安装后重启 DeepSeek Harness(或在插件卡片上关闭再启用),左侧栏会出现「邮件」入口。
|
|
48
|
+
|
|
49
|
+
本机需要 **Python 3.10+**:插件通过 Python 标准库 `imaplib` / `smtplib` 处理邮件,无需 pip 安装任何依赖。插件会依次尝试环境变量 `MAIL_PYTHON`、`C:\Python314\python.exe` 到 `C:\Python310\python.exe`,最后是 PATH 中的 `python`。
|
|
50
|
+
|
|
51
|
+
## 快速上手 / Quick start
|
|
52
|
+
|
|
53
|
+
1. 安装并重启 DSH → 左侧栏点「邮件」。
|
|
54
|
+
2. 切到「账号」视图 → 点预设(QQ 邮箱 / 网易 163 / Gmail)自动填好服务器与端口,或手动填自定义服务器。
|
|
55
|
+
3. 填邮箱地址、授权码,点「测试连接」验证 IMAP 登录 + SMTP 登录都通过,再点「保存」。
|
|
56
|
+
4. 回到「收件箱」,从下拉框选账号 → 点「刷新」拉取最近邮件。
|
|
57
|
+
5. 点列表中的邮件读正文(链接可点、图片可显示);点「写邮件」填写收件人 / 主题 / 正文发送。
|
|
58
|
+
|
|
59
|
+
## 功能 / Features
|
|
60
|
+
|
|
61
|
+
- 左侧栏「邮件」面板 + 主区域邮件视图,账号、邮件列表与正文在面板内缓存,切视图不会重新拉取。
|
|
62
|
+
- 多账号管理:添加 / 删除,快速设置预设,支持完全自定义的 IMAP/SMTP 主机、端口与 TLS 开关。
|
|
63
|
+
- 收件箱:按 UID 拉取最近 N 封(默认 20,可调 1–100),显示主题 / 发件人 / 日期 / 摘要。
|
|
64
|
+
- 读信:正文支持富文本——保留可点击链接与内嵌图片;HTML 经消毒(剥离脚本、样式、危险属性与 `javascript:` 链接),`cid:` 内嵌图片转成 `data:` URI 显示。
|
|
65
|
+
- 写信:纯文本 / HTML 邮件正文通过 SMTP 发送(UTF-8)。
|
|
66
|
+
- 连接测试:一键验证 IMAP 选定 INBOX + SMTP 登录。
|
|
67
|
+
- 本地化:中文 / 英文界面,跟随 DSH 语言设置。
|
|
68
|
+
|
|
69
|
+
## AI 助手查询邮箱(需开启)/ AI assistant mail query
|
|
70
|
+
|
|
71
|
+
插件提供只读工具 `mail_query`,让 DeepSeek Harness 的 AI 助手方便查询邮箱内容(列出账号 / 列出邮件 / 读某封邮件 / 最近已发送)。出于隐私,**默认关闭**:必须先在「设置 → 插件 → dsh-mail」中打开「允许 AI 助手查询邮箱内容」开关,助手才能拿到邮件;关闭时工具直接返回“未开启”,不会访问邮箱。
|
|
72
|
+
|
|
73
|
+
该工具只读取邮件,**不能发信、删信或修改任何数据**,也**不会返回授权码 / 密码等凭据**。开关实时生效,关闭后立即失效,无需重启插件。
|
|
74
|
+
|
|
75
|
+
The read-only `mail_query` tool lets the DSH AI assistant query mail (list accounts / messages / read a message / recent sent). For privacy it is **off by default**: enable "Allow the AI assistant to query mailbox content" in Settings → Plugins → dsh-mail before the assistant can read mail; when off the tool returns "disabled" and never touches the mailbox. It cannot send, delete, or modify mail, and never returns credentials. The switch takes effect immediately.
|
|
76
|
+
|
|
77
|
+
## 支持的邮箱与服务器 / Server presets
|
|
78
|
+
|
|
79
|
+
| 服务商 | IMAP | SMTP | 凭据 |
|
|
80
|
+
| --- | --- | --- | --- |
|
|
81
|
+
| QQ 邮箱 | `imap.qq.com:993` (SSL) | `smtp.qq.com:465` (SSL) | 授权码 |
|
|
82
|
+
| 网易 163 | `imap.163.com:993` (SSL) | `smtp.163.com:465` (SSL) | 授权码 |
|
|
83
|
+
| Gmail | `imap.gmail.com:993` (SSL) | `smtp.gmail.com:465` (SSL) | 应用专用密码 |
|
|
84
|
+
| 自定义 | 任意 | 任意 | 密码 / 授权码 |
|
|
85
|
+
|
|
86
|
+
非 993/465 端口可关闭 TLS 走 STARTTLS(IMAP 非 TLS 连接强制要求 STARTTLS 成功,否则拒绝发送凭据)。
|
|
87
|
+
|
|
88
|
+
## 工作原理 / How it works
|
|
89
|
+
|
|
90
|
+
浏览器端 `client.js` 通过 `POST /api/dsh-mail` 调 Host 端注册的私有 HTTP 路由(DSH `connection.fetch.register`,带连接层鉴权)。Host 端 `index.js`:
|
|
91
|
+
|
|
92
|
+
- 账号与授权码存进 DSH 凭据保险箱(`ctx.credentials`),记录 key 形如 `mail/acct-xxxxxxxx`,只把脱敏后的账号元数据返回给 UI;
|
|
93
|
+
- 每次操作启动一个 Python 子进程运行 `bridge.py`,通过环境变量 `MAIL_REQUEST` 传 JSON 请求、stdout 读 JSON 结果;
|
|
94
|
+
- `bridge.py` 用标准库实现 `test` / `listMessages` / `getMessage` / `sendMessage` 四个操作;正文解码处理 charset 回退(UTF-8 / GB18030 / GBK / Big5 / Shift-JIS / EUC-KR)以消除中文乱码。
|
|
95
|
+
|
|
96
|
+
所有邮件操作在同一台机器上完成;插件本身没有对外上传行为。
|
|
97
|
+
|
|
98
|
+
## 安全说明 / Security notice
|
|
99
|
+
|
|
100
|
+
- 邮箱授权码保存在 DSH 凭据保险箱中,界面 API 只返回脱敏元数据,授权码不会下发到 Web 客户端。
|
|
101
|
+
- 邮件正文的 HTML 经过白名单消毒:脚本、`<style>`、事件属性、`javascript:` 链接全部剥离,仅保留安全标签与属性;`data:` URL 仅允许 `data:image/`。
|
|
102
|
+
- 子进程环境变量中会短暂包含授权码(进程生命周期内);该值不被记录到日志,也不回传浏览器。
|
|
103
|
+
- 邮件正文中的远程图片 URL 由邮件发送方控制,阅读邮件时浏览器可能向其发起请求——这是所有邮件客户端的通用行为,请留意发件人是否可信。
|
|
104
|
+
- 本插件不加密本地缓存;请勿在公用电脑上使用。
|
|
105
|
+
|
|
106
|
+
## 常见问题 / FAQ
|
|
107
|
+
|
|
108
|
+
**侧边栏没有「邮件」入口?**
|
|
109
|
+
`client.js` 里 `window.__ModuleLoader__.load({ id })` 的 `id` 必须与 `package.json` 的 `name` 完全一致(DSH 按包名查浏览器模块表)。装完先重启 DSH;仍没有就运行 `npm run check`。
|
|
110
|
+
|
|
111
|
+
**测试连接失败?**
|
|
112
|
+
确认邮箱已开启 IMAP/SMTP 服务,且使用的是授权码而非登录密码;QQ/163 需要到邮箱设置里生成授权码。TLS/SSL 端口用 993 / 465。
|
|
113
|
+
|
|
114
|
+
**读信乱码?**
|
|
115
|
+
插件会对未声明 charset 的正文逐个尝试常见中文编码。若某封邮件仍乱码,请把截图与邮箱服务商发我。
|
|
116
|
+
|
|
117
|
+
**图片显示不出来?**
|
|
118
|
+
远程图片需要能访问对应 URL;`cid:` 内嵌图片仅在邮件本身带有内嵌资源时显示(大于 2 MB 的内嵌图会被跳过以免撑爆响应)。
|
|
119
|
+
|
|
120
|
+
**授权码存在哪?会上传吗?**
|
|
121
|
+
存在 DSH 凭据保险箱,仅本地;插件没有网络上传行为。你也可以在「凭据保险箱」侧栏面板中查看 / 删除这些记录(key 形如 `mail/acct-…`)。
|
|
122
|
+
|
|
123
|
+
## 从源码构建 / From source
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
git clone https://github.com/mysterycode-liwen/dsh-email.git
|
|
127
|
+
cd dsh-email
|
|
128
|
+
npm run check # 校验 client id / patch name / manifest 一致
|
|
129
|
+
dsh plugin --profile desktop add link:$(pwd)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
发布前 `prepublishOnly` 会自动跑 `npm run check`。
|
|
133
|
+
|
|
134
|
+
## 许可 / License
|
|
135
|
+
|
|
136
|
+
[MIT](LICENSE) © 李文 (mysterycode-liwen)
|