dsh-manage-session 0.0.0-stage → 2.0.3

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 (57) hide show
  1. package/CHANGELOG.ja.md +33 -0
  2. package/CHANGELOG.ko.md +33 -0
  3. package/CHANGELOG.md +33 -0
  4. package/INSTALL.ja.md +164 -0
  5. package/INSTALL.ko.md +164 -0
  6. package/INSTALL.md +164 -0
  7. package/INSTALL.zh.md +164 -0
  8. package/LICENSE +21 -0
  9. package/README.en.md +64 -0
  10. package/README.ja.md +39 -0
  11. package/README.ko.md +38 -0
  12. package/README.md +100 -2
  13. package/cordis.patch.yml +19 -0
  14. package/dsh.plugin.json +22 -0
  15. package/lib/client.js +3275 -0
  16. package/lib/index.d.ts +1453 -0
  17. package/lib/index.js +3276 -0
  18. package/locale/de.json +6 -0
  19. package/locale/en.json +6 -0
  20. package/locale/es.json +6 -0
  21. package/locale/fr.json +6 -0
  22. package/locale/it.json +6 -0
  23. package/locale/ja.json +6 -0
  24. package/locale/ko.json +6 -0
  25. package/locale/ru.json +6 -0
  26. package/locale/zh.json +6 -0
  27. package/package.json +130 -4
  28. package/screenshots.json +7 -0
  29. package/src/client/bridge-scope.ts +202 -0
  30. package/src/client/card.tsx +154 -0
  31. package/src/client/health-panel.tsx +452 -0
  32. package/src/client/host-api.ts +261 -0
  33. package/src/client/index.ts +594 -0
  34. package/src/client/locales.ts +893 -0
  35. package/src/client/manage-locales.ts +178 -0
  36. package/src/client/manage.tsx +430 -0
  37. package/src/client/panel.tsx +131 -0
  38. package/src/client/session-menu-legacy.ts +248 -0
  39. package/src/client/session-menu.tsx +96 -0
  40. package/src/config.ts +43 -0
  41. package/src/host/health/attribution.ts +118 -0
  42. package/src/host/health/cache.ts +97 -0
  43. package/src/host/health/decode.ts +325 -0
  44. package/src/host/health/gates.ts +422 -0
  45. package/src/host/health/generation.ts +216 -0
  46. package/src/host/health/lossless.ts +128 -0
  47. package/src/host/health/repair.ts +238 -0
  48. package/src/host/health/scan.ts +213 -0
  49. package/src/host/health/source-kind.ts +350 -0
  50. package/src/host/history/archive-source.ts +250 -0
  51. package/src/host/history/archive.ts +249 -0
  52. package/src/host/history/favorites.ts +71 -0
  53. package/src/host/history/purge.ts +370 -0
  54. package/src/host/history/tombstones.ts +100 -0
  55. package/src/host/registry/archive-registry.ts +317 -0
  56. package/src/host/settings-bridge.ts +222 -0
  57. package/src/index.ts +871 -0
package/INSTALL.zh.md ADDED
@@ -0,0 +1,164 @@
1
+ # 安装指南(官方 DSH CLI)
2
+
3
+ 本指南只使用官方 `dsh plugin` 命令。该命令会把依赖装入 profile 并同步 `dsh.profile.bundles`。请勿改用裸 `npm install`、在 profile 里直接 `pnpm add`,或手工编辑 profile 清单。
4
+
5
+ - [English installation guide](./INSTALL.md)
6
+ - [中文安装指南](./INSTALL.zh.md)
7
+ - [日本語インストールガイド](./INSTALL.ja.md)
8
+ - [한국어 설치 안내](./INSTALL.ko.md)
9
+ - [中文 README](./README.md)
10
+ - [English README](./README.en.md)
11
+ - [日本語 README](./README.ja.md)
12
+ - [한국어 README](./README.ko.md)
13
+ - [Changelog](./CHANGELOG.md)
14
+ - [日本語 changelog](./CHANGELOG.ja.md)
15
+ - [한국어 changelog](./CHANGELOG.ko.md)
16
+
17
+ 本指南中的占位符:
18
+
19
+ - `<profile>`:要改动的 DSH profile,通常是 `web`;
20
+ - `dsh-manage-session`:npm 包名,同时也是运行时插件 ID。
21
+
22
+ > **支持的 DSH 范围:`engines.dsh` 的逐 rc 枚举白名单(`0.1.0-rc.2` … `0.2.1-rc.3`,逐版本实测)。**
23
+ >
24
+ > 该范围同时写在 `package.json` 与 `dsh.plugin.json` 的 `engines.dsh` 中,也与本插件为其 `@deepseek-ai/dsh-client-ui-slots` 依赖已经声明的 `^0.1.0-rc.6` 下界一致。安装前先用 `dsh --version` 确认当前版本。
25
+
26
+ ## 0. 前置条件与 profile 探查
27
+
28
+ ```bash
29
+ echo "DSH_HOME=${DSH_HOME:-$HOME/.dsh}"
30
+ dsh --version
31
+ ls "${DSH_HOME:-$HOME/.dsh}/profiles"
32
+ ```
33
+
34
+ 请使用正在运行的 DSH 进程所使用的那个 profile。`web` 很常见,但以实际生效的 `--profile` 参数为准。
35
+
36
+ ## 1. 官方安装
37
+
38
+ ```bash
39
+ dsh plugin --profile <profile> add dsh-manage-session -w
40
+ ```
41
+
42
+ (当 profile 是 pnpm workspace 根时,如 `web`,`-w` 是必需的。)
43
+
44
+ 显式安装指定版本:
45
+
46
+ ```bash
47
+ dsh plugin --profile <profile> add dsh-manage-session@1.0.0 -w
48
+ ```
49
+
50
+ 官方 CLI 会自动更新 profile 依赖、锁文件与 `dsh.profile.bundles`。不要手工添加 YAML 行。
51
+
52
+ ### 供应链冷却期
53
+
54
+ DSH 运行时使用 pnpm 11,其 `minimumReleaseAge` 策略可能拦截刚发布的版本并报 `ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION`。把该版本加入 `~/.dsh/profiles/<profile>/pnpm-workspace.yaml` 的 `minimumReleaseAgeExclude`:
55
+
56
+ ```yaml
57
+ minimumReleaseAgeExclude:
58
+ - dsh-manage-session@1.0.0
59
+ ```
60
+
61
+ ## 2. 重启宿主
62
+
63
+ **安装或升级后必须重启 DSH。** 仅刷新浏览器页面无效:宿主半身在启动时注册 `/manage-session/api` 路由与设置命名空间,且归档来源需要在宿主重启后才会反映清理结果。
64
+
65
+ ## 3. 升级
66
+
67
+ ```bash
68
+ dsh plugin --profile <profile> update dsh-manage-session -w
69
+ ```
70
+
71
+ 升级后重启 DSH。
72
+
73
+ ## 4. 本地路径 / `link:` 注册(备选)
74
+
75
+ 用于开发或离线安装,可从本地检出注册:
76
+
77
+ ```bash
78
+ # ~/.dsh/profiles/<profile>/package.json dependencies:
79
+ # "dsh-manage-session": "link:<absolute path to dsh-manage-session>"
80
+ # ~/.dsh/profiles/<profile>/cordis.patch.yml:
81
+ # - insert:
82
+ # - id: dsh-manage-session
83
+ # name: dsh-manage-session
84
+ cd ~/.dsh/profiles/<profile> && pnpm install && dsh web
85
+ ```
86
+
87
+ 或用官方 CLI 直接指定本地路径(无需联网):
88
+
89
+ ```bash
90
+ dsh plugin --profile <profile> add /absolute/path/to/dsh-manage-session -w
91
+ ```
92
+
93
+ 从源码检出构建时用以下脚本:
94
+
95
+ ```bash
96
+ pnpm install
97
+ pnpm typecheck # tsc -b --pretty false
98
+ pnpm test # vitest run
99
+ pnpm build # tsc -b && tsdown → lib/index.js + lib/index.d.ts + lib/client.js
100
+ ```
101
+
102
+ `lib/` 不入库,因此源码检出必须先构建才能按路径注册。发布时由 `prepublishOnly` 钩子自动构建。
103
+
104
+ ## 5. 校验安装
105
+
106
+ 检查依赖与已安装版本:
107
+
108
+ ```bash
109
+ grep -n "dsh-manage-session" \
110
+ "${DSH_HOME:-$HOME/.dsh}/profiles/<profile>/package.json"
111
+ node -p "require('${DSH_HOME:-$HOME/.dsh}/profiles/<profile>/node_modules/dsh-manage-session/package.json').version"
112
+ ```
113
+
114
+ 检查官方装配:
115
+
116
+ ```bash
117
+ dsh --profile <profile> --dump-default-config
118
+ ```
119
+
120
+ 其中必须包含:
121
+
122
+ ```yaml
123
+ - id: dsh-manage-session
124
+ name: dsh-manage-session
125
+ ```
126
+
127
+ ## 6. 验证插件
128
+
129
+ 重启后,侧边栏入口 `dsh-manage-session` 可用,设置区使用 `manage-session` 命名空间。请确认:
130
+
131
+ 1. 两个开关均开启时,**养老院**与**体检**两个页签都会渲染。
132
+ 2. 关闭 `historyFiles` 后「养老院」页签消失,且所有 `session-history-*` 调用返回显式的 disabled 错误。
133
+ 3. 关闭 `healthCheck` 后「体检」页签消失,且所有 `session-health-*` 调用返回显式的 disabled 错误。
134
+ 4. 对 `/manage-session/api` 调用未识别的方法时返回显式错误,而不是静默成功。
135
+
136
+ 关闭的子域返回 `{ ok: false, error: '子域已关闭(…=false):<method> 未注册' }` —— 本插件不留空壳。
137
+
138
+ ## 7. 故障排查
139
+
140
+ | 现象 | 处理 |
141
+ | --- | --- |
142
+ | 找不到 `dsh` | 安装或启用官方 DSH CLI。 |
143
+ | `ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION` | 把该版本加入该 profile 的 `pnpm-workspace.yaml` 中的 `minimumReleaseAgeExclude`。 |
144
+ | 安装后页签或路由缺失 | 重启宿主进程——刷新页面不会重新注册路由。 |
145
+ | 归档集合的改动不可见 | 重启宿主;归档来源在启动时读取。 |
146
+ | `session-history-*` 返回 disabled 错误 | `historyFiles` 开关已关闭,在插件设置中重新开启。 |
147
+ | `session-health-*` 返回 disabled 错误 | `healthCheck` 开关已关闭,在插件设置中重新开启。 |
148
+ | 升级后客户端包陈旧 | 强制刷新浏览器(Ctrl+Shift+R)。 |
149
+
150
+ ## 8. 卸载
151
+
152
+ ```bash
153
+ dsh plugin --profile <profile> remove dsh-manage-session
154
+ ```
155
+
156
+ 卸载后重启 DSH。
157
+
158
+ ## 卸载不会撤销已执行的处置
159
+
160
+ 本插件从不改写会话日志、不修改历史数据、不静默丢弃字段。它唯一看起来不可逆的动作——隔离损坏的投影缓存记录——会先复制备份,并把隔离目录留在磁盘上供你恢复。因此卸载插件不会撤销你主动请求过的隔离;如需还原状态请手工恢复。
161
+
162
+ ## 许可
163
+
164
+ MIT
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 drscrewdriver
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.en.md ADDED
@@ -0,0 +1,64 @@
1
+ # dsh-manage-session (Session Manager)
2
+
3
+ > **Former name**: `dsh-session-steward` (Session Steward). Renamed to `dsh-manage-session` at 2.0.0;
4
+ > search/indexing moved back to [`dsh-search-index`](https://github.com/drscrewdriver/dsh-search-index).
5
+
6
+ A DSH web plugin: **one console over active and archived sessions + a four-gate checkup**.
7
+
8
+ - **Manage (main page)** — sessions grouped by workspace, **active + archived**: domain filter
9
+ (all / active / archived), title filter, favorites, and batch archive / unarchive / purge
10
+ (real deletion, irreversible).
11
+ - **Checkup (secondary tab)** — four gates → prescription → discharge (reversible repair).
12
+
13
+ > Reversible operations only. **No search or index of its own, and no DRS dependency**:
14
+ > retrieval (title/content FTS5) belongs to `dsh-search-index`; the manage console builds its
15
+ > corpus from the host `sessionQuery` service plus the official archive set (`session-catalog`).
16
+
17
+ ## Where the entry lives (top tool slot / footer fallback)
18
+
19
+ | Host capability | Entry form |
20
+ |---|---|
21
+ | Sidebar declares the top tool row (`sidebar.panellist` + the `main` page slot — the Plugins / More row of 0.1.7+/0.2.x) | A **panel row** right after Plugins and before More (order 6), icon + label left-aligned; clicking opens a **full page**, Close returns to the conversation |
22
+ | No such slot (older lines / reduced layouts) | Falls back to the sidebar **footer** (`sidebar.footer.action`) with a floating dialog |
23
+
24
+ <!-- hosts-sync:begin -->
25
+ <!-- Generated by scripts/sync-hosts.mjs; single source in scripts/hosts.mjs -->
26
+ Supports DSH 0.1.0-rc.2, 0.1.0-rc.3, 0.1.0-rc.6, 0.1.0-rc.7, 0.1.0-rc.8, 0.1.1-rc.1, 0.1.1-rc.2, 0.1.2-rc.1, 0.1.5-rc.1, 0.1.5-rc.2, 0.1.5-rc.3, 0.1.7-rc.1, 0.1.7-rc.2, 0.2.0-rc.1, 0.2.0-rc.2, 0.2.1-rc.1, 0.2.1-rc.2, 0.2.1-rc.3 (enumerated peers — a per-rc tested whitelist; alpha/beta releases are out of scope).
27
+ <!-- hosts-sync:end -->
28
+
29
+ ## Install
30
+
31
+ ```bash
32
+ dsh plugin --profile web add dsh-manage-session
33
+ ```
34
+
35
+ Restart the host process afterwards.
36
+
37
+ ## Routes
38
+
39
+ Prefix `/manage-session/api`, methods named `session-*`:
40
+ `session-catalog`, `session-history-list|archive|prune|purge`, `session-history-favorites-list` /
41
+ `-favorite-set`, `session-health-status|scan|session|repair|source-migrate`.
42
+
43
+ ## Settings
44
+
45
+ Namespace `manage-session`: `enabled`, `historyFiles`, `healthCheck`, `directDelete`.
46
+
47
+ ## Storage
48
+
49
+ - `~/.dsh/storages/manage-session-favorites.json` — favorites
50
+ - `~/.dsh/storages/workspace.json` — host-owned archive array + workspace membership (backed up before writes)
51
+
52
+ ## Development
53
+
54
+ ```bash
55
+ pnpm install
56
+ pnpm typecheck
57
+ pnpm test # host half
58
+ pnpm test:client # client half (build first)
59
+ pnpm build
60
+ ```
61
+
62
+ ## License
63
+
64
+ MIT
package/README.ja.md ADDED
@@ -0,0 +1,39 @@
1
+ # dsh-manage-session(セッションマネージャー)
2
+
3
+ > **旧名**:`dsh-session-steward`(セッション・スチュワード)。2.0.0 で `dsh-manage-session` に改名し、
4
+ > 検索/索引は [`dsh-search-index`](https://github.com/drscrewdriver/dsh-search-index) に戻しました。
5
+
6
+ DSH Web プラグイン:**アクティブ/アーカイブ済みセッションの統合管理台+セッション健診**。
7
+
8
+ - **管理(メインページ)** — ワークスペース別に活性+アーカイブのセッションを一覧。ドメイン
9
+ フィルタ(すべて/アクティブ/アーカイブ)、タイトル絞り込み、お気に入り、一括のアーカイブ/
10
+ 解除/実体削除(不可逆)。
11
+ - **健診(補助タブ)** — 四つのゲート → 処方 → 退院(可逆な処置)。
12
+
13
+ > **検索・索引は本パッケージに含まず、DRS 依存もありません**:検索は `dsh-search-index` が担当。
14
+ > 管理台の語料はホストの `sessionQuery` と公式アーカイブ集合から `session-catalog` が組み立てます。
15
+
16
+ ## 入口の位置(上部ツール枠 / 下部フォールバック)
17
+
18
+ | ホストの能力 | 入口の形 |
19
+ |---|---|
20
+ | 上部ツール行(`sidebar.panellist` + `main`)を宣言 | 「プラグイン」の直後、「その他」の手前(order 6)に**パネル行**。クリックでメイン列に全ページ表示 |
21
+ | 枠が無いホスト | サイドバー下部(`sidebar.footer.action`)にフォールバックし、ダイアログを開く |
22
+
23
+ <!-- hosts-sync:begin -->
24
+ <!-- Generated by scripts/sync-hosts.mjs; single source in scripts/hosts.mjs -->
25
+ Supports DSH 0.1.0-rc.2, 0.1.0-rc.3, 0.1.0-rc.6, 0.1.0-rc.7, 0.1.0-rc.8, 0.1.1-rc.1, 0.1.1-rc.2, 0.1.2-rc.1, 0.1.5-rc.1, 0.1.5-rc.2, 0.1.5-rc.3, 0.1.7-rc.1, 0.1.7-rc.2, 0.2.0-rc.1, 0.2.0-rc.2, 0.2.1-rc.1, 0.2.1-rc.2, 0.2.1-rc.3 (enumerated peers — a per-rc tested whitelist; alpha/beta releases are out of scope).
26
+ <!-- hosts-sync:end -->
27
+
28
+ ## インストール/設定/開発
29
+
30
+ ```bash
31
+ dsh plugin --profile web add dsh-manage-session # インストール後に再起動
32
+ pnpm install && pnpm typecheck && pnpm test && pnpm build
33
+ ```
34
+
35
+ 設定名前空間 `manage-session`:`enabled`、`historyFiles`、`healthCheck`、`directDelete`。
36
+
37
+ ## ライセンス
38
+
39
+ MIT
package/README.ko.md ADDED
@@ -0,0 +1,38 @@
1
+ # dsh-manage-session (세션 매니저)
2
+
3
+ > **이전 이름**: `dsh-session-steward`(세션 스튜어드). 2.0.0에서 `dsh-manage-session`로 개명했고,
4
+ > 검색/색인은 [`dsh-search-index`](https://github.com/drscrewdriver/dsh-search-index)로 되돌렸습니다.
5
+
6
+ DSH 웹 플러그인: **활성·보관 세션 통합 관리대 + 세션 건강 점검**.
7
+
8
+ - **관리(메인 페이지)** — 워크스페이스별 활성+보관 세션 목록, 도메인 필터, 제목 필터, 즐겨찾기,
9
+ 일괄 보관/해제/실제 삭제(되돌릴 수 없음).
10
+ - **점검(보조 탭)** — 네 게이트 → 처방 → 퇴원(되돌릴 수 있는 조치).
11
+
12
+ > **검색·색인은 이 패키지에 없고 DRS 의존도 없습니다**: 검색은 `dsh-search-index` 담당.
13
+ > 관리대 데이터는 호스트 `sessionQuery` + 공식 보관 집합에서 `session-catalog`가 조립합니다.
14
+
15
+ ## 진입점 위치(상단 도구 슬롯 / 하단 대체)
16
+
17
+ | 호스트 능력 | 진입점 형태 |
18
+ |---|---|
19
+ | 상단 도구 행(`sidebar.panellist` + `main`) 선언 | 「플러그인」 뒤, 「더 보기」 앞(order 6)에 **패널 행**, 클릭 시 메인 열 전체 페이지 |
20
+ | 슬롯 없음 | 사이드바 하단(`sidebar.footer.action`)으로 대체, 대화상자 표시 |
21
+
22
+ <!-- hosts-sync:begin -->
23
+ <!-- Generated by scripts/sync-hosts.mjs; single source in scripts/hosts.mjs -->
24
+ Supports DSH 0.1.0-rc.2, 0.1.0-rc.3, 0.1.0-rc.6, 0.1.0-rc.7, 0.1.0-rc.8, 0.1.1-rc.1, 0.1.1-rc.2, 0.1.2-rc.1, 0.1.5-rc.1, 0.1.5-rc.2, 0.1.5-rc.3, 0.1.7-rc.1, 0.1.7-rc.2, 0.2.0-rc.1, 0.2.0-rc.2, 0.2.1-rc.1, 0.2.1-rc.2, 0.2.1-rc.3 (enumerated peers — a per-rc tested whitelist; alpha/beta releases are out of scope).
25
+ <!-- hosts-sync:end -->
26
+
27
+ ## 설치 / 설정 / 개발
28
+
29
+ ```bash
30
+ dsh plugin --profile web add dsh-manage-session # 설치 후 재시작
31
+ pnpm install && pnpm typecheck && pnpm test && pnpm build
32
+ ```
33
+
34
+ 설정 네임스페이스 `manage-session`: `enabled`, `historyFiles`, `healthCheck`, `directDelete`.
35
+
36
+ ## 라이선스
37
+
38
+ MIT
package/README.md CHANGED
@@ -1,3 +1,101 @@
1
- # Temporary Holding Version
1
+ # dsh-manage-session(会话管理台 / Session Manager)
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ > **原名**:`dsh-session-steward`(会话管家)。本仓库自 2.0.0 起改名为 `dsh-manage-session`,
4
+ > 并把搜索/索引能力拆回 [`dsh-search-index`](https://github.com/drscrewdriver/dsh-search-index)。
5
+
6
+ DSH Web 插件:**活跃与归档会话的统一管理台 + 四门体检**。
7
+
8
+ - **管理(主页面)** —— 按工作区分组列出**活跃 + 归档**会话:域筛选(全部 / 活跃 / 归档)、
9
+ 标题过滤、收藏,勾选后批量执行三个**互不等价**的操作 —— 归档、取消归档、
10
+ 清理归档文件(真删磁盘,不可逆)。每行给出标题、工作区与时间。
11
+ - **体检(备用页签)** —— 四门体检 → 处方(命令清单)→ 出院(可逆处置 + before/after)。
12
+
13
+ > 只做**可逆处置**:不改写会话日志、不改历史数据、不静默丢字段。
14
+ >
15
+ > **本包不含搜索/索引,也不依赖 DRS**:会话检索(标题 / 内容 FTS5、命中定位)由
16
+ > `dsh-search-index` 提供,DRS(`dsh-reference-session-collector`)依赖也在那边。
17
+ > 管理台的语料由 `session-catalog` 现场从宿主 `sessionQuery` + 官方归档集合拼装。
18
+
19
+ ## 入口位次(顶栏工具槽 / 底栏回落)
20
+
21
+ | 宿主能力 | 入口形态 |
22
+ |---|---|
23
+ | 侧栏声明了顶部工具行槽位(`sidebar.panellist` 面板行 + `main` 整页槽,0.1.7+/0.2.x 的「插件 / 更多」工具行) | 入口作为**面板行**落在「插件」行之后、「更多」启动器之前(order 6),行内 icon + 文案默认左对齐;点击在主栏**整页**打开,页内「关闭」回到会话 |
24
+ | 宿主没有该槽位(老线 / 精简布局) | 回落侧栏**底栏** `sidebar.footer.action`,点击开浮动对话框 |
25
+
26
+ 判定在装载时做(`inject` 探测两席位是否已声明);宿主稍后才声明槽位时,底栏入口会就地撤下
27
+ 并切换到顶栏,不会两份并存。两路都受设置开关驱动,开关翻转即时生效。
28
+
29
+ <!-- hosts-sync:begin -->
30
+ <!-- 由 scripts/sync-hosts.mjs 生成,勿手改;单源在 scripts/hosts.mjs -->
31
+ 支持 DSH 0.1.0-rc.2、0.1.0-rc.3、0.1.0-rc.6、0.1.0-rc.7、0.1.0-rc.8、0.1.1-rc.1、0.1.1-rc.2、0.1.2-rc.1、0.1.5-rc.1、0.1.5-rc.2、0.1.5-rc.3、0.1.7-rc.1、0.1.7-rc.2、0.2.0-rc.1、0.2.0-rc.2、0.2.1-rc.1、0.2.1-rc.2、0.2.1-rc.3(枚举 peer,逐 rc 实测白名单;alpha/beta 不在支持范围)。
32
+ <!-- hosts-sync:end -->
33
+
34
+ ## 安装
35
+
36
+ ```bash
37
+ dsh plugin --profile web add dsh-manage-session
38
+ # 或本地 tgz
39
+ dsh plugin --profile web add "file:E:/test/rewrite-agently/mine-dsh-plugins/dsh-manage-session/dsh-manage-session-2.0.0.tgz"
40
+ ```
41
+
42
+ 安装后**必须重启宿主进程**(仅刷新页面无效)。
43
+
44
+ ## 路由契约
45
+
46
+ 前缀 `/manage-session/api`,方法名一律 `session-*`;未识别的方法返回显式错误,绝不静默。
47
+
48
+ | 方法 | 作用 |
49
+ |---|---|
50
+ | `session-catalog` | 管理台语料(活跃 + 归档同表;`sessionQuery` + 归档集合现场拼装) |
51
+ | `session-history-list` | 列出归档集合(存储文件优先;含来源、降级、按行体积与 `pendingRestart`) |
52
+ | `session-history-archive` | 批量归档(内存 API 优先,文件降级) |
53
+ | `session-history-prune` | **取消归档状态**:从归档数组批量移除 id(可逆,需重启) |
54
+ | `session-history-purge` | **清理归档文件**:真删转录目录 + 投影缓存 + 两处 id(**不可逆**) |
55
+ | `session-history-favorites-list` / `-favorite-set` | 收藏集合读写(JSON 域) |
56
+ | `session-health-status` | 开关状态与方法表(面板与删除行探针用,含 `directDelete`) |
57
+ | `session-health-scan` / `-session` / `-repair` / `-source-migrate` | 批量体检、单会话报告、可逆处置、署名迁移 |
58
+
59
+ ## 设置
60
+
61
+ 命名空间:`manage-session`。
62
+
63
+ | 开关 | 字段 | 关闭效果 |
64
+ |---|---|---|
65
+ | 启用插件 | `enabled`(默认 true) | 不注册任何接口,入口整体消失 |
66
+ | 会话历史文件 | `historyFiles`(默认 true) | 不注册 `session-history-*` |
67
+ | 健康检查 | `healthCheck`(默认 true) | 不注册 `session-health-*`,不渲染「体检」页签 |
68
+ | 行内删除 | `directDelete`(默认 false) | 侧栏会话菜单不出现「删除」行(破坏性入口默认关) |
69
+
70
+ ## 存储
71
+
72
+ | 路径 | 内容 |
73
+ |---|---|
74
+ | `~/.dsh/storages/manage-session-favorites.json` | 收藏集合(按 sessionId) |
75
+ | `~/.dsh/storages/workspace.json` | 归档数组与工作区成员表(**宿主文件**,本插件写入前自动备份) |
76
+
77
+ ## 四门体检
78
+
79
+ | gate | 判据 | level |
80
+ |---|---|---|
81
+ | `log-integrity` | zstd 多帧扫描 → provenance 展开 → 打包行解包;seq 连续、无撕裂尾帧 | 有读取问题 `fail`;仅撕裂尾帧 `warn` |
82
+ | `projection-cache` | `~/.dsh/storages/session_projcache/sessions/<id>.json` 的 `minSeq` 与日志末 seq 的 lag + 未结算字段 | 滞后且未结算 `fail`;任一 `warn` |
83
+ | `lossless-json` | 热态 `sessionProjections.checkpoint(session)` 逐行判定无损 JSON | 命中 `fail`,并给出投影 key → 归属包 |
84
+ | `cold-read` | 最后 `turn/end` 的原因、是否存在未收尾 open step | open step `fail`;interrupted/无 turn/end `warn` |
85
+
86
+ **处方**只给三件可逆的事:① 隔离损坏的投影缓存记录(先备份)② 含未结算 step 时提示等待宿主结算
87
+ ③ 输出可执行命令清单。**禁止**:改写会话日志、改历史数据、静默丢弃字段。
88
+
89
+ ## 开发
90
+
91
+ ```bash
92
+ pnpm install
93
+ pnpm typecheck # tsc -b --pretty false
94
+ pnpm test # vitest run(宿主半)
95
+ pnpm test:client # 浏览器半身注册 / 字典断言(需先 build)
96
+ pnpm build # tsc -b && tsdown → lib/index.js + lib/client.js
97
+ ```
98
+
99
+ ## 许可
100
+
101
+ MIT
@@ -0,0 +1,19 @@
1
+ # dsh-manage-session bundle patch
2
+ #
3
+ # 通过官方 CLI 安装时 ——
4
+ #
5
+ # dsh plugin --profile web add dsh-manage-session
6
+ #
7
+ # —— 命令会把 `dsh-manage-session` 追加到 bundle 栈,profile 启动时合并本补丁
8
+ # (单个 insert,插入本插件行)。
9
+ #
10
+ # 注:P1「替换官方 workspace 注册表」已撤编(beta.8-12 实测桌面宿主对用户层
11
+ # 禁用核心服务行会触发 INACTIVE_EFFECT 启动致命)——归档/取消归档的即时生效
12
+ # 不依赖替换(官方 archiveSession/unarchiveSession 内存 API);仅删除保留
13
+ # 文件路径语义(操作后需重启侧栏生效)。子类源码留存 src/host/registry/ 备查。
14
+ #
15
+ # 客户端口不使用本补丁: 入口位次由客户端半身自行判定(宿主声明
16
+ # `sidebar.panellist` + `main` 两个席位 → 顶栏面板行;否则回落底栏)。
17
+ - insert:
18
+ - id: dsh-manage-session
19
+ name: 'dsh-manage-session'
@@ -0,0 +1,22 @@
1
+ {
2
+ "id": "dsh-manage-session",
3
+ "name": "dsh-manage-session",
4
+ "version": "2.0.3",
5
+ "description": {
6
+ "en": "Session Manager: one console over active and archived sessions (browse, filter, favorite, archive/unarchive, batch purge, delete) plus a four-gate session health checkup. The entry sits in the sidebar top tool slot right after the Plugins row when the host provides one, and falls back to the footer otherwise. No index of its own and no DRS dependency — search lives in dsh-search-index. Never rewrites session logs. (formerly dsh-session-steward)",
7
+ "zh": "会话管理台:一屏管理活跃与归档会话(列表、筛选、收藏、归档与取消归档、批量清理、删除),外加四门会话体检。宿主提供侧栏顶部工具槽位时入口落在「插件」行之后,否则回落底栏。不自建索引、不依赖 DRS——搜索能力在 dsh-search-index。不改写会话日志。(原名 dsh-session-steward)"
8
+ },
9
+ "homepage": "https://github.com/drscrewdriver/dsh-manage-session",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/drscrewdriver/dsh-manage-session.git"
13
+ },
14
+ "license": "MIT",
15
+ "engines": {
16
+ "dsh": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3"
17
+ },
18
+ "components": {
19
+ "host": "lib/index.js",
20
+ "client": "lib/client.js"
21
+ }
22
+ }