dsh-archived-chats 0.11.0 → 0.12.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.
Files changed (39) hide show
  1. package/README.en.md +63 -17
  2. package/README.md +63 -17
  3. package/assets/screenshots/01-archive-entry.png +0 -0
  4. package/assets/screenshots/01b-archive-success.png +0 -0
  5. package/assets/screenshots/02-archived-overview.png +0 -0
  6. package/assets/screenshots/03-full-text-search.png +0 -0
  7. package/assets/screenshots/04-conversation-preview.png +0 -0
  8. package/assets/screenshots/05-metadata-editor.png +0 -0
  9. package/assets/screenshots/06-bulk-selection.png +0 -0
  10. package/assets/screenshots/07-import-preview.png +0 -0
  11. package/assets/screenshots/08-move-undo.png +0 -0
  12. package/assets/screenshots/09-recycle-restore.png +0 -0
  13. package/assets/screenshots/10-permanent-delete.png +0 -0
  14. package/assets/screenshots/11-storage-retention.png +0 -0
  15. package/assets/screenshots/12-storage-details.png +0 -0
  16. package/assets/screenshots/13-retention-preview.png +0 -0
  17. package/assets/screenshots/14-origins-branches.png +0 -0
  18. package/docs/ARCHITECTURE.en.md +15 -5
  19. package/docs/ARCHITECTURE.md +15 -5
  20. package/lib/client.js +929 -12
  21. package/lib/index.js +165 -3
  22. package/lib/insights.js +190 -0
  23. package/lib/lineage.js +247 -0
  24. package/lib/recycle.js +16 -8
  25. package/lib/retention-service.js +217 -0
  26. package/lib/retention.js +263 -0
  27. package/lib/snapshot.js +92 -1
  28. package/lib/types/client/index.d.ts +108 -2
  29. package/lib/types/index.d.ts +107 -1
  30. package/package.json +12 -2
  31. package/assets/screenshots/1-archived-chats.png +0 -0
  32. package/assets/screenshots/2-search.png +0 -0
  33. package/assets/screenshots/3-delete-confirm.png +0 -0
  34. package/assets/screenshots/4-group-menu.png +0 -0
  35. package/assets/screenshots/5-metadata-editor.png +0 -0
  36. package/assets/screenshots/6-bulk-actions.png +0 -0
  37. package/assets/screenshots/7-import-preview.png +0 -0
  38. package/assets/screenshots/8-conversation-preview.png +0 -0
  39. package/assets/screenshots/9-recycle-bin.png +0 -0
package/README.en.md CHANGED
@@ -1,15 +1,31 @@
1
1
  # dsh-archived-chats
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/dsh-archived-chats)](https://www.npmjs.com/package/dsh-archived-chats)
4
+ [![npm downloads](https://img.shields.io/npm/dm/dsh-archived-chats)](https://www.npmjs.com/package/dsh-archived-chats)
5
+ [![CI](https://github.com/Ultronen/dsh-archived-chats/actions/workflows/ci.yml/badge.svg)](https://github.com/Ultronen/dsh-archived-chats/actions/workflows/ci.yml)
6
+ [![Awesome DSH Plugin](https://awesome-dsh-plugin.com/badge.svg)](https://awesome-dsh-plugin.com/p/Ultronen/dsh-archived-chats/)
7
+
3
8
  [English](README.en.md) | [中文](README.md)
4
9
 
5
10
  > 🔎 **Archived no longer means lost.** Search conversation content, read complete messages and tool calls, then back up, restore, or delete safely.
6
11
 
7
- > ♻️ **Ordinary deletion is now undoable.** The plugin first creates a local protection 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.
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.
8
13
 
9
- A local conversation archive center for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness): recover, search, read, back up, restore, or delete archived sessions.
14
+ A local archived-chat manager for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness): search and preview complete conversations, back up and restore sessions, and safely manage history with an undoable Recycle Bin, recovery snapshots, retention policies, and Origins & Branches.
10
15
 
11
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 an **Archived Chats** page under Settings where every archived session is visible, searchable, and manageable.
12
17
 
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
+
20
+ <p align="center">
21
+ <a href="assets/screenshots/04-conversation-preview.png"><img src="assets/screenshots/04-conversation-preview.png" width="49%" alt="Full-text search and read-only preview for archived chats"></a>
22
+ <a href="assets/screenshots/11-storage-retention.png"><img src="assets/screenshots/11-storage-retention.png" width="49%" alt="Storage and Retention with session directories, recovery snapshots, and policy controls"></a>
23
+ </p>
24
+
25
+ <p align="center"><sub>Search and read without unarchiving first; removing an archived chat here moves it through a recovery-snapshot Recycle Bin.</sub></p>
26
+
27
+ If this plugin helps you recover or protect an important conversation, consider starring the repository so people who need archived-chat recovery can discover it more easily.
28
+
13
29
  ## 🚀 Install
14
30
 
15
31
  ```sh
@@ -26,32 +42,41 @@ dsh plugin --profile web update dsh-archived-chats
26
42
 
27
43
  ## Compatibility
28
44
 
29
- The full 0.11.0 feature target is DeepSeek Harness `0.1.1-rc.2`. Older hosts can still expose the archive list, but a missing persistence, attachment, or live-session lifecycle capability produces an explicit capability error instead of guessed internal writes or an incomplete snapshot. The v0.9.0 UI was checked on Harness `0.1.0-rc.8`; v0.10.0 search, preview, and stored-image reads were checked on `0.1.1-rc.2`.
45
+ The full 0.12.0 feature target is DeepSeek Harness `0.1.1-rc.2`. Older hosts can still expose the archive list, but missing persistence, attachment, or live-session lifecycle capabilities produce explicit errors for recycle, storage, or lineage features instead of guessed internal writes.
30
46
 
31
47
  ## Preview
32
48
 
33
- Screenshots 1–7 were captured from 0.9.0 in a local DeepSeek Harness `0.1.0-rc.8` web profile. The archived preview is from 0.10.0 and the Recycle Bin is from 0.11.0, both captured in an isolated real DeepSeek Harness `0.1.1-rc.2` host.
34
-
35
- ![Archived Chats overview](assets/screenshots/1-archived-chats.png)
36
- ![Search and filters](assets/screenshots/2-search.png)
37
- ![Read-only archived conversation preview](assets/screenshots/8-conversation-preview.png)
38
- ![Recycle Bin with automatic protection snapshot](assets/screenshots/9-recycle-bin.png)
39
- ![Group actions](assets/screenshots/4-group-menu.png)
40
- ![Metadata editor](assets/screenshots/5-metadata-editor.png)
41
- ![Bulk actions](assets/screenshots/6-bulk-actions.png)
42
- ![Import preview](assets/screenshots/7-import-preview.png)
49
+ These screenshots cover the current `0.12.0` feature set. They were 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 order follows the complete release path from archive entry, search, and preview through recycle recovery, storage governance, and Origins & Branches.
50
+
51
+ ![Archive a conversation from its session menu](assets/screenshots/01-archive-entry.png)
52
+ ![Three-second archive success notice](assets/screenshots/01b-archive-success.png)
53
+ ![Archived Chats overview](assets/screenshots/02-archived-overview.png)
54
+ ![Full-text conversation and tool-result search](assets/screenshots/03-full-text-search.png)
55
+ ![Read-only archived conversation preview](assets/screenshots/04-conversation-preview.png)
56
+ ![Tags and notes editor](assets/screenshots/05-metadata-editor.png)
57
+ ![On-demand bulk selection](assets/screenshots/06-bulk-selection.png)
58
+ ![Import backup preview](assets/screenshots/07-import-preview.png)
59
+ ![Undo notice after moving a chat to Recycle Bin](assets/screenshots/08-move-undo.png)
60
+ ![Recycle Bin with recovery snapshots and restore actions](assets/screenshots/09-recycle-restore.png)
61
+ ![Permanent deletion confirmation for the chat and protection snapshot](assets/screenshots/10-permanent-delete.png)
62
+ ![Storage and Retention overview](assets/screenshots/11-storage-retention.png)
63
+ ![Protection snapshot details](assets/screenshots/12-storage-details.png)
64
+ ![Retention cleanup preview](assets/screenshots/13-retention-preview.png)
65
+ ![Origins & Branches relationship view](assets/screenshots/14-origins-branches.png)
43
66
 
44
67
  ## Usage
45
68
 
46
- 1. Archive a conversation from the normal DSH session menu. Archiving removes it from the sidebar but keeps its session data in the workspace store.
69
+ 1. Archive a conversation from the normal DSH session menu. After the Host confirms success, a **Chat archived** notice appears at the top for three seconds with direct **View** and **Undo** actions; hovering or focusing it pauses the timer. Archiving removes the chat from the sidebar but keeps its session data in the workspace store.
47
70
  2. Open **Settings → Archived Chats**. The page groups archived conversations by workspace and remembers collapsed groups in this browser.
48
71
  3. Search titles, tags, notes, conversation text, or tool output. Open the row preview to read an archived conversation without unarchiving it. Click **Select multiple** only when you need bulk actions.
49
72
  4. Click **Import backup** to choose a ZIP produced by this plugin and confirm non-conflicting sessions after the preview. Click **Export backup** to export the current selection, or every archived chat when nothing is selected. Individual rows also have an export action.
50
73
  5. Choose **Unarchive** to return a conversation to the sidebar. **Move to Recycle Bin** creates a protection snapshot and offers immediate **Undo**; the session can also be restored later from the **Recycle Bin** tab. Only **Delete permanently / Empty Recycle Bin** removes originals and snapshots irreversibly.
74
+ 6. Open **Storage & Retention** to measure archived/recycled session directories and recovery snapshots this plugin created and retained for them. Restoring a chat may retain its snapshot, so storage can remain when the archive list is empty. Counts apply separately to each original chat; saving performs no cleanup until exact candidates are previewed and applied. **Origins & Branches** uses a collapsible connector tree to show where archived/recycled chats came from and which sessions branched from them, with project filtering and search.
51
75
 
52
76
  ## Features
53
77
 
54
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
+ - **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.
55
80
  - **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.
56
81
  - **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.
57
82
  - **Filter and sort** by type (all / regular / subagent), project, and tag; then order results by newest, oldest, or title.
@@ -62,8 +87,11 @@ Screenshots 1–7 were captured from 0.9.0 in a local DeepSeek Harness `0.1.0-rc
62
87
  - **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.
63
88
  - **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.
64
89
  - **Unarchive** a single chat or a whole project group from the group's `⋯` menu — restored chats reappear in the sidebar immediately.
65
- - **Archived / Recycle Bin tabs**: recycled rows stay grouped by their original workspace, each group can collapse independently, and rows show trash time, snapshot size, attachment count, and `trashed` / `degraded` / `purge-pending` state. Checkboxes stay hidden until **Select multiple** is activated.
66
- - **Automatic protection snapshots**: moving a session captures all conversation events plus verified stored-image bytes before the recycle record commits. One current protection snapshot is kept per session; 0.11 does not provide historical retention or conversation-tree restoration.
90
+ - **Four archive-management views**: Archived, Recycle Bin, Storage & Retention, and Origins & Branches. Recycled rows stay grouped by their original workspace, each group can collapse independently, and rows show trash time, snapshot size, attachment count, and `trashed` / `degraded` / `purge-pending` state. Checkboxes stay hidden until **Select multiple** is activated.
91
+ - **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
+ - **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 are diagnosed without rewriting relationships.
94
+ - **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.
67
95
  - **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.
68
96
  - **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.
69
97
  - Works in light and dark schemes; localized in English and 中文.
@@ -72,6 +100,8 @@ Screenshots 1–7 were captured from 0.9.0 in a local DeepSeek Harness `0.1.0-rc
72
100
 
73
101
  The recycle catalog (`trash.json`) and 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; neither conversations nor attachments are uploaded. Recycle previews use a separate authorized scope.
74
102
 
103
+ 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
+
75
105
  Permanent purge removes the snapshot's attachment copies, 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.
76
106
 
77
107
  ## Tags, notes, and statistics
@@ -126,6 +156,13 @@ Yes. The success notice includes **Undo**, and the Recycle Bin keeps a Restore a
126
156
 
127
157
  </details>
128
158
 
159
+ <details>
160
+ <summary><b>Why are recovery snapshots shown when there are no archived chats?</b></summary>
161
+
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. The default keeps one snapshot per original chat. To remove them, set the count to `0`, save, then run **Preview cleanup → Apply selected cleanup**. Saving alone never deletes data.
163
+
164
+ </details>
165
+
129
166
  ## Implementation overview
130
167
 
131
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.
@@ -142,6 +179,15 @@ The suite (`test/*.test.mjs`) covers export records and real ZIP decoding, bound
142
179
 
143
180
  ## Version history
144
181
 
182
+ ### 0.12.0
183
+
184
+ - Added a three-second top notice after archive success, with direct View and Undo, hover/focus pause, and retryable failures.
185
+ - Added separate session/snapshot accounting, repeated snapshot-attachment totals, and unavailable/degraded diagnostics.
186
+ - Added count/age/quota retention planning with separate save/apply, short-lived single-use previews, and execution-time revalidation.
187
+ - Added a read-only Origins & Branches tree scoped to archived/recycled chats and necessary relationship context, with diagnostics for missing parents, cycles, and delegation-depth anomalies.
188
+ - Recycle cycles retain prior valid snapshots; permanent purge still removes the original and every valid snapshot through `purge-pending`.
189
+ - **Downgrade warning:** 0.11.x does not display or govern multiple histories, though it tolerates them and removes them on permanent purge. Back up `$DSH_HOME/plugin-data/archived-chats/` before downgrading.
190
+
145
191
  ### 0.11.0
146
192
 
147
193
  - Added persistent **Archived / Recycle Bin** tabs, independent recycle selection, trash-scoped preview, restore, permanent purge, and empty actions.
@@ -217,7 +263,7 @@ The suite (`test/*.test.mjs`) covers export records and real ZIP decoding, bound
217
263
  dsh plugin --profile web remove dsh-archived-chats
218
264
  ```
219
265
 
220
- Uninstalling does not remove `metadata.json`, `trash.json`, protection snapshots, or a legacy `pending-deletions.json` under `$DSH_HOME/plugin-data/archived-chats/`, and it never triggers permanent purge. Restore or back up anything you need before manually handling that directory.
266
+ Uninstalling does not remove `metadata.json`, `trash.json`, `retention.json`, protection snapshots, or a legacy `pending-deletions.json` under `$DSH_HOME/plugin-data/archived-chats/`, and it never triggers permanent purge. Restore or back up anything you need before manually handling that directory.
221
267
 
222
268
  ## License
223
269
 
package/README.md CHANGED
@@ -1,15 +1,31 @@
1
1
  # dsh-archived-chats
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/dsh-archived-chats)](https://www.npmjs.com/package/dsh-archived-chats)
4
+ [![npm downloads](https://img.shields.io/npm/dm/dsh-archived-chats)](https://www.npmjs.com/package/dsh-archived-chats)
5
+ [![CI](https://github.com/Ultronen/dsh-archived-chats/actions/workflows/ci.yml/badge.svg)](https://github.com/Ultronen/dsh-archived-chats/actions/workflows/ci.yml)
6
+ [![Awesome DSH Plugin](https://awesome-dsh-plugin.com/badge.svg)](https://awesome-dsh-plugin.com/p/Ultronen/dsh-archived-chats/)
7
+
3
8
  [English](README.en.md) | 中文
4
9
 
5
10
  > 🔎 **归档不再等于消失。** 直接搜索聊天正文、阅读完整对话和工具调用,然后安全备份、恢复或删除。
6
11
 
7
- > ♻️ **普通删除现在可撤销。** 插件会先创建包含会话与附件的本地保护快照,再移入回收站;只有在回收站中明确选择「永久删除」才会物理清除。
12
+ > ♻️ **在本插件中移除归档聊天可以撤销。** 插件会先创建包含会话与附件的本地恢复快照,再移入回收站;只有在回收站中明确选择「永久删除」才会物理清除。
8
13
 
9
- 为 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 新增一个本地会话归档中心:找回、搜索、阅读、备份、恢复或删除被归档的会话。
14
+ 为 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 新增一个本地归档聊天中心:搜索和预览完整对话,备份与恢复会话,并通过可撤销回收站、恢复快照、保留策略及来源与分支安全管理历史聊天。
10
15
 
11
16
  在 DeepSeek Harness 里,聊天一旦归档就会从侧边栏消失,界面中没有任何入口可以再看到它,只有工作区存档(`~/.dsh/storages/workspace.json`)还记得它。这个插件在「设置」中补上一个「已归档的聊天」页面,让所有归档会话都可见、可搜索、可管理。
12
17
 
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
+
20
+ <p align="center">
21
+ <a href="assets/screenshots/04-conversation-preview.png"><img src="assets/screenshots/04-conversation-preview.png" width="49%" alt="归档聊天正文搜索与只读对话预览"></a>
22
+ <a href="assets/screenshots/11-storage-retention.png"><img src="assets/screenshots/11-storage-retention.png" width="49%" alt="空间与策略中的会话目录、恢复快照和保留策略"></a>
23
+ </p>
24
+
25
+ <p align="center"><sub>无需先取消归档即可搜索和阅读;从本插件移除归档聊天时会先进入带恢复快照的回收站。</sub></p>
26
+
27
+ 如果它帮你找回或保护过一次重要对话,欢迎给仓库一个 Star——这能帮助真正需要归档恢复功能的用户更容易发现它。
28
+
13
29
  ## 🚀 安装
14
30
 
15
31
  ```sh
@@ -26,32 +42,41 @@ dsh plugin --profile web update dsh-archived-chats
26
42
 
27
43
  ## 兼容性
28
44
 
29
- 0.11.0 的完整功能目标是 DeepSeek Harness `0.1.1-rc.2`。较旧宿主仍可使用归档列表,但缺少持久层、附件或运行中会话生命周期能力时,回收操作会返回明确的能力错误,不会猜测宿主内部结构或写入不完整快照。v0.9.0 界面已在 Harness `0.1.0-rc.8` 复核;v0.10.0 搜索、预览和图片读取已在 `0.1.1-rc.2` 复核。
45
+ 0.12.0 的完整功能目标是 DeepSeek Harness `0.1.1-rc.2`。较旧宿主仍可使用归档列表,但缺少持久层、附件或运行中会话生命周期能力时,回收、空间分析或血缘功能会返回明确的能力错误,不会猜测宿主内部结构或写入不完整数据。
30
46
 
31
47
  ## 预览
32
48
 
33
- 截图 1–7 来自 `0.9.0` 在本地 DeepSeek Harness `0.1.0-rc.8` Web profile 中的实际操作;归档对话预览来自 `0.10.0`,回收站来自 `0.11.0`,两者都在 DeepSeek Harness `0.1.1-rc.2` 隔离真实宿主中捕获。
34
-
35
- ![已归档的聊天总览](assets/screenshots/1-archived-chats.png)
36
- ![搜索与筛选](assets/screenshots/2-search.png)
37
- ![归档对话只读预览](assets/screenshots/8-conversation-preview.png)
38
- ![回收站与自动保护快照](assets/screenshots/9-recycle-bin.png)
39
- ![分组操作](assets/screenshots/4-group-menu.png)
40
- ![标签与备注编辑](assets/screenshots/5-metadata-editor.png)
41
- ![批量操作](assets/screenshots/6-bulk-actions.png)
42
- ![导入预览](assets/screenshots/7-import-preview.png)
49
+ 以下截图均来自当前 `0.12.0` 功能,在隔离的真实 DeepSeek Harness `0.1.1-rc.2` 中文浅色 Web profile 中捕获,只使用合成演示会话,不包含真实用户数据。截图顺序对应从归档入口、搜索与预览,到回收、空间治理和来源分支的完整发布路径。
50
+
51
+ ![从会话菜单点击归档](assets/screenshots/01-archive-entry.png)
52
+ ![归档成功后的三秒提示](assets/screenshots/01b-archive-success.png)
53
+ ![已归档的聊天总览](assets/screenshots/02-archived-overview.png)
54
+ ![聊天正文与工具结果全文搜索](assets/screenshots/03-full-text-search.png)
55
+ ![归档对话只读预览](assets/screenshots/04-conversation-preview.png)
56
+ ![标签与备注编辑](assets/screenshots/05-metadata-editor.png)
57
+ ![按需批量选择](assets/screenshots/06-bulk-selection.png)
58
+ ![导入归档备份预览](assets/screenshots/07-import-preview.png)
59
+ ![移至回收站后的撤销提示](assets/screenshots/08-move-undo.png)
60
+ ![回收站中的恢复快照与恢复操作](assets/screenshots/09-recycle-restore.png)
61
+ ![永久删除会话与保护快照确认](assets/screenshots/10-permanent-delete.png)
62
+ ![空间与策略概览](assets/screenshots/11-storage-retention.png)
63
+ ![保护快照明细](assets/screenshots/12-storage-details.png)
64
+ ![保留策略清理预览](assets/screenshots/13-retention-preview.png)
65
+ ![来源与分支关系视图](assets/screenshots/14-origins-branches.png)
43
66
 
44
67
  ## 使用流程
45
68
 
46
- 1. 在 DSH 正常聊天的会话菜单中点击归档。归档只会把会话从侧边栏隐藏,工作区存档仍会保留会话数据。
69
+ 1. 在 DSH 正常聊天的会话菜单中点击归档。宿主确认成功后,页面顶部会显示 3 秒的 **已归档的聊天** 提示,可立即 **查看** 归档中心或 **撤销**;悬停或键盘聚焦时计时暂停。归档只会把会话从侧边栏隐藏,工作区存档仍会保留会话数据。
47
70
  2. 打开 **设置 → 已归档的聊天**。页面按工作区分组,并在当前浏览器中记住分组的折叠状态。
48
71
  3. 搜索标题、标签、备注、聊天正文或工具结果;点击行内预览按钮可直接阅读归档对话,无需先取消归档。需要多选时点击 **批量选择** 显示复选框。
49
72
  4. 点击顶部 **导入备份** 选择本插件导出的 ZIP,预览后确认无冲突会话;点击 **导出备份** 导出当前选中项,未选择时导出全部归档会话。单条会话也可以从行内操作导出。
50
73
  5. 点击 **取消归档** 将会话放回侧边栏;点击 **移至回收站** 会创建保护快照,可立即点击 **撤销**,也可稍后在 **回收站** 标签恢复。只有回收站中的 **永久删除 / 清空回收站** 会不可撤销地移除原会话和快照。
74
+ 6. 打开 **空间与策略** 查看归档/回收站会话目录,以及本插件为它们创建并保留的恢复快照。恢复聊天后快照仍可保留,所以归档列表为空时这里仍可能有数据。保留数量按每个原会话分别计算;保存策略不会执行清理,必须再预览并确认具体候选。**来源与分支** 用可折叠的连接线分支树只读展示已归档/回收站会话从哪里产生、又分出了哪些会话,并可按项目筛选或搜索。
51
75
 
52
76
  ## 功能
53
77
 
54
78
  - **完整归档列表**:按工作区(项目)分组并显示每组数量;每个分组都可折叠/展开,状态按浏览器记忆。
79
+ - **归档成功提示**:会话归档成功后,在 DSH 全局浮层显示 3 秒的紧凑提示,提供 **查看**、**撤销** 和关闭操作;鼠标悬停或键盘聚焦会暂停计时,查看/撤销进行中不会自动消失,失败时保留重试入口。
55
80
  - **聊天正文全文搜索**:同一个搜索框同时匹配标题、项目、标签、备注、用户消息、助手回答与工具结果,并在结果行显示命中摘要。
56
81
  - **原生归档对话预览与轮次导航**:沿用 Harness 会话布局,用户消息靠右、助手消息靠左;以只读方式展示 Markdown、思考过程、工具活动、JSON、代码和可用的已存储图片,并保留可快速跳转的响应式轮次轨道。宿主缺少附件能力时只影响图片,其他预览内容仍可阅读。
57
82
  - **筛选与排序**:用类型(全部 / 普通会话 / 子代理会话)、项目和标签筛选,并按最新、最早或标题排序。
@@ -62,8 +87,11 @@ dsh plugin --profile web update dsh-archived-chats
62
87
  - **紧凑顶部操作**:常用的 **导入备份** / **导出备份** 直接可用,低频危险操作收纳在 **更多**;页面专注于 DSH 归档管理,不常驻来源选择器或冗余菜单。
63
88
  - **按需多选**:复选框默认隐藏,点击 **批量选择** 后才显示;可逐条选择、选择当前筛选结果或整个项目。选中后可一次导出、取消归档或移至回收站,隐藏在其他筛选结果中的选择不会丢失。
64
89
  - **取消归档**单个聊天,或从分组的 `⋯` 菜单整组取消——恢复的聊天会立刻回到侧边栏。
65
- - **归档 / 回收站双标签**:回收站按原工作区分组并可独立折叠,显示移入时间、快照大小、附件数和 `trashed` / `degraded` / `purge-pending` 状态;复选框默认隐藏,点击 **批量选择** 后才显示。
66
- - **自动保护快照**:移入回收站前保存完整会话事件和经校验的图片附件字节。每个会话只保留一个当前保护快照;本版不提供按时间的多代保留或会话树恢复。
90
+ - **四个归档管理视图**:归档、回收站、空间与策略、来源与分支。回收站按原工作区分组并可独立折叠,显示移入时间、快照大小、附件数和 `trashed` / `degraded` / `purge-pending` 状态;复选框默认隐藏,点击 **批量选择** 后才显示。
91
+ - **空间分析**:分别统计归档/回收会话目录与插件保护快照,标出无法统计项、降级快照和重复快照附件字节;会话目录与快照明细从摘要卡片进入可搜索弹窗,不会把保留策略持续向下推,也不会把这些数字描述为 Harness 全局附件可回收空间。
92
+ - **预览优先的保留策略**:可按每个原会话的保留快照数、快照年龄、快照容量和回收站年龄生成候选;默认每个原会话保留一份恢复快照。保存策略绝不自动执行,回收站正在使用或不可用的快照不会被选中,回收站永久删除默认不勾选。
93
+ - **只读来源与分支**:使用 Harness 持久化 `parentSession` 展示已归档/回收站会话的来源、分叉和子代理树,并保留解释关系所需的父子上下文;无关活动会话不会发送到浏览器。管理卡片把来源说明放在卡片内容中,底部独立一排居中显示折叠箭头;可复制完整 ID、点击整张卡片或箭头折叠,使用项目/状态筛选和全局展开/折叠。搜索标题、项目或 ID 时会自动展开命中路径,独立滚动区域避免大树持续推长页面,超过 50 个节点时根分支默认折叠。本版只诊断缺失父节点、循环与委派深度不一致,不修改关系。
94
+ - **自动恢复快照与保留历史**:已归档聊天移入回收站前保存完整会话事件和经校验的图片附件字节。恢复只移除回收记录,不自动删除快照;它会显示为“已保留的恢复快照”,即使当前没有归档聊天。重复恢复/回收会继续保留旧的有效快照,直到用户明确应用保留策略或永久删除该会话。
67
95
  - **两级恢复**:原会话仍完好时只移除回收标记,不重写持久层;原件丢失时才使用已验证快照和官方写入能力回退恢复,且绝不覆盖同 ID 会话。
68
96
  - **明确的永久删除**:仅回收站提供永久删除与清空。插件先写入 `purge-pending` 崩溃恢复意图,再删除原会话和保护快照;中途失败会在下次启动重试。
69
97
  - 适配浅色/深色主题,支持中文和英文界面。
@@ -72,6 +100,8 @@ dsh plugin --profile web update dsh-archived-chats
72
100
 
73
101
  回收目录 `trash.json` 与保护快照位于 `$DSH_HOME/plugin-data/archived-chats/`,全部只保存在本机。快照会逐个读取附件、校验摘要并使用原子发布;不会上传会话或附件。回收站中的预览也使用单独授权范围。
74
102
 
103
+ 保留策略保存在同目录的 `retention.json`。插件不会在后台、启动时或定时自动应用策略;每次清理都要先生成五分钟有效的单次预览,再由用户选择并确认。
104
+
75
105
  永久删除会删掉该会话的快照附件副本,但 Harness 全局附件存储可能仍因其他会话引用或宿主垃圾回收策略保留相同字节;本插件不声称会立即清理宿主的全局附件库。
76
106
 
77
107
  ## 标签、备注与统计
@@ -126,6 +156,13 @@ JSON 会保留附件引用,但**本版不复制附件二进制,也不包含
126
156
 
127
157
  </details>
128
158
 
159
+ <details>
160
+ <summary><b>为什么没有已归档聊天,空间页仍显示恢复快照?</b></summary>
161
+
162
+ 恢复快照是在已归档聊天移入回收站前创建的。恢复聊天时插件会移除回收记录,但故意保留已经验证的快照作为恢复历史,因此当前归档列表为空时仍可能占用空间。默认策略按每个原会话保留一份;如需删除,请把数量改为 `0`,保存后再执行 **预览清理 → 应用所选清理**。仅保存策略不会删除数据。
163
+
164
+ </details>
165
+
129
166
  ## 实现概览
130
167
 
131
168
  插件由两部分组成:Host 服务层负责读取本地归档、快照、回收目录和恢复/清除事务,浏览器设置页负责搜索、预览、备份、恢复与明确确认。所有修改都通过受保护的本地路由完成;普通移除只提交回收记录,物理清除仅由回收站的崩溃安全 purge 流程触发。
@@ -142,6 +179,15 @@ npm test
142
179
 
143
180
  ## 版本更新记录
144
181
 
182
+ ### 0.12.0
183
+
184
+ - 归档成功后新增 3 秒顶部提示,可立即查看归档中心或撤销;悬停/聚焦暂停,操作失败保留重试。
185
+ - 新增会话目录与保护快照分账、重复快照附件统计和不可用/降级诊断。
186
+ - 新增按历史数、年龄与容量规划的保留策略;保存与执行分离,清理使用单次短效预览并在执行前重检。
187
+ - 新增只读“来源与分支”树,只展示已归档/回收站会话和必要关系上下文,并诊断缺失父节点、循环和委派深度异常。
188
+ - 重复回收周期不再立即删除上一份有效保护快照;永久删除仍通过 `purge-pending` 事务移除原会话和全部有效快照。
189
+ - **降级提醒:** 0.11.x 不显示或治理多份历史快照,但能容忍它们并在永久删除时清理。降级前请备份 `$DSH_HOME/plugin-data/archived-chats/`。
190
+
145
191
  ### 0.11.0
146
192
 
147
193
  - 新增 **归档 / 回收站** 双标签、独立批量选择、回收站范围预览、恢复、永久删除和清空。
@@ -217,7 +263,7 @@ npm test
217
263
  dsh plugin --profile web remove dsh-archived-chats
218
264
  ```
219
265
 
220
- 卸载不会删除 `$DSH_HOME/plugin-data/archived-chats/` 中的 `metadata.json`、`trash.json`、保护快照或旧版 `pending-deletions.json`,也不会触发永久删除。这是故意的本地数据保护;请先恢复或备份需要的会话,再手动处理该目录。
266
+ 卸载不会删除 `$DSH_HOME/plugin-data/archived-chats/` 中的 `metadata.json`、`trash.json`、`retention.json`、保护快照或旧版 `pending-deletions.json`,也不会触发永久删除。这是故意的本地数据保护;请先恢复或备份需要的会话,再手动处理该目录。
221
267
 
222
268
  ## License
223
269
 
@@ -10,7 +10,7 @@ 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
12
  - The browser client in lib/client.js registers the Archived Chats 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, and lib/stats.js. lib/trash.js owns the versioned recycle catalog, lib/snapshot.js owns verified protection snapshots, and lib/recycle.js composes move, restore, purge, empty, startup recovery, and legacy migration.
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.
14
14
 
15
15
  The browser never reads session files directly. All reads and writes go through Host routes.
16
16
 
@@ -21,6 +21,11 @@ Current routes:
21
21
  ~~~text
22
22
  GET /plugins/dsh-archived-chats/state
23
23
  GET /plugins/dsh-archived-chats/stats
24
+ GET /plugins/dsh-archived-chats/insights
25
+ POST /plugins/dsh-archived-chats/retention/policy
26
+ POST /plugins/dsh-archived-chats/retention/preview
27
+ POST /plugins/dsh-archived-chats/retention/apply
28
+ GET /plugins/dsh-archived-chats/lineage
24
29
  POST /plugins/dsh-archived-chats/preview
25
30
  POST /plugins/dsh-archived-chats/preview/image
26
31
  POST /plugins/dsh-archived-chats/search
@@ -47,6 +52,7 @@ The state route joins archived sessions, workspace, tags, notes, and metadataUpd
47
52
  ~~~text
48
53
  $DSH_HOME/plugin-data/archived-chats/metadata.json
49
54
  $DSH_HOME/plugin-data/archived-chats/trash.json
55
+ $DSH_HOME/plugin-data/archived-chats/retention.json
50
56
  $DSH_HOME/plugin-data/archived-chats/snapshots/
51
57
  ~~~
52
58
 
@@ -54,6 +60,8 @@ Metadata and recycle catalogs are versioned. Writes serialize and atomically rep
54
60
 
55
61
  The stats route measures session directories with concurrency four, skips symbolic links, and caches results for 30 seconds. A measurement failure marks only that row unavailable; list and mutation actions continue. Delete invalidates the affected cache row.
56
62
 
63
+ Insights joins session measurement with a stream-verified snapshot inventory and counts repeated snapshot attachments only from validated SHA-256 descriptors. The browser keeps totals in summary cards and presents session/snapshot inventories only in bounded searchable dialogs. retention.json uses an exact version-one schema; saving never runs cleanup. Preview issues a five-minute single-use token/nonce and apply revalidates inside the lifecycle queue; recycle candidates still delegate to recycle purge. Lineage uses only durable parentSession edges, caps real nodes at 5,000, never rewrites headers, and resolves titles for at most 100 untitled active source nodes already included in the focused tree.
64
+
57
65
  ## Preview and full-text search
58
66
 
59
67
  Preview accepts visible archived IDs by default and only recycle-catalog IDs with explicit `scope: "trash"`; search remains archive-only. lib/search.js uses Harness append-origin message projection, so replacement copies are never indexed twice. User, assistant, reasoning, tool-call, and tool-result text is searchable, while preview returns bounded pages of structured segments and sanitized image descriptors.
@@ -93,11 +101,11 @@ The confirmation token expires quickly and can be used once. Hosts without the s
93
101
 
94
102
  `trash.json` permits only `trashed`, `purge-pending`, and `degraded`. Legal transitions are `missing -> trashed`, `trashed/degraded -> purge-pending`, and removal of an existing state after a committed transaction. A `purge-pending` record cannot restore.
95
103
 
96
- Protection manifests use `dsh-archived-chats/snapshot` v1 and session payloads use `dsh-archived-chats/snapshot-session` v1. There is at most one active snapshot per session; replacement publishes the new snapshot before removing the old one. Exact limits are a 4 MiB manifest, 512 MiB session JSON, 10,000 attachments, 32 MiB per attachment, and 8 GiB total. Attachments are processed sequentially, and paths use generated UUIDs and digests rather than user data.
104
+ Protection manifests use `dsh-archived-chats/snapshot` v1 and session payloads use `dsh-archived-chats/snapshot-session` v1. Each recycle record names one active snapshot; older valid snapshots from restore/recycle cycles remain history until explicit retention application or permanent purge. Exact limits remain 4 MiB manifest, 512 MiB session JSON, 10,000 attachments, 32 MiB each, and 8 GiB total.
97
105
 
98
106
  Move ordering is: validate archive ownership → dispose or park a live session → capture and verify snapshot → recheck ownership → atomically commit `trashed` → invalidate caches. Ordinary move never removes the persistence artifact.
99
107
 
100
- Restore first rejects an existing-ID conflict. With an intact original it only restores archive visibility and removes the recycle record/snapshot, without rewriting persistence. With a missing original it completes all validation and attachment-identity republishing before writing only through public `create` / `append` / `saveImage` capabilities. A failure rolls back the new artifact and retains trash.
108
+ 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.
101
109
 
102
110
  Permanent purge persists `purge-pending` before physical writes, then removes the original, snapshot, and recycle record in that order. 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.
103
111
 
@@ -105,11 +113,12 @@ Permanent purge persists `purge-pending` before physical writes, then removes th
105
113
 
106
114
  client.js registers an order-30 settings.section and uses the DSH rc.7 overlay, state, and design tokens. The page state includes:
107
115
 
116
+ - A frame-wide archive success notice in `shell.overlay`: during its effect lifetime the plugin wraps the public `workspaces.archiveSession` method, publishes the latest session ID only after the original call succeeds, and restores the method on unload. The notice defaults to three seconds and tracks pointer/focus pause reasons independently. View follows the Host's accessible Settings trigger and Archived Chats nav label; Undo calls the guarded `/unarchive` route and refreshes the workspace projection. Failures remain retryable and never present false success.
108
117
  - Archived sessions and workspace groups.
109
118
  - Search, type/project/tag filters, and sorting.
110
119
  - Tag and note editor.
111
120
  - Selected-item export, unarchive, and move to Recycle Bin.
112
- - Archived/Recycle Bin tabs with independent recycle selection, status, restore, permanent purge, and empty actions.
121
+ - Archived, Recycle Bin, Storage & Retention, and Origins & Branches tabs; storage and relationship requests load on demand and are cancellable. Storage summary cards open searchable session-directory/snapshot dialogs, keeping retention controls stable regardless of inventory size. The projector retains global capability, while the 0.12 route returns only archived/recycled chats, their ancestor chains, and descendant trees; unrelated active chats are never sent to the browser. Necessary source titles resolve on demand, and a recycle record whose original header is gone still appears as a standalone recycled node. Compact rows use visible spines and elbows for parent/child structure. The DOM uses native list/listitem and disclosure-button semantics instead of claiming an incomplete composite ARIA tree keyboard model while rows also contain Copy ID actions. Rows lead with titles and include project plus localized source/type/delegation/branch metadata and one compact ID. The tree supports per-node and global folding, project filtering that retains required ancestors, and title/project/ID search that temporarily reveals matching paths before restoring the user's fold state. It scrolls independently, defaults only root branches to collapsed above 50 nodes, traverses iteratively, and caps visible guide columns at the nearest 12 levels.
113
122
  - Import preview, disabled conflicts, and restore results.
114
123
  - Responsive settings-page markers and sidebar refresh injection.
115
124
 
@@ -130,7 +139,7 @@ The browser never mutates files directly. After an operation, the Host response
130
139
 
131
140
  ## Compatibility and testing
132
141
 
133
- The complete 0.11.0 target is DeepSeek Harness 0.1.1-rc.2; older hosts degrade through explicit capability errors. When host slots, design tokens, attachments, or session internals change, run the smoke suite first and then repeat a real-host check. Before downgrading to 0.10, restore needed sessions and back up plugin data because 0.10 does not understand recycle records or snapshots.
142
+ The complete 0.12.0 target is DeepSeek Harness 0.1.1-rc.2. Version 0.11.x tolerates multiple valid snapshots but does not display or govern history; back up the complete plugin-data directory before downgrading.
134
143
 
135
144
  Coverage includes:
136
145
 
@@ -141,6 +150,7 @@ Coverage includes:
141
150
  - stats.js symlink handling, caching, and concurrency limits.
142
151
  - search.js message projection, Unicode search, pagination, partial failures, and TTL/LRU caching.
143
152
  - trash.js, snapshot.js, and recycle.js format validation, concurrency, recovery, rollback, crash intent, and legacy migration.
153
+ - insights.js, retention.js, retention-service.js, and lineage.js trusted accounting, policy bounds, short-lived authority, revalidation, and bounded graph projection.
144
154
  - Host routes and browser settings smoke/responsive behavior.
145
155
 
146
156
  Run:
@@ -10,7 +10,7 @@
10
10
 
11
11
  - Host 服务层位于 lib/index.js,运行在 DSH Web 宿主中,读取工作区注册表和会话持久层,并提供本地 HTTP 路由。
12
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/trash.js 负责版本化回收目录,lib/snapshot.js 负责可验证保护快照,lib/recycle.js 组合移入、恢复、永久删除、清空、启动恢复与旧数据迁移。
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 负责可验证保护快照,lib/recycle.js 组合回收生命周期。
14
14
 
15
15
  浏览器不直接访问会话文件。所有读取和写入都经 Host 路由完成。
16
16
 
@@ -21,6 +21,11 @@
21
21
  ~~~text
22
22
  GET /plugins/dsh-archived-chats/state
23
23
  GET /plugins/dsh-archived-chats/stats
24
+ GET /plugins/dsh-archived-chats/insights
25
+ POST /plugins/dsh-archived-chats/retention/policy
26
+ POST /plugins/dsh-archived-chats/retention/preview
27
+ POST /plugins/dsh-archived-chats/retention/apply
28
+ GET /plugins/dsh-archived-chats/lineage
24
29
  POST /plugins/dsh-archived-chats/preview
25
30
  POST /plugins/dsh-archived-chats/preview/image
26
31
  POST /plugins/dsh-archived-chats/search
@@ -47,6 +52,7 @@ state 路由把归档会话、工作区、标签、备注和 metadataUpdatedAt
47
52
  ~~~text
48
53
  $DSH_HOME/plugin-data/archived-chats/metadata.json
49
54
  $DSH_HOME/plugin-data/archived-chats/trash.json
55
+ $DSH_HOME/plugin-data/archived-chats/retention.json
50
56
  $DSH_HOME/plugin-data/archived-chats/snapshots/
51
57
  ~~~
52
58
 
@@ -54,6 +60,8 @@ $DSH_HOME/plugin-data/archived-chats/snapshots/
54
60
 
55
61
  stats 路由以并发 4 测量会话目录,跳过符号链接,结果缓存 30 秒。测量失败只标记当前行不可用,不阻塞列表和其他操作;删除会使对应缓存失效。
56
62
 
63
+ insights 将会话目录测量与流式校验的快照清单分账,重复附件只按快照内已验证 SHA-256 统计;浏览器只在摘要卡片中显示总量,会话目录和快照明细通过有界、可搜索弹窗按需呈现。retention.json 使用精确 version 1 schema;保存策略不执行清理。preview 生成五分钟、单次使用的 token/nonce,apply 在生命周期队列内重检候选,回收站候选仍委托 recycle purge。lineage 只用持久化 parentSession 建树,最多 5,000 个真实节点,不修改会话头;对已经进入聚焦关系树但没有安全标题的活动来源节点,最多按需读取 100 个标题事件。
64
+
57
65
  ## 预览和全文搜索
58
66
 
59
67
  preview 默认只接受当前可见归档 ID;显式 `scope: "trash"` 时仅接受回收目录中的 ID。search 只搜索可见归档。lib/search.js 使用 Harness 的 append-origin 消息投影,不会将 replacement 副本重复索引。用户、助手、思考、工具调用与工具结果均可搜索,预览窗口以分页方式返回有界段落和净化后的图片描述符。
@@ -93,11 +101,11 @@ import/inspect 只接受本插件版本一导出的 ZIP。Host 会有界读取
93
101
 
94
102
  `trash.json` 的合法状态只有 `trashed`、`purge-pending`、`degraded`。合法转换为 `missing -> trashed`、`trashed/degraded -> purge-pending`,以及任一现有状态在事务成功后移除。`purge-pending` 不得恢复。
95
103
 
96
- 保护快照格式是 `dsh-archived-chats/snapshot` v1,会话载荷是 `dsh-archived-chats/snapshot-session` v1。每个会话最多一个活跃快照;替换时先发布新快照,再删除旧快照。精确上限为:manifest 4 MiB、session JSON 512 MiB、10,000 个附件、单附件 32 MiB、总计 8 GiB。附件按顺序逐个读写,文件名使用 UUID 和摘要,而不是用户数据。
104
+ 保护快照格式是 `dsh-archived-chats/snapshot` v1,会话载荷是 `dsh-archived-chats/snapshot-session` v1。每个回收记录只引用一个活跃快照,重复恢复/回收产生的旧有效快照保留为历史,直到明确应用保留策略或永久删除。精确上限为:manifest 4 MiB、session JSON 512 MiB、10,000 个附件、单附件 32 MiB、总计 8 GiB。
97
105
 
98
106
  移入顺序为:校验归档所有权 → 处置/停放运行中会话 → 捕获并验证快照 → 再次校验所有权 → 原子写入 `trashed` 记录 → 使缓存失效。普通移入不删除持久层文件。
99
107
 
100
- 恢复先检查同 ID 冲突。原会话完好时只恢复归档可见性、移除回收记录和快照,不重写持久层;原件丢失时先完成所有校验和附件身份重发,然后仅通过公开 `create` / `append` / `saveImage` 能力写入。失败会回滚新建件并保留回收记录。
108
+ 恢复先检查同 ID 冲突。原会话完好时只恢复归档可见性并移除回收记录,不重写持久层,保护快照保留为历史;原件丢失时先完成所有校验和附件身份重发,然后仅通过公开 `create` / `append` / `saveImage` 能力写入。失败会回滚新建件并保留回收记录。
101
109
 
102
110
  永久删除在任何物理写入前持久化 `purge-pending`,再删除原会话、快照和回收记录。启动恢复仅重试 `purge-pending`,从不删除普通 `trashed`。旧 `pending-deletions.json` 是严格、只读的迁移输入:每个仍归档的 ID 都转成可恢复回收记录,绝不因旧标记在启动时直接删除。
103
111
 
@@ -105,11 +113,12 @@ import/inspect 只接受本插件版本一导出的 ZIP。Host 会有界读取
105
113
 
106
114
  client.js 注册 order 30 的 settings.section,并使用 DSH rc.7 的浮层、状态和设计令牌。页面状态包括:
107
115
 
116
+ - `shell.overlay` 中的归档成功提示:插件在 effect 生命周期内包装公开的 `workspaces.archiveSession`,只在原调用成功后发布最近一次会话 ID,卸载时恢复原方法。提示默认 3 秒,指针/焦点暂停原因独立计数;查看通过宿主设置按钮和归档页的可访问文本进入 `archived-chats` section,撤销调用受保护的 `/unarchive` 后刷新 workspace 投影。请求失败保留可重试状态,不显示伪成功。
108
117
  - 归档列表和工作区分组。
109
118
  - 搜索、类型/项目/标签筛选和排序。
110
119
  - 标签备注编辑器。
111
120
  - 选中项批量导出、取消归档和移入回收站。
112
- - 归档/回收站双标签,回收站独立选择、状态、恢复、永久删除和清空。
121
+ - 归档、回收站、空间与策略、来源与分支四标签;空间请求与关系请求按需加载并可取消。空间摘要卡片打开可搜索的会话目录/快照明细弹窗,保留策略不受明细数量影响。关系投影器保留全局能力,但 0.12 路由只返回已归档/回收站会话、它们的祖先链和后代树;无关活动会话不会发送到浏览器。必要来源节点按需补读标题,原件缺失的回收站记录仍作为独立回收节点显示。浏览器用有竖线和转折线的紧凑树行呈现父子关系,DOM 使用原生列表/列表项和展开按钮语义,避免在同一节点还包含复制操作时宣称不完整的 ARIA 复合树键盘模型。标题是主信息,附带所属项目、本地化来源/类型/委派层级/分支数和一次缩写 ID。树支持逐节点及全部展开/折叠、保留祖先上下文的项目筛选,以及会临时展开命中路径的标题/项目/ID 搜索;清空搜索恢复用户原折叠状态。树在独立滚动区中渲染,超过 50 个节点时只默认折叠根分支,遍历保持迭代式并把可视连接轨道限制在最近 12 层。
113
122
  - 导入预览、冲突禁用和恢复结果。
114
123
  - 响应式设置页标记和侧边栏刷新注入面。
115
124
 
@@ -130,7 +139,7 @@ client.js 注册 order 30 的 settings.section,并使用 DSH rc.7 的浮层、
130
139
 
131
140
  ## 兼容性和测试
132
141
 
133
- 0.11.0 的完整能力目标是 DeepSeek Harness 0.1.1-rc.2;较旧宿主通过明确能力错误降级。宿主插槽、设计令牌、附件或会话内部接口变化时,应先运行冒烟测试,再做真实宿主检查。降级到 0.10 前必须先在 0.11 恢复所需会话并备份插件数据,因为 0.10 不识别回收目录和快照。
142
+ 0.12.0 的完整能力目标是 DeepSeek Harness 0.1.1-rc.2。0.11.x 能容忍多个有效快照但不显示或治理历史;降级前应备份整个插件数据目录。
134
143
 
135
144
  测试覆盖:
136
145
 
@@ -141,6 +150,7 @@ client.js 注册 order 30 的 settings.section,并使用 DSH rc.7 的浮层、
141
150
  - stats.js 的符号链接、缓存和并发限制。
142
151
  - search.js 的消息投影、Unicode 搜索、分页、部分失败与 TTL/LRU 缓存。
143
152
  - trash.js、snapshot.js 和 recycle.js 的格式验证、并发、恢复、回滚、崩溃意图和旧标记迁移。
153
+ - insights.js、retention.js、retention-service.js 和 lineage.js 的可信分账、策略边界、短效授权、重检和有界图投影。
144
154
  - Host 路由和浏览器设置页的冒烟及响应式行为。
145
155
 
146
156
  运行: