@xrn1997/dsh-session-delete 0.0.0-stage → 0.0.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/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 2026 xrn1997
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,130 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # @xrn1997/dsh-session-delete
2
+
3
+ 给 DeepSeek Harness(DSH)加一个**删除会话**的能力。DSH 官方有归档、没有删除——归档只是把会话从列表里挪走,文件还在。本插件补上删除,并且让删除可恢复:删除 = 移入回收站,另有一个显式的「彻底删除」。
4
+
5
+ ![左侧栏「回收站」面板:按项目分组的卡片列表,每条带「恢复」与「彻底删除…」,页脚是整页唯一的实心红按钮「清空回收站…」](https://raw.githubusercontent.com/xrn1997/dsh-session-delete/main/docs/screenshots/screenshot-01.png)
6
+
7
+ - 安装:`dsh plugin --profile <profile> add @xrn1997/dsh-session-delete`
8
+ - 许可:[Apache-2.0](LICENSE)
9
+ - 数据:回收站本体留在本机 `~/.dsh/session-trash/`,不联网、不上传
10
+
11
+ ## 目录
12
+
13
+ - [功能特性](#功能特性)
14
+ - [安装](#安装)
15
+ - [用法](#用法)
16
+ - [回收站与数据](#回收站与数据)
17
+ - [界面语言](#界面语言)
18
+ - [常见问题](#常见问题)
19
+ - [开发](#开发)
20
+ - [贡献](#贡献)
21
+ - [许可](#许可)
22
+
23
+ ## 功能特性
24
+
25
+ - **删除 = 移入回收站**:会话条目「…」菜单里的「删除」把会话搬进回收站,可随时恢复;删完有一条停留 6 秒的撤销提示
26
+ - **显式彻底删除**:单条「彻底删除…」或页脚「清空回收站…」,两者共用同一个二次确认
27
+ - **回收站面板**:按项目分组的卡片列表,每条两行(标题 / 删除时间 · 大小),头部是条数与合计占用 + 刷新,页脚交代本体位置与「清空后不可恢复」
28
+ - **运行中的会话拒绝删除**:菜单项置灰并说明原因——不替用户终止正在进行的活
29
+ - **不自动过期**:不设天数上限,清空是显式动作
30
+ - **失败不吞**:回收站读不到时把宿主原文上屏,并给一个「重试」
31
+ - **不可用时不出现**:取数通道探测不过就一个入口都不注册——页面上看不出本插件,但也不会因此把宿主拖死
32
+ - **文案随宿主语言**:中文 / English 挂在宿主 locale 服务上,跟随设置的界面语言
33
+
34
+ ## 安装
35
+
36
+ ```bash
37
+ dsh plugin --profile <profile> add @xrn1997/dsh-session-delete
38
+ ```
39
+
40
+ 装完**重启宿主**(Node 半不走 HMR)。卸载:
41
+
42
+ ```bash
43
+ dsh plugin --profile <profile> remove @xrn1997/dsh-session-delete
44
+ ```
45
+
46
+ 卸载只是移除插件;`~/.dsh/session-trash/` 下已有的目录仍留在原处,不会被自动清理。
47
+
48
+ 也可以离线分发:`pnpm pack` 出 tarball 后 `dsh plugin add ./dsh-session-delete-<版本>.tgz`。包里带的是**预构建产物**(`prepack` 在打包时替你跑 `build`),所以这条路上用户不需要为构建脚本授权。
49
+
50
+ **兼容性分两层,别混**:
51
+
52
+ - **装得上**由 `package.json` 的 `peerDependencies` 决定——宿主 `dsh plugin add` 会拿运行中的宿主版本逐项比对插件的 `@deepseek-ai/dsh*` peer 区间,不满足即拒绝并回滚。本插件**一条 `dsh-*` peer 都没有**(界面用的控件与图标已固化成 `src/client/ui/*`,浏览器半只 require React 家族这三个冻结平台模块),所以这道闸不限制它装在哪些代上。
53
+ - **真跑过**由 `dsh.compatibility.dshReleases` 记录,只列实测过的宿主:**DSH Desktop 0.2.0-rc.2**(`compatible`)。别的 rc 装得上,但没验过。
54
+
55
+ ## 用法
56
+
57
+ 两个入口。
58
+
59
+ **删除**:会话条目右边的「…」菜单 → 「删除」→ 确认框(「移入回收站」)→ 会话进回收站。正在运行的会话这一行是**置灰**的,悬停给出「会话正在运行,先停止再删除」——本插件不替用户终止正在进行的活。
60
+
61
+ **回收站**:侧栏面板列表里常驻的「回收站」一行(与「插件」「小说」同层)。打开后是中央面板:
62
+
63
+ - 清单按项目分组,每条两行——标题 / 「刚刚删除 · 24KB」或「删除于 7分钟前 · 350KB」;动作收在右侧,「恢复」是描边,「彻底删除…」是安静的红
64
+ - 头部是条数与合计占用(「2 个会话 · 共 49KB」)加一个「刷新」;页脚是「清空回收站…」——**整页唯一一块实心红**
65
+ - 面板四态:读数中 / 空(「回收站是空的」,此时底部**不出现**「清空回收站…」)/ 读数失败(宿主原文 + 「重试」)/ 有条目
66
+ - 「恢复」按记录的原目录名放回原项目目录,并还原它原本的可见性:删除前未归档的,恢复后仍未归档;删除前已归档的,恢复后仍在归档态
67
+
68
+ ## 回收站与数据
69
+
70
+ | 东西 | 位置 |
71
+ | --- | --- |
72
+ | 回收站本体 | `~/.dsh/session-trash/<时间戳>-<原目录名>/` |
73
+ | 回收站清单 | 本插件自己的 storage domain(介质在 `~/.dsh/storages/`) |
74
+
75
+ - 回收站与 `~/.dsh/sessions/` **同卷**:搬进搬出靠整目录 `rename`,原子、瞬时
76
+ - **清单丢了不致命**:会话文件自描述,解压后第一行即 header,含 `id` 与 `cwd`
77
+ - **不自动过期**:不设天数上限,清空是显式动作;界面显示条数与占用
78
+ - **附件不连坐**:附件是全局内容寻址的,与会话不是父子关系——删除不连带,也不会回收;被删会话独享的附件会留成垃圾(要回收得先有引用计数,属另一件事)
79
+
80
+ ## 界面语言
81
+
82
+ 中文 / English 挂在宿主自己的 locale 服务上,跟随设置的界面语言;服务不可用时退回内置中文。
83
+
84
+ ## 常见问题
85
+
86
+ **装完侧栏没有「回收站」,会话菜单里也没有「删除」?**
87
+
88
+ 先重启宿主。若仍没有,确认这一代宿主上本插件激活过——取数通道探测不过时,本插件**一个入口都不注册**:页面上看不出它的存在,但它也不会因此把宿主拖死。这是有意用「入口不出现」表达不可用,不是禁用态。
89
+
90
+ **删完之后侧栏那一行怎么还在?**
91
+
92
+ 本插件只在**宿主确实不再列它**时才通告客户端把那一行去掉;拿不准时宁可沉默(那时说「已移除」是假话)。刚巧遇上就刷新页面,那一行会自己消失。本机运行期没打开过的**冷会话**走的是正常路径,删完即走。
93
+
94
+ **正在运行的会话为什么删不掉?**
95
+
96
+ 判据用的是宿主自己的活跃检查(与官方归档的准入同源)。首版一律拒绝,不替用户终止正在进行的活——先停下这个会话再删。
97
+
98
+ **能恢复多久?**
99
+
100
+ 不存在时间上限。不自动过期,只有你显式清空或彻底删除才会真的丢字节。
101
+
102
+ ## 开发
103
+
104
+ ```bash
105
+ pnpm install
106
+ pnpm build # tsdown:Node 半 + 浏览器半(含浏览器半的纯度门)
107
+ pnpm test # vitest run
108
+ pnpm typecheck # tsc --noEmit
109
+ ```
110
+
111
+ ### 本地源码调试
112
+
113
+ **`lib/` 是构建产物且不入库,从源码目录链进 profile 的安装方式不会替你构建它。**
114
+
115
+ ```bash
116
+ pnpm build # 必须在源码目录手动跑一次
117
+ dsh plugin --profile <profile> add "link:<本仓绝对路径>"
118
+ ```
119
+
120
+ 改动生效分两半:**浏览器半**(`src/client/`)由宿主 HMR 推到浏览器,无需重启;**Node 半**不在热重载链路内,必须重启宿主。
121
+
122
+ 设计(五个触点、边界、错误形状、验证门、界面规格)住在 [`docs/design/2026-09-30-session-delete-design.md`](docs/design/2026-09-30-session-delete-design.md),README 不复述。
123
+
124
+ ## 贡献
125
+
126
+ 欢迎 Issue 与 PR。提交改动前请确保 `pnpm test` 与 `pnpm typecheck` 都通过,且**两条命令的退出码都亲眼看过**——跑门要把输出先灌进文件、再单独打印退出码,管道会把红吃掉。提交即表示你同意以 [Apache-2.0](LICENSE) 协议授权你的贡献。
127
+
128
+ ## 许可
129
+
130
+ [Apache-2.0](LICENSE)
@@ -0,0 +1,3 @@
1
+ - insert:
2
+ - id: session-delete
3
+ name: '@xrn1997/dsh-session-delete'
package/icon.svg ADDED
@@ -0,0 +1,18 @@
1
+ <!--
2
+ 插件卡片/组件行的图标(`package.json` 顶层 `icon`,宿主按**图片**读它、不内联 HTML)。
3
+
4
+ 形状逐字取自 `@deepseek-ai/dsh-client-ui-primitives@0.2.0-rc.2` 的 `IconTrashOutlineRegular`
5
+ (与插件界面里那枚垃圾桶图标同源)。
6
+
7
+ 两处与组件版不同:
8
+ 1. 颜色写死。图片形式的 SVG **不继承 `currentColor`**(它是一份独立文档),所以不能像组件里那样
9
+ 吃宿主的字色 ⇒ 取一个浅色/深色底上都能读的中灰。
10
+ 2. 不带 `aria-hidden`。这不是行内构件,可及名由承载它的宿主卡片提供。
11
+ -->
12
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="#8a9099" stroke-width="1">
13
+ <path d="M1.28149 3.88831H14.7187" />
14
+ <path d="M5.41602 3.88833V2.47962C5.41602 2.29282 5.52492 2.11366 5.71876 1.98157C5.9126 1.84948 6.17551 1.77527 6.44964 1.77527H9.55053C9.82466 1.77527 10.0876 1.84948 10.2814 1.98157C10.4753 2.11366 10.5842 2.29282 10.5842 2.47962V3.88833" />
15
+ <path d="M2.57349 3.88831L3.19366 13.2943C3.21937 13.5502 3.33952 13.7872 3.53065 13.9593C3.72178 14.1313 3.97016 14.2259 4.22729 14.2246H11.7728C12.0299 14.2259 12.2783 14.1313 12.4694 13.9593C12.6605 13.7872 12.7807 13.5502 12.8064 13.2943L13.4266 3.88831" />
16
+ <path d="M6.44946 6.98926V11.1238" />
17
+ <path d="M9.55054 6.98926V11.1238" />
18
+ </svg>