dsh-session-manager 0.4.9 → 0.4.10

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.
Files changed (5) hide show
  1. package/CHANGELOG.md +136 -167
  2. package/README.md +108 -107
  3. package/README.zh.md +1 -0
  4. package/lib/index.js +1247 -1207
  5. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
- # Changelog
2
-
1
+ # Changelog
2
+
3
+ ## 0.4.10 — 2026-09-13
4
+
5
+ - **fix(move)**: cross-workspace move no longer breaks the live JSONL writer. The DSH JSONL backend keeps one `JsonlSessionHandle` per session id in an in-process tracker; its `header.cwd` is captured at construction, and the api-gateway's `session/event` router writes through that handle, so a session whose header was rewritten in memory but whose writer was still pointing at the pre-move directory started throwing `ENOENT` on the first new message (issue #8). `moveSession` now mutates the live writer's `header` in place so its persist path flips to the target `cwd` while the same handle, queue, cursor, and lease are retained; the Agent's owned handle therefore stays consistent with the tracker entry, and no `session/disposed` is fabricated. If the runtime does not expose a rebindable writer (older DSH builds or a custom backend), the move now refuses up front with a clear message instead of silently leaving the live session writing to a deleted path. Adds `test/issue-8-move-enoent.test.mjs` (post-move writer identity stability + a "no-fix ENOENT" regression guard) and `test/issue-8-repro/` (a standalone reproducer script).
6
+
7
+ - **chore**: bump version to 0.4.10.
3
8
 
4
9
  ## 0.4.9 — 2026-09-12
5
10
 
@@ -49,168 +54,132 @@
49
54
 
50
55
  - **chore**: bump version to 0.4.9.
51
56
 
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.
57
+ ## 0.4.7 — 2026-09-10
58
+
59
+ - **fix(disk scan)**: include `session.v3.jsonl.zstd` in the on-disk
60
+ filename list used by readSessionArtifact() and listSessionHeaders().
61
+ DSH 0.1.5-rc.1's persistence backend writes generation v3 artifacts at
62
+ that filename; the 0.4.6 release scanned only v2/plaintext names, so
63
+ fresh sessions appeared to have no disk record and the move/migrate
64
+ endpoints failed with "会话没有磁盘记录" / "session has no artifact".
65
+
66
+ - **chore**: bump version to 0.4.7.
67
+
68
+
69
+ ## 0.4.6 — 2026-09-05
70
+
71
+ - **fix(persistence)**: read all concatenated Zstandard frames in a session
72
+ artifact. DSH writes one frame for the header and additional frames for
73
+ event batches; reading only the first frame made sessions appear to lose
74
+ their event history after refresh.
75
+ - **fix(move)**: preserve the session generation/header version when
76
+ re-homing an artifact, and synchronize the live session, persistence
77
+ coordinator, registry indexes, and workspace accounting after a move.
78
+ This avoids stale-path `ENOENT` failures and v2/v0 filename/header
79
+ mismatches on the next DSH startup.
80
+ - **fix(preset migration)**: fall back to an id-based artifact scan when a
81
+ persistence locate result points at a stale path, and mirror cold-path
82
+ migrations into the live session projection.
83
+ - **fix(client)**: stop calling the removed/unavailable
84
+ `noteAgentPreset` client method; refresh the session projection instead.
85
+ - **recovery**: add `scripts/heal-v2-sessions.ps1` for the DSH 0.1.1-rc.2
86
+ boot-time quirk where `session.v2.jsonl.zstd` contains a `version: 0`
87
+ header. Run it before starting DSH; this repair must happen before DSH's
88
+ workspace initialization, which is earlier than user plugin `apply()`.
89
+
90
+ - **docs**: bump version to 0.4.6.
91
+ ## 0.4.5 — 2026-09-05
92
+
93
+ - **fix(move)**: keep the live session and agent in place during a cross-workspace
94
+ move. The previous code tore down the live agent/session, moved the file, then
95
+ called `ctx.agents.resume` to re-create the agent. DSH's `agent/status` event
96
+ is only emitted on phase changes, so a freshly resumed agent never told the
97
+ client it was now idle, leaving the sidebar's model selector and send button
98
+ disabled ("会话不可用") until a manual browser refresh. The new path flushes
99
+ pending events to disk, updates the in-memory session header + coordinator
100
+ state + workspace accounting in place, and atomically renames the artifact,
101
+ so the agent's UI keeps showing the same in-memory session with no client
102
+ re-init.
103
+ - **fix(preset migration)**: drop the over-strict `persistence.readRaw` /
104
+ `persistence.list` precondition that caused the
105
+ `/session-manager/api/preset-scan` endpoint to fail with
106
+ `current persistence backend does not support readRaw/list` on a default DSH
107
+ build. The actual `JsonlSessionPersistence` backend exposes both methods, so
108
+ the precondition is replaced with a try/catch around `listSessionHeaders` that
109
+ converts any missing-method failure into a useful
110
+ `failed to enumerate sessions: <detail>` message.
111
+ - **chore**: remove the now-unused `quietLive` / `releaseLiveSession` helpers
112
+ and squash the per-route indentation noise around `/move` and `/workspaces`.
113
+
114
+ ## 0.4.4 — 2026-09-03
115
+
116
+ - **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.
117
+ - **chore**: rewrite `package.json` `description` to use `Session manager` / `sessions` for the same alignment, and bump the version to `0.4.4`.
118
+ - **chore(repo)**: update the GitHub repository description to match.
119
+
120
+ ## 0.4.3 — 2026-09-03
121
+
122
+ - **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.
123
+
124
+ ## 0.4.2 — 2026-09-03
125
+
126
+ - **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.
127
+ - **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.
128
+ - **chore**: rewrote `package.json` `description` to match the new English summary.
129
+
130
+ ## 0.4.1 — 2026-08-28
131
+
132
+ - **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.
133
+
134
+ ## 0.4.0 — 2026-08-28
135
+
136
+ - **feat(session preset migration)**: replaces the former bulk workflow with a
137
+ per-conversation **Migrate preset** action in Session manager. It resolves the
138
+ effective preset from the latest `agent-preset/selected` event or, when absent,
139
+ the session header, then safely updates that one conversation.
140
+ - **fix(lifecycle)**: moving a conversation or migrating its preset now retires stale
141
+ live agents and persistence owners before refresh. This prevents resume failures
142
+ such as `already has a live persistence owner`.
143
+ - **fix(move)**: refreshes session and workspace state immediately and once more after
144
+ the host event race, so a moved conversation reappears in its target workspace
145
+ without a manual browser refresh.
146
+ - **ui**: finalizes header actions and Session manager dialogs: red delete actions,
147
+ per-row preset migration, consistent dialog placement, readable hover states, and
148
+ a close button beside the manager title.
149
+ - **docs**: refreshes bilingual documentation and npm metadata for the single-session
150
+ preset migration workflow.
151
+
152
+ ## 0.3.0 — 2026-08-27
153
+
154
+ - **feat(preset migration)**: introduced preset migration support for conversations
155
+ whose configured Agent preset was renamed or removed.
156
+ - **feat(move)**: added workspace move handling and client-side workspace refreshes.
157
+
158
+ ## 0.2.1 — 2026-08-26
159
+
160
+ - **fix(move)**: reimplemented cross-workspace moves so the session artifact, stored
161
+ `cwd`, and workspace accounting are moved together while preserving history,
162
+ title, archive state, and derived-session relationships.
163
+ - **feat(workspaces API)**: added the workspace projection endpoint used by the move UI.
164
+ - **guard**: reject subagent and transient blank-session placeholders for move actions.
165
+
166
+ ## 0.2.0 — 2026-08-16
167
+
168
+ > ⚠️ The initial workspace-move implementation was superseded by 0.2.1.
169
+
170
+ - **feat(move)**: added the initial move-to-workspace UI and host endpoints.
171
+
172
+ ## 0.1.2 — 2026-08-16
173
+
174
+ - **docs**: synchronized package metadata and bilingual README files for publication.
175
+
176
+ ## 0.1.1 — 2026-08-16
177
+
178
+ - **fix(panel)**: hide transient blank-session placeholders from the manager panel.
179
+ - **test**: added the host API smoke test.
180
+ - **ci**: added syntax and package-content verification.
181
+
182
+ ## 0.1.0 — 2026-08-16
183
+
184
+ - **feat**: initial session deletion with confirmation, archive management, and the
185
+ Session manager panel.
package/README.md CHANGED
@@ -1,108 +1,109 @@
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
- | --- | --- |
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.10 | v0.1.5-rc.1 |
75
76
  | 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
-
108
- [MIT](LICENSE)
77
+ | 0.4.7 | v0.1.5-rc.1 |
78
+ | 0.4.4 | 0.1.3-alpha.2 |
79
+ | 0.4.1 | 0.1.3-alpha.2 |
80
+ | 0.4.0 | v0.1.2-rc.1 |
81
+ | 0.1.2 | v0.1.0-rc.7 |
82
+ | 0.1.1 | v0.1.0-rc.7 |
83
+ | 0.1.0 | v0.1.0-rc.7 |
84
+
85
+ The plugin is a Cordis plugin and declares `cordis: ">=4.0.0-rc <5"` as its peer dependency.
86
+
87
+ ## Development
88
+
89
+ - `lib/index.js` is the host-side ESM plugin; `lib/client.js` is the Web client bundle. No build step is required.
90
+ - Before submitting changes, run:
91
+
92
+ ```powershell
93
+ node --check lib/client.js
94
+ node --check lib/index.js
95
+ node --test test/*.test.mjs
96
+ node scripts/smoke-test.mjs
97
+ git diff --check
98
+ npm pack --dry-run
99
+ ```
100
+
101
+ Release history is in [CHANGELOG.md](CHANGELOG.md).
102
+
103
+ ## Acknowledgments
104
+
105
+ 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.
106
+
107
+ ## License
108
+
109
+ [MIT](LICENSE)
package/README.zh.md CHANGED
@@ -72,6 +72,7 @@ dev_inject_plugin {"dir": "<本仓库的绝对路径>"}
72
72
 
73
73
  | 插件版本 | 已验证 DSH 版本 |
74
74
  | --- | --- |
75
+ | 0.4.10 | v0.1.5-rc.1 |
75
76
  | 0.4.9 | v0.1.5-rc.1 |
76
77
  | 0.4.7 | v0.1.5-rc.1 |
77
78
  | 0.4.4 | 0.1.3-alpha.2 |