dsh-session-manager 0.1.0 → 0.1.2

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 CHANGED
@@ -1,100 +1,129 @@
1
- # dsh-session-manager — 会话管理器(删除 + 归档管理)
1
+ # dsh-session-manager — conversation manager (delete + archive)
2
2
 
3
- 为 DeepSeek Harness Web 增加两件官方缺失的能力:
3
+ [中文](README.zh.md) | English
4
4
 
5
- 1. **删除对话**(删除前二次确认):物理删除会话 —— 停止并销毁对应 agent、清空
6
- 会话存储条目(所有标签页同步移除该行)、删除磁盘上的 JSONL 会话目录、
7
- 清理工作区记账与归档集合。
8
- 2. **归档管理**:移入归档(官方已有 `workspace.archiveSession`)与 **移出归档**
9
- (官方 rc.6 没有 unarchive API,本插件在 host 端补齐,走 workspace registry
10
- 自己的持久化队列,`host/archived-sessions-changed` 帧自动同步所有客户端)。
5
+ [![npm version](https://img.shields.io/npm/v/dsh-session-manager)](https://www.npmjs.com/package/dsh-session-manager)
6
+ [![GitHub](https://img.shields.io/badge/GitHub-repo-blue)](https://github.com/hkkz9522/dsh-session-manager)
7
+ [![CI](https://github.com/hkkz9522/dsh-session-manager/actions/workflows/ci.yml/badge.svg)](https://github.com/hkkz9522/dsh-session-manager/actions/workflows/ci.yml)
11
8
 
12
- ## 特性
9
+ Adds two capabilities that are missing from DeepSeek Harness Web:
13
10
 
14
- - 🗑 **删除会话**:头部垃圾桶按钮直接删除当前会话;管理面板每行可删。全部带二次确认
15
- - 📦 **归档 / 移出归档**:头部归档菜单 + 管理面板逐行操作
16
- - 📋 **会话管理面板**:全部 / 未归档 / 已归档 过滤(已归档会话侧边栏默认不可见,
17
- 只有这里能找回),每行「打开 / 归档 / 移出归档 / 删除」
18
- - 🏷 状态徽标:已归档 / 运行中 / 当前会话;相对时间与工作区目录
19
- - ⚠️ 删除确认弹窗展示会话标题与“不可撤销”警告;会话运行中会提示“删除将立即中断它”
11
+ 1. **Delete conversations** (with an explicit confirmation dialog): physically deletes a
12
+ session — stops and disposes its agent, detaches the session store entry (every tab
13
+ drops the row), removes the JSONL directory from disk, and cleans up workspace
14
+ accounting and the archive set.
15
+ 2. **Archive management**: archive (`workspace.archiveSession`, built in) and
16
+ **unarchive** (missing in rc.6 — this plugin implements it on the host side through
17
+ the workspace registry's own persistence queue, with
18
+ `host/archived-sessions-changed` frames keeping every client in sync).
20
19
 
21
- ## UI 入口
20
+ ## Features
22
21
 
23
- | 位置 | 内容 |
22
+ - 🗑 **Delete sessions**: a "Delete session…" button in the conversation header plus a
23
+ per-row delete in the manager panel — every path requires confirmation.
24
+ - 📦 **Archive / unarchive**: header button + per-row actions in the panel.
25
+ - 📋 **Session manager panel** (sidebar footer entry): filter by All / Active / Archived
26
+ (archived sessions are invisible in the sidebar — the panel is where you find them
27
+ again), with per-row Open / Archive / Unarchive / Delete.
28
+ - 🏷 Status badges: archived / running / current; relative time and workspace directory.
29
+ - ⚠️ The delete dialog shows the session title and an "irreversible" warning; for a
30
+ running session it warns that deletion will interrupt it immediately.
31
+
32
+ ## Where the UI lives
33
+
34
+ | Location | Content |
24
35
  |---|---|
25
- | 会话头部(当前会话标题旁) | 「归档 / 移出归档」与「删除会话…」(红色,二次确认弹窗)两个文字按钮 |
26
- | 侧边栏底部 | 「会话管理」按钮:打开完整管理面板 |
36
+ | Conversation header (next to the session title) | "Archive / Unarchive" and "Delete session…" (red, confirmation dialog) buttons |
37
+ | Sidebar footer | "会话管理" button that opens the full manager panel |
27
38
 
28
- ## 安装
39
+ ## Install
29
40
 
30
- ### 从 npm 安装(推荐)
41
+ ### From npm (recommended)
31
42
 
32
43
  ```powershell
33
44
  dsh plugin --profile web add dsh-session-manager
34
45
  ```
35
46
 
36
- 重启 web 后生效(profile bundle 自动装配,`lib/` 即运行时产物,无需构建)。
47
+ Restart the web app to activate (profile bundle auto-assembles; `lib/` is the runtime
48
+ artifact, no build step).
37
49
 
38
- ### 从 GitHub 安装(备用)
50
+ ### From GitHub (alternative)
39
51
 
40
52
  ```powershell
41
53
  dsh plugin --profile web add github:hkkz9522/dsh-session-manager
42
54
  ```
43
55
 
44
- ### 本地开发 / 运行时注入
56
+ ### Local development / runtime injection
45
57
 
46
- 克隆本仓库后,在已常驻 [dsh-super-injector](https://github.com/yjh051108/dsh-super-injector)
47
- 的 web 会话中注入(注入即生效,免重启):
58
+ After cloning, inject in a web session that has
59
+ [dsh-super-injector](https://github.com/yjh051108/dsh-super-injector) resident
60
+ (activates immediately, no restart):
48
61
 
49
62
  ```
50
- dev_inject_plugin {"dir": "<仓库目录绝对路径>"}
63
+ dev_inject_plugin {"dir": "<absolute path to the repo>"}
51
64
  ```
52
65
 
53
- ## 卸载
54
-
55
- - 若通过 `dsh plugin add` 装配:从 `~/.dsh/profiles/web/package.json` 的
56
- `dependencies` 与 `dsh.profile.bundles` 中移除对应条目,重启。
57
- - 若通过运行时注入安装:`dev_uninject_plugin {"name": "dsh-session-manager"}`
58
-
59
- ## 兼容性(升级 DSH 后)
60
-
61
- - **客户端 UI** 只使用官方插件面(slot 契约 `conversation.session.header.actions` /
62
- `sidebar.footer.action`、标准工具包 `useSessions` / `useWorkspaces` / `t`、locale、
63
- client bundle 格式),升级大概率无缝。
64
- - **host 端** 不 import 任何 `@deepseek-ai` 包(仅 node 内置模块),升级不会在
65
- 加载期失败;删除 / 移出归档用到了少数 rc.6 未公开的内部结构(已做防御性访问),
66
- 若未来版本重构这些内部实现,会表现为运行时操作报错而非崩溃,按报错适配即可。
67
- - `peerDependencies` 仅声明 `cordis` 范围,不硬编码 DSH 版本。
68
- - 建议升级后自检一次:新建空白会话并删除(端到端 30 秒)。
69
-
70
- ## 实现说明
71
-
72
- - **host 端**(`lib/index.js`):cordis 插件,注入
73
- `webServer / workspaceRegistry / sessions / agents / sessionPersistence`,
74
- 注册两条 HTTP 端点:
66
+ ## Uninstall
67
+
68
+ - Installed via `dsh plugin add`: remove the entry from `dsh.profile.bundles` and
69
+ `dependencies` in `~/.dsh/profiles/web/package.json`, then restart.
70
+ - Installed via runtime injection: `dev_uninject_plugin {"name": "dsh-session-manager"}`
71
+
72
+ ## Compatibility (DSH upgrades)
73
+
74
+ - **Client UI** uses only the official plugin surface (slot contracts
75
+ `conversation.session.header.actions` / `sidebar.footer.action`, the standard toolkit
76
+ `useSessions` / `useWorkspaces` / `t`, locale, client bundle format) — upgrades are
77
+ very likely seamless.
78
+ - **Host side** imports no `@deepseek-ai` package (only Node built-ins), so it never
79
+ fails at load time after an upgrade. Delete/unarchive rely on a few internals that
80
+ rc.6 does not expose publicly (accessed defensively); if a future version refactors
81
+ them, you get a runtime error rather than a crash — adapt per the error message.
82
+ - `peerDependencies` declares only the `cordis` range; no hard-coded DSH version.
83
+ - After an upgrade, self-check once: create a blank session and delete it (end-to-end,
84
+ 30 s), or run `node scripts/smoke-test.mjs` (read-only smoke checks of the two host
85
+ endpoints; touches no real session).
86
+
87
+ ## Development & maintenance
88
+
89
+ - **No build step**: `lib/` is the runtime artifact (host is ESM; client is a hand-written
90
+ loader-factory bundle).
91
+ - **Smoke test**: `node scripts/smoke-test.mjs [baseUrl]` (needs a running dsh web).
92
+ - **CI** (`.github/workflows/ci.yml`): `node --check` on both files + `npm pack --dry-run`
93
+ content assertion.
94
+ - Changes are tracked in [CHANGELOG.md](./CHANGELOG.md).
95
+
96
+ ## Implementation notes
97
+
98
+ - **Host** (`lib/index.js`): a cordis plugin injecting
99
+ `webServer / workspaceRegistry / sessions / agents / sessionPersistence`, exposing two
100
+ HTTP endpoints:
75
101
  - `POST /session-manager/api/delete { sessionId }`
76
102
  - `POST /session-manager/api/unarchive { sessionId }`
77
- - **client 端**(`lib/client.js`):loader factory 格式手写 bundle(无构建步骤),
78
- 注册两个 slot:
79
- - `conversation.session.header.actions`(每会话操作 + 删除确认)
80
- - `sidebar.footer.action`(会话管理面板入口)
103
+ - **Client** (`lib/client.js`): a loader-factory bundle registering two slots:
104
+ - `conversation.session.header.actions` (per-session actions + delete confirmation)
105
+ - `sidebar.footer.action` (manager panel entry)
81
106
 
82
- 删除 live 会话的顺序:`agent.cancel`(中断运行)→ `agent.scope.dispose`(安静销毁
83
- agent fiber,3s 上限)→ 从 agents 注册表移除僵尸条目 → `sessions.flush` → 会话
84
- store 条目 detach(触发 `session/disposed` → 各端移除行)→ 工作区记账清理 →
85
- 归档集合清理 → 删除磁盘目录。
107
+ Delete of a live session: `agent.cancel` (interrupt) → `agent.scope.dispose` (quietly
108
+ dispose the agent fiber, 3 s cap) → drop the zombie entry from the agents registry →
109
+ `sessions.flush` → detach the session store entry (`session/disposed` → all clients
110
+ remove the row) → workspace accounting cleanup → archive-set cleanup → remove the on-disk
111
+ directory.
86
112
 
87
- ## 风险与边界
113
+ ## Risks & limitations
88
114
 
89
- - 删除是不可逆操作(文件物理删除),UI 已做二次确认。
90
- - live 会话删除依赖 host 内部结构(会话 store / agent registry 的实例字段),
91
- 未来 DSH 版本若重构这些内部实现可能需要同步适配(代码均做了防御性访问)。
92
- - 已归档会话若其磁盘文件已被外部删除,移出归档只会把它放回列表(行可能不显示)。
115
+ - Deletion is irreversible (physical file removal); the UI always asks for confirmation.
116
+ - Deleting a live session touches host internals (session store / agent registry
117
+ instance fields); a future DSH refactor may require adapting the plugin (all access is
118
+ defensive).
119
+ - An archived session whose files were removed externally will just reappear in the list
120
+ on unarchive (the row may not display).
93
121
 
94
- ## 开源许可
122
+ ## License
95
123
 
96
- 本项目基于 [MIT License](./LICENSE) 开源。
124
+ [MIT](./LICENSE)
97
125
 
98
- 你可以自由地使用、修改、复制、分发本项目(包括商业用途),但需保留版权声明与
99
- 本许可文本;项目按“现状”提供,作者不对其适用性、可靠性或特定用途的适配性作任何
100
- 明示或默示的担保。完整条款见 [LICENSE](./LICENSE)。
126
+ Free to use, modify, copy, and distribute (including commercially) as long as the
127
+ copyright notice and this license text are retained. The project is provided "as is",
128
+ without warranty of any kind, express or implied. See [LICENSE](./LICENSE) for the full
129
+ terms.
package/README.zh.md ADDED
@@ -0,0 +1,115 @@
1
+ # dsh-session-manager — 会话管理器(删除 + 归档管理)
2
+
3
+ [English](README.md) | 中文
4
+
5
+ [![npm version](https://img.shields.io/npm/v/dsh-session-manager)](https://www.npmjs.com/package/dsh-session-manager)
6
+ [![GitHub](https://img.shields.io/badge/GitHub-repo-blue)](https://github.com/hkkz9522/dsh-session-manager)
7
+ [![CI](https://github.com/hkkz9522/dsh-session-manager/actions/workflows/ci.yml/badge.svg)](https://github.com/hkkz9522/dsh-session-manager/actions/workflows/ci.yml)
8
+
9
+ 为 DeepSeek Harness Web 增加两件官方缺失的能力:
10
+
11
+ 1. **删除对话**(删除前二次确认):物理删除会话 —— 停止并销毁对应 agent、清空
12
+ 会话存储条目(所有标签页同步移除该行)、删除磁盘上的 JSONL 会话目录、
13
+ 清理工作区记账与归档集合。
14
+ 2. **归档管理**:移入归档(官方已有 `workspace.archiveSession`)与 **移出归档**
15
+ (官方 rc.6 没有 unarchive API,本插件在 host 端补齐,走 workspace registry
16
+ 自己的持久化队列,`host/archived-sessions-changed` 帧自动同步所有客户端)。
17
+
18
+ ## 特性
19
+
20
+ - 🗑 **删除会话**:会话头部「删除会话…」按钮 + 管理面板每行删除,全部带二次确认
21
+ - 📦 **归档 / 移出归档**:会话头部按钮 + 管理面板逐行操作
22
+ - 📋 **会话管理面板**(侧边栏底部入口):全部 / 未归档 / 已归档 过滤(已归档会话
23
+ 侧边栏默认不可见,只有这里能找回),每行「打开 / 归档 / 移出归档 / 删除」
24
+ - 🏷 状态徽标:已归档 / 运行中 / 当前会话;相对时间与工作区目录
25
+ - ⚠️ 删除确认弹窗展示会话标题与“不可撤销”警告;会话运行中会提示“删除将立即中断它”
26
+
27
+ ## UI 入口
28
+
29
+ | 位置 | 内容 |
30
+ |---|---|
31
+ | 会话头部(当前会话标题旁) | 「归档 / 移出归档」与「删除会话…」(红色,二次确认弹窗)两个文字按钮 |
32
+ | 侧边栏底部 | 「会话管理」按钮:打开完整管理面板 |
33
+
34
+ ## 安装
35
+
36
+ ### 从 npm 安装(推荐)
37
+
38
+ ```powershell
39
+ dsh plugin --profile web add dsh-session-manager
40
+ ```
41
+
42
+ 重启 web 后生效(profile bundle 自动装配,`lib/` 即运行时产物,无需构建)。
43
+
44
+ ### 从 GitHub 安装(备用)
45
+
46
+ ```powershell
47
+ dsh plugin --profile web add github:hkkz9522/dsh-session-manager
48
+ ```
49
+
50
+ ### 本地开发 / 运行时注入
51
+
52
+ 克隆本仓库后,在已常驻 [dsh-super-injector](https://github.com/yjh051108/dsh-super-injector)
53
+ 的 web 会话中注入(注入即生效,免重启):
54
+
55
+ ```
56
+ dev_inject_plugin {"dir": "<仓库目录绝对路径>"}
57
+ ```
58
+
59
+ ## 卸载
60
+
61
+ - 若通过 `dsh plugin add` 装配:从 `~/.dsh/profiles/web/package.json` 的
62
+ `dependencies` 与 `dsh.profile.bundles` 中移除对应条目,重启。
63
+ - 若通过运行时注入安装:`dev_uninject_plugin {"name": "dsh-session-manager"}`
64
+
65
+ ## 兼容性(升级 DSH 后)
66
+
67
+ - **客户端 UI** 只使用官方插件面(slot 契约 `conversation.session.header.actions` /
68
+ `sidebar.footer.action`、标准工具包 `useSessions` / `useWorkspaces` / `t`、locale、
69
+ client bundle 格式),升级大概率无缝。
70
+ - **host 端** 不 import 任何 `@deepseek-ai` 包(仅 node 内置模块),升级不会在
71
+ 加载期失败;删除 / 移出归档用到了少数 rc.6 未公开的内部结构(已做防御性访问),
72
+ 若未来版本重构这些内部实现,会表现为运行时操作报错而非崩溃,按报错适配即可。
73
+ - `peerDependencies` 仅声明 `cordis` 范围,不硬编码 DSH 版本。
74
+ - 建议升级后自检一次:新建空白会话并删除(端到端 30 秒),或运行
75
+ `node scripts/smoke-test.mjs`(对两个 host 端点的只读冒烟检查,不触碰真实会话)。
76
+
77
+ ## 开发与维护
78
+
79
+ - **无构建步骤**:`lib/` 即运行时产物(host 为 ESM,client 为 loader factory 格式手写 bundle)。
80
+ - **冒烟测试**:`node scripts/smoke-test.mjs [baseUrl]`(需运行中的 dsh web)。
81
+ - **CI**(`.github/workflows/ci.yml`):`node --check` 两个文件 + `npm pack --dry-run`
82
+ 校验发布包内容。
83
+ - 变更记录见 [CHANGELOG.md](./CHANGELOG.md)。
84
+
85
+ ## 实现说明
86
+
87
+ - **host 端**(`lib/index.js`):cordis 插件,注入
88
+ `webServer / workspaceRegistry / sessions / agents / sessionPersistence`,
89
+ 注册两条 HTTP 端点:
90
+ - `POST /session-manager/api/delete { sessionId }`
91
+ - `POST /session-manager/api/unarchive { sessionId }`
92
+ - **client 端**(`lib/client.js`):loader factory 格式手写 bundle(无构建步骤),
93
+ 注册两个 slot:
94
+ - `conversation.session.header.actions`(每会话操作 + 删除确认)
95
+ - `sidebar.footer.action`(会话管理面板入口)
96
+
97
+ 删除 live 会话的顺序:`agent.cancel`(中断运行)→ `agent.scope.dispose`(安静销毁
98
+ agent fiber,3s 上限)→ 从 agents 注册表移除僵尸条目 → `sessions.flush` → 会话
99
+ store 条目 detach(触发 `session/disposed` → 各端移除行)→ 工作区记账清理 →
100
+ 归档集合清理 → 删除磁盘目录。
101
+
102
+ ## 风险与边界
103
+
104
+ - 删除是不可逆操作(文件物理删除),UI 已做二次确认。
105
+ - live 会话删除依赖 host 内部结构(会话 store / agent registry 的实例字段),
106
+ 未来 DSH 版本若重构这些内部实现可能需要同步适配(代码均做了防御性访问)。
107
+ - 已归档会话若其磁盘文件已被外部删除,移出归档只会把它放回列表(行可能不显示)。
108
+
109
+ ## 开源许可
110
+
111
+ 本项目基于 [MIT License](./LICENSE) 开源。
112
+
113
+ 你可以自由地使用、修改、复制、分发本项目(包括商业用途),但需保留版权声明与
114
+ 本许可文本;项目按“现状”提供,作者不对其适用性、可靠性或特定用途的适配性作任何
115
+ 明示或默示的担保。完整条款见 [LICENSE](./LICENSE)。
package/lib/client.js CHANGED
@@ -334,9 +334,13 @@ window.__ModuleLoader__.load({
334
334
  const archived = useMemo(() => new Set(archivedIds), [archivedIds]);
335
335
 
336
336
  const rows = useMemo(() => {
337
+ // Hide subagent sessions and blank workspace placeholders (the
338
+ // "New Session" seat DSH regenerates per workspace on reconnect) —
339
+ // mirror the sidebar's sessionVisible rule: blank rows show only
340
+ // when they are the current session.
337
341
  const all = list.ids
338
342
  .map((id) => list.byId[id])
339
- .filter((s) => s !== void 0 && s.origin !== "subagent");
343
+ .filter((s) => s !== void 0 && s.origin !== "subagent" && (!s.blank || s.id === list.current));
340
344
  if (filter === "active") return all.filter((s) => !archived.has(s.id));
341
345
  if (filter === "archived") return all.filter((s) => archived.has(s.id));
342
346
  return all;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-session-manager",
3
- "version": "0.1.0",
4
- "description": "会话管理器:删除对话(删除前二次确认)+ 归档管理(移入/移出归档),Web UI 全面接管侧边栏会话列表与头部操作",
3
+ "version": "0.1.2",
4
+ "description": "Session manager for DeepSeek Harness: delete conversations with confirmation and manage archives. 会话管理器:删除对话(二次确认)+ 归档管理。",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "dsh",
@@ -29,7 +29,8 @@
29
29
  "lib",
30
30
  "cordis.patch.yml",
31
31
  "LICENSE",
32
- "README.md"
32
+ "README.md",
33
+ "README.zh.md"
33
34
  ],
34
35
  "dsh": {
35
36
  "bundle": {