dsh-manage-session 0.3.3 → 0.5.1

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/package.json CHANGED
@@ -1,122 +1,125 @@
1
- {
2
- "name": "dsh-manage-session",
3
- "version": "0.3.3",
4
- "publishConfig": {
5
- "registry": "https://registry.npmjs.org",
6
- "access": "public",
7
- "tag": "dsh-0.1.5"
8
- },
9
- "description": "DSH Web 插件(DSH 0.1.5 专线):会话管家 —— 会话历史文件(归档浏览与清理)与会话健康检查(体检 → 处方 → 出院),不碰会话日志、只做可逆处置",
10
- "keywords": [
11
- "deepseek-harness",
12
- "dsh",
13
- "dsh-plugin",
14
- "session",
15
- "archive",
16
- "health",
17
- "doctor"
18
- ],
19
- "repository": {
20
- "type": "git",
21
- "url": "git+https://github.com/drscrewdriver/dsh-manage-session.git"
22
- },
23
- "type": "module",
24
- "main": "lib/index.js",
25
- "types": "lib/index.d.ts",
26
- "exports": {
27
- ".": {
28
- "types": "./lib/index.d.ts",
29
- "default": "./lib/index.js"
30
- },
31
- "./client": {
32
- "default": "./lib/client.js"
33
- },
34
- "./cordis.patch.yml": "./cordis.patch.yml",
35
- "./package.json": "./package.json"
36
- },
37
- "dsh": {
38
- "bundle": {
39
- "patch": "./cordis.patch.yml"
40
- },
41
- "client": {
42
- "platform": "web",
43
- "inject": [
44
- "@deepseek-ai/dsh-client-locale",
45
- "@deepseek-ai/dsh-client-ui-settings",
46
- "@deepseek-ai/dsh-client-ui-settings-general"
47
- ]
48
- }
49
- },
50
- "scripts": {
51
- "build": "node -e \"require('fs').rmSync('lib',{recursive:true,force:true})\" && tsc -b && tsdown",
52
- "prepublishOnly": "npm run build",
53
- "typecheck": "tsc -b --pretty false",
54
- "test": "vitest run",
55
- "release:015": "npm publish --tag dsh-0.1.5"
56
- },
57
- "files": [
58
- "lib/index.js",
59
- "lib/index.d.ts",
60
- "lib/client.js",
61
- "src",
62
- "cordis.patch.yml",
63
- "dsh.plugin.json",
64
- "screenshots.json",
65
- "README.md",
66
- "README.en.md",
67
- "README.ja.md",
68
- "README.ko.md",
69
- "INSTALL.md",
70
- "INSTALL.zh.md",
71
- "INSTALL.ja.md",
72
- "INSTALL.ko.md",
73
- "CHANGELOG.md",
74
- "CHANGELOG.ja.md",
75
- "CHANGELOG.ko.md",
76
- "LICENSE"
77
- ],
78
- "engines": {
79
- "node": ">=20",
80
- "dsh": ">=0.1.5-rc.1 <0.1.6-0"
81
- },
82
- "license": "MIT",
83
- "peerDependencies": {
84
- "@deepseek-ai/cordis": "^4.0.1",
85
- "@deepseek-ai/dsh-client-locale": ">=0.1.5-rc.1 <0.1.6-0",
86
- "@deepseek-ai/dsh-client-ui-settings": ">=0.1.5-rc.1 <0.1.6-0",
87
- "@deepseek-ai/dsh-client-ui-settings-general": ">=0.1.5-rc.1 <0.1.6-0",
88
- "@deepseek-ai/dsh-client-ui-slots": ">=0.0.1-rc.1 <0.1.0 || >=0.1.0-rc.1 <0.1.6-0",
89
- "@deepseek-ai/schemastery": "^3.18.1",
90
- "react": "^18.2.0"
91
- },
92
- "peerDependenciesMeta": {
93
- "@deepseek-ai/dsh-client-locale": {
94
- "optional": true
95
- },
96
- "@deepseek-ai/dsh-client-ui-settings": {
97
- "optional": true
98
- },
99
- "@deepseek-ai/dsh-client-ui-settings-general": {
100
- "optional": true
101
- },
102
- "@deepseek-ai/dsh-client-ui-slots": {
103
- "optional": true
104
- }
105
- },
106
- "devDependencies": {
107
- "@deepseek-ai/cordis": "^4.0.1",
108
- "@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.6",
109
- "@deepseek-ai/schemastery": "^3.18.1",
110
- "@types/node": "^24.0.0",
111
- "@types/react": "~18.3.1",
112
- "@types/react-dom": "^18.3.7",
113
- "cordis": "^4.0.0-rc.7",
114
- "react": "^18.2.0",
115
- "react-dom": "^18.2.0",
116
- "tsdown": "^0.22.2",
117
- "tsx": "^4.23.12",
118
- "typescript": "^5.6.0",
119
- "vite-tsconfig-paths": "^6.1.1",
120
- "vitest": "^4.1.1"
121
- }
122
- }
1
+ {
2
+ "name": "dsh-manage-session",
3
+ "version": "0.5.1",
4
+ "publishConfig": {
5
+ "tag": "dsh-0.2.0"
6
+ },
7
+ "description": "DSH Web 插件(DSH 0.2.0 专线):会话管家 —— 会话历史文件(归档浏览与清理)与会话健康检查(体检 → 处方 → 出院),不碰会话日志、只做可逆处置",
8
+ "keywords": [
9
+ "deepseek-harness",
10
+ "dsh",
11
+ "dsh-plugin",
12
+ "session",
13
+ "archive",
14
+ "health",
15
+ "doctor"
16
+ ],
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/drscrewdriver/dsh-manage-session.git"
20
+ },
21
+ "type": "module",
22
+ "main": "lib/index.js",
23
+ "types": "lib/index.d.ts",
24
+ "exports": {
25
+ ".": {
26
+ "types": "./lib/index.d.ts",
27
+ "default": "./lib/index.js"
28
+ },
29
+ "./client": {
30
+ "default": "./lib/client.js"
31
+ },
32
+ "./cordis.patch.yml": "./cordis.patch.yml",
33
+ "./package.json": "./package.json"
34
+ },
35
+ "dsh": {
36
+ "bundle": {
37
+ "patch": "./cordis.patch.yml"
38
+ },
39
+ "client": {
40
+ "platform": "web",
41
+ "inject": [
42
+ "@deepseek-ai/dsh-client-locale",
43
+ "@deepseek-ai/dsh-client-ui-settings",
44
+ "@deepseek-ai/dsh-client-ui-settings-general"
45
+ ]
46
+ }
47
+ },
48
+ "scripts": {
49
+ "build": "node -e \"require('fs').rmSync('lib',{recursive:true,force:true})\" && tsc -b && tsdown",
50
+ "prepublishOnly": "npm run build",
51
+ "typecheck": "tsc -b --pretty false",
52
+ "test": "vitest run",
53
+ "release:020": "npm publish --tag dsh-0.2.0"
54
+ },
55
+ "files": [
56
+ "lib/index.js",
57
+ "lib/index.d.ts",
58
+ "lib/client.js",
59
+ "src",
60
+ "cordis.patch.yml",
61
+ "dsh.plugin.json",
62
+ "screenshots.json",
63
+ "README.md",
64
+ "README.en.md",
65
+ "README.ja.md",
66
+ "README.ko.md",
67
+ "INSTALL.md",
68
+ "INSTALL.zh.md",
69
+ "INSTALL.ja.md",
70
+ "INSTALL.ko.md",
71
+ "CHANGELOG.md",
72
+ "CHANGELOG.ja.md",
73
+ "CHANGELOG.ko.md",
74
+ "LICENSE"
75
+ ],
76
+ "engines": {
77
+ "node": ">=20",
78
+ "dsh": ">=0.2.0-rc.1 <0.2.1-0"
79
+ },
80
+ "license": "MIT",
81
+ "peerDependencies": {
82
+ "@deepseek-ai/cordis": "^4.0.1",
83
+ "@deepseek-ai/dsh-client-locale": ">=0.2.0-rc.1 <0.2.1-0",
84
+ "@deepseek-ai/dsh-client-ui-settings": ">=0.2.0-rc.1 <0.2.1-0",
85
+ "@deepseek-ai/dsh-client-ui-settings-general": ">=0.2.0-rc.1 <0.2.1-0",
86
+ "@deepseek-ai/dsh-client-ui-slots": ">=0.2.0-rc.1 <0.2.1-0",
87
+ "@deepseek-ai/schemastery": "^3.18.4",
88
+ "react": "^18.2.0",
89
+ "@deepseek-ai/dsh-session": ">=0.2.0-rc.1 <0.2.1-0"
90
+ },
91
+ "peerDependenciesMeta": {
92
+ "@deepseek-ai/dsh-client-locale": {
93
+ "optional": true
94
+ },
95
+ "@deepseek-ai/dsh-client-ui-settings": {
96
+ "optional": true
97
+ },
98
+ "@deepseek-ai/dsh-client-ui-settings-general": {
99
+ "optional": true
100
+ },
101
+ "@deepseek-ai/dsh-client-ui-slots": {
102
+ "optional": true
103
+ },
104
+ "@deepseek-ai/dsh-session": {
105
+ "optional": true
106
+ }
107
+ },
108
+ "devDependencies": {
109
+ "@deepseek-ai/cordis": "^4.0.1",
110
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.0-rc.1",
111
+ "@deepseek-ai/schemastery": "^3.18.4",
112
+ "@types/node": "^24.0.0",
113
+ "@types/react": "~18.3.1",
114
+ "@types/react-dom": "^18.3.7",
115
+ "cordis": "^4.0.0-rc.7",
116
+ "react": "^18.2.0",
117
+ "react-dom": "^18.2.0",
118
+ "tsdown": "^0.22.2",
119
+ "tsx": "^4.23.12",
120
+ "typescript": "^5.6.0",
121
+ "vite-tsconfig-paths": "^6.1.1",
122
+ "vitest": "^4.1.1",
123
+ "@deepseek-ai/dsh-session": "0.2.0-rc.1"
124
+ }
125
+ }
@@ -1,17 +1,14 @@
1
1
  /**
2
2
  * 设置卡(插件配置行):一个可折叠抽屉 —— 会话历史文件 / 健康检查。
3
3
  *
4
- * **chrome 必须自己渲染**:DSH 的「插件」设置分区(`dsh-client-ui-settings-plugins`)
5
- * 只做一件事——按 settings 命名空间分发 `settings.plugin.item`:
4
+ * **chrome 必须自己渲染**:宿主不为贡献卡提供任何外壳,标题、说明、
5
+ * 展开/收起全归插件自己所有。早期版本只渲染裸行,与同分区其它插件
6
+ * 的抽屉形态不一致,还让 `card.title` / `card.desc` 成为死文案。
6
7
  *
7
- * renderSlot('settings.plugin.item', {}, { entryKey: ns })
8
- *
9
- * 它**不提供任何外壳**。所以卡片的标题、说明、展开/收起全归插件自己所有
10
- * (同分区里 search-index 等卡片都是这个形态)。早期版本只渲染了裸行,
11
- * 结果既与分区内其它插件的抽屉形态不一致,又让 `card.title` / `card.desc`
12
- * 变成定义了却没人渲染的死文案。
13
- *
14
- * 读写走 settingsScope 的显式 `set`(用户在控件上的直接操作,非隐式提交)。
8
+ * 读写走 configForms(`configForms.get(STEWARD_ENTRY_ID)`,以本插件 entry 为键;
9
+ * 旧宿主回退 settingsScope 绑定)的显式 `set`。0.1.7 起本卡挂在插件族共用
10
+ * 设置节(`dsh-family.tab`,dsh-thinking-levels 顶级「起子插件设置」节声明)里,
11
+ * 与同节其它抽屉一样默认展开。
15
12
  */
16
13
  import { createElement, useState, useSyncExternalStore, type JSX } from 'react'
17
14
  import { DEFAULT_CONFIG, type StewardConfig } from '../config.ts'
@@ -94,13 +91,13 @@ function Header(props: { t?: CardTranslate; open: boolean; onToggle: () => void
94
91
  ])
95
92
  }
96
93
 
97
- /** 插件设置卡主体(抽屉)。默认收起,与「插件」分区内其它卡片一致。 */
94
+ /** 插件设置卡主体(抽屉)。默认展开,family 设置节内直接呈现完整面板。 */
98
95
  export function StewardSettingsCard({ t, scope }: StewardCardProps): JSX.Element {
99
96
  const snapshot = useSyncExternalStore(
100
97
  (listener) => scope.subscribe(listener),
101
98
  () => scope.getSnapshot(),
102
99
  )
103
- const [open, setOpen] = useState(false)
100
+ const [open, setOpen] = useState(true)
104
101
  const value: Partial<StewardConfig> = snapshot.value ?? {}
105
102
  const writable = snapshot.writable
106
103
 
@@ -12,6 +12,7 @@ import {
12
12
  type HealthReport,
13
13
  type HealthScanResponse,
14
14
  type HealthSessionResponse,
15
+ type SourceMigrateResponse,
15
16
  } from './host-api.ts'
16
17
  import { translate, type LocaleKey } from './locales.ts'
17
18
 
@@ -24,6 +25,7 @@ const GATE_LABEL: Record<HealthGate['id'], LocaleKey> = {
24
25
  'projection-cache': 'health.gate.projection-cache',
25
26
  'lossless-json': 'health.gate.lossless-json',
26
27
  'cold-read': 'health.gate.cold-read',
28
+ 'source-kind': 'health.gate.source-kind',
27
29
  }
28
30
 
29
31
  const LEVEL_LABEL = {
@@ -65,6 +67,9 @@ export function HealthPanel({ t, onClose }: { t?: PanelTranslate; onClose: () =>
65
67
  const [error, setError] = useState<string | null>(null)
66
68
  const [detail, setDetail] = useState<HealthSessionResponse | null>(null)
67
69
  const [repairing, setRepairing] = useState(false)
70
+ const [migrating, setMigrating] = useState(false)
71
+ /** 署名转换结果提示(一次性;点击转换或返回列表时清除)。 */
72
+ const [migrateNote, setMigrateNote] = useState<string | null>(null)
68
73
  const [discharge, setDischarge] = useState<HealthRepairResponse | null>(null)
69
74
  const [copied, setCopied] = useState<string | null>(null)
70
75
  /** 分批扫描进度:done = 已访问会话数,total = 语料总数(0 表示尚未拿到分母)。 */
@@ -119,6 +124,7 @@ export function HealthPanel({ t, onClose }: { t?: PanelTranslate; onClose: () =>
119
124
  setError(null)
120
125
  setDetail(null)
121
126
  setDischarge(null)
127
+ setMigrateNote(null)
122
128
  setFindings(null)
123
129
  setCacheInfo(null)
124
130
  setProgress({ done: 0, total: 0 })
@@ -190,6 +196,7 @@ export function HealthPanel({ t, onClose }: { t?: PanelTranslate; onClose: () =>
190
196
  const openDetail = (sessionId: string): void => {
191
197
  setError(null)
192
198
  setDischarge(null)
199
+ setMigrateNote(null)
193
200
  void callHostAny<HealthSessionResponse>('session-health-session', { sessionId }, 120_000)
194
201
  .then((res) => {
195
202
  if (res.ok === true) {
@@ -226,6 +233,31 @@ export function HealthPanel({ t, onClose }: { t?: PanelTranslate; onClose: () =>
226
233
  } catch { /* 剪贴板不可用时仍然展示命令 */ }
227
234
  }
228
235
 
236
+ // 署名转换:仅当 source-kind 门报 warn(v4 日志里观测到旧署名行)时出现。
237
+ // 成败都回写最新报告;结果提示一次性展示,避免残留误导。
238
+ const runSourceMigrate = (sessionId: string): void => {
239
+ setMigrating(true)
240
+ setError(null)
241
+ setMigrateNote(null)
242
+ void callHostAny<SourceMigrateResponse>('session-health-source-migrate', { sessionId }, 120_000)
243
+ .then((res) => {
244
+ if (res.after !== undefined) {
245
+ setDetail({ ok: true, report: res.after, prescriptions: detail?.prescriptions ?? [] })
246
+ reconcileRow(res.after)
247
+ }
248
+ const changed = res.outcome?.changedRows ?? 0
249
+ if (res.ok === true && changed > 0) {
250
+ setMigrateNote(translate(t, 'health.sourceMigrated', { n: changed, backup: res.outcome?.backup ?? '' }))
251
+ } else if (res.ok === true) {
252
+ setMigrateNote(translate(t, 'health.sourceMigrateNone'))
253
+ } else {
254
+ setMigrateNote(translate(t, 'health.sourceMigrateFail', { error: res.outcome?.error ?? res.error ?? '未知原因' }))
255
+ }
256
+ })
257
+ .catch((err: unknown) => setError(String(err instanceof Error ? err.message : err)))
258
+ .finally(() => setMigrating(false))
259
+ }
260
+
229
261
  const report = detail?.report ?? discharge?.after
230
262
  const lines: (ReactElement | null)[] = []
231
263
 
@@ -348,6 +380,25 @@ export function HealthPanel({ t, onClose }: { t?: PanelTranslate; onClose: () =>
348
380
  createElement('span', { key: 'tx' }, repairing ? translate(t, 'health.repairing') : translate(t, 'health.repair')),
349
381
  ]),
350
382
  ]))
383
+ // 署名转换按钮:只在 source-kind 门报 warn(v4 日志里观测到旧署名行)时出现,
384
+ // 不随常规处置出现——v3 及更早版本线的旧行由宿主迁移负责,不该一键误触。
385
+ if (report.gates.some(gate => gate.id === 'source-kind' && gate.level === 'warn')) {
386
+ lines.push(createElement('div', { key: 'migrate', className: 'dss_phaseRow' }, [
387
+ createElement('button', {
388
+ key: 'm',
389
+ type: 'button',
390
+ className: 'dss_actBtn',
391
+ disabled: migrating,
392
+ onClick: () => { runSourceMigrate(report.sessionId) },
393
+ }, [
394
+ migrating ? createElement('span', { key: 'sp', className: 'dss_spinner', 'aria-hidden': 'true' }) : null,
395
+ createElement('span', { key: 'tx' }, migrating
396
+ ? translate(t, 'health.sourceMigrating')
397
+ : translate(t, 'health.sourceMigrate')),
398
+ ]),
399
+ migrateNote !== null && createElement('span', { key: 'note', className: 'dss_status' }, migrateNote),
400
+ ]))
401
+ }
351
402
  const prescriptions = detail?.prescriptions ?? discharge?.prescriptions ?? []
352
403
  if (prescriptions.length > 0) {
353
404
  lines.push(createElement('div', { key: 'cmds', className: 'dss_cmdBlock' }, [