dsh-reading-inbox 0.2.1 → 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/README.en.md +211 -208
- package/README.md +211 -208
- package/VERIFY.md +133 -126
- package/index.js +80 -80
- package/package.json +83 -83
- package/src/config.js +44 -44
- package/src/fetch.js +173 -173
- package/src/markdown.js +309 -309
- package/src/routes.js +276 -254
- package/src/search.js +109 -0
- package/src/store.js +741 -647
- package/src/tools.js +441 -438
- package/web/app.js +912 -785
- package/web/index.html +83 -74
- package/web/style.css +814 -739
package/README.en.md
CHANGED
|
@@ -1,208 +1,211 @@
|
|
|
1
|
-
# dsh-reading-inbox
|
|
2
|
-
|
|
3
|
-
> **A reading inbox for DeepSeek Harness.** Clip a web page into clean Markdown, keep the original HTML, tag it, search it, and let the agent use it.
|
|
4
|
-
|
|
5
|
-
[](LICENSE)
|
|
6
|
-
[](https://github.com/topics/dsh-plugin)
|
|
7
|
-
[](package.json)
|
|
8
|
-
[](package.json)
|
|
9
|
-
|
|
10
|
-
[中文](README.md) | English
|
|
11
|
-
|
|
12
|
-

|
|
13
|
-
|
|
14
|
-
## Why an inbox
|
|
15
|
-
|
|
16
|
-
Pages disappear. Links rot. Bookmarks turn into a pile nobody opens again.
|
|
17
|
-
|
|
18
|
-
DSH already has `web_fetch` and `read_url` for reading a page once. They do not solve three things:
|
|
19
|
-
|
|
20
|
-
1. **Keep it** — turn the article into Markdown, keep the original HTML as an archive, so a dead link is still readable.
|
|
21
|
-
2. **Find it later** — full-text search over title, body, tags and source; unread / reading / read / archived states.
|
|
22
|
-
3. **Let the agent use it** — the model can clip, search, read and update clips instead of only seeing the current page.
|
|
23
|
-
|
|
24
|
-
This plugin is the small implementation of those three things. Everything stays on your machine.
|
|
25
|
-
|
|
26
|
-
## Features
|
|
27
|
-
|
|
28
|
-
- **One-step clipping** — paste a URL; Readability extracts the article; Markdown + original HTML + title/author/date/source/excerpt are saved.
|
|
29
|
-
- **Inbox UI** — unread / reading / read / archived, search, tag filters, reading view, copy link, export Markdown.
|
|
30
|
-
- **Highlights and notes** — select text to highlight it (yellow / green / blue / red) and add a note. Anchors use quote + surrounding context, so a re-clip re-locates them automatically; missing text becomes stale instead of landing on the wrong sentence. Markdown export includes active annotations.
|
|
31
|
-
- **Local full-text search** — CJK is indexed as unigrams + bigrams, Latin as words; title and tags are boosted. No model call.
|
|
32
|
-
- **
|
|
33
|
-
- **
|
|
34
|
-
- **
|
|
35
|
-
- **
|
|
36
|
-
- **
|
|
37
|
-
- **
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
|
106
|
-
|
|
|
107
|
-
| `
|
|
108
|
-
| `
|
|
109
|
-
| `
|
|
110
|
-
| `
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
|
119
|
-
|
|
|
120
|
-
| `
|
|
121
|
-
| `
|
|
122
|
-
| `
|
|
123
|
-
| `
|
|
124
|
-
| `
|
|
125
|
-
| `
|
|
126
|
-
| `
|
|
127
|
-
| `
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
- **
|
|
150
|
-
- **
|
|
151
|
-
- **
|
|
152
|
-
- **
|
|
153
|
-
- **
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
npm
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
- `
|
|
190
|
-
- `src/
|
|
191
|
-
- `src/
|
|
192
|
-
- `
|
|
193
|
-
- `src/
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
- [ ]
|
|
203
|
-
- [ ]
|
|
204
|
-
- [ ]
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
1
|
+
# dsh-reading-inbox
|
|
2
|
+
|
|
3
|
+
> **A reading inbox for DeepSeek Harness.** Clip a web page into clean Markdown, keep the original HTML, tag it, search it, and let the agent use it.
|
|
4
|
+
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://github.com/topics/dsh-plugin)
|
|
7
|
+
[](package.json)
|
|
8
|
+
[](package.json)
|
|
9
|
+
|
|
10
|
+
[中文](README.md) | English
|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
## Why an inbox
|
|
15
|
+
|
|
16
|
+
Pages disappear. Links rot. Bookmarks turn into a pile nobody opens again.
|
|
17
|
+
|
|
18
|
+
DSH already has `web_fetch` and `read_url` for reading a page once. They do not solve three things:
|
|
19
|
+
|
|
20
|
+
1. **Keep it** — turn the article into Markdown, keep the original HTML as an archive, so a dead link is still readable.
|
|
21
|
+
2. **Find it later** — full-text search over title, body, tags and source; unread / reading / read / archived states.
|
|
22
|
+
3. **Let the agent use it** — the model can clip, search, read and update clips instead of only seeing the current page.
|
|
23
|
+
|
|
24
|
+
This plugin is the small implementation of those three things. Everything stays on your machine.
|
|
25
|
+
|
|
26
|
+
## Features
|
|
27
|
+
|
|
28
|
+
- **One-step clipping** — paste a URL; Readability extracts the article; Markdown + original HTML + title/author/date/source/excerpt are saved.
|
|
29
|
+
- **Inbox UI** — unread / reading / read / archived, search, tag filters, reading view, copy link, export Markdown.
|
|
30
|
+
- **Highlights and notes** — select text to highlight it (yellow / green / blue / red) and add a note. Anchors use quote + surrounding context, so a re-clip re-locates them automatically; missing text becomes stale instead of landing on the wrong sentence. Markdown export includes active annotations.
|
|
31
|
+
- **Local full-text search** — CJK is indexed as unigrams + bigrams, Latin as words; title and tags are boosted. No model call.
|
|
32
|
+
- **Search grammar and saved views** — `tag:security`, `is:unread`, `site:example.com`, `after:2026-01-01`, `before:2026-12-31`, `has:highlight`; results include a matched snippet; save frequent queries as views.
|
|
33
|
+
- **Agent tools** — `reading_clip`, `reading_search`, `reading_list`, `reading_read`, `reading_update`, `reading_highlight`.
|
|
34
|
+
- **Slash command** — `/inbox <url> [tag1,tag2]` without leaving the conversation.
|
|
35
|
+
- **Chinese-web friendly** — detects GBK / GB2312 / UTF-8 / Big5 so pages do not turn into mojibake.
|
|
36
|
+
- **Safe defaults** — http/https only; every redirect hop is re-validated; DNS answers are checked again at connect time (DNS rebinding defense); loopback, private networks, CGNAT, link-local and cloud metadata addresses are rejected; hard caps of 5 MB, 20 seconds and 5 redirects.
|
|
37
|
+
- **Local-first** — no telemetry, no account, no third-party service.
|
|
38
|
+
- **Exportable** — Markdown with YAML frontmatter, ready for Obsidian / Logseq / any notes folder.
|
|
39
|
+
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
Requires **DSH >= 0.2.0 < 0.3.0** and **Node.js >= 22.12**. DSH 0.2.2 itself requires Node.js >= 24.9, so the DSH runtime is the effective floor.
|
|
43
|
+
|
|
44
|
+
From npm:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
dsh plugin --profile web add dsh-reading-inbox
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
> pnpm's supply-chain policy waits before adopting a freshly published version. If an install right after a release picks the previous version, pin it: `dsh plugin --profile web add dsh-reading-inbox@0.3.0`.
|
|
51
|
+
|
|
52
|
+
From GitHub:
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
dsh plugin --profile web add github:Bit0620/dsh-reading-inbox
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Local development:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
dsh plugin --profile web add file:/absolute/path/to/dsh-reading-inbox
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Restart `dsh web`. A **Reading inbox** row appears in the sidebar, and `/inbox` is available in chat.
|
|
65
|
+
|
|
66
|
+
> DSH Desktop manages its own profile. If the row does not appear after a CLI install, install `dsh-reading-inbox` through **Plugins → Add plugin** in the desktop app, or install it into the profile the app uses.
|
|
67
|
+
|
|
68
|
+
## Usage
|
|
69
|
+
|
|
70
|
+
### In the inbox
|
|
71
|
+
|
|
72
|
+
1. Paste a URL into the top bar and press Enter.
|
|
73
|
+
2. Click an item to read it. Mark read, archive, copy the link, export Markdown, or edit tags on the right.
|
|
74
|
+
3. Select text in the article: a highlight toolbar appears. Pick a color, add an optional note, and save.
|
|
75
|
+
4. The search box searches title, body, tags and source as you type. Combine `tag:`, `is:`, `site:`, `after:` and `has:highlight` filters when needed.
|
|
76
|
+
5. Save the current query as a view below the search box; one click restores the same filters.
|
|
77
|
+
6. Click any tag to filter by it; click a highlight or “Locate” in the annotation list to jump back to the source sentence.
|
|
78
|
+
|
|
79
|
+
### Ask the agent
|
|
80
|
+
|
|
81
|
+
```text
|
|
82
|
+
Clip https://example.com/article into my reading inbox, tags: architecture, reading
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
```text
|
|
86
|
+
Search my saved articles about SSRF and read the key paragraphs
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
```text
|
|
90
|
+
Mark that article as read and add the tag security
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The model calls `reading_clip`, `reading_search`, `reading_read`, `reading_update` and `reading_highlight`. The plugin adds a system-prompt section explaining when to use them.
|
|
94
|
+
|
|
95
|
+
### Slash command
|
|
96
|
+
|
|
97
|
+
```text
|
|
98
|
+
/inbox https://example.com/article architecture, reading
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Command output is shown in the UI only; the full article is not pushed into model context.
|
|
102
|
+
|
|
103
|
+
## Tools
|
|
104
|
+
|
|
105
|
+
| Tool | What it does |
|
|
106
|
+
| --- | --- |
|
|
107
|
+
| `reading_clip` | Fetch a URL, extract the article, save Markdown + original HTML, update the index. Duplicate URLs return the existing clip; `force: true` re-fetches. |
|
|
108
|
+
| `reading_search` | Full-text search with `tag:` / `is:` / `site:` / `after:` / `before:` / `has:highlight` grammar, status/tag filters and pagination; returns metadata plus a matched snippet, not the body. |
|
|
109
|
+
| `reading_list` | List by date, filtered by status/tag. |
|
|
110
|
+
| `reading_read` | Read a Markdown slice by id; use `offset` / `nextOffset` for long articles and `hasMore` to know whether it is complete. |
|
|
111
|
+
| `reading_update` | Change status or tags. Status: `unread` / `reading` / `read` / `archived`. |
|
|
112
|
+
| `reading_highlight` | Create/list/update/delete highlights and notes. `action` is `create` / `list` / `update` / `delete`; `create` takes a `quote` from the article (plain text or Markdown; formatting is stripped, or pass `startOffset`/`endOffset`), plus optional `note` and `color`. |
|
|
113
|
+
|
|
114
|
+
## Configuration
|
|
115
|
+
|
|
116
|
+
Set these in the shell that starts DSH, or in the profile's `.env`, then restart.
|
|
117
|
+
|
|
118
|
+
| Variable | Default | Meaning |
|
|
119
|
+
| --- | --- | --- |
|
|
120
|
+
| `DSH_READING_INBOX_DIR` | `~/.dsh-reading-inbox` | Data directory |
|
|
121
|
+
| `DSH_READING_INBOX_TIMEOUT_MS` | `20000` | Per-fetch timeout |
|
|
122
|
+
| `DSH_READING_INBOX_MAX_BYTES` | `5242880` | Max page size (5 MB) |
|
|
123
|
+
| `DSH_READING_INBOX_MAX_MARKDOWN_CHARS` | `400000` | Max Markdown chars per article; longer content is truncated and flagged |
|
|
124
|
+
| `DSH_READING_INBOX_MAX_REDIRECTS` | `5` | Max redirects |
|
|
125
|
+
| `DSH_READING_INBOX_ALLOW_PRIVATE` | `0` | Set to `1` to allow localhost/private targets; for local tests only |
|
|
126
|
+
| `DSH_READING_INBOX_USER_AGENT` | `dsh-reading-inbox/0.1 ...` | User-Agent for fetches |
|
|
127
|
+
| `DSH_READING_INBOX_PROXY` | falls back to `HTTPS_PROXY` / `HTTP_PROXY` | HTTP proxy URL, e.g. `http://127.0.0.1:7890`; the proxy resolves the destination |
|
|
128
|
+
| `DSH_READING_INBOX_BLOCK_FAKE_IP` | `0` | Set to `1` to reject Clash/Mihomo TUN fake-IPs in `198.18.0.0/15`; stricter, but fake-IP networks can no longer clip |
|
|
129
|
+
| `DSH_READING_INBOX_DEFAULT_TAGS` | empty | Default tags, comma-separated; used only when the user supplies none |
|
|
130
|
+
|
|
131
|
+
## Data layout
|
|
132
|
+
|
|
133
|
+
```text
|
|
134
|
+
~/.dsh-reading-inbox/
|
|
135
|
+
├── index.json # metadata + the source for full-text search
|
|
136
|
+
├── views.json # saved search views
|
|
137
|
+
└── clips/
|
|
138
|
+
└── <id>/
|
|
139
|
+
├── article.md # clean Markdown body
|
|
140
|
+
├── original.html # original HTML snapshot (archive only, never rendered)
|
|
141
|
+
├── annotations.json # highlights/notes (created on the first annotation)
|
|
142
|
+
└── meta.json # title, URL, author, date, tags, status, annotation count
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Back up the whole directory, or sync `clips/` and `index.json`.
|
|
146
|
+
|
|
147
|
+
## Security and boundaries
|
|
148
|
+
|
|
149
|
+
- **Loopback only** — every route accepts `127.0.0.1` / `::1` only, and checks Host, Origin and `Sec-Fetch-Site`; cross-site requests get 403.
|
|
150
|
+
- **SSRF fence** — each redirect hop is re-resolved and re-validated; the DNS answer is checked again when the socket connects, closing the DNS rebinding window; loopback, private networks, CGNAT, link-local, multicast and cloud metadata addresses are rejected.
|
|
151
|
+
- **Clash/Mihomo TUN exception** — fake-IPs in `198.18.0.0/15` are allowed by default, because blocking them would break clipping for many Chinese networks. In fake-IP mode the local pre-check only sees the fake address and cannot learn the real destination, so SSRF protection then depends on the proxy's routing rules. Set `DSH_READING_INBOX_BLOCK_FAKE_IP=1` to reject the range. With an HTTP proxy the destination is resolved by the proxy; use a trusted proxy.
|
|
152
|
+
- **Bounded fetches** — hard limits of 5 MB, 20 seconds and 5 redirects.
|
|
153
|
+
- **Raw HTML is never rendered** — `original.html` is an archive; the UI renders Turndown Markdown through a `sanitize-html` allowlist.
|
|
154
|
+
- **No credentials** — the plugin does not read, store or print account passwords, and does not reuse page login sessions.
|
|
155
|
+
- **No telemetry** — the only network requests are the URLs you explicitly clip.
|
|
156
|
+
- **Copyright** — keep a personal reading copy only; do not use this to redistribute copyrighted content.
|
|
157
|
+
|
|
158
|
+
## Verify (source checkout)
|
|
159
|
+
|
|
160
|
+
These commands run from a source checkout; the npm package ships runtime files only, without tests or development scripts.
|
|
161
|
+
|
|
162
|
+
```sh
|
|
163
|
+
npm install
|
|
164
|
+
npm test
|
|
165
|
+
npm run verify
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
`npm run verify` starts a local test page and walks the whole path: fetch → extract → index → search → read → annotate → export. It prints machine-readable JSON.
|
|
169
|
+
|
|
170
|
+
Local UI:
|
|
171
|
+
|
|
172
|
+
```sh
|
|
173
|
+
npm run seed # write four demo articles into .dev-inbox
|
|
174
|
+
npm run dev # http://127.0.0.1:4173/dsh-reading-inbox/
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
See [VERIFY.md](VERIFY.md) for the end-to-end check inside a real DSH.
|
|
178
|
+
|
|
179
|
+
## Development
|
|
180
|
+
|
|
181
|
+
```sh
|
|
182
|
+
npm run build:client # rebuild client/client.js with esbuild
|
|
183
|
+
npm test # 36 tests: extraction, rendering, SSRF, DNS checks, annotation anchoring, store races, search, routes, client bundle
|
|
184
|
+
npm run verify # end-to-end self-check
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Layout:
|
|
188
|
+
|
|
189
|
+
- `index.js` — DSH plugin entry: tools, routes, command, system prompt.
|
|
190
|
+
- `src/store.js` — clipping, Markdown files, index, search, status.
|
|
191
|
+
- `src/markdown.js` — Readability + Turndown + sanitize-html.
|
|
192
|
+
- `src/fetch.js` — redirect loop, SSRF checks, charset detection, byte caps.
|
|
193
|
+
- `src/routes.js` — loopback-only HTTP routes and JSON API.
|
|
194
|
+
- `src/tools.js` — `reading_*` tools.
|
|
195
|
+
- `web/` — the inbox UI (plain HTML/CSS/JS, no build).
|
|
196
|
+
- `src/client.js` — DSH sidebar entry that frames `web/`.
|
|
197
|
+
|
|
198
|
+
## Limits and roadmap
|
|
199
|
+
|
|
200
|
+
0.3.0 is deliberately small:
|
|
201
|
+
|
|
202
|
+
- [ ] SPA / login / anti-bot pages may yield no article; add a Playwright fallback.
|
|
203
|
+
- [ ] Images still point at remote URLs; download them into `clips/<id>/assets/` for a full offline archive.
|
|
204
|
+
- [ ] No PDF support; use `dsh-pdf-mineru` or a document reader for PDFs.
|
|
205
|
+
- [ ] No browser extension or RSS import yet.
|
|
206
|
+
- [ ] No sync/backup yet; the directory is portable.
|
|
207
|
+
- [ ] Search is local BM25-style ranking; add chunking and result highlighting next.
|
|
208
|
+
|
|
209
|
+
## License
|
|
210
|
+
|
|
211
|
+
MIT © 2026 Bit0620. See [LICENSE](LICENSE).
|