@omdp/dsh-archived-sessions 0.3.5 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +105 -4
- package/lib/index.js +23 -7
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @omdp/dsh-archived-sessions
|
|
2
2
|
|
|
3
|
-
> Archived-sessions manager for the DeepSeek Harness web UI — fork of [`@muwinds/dsh-archived-sessions`](https://github.com/MuWinds/dsh-archived-sessions) (0.2.0), adapted for DSH **0.1.5-rc.1**
|
|
3
|
+
> Archived-sessions manager for the DeepSeek Harness web UI — fork of [`@muwinds/dsh-archived-sessions`](https://github.com/MuWinds/dsh-archived-sessions) (0.2.0), adapted for DSH **0.1.5-rc.1** through **0.1.7-rc.2**.
|
|
4
4
|
|
|
5
|
-
DSH 归档会话管理:在 设置 → 归档会话管理 中查看、释放、删除已归档会话(支持按树删除子会话、清理孤儿会话)。自 0.3.4 起与 DSH 0.1.6 内置的「已归档会话」设置页共存、互不冲突。
|
|
5
|
+
DSH 归档会话管理:在 设置 → 归档会话管理 中查看、释放、删除已归档会话(支持按树删除子会话、清理孤儿会话)。自 0.3.4 起与 DSH 0.1.6 内置的「已归档会话」设置页共存、互不冲突。0.3.6 起 `ctx.shell` 双时代自适应(`run()` / `execute()`),**0.1.5-rc.1 → 0.1.7-rc.2 全区间删除可用**(0.3.7 追加 rc.2 声明)。
|
|
6
6
|
|
|
7
7
|
[English](#english) · [中文](#中文)
|
|
8
8
|
|
|
@@ -48,10 +48,44 @@ pnpm add @omdp/dsh-archived-sessions -w
|
|
|
48
48
|
|
|
49
49
|
### 要求 / Requirements
|
|
50
50
|
|
|
51
|
-
- DeepSeek Harness **0.1.5-rc.1**、**0.1.5-rc.2**、**0.1.6-alpha.1**、**0.1.7-rc.1
|
|
51
|
+
- DeepSeek Harness **0.1.5-rc.1**、**0.1.5-rc.2**、**0.1.6-alpha.1**、**0.1.7-rc.1**、**0.1.7-rc.2**(实测版本;**0.3.6 起全兼容**,0.3.7 追加 rc.2 声明,0.3.5 与 0.1.5/0.1.6 系列**静默不兼容**——见变更记录)
|
|
52
|
+
- `@deepseek-ai/dsh` `0.1.7-rc.1 || 0.1.7-rc.2`(peer,逐版本枚举,0.3.6 起新增、0.3.7 追加 rc.2;语义见下方「兼容性门禁」)
|
|
52
53
|
- `@deepseek-ai/cordis` `4.0.1` / `4.0.2` / `4.0.4`(peer,逐版本枚举)
|
|
53
54
|
- `@deepseek-ai/dsh-session-persistence-jsonl`(可选,随 DSH 自带;缺失时回退到内置路径编码)
|
|
54
55
|
|
|
56
|
+
### `ctx.shell` 双时代自适应(0.3.6)
|
|
57
|
+
|
|
58
|
+
删目录那一步是本插件唯一会「真正碰磁盘」的操作,而 `ctx.shell` 的契约在 DSH 0.1.7 改过名——
|
|
59
|
+
两侧方法名不同、且**旧方法在新版被整个移除**(解包 npm tarball 核对 `@deepseek-ai/dsh-shell` 的
|
|
60
|
+
`lib/types/index.d.ts`:`0.1.5-rc.1`/`0.1.5-rc.2`/`0.1.5-rc.3`/`0.1.6-alpha.1` 里
|
|
61
|
+
`abstract run(...)` 存在、`execute` 为 0 次;`0.1.7-rc.1` 里 `abstract execute(spec): Promise<ShellExecution>`
|
|
62
|
+
存在、`run` 为 0 次):
|
|
63
|
+
|
|
64
|
+
| DSH | 调用链 | 结果 |
|
|
65
|
+
|---|---|---|
|
|
66
|
+
| ≤ `0.1.6`(rc.x / alpha) | `resolve(request) → spec` → **`run(spec) → Promise<ShellRunResult>`** | 只有 `run` |
|
|
67
|
+
| ≥ `0.1.7` | `resolve(request) → spec` → **`execute(spec) → ShellExecution`** → `await execution.result()` | 只有 `execute` |
|
|
68
|
+
|
|
69
|
+
所以 `removeDir()` 现在**运行期探测**:优先 `execute()`(0.1.7+),否则回退 `run()`(≤0.1.6),
|
|
70
|
+
两者都没有才报错。这样同一个包在整条版本线上都能删。教训:0.3.4 只调 `run()`(rc.x 可用、
|
|
71
|
+
0.1.7 全废),0.3.5 只调 `execute()`(0.1.7 可用、rc.x **静默失效**——`typeof shell.run !== "function"`
|
|
72
|
+
守卫直接抛错,被 UI 收敛成红字「删除失败」),两次都是「只赌一边」。
|
|
73
|
+
|
|
74
|
+
### 兼容性门禁(0.3.6 起声明)
|
|
75
|
+
|
|
76
|
+
0.3.6 起在 `peerDependencies` 显式声明 `"@deepseek-ai/dsh": "0.1.7-rc.1 || 0.1.7-rc.2"`(0.3.7 追加 rc.2)。
|
|
77
|
+
该声明由 DSH 自己的
|
|
78
|
+
**`evaluatePluginCompatibility()`**(`dsh-app-boot` 的公开导出)在安装与每次启动时校验:命中未实测
|
|
79
|
+
的新版本时会**整包优雅跳过**(stderr 打 `skipping profile bundle`,DSH 照常启动),命中实测版本
|
|
80
|
+
则正常加载。声明从 `0.1.7-rc.1` 起是因为**这个门禁本身是 0.1.7 才引入的**(逐版解包核对
|
|
81
|
+
`dsh-app-boot`:`0.1.5-rc.2`/`0.1.5-rc.3`/`0.1.6-alpha.1`/`0.1.6-alpha.2`/`0.1.7-alpha.1`/`0.1.7-alpha.2`
|
|
82
|
+
里 `evaluatePluginCompatibility` 出现 0 次)——旧运行时读到这条 peer
|
|
83
|
+
只是不认识的声明,**不影响加载**,所以老用户不会因为这条声明而失去插件。
|
|
84
|
+
0.3.7 追加 `0.1.7-rc.2` 的依据:rc.1→rc.2 tarball 逐文件 diff 显示 `dsh-shell`(本插件删除功能的
|
|
85
|
+
唯一 shell 依赖面)的 `lib/` **逐字节零变化**;再用 rc.2 的门禁跑新声明 → 放行;并在 scratch
|
|
86
|
+
profile(`dsh@0.1.7-rc.2` + 插件 0.3.6 + 精确版本豁免)上**真机实测完整删除链路**:
|
|
87
|
+
`POST /dsh-archived/delete` → `{"ok":true}` + 磁盘目录消失 + 归档集合清空。
|
|
88
|
+
|
|
55
89
|
### API
|
|
56
90
|
|
|
57
91
|
| 方法 | 请求 | 响应 |
|
|
@@ -65,6 +99,23 @@ pnpm add @omdp/dsh-archived-sessions -w
|
|
|
65
99
|
|
|
66
100
|
### 变更记录
|
|
67
101
|
|
|
102
|
+
- **0.3.7**(2026-09-25):**追加 DSH `0.1.7-rc.2` 支持**(peer 枚举 `0.1.7-rc.1 || 0.1.7-rc.2`,代码零改动)。
|
|
103
|
+
背景:DSH 桌面版 0.1.7-rc.2 上线后,门禁把只声明 `0.1.7-rc.1` 的 0.3.6 拦下(插件列表「异常」)。
|
|
104
|
+
核查:`dsh-shell` 的 `lib/` 在 rc.1→rc.2 **逐字节零变化**(本插件唯一 shell 依赖面);rc.2 门禁执行
|
|
105
|
+
新声明 → 放行;scratch profile(`dsh@0.1.7-rc.2` + 0.3.6 + 豁免)**真机删除实测通过**——
|
|
106
|
+
`POST /dsh-archived/delete {"sessionId":"session-f71d25a2-…"}` → `{"ok":true,"deleted":true}` +
|
|
107
|
+
磁盘目录消失 + `archivedSessionIds` 清空 + `list` 回 `{items:[]}`(测试会话已从备份还原)。
|
|
108
|
+
|
|
109
|
+
- **0.3.6**(2026-09-24):**`ctx.shell` 双时代自适应 + 声明 DSH 版本支持**。
|
|
110
|
+
1. **修复 0.3.5 对 rc.x 的静默回归**:0.3.5 改用 `execute()` 修好了 0.1.7,但 `run()` 在
|
|
111
|
+
0.1.5/0.1.6 上才是唯一存在的方法,于是 0.3.5 在那些版本上**每次删除都抛**
|
|
112
|
+
`shell executor unavailable; cannot delete from disk`(0.3.4 用 `run()` 反而是 rc.x 可用、
|
|
113
|
+
0.1.7 全废)。0.3.6 改为运行期探测:优先 `execute()`(0.1.7+,需再 `await execution.result()`),
|
|
114
|
+
否则回退 `run()`(≤0.1.6),两者皆无才报错 ⇒ **0.1.5-rc.1 → 0.1.7-rc.1 全区间删除可用**。
|
|
115
|
+
依据:逐版解包 `@deepseek-ai/dsh-shell` 的 `lib/types/index.d.ts`(见上方「`ctx.shell` 双时代自适应」)。
|
|
116
|
+
2. 新增 `@deepseek-ai/dsh` peer 声明 `0.1.7-rc.1`(逐版本枚举,语义见上方「兼容性门禁」)。
|
|
117
|
+
3. 文档同步说明 0.3.5 的 rc.x 回归——避免有人把 0.3.5 当作「rc.x 也能用」的版本。
|
|
118
|
+
|
|
68
119
|
- **0.3.5**(2026-09-24):**适配 DSH 0.1.7-rc.1 —— 修复"删除失败"**。0.1.7 的 `ctx.shell` 是「
|
|
69
120
|
`resolve(request) → spec` / `execute(spec) → ShellExecution` / `execution.result()`」三件套,
|
|
70
121
|
**没有 `run()`**(0.1.5/0.1.6 的 `run(spec)` 已移除)。旧代码 `removeDir()` 用
|
|
@@ -73,6 +124,8 @@ pnpm add @omdp/dsh-archived-sessions -w
|
|
|
73
124
|
UI 表现为红色「删除失败 N 个会话: session-…」。修复:改用 `resolve` + `execute` + `result()`;
|
|
74
125
|
任一执行异常都包成明确的「删除失败」错误。同时把 peer 的 `@deepseek-ai/cordis: ^4.0.1`
|
|
75
126
|
范围改为逐版本枚举 `4.0.1 || 4.0.2 || 4.0.4`(本仓库规范 3:只声明实测过的版本,不用开放范围)。
|
|
127
|
+
> ⚠️ 本版的代价:`execute()` 在 0.1.5/0.1.6 上不存在 ⇒ **rc.x 上删除静默失效**,由 **0.3.6** 的
|
|
128
|
+
> 双时代探测修回。
|
|
76
129
|
- **0.3.4**(2026-09-15):**适配 DSH 0.1.6-alpha.1**——DSH 0.1.6 起在 web-app 内置了原生「已归档会话」设置页(`@deepseek-ai/dsh-client-ui-settings-unarchive-sessions`),它在 `settings.section` 槽位注册的 id 恰为 `archived-sessions`,与本插件旧 id 相同 → slot 冲突,**整个 Web UI 启动报「Failed to load plugins」被拦截**(运行时二分实测:去掉本插件即恢复)。修复:本插件 slot id 改为唯一的 `omdp-archived-sessions`、导航标签改为「归档会话管理」,与原生项共存(原生只有查看+恢复,删除/按树删除/孤儿清理仍是本插件能力)。其余 API 面(`sessionPersistence.list`/`workspaceRegistry`/`sessionQuery`/`shell.run`/`fs`/jsonl 路径编码)对 0.1.6-alpha.1 源码核查零差异。
|
|
77
130
|
- **0.3.3**(2026-09-10):**修复 0.3.2 的删除回归**——0.3.2 把会话根目录改为 `DSH_HOME` 推导时拼出了**混合分隔符**路径(`C:\Users\xj\.dsh/sessions/...`),而删除前校验 `assertSessionDirName` 的 basename 提取对混合分隔符失效(先按 `/` 切再按 `\` 切,把名字切成残缺片段),导致所有删除被"拒绝删除非会话目录"拦截。修复:① basename 提取改为按分隔符整体切分;② 根目录统一为 `/`。删除/孤儿清理恢复正常。
|
|
78
131
|
- **0.3.2**(2026-09-10):修两处 fork 遗留——① client 半区的模块 id 仍是 `@muwinds/dsh-archived-sessions`(未随包名改),浏览器端按 `@omdp/...` 找不到模块、设置页不显示;② 会话根目录改为从 `DSH_HOME` 环境变量推导(`<DSH_HOME>/sessions`,缺省 `~/.dsh/sessions`),不再硬编码本机路径。
|
|
@@ -121,10 +174,50 @@ pnpm add @omdp/dsh-archived-sessions -w
|
|
|
121
174
|
|
|
122
175
|
### Requirements
|
|
123
176
|
|
|
124
|
-
- DeepSeek Harness **0.1.5-rc.1**, **0.1.5-rc.2**, **0.1.6-alpha.1**, **0.1.7-rc.1** (tested; 0.3.
|
|
177
|
+
- DeepSeek Harness **0.1.5-rc.1**, **0.1.5-rc.2**, **0.1.6-alpha.1**, **0.1.7-rc.1**, **0.1.7-rc.2** (tested; **0.3.6+ works on all of them** — 0.3.7 adds the rc.2 declaration, 0.3.5 is *silently broken* on the 0.1.5/0.1.6 line, see changelog)
|
|
178
|
+
- `@deepseek-ai/dsh` `0.1.7-rc.1 || 0.1.7-rc.2` (peer, enumerated per version, new in 0.3.6, rc.2 added in 0.3.7)
|
|
125
179
|
- `@deepseek-ai/cordis` `4.0.1` / `4.0.2` / `4.0.4` (peer, enumerated per version)
|
|
126
180
|
- `@deepseek-ai/dsh-session-persistence-jsonl` (optional, ships with DSH; falls back to the built-in path encoding when absent)
|
|
127
181
|
|
|
182
|
+
### Dual-era `ctx.shell` adaptation (0.3.6)
|
|
183
|
+
|
|
184
|
+
The directory-removal step is the only place this plugin actually touches the disk, and `ctx.shell`'s
|
|
185
|
+
contract was renamed in DSH 0.1.7 — the two eras expose *different* methods, and the old one is removed
|
|
186
|
+
outright in the new one (verified by unpacking each `@deepseek-ai/dsh-shell` npm tarball and reading
|
|
187
|
+
`lib/types/index.d.ts`: `abstract run(...)` exists and `execute` appears 0 times in
|
|
188
|
+
`0.1.5-rc.1`/`0.1.5-rc.2`/`0.1.5-rc.3`/`0.1.6-alpha.1`; `0.1.7-rc.1` has
|
|
189
|
+
`abstract execute(spec): Promise<ShellExecution>` and `run` appears 0 times):
|
|
190
|
+
|
|
191
|
+
| DSH | Call chain | Result |
|
|
192
|
+
|---|---|---|
|
|
193
|
+
| ≤ `0.1.6` (rc.x / alpha) | `resolve(request) → spec` → **`run(spec) → Promise<ShellRunResult>`** | only `run` |
|
|
194
|
+
| ≥ `0.1.7` | `resolve(request) → spec` → **`execute(spec) → ShellExecution`** → `await execution.result()` | only `execute` |
|
|
195
|
+
|
|
196
|
+
`removeDir()` now probes at runtime: prefer `execute()` (0.1.7+), fall back to `run()` (≤0.1.6), and only
|
|
197
|
+
error out when neither exists — so one build deletes across the entire line. The lesson: 0.3.4 called
|
|
198
|
+
only `run()` (fine on rc.x, dead on 0.1.7) and 0.3.5 called only `execute()` (fine on 0.1.7, **silently
|
|
199
|
+
dead** on rc.x, where the `typeof shell.run !== "function"` guard threw immediately and the UI surfaced
|
|
200
|
+
it as the red "删除失败" banner) — both were bets on a single era.
|
|
201
|
+
|
|
202
|
+
### Compatibility gate (declared since 0.3.6)
|
|
203
|
+
|
|
204
|
+
Since 0.3.6 the plugin declares `"@deepseek-ai/dsh": "0.1.7-rc.1 || 0.1.7-rc.2"` in `peerDependencies`
|
|
205
|
+
(rc.2 added in 0.3.7). DSH's own
|
|
206
|
+
**`evaluatePluginCompatibility()`** (a public export of `dsh-app-boot`) checks it at install time and on
|
|
207
|
+
every boot: on an untested newer runtime the **whole bundle is gracefully skipped** (stderr prints
|
|
208
|
+
`skipping profile bundle`; DSH still boots), and on the tested runtime it loads normally. The declaration
|
|
209
|
+
starts at `0.1.7-rc.1` because **the gate itself only exists from 0.1.7** (verified per version by
|
|
210
|
+
unpacking `dsh-app-boot` tarballs: `evaluatePluginCompatibility` appears 0 times in
|
|
211
|
+
`0.1.5-rc.2`/`0.1.5-rc.3`/`0.1.6-alpha.1`/`0.1.6-alpha.2`/`0.1.7-alpha.1`/`0.1.7-alpha.2`) — older
|
|
212
|
+
runtimes simply see an unrecognized peer declaration, so **existing users on older
|
|
213
|
+
DSH versions do not lose the plugin** because of it.
|
|
214
|
+
The `0.1.7-rc.2` addition (0.3.7) is based on: a file-by-file tarball diff showing `dsh-shell`'s `lib/`
|
|
215
|
+
(**this plugin's only shell surface**) is **byte-identical** rc.1 → rc.2; running the rc.2 gate against the
|
|
216
|
+
new declaration → pass; and a **live end-to-end delete test** on a scratch profile
|
|
217
|
+
(`dsh@0.1.7-rc.2` + 0.3.6 + exact-version exemption): `POST /dsh-archived/delete
|
|
218
|
+
{"sessionId":"session-f71d25a2-…"}` → `{"ok":true,"deleted":true}` + directory gone from disk +
|
|
219
|
+
archive set emptied + `list` returning `{items:[]}` (the test session was restored from backup).
|
|
220
|
+
|
|
128
221
|
### API
|
|
129
222
|
|
|
130
223
|
| Method | Request | Response |
|
|
@@ -138,7 +231,15 @@ pnpm add @omdp/dsh-archived-sessions -w
|
|
|
138
231
|
|
|
139
232
|
### Changelog
|
|
140
233
|
|
|
234
|
+
- **0.3.7** (2026-09-25): **adds DSH `0.1.7-rc.2` support** (peer enumeration `0.1.7-rc.1 || 0.1.7-rc.2`, zero code changes). Background: the DSH **desktop** app ships runtime `0.1.7-rc.2`, so the gate skipped 0.3.6's exact-`rc.1` declaration (plugin list badge 异常). Verification: `dsh-shell`'s `lib/` is **byte-identical** rc.1 → rc.2 (this plugin's only shell surface); the rc.2 gate passes the new declaration; and a live delete test on a scratch profile (`dsh@0.1.7-rc.2` + 0.3.6 + exemption) succeeded end-to-end — `POST /dsh-archived/delete {"sessionId":"session-f71d25a2-…"}` → `{"ok":true,"deleted":true}` + directory gone + archive set emptied + `list` → `{items:[]}` (test session restored from backup).
|
|
235
|
+
|
|
236
|
+
- **0.3.6** (2026-09-24): **dual-era `ctx.shell` adaptation + declared DSH version support**.
|
|
237
|
+
1. **Fixes a silent rc.x regression from 0.3.5**: 0.3.5 switched to `execute()` and thereby fixed 0.1.7, but `run()` is the only method that exists on 0.1.5/0.1.6, so on those versions 0.3.5 threw `shell executor unavailable; cannot delete from disk` on **every** delete (0.3.4's use of `run()` was conversely fine on rc.x and dead on 0.1.7). 0.3.6 probes at runtime: prefer `execute()` (0.1.7+, awaiting `execution.result()`), else fall back to `run()` (≤0.1.6), and only error when neither exists ⇒ **deletes work across 0.1.5-rc.1 → 0.1.7-rc.1**. Basis: unpacked `@deepseek-ai/dsh-shell` `lib/types/index.d.ts` per version (see "Dual-era `ctx.shell` adaptation" above).
|
|
238
|
+
2. Added the `@deepseek-ai/dsh` peer declaration `0.1.7-rc.1` (enumerated per version; see "Compatibility gate" above).
|
|
239
|
+
3. Documented 0.3.5's rc.x regression so nobody treats 0.3.5 as "fine on rc.x".
|
|
240
|
+
|
|
141
241
|
- **0.3.5** (2026-09-24): **DSH 0.1.7-rc.1 support — fixes the "删除失败" (delete failed) banner**. 0.1.7's `ctx.shell` is the trio `resolve(request) → spec` / `execute(spec) → ShellExecution` / `execution.result()`; there is **no `run()`** any more (0.1.5/0.1.6 had `run(spec)`). The old `removeDir()` guarded on `typeof shell.run !== "function"` and therefore always threw `shell executor unavailable; cannot delete from disk` on 0.1.7 — every session directory was rejected before touching the disk, surfacing in the UI as the red banner "删除失败 N 个会话: session-…". Fix: use `resolve` + `execute` + `result()`; any execution error is wrapped into an explicit delete-failure error. Also changed the peer from the range `@deepseek-ai/cordis: ^4.0.1` to per-version enumeration `4.0.1 || 4.0.2 || 4.0.4` (repo rule 3: only declare actually-tested versions, never open ranges).
|
|
242
|
+
> ⚠️ What this version cost: `execute()` does not exist on 0.1.5/0.1.6 ⇒ **deletes silently stopped working on rc.x**, fixed again by **0.3.6**'s dual-era probe.
|
|
142
243
|
- **0.3.4** (2026-09-15): **adapted to DSH 0.1.6-alpha.1** — since DSH 0.1.6 the web-app ships a native archived-sessions settings page (`@deepseek-ai/dsh-client-ui-settings-unarchive-sessions`) that registers the `settings.section` slot with id `archived-sessions` — exactly the id this plugin used → slot collision, and the whole Web UI boot failed with a "Failed to load plugins" screen (verified at runtime by bisecting plugin subsets: removing this plugin restores boot). Fix: this plugin's slot id is now the unique `omdp-archived-sessions` and its nav label is "归档会话管理", coexisting with the native entry (the native page only lists/restores; delete, tree-delete and orphan sweep remain this plugin's features). All other DSH surfaces used by the plugin (`sessionPersistence.list`/`workspaceRegistry`/`sessionQuery`/`shell.run`/`fs`/jsonl path encoding) verified byte- or removal-free against 0.1.6-alpha.1.
|
|
143
244
|
- **0.3.3** (2026-09-10): **fixes a 0.3.2 delete regression** — 0.3.2 derived the session root from `DSH_HOME` with a **mixed-separator** path (`C:\Users\xj\.dsh/sessions/...`), and the pre-delete guard `assertSessionDirName`'s basename extraction broke on mixed separators (it sliced by `/` then by `\`, producing a truncated fragment), so every delete was rejected with "拒绝删除非会话目录". Fixed: ① basename extraction now splits on either separator; ② roots are normalized to `/`. Delete and orphan sweep work again.
|
|
144
245
|
- **0.3.2** (2026-09-10): fixes two fork leftovers — ① the client half's module id was still `@muwinds/dsh-archived-sessions` (not renamed with the package), so the browser could not find the module and the settings page never rendered; ② the session root is now derived from the `DSH_HOME` environment variable (`<DSH_HOME>/sessions`, falling back to `~/.dsh/sessions`) instead of a hard-coded local path.
|
package/lib/index.js
CHANGED
|
@@ -126,15 +126,27 @@ function assertSessionDirName(dirPath) {
|
|
|
126
126
|
|
|
127
127
|
/** Delete a directory recursively through the shell executor (pwsh / rm).
|
|
128
128
|
*
|
|
129
|
-
* DSH 0.1.7
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
129
|
+
* `ctx.shell` changed shape in DSH 0.1.7 — the method set is version-dependent,
|
|
130
|
+
* so this must NOT hard-require either one:
|
|
131
|
+
* · 0.1.7+ : `resolve()` → `execute(spec)` → `ShellExecution` → `await result()`
|
|
132
|
+
* · ≤0.1.6 : `resolve()` → `run(spec)` → `Promise<ShellRunResult>` (direct)
|
|
133
|
+
* `dsh-shell`'s own `.d.ts` proves the split: 0.1.5-rc.3 / 0.1.6-alpha.1 declare
|
|
134
|
+
* only `run`/`start`, while 0.1.7-rc.1 declares only `resolve`/`execute`.
|
|
135
|
+
*
|
|
136
|
+
* 0.3.4 required `run()` (worked on rc.x, failed on 0.1.7);
|
|
137
|
+
* 0.3.5 required `execute()` (worked on 0.1.7, silently broke rc.x).
|
|
138
|
+
* Each single-method gate turned the other era into "every delete throws before
|
|
139
|
+
* it touches the disk — the 0.3.x delete banner bug". Detect at call time.
|
|
133
140
|
*/
|
|
134
141
|
async function removeDir(ctx, dirPath) {
|
|
135
142
|
assertSessionDirName(dirPath);
|
|
136
143
|
const shell = ctx.get("shell");
|
|
137
|
-
if (!shell || typeof shell.resolve !== "function"
|
|
144
|
+
if (!shell || typeof shell.resolve !== "function") {
|
|
145
|
+
throw new Error("shell executor unavailable; cannot delete from disk");
|
|
146
|
+
}
|
|
147
|
+
const useExecute = typeof shell.execute === "function";
|
|
148
|
+
const useRun = !useExecute && typeof shell.run === "function";
|
|
149
|
+
if (!useExecute && !useRun) {
|
|
138
150
|
throw new Error("shell executor unavailable; cannot delete from disk");
|
|
139
151
|
}
|
|
140
152
|
const isWindows = /^[A-Za-z]:[\\/]/.test(dirPath);
|
|
@@ -152,8 +164,12 @@ async function removeDir(ctx, dirPath) {
|
|
|
152
164
|
}
|
|
153
165
|
let result;
|
|
154
166
|
try {
|
|
155
|
-
|
|
156
|
-
|
|
167
|
+
if (useExecute) {
|
|
168
|
+
const execution = await shell.execute(spec);
|
|
169
|
+
result = await execution.result();
|
|
170
|
+
} else {
|
|
171
|
+
result = await shell.run(spec);
|
|
172
|
+
}
|
|
157
173
|
} catch (e) {
|
|
158
174
|
throw new Error("删除失败: " + String((e && e.message) || e));
|
|
159
175
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omdp/dsh-archived-sessions",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"description": "Archived-sessions manager for the DeepSeek Harness web UI: list / unarchive / delete / detail from Settings. · DSH 归档会话管理:设置页查看、释放、删除已归档会话(含按树删除子会话与孤儿清理)。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@deepseek-ai/cordis": "4.0.1 || 4.0.2 || 4.0.4"
|
|
46
|
+
"@deepseek-ai/cordis": "4.0.1 || 4.0.2 || 4.0.4",
|
|
47
|
+
"@deepseek-ai/dsh": "0.1.7-rc.1 || 0.1.7-rc.2"
|
|
47
48
|
}
|
|
48
49
|
}
|