dsh-session-manager 0.4.6 → 0.4.9

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 CHANGED
@@ -1,119 +1,216 @@
1
- # Changelog
2
-
3
- ## 0.4.6 — 2026-09-05
4
-
5
- - **fix(persistence)**: read all concatenated Zstandard frames in a session
6
- artifact. DSH writes one frame for the header and additional frames for
7
- event batches; reading only the first frame made sessions appear to lose
8
- their event history after refresh.
9
- - **fix(move)**: preserve the session generation/header version when
10
- re-homing an artifact, and synchronize the live session, persistence
11
- coordinator, registry indexes, and workspace accounting after a move.
12
- This avoids stale-path `ENOENT` failures and v2/v0 filename/header
13
- mismatches on the next DSH startup.
14
- - **fix(preset migration)**: fall back to an id-based artifact scan when a
15
- persistence locate result points at a stale path, and mirror cold-path
16
- migrations into the live session projection.
17
- - **fix(client)**: stop calling the removed/unavailable
18
- `noteAgentPreset` client method; refresh the session projection instead.
19
- - **recovery**: add `scripts/heal-v2-sessions.ps1` for the DSH 0.1.1-rc.2
20
- boot-time quirk where `session.v2.jsonl.zstd` contains a `version: 0`
21
- header. Run it before starting DSH; this repair must happen before DSH's
22
- workspace initialization, which is earlier than user plugin `apply()`.
23
-
24
- - **docs**: bump version to 0.4.6.
25
- ## 0.4.5 — 2026-09-05
26
-
27
- - **fix(move)**: keep the live session and agent in place during a cross-workspace
28
- move. The previous code tore down the live agent/session, moved the file, then
29
- called `ctx.agents.resume` to re-create the agent. DSH's `agent/status` event
30
- is only emitted on phase changes, so a freshly resumed agent never told the
31
- client it was now idle, leaving the sidebar's model selector and send button
32
- disabled ("会话不可用") until a manual browser refresh. The new path flushes
33
- pending events to disk, updates the in-memory session header + coordinator
34
- state + workspace accounting in place, and atomically renames the artifact,
35
- so the agent's UI keeps showing the same in-memory session with no client
36
- re-init.
37
- - **fix(preset migration)**: drop the over-strict `persistence.readRaw` /
38
- `persistence.list` precondition that caused the
39
- `/session-manager/api/preset-scan` endpoint to fail with
40
- `current persistence backend does not support readRaw/list` on a default DSH
41
- build. The actual `JsonlSessionPersistence` backend exposes both methods, so
42
- the precondition is replaced with a try/catch around `listSessionHeaders` that
43
- converts any missing-method failure into a useful
44
- `failed to enumerate sessions: <detail>` message.
45
- - **chore**: remove the now-unused `quietLive` / `releaseLiveSession` helpers
46
- and squash the per-route indentation noise around `/move` and `/workspaces`.
47
-
48
- ## 0.4.4 — 2026-09-03
49
-
50
- - **docs**: rename the English README wording from `conversation` to `session` to align with the plugin name (`dsh-session-manager`), the Chinese README (`会话`), the DSH host APIs, and the [awesome-dsh-plugin](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin) registry entry.
51
- - **chore**: rewrite `package.json` `description` to use `Session manager` / `sessions` for the same alignment, and bump the version to `0.4.4`.
52
- - **chore(repo)**: update the GitHub repository description to match.
53
-
54
- ## 0.4.3 — 2026-09-03
55
-
56
- - **docs**: add the [Awesome DSH Plugin](https://awesome-dsh-plugin.com) badge to `README.md` / `README.zh.md` so the repo surfaces its curated registry membership.
57
-
58
- ## 0.4.2 — 2026-09-03
59
-
60
- - **feat(theme)**: dialogs now auto-follow DSH''s dark/light theme (`data-ds-dark-theme` / ` `code-scheme` / `data-theme`) via a single `data-sm-theme` attribute and scoped CSS variables, with inline `background` / `color` / `border-color` applied to each dialog root so they stay opaque regardless of how DSH resolves its own tokens. The previous manual light/dark toggle button is removed.
61
- - **docs**: aligned bilingual README structure, dropped the obsolete "no bulk migration" wording, and added an Acknowledgments section that thanks the users and the contributors filing issues and opening PRs. Listed [dsh-market](https://github.com/dsh-market/dsh-market) and [awesome-dsh-plugin](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin) as install sources.
62
- - **chore**: rewrote `package.json` `description` to match the new English summary.
63
-
64
- ## 0.4.1 — 2026-08-28
65
-
66
- - **fix(ui)**: keep the title-bar **Delete conversation** button readable on hover with a red background, white text, and red border; remove the unused legacy danger-button rules.
67
-
68
- ## 0.4.0 — 2026-08-28
69
-
70
- - **feat(session preset migration)**: replaces the former bulk workflow with a
71
- per-conversation **Migrate preset** action in Session manager. It resolves the
72
- effective preset from the latest `agent-preset/selected` event or, when absent,
73
- the session header, then safely updates that one conversation.
74
- - **fix(lifecycle)**: moving a conversation or migrating its preset now retires stale
75
- live agents and persistence owners before refresh. This prevents resume failures
76
- such as `already has a live persistence owner`.
77
- - **fix(move)**: refreshes session and workspace state immediately and once more after
78
- the host event race, so a moved conversation reappears in its target workspace
79
- without a manual browser refresh.
80
- - **ui**: finalizes header actions and Session manager dialogs: red delete actions,
81
- per-row preset migration, consistent dialog placement, readable hover states, and
82
- a close button beside the manager title.
83
- - **docs**: refreshes bilingual documentation and npm metadata for the single-session
84
- preset migration workflow.
85
-
86
- ## 0.3.0 — 2026-08-27
87
-
88
- - **feat(preset migration)**: introduced preset migration support for conversations
89
- whose configured Agent preset was renamed or removed.
90
- - **feat(move)**: added workspace move handling and client-side workspace refreshes.
91
-
92
- ## 0.2.1 — 2026-08-26
93
-
94
- - **fix(move)**: reimplemented cross-workspace moves so the session artifact, stored
95
- `cwd`, and workspace accounting are moved together while preserving history,
96
- title, archive state, and derived-session relationships.
97
- - **feat(workspaces API)**: added the workspace projection endpoint used by the move UI.
98
- - **guard**: reject subagent and transient blank-session placeholders for move actions.
99
-
100
- ## 0.2.0 — 2026-08-16
101
-
102
- > ⚠️ The initial workspace-move implementation was superseded by 0.2.1.
103
-
104
- - **feat(move)**: added the initial move-to-workspace UI and host endpoints.
105
-
106
- ## 0.1.2 — 2026-08-16
107
-
108
- - **docs**: synchronized package metadata and bilingual README files for publication.
109
-
110
- ## 0.1.1 — 2026-08-16
111
-
112
- - **fix(panel)**: hide transient blank-session placeholders from the manager panel.
113
- - **test**: added the host API smoke test.
114
- - **ci**: added syntax and package-content verification.
115
-
116
- ## 0.1.0 — 2026-08-16
117
-
118
- - **feat**: initial session deletion with confirmation, archive management, and the
119
- Session manager panel.
1
+ # Changelog
2
+
3
+
4
+ ## 0.4.9 — 2026-09-12
5
+
6
+ - **fix(ui)**: Session manager panel and inner dialogs (Delete / Move /
7
+ Migrate confirmations) now close on Esc regardless of focus
8
+ position (issue #7). The original layer-bound onKeyDown was
9
+ unreachable because the sidebar toggle / row button that opened
10
+ each modal stayed focused -- focus is a sibling of the layer,
11
+ not a descendant, so keydown never bubbles into the modal subtree.
12
+ ConfirmDialog / MoveDialog are also used by the title-bar Delete
13
+ / Move actions, so this fix applies there too.
14
+
15
+ - **fix(ui)**: Modals now close ONLY via Esc or their explicit close
16
+ buttons. The original 0.4.7 behavior (close on backdrop click)
17
+ was removed per user feedback -- a stray click outside the panel
18
+ was dismissing it accidentally. Every `.sm-nativeDialogBackdrop`
19
+ `onMouseDown` handler is gone; the dim backdrop itself is also
20
+ gone so opening a modal never darkens the page (sidebar or
21
+ content area).
22
+
23
+ - **refactor(ui)**: Esc handling moved from per-layer `onKeyDown`
24
+ to a `window`-level `keydown` listener via `useEffect` on every
25
+ modal. A `useRef` lets the listener see the latest state values
26
+ without re-subscribing on every render. The panel listener
27
+ returns early when any inner dialog is open so the child
28
+ dialog's listener gets the first shot at Esc.
29
+
30
+ - **fix(ui)**: After a keyboard-driven close (Esc), the originally
31
+ focused trigger button (sidebar toggle / row button / Cancel
32
+ button) no longer leaves a lingering `:focus-visible` ring. The
33
+ four Esc handlers `blur()` the active element after the close
34
+ call. Mouse-driven closes are not affected -- `:focus-visible`
35
+ only activates for keyboard-acquired focus.
36
+
37
+ - **fix(ui)**: ConfirmDialog no longer listens for Enter at the
38
+ layer level. The previous handler raced with the focused Cancel
39
+ button's native Enter handler -- both fired (`onCancel` +
40
+ `onConfirm`). Enter now lives only on the focused button.
41
+
42
+ - **cleanup(ui)**: Remove three dead `<section>` `ref={(el) =>
43
+ el.focus()}` callbacks (sections have no `tabindex` and are
44
+ not focusable, so the focus calls were silent no-ops). Also
45
+ remove the now-unused `onPanelKey` callback and `tabIndex: -1`
46
+ attributes on the modal layers. The `.sm-nativeDialogBackdrop`
47
+ divs are no longer rendered at all -- they had no behavior left
48
+ after removing the click-to-close.
49
+
50
+ - **chore**: bump version to 0.4.9.
51
+
52
+ ## 0.4.8 — 2026-09-11
53
+
54
+ - **perf(listSessionHeaders)**: skip known session directories before any
55
+ fopen. The disk fallback loop previously opened and zstd-decoded every
56
+ candidate file under `<dshHome>/sessions/<proj>/<dir>/` even when the
57
+ persistence layer had already returned those ids, wasting O(N *
58
+ file_size) read+inflate per call. On a healthy 80-session / 249 MB
59
+ library that meant +17s CPU / +254 MB read per DSH startup, paid three
60
+ times (post-boot sweep, cross-workspace move, preset-scan). We now
61
+ pre-build a `knownDirs` set from the persisted ids (both the raw id
62
+ and `encodeSessionSegment(id)`) and skip matching directories with
63
+ an O(1) Set lookup. Orphan raw-id directories that the index does not
64
+ know about still fall through to the file read so the disk fallback
65
+ semantics are preserved. Fixes
66
+ [issue #6](https://github.com/hkkz9522/dsh-session-manager/issues/6).
67
+
68
+ - **refactor(listSessionHeaders)**: replace the inline concatenated-zstd
69
+ walk with `decompressAllZstdFrames` from `lib/compat/zstd-frames.js`,
70
+ removing ~30 lines of duplicated decoder logic. Async decompression
71
+ yields to the event loop between frames -- a net win on the orphan
72
+ path even though the hot path is now skipped entirely.
73
+
74
+ - **perf(moveSession)**: resolve the pre-flight session header via
75
+ `persistence.list().find()` first, and only call the disk-fallback
76
+ `listSessionHeaders()` when the index missed. Previously moveSession
77
+ paid the (pre-fix) full-library scan every time; now the common case
78
+ is one `.list()` + `.find()`.
79
+
80
+ - **chore**: hoist `encodeSessionSegment` and `listSessionHeaders` to
81
+ module scope so the regression test can exercise them in isolation;
82
+ add `export { listSessionHeaders, encodeSessionSegment }` for the
83
+ same reason. Behavior is unchanged.
84
+
85
+ - **chore**: bump version to 0.4.8.
86
+
87
+
88
+ ## 0.4.7 — 2026-09-10
89
+
90
+ - **fix(disk scan)**: include `session.v3.jsonl.zstd` in the on-disk
91
+ filename list used by readSessionArtifact() and listSessionHeaders().
92
+ DSH 0.1.5-rc.1's persistence backend writes generation v3 artifacts at
93
+ that filename; the 0.4.6 release scanned only v2/plaintext names, so
94
+ fresh sessions appeared to have no disk record and the move/migrate
95
+ endpoints failed with "会话没有磁盘记录" / "session has no artifact".
96
+
97
+ - **chore**: bump version to 0.4.7.
98
+
99
+
100
+ ## 0.4.6 — 2026-09-05
101
+
102
+ - **fix(persistence)**: read all concatenated Zstandard frames in a session
103
+ artifact. DSH writes one frame for the header and additional frames for
104
+ event batches; reading only the first frame made sessions appear to lose
105
+ their event history after refresh.
106
+ - **fix(move)**: preserve the session generation/header version when
107
+ re-homing an artifact, and synchronize the live session, persistence
108
+ coordinator, registry indexes, and workspace accounting after a move.
109
+ This avoids stale-path `ENOENT` failures and v2/v0 filename/header
110
+ mismatches on the next DSH startup.
111
+ - **fix(preset migration)**: fall back to an id-based artifact scan when a
112
+ persistence locate result points at a stale path, and mirror cold-path
113
+ migrations into the live session projection.
114
+ - **fix(client)**: stop calling the removed/unavailable
115
+ `noteAgentPreset` client method; refresh the session projection instead.
116
+ - **recovery**: add `scripts/heal-v2-sessions.ps1` for the DSH 0.1.1-rc.2
117
+ boot-time quirk where `session.v2.jsonl.zstd` contains a `version: 0`
118
+ header. Run it before starting DSH; this repair must happen before DSH's
119
+ workspace initialization, which is earlier than user plugin `apply()`.
120
+
121
+ - **docs**: bump version to 0.4.6.
122
+ ## 0.4.5 — 2026-09-05
123
+
124
+ - **fix(move)**: keep the live session and agent in place during a cross-workspace
125
+ move. The previous code tore down the live agent/session, moved the file, then
126
+ called `ctx.agents.resume` to re-create the agent. DSH's `agent/status` event
127
+ is only emitted on phase changes, so a freshly resumed agent never told the
128
+ client it was now idle, leaving the sidebar's model selector and send button
129
+ disabled ("会话不可用") until a manual browser refresh. The new path flushes
130
+ pending events to disk, updates the in-memory session header + coordinator
131
+ state + workspace accounting in place, and atomically renames the artifact,
132
+ so the agent's UI keeps showing the same in-memory session with no client
133
+ re-init.
134
+ - **fix(preset migration)**: drop the over-strict `persistence.readRaw` /
135
+ `persistence.list` precondition that caused the
136
+ `/session-manager/api/preset-scan` endpoint to fail with
137
+ `current persistence backend does not support readRaw/list` on a default DSH
138
+ build. The actual `JsonlSessionPersistence` backend exposes both methods, so
139
+ the precondition is replaced with a try/catch around `listSessionHeaders` that
140
+ converts any missing-method failure into a useful
141
+ `failed to enumerate sessions: <detail>` message.
142
+ - **chore**: remove the now-unused `quietLive` / `releaseLiveSession` helpers
143
+ and squash the per-route indentation noise around `/move` and `/workspaces`.
144
+
145
+ ## 0.4.4 — 2026-09-03
146
+
147
+ - **docs**: rename the English README wording from `conversation` to `session` to align with the plugin name (`dsh-session-manager`), the Chinese README (`会话`), the DSH host APIs, and the [awesome-dsh-plugin](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin) registry entry.
148
+ - **chore**: rewrite `package.json` `description` to use `Session manager` / `sessions` for the same alignment, and bump the version to `0.4.4`.
149
+ - **chore(repo)**: update the GitHub repository description to match.
150
+
151
+ ## 0.4.3 — 2026-09-03
152
+
153
+ - **docs**: add the [Awesome DSH Plugin](https://awesome-dsh-plugin.com) badge to `README.md` / `README.zh.md` so the repo surfaces its curated registry membership.
154
+
155
+ ## 0.4.2 — 2026-09-03
156
+
157
+ - **feat(theme)**: dialogs now auto-follow DSH''s dark/light theme (`data-ds-dark-theme` / ` `code-scheme` / `data-theme`) via a single `data-sm-theme` attribute and scoped CSS variables, with inline `background` / `color` / `border-color` applied to each dialog root so they stay opaque regardless of how DSH resolves its own tokens. The previous manual light/dark toggle button is removed.
158
+ - **docs**: aligned bilingual README structure, dropped the obsolete "no bulk migration" wording, and added an Acknowledgments section that thanks the users and the contributors filing issues and opening PRs. Listed [dsh-market](https://github.com/dsh-market/dsh-market) and [awesome-dsh-plugin](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin) as install sources.
159
+ - **chore**: rewrote `package.json` `description` to match the new English summary.
160
+
161
+ ## 0.4.1 — 2026-08-28
162
+
163
+ - **fix(ui)**: keep the title-bar **Delete conversation** button readable on hover with a red background, white text, and red border; remove the unused legacy danger-button rules.
164
+
165
+ ## 0.4.0 — 2026-08-28
166
+
167
+ - **feat(session preset migration)**: replaces the former bulk workflow with a
168
+ per-conversation **Migrate preset** action in Session manager. It resolves the
169
+ effective preset from the latest `agent-preset/selected` event or, when absent,
170
+ the session header, then safely updates that one conversation.
171
+ - **fix(lifecycle)**: moving a conversation or migrating its preset now retires stale
172
+ live agents and persistence owners before refresh. This prevents resume failures
173
+ such as `already has a live persistence owner`.
174
+ - **fix(move)**: refreshes session and workspace state immediately and once more after
175
+ the host event race, so a moved conversation reappears in its target workspace
176
+ without a manual browser refresh.
177
+ - **ui**: finalizes header actions and Session manager dialogs: red delete actions,
178
+ per-row preset migration, consistent dialog placement, readable hover states, and
179
+ a close button beside the manager title.
180
+ - **docs**: refreshes bilingual documentation and npm metadata for the single-session
181
+ preset migration workflow.
182
+
183
+ ## 0.3.0 — 2026-08-27
184
+
185
+ - **feat(preset migration)**: introduced preset migration support for conversations
186
+ whose configured Agent preset was renamed or removed.
187
+ - **feat(move)**: added workspace move handling and client-side workspace refreshes.
188
+
189
+ ## 0.2.1 — 2026-08-26
190
+
191
+ - **fix(move)**: reimplemented cross-workspace moves so the session artifact, stored
192
+ `cwd`, and workspace accounting are moved together while preserving history,
193
+ title, archive state, and derived-session relationships.
194
+ - **feat(workspaces API)**: added the workspace projection endpoint used by the move UI.
195
+ - **guard**: reject subagent and transient blank-session placeholders for move actions.
196
+
197
+ ## 0.2.0 — 2026-08-16
198
+
199
+ > ⚠️ The initial workspace-move implementation was superseded by 0.2.1.
200
+
201
+ - **feat(move)**: added the initial move-to-workspace UI and host endpoints.
202
+
203
+ ## 0.1.2 — 2026-08-16
204
+
205
+ - **docs**: synchronized package metadata and bilingual README files for publication.
206
+
207
+ ## 0.1.1 — 2026-08-16
208
+
209
+ - **fix(panel)**: hide transient blank-session placeholders from the manager panel.
210
+ - **test**: added the host API smoke test.
211
+ - **ci**: added syntax and package-content verification.
212
+
213
+ ## 0.1.0 — 2026-08-16
214
+
215
+ - **feat**: initial session deletion with confirmation, archive management, and the
216
+ Session manager panel.
package/README.md CHANGED
@@ -1,113 +1,108 @@
1
- # dsh-session-manager — session manager for DeepSeek Harness
2
-
3
- English | [中文](README.zh.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-repository-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
- [![Awesome DSH Plugin](https://awesome-dsh-plugin.com/badge.svg)](https://awesome-dsh-plugin.com)
9
-
10
- A DeepSeek Harness (DSH) Web plugin for session management: delete sessions, archive sessions, move sessions across workspaces, and migrate a session's Agent preset. Suggestions are welcome on GitHub.
11
-
12
- ## Features
13
-
14
- - **Archive / unarchive** sessions.
15
- - **Delete sessions** with an explicit irreversible-action confirmation.
16
- - **Move to workspace**: preserves history, title, archive state, and derived-session relationships, and updates the session's working directory to the target workspace.
17
- - **Migrate Agent preset**: change the preset on demand. Typical use case: when the original preset was renamed or removed and the session can no longer resume, you can repair that session.
18
- - **Session manager**: browse active and archived sessions in the sidebar, and run Open, Archive / Unarchive, Move, Delete, or Migrate preset on each row.
19
- - The current session's title area offers Archive / Unarchive, Move to workspace, and a red Delete session button.
20
-
21
- ## Where to find the UI
22
-
23
- - **Session title area (right side):** archive/unarchive, move to workspace, delete session.
24
- - **Sidebar footer → Session manager:** browse all sessions (including archived ones) and operate on each one.
25
-
26
- ## Agent preset migration
27
-
28
- Use this when a session can no longer resume because its original preset no longer exists, for example after removing a custom preset such as `router-standard`.
29
-
30
- 1. Open **Session manager**.
31
- 2. Locate the session and select **Migrate preset**.
32
- 3. Choose one of the currently available target presets and confirm.
33
-
34
- The plugin determines the session's effective preset from its latest `agent-preset/selected` event when present; otherwise it uses the session header. It safely updates the relevant stored value, releases any live persistence owner, and refreshes the session list. If the migrated session is open, reopen it before continuing the chat.
35
-
36
- > A preset migration changes session metadata only. It does not alter message history, files, or the selected workspace.
37
-
38
- ## Install
39
-
40
- The plugin is listed in [dsh-market](https://github.com/dsh-market/dsh-market) and [awesome-dsh-plugin](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin), and can be installed directly from the **Plugin Marketplace** inside DSH.
41
-
42
- ### From dsh-market
43
-
44
- ```powershell
45
- dsh plugin --profile web add npm:dsh-session-manager
46
- ```
47
-
48
- ### From GitHub
49
-
50
- ```powershell
51
- dsh plugin --profile web add github:hkkz9522/dsh-session-manager
52
- ```
53
-
54
- Restart DSH Web after installation. If the browser still holds an older client bundle, force refresh with `Ctrl+Shift+R`.
55
-
56
- ### Local development / runtime injection
57
-
58
- ```text
59
- dev_inject_plugin {"dir": "<absolute path to this repository>"}
60
- ```
61
-
62
- ## HTTP API
63
-
64
- The following local endpoints are used by the Web UI and are also useful for integration and diagnostics:
65
-
66
- ```text
67
- POST /session-manager/api/delete { sessionId }
68
- POST /session-manager/api/unarchive { sessionId }
69
- GET /session-manager/api/workspaces
70
- POST /session-manager/api/move { sessionId, targetWorkspaceId }
71
- GET /session-manager/api/preset-scan?sessionId=<sessionId>
72
- POST /session-manager/api/preset-migrate { sessionId, toPreset }
73
- ```
74
-
75
- Example: migrate a session to the `standard` preset.
76
-
77
- ```bash
78
- curl -s -X POST http://127.0.0.1:3080/session-manager/api/preset-migrate \
79
- -H 'content-type: application/json' \
80
- -d '{"sessionId":"session-...","toPreset":"standard"}'
81
- ```
82
-
83
- ## Safety and behavior
84
-
85
- - **Deletion is permanent**, so the UI always asks for confirmation.
86
- - Moving a running session first interrupts and closes it, then refreshes the sidebar; reopen the session from the target workspace to continue.
87
- - Move rewrites the session's stored `cwd`; subsequent tool calls run in the target workspace.
88
- - Subagent sessions and transient blank-session placeholders are excluded from delete, move, and preset migration.
89
- - File rewrites use temporary files and atomic replacement (when supported by the environment) to avoid partially written session artifacts.
90
-
91
- ## Compatibility and development
92
-
93
- - This is a Cordis plugin with peer dependency `cordis >=4.0.0-rc <5`.
94
- - `lib/index.js` is the host-side ESM plugin, `lib/client.js` is the Web client bundle; no build step is required.
95
- - Before submitting changes, run:
96
-
97
- ```powershell
98
- node --check lib/client.js
99
- node --check lib/index.js
100
- git diff --check
101
- node scripts/smoke-test.mjs
102
- npm pack --dry-run
103
- ```
104
-
105
- Release history is in [CHANGELOG.md](CHANGELOG.md).
106
-
107
- ## Acknowledgments
108
-
109
- Thanks to everyone who installs and uses dsh-session-manager, and to the people who file issues and open pull requests to help improve it. This plugin is listed in [dsh-market](https://github.com/dsh-market/dsh-market) and [awesome-dsh-plugin](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin). Suggestions and feedback are welcome.
110
-
111
- ## License
112
-
1
+ # dsh-session-manager — session manager for DeepSeek Harness
2
+
3
+ English | [中文](README.zh.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-repository-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
+ [![Awesome DSH Plugin](https://awesome-dsh-plugin.com/badge.svg)](https://awesome-dsh-plugin.com)
9
+
10
+ A DeepSeek Harness (DSH) Web plugin for session management: delete sessions, archive sessions, move sessions across workspaces, and migrate a session's Agent preset. Suggestions are welcome on GitHub.
11
+
12
+ ## Features
13
+
14
+ - **Archive / unarchive** sessions.
15
+ - **Delete sessions** with an explicit irreversible-action confirmation.
16
+ - **Move to workspace**: preserves history, title, archive state, and derived-session relationships, and rewrites the session's working directory to the target workspace.
17
+ - **Migrate Agent preset**: change the preset on demand. Typical use case: when the original preset was renamed or removed and the session can no longer resume, you can repair that session.
18
+ - **Session manager panel**: browse active and archived sessions in the sidebar, and run Open, Archive / Unarchive, Move, Migrate preset, or Delete on each row.
19
+ - The current session's title area offers Archive / Unarchive, Move to workspace, and a red Delete session button.
20
+ - Each dialog button (Move, Migrate preset, Delete, plus the Session manager toggle) closes its own popup when clicked a second time, matching the built-in title-area buttons.
21
+
22
+ ## Where to find the UI
23
+
24
+ - **Session title area (right side):** Archive / Unarchive, Move to workspace, Delete session.
25
+ - **Sidebar footer → Session manager:** browse all sessions (including archived ones) and operate on each one.
26
+
27
+ ## Agent preset migration
28
+
29
+ Use this when a session can no longer resume because its original preset no longer exists, for example after removing a custom preset such as `router-standard`.
30
+
31
+ 1. Open **Session manager**.
32
+ 2. Locate the session and select **Migrate preset**.
33
+ 3. Choose one of the currently available target presets and confirm.
34
+
35
+ The plugin determines the session's effective preset from its latest `agent-preset/selected` event when present; otherwise it uses the session header. It then rewrites that event in place (or appends a fresh one if the session has never recorded a selection), so the migration is durable and the prior entry remains visible in the event log as history. For a live session, the new event is appended in memory via `Session.append()` and flushed to disk via `SessionStore.flush()`; the api-gateway's chat panel sees the new preset on the next event fold.
36
+
37
+ > A preset migration changes session metadata only. It does not alter message history, files, or the selected workspace.
38
+
39
+ ## Install
40
+
41
+ The plugin is listed in [dsh-market](https://github.com/dsh-market/dsh-market) and [awesome-dsh-plugin](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin), and can be installed directly from the **Plugin Marketplace** inside DSH.
42
+
43
+ ### From dsh-market
44
+
45
+ ```powershell
46
+ dsh plugin --profile web add npm:dsh-session-manager
47
+ ```
48
+
49
+ ### From GitHub
50
+
51
+ ```powershell
52
+ dsh plugin --profile web add github:hkkz9522/dsh-session-manager
53
+ ```
54
+
55
+ Restart DSH Web after installation. If the browser still holds an older client bundle, force refresh with `Ctrl+Shift+R`.
56
+
57
+ ### Local development / runtime injection
58
+
59
+ ```text
60
+ dev_inject_plugin {"dir": "<absolute path to this repository>"}
61
+ ```
62
+
63
+ ## Safety and behavior
64
+
65
+ - **Deletion is permanent**, so the UI always asks for confirmation.
66
+ - Move and Migrate preset do **not** tear down the live agent or session. They keep the in-memory session/agent alive, write the new artifact in place, update the in-memory session header to point at the new cwd (move) or append the new event (migrate), and refresh the workspace registry. The api-gateway's chat panel therefore stays "available" without a manual refresh.
67
+ - Move rewrites the session's stored `cwd`; subsequent tool calls run in the target workspace.
68
+ - Subagent sessions and transient blank-session placeholders are excluded from Delete, Move, and Migrate preset.
69
+ - The move path encodes the artifact in the backend's own physical layout (zstd frames with a one-header-line first frame, or plain JSONL), matching DSH's own writer. The migrate path rewrites the relevant event in place at the existing file.
70
+
71
+ ## Compatibility
72
+
73
+ | Plugin version | Verified DSH version |
74
+ | --- | --- |
75
+ | 0.4.9 | v0.1.5-rc.1 |
76
+ | 0.4.7 | v0.1.5-rc.1 |
77
+ | 0.4.4 | 0.1.3-alpha.2 |
78
+ | 0.4.1 | 0.1.3-alpha.2 |
79
+ | 0.4.0 | v0.1.2-rc.1 |
80
+ | 0.1.2 | v0.1.0-rc.7 |
81
+ | 0.1.1 | v0.1.0-rc.7 |
82
+ | 0.1.0 | v0.1.0-rc.7 |
83
+
84
+ The plugin is a Cordis plugin and declares `cordis: ">=4.0.0-rc <5"` as its peer dependency.
85
+
86
+ ## Development
87
+
88
+ - `lib/index.js` is the host-side ESM plugin; `lib/client.js` is the Web client bundle. No build step is required.
89
+ - Before submitting changes, run:
90
+
91
+ ```powershell
92
+ node --check lib/client.js
93
+ node --check lib/index.js
94
+ node --test test/*.test.mjs
95
+ node scripts/smoke-test.mjs
96
+ git diff --check
97
+ npm pack --dry-run
98
+ ```
99
+
100
+ Release history is in [CHANGELOG.md](CHANGELOG.md).
101
+
102
+ ## Acknowledgments
103
+
104
+ Thanks to everyone who installs and uses dsh-session-manager, and to the people who file issues and open pull requests to help improve it. This plugin is listed in [dsh-market](https://github.com/dsh-market/dsh-market) and [awesome-dsh-plugin](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin). Suggestions and feedback are welcome.
105
+
106
+ ## License
107
+
113
108
  [MIT](LICENSE)