dsh-archive-management 0.0.0-stage → 1.2.1
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/CHANGELOG.md +131 -0
- package/LICENSE +201 -0
- package/README.md +81 -2
- package/README.zh-CN.md +82 -0
- package/SECURITY.md +7 -0
- package/cordis.patch.yml +6 -0
- package/package.json +51 -4
- package/src/client.js +2107 -0
- package/src/index.js +1454 -0
- package/tools/unhide.mjs +56 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.2.1 (2026-11-20)
|
|
4
|
+
|
|
5
|
+
### 修复(fork P0 深度审查产出)
|
|
6
|
+
|
|
7
|
+
- **软删除级联**:删除父会话时全部子代理会话(多级)跟随进入回收站,可独立还原;任一子代理运行中整体拒绝(409)。
|
|
8
|
+
- **purge-archived 级联**:「全部永久删除」同时清掉已归档会话的未归档子代理,不再留孤儿。
|
|
9
|
+
- **配置原子写**:config.json 改为临时文件 + rename,杜绝写一半损坏。
|
|
10
|
+
- **/debug 收紧鉴权**:GET 也要求自定义头(遥测快照不再对无凭证本机请求可见)。
|
|
11
|
+
- 新增 10 项测试断言(软删除级联/运行子代理拒绝/调试鉴权),宿主套件 63 项全绿。
|
|
12
|
+
|
|
13
|
+
## 1.2.0 (2026-11-20)
|
|
14
|
+
|
|
15
|
+
### 变更
|
|
16
|
+
|
|
17
|
+
- **npm 包名定为 `dsh-archive-management`**(`dsh-archive-manager` 已被他人占用),版本对齐 1.2.0。
|
|
18
|
+
- 首次发布到 npm:`dsh plugin --profile web add dsh-archive-management` 即可从 DSH 内置 Plugin Hub 一键安装。
|
|
19
|
+
|
|
20
|
+
## 0.6.0 (2026-11-19)
|
|
21
|
+
|
|
22
|
+
### 变更
|
|
23
|
+
|
|
24
|
+
- **产品更名为 `dsh-archive-manager`**(原 `dsh-session-delete`;npm 上该名已被另一插件占用)。API 路径前缀 `/api/session-delete` 保持不变。
|
|
25
|
+
|
|
26
|
+
## 0.6.0 (2026-11-19)
|
|
27
|
+
|
|
28
|
+
### 新增
|
|
29
|
+
|
|
30
|
+
- **子代理级联删除**:侧边栏「永久删除」与批量永久删除现在会级联抹除目标会话的全部后代子代理会话(多级递归);任一子代理在运行则整体拒绝(409),绝不留下半删状态;逐会话广播 removed 并写入审计(`cascade` 字段)。
|
|
31
|
+
- **注入诊断遥测**:`GET/POST /api/session-delete/debug`——侧边栏钩子全链路(安装/行捕获/菜单扫描/容器快照)实时上报,可离线排查注入链路。
|
|
32
|
+
|
|
33
|
+
### 变更
|
|
34
|
+
|
|
35
|
+
- 侧边栏「永久删除」改经轻量 DOM 注入实现:位于「归档会话」**正下方**、常规配色、**无快捷键**、恒单条;行组件判定按 0.2.2-rc.5 实测 props(`node.id` + `onOpen/useContextMenu/onRenameRequest`),右键/左键/中键均可触发。
|
|
36
|
+
- 归档管理页对齐 zcodex 版式:移除页签与大标题下的切换器,新增 22px 页面标题;自动归档卡片仅保留「自动归档旧会话(开关)」与「归档保留时长(宽下拉)」两行;「立即扫描 / 刷新」降级为扫描结果行内文字链接;分组行仅显示「N 个会话」;「回收站」降级为页面底部入口(还原/彻底删除/清空功能不变);「全部会话」视图移除(侧栏永久删除已覆盖任意会话删除)。
|
|
37
|
+
- 宿主测试数据模型改为磁盘驱动(删除的会话自动从清单排除),与真实持久化一致。
|
|
38
|
+
|
|
39
|
+
### 测试
|
|
40
|
+
|
|
41
|
+
- `test/smoke.mjs` 扩至 53 项断言:级联删除(多级抹除/逐会话广播/审计/运行中子代理 409 且目录不动)、配置补丁语义、自动归档跳过逻辑、purge-archived 幂等。
|
|
42
|
+
- `test/render.mjs` 22 项断言:三槽位注册、菜单项与设置页(zcodex 版式)渲染、分组折叠、项目筛选、扫描入口。
|
|
43
|
+
|
|
44
|
+
## 0.5.1-fork.1 (2026-11-19)
|
|
45
|
+
|
|
46
|
+
首次 fork 变更(详见 FORK.md):侧边栏「永久删除」初版(官方槽位)+ 归档管理页重构 + 自动归档。
|
|
47
|
+
|
|
48
|
+
## 0.5.1-fork.1 (2026-11-19)
|
|
49
|
+
|
|
50
|
+
本版本是 [xohmai/dsh-session-delete](https://github.com/xohmai/dsh-session-delete) v0.5.1 的本地魔改 fork(Apache-2.0,原始许可与版权保留,修改内容见下与 FORK.md)。
|
|
51
|
+
|
|
52
|
+
### 新增
|
|
53
|
+
|
|
54
|
+
- **侧边栏「永久删除」(仿 Codex)**:会话行 `…` 菜单新增红色「永久删除」项(官方槽位 `sidebar.workspaces.session.menu.item` + 官方原语 `MenuItemButton`/`Modal`,不再依赖 DOM 注入),确认框走 `shell.overlay` 槽位,菜单关闭后仍存活。删除一步完成:归档隐藏 → 直接抹除磁盘目录,**不经回收站、不可恢复**;运行中的会话拒绝(409);删除当前打开的会话后自动切到空白会话。宿主新增 `POST /api/session-delete/delete-permanent`。
|
|
55
|
+
- **归档管理(仿 zcodex)**:设置页默认页签重构为「归档管理」——顶部「自动归档旧会话」卡片(开关 + 保留期 1/3/7/14/30/90 天 + 扫描间隔 10 分钟~24 小时 + 立即扫描 + 上次扫描结果行),下方「已归档的会话」按项目分组清单(搜索 + 按更新时间/创建时间/体积排序 + 多选批量)+ 红色「全部永久删除」(两步确认,跳过运行中会话,返回成功/失败/跳过统计)。宿主新增 `GET|POST /api/session-delete/config`、`POST /api/session-delete/auto-archive/run`、`POST /api/session-delete/purge-archived`。
|
|
56
|
+
- 自动归档配置落盘 `<DSH_HOME>/trash/sessions/config.json`;插件启动时恢复定时扫描,卸载时清理定时器。
|
|
57
|
+
- 行内新增「永久删除」按钮(两步确认),与回收站「彻底删除」区分开。
|
|
58
|
+
|
|
59
|
+
### 兼容性
|
|
60
|
+
|
|
61
|
+
- 原「归档会话/全部会话/回收站」三页签行为不变;设置页 nav 名称由「归档会话」改为「归档管理」(CSS 图标替换的选择器文本同步更新)。
|
|
62
|
+
- 侧边栏入口依赖 `@deepseek-ai/dsh-client-ui-primitives` 的 `Button/Modal/MenuItemButton/IconTrashOutlineRegular`:缺失时仅跳过侧边栏注册并打警告,设置页不受影响。
|
|
63
|
+
|
|
64
|
+
## 0.5.1 (2026-11-06) — 上游 xohmai/dsh-session-delete
|
|
65
|
+
|
|
66
|
+
## 0.5.1
|
|
67
|
+
|
|
68
|
+
- Fix (PR #4): deleting a session now broadcasts `api-session/removed` to every connected client, so sidebar rows are pruned immediately everywhere — previously only the acting client refreshed its list, leaving stale rows in other clients that failed with `session/not-found` when opened. Verified end-to-end against DSH source before merging: the event is whitelisted in `dsh-api-remotes`' forwarded-event registry (cordis emits from plugin contexts reach it the same way `plugin-market/changed` does), and the client's `handleSessionRemoved` is no-op-safe for cold, non-resident sessions while still recording the store removal. Double emission when the host later disposes a live session is idempotent
|
|
69
|
+
- Fix (PR #4): restoring from trash broadcasts `api-session/added` with a minimal summary so the row reappears in connected clients without waiting for a baseline refresh; the summary now carries `formatStatus: "current"` like the host's own `summaryFor` (follow-up to the PR)
|
|
70
|
+
- Prefer the public `workspaceRegistry.unarchiveSession()` on current DSH (same serial queue and persistence as `archiveSession`); the internal state-machine path stays as the legacy fallback (≤0.1.1-rc.x) and capability detection is unchanged
|
|
71
|
+
- Tests: emit assertions for the delete/restore broadcasts; the smoke stub now encodes session-directory names the same way the core does, fixing the Windows-only mkdir failures the PR author reported (raw `:` from IM ids is not a legal directory name on NTFS)
|
|
72
|
+
- Known edge (core semantics, not a bug): official clients treat `origin === "subagent"` rows as durable — `api-session/removed` only marks them not-running; such rows disappear on the client's next list refresh
|
|
73
|
+
|
|
74
|
+
## 0.5.0
|
|
75
|
+
|
|
76
|
+
- New: streaming session list with real progress. A new `GET /api/session-delete/list-stream` route emits NDJSON — a `meta` line first (total count, workspaces, unarchive capability) so the total is known immediately, then one line per session as soon as it is computed, then `done`. The client switches to this route and shows a live "已加载 N / M 个会话" counter instead of a bare wait; rows render once, sorted by `mtimeMs` (same order as before, no reshuffle flicker). The old one-shot `/list` route stays for compatibility and tests
|
|
77
|
+
- UI: first-load transitions are now centered horizontally and vertically in the scroll area (spinner + label + live counter); the trash tab gets the same centered spinner without a counter (its endpoint is millisecond-fast). Reloads with existing data stay silent (old list remains usable, ↻ spins)
|
|
78
|
+
- Perf (critical): titles no longer decompress session logs one-by-one. Two compounding costs were removed — `readTitleSnapshots` re-scans the whole persistence listing on every call, so per-session calls were quadratic (520 sessions: 60s+ and still incomplete), and every session paid a full zstd decompress. Titles now resolve in one batched pass: cold sessions hit the `sessionProjectionCache` `title` row first (zero I/O, same source the sidebar's `session.list` serves and prewarms; identity-witnessed so it can never cross sessions; seeded headers follow the official predecessor probe), and only actual misses go through one batched `readTitleSnapshots` call (its internal concurrency pool decompresses in parallel). Live sessions keep reading in-memory titles. Measured on 520 sessions / 401 MB of logs: the stat+readdir pass is ~50 ms, versus 60s+ before
|
|
79
|
+
- Perf: record computation runs as three phases (parallel stat precheck → batched title resolve → 16-way row pool); mtime-keyed record cache hits skip title resolution and dir sizing entirely, so repeat loads are stat-only
|
|
80
|
+
- Fix (perf): `locate()` returns the *current-generation* log path (e.g. `session.v3.jsonl.zstd`), which does not exist for not-yet-migrated old-format sessions (v0 keeps the plain `session.jsonl.zstd` name) — the mtime record cache could never warm for them and every reload recomputed everything (measured 8s steady on 520 sessions). The precheck now falls back to scanning the session directory for the highest-generation log actually present
|
|
81
|
+
- UI: switching tabs no longer refetches on every entry — data loads once when absent and is kept in sync by the post-action refreshes (delete/restore/purge already reload); the ↻ button remains for a manual refresh
|
|
82
|
+
- Diagnostics: the `done` line of `/list-stream` now carries per-phase timings (`inventoryMs`/`prepMs`/`titleMs`/`rowMs`) and title-source counts (recordCache/snapshot/predecessor/batched), which pinpointed both regressions above
|
|
83
|
+
- Fix (IM channels, #3): sessions from IM channels (`dsh-im-connect`, ids like `im:weixin_…@im.wechat` containing `:`/`@`/`_`/`.`) could neither be deleted, restored, nor unarchived. Two layers: the id whitelist rejected them with 400 before any logic ran, and — once widened — the raw id embedded in the trash entry name made `mkdir` fail with ENOENT on Windows (`:` is a reserved character). Per the core contract (`SessionId` is an *unvalidated* branded string that "MUST be encoded before use in a path"), the whitelist now only guards against injection (`[A-Za-z0-9._:@~-]{8,200}`, still no `/`/`\`/whitespace) and entry names escape the id through the same `~XXXX` scheme the core's own `encodeSegment` uses (verbatim-aligned; `:`→`~003A`, `@`→`~0040`). `ENTRY_RE` is tightened to exactly the escape output charset (contains `~`, never `:`/`@` — entry names become real directories), restore/purge keep taking ids from `meta.json` (never reverse-parsing entry names), and ids whose escaped entry would overflow the entry whitelist are rejected *before* any mutation, preserving the invariant that every trashed entry stays restorable. Full IM-id pipeline covered by tests: preview → delete → trash → restore → purge
|
|
84
|
+
|
|
85
|
+
## 0.4.1
|
|
86
|
+
|
|
87
|
+
- Fix (compat): DSH 0.1.5 changed `sessionPersistence.list()` to return `{ header, revision, sizeBytes }` snapshots instead of bare header arrays; the wrapper flowed into `locate()` and crashed every `/api/session-delete/list` and `/trash` request with "Cannot read properties of undefined (reading 'length')" (inside `encodeSegment(undefined)`). Both call sites now unwrap snapshots via a compat helper (`item.header ?? item`, same unwrap the official session-query uses), so both the new and the legacy (≤0.1.1-rc.x) shapes work
|
|
88
|
+
- Dev: `react`/`react-dom` 18.3.1 as devDependencies — DSH 0.1.5 no longer ships react in its node_modules, so the render smoke tests resolve it from the plugin's own dev install
|
|
89
|
+
- Tests: smoke stub now models the 0.1.5+ snapshot shape by default; a dedicated test keeps the legacy bare-header shape covered
|
|
90
|
+
|
|
91
|
+
## 0.4.0
|
|
92
|
+
|
|
93
|
+
- Fix (complete): deleted sessions no longer reappear in the workspace sidebar, in any client. Root cause beyond 0.3.0's live-session case: client sidebars render rows from an in-memory list store that only prunes on `host/session-removed` (live disposals only) or a fresh `session.list` baseline — forgetting a deleted cold session's archive id broadcast `archived-sessions-changed` and resurrected the stale row in every connected client
|
|
94
|
+
- Delete / purge / purge-all now always keep the archive-set entry during runtime (`keptHidden`); a ghost id without a list row renders nothing in the official UI, so keeping it is free. Ghosts are reconciled once at Host restart (plugin mount), when every client rebuilds from a fresh baseline and un-archiving can resurrect nothing
|
|
95
|
+
- `/list` no longer reconciles ghosts during runtime (that broadcast was itself a resurrection trigger for long-lived clients)
|
|
96
|
+
- The acting client now pulls a fresh `session.list` baseline after deletes and restores (`sessions.refresh()`, capability-detected), pruning its own stale rows immediately
|
|
97
|
+
|
|
98
|
+
## 0.3.0
|
|
99
|
+
|
|
100
|
+
- Fix: deleting an archived session that is still attached in memory ("打开中") no longer makes it reappear in the workspace sidebar — the Host serves live sessions from memory regardless of disk state, so the archive-set entry is now deliberately kept (`keptHidden`) to hold the session hidden; the leftover id is reconciled automatically once the session is no longer live (e.g. after a Host restart)
|
|
101
|
+
- The same live-aware keep-hidden rule now applies to trash purge / purge-all and to the `/list` ghost reconcile (which no longer strips archive entries belonging to live sessions)
|
|
102
|
+
- Delete responses carry `keptHidden`; the UI notice explains when a deleted session stays hidden until restart
|
|
103
|
+
- UI: batch "删除所选" now uses the same two-step arm-and-confirm as single delete and trash purge (auto-disarms on selection change / tab switch); delete buttons carry explanatory tooltips; the Archived tab shows a contextual hint when live sessions are present
|
|
104
|
+
|
|
105
|
+
## 0.2.3
|
|
106
|
+
|
|
107
|
+
- Reconcile historical `archivedSessionIds` ghosts on `/list`: ids present in `workspace.json` but missing from the on-disk session inventory are removed best-effort
|
|
108
|
+
|
|
109
|
+
## 0.2.2
|
|
110
|
+
|
|
111
|
+
- Clear `workspace.json` `global.archivedSessionIds` ghosts after delete / purge so official archive counts do not keep deleted sessions (best-effort when the registry state machine is available)
|
|
112
|
+
|
|
113
|
+
## 0.2.1
|
|
114
|
+
|
|
115
|
+
- Accept bare-UUID and `<id>-session-<uuid>` session ids in the host ID whitelist so continuable / configured subagent sessions can be previewed, deleted, and restored (thanks @xi146)
|
|
116
|
+
- Make `test/render.mjs` resolve `react` / `react-dom` from the local DSH install instead of a hard-coded Linux global path
|
|
117
|
+
|
|
118
|
+
## 0.2.0
|
|
119
|
+
|
|
120
|
+
- Online unarchive: restore from the Archived tab returns the session to the sidebar immediately; trash restore also unarchives automatically
|
|
121
|
+
- Older DSH builds without the registry state machine fall back to the offline `tools/unhide.mjs` guidance
|
|
122
|
+
- Trash entries show session titles (captured into `meta.json` on delete) with multi-select batch restore / purge
|
|
123
|
+
- Stronger selection styling and unified `.sd-check` checkbox size across group headers and rows
|
|
124
|
+
- Security and quality: trash entry path traversal guards, audit-log protection, 400 for malformed JSON, per-domain UI loading states
|
|
125
|
+
|
|
126
|
+
## 0.1.0
|
|
127
|
+
|
|
128
|
+
- Settings-page session manager with Archived / All / Trash tabs
|
|
129
|
+
- Soft-delete into `~/.dsh/trash/sessions/` with restore and purge
|
|
130
|
+
- Running-session guard and CSRF header on mutating routes
|
|
131
|
+
- `tools/unhide.mjs` to remove restored ids from the archive set while DSH is stopped
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,82 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-archive-manager
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Session archive & cleanup manager for DeepSeek Harness (DSH)** — sidebar one-click **permanent delete** (Codex-style), a **zcodex-style archive management** page, and **auto-archive** with retention.
|
|
4
|
+
|
|
5
|
+
[中文说明](README.zh-CN.md)
|
|
6
|
+
|
|
7
|
+
Built on the framework of [xohmai/dsh-session-delete](https://github.com/xohmai/dsh-session-delete) (Apache-2.0). Upstream copyright fully retained; see [FORK.md](FORK.md) and [NOTICE](NOTICE) for the relationship and changes.
|
|
8
|
+
|
|
9
|
+
**Author:** [Eleven_AI](https://github.com/ElevenAI-Pro) · xinshiyi
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
### Sidebar "Delete permanently" (Codex-style, full chain)
|
|
14
|
+
|
|
15
|
+
- Right-click (or `⋯`) any session → the entry sits **right below "Archive session"**, normal color, trash icon, **no shortcut**.
|
|
16
|
+
- One click (with confirmation) permanently erases the session **and all of its sub-agent sessions recursively**. No trash, no residue.
|
|
17
|
+
- Running sessions (or running children) are refused with HTTP 409 — never a half-deleted state.
|
|
18
|
+
- The sidebar row disappears immediately (broadcast + projection refresh); deleting the open session switches to a blank one.
|
|
19
|
+
- Every action is appended to an audit log (`~/.dsh/trash/sessions/audit.log`).
|
|
20
|
+
|
|
21
|
+
### Archive management (zcodex-style page)
|
|
22
|
+
|
|
23
|
+
- **Auto-archive old sessions**: toggle + retention (1/3/7/14/30/90 days), background scan every 30 minutes; pinned & running sessions are skipped — archive only hides, never deletes.
|
|
24
|
+
- **Archived sessions** grouped by project (collapsible), with search, sorting (updated/created/size), project filter, multi-select batch delete, and a red **Delete all permanently** (two-step confirm).
|
|
25
|
+
- Row actions: **Restore** (unarchive back to the sidebar), **Delete** (to trash), **Delete permanently** (irreversible).
|
|
26
|
+
- **Trash** (entry at the bottom of the page): restore / delete permanently / empty.
|
|
27
|
+
|
|
28
|
+
### Safety
|
|
29
|
+
|
|
30
|
+
- Non-GET API requests require a custom header (cross-site posts cannot pass the CORS preflight).
|
|
31
|
+
- Session ids are whitelist-validated and path-escaped before touching the disk (Windows reserved characters included).
|
|
32
|
+
- Zero runtime dependencies, no telemetry, no network calls. `react`/`react-dom` are dev-only (tests).
|
|
33
|
+
|
|
34
|
+
## Install
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
dsh plugin --profile <your-profile> add dsh-archive-management
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Or install from this GitHub repository directly:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
dsh plugin --profile <your-profile> add github:ElevenAI-Pro/dsh-archive-manager
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Local development can install from a link (edits apply on page refresh):
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
dsh plugin --profile <your-profile> add link:<this-repo-path>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Host API
|
|
53
|
+
|
|
54
|
+
| Method | Path | Purpose |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| GET/POST | `/api/session-delete/config` | auto-archive config (read / save & reschedule) |
|
|
57
|
+
| POST | `/api/session-delete/auto-archive/run` | run one archive scan now |
|
|
58
|
+
| POST | `/api/session-delete/delete` | soft delete: archive + move to trash |
|
|
59
|
+
| POST | `/api/session-delete/delete-permanent` | permanent delete (cascades to sub-agents) |
|
|
60
|
+
| POST | `/api/session-delete/purge-archived` | permanently delete all archived sessions |
|
|
61
|
+
| GET/POST | `/api/session-delete/trash` / `restore` / `purge` / `unarchive` | trash & archive ops |
|
|
62
|
+
| GET/POST | `/api/session-delete/debug` | sidebar hook telemetry (offline diagnosis) |
|
|
63
|
+
|
|
64
|
+
Non-GET requests must carry `x-dsh-plugin: session-delete` (cross-site requests cannot pass the CORS preflight).
|
|
65
|
+
|
|
66
|
+
## Development & tests
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
pnpm install # devDependencies: react / react-dom (render tests only)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
# Host-half behaviour suite (mocked Cordis ctx + temp session tree)
|
|
74
|
+
ELECTRON_RUN_AS_NODE=1 <DeepSeek Harness.exe> test/smoke.mjs
|
|
75
|
+
|
|
76
|
+
# Client-half render suite (real React, renders the slot components)
|
|
77
|
+
ELECTRON_RUN_AS_NODE=1 <DeepSeek Harness.exe> test/render.mjs
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## License
|
|
81
|
+
|
|
82
|
+
Apache-2.0 — original work © xohmai; modifications © 2026 contributors. See [LICENSE](LICENSE), [NOTICE](NOTICE) and [FORK.md](FORK.md).
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# dsh-archive-manager
|
|
2
|
+
|
|
3
|
+
**DeepSeek Harness(DSH)会话归档与清理管理器** —— 侧边栏一键「永久删除」(Codex 风格,级联子代理)+ zcodex 风格的「归档管理」页 + 自动归档(保留期可调)。
|
|
4
|
+
|
|
5
|
+
[English](README.md)
|
|
6
|
+
|
|
7
|
+
基于 [xohmai/dsh-session-delete](https://github.com/xohmai/dsh-session-delete) 的框架重构(Apache-2.0)。上游版权完整保留,与本 fork 的关系及改动见 [FORK.md](FORK.md)、[NOTICE](NOTICE)。
|
|
8
|
+
|
|
9
|
+
**作者:**[Eleven_AI](https://github.com/ElevenAI-Pro)(xinshiyi)
|
|
10
|
+
|
|
11
|
+
## 功能
|
|
12
|
+
|
|
13
|
+
### 侧边栏「永久删除」(Codex 风格,全链路)
|
|
14
|
+
|
|
15
|
+
- 右键(或点 `⋯`)任意会话行 → 菜单「归档会话」**正下方**即「永久删除」(常规配色、垃圾桶图标、无快捷键)。
|
|
16
|
+
- 确认后一步抹除该会话**及其全部子代理会话(多级递归)**:不经回收站、无残留。
|
|
17
|
+
- 运行中的会话(含运行中的子代理)拒绝删除(HTTP 409),绝不留下半删状态。
|
|
18
|
+
- 侧栏行即时移除;删除当前打开的会话自动切到空白会话。
|
|
19
|
+
- 全部动作追加审计日志(`~/.dsh/trash/sessions/audit.log`)。
|
|
20
|
+
|
|
21
|
+
### 归档管理(zcodex 版式)
|
|
22
|
+
|
|
23
|
+
- **自动归档旧会话**:开关 + 保留期(1/3/7/14/30/90 天),后台每 30 分钟扫描;置顶与运行中的会话不受影响——归档只隐藏、不删数据。
|
|
24
|
+
- **已归档的会话**:按项目分组(可折叠),支持搜索、排序(更新时间/创建时间/体积)、项目筛选、多选批量删除;「全部永久删除」两步确认,跳过运行中会话。
|
|
25
|
+
- 行内三个动作:**还原**(解除归档回到侧栏)、**删除**(进回收站)、**永久删除**(直接抹除)。
|
|
26
|
+
- **回收站**(页面底部入口):还原 / 彻底删除 / 清空。
|
|
27
|
+
|
|
28
|
+
### 安全
|
|
29
|
+
|
|
30
|
+
- 非 GET 请求需携带自定义头(跨站请求过不了 CORS 预检)。
|
|
31
|
+
- 会话 id 白名单校验 + 落盘路径转义(含 Windows 保留字符)。
|
|
32
|
+
- 零运行时依赖、无遥测、无网络外发;react/react-dom 仅测试用(devDependencies)。
|
|
33
|
+
|
|
34
|
+
## 安装
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
dsh plugin --profile <your-profile> add dsh-archive-management
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
或直接从 GitHub 仓库安装:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
dsh plugin --profile <your-profile> add github:ElevenAI-Pro/dsh-archive-manager
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
本地开发可用 link 方式安装(改源码后刷新页面即生效):
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
dsh plugin --profile <your-profile> add link:<本仓库路径>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## 宿主路由
|
|
53
|
+
|
|
54
|
+
| 方法 | 路径 | 说明 |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| GET/POST | `/api/session-delete/config` | 自动归档配置(读取 / 保存并重排定时器) |
|
|
57
|
+
| POST | `/api/session-delete/auto-archive/run` | 立即执行一次自动归档扫描 |
|
|
58
|
+
| POST | `/api/session-delete/delete` | 软删除:归档隐藏 + 移入回收站 |
|
|
59
|
+
| POST | `/api/session-delete/delete-permanent` | 永久删除(级联子代理) |
|
|
60
|
+
| POST | `/api/session-delete/purge-archived` | 永久删除全部已归档会话 |
|
|
61
|
+
| GET/POST | `/api/session-delete/trash` / `restore` / `purge` / `unarchive` | 回收站与归档操作 |
|
|
62
|
+
| GET/POST | `/api/session-delete/debug` | 侧栏钩子遥测(离线诊断) |
|
|
63
|
+
|
|
64
|
+
非 GET 请求需携带自定义头 `x-dsh-plugin: session-delete`。
|
|
65
|
+
|
|
66
|
+
## 开发与测试
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
pnpm install # devDependencies:react / react-dom(渲染测试用)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
# 宿主半行为测试(mock Cordis ctx + 临时磁盘会话树,53 项断言)
|
|
74
|
+
ELECTRON_RUN_AS_NODE=1 <DeepSeek Harness.exe> test/smoke.mjs
|
|
75
|
+
|
|
76
|
+
# 客户端半渲染测试(真实 React,渲染槽位组件,22 项断言)
|
|
77
|
+
ELECTRON_RUN_AS_NODE=1 <DeepSeek Harness.exe> test/render.mjs
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## License
|
|
81
|
+
|
|
82
|
+
Apache-2.0 —— 原始作品 © xohmai;修改 © 2026 贡献者。见 [LICENSE](LICENSE)、[NOTICE](NOTICE)、[FORK.md](FORK.md)。
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Security notes
|
|
2
|
+
|
|
3
|
+
- All mutating HTTP routes require the custom header `x-dsh-plugin: session-delete` and bind to the local DSH web server (no CORS preflight answers).
|
|
4
|
+
- Session ids and trash entry names are validated against strict allowlists before any filesystem operation.
|
|
5
|
+
- Running sessions are refused (`409 RUNNING`); delete archives first, then moves data under `~/.dsh/trash/sessions/`.
|
|
6
|
+
- `tools/unhide.mjs` edits `storages/workspace.json` and must only be run while DSH is stopped.
|
|
7
|
+
- Please report security issues privately via GitHub Security Advisories on this repository.
|
package/cordis.patch.yml
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-archive-management",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.2.1",
|
|
4
|
+
"description": "Real session deletion for DeepSeek Harness: settings-page manager with trash & restore + sidebar permanent delete (Codex style) + auto-archive with retention (zcodex style). Fork of xohmai/dsh-session-delete.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"deepseek-harness",
|
|
9
|
+
"dsh",
|
|
10
|
+
"dsh-plugin",
|
|
11
|
+
"cordis",
|
|
12
|
+
"session-management"
|
|
13
|
+
],
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/ElevenAI-Pro/dsh-archive-manager.git"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://github.com/ElevenAI-Pro/dsh-archive-manager#readme",
|
|
19
|
+
"bugs": "https://github.com/ElevenAI-Pro/dsh-archive-manager/issues",
|
|
20
|
+
"author": "Eleven_AI <ElevenAI-Pro@users.noreply.github.com>",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": "./src/index.js",
|
|
23
|
+
"./client": "./src/client.js",
|
|
24
|
+
"./package.json": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"src",
|
|
28
|
+
"tools",
|
|
29
|
+
"cordis.patch.yml",
|
|
30
|
+
"SECURITY.md",
|
|
31
|
+
"CHANGELOG.md"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"test": "node test/smoke.mjs && node test/render.mjs"
|
|
35
|
+
},
|
|
36
|
+
"dsh": {
|
|
37
|
+
"bundle": {
|
|
38
|
+
"patch": "./cordis.patch.yml"
|
|
39
|
+
},
|
|
40
|
+
"client": {
|
|
41
|
+
"platform": "web",
|
|
42
|
+
"immediately": true,
|
|
43
|
+
"inject": ["@deepseek-ai/dsh-client-ui-workspace", "@deepseek-ai/dsh-client-ui-primitives"]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=20"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"react": "^18.3.1",
|
|
51
|
+
"react-dom": "^18.3.1"
|
|
52
|
+
}
|
|
53
|
+
}
|