dsh-archived-chats 0.12.0 → 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/README.en.md +40 -21
- package/README.md +40 -21
- package/docs/ARCHITECTURE.en.md +27 -7
- package/docs/ARCHITECTURE.md +27 -7
- package/lib/client.js +538 -43
- package/lib/history-restore.js +286 -0
- package/lib/history.js +326 -0
- package/lib/index.js +176 -0
- package/lib/recycle.js +32 -7
- package/lib/snapshot.js +122 -4
- package/lib/types/client/index.d.ts +43 -3
- package/lib/types/index.d.ts +43 -1
- package/package.json +7 -2
package/README.en.md
CHANGED
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
|
|
8
8
|
[English](README.en.md) | [中文](README.md)
|
|
9
9
|
|
|
10
|
-
> 🔎 **Archived no longer means lost.** Search
|
|
10
|
+
> 🔎 **Archived no longer means lost.** Search and read complete conversations, inspect local history versions, then back up, restore as a copy, or delete safely.
|
|
11
11
|
|
|
12
12
|
> ♻️ **Removing an archived chat from this plugin is undoable.** The plugin first creates a local recovery snapshot containing the session and attachments, then moves it to the Recycle Bin. Physical removal happens only after an explicit **Delete permanently** action in the Recycle Bin.
|
|
13
13
|
|
|
14
|
-
A local archived-chat manager for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness): search and preview complete conversations,
|
|
14
|
+
A local archived-chat manager for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness): search and preview complete conversations, retain a validated local version after archive, restore any healthy version as a new archived copy, and manage old chats through backups, an undoable Recycle Bin, retention policies, and Origins & Branches.
|
|
15
15
|
|
|
16
|
-
Once a conversation is archived in DeepSeek Harness it disappears from the sidebar, and there is no built-in way to browse it again — only the workspace store (`~/.dsh/storages/workspace.json`) still remembers it. This plugin adds
|
|
16
|
+
Once a conversation is archived in DeepSeek Harness it disappears from the sidebar, and there is no built-in way to browse it again — only the workspace store (`~/.dsh/storages/workspace.json`) still remembers it. This plugin adds a **Session Archive** page under Settings where every archived session is visible, searchable, and manageable.
|
|
17
17
|
|
|
18
18
|
[Plugin market](https://awesome-dsh-plugin.com/p/Ultronen/dsh-archived-chats/) · [npm](https://www.npmjs.com/package/dsh-archived-chats) · [Releases](https://github.com/Ultronen/dsh-archived-chats/releases) · [Questions and feedback](https://github.com/Ultronen/dsh-archived-chats/discussions) · [Private vulnerability reporting](https://github.com/Ultronen/dsh-archived-chats/security/advisories/new)
|
|
19
19
|
|
|
@@ -32,7 +32,7 @@ If this plugin helps you recover or protect an important conversation, consider
|
|
|
32
32
|
dsh plugin --profile web add dsh-archived-chats@latest
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
Restart DSH once after installing, then open **Settings →
|
|
35
|
+
Restart DSH once after installing, then open **Settings → Session Archive**.
|
|
36
36
|
|
|
37
37
|
To update an existing installation:
|
|
38
38
|
|
|
@@ -42,15 +42,15 @@ dsh plugin --profile web update dsh-archived-chats
|
|
|
42
42
|
|
|
43
43
|
## Compatibility
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
Version 1.0.0 has been verified to load in a DeepSeek Harness `0.1.1-rc.2` Web profile, register all 30 routes, and expose the archive/history read boundaries. That rc.2 Web Host does not publish the persistence writer required by ZIP import or **Restore as copy**, so preparation returns `501 restore-unsupported` without writing data; full restore requires a Host that explicitly exposes that public capability. Before downgrading from 1.0, back up `$DSH_HOME/plugin-data/archived-chats/`; 0.12 can still validate, retain, and purge version-one snapshots, but it does not show the History tab.
|
|
46
46
|
|
|
47
47
|
## Preview
|
|
48
48
|
|
|
49
|
-
These screenshots
|
|
49
|
+
These screenshots are the `0.12.0` UI baseline, captured in an isolated real DeepSeek Harness `0.1.1-rc.2` Chinese light-theme web profile with synthetic demo conversations and no real user data. The 1.0 History UI has not yet replaced this release screenshot set, so the established paths and headings remain unchanged below.
|
|
50
50
|
|
|
51
51
|

|
|
52
52
|

|
|
53
|
-

|
|
54
54
|

|
|
55
55
|

|
|
56
56
|

|
|
@@ -66,17 +66,19 @@ These screenshots cover the current `0.12.0` feature set. They were captured in
|
|
|
66
66
|
|
|
67
67
|
## Usage
|
|
68
68
|
|
|
69
|
-
1. Archive a conversation from the normal DSH session menu. After
|
|
70
|
-
2. Open **Settings →
|
|
71
|
-
3.
|
|
72
|
-
4.
|
|
73
|
-
5.
|
|
74
|
-
6.
|
|
69
|
+
1. Archive a conversation from the normal DSH session menu. After Host success, the notice first reports **saving history version** and starts its three-second dismissal only after save. Snapshot failure never rolls back archive success; the notice retains **Retry save**, **View**, **Undo**, and close actions.
|
|
70
|
+
2. Open **Settings → Session Archive → History**. Groups can be searched by safe title/workspace and expanded to preview any healthy version read-only or choose **Restore as copy**. The Host generates a new session ID and registers the result as archived; it never overwrites, unarchives, or deletes the source.
|
|
71
|
+
3. Use **Archived** to manage chats by workspace and search titles, tags, notes, message text, or tool output. Row preview does not require unarchive.
|
|
72
|
+
4. Use **Import backup / Export backup** for ZIP backups. ZIP import and history restore are separate flows.
|
|
73
|
+
5. **Move to Recycle Bin** reuses a healthy snapshot for the same revision when possible and otherwise publishes a new protection snapshot. Only **Delete permanently / Empty Recycle Bin** irreversibly removes the original and every validated snapshot for that source.
|
|
74
|
+
6. Use **Storage & Retention** to preview and explicitly apply history-count, age, quota, and recycle-age policy. **Origins & Branches** remains a read-only tree of necessary relationship context.
|
|
75
75
|
|
|
76
76
|
## Features
|
|
77
77
|
|
|
78
78
|
- **Complete archived-session list**, grouped by workspace (project) with a per-group count. Every group can be collapsed or expanded, and the state is remembered per browser.
|
|
79
79
|
- **Archive success notice**: after a chat is archived, a compact frame-wide notice remains for three seconds with **View**, **Undo**, and close actions. Pointer hover or keyboard focus pauses the timer, active View/Undo work cannot time out, and failures retain a retry action.
|
|
80
|
+
- **Local history after archive**: only a successful browser-originated archive captures a validated version, deduplicated by the same non-null source revision. The plugin never scans unrelated active chats and performs no startup, scheduled, or background capture.
|
|
81
|
+
- **History timeline, restore, and deletion**: the fifth History tab shows timestamp, size, attachment count, recycle-protection state, and opaque degraded items by original chat. Preview is read-only and restore always creates a new archived ID. Ordinary history can be deleted individually or cleared globally after confirmation and cannot then be recovered. Original chats remain unchanged; recycle-protection and degraded snapshots are skipped.
|
|
80
82
|
- **Full-text conversation search**: one search field matches titles, workspaces, tags, notes, user messages, assistant answers, and tool results, with a readable hit excerpt on each matching row.
|
|
81
83
|
- **Native archived conversation preview and turn navigation**: follow the Harness conversation layout with user messages on the right and assistant messages on the left; present Markdown, reasoning, tool activity, JSON, code, and available stored images read-only, while retaining a responsive turn rail for quick jumps. If the host lacks attachment capability, only images degrade and the rest of the preview remains readable.
|
|
82
84
|
- **Filter and sort** by type (all / regular / subagent), project, and tag; then order results by newest, oldest, or title.
|
|
@@ -87,10 +89,10 @@ These screenshots cover the current `0.12.0` feature set. They were captured in
|
|
|
87
89
|
- **Compact top-level actions**: common **Import backup** / **Export backup** actions are direct, while the low-frequency destructive action lives under **More**. The page stays focused on DSH archive management without a persistent source selector or redundant menus.
|
|
88
90
|
- **On-demand multi-select**: checkboxes stay hidden by default and appear only after clicking **Select multiple**. Select individual chats, every visible result, or an entire project; the selection bar can export, unarchive, or move the chosen chats to the Recycle Bin, while selections hidden by another filter remain intact.
|
|
89
91
|
- **Unarchive** a single chat or a whole project group from the group's `⋯` menu — restored chats reappear in the sidebar immediately.
|
|
90
|
-
- **
|
|
92
|
+
- **Five archive-management views**: Archived, History, Recycle Bin, Storage & Retention, and Origins & Branches. History loads only on first activation; Recycle Bin stays grouped by original workspace with independent disclosure state.
|
|
91
93
|
- **Storage analysis**: separately measures archived/recycled session directories and plugin-owned snapshots, with unavailable/degraded diagnostics and repeated snapshot-attachment bytes. Searchable detail dialogs open from the summary cards, so long inventories never push retention controls down the page. It does not label these numbers as globally reclaimable Harness attachment storage.
|
|
92
94
|
- **Preview-first retention policies**: plan by retained recovery snapshots per original chat, snapshot age, snapshot quota, and recycle age. The default keeps one recovery snapshot per original chat. Saving never runs cleanup; snapshots in use by Recycle Bin or unavailable snapshots are excluded and permanent recycle purges start unselected.
|
|
93
|
-
- **Read-only Origins & Branches**: uses durable Harness `parentSession` fields to show the sources, forks, and subagent trees of archived/recycled chats, retaining only the parent/child context needed to explain them. Unrelated active chats are not sent to the browser. Managed cards keep source copy inside the card and put a centered disclosure arrow on its own bottom row; users can click the whole card or arrow to fold, copy the full ID, use project/status filters, and expand or collapse all. Searching titles, projects, or IDs automatically reveals matching paths; an independently scrolling tree keeps large datasets from extending the page, and root branches default to collapsed above 50 nodes. Missing parents, cycles, and delegation-depth mismatches
|
|
95
|
+
- **Read-only Origins & Branches**: uses durable Harness `parentSession` fields to show the sources, forks, and subagent trees of archived/recycled chats, retaining only the parent/child context needed to explain them. Unrelated active chats are not sent to the browser. Managed cards keep source copy inside the card and put a centered disclosure arrow on its own bottom row; users can click the whole card or arrow to fold, copy the full ID, use project/status filters, and expand or collapse all. Searching titles, projects, or IDs automatically reveals matching paths; an independently scrolling tree keeps large datasets from extending the page, and root branches default to collapsed above 50 nodes. Missing parents, cycles, and delegation-depth mismatches render in full inside the affected managed card without rewriting relationships.
|
|
94
96
|
- **Automatic recovery snapshots and retained history**: moving an archived chat to Recycle Bin captures all events plus verified image bytes. Restore removes the recycle record but deliberately retains the validated snapshot, so retained recovery storage can exist with an empty archive list. Repeated restore/recycle cycles retain older valid snapshots until the user explicitly applies retention or permanently purges the chat.
|
|
95
97
|
- **Two-level restore**: when the original session is intact, restore only removes the recycle marker and does not rewrite persistence. If the original is missing, the plugin falls back to the validated session-and-attachment snapshot through public writer capabilities, never overwriting an existing ID.
|
|
96
98
|
- **Explicit permanent purge**: only the Recycle Bin exposes permanent delete and empty. The plugin records durable `purge-pending` crash intent before deleting the original and snapshot; interrupted purges retry at startup.
|
|
@@ -98,11 +100,11 @@ These screenshots cover the current `0.12.0` feature set. They were captured in
|
|
|
98
100
|
|
|
99
101
|
## Recycle Bin, privacy, and attachment limits
|
|
100
102
|
|
|
101
|
-
The recycle catalog (`trash.json`)
|
|
103
|
+
The recycle catalog (`trash.json`) plus history/protection snapshots live under `$DSH_HOME/plugin-data/archived-chats/` and stay on this machine. Attachment bytes are read one at a time, digest-verified, and atomically published. Conversations and attachments are never uploaded, cloud-synced, background-scanned, or scheduled for capture.
|
|
102
104
|
|
|
103
105
|
Retention policy lives in `retention.json` under the same directory. Policies never run in the background, at startup, or on a timer; every cleanup requires a single-use five-minute preview followed by explicit selection and confirmation.
|
|
104
106
|
|
|
105
|
-
Permanent purge removes
|
|
107
|
+
Permanent Recycle Bin purge removes every validated snapshot attachment copy for that source, but Harness's global attachment store may retain identical bytes because another session still references them or because the host applies its own garbage-collection policy. This plugin does not claim immediate global attachment GC.
|
|
106
108
|
|
|
107
109
|
## Tags, notes, and statistics
|
|
108
110
|
|
|
@@ -135,6 +137,13 @@ No. DSH hides the conversation from the sidebar and keeps its archived session r
|
|
|
135
137
|
|
|
136
138
|
</details>
|
|
137
139
|
|
|
140
|
+
<details>
|
|
141
|
+
<summary><b>Are history versions screenshots, and can restore overwrite the source?</b></summary>
|
|
142
|
+
|
|
143
|
+
No. They are locally stored, validated copies of session records and attachments, and preview is read-only. **Restore as copy** asks the Host for a new ID and creates a new archived chat. It never overwrites, deletes, or unarchives the source or mutates the selected snapshot.
|
|
144
|
+
|
|
145
|
+
</details>
|
|
146
|
+
|
|
138
147
|
<details>
|
|
139
148
|
<summary><b>What happens when an imported backup contains an existing session ID?</b></summary>
|
|
140
149
|
|
|
@@ -159,13 +168,13 @@ Yes. The success notice includes **Undo**, and the Recycle Bin keeps a Restore a
|
|
|
159
168
|
<details>
|
|
160
169
|
<summary><b>Why are recovery snapshots shown when there are no archived chats?</b></summary>
|
|
161
170
|
|
|
162
|
-
A recovery snapshot is created before an archived chat moves to the Recycle Bin. Restoring removes the recycle record but deliberately keeps the validated snapshot as recovery history, so it may still use storage after the archive list becomes empty.
|
|
171
|
+
A recovery snapshot is created before an archived chat moves to the Recycle Bin. Restoring removes the recycle record but deliberately keeps the validated snapshot as recovery history, so it may still use storage after the archive list becomes empty. Delete one ordinary version or use **Clear history versions** from History; a snapshot still protecting Recycle Bin recovery is skipped. Alternatively, set retention count to `0` and run **Preview cleanup → Apply selected cleanup**.
|
|
163
172
|
|
|
164
173
|
</details>
|
|
165
174
|
|
|
166
175
|
## Implementation overview
|
|
167
176
|
|
|
168
|
-
The plugin has two halves: the Host service manages archives, snapshots, the recycle catalog, and restore/purge transactions, while the browser page provides search, preview, backup, restore, and explicit confirmations. Mutations go through guarded local routes. Ordinary removal commits only a recycle record; physical removal is reachable only through the Recycle Bin's crash-safe purge flow.
|
|
177
|
+
The plugin has two halves: the Host service manages archives, version snapshots, the recycle catalog, and restore/purge transactions, while the browser page provides search, history timelines, read-only preview, backup, restore-as-copy, and explicit confirmations. Mutations go through guarded local routes. Ordinary removal commits only a recycle record; physical removal is reachable only through the Recycle Bin's crash-safe purge flow.
|
|
169
178
|
|
|
170
179
|
User-facing storage, backup limits, deletion outcomes, and compatibility notes stay in this README. Maintainer details such as route contracts, data flow, restore transactions, live-deletion lifecycle, and failure fallbacks are documented in [ARCHITECTURE.md](docs/ARCHITECTURE.en.md).
|
|
171
180
|
|
|
@@ -175,10 +184,20 @@ User-facing storage, backup limits, deletion outcomes, and compatibility notes s
|
|
|
175
184
|
npm test
|
|
176
185
|
```
|
|
177
186
|
|
|
178
|
-
The suite (`test/*.test.mjs`) covers export
|
|
187
|
+
The suite (`test/*.test.mjs`) covers export/import, history capture/inventory/preview/image authorization, single-use restore-as-copy transactions and rollback, retention, full-text search, and Host/browser smoke and responsive behavior. It uses an isolated temporary DSH home plus mocked host and browser runtimes; it never reads or changes real sessions.
|
|
179
188
|
|
|
180
189
|
## Version history
|
|
181
190
|
|
|
191
|
+
### 1.0.0
|
|
192
|
+
|
|
193
|
+
- Added the fifth **History** tab for validated local versions, recycle-protection state, safe search, and opaque degraded entries grouped by source chat.
|
|
194
|
+
- Browser archive success now captures by stable revision; capture failure never rolls back archive and the notice retains safe retry.
|
|
195
|
+
- Reused the conversation preview for snapshot timestamps and verified images. Restore always creates a new archived ID and never overwrites the source.
|
|
196
|
+
- Added confirmed single-version deletion and global History clearing without selection checkboxes; recycle-protection and degraded snapshots are not removed by these actions.
|
|
197
|
+
- Recycle moves may reuse the same healthy non-null revision. Retention continues to govern history, and permanent purge removes every validated snapshot for the source.
|
|
198
|
+
- A real `0.1.1-rc.2` Web Host verified plugin loading, safe inventory, and capability degradation; without a writer, restore fails without mutation as `restore-unsupported`.
|
|
199
|
+
- **Downgrade reminder:** 0.12 does not show History, but it can validate, retain, and purge version-one snapshots. Back up `$DSH_HOME/plugin-data/archived-chats/` before downgrading.
|
|
200
|
+
|
|
182
201
|
### 0.12.0
|
|
183
202
|
|
|
184
203
|
- Added a three-second top notice after archive success, with direct View and Undo, hover/focus pause, and retryable failures.
|
|
@@ -249,7 +268,7 @@ The suite (`test/*.test.mjs`) covers export records and real ZIP decoding, bound
|
|
|
249
268
|
|
|
250
269
|
### 0.3.0
|
|
251
270
|
|
|
252
|
-
- First published release of the
|
|
271
|
+
- First published release of the Session Archive settings page.
|
|
253
272
|
- Added workspace-grouped browsing, title search, type/project filters, unarchive, and confirmed single/group/all deletion.
|
|
254
273
|
- Added host routes, the browser settings section, and the pending-deletion sweep for live sessions.
|
|
255
274
|
|
package/README.md
CHANGED
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
|
|
8
8
|
[English](README.en.md) | 中文
|
|
9
9
|
|
|
10
|
-
> 🔎 **归档不再等于消失。**
|
|
10
|
+
> 🔎 **归档不再等于消失。** 直接搜索和阅读完整对话,查看本地历史版本,再安全备份、恢复为副本或删除。
|
|
11
11
|
|
|
12
12
|
> ♻️ **在本插件中移除归档聊天可以撤销。** 插件会先创建包含会话与附件的本地恢复快照,再移入回收站;只有在回收站中明确选择「永久删除」才会物理清除。
|
|
13
13
|
|
|
14
|
-
为 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)
|
|
14
|
+
为 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 新增一个本地归档聊天中心:搜索和预览完整对话,在每次成功归档后保留已验证的历史版本,把任意健康版本恢复为新的已归档副本,并通过备份、可撤销回收站、保留策略及来源与分支管理历史聊天。
|
|
15
15
|
|
|
16
|
-
在 DeepSeek Harness 里,聊天一旦归档就会从侧边栏消失,界面中没有任何入口可以再看到它,只有工作区存档(`~/.dsh/storages/workspace.json
|
|
16
|
+
在 DeepSeek Harness 里,聊天一旦归档就会从侧边栏消失,界面中没有任何入口可以再看到它,只有工作区存档(`~/.dsh/storages/workspace.json`)还记得它。这个插件在「设置」中补上一个「会话档案」页面,让所有归档会话都可见、可搜索、可管理。
|
|
17
17
|
|
|
18
18
|
[插件市场](https://awesome-dsh-plugin.com/p/Ultronen/dsh-archived-chats/) · [npm](https://www.npmjs.com/package/dsh-archived-chats) · [版本发布](https://github.com/Ultronen/dsh-archived-chats/releases) · [问题交流](https://github.com/Ultronen/dsh-archived-chats/discussions) · [私密报告漏洞](https://github.com/Ultronen/dsh-archived-chats/security/advisories/new)
|
|
19
19
|
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
dsh plugin --profile web add dsh-archived-chats@latest
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
安装后重启一次 DSH,然后打开 **设置 →
|
|
35
|
+
安装后重启一次 DSH,然后打开 **设置 → 会话档案**。
|
|
36
36
|
|
|
37
37
|
更新已有安装:
|
|
38
38
|
|
|
@@ -42,15 +42,15 @@ dsh plugin --profile web update dsh-archived-chats
|
|
|
42
42
|
|
|
43
43
|
## 兼容性
|
|
44
44
|
|
|
45
|
-
0.
|
|
45
|
+
1.0.0 已在 DeepSeek Harness `0.1.1-rc.2` Web profile 中验证能正常加载、注册 30 条路由并提供归档/历史读取边界。该 rc.2 Web Host 未公开导入与「恢复为副本」所需的持久层 writer,因此确认准备会返回 `501 restore-unsupported`且不写入数据;完整恢复需要宿主明确提供该公开能力。从 1.0 降级前请先备份 `$DSH_HOME/plugin-data/archived-chats/`;0.12 可继续校验、保留和清理 version 1 快照,但不会显示「历史版本」页签。
|
|
46
46
|
|
|
47
47
|
## 预览
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
以下截图是 `0.12.0` 界面基线,在隔离的真实 DeepSeek Harness `0.1.1-rc.2` 中文浅色 Web profile 中捕获,只使用合成演示会话,不包含真实用户数据。1.0 的「历史版本」界面尚未替换这组发布截图,因此下方仍保留原有路径和标题。
|
|
50
50
|
|
|
51
51
|

|
|
52
52
|

|
|
53
|
-

|
|
54
54
|

|
|
55
55
|

|
|
56
56
|

|
|
@@ -66,17 +66,19 @@ dsh plugin --profile web update dsh-archived-chats
|
|
|
66
66
|
|
|
67
67
|
## 使用流程
|
|
68
68
|
|
|
69
|
-
1. 在 DSH
|
|
70
|
-
2. 打开 **设置 →
|
|
71
|
-
3.
|
|
72
|
-
4.
|
|
73
|
-
5. 点击 **取消归档** 将会话放回侧边栏;点击 **移至回收站**
|
|
74
|
-
6. 打开 **空间与策略**
|
|
69
|
+
1. 在 DSH 正常聊天的会话菜单中点击归档。宿主确认成功后,顶部提示会先显示「正在保存历史版本」,保存完成后才开始 3 秒关闭计时。快照失败不会回滚已成功的归档,提示会保留「重试保存」、**查看**、**撤销** 和关闭操作。
|
|
70
|
+
2. 打开 **设置 → 会话档案 → 历史版本**。这里按原会话分组,可搜索安全标题/项目,展开后可只读预览任意健康版本,或选择 **恢复为副本**。恢复由 Host 生成新会话 ID,始终作为已归档副本,不覆盖、取消归档或删除来源。
|
|
71
|
+
3. 在 **归档** 页签按工作区管理会话,搜索标题、标签、备注、聊天正文或工具结果;行内预览无需先取消归档。
|
|
72
|
+
4. 使用顶部 **导入备份 / 导出备份** 管理 ZIP 备份;ZIP 导入与历史恢复是两条独立流程。
|
|
73
|
+
5. 点击 **取消归档** 将会话放回侧边栏;点击 **移至回收站** 会在同一修订已有健康快照时复用它,否则创建新的保护快照。只有回收站中的 **永久删除 / 清空回收站** 会不可撤销地移除原会话与该来源的全部已验证历史快照。
|
|
74
|
+
6. 打开 **空间与策略** 预览并明确应用历史数量、年龄、容量和回收站年龄策略。**来源与分支** 仍以只读分支树展示必要关系上下文。
|
|
75
75
|
|
|
76
76
|
## 功能
|
|
77
77
|
|
|
78
78
|
- **完整归档列表**:按工作区(项目)分组并显示每组数量;每个分组都可折叠/展开,状态按浏览器记忆。
|
|
79
79
|
- **归档成功提示**:会话归档成功后,在 DSH 全局浮层显示 3 秒的紧凑提示,提供 **查看**、**撤销** 和关闭操作;鼠标悬停或键盘聚焦会暂停计时,查看/撤销进行中不会自动消失,失败时保留重试入口。
|
|
80
|
+
- **归档后本地历史**:浏览器触发的普通归档成功后才抓取一个已验证版本;相同非空修订去重。不扫描无关活动会话,不在后台、定时器或启动时自动抓取。
|
|
81
|
+
- **历史时间线、恢复与删除**:第五个「历史版本」页签按原会话展示时间、大小、附件数和回收保护状态;预览只读,恢复始终生成新的已归档 ID。普通历史可经确认后单条删除或全局清空,删除后无法恢复;原聊天不受影响,回收站保护和降级快照会跳过。
|
|
80
82
|
- **聊天正文全文搜索**:同一个搜索框同时匹配标题、项目、标签、备注、用户消息、助手回答与工具结果,并在结果行显示命中摘要。
|
|
81
83
|
- **原生归档对话预览与轮次导航**:沿用 Harness 会话布局,用户消息靠右、助手消息靠左;以只读方式展示 Markdown、思考过程、工具活动、JSON、代码和可用的已存储图片,并保留可快速跳转的响应式轮次轨道。宿主缺少附件能力时只影响图片,其他预览内容仍可阅读。
|
|
82
84
|
- **筛选与排序**:用类型(全部 / 普通会话 / 子代理会话)、项目和标签筛选,并按最新、最早或标题排序。
|
|
@@ -87,10 +89,10 @@ dsh plugin --profile web update dsh-archived-chats
|
|
|
87
89
|
- **紧凑顶部操作**:常用的 **导入备份** / **导出备份** 直接可用,低频危险操作收纳在 **更多**;页面专注于 DSH 归档管理,不常驻来源选择器或冗余菜单。
|
|
88
90
|
- **按需多选**:复选框默认隐藏,点击 **批量选择** 后才显示;可逐条选择、选择当前筛选结果或整个项目。选中后可一次导出、取消归档或移至回收站,隐藏在其他筛选结果中的选择不会丢失。
|
|
89
91
|
- **取消归档**单个聊天,或从分组的 `⋯` 菜单整组取消——恢复的聊天会立刻回到侧边栏。
|
|
90
|
-
-
|
|
92
|
+
- **五个归档管理视图**:归档、历史版本、回收站、空间与策略、来源与分支。历史页首次激活时才加载;回收站按原工作区分组并可独立折叠。
|
|
91
93
|
- **空间分析**:分别统计归档/回收会话目录与插件保护快照,标出无法统计项、降级快照和重复快照附件字节;会话目录与快照明细从摘要卡片进入可搜索弹窗,不会把保留策略持续向下推,也不会把这些数字描述为 Harness 全局附件可回收空间。
|
|
92
94
|
- **预览优先的保留策略**:可按每个原会话的保留快照数、快照年龄、快照容量和回收站年龄生成候选;默认每个原会话保留一份恢复快照。保存策略绝不自动执行,回收站正在使用或不可用的快照不会被选中,回收站永久删除默认不勾选。
|
|
93
|
-
- **只读来源与分支**:使用 Harness 持久化 `parentSession` 展示已归档/回收站会话的来源、分叉和子代理树,并保留解释关系所需的父子上下文;无关活动会话不会发送到浏览器。管理卡片把来源说明放在卡片内容中,底部独立一排居中显示折叠箭头;可复制完整 ID、点击整张卡片或箭头折叠,使用项目/状态筛选和全局展开/折叠。搜索标题、项目或 ID 时会自动展开命中路径,独立滚动区域避免大树持续推长页面,超过 50
|
|
95
|
+
- **只读来源与分支**:使用 Harness 持久化 `parentSession` 展示已归档/回收站会话的来源、分叉和子代理树,并保留解释关系所需的父子上下文;无关活动会话不会发送到浏览器。管理卡片把来源说明放在卡片内容中,底部独立一排居中显示折叠箭头;可复制完整 ID、点击整张卡片或箭头折叠,使用项目/状态筛选和全局展开/折叠。搜索标题、项目或 ID 时会自动展开命中路径,独立滚动区域避免大树持续推长页面,超过 50 个节点时根分支默认折叠。本版只诊断缺失父节点、循环与委派深度不一致,诊断在对应管理卡片内完整换行显示,不修改关系。
|
|
94
96
|
- **自动恢复快照与保留历史**:已归档聊天移入回收站前保存完整会话事件和经校验的图片附件字节。恢复只移除回收记录,不自动删除快照;它会显示为“已保留的恢复快照”,即使当前没有归档聊天。重复恢复/回收会继续保留旧的有效快照,直到用户明确应用保留策略或永久删除该会话。
|
|
95
97
|
- **两级恢复**:原会话仍完好时只移除回收标记,不重写持久层;原件丢失时才使用已验证快照和官方写入能力回退恢复,且绝不覆盖同 ID 会话。
|
|
96
98
|
- **明确的永久删除**:仅回收站提供永久删除与清空。插件先写入 `purge-pending` 崩溃恢复意图,再删除原会话和保护快照;中途失败会在下次启动重试。
|
|
@@ -98,11 +100,11 @@ dsh plugin --profile web update dsh-archived-chats
|
|
|
98
100
|
|
|
99
101
|
## 回收站、隐私与附件限制
|
|
100
102
|
|
|
101
|
-
回收目录 `trash.json`
|
|
103
|
+
回收目录 `trash.json` 与历史/保护快照位于 `$DSH_HOME/plugin-data/archived-chats/`,全部只保存在本机。快照会逐个读取附件、校验摘要并使用原子发布;不会上传、云同步或定时扫描会话与附件。
|
|
102
104
|
|
|
103
105
|
保留策略保存在同目录的 `retention.json`。插件不会在后台、启动时或定时自动应用策略;每次清理都要先生成五分钟有效的单次预览,再由用户选择并确认。
|
|
104
106
|
|
|
105
|
-
|
|
107
|
+
回收站永久删除会删掉该来源的全部已验证快照附件副本,但 Harness 全局附件存储可能仍因其他会话引用或宿主垃圾回收策略保留相同字节;本插件不声称会立即清理宿主的全局附件库。
|
|
106
108
|
|
|
107
109
|
## 标签、备注与统计
|
|
108
110
|
|
|
@@ -135,6 +137,13 @@ JSON 会保留附件引用,但**本版不复制附件二进制,也不包含
|
|
|
135
137
|
|
|
136
138
|
</details>
|
|
137
139
|
|
|
140
|
+
<details>
|
|
141
|
+
<summary><b>历史版本是界面截图吗?恢复会覆盖原聊天吗?</b></summary>
|
|
142
|
+
|
|
143
|
+
不是。它们是插件在本机保存并校验的会话记录与附件副本,预览只读。**恢复为副本** 会请 Host 生成新 ID,创建新的已归档聊天;来源会话和所选快照均不会被覆盖、删除或取消归档。
|
|
144
|
+
|
|
145
|
+
</details>
|
|
146
|
+
|
|
138
147
|
<details>
|
|
139
148
|
<summary><b>导入备份包含已存在的会话 ID 时会怎样?</b></summary>
|
|
140
149
|
|
|
@@ -159,13 +168,13 @@ JSON 会保留附件引用,但**本版不复制附件二进制,也不包含
|
|
|
159
168
|
<details>
|
|
160
169
|
<summary><b>为什么没有已归档聊天,空间页仍显示恢复快照?</b></summary>
|
|
161
170
|
|
|
162
|
-
|
|
171
|
+
恢复快照是在已归档聊天移入回收站前创建的。恢复聊天时插件会移除回收记录,但故意保留已经验证的快照作为恢复历史,因此当前归档列表为空时仍可能占用空间。可在「历史版本」中单条删除或使用「清空历史版本」;回收站正在使用的保护版本会跳过。也可将保留数量改为 `0`,再执行 **预览清理 → 应用所选清理**。
|
|
163
172
|
|
|
164
173
|
</details>
|
|
165
174
|
|
|
166
175
|
## 实现概览
|
|
167
176
|
|
|
168
|
-
插件由两部分组成:Host
|
|
177
|
+
插件由两部分组成:Host 服务层负责读取本地归档、版本快照、回收目录和恢复/清除事务,浏览器设置页负责搜索、历史时间线、只读预览、备份、恢复为副本与明确确认。所有修改都通过受保护的本地路由完成;普通移除只提交回收记录,物理清除仅由回收站的崩溃安全 purge 流程触发。
|
|
169
178
|
|
|
170
179
|
普通用户需要了解的数据保存、备份限制、删除结果和兼容性说明已列在本 README 中。路由清单、数据流、恢复事务、实时删除生命周期和失败回退等维护者细节请参阅 [架构文档](docs/ARCHITECTURE.md)。
|
|
171
180
|
|
|
@@ -175,10 +184,20 @@ JSON 会保留附件引用,但**本版不复制附件二进制,也不包含
|
|
|
175
184
|
npm test
|
|
176
185
|
```
|
|
177
186
|
|
|
178
|
-
测试套件(`test/*.test.mjs
|
|
187
|
+
测试套件(`test/*.test.mjs`)覆盖导出与导入、历史抓取/清单/预览/图片授权、单次确认的恢复为副本事务、回滚、保留策略、全文搜索,以及 Host+浏览器冒烟/响应式行为。测试使用隔离的临时 DSH 主目录和模拟运行时,不会读取或修改真实会话。
|
|
179
188
|
|
|
180
189
|
## 版本更新记录
|
|
181
190
|
|
|
191
|
+
### 1.0.0
|
|
192
|
+
|
|
193
|
+
- 新增第五个 **历史版本** 页签:按原会话查看本地已验证版本、回收保护状态和不透明降级项。
|
|
194
|
+
- 浏览器归档成功后按稳定修订去重抓取;失败不回滚归档,通知保留安全重试。
|
|
195
|
+
- 复用原有对话预览显示快照时间与已验证图片;恢复始终生成新的已归档 ID,不覆盖来源。
|
|
196
|
+
- 新增经过危险确认的单条历史删除和全局清空;不使用复选框,回收站保护/降级快照不会被该操作删除。
|
|
197
|
+
- 回收移动可复用相同非空修订快照;保留策略继续治理历史,永久删除会清掉该来源的全部已验证快照。
|
|
198
|
+
- 真实 `0.1.1-rc.2` Web Host 验证了插件加载、安全清单与能力降级;宿主缺少 writer 时恢复以 `restore-unsupported` 无写入失败。
|
|
199
|
+
- **降级提醒:** 0.12 不显示「历史版本」页签,但仍能校验、保留和清理 version 1 快照。降级前仍应备份 `$DSH_HOME/plugin-data/archived-chats/`。
|
|
200
|
+
|
|
182
201
|
### 0.12.0
|
|
183
202
|
|
|
184
203
|
- 归档成功后新增 3 秒顶部提示,可立即查看归档中心或撤销;悬停/聚焦暂停,操作失败保留重试。
|
|
@@ -249,7 +268,7 @@ npm test
|
|
|
249
268
|
|
|
250
269
|
### 0.3.0
|
|
251
270
|
|
|
252
|
-
-
|
|
271
|
+
- 首个公开发布版本,提供「会话档案」设置页。
|
|
253
272
|
- 新增按工作区分组浏览、标题搜索、类型/项目筛选、取消归档,以及带确认的单条/分组/全部删除。
|
|
254
273
|
- 新增 Host 路由、浏览器设置区块,以及用于处理运行中会话的待删队列清扫。
|
|
255
274
|
|
package/docs/ARCHITECTURE.en.md
CHANGED
|
@@ -9,8 +9,8 @@ This document is for maintainers and developers who need to understand data beha
|
|
|
9
9
|
The plugin has a Host service half and a browser client half:
|
|
10
10
|
|
|
11
11
|
- The Host service in lib/index.js runs inside the DSH Web host, reads the workspace registry and session persistence, and exposes local HTTP routes.
|
|
12
|
-
- The browser client in lib/client.js registers the
|
|
13
|
-
- Pure domain logic lives in lib/export.js, lib/import.js, lib/restore.js, lib/metadata.js, lib/search.js, lib/stats.js, lib/insights.js, lib/retention.js, lib/retention-service.js, and lib/lineage.js. lib/trash.js owns the recycle catalog, lib/snapshot.js owns verified snapshots, and lib/recycle.js composes recycle lifecycle operations.
|
|
12
|
+
- The browser client in lib/client.js registers the Session Archive settings.section and renders state and actions.
|
|
13
|
+
- Pure domain logic lives in lib/export.js, lib/import.js, lib/restore.js, lib/metadata.js, lib/search.js, lib/stats.js, lib/insights.js, lib/retention.js, lib/retention-service.js, and lib/lineage.js. lib/history.js owns capture, safe inventory, and preview authorization; lib/history-restore.js owns single-use restore-as-copy transactions. lib/trash.js owns the recycle catalog, lib/snapshot.js owns verified snapshots, and lib/recycle.js composes recycle lifecycle operations.
|
|
14
14
|
|
|
15
15
|
The browser never reads session files directly. All reads and writes go through Host routes.
|
|
16
16
|
|
|
@@ -26,6 +26,14 @@ POST /plugins/dsh-archived-chats/retention/policy
|
|
|
26
26
|
POST /plugins/dsh-archived-chats/retention/preview
|
|
27
27
|
POST /plugins/dsh-archived-chats/retention/apply
|
|
28
28
|
GET /plugins/dsh-archived-chats/lineage
|
|
29
|
+
POST /plugins/dsh-archived-chats/history/capture
|
|
30
|
+
GET /plugins/dsh-archived-chats/history
|
|
31
|
+
POST /plugins/dsh-archived-chats/history/preview
|
|
32
|
+
POST /plugins/dsh-archived-chats/history/preview/image
|
|
33
|
+
POST /plugins/dsh-archived-chats/history/restore/preview
|
|
34
|
+
POST /plugins/dsh-archived-chats/history/restore
|
|
35
|
+
POST /plugins/dsh-archived-chats/history/delete
|
|
36
|
+
POST /plugins/dsh-archived-chats/history/delete-all
|
|
29
37
|
POST /plugins/dsh-archived-chats/preview
|
|
30
38
|
POST /plugins/dsh-archived-chats/preview/image
|
|
31
39
|
POST /plugins/dsh-archived-chats/search
|
|
@@ -43,7 +51,7 @@ POST /plugins/dsh-archived-chats/delete
|
|
|
43
51
|
POST /plugins/dsh-archived-chats/delete-all
|
|
44
52
|
~~~
|
|
45
53
|
|
|
46
|
-
Every mutating route, plus
|
|
54
|
+
Every mutating route, plus preview, preview/image, search, history/preview, and history/preview/image, requires the `x-dsh-archived-chats: 1` header. `GET /history` returns only bounded safe inventory. History images require both the snapshot identity and the complete projected descriptor to match.
|
|
47
55
|
|
|
48
56
|
## State and local data
|
|
49
57
|
|
|
@@ -70,6 +78,16 @@ The preview/image authorization sequence is fixed: first require POST and `x-dsh
|
|
|
70
78
|
|
|
71
79
|
Cross-session persistence inspection is limited to four concurrent reads. A broken session is reported in `skipped` while other hits still succeed. Canonical projections use a 30-second TTL, a 64-session LRU, and a per-session cached-code-point cap; oversized sessions remain searchable but do not stay resident. Unarchive, delete, and restore invalidate affected cache entries.
|
|
72
80
|
|
|
81
|
+
## History versions and restore-as-copy
|
|
82
|
+
|
|
83
|
+
`history/capture` is called only after the browser wrapper around public `workspaces.archiveSession` succeeds. The Host enters the lifecycle queue shared with recycle and retention, rechecks archive ownership and recycle state, requires a stable Host revision for a still-live session, and reuses a healthy snapshot for the same non-null revision. The plugin does not scan unrelated active chats and performs no startup, scheduled, or background capture.
|
|
84
|
+
|
|
85
|
+
`history.js` groups published snapshots as `archived`, `recycled`, or `history-only`, inspects no more than 5,000 snapshot directories, shares one in-flight request, and caches completed inventory for 30 seconds. Inventory contains only safe title/workspace title, timestamps, sizes, attachment counts, and protection state; degraded entries expose only snapshot ID and a stable code. Paginated preview and image reads revalidate snapshot identity, digests, and complete descriptors without returning paths or raw records.
|
|
86
|
+
|
|
87
|
+
`history-restore.js` fully validates the snapshot, asks the Host for a new session ID, and issues a five-minute single-use token/nonce. Confirmation consumes the credential before writes and rechecks the manifest, then creates persistence, rewrites session/attachment identities, appends events, restores workspace and metadata, and commits archive registry state last. Failures reverse plugin-controlled steps. The source session and snapshot never change, and the plugin makes no claim that Host-global attachment objects were deleted.
|
|
88
|
+
|
|
89
|
+
Single-version deletion and **Clear history versions** both enter the shared lifecycle queue and bypass the ordinary 30-second cache/in-flight list so current snapshot and recycle-protection state is recomputed. Single deletion rejects `recycle-protection`; clear removes only healthy ordinary history and skips recycle-protection and degraded snapshots. Deletion physically removes the plugin snapshot and its attachment copies, so that version can no longer be previewed or restored, while the original chat and other versions remain unchanged.
|
|
90
|
+
|
|
73
91
|
## Export flow
|
|
74
92
|
|
|
75
93
|
The export route accepts a bounded native form request and export.js writes a versioned ZIP:
|
|
@@ -107,18 +125,18 @@ Move ordering is: validate archive ownership → dispose or park a live session
|
|
|
107
125
|
|
|
108
126
|
Restore first rejects an existing-ID conflict. With an intact original it restores archive visibility and removes only the recycle record, without rewriting persistence; the snapshot remains history. With a missing original it completes validation and attachment-identity republishing before writing through public `create` / `append` / `saveImage` capabilities. A failure rolls back the new artifact and retains trash.
|
|
109
127
|
|
|
110
|
-
Permanent purge persists `purge-pending` before physical writes, then removes the original, snapshot, and recycle record
|
|
128
|
+
Permanent purge persists `purge-pending` before physical writes, then removes the original, every validated snapshot for that source, and the recycle record. Startup recovery retries only `purge-pending`, never plain `trashed`. Legacy `pending-deletions.json` is strict read-only migration input: each still-archived ID becomes recoverable trash and is never boot-deleted merely because of the old marker.
|
|
111
129
|
|
|
112
130
|
## Browser client
|
|
113
131
|
|
|
114
132
|
client.js registers an order-30 settings.section and uses the DSH rc.7 overlay, state, and design tokens. The page state includes:
|
|
115
133
|
|
|
116
|
-
- A frame-wide archive success notice in `shell.overlay`: during its effect lifetime the plugin wraps
|
|
134
|
+
- A frame-wide archive success notice in `shell.overlay`: during its effect lifetime the plugin wraps public `workspaces.archiveSession` and starts history capture only after the original succeeds. Capture pauses the three-second dismissal; success resumes it, while failure retains retry-save without rolling back archive. View and Undo remain available.
|
|
117
135
|
- Archived sessions and workspace groups.
|
|
118
136
|
- Search, type/project/tag filters, and sorting.
|
|
119
137
|
- Tag and note editor.
|
|
120
138
|
- Selected-item export, unarchive, and move to Recycle Bin.
|
|
121
|
-
- Archived, Recycle Bin, Storage & Retention, and Origins & Branches tabs
|
|
139
|
+
- Archived, History, Recycle Bin, Storage & Retention, and Origins & Branches tabs. History requests safe inventory only on first activation and starts with groups collapsed. Snapshot preview reuses the conversation dialog with a visible snapshot timestamp. Restore confirmation focuses Cancel first and never places token/nonce in the render tree. Storage and relationship views retain on-demand loads, bounded dialogs, and read-only relationship projection.
|
|
122
140
|
- Import preview, disabled conflicts, and restore results.
|
|
123
141
|
- Responsive settings-page markers and sidebar refresh injection.
|
|
124
142
|
|
|
@@ -131,6 +149,7 @@ The browser never mutates files directly. After an operation, the Host response
|
|
|
131
149
|
## Security and failure policy
|
|
132
150
|
|
|
133
151
|
- All state-changing routes require POST and the guard header.
|
|
152
|
+
- History responses exclude workspace/snapshot/attachment paths, raw events, notes, and confirmation tokens; logs contain only IDs and stable codes.
|
|
134
153
|
- Import limits ZIP size, entries, paths, versions, and JSON structure, rejecting traversal, duplicates, and prototype-pollution keys.
|
|
135
154
|
- Ordinary delete never invokes physical purge; only a committed recycle record can enter purge.
|
|
136
155
|
- Snapshot and recycle documents use `0600`, directories use `0700`, and publication is temporary write, sync, atomic rename.
|
|
@@ -139,7 +158,7 @@ The browser never mutates files directly. After an operation, the Host response
|
|
|
139
158
|
|
|
140
159
|
## Compatibility and testing
|
|
141
160
|
|
|
142
|
-
|
|
161
|
+
Version 1.0.0 has been verified in a DeepSeek Harness 0.1.1-rc.2 Web profile for loading, 30-route registration, safe empty history inventory, and capability degradation. That Host does not expose the writer required by import/history restore, which therefore returns `501 restore-unsupported` without mutation. Version 0.12 uses the same version-one manifest and can validate, retain, and purge 1.0 snapshots, but it does not expose History or restore-as-copy. Back up the complete plugin-data directory before downgrading.
|
|
143
162
|
|
|
144
163
|
Coverage includes:
|
|
145
164
|
|
|
@@ -151,6 +170,7 @@ Coverage includes:
|
|
|
151
170
|
- search.js message projection, Unicode search, pagination, partial failures, and TTL/LRU caching.
|
|
152
171
|
- trash.js, snapshot.js, and recycle.js format validation, concurrency, recovery, rollback, crash intent, and legacy migration.
|
|
153
172
|
- insights.js, retention.js, retention-service.js, and lineage.js trusted accounting, policy bounds, short-lived authority, revalidation, and bounded graph projection.
|
|
173
|
+
- history.js and history-restore.js revision deduplication, cache invalidation, snapshot authorization, single-use confirmation, transaction rollback, and source immutability.
|
|
154
174
|
- Host routes and browser settings smoke/responsive behavior.
|
|
155
175
|
|
|
156
176
|
Run:
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
插件由 Host 服务层和浏览器客户端两部分组成:
|
|
10
10
|
|
|
11
11
|
- Host 服务层位于 lib/index.js,运行在 DSH Web 宿主中,读取工作区注册表和会话持久层,并提供本地 HTTP 路由。
|
|
12
|
-
- 浏览器客户端位于 lib/client.js,通过 settings.section
|
|
13
|
-
- 纯领域逻辑拆分在 lib/export.js、lib/import.js、lib/restore.js、lib/metadata.js、lib/search.js、lib/stats.js、lib/insights.js、lib/retention.js、lib/retention-service.js 和 lib/lineage.js 中。lib/trash.js 负责版本化回收目录,lib/snapshot.js
|
|
12
|
+
- 浏览器客户端位于 lib/client.js,通过 settings.section 注册「会话档案」设置页,负责展示状态和发起操作。
|
|
13
|
+
- 纯领域逻辑拆分在 lib/export.js、lib/import.js、lib/restore.js、lib/metadata.js、lib/search.js、lib/stats.js、lib/insights.js、lib/retention.js、lib/retention-service.js 和 lib/lineage.js 中。lib/history.js 负责历史抓取、安全清单和预览授权,lib/history-restore.js 负责单次确认的恢复为副本事务。lib/trash.js 负责版本化回收目录,lib/snapshot.js 负责可验证快照,lib/recycle.js 组合回收生命周期。
|
|
14
14
|
|
|
15
15
|
浏览器不直接访问会话文件。所有读取和写入都经 Host 路由完成。
|
|
16
16
|
|
|
@@ -26,6 +26,14 @@ POST /plugins/dsh-archived-chats/retention/policy
|
|
|
26
26
|
POST /plugins/dsh-archived-chats/retention/preview
|
|
27
27
|
POST /plugins/dsh-archived-chats/retention/apply
|
|
28
28
|
GET /plugins/dsh-archived-chats/lineage
|
|
29
|
+
POST /plugins/dsh-archived-chats/history/capture
|
|
30
|
+
GET /plugins/dsh-archived-chats/history
|
|
31
|
+
POST /plugins/dsh-archived-chats/history/preview
|
|
32
|
+
POST /plugins/dsh-archived-chats/history/preview/image
|
|
33
|
+
POST /plugins/dsh-archived-chats/history/restore/preview
|
|
34
|
+
POST /plugins/dsh-archived-chats/history/restore
|
|
35
|
+
POST /plugins/dsh-archived-chats/history/delete
|
|
36
|
+
POST /plugins/dsh-archived-chats/history/delete-all
|
|
29
37
|
POST /plugins/dsh-archived-chats/preview
|
|
30
38
|
POST /plugins/dsh-archived-chats/preview/image
|
|
31
39
|
POST /plugins/dsh-archived-chats/search
|
|
@@ -43,7 +51,7 @@ POST /plugins/dsh-archived-chats/delete
|
|
|
43
51
|
POST /plugins/dsh-archived-chats/delete-all
|
|
44
52
|
~~~
|
|
45
53
|
|
|
46
|
-
所有修改路由以及会返回对话内容的 preview、preview/image、search 路由都要求 `x-dsh-archived-chats: 1`
|
|
54
|
+
所有修改路由以及会返回对话内容的 preview、preview/image、search、history/preview 和 history/preview/image 路由都要求 `x-dsh-archived-chats: 1` 请求头。`GET /history` 只返回有界安全清单;历史图片只在快照身份与完整描述符同时匹配时返回。
|
|
47
55
|
|
|
48
56
|
## 状态和本地数据
|
|
49
57
|
|
|
@@ -70,6 +78,16 @@ preview/image 的授权顺序固定为:先验证 POST 和 `x-dsh-archived-chat
|
|
|
70
78
|
|
|
71
79
|
跨会话搜索的持久层读取并发上限为 4;单个会话失败会记入 skipped,其他命中仍正常返回。规范投影使用 30 秒 TTL、64 会话 LRU 和单会话最大缓存字符数保护内存;超大会话仍可搜索,但不会常驻缓存。取消归档、删除和恢复会使相关缓存失效。
|
|
72
80
|
|
|
81
|
+
## 历史版本与恢复为副本
|
|
82
|
+
|
|
83
|
+
`history/capture` 只在浏览器包装的公开 `workspaces.archiveSession` 成功后调用。Host 进入与回收/保留共用的生命周期队列,重新检查归档所有权与回收状态,为仍存活的会话要求稳定 Host 修订,并复用同一非空修订的健康快照。插件不扫描无关活动会话,不在启动、定时器或后台自动抓取。
|
|
84
|
+
|
|
85
|
+
`history.js` 将已发布快照分组为 `archived` / `recycled` / `history-only`,单次最多检查 5,000 个快照目录,共用进行中请求并缓存已完成结果 30 秒。清单只含安全标题/工作区标题、时间、大小、附件数和保护状态;降级项只显示快照 ID 与稳定代码。分页预览与图片读取每次都重新验证快照、摘要和完整描述符,不返回路径或原始记录。
|
|
86
|
+
|
|
87
|
+
`history-restore.js` 先完整验证快照,用 Host 生成新会话 ID,再签发五分钟、单次使用的 token/nonce。确认时先消费凭据并重验 manifest;然后依次创建持久会话、重写会话/附件身份、附加事件、恢复工作区和元数据,最后才写入归档注册表。任一插件控制的边界失败都按逆序回滚;来源会话与快照始终不变,也不声称删除了 Host 全局附件对象。
|
|
88
|
+
|
|
89
|
+
历史页的单条删除与「清空历史版本」都进入共用生命周期队列,并绕过普通 30 秒缓存/进行中请求,重新计算当前快照与回收保护关系。单条删除拒绝 `recycle-protection`;清空只删除健康普通历史,跳过回收保护和降级快照。删除会物理移除插件快照及其附件副本,无法再预览或恢复,但不修改原聊天或其他版本。
|
|
90
|
+
|
|
73
91
|
## 导出流程
|
|
74
92
|
|
|
75
93
|
export 路由接收有界的原生表单请求,由 export.js 生成版本化 ZIP:
|
|
@@ -107,18 +125,18 @@ import/inspect 只接受本插件版本一导出的 ZIP。Host 会有界读取
|
|
|
107
125
|
|
|
108
126
|
恢复先检查同 ID 冲突。原会话完好时只恢复归档可见性并移除回收记录,不重写持久层,保护快照保留为历史;原件丢失时先完成所有校验和附件身份重发,然后仅通过公开 `create` / `append` / `saveImage` 能力写入。失败会回滚新建件并保留回收记录。
|
|
109
127
|
|
|
110
|
-
永久删除在任何物理写入前持久化 `purge-pending
|
|
128
|
+
永久删除在任何物理写入前持久化 `purge-pending`,再删除原会话、该来源的全部已验证快照和回收记录。启动恢复仅重试 `purge-pending`,从不删除普通 `trashed`。旧 `pending-deletions.json` 是严格、只读的迁移输入:每个仍归档的 ID 都转成可恢复回收记录,绝不因旧标记在启动时直接删除。
|
|
111
129
|
|
|
112
130
|
## 浏览器客户端
|
|
113
131
|
|
|
114
132
|
client.js 注册 order 30 的 settings.section,并使用 DSH rc.7 的浮层、状态和设计令牌。页面状态包括:
|
|
115
133
|
|
|
116
|
-
- `shell.overlay` 中的归档成功提示:插件在 effect 生命周期内包装公开的 `workspaces.archiveSession
|
|
134
|
+
- `shell.overlay` 中的归档成功提示:插件在 effect 生命周期内包装公开的 `workspaces.archiveSession`,只在原调用成功后发起历史抓取。抓取进行时暂停 3 秒关闭计时,成功后恢复,失败时显示不回滚归档的重试保存;查看与撤销继续可用。
|
|
117
135
|
- 归档列表和工作区分组。
|
|
118
136
|
- 搜索、类型/项目/标签筛选和排序。
|
|
119
137
|
- 标签备注编辑器。
|
|
120
138
|
- 选中项批量导出、取消归档和移入回收站。
|
|
121
|
-
-
|
|
139
|
+
- 归档、历史版本、回收站、空间与策略、来源与分支五标签。历史首次激活才请求安全清单,会话组默认折叠;预览复用对话弹窗并显示快照时间,恢复确认的初始焦点位于取消,token/nonce 不进入渲染树。其他空间与关系视图保留按需加载、有界弹窗和只读关系投影。
|
|
122
140
|
- 导入预览、冲突禁用和恢复结果。
|
|
123
141
|
- 响应式设置页标记和侧边栏刷新注入面。
|
|
124
142
|
|
|
@@ -131,6 +149,7 @@ client.js 注册 order 30 的 settings.section,并使用 DSH rc.7 的浮层、
|
|
|
131
149
|
## 安全和失败策略
|
|
132
150
|
|
|
133
151
|
- 所有状态变更路由都要求 POST 和 guard header。
|
|
152
|
+
- 历史响应不包含工作区/快照/附件路径、原始事件、备注或确认 token;日志只记 ID 和稳定代码。
|
|
134
153
|
- 导入限制 ZIP 大小、条目数量、路径格式、版本和 JSON 结构,拒绝遍历、重复和原型污染字段。
|
|
135
154
|
- 普通删除从不调用物理清除;仅已提交回收记录可进入 purge。
|
|
136
155
|
- 快照和回收文件使用 `0600`,目录使用 `0700`,发布为临时写入、sync、原子 rename。
|
|
@@ -139,7 +158,7 @@ client.js 注册 order 30 的 settings.section,并使用 DSH rc.7 的浮层、
|
|
|
139
158
|
|
|
140
159
|
## 兼容性和测试
|
|
141
160
|
|
|
142
|
-
0.
|
|
161
|
+
1.0.0 已在 DeepSeek Harness 0.1.1-rc.2 Web profile 中验证加载、30 路由注册、安全空历史清单和能力降级。该 Host 未公开导入/历史恢复所需 writer,因此以 `501 restore-unsupported` 无写入失败。0.12 使用相同 version 1 manifest,能校验、保留和清理 1.0 快照,但不显示历史页或恢复为副本;降级前应备份整个插件数据目录。
|
|
143
162
|
|
|
144
163
|
测试覆盖:
|
|
145
164
|
|
|
@@ -151,6 +170,7 @@ client.js 注册 order 30 的 settings.section,并使用 DSH rc.7 的浮层、
|
|
|
151
170
|
- search.js 的消息投影、Unicode 搜索、分页、部分失败与 TTL/LRU 缓存。
|
|
152
171
|
- trash.js、snapshot.js 和 recycle.js 的格式验证、并发、恢复、回滚、崩溃意图和旧标记迁移。
|
|
153
172
|
- insights.js、retention.js、retention-service.js 和 lineage.js 的可信分账、策略边界、短效授权、重检和有界图投影。
|
|
173
|
+
- history.js 和 history-restore.js 的修订去重、缓存失效、快照授权、单次确认、事务回滚与来源不变式。
|
|
154
174
|
- Host 路由和浏览器设置页的冒烟及响应式行为。
|
|
155
175
|
|
|
156
176
|
运行:
|