dsh-session-guard 4.2.4 → 4.2.6

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,109 +1,109 @@
1
- {
2
- "name": "dsh-session-guard",
3
- "version": "4.2.4",
4
- "publishConfig": {
5
- "registry": "https://registry.npmjs.org",
6
- "tag": "latest"
7
- },
8
- "type": "module",
9
- "description": "高峰自动会话门:周末模式 + 高峰自动暂停 + 官方源二维判定 + 会话级冻结 + 后端自动重试。",
10
- "keywords": [
11
- "deepseek-harness",
12
- "dsh",
13
- "plugin",
14
- "peak",
15
- "off-peak",
16
- "weekend",
17
- "pause",
18
- "freeze",
19
- "retry",
20
- "session-gate"
21
- ],
22
- "license": "MIT",
23
- "repository": {
24
- "type": "git",
25
- "url": "git+https://github.com/drscrewdriver/dsh-session-guard.git"
26
- },
27
- "homepage": "https://github.com/drscrewdriver/dsh-session-guard",
28
- "main": "src/index.js",
29
- "exports": {
30
- ".": "./src/index.js",
31
- "./client": "./lib/client.js",
32
- "./package.json": "./package.json"
33
- },
34
- "files": [
35
- "src/",
36
- "lib/",
37
- "cordis.patch.yml",
38
- "dsh.plugin.json",
39
- "README.md",
40
- "README.en.md",
41
- "README.ja.md",
42
- "README.ko.md",
43
- "INSTALL.md",
44
- "INSTALL.zh.md",
45
- "INSTALL.ja.md",
46
- "INSTALL.ko.md",
47
- "CHANGELOG.md",
48
- "CHANGELOG.ja.md",
49
- "CHANGELOG.ko.md",
50
- "LICENSE"
51
- ],
52
- "dsh": {
53
- "client": {
54
- "inject": [
55
- "@deepseek-ai/dsh-client-locale"
56
- ],
57
- "platform": "web"
58
- },
59
- "bundle": {
60
- "patch": "./cordis.patch.yml"
61
- }
62
- },
63
- "scripts": {
64
- "build": "tsdown",
65
- "prepack": "npm run build",
66
- "lint": "eslint src tests",
67
- "test": "node --test \"tests/*.test.mjs\""
68
- },
69
- "engines": {
70
- "node": ">=20",
71
- "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 || 0.2.1-rc.4"
72
- },
73
- "dependencies": {
74
- "@deepseek-ai/schemastery": "^3.18.4"
75
- },
76
- "peerDependencies": {
77
- "@deepseek-ai/cordis": "^4.0.4",
78
- "@deepseek-ai/dsh-client-locale": "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 || 0.2.1-rc.4",
79
- "@deepseek-ai/dsh-client-ui-renderer": "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 || 0.2.1-rc.4",
80
- "@deepseek-ai/dsh-client-ui-settings": "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 || 0.2.1-rc.4",
81
- "@deepseek-ai/dsh-client-ui-slots": "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 || 0.2.1-rc.4"
82
- },
83
- "peerDependenciesMeta": {
84
- "@deepseek-ai/cordis": {
85
- "optional": true
86
- },
87
- "@deepseek-ai/dsh-client-locale": {
88
- "optional": true
89
- },
90
- "@deepseek-ai/dsh-client-ui-renderer": {
91
- "optional": true
92
- },
93
- "@deepseek-ai/dsh-client-ui-settings": {
94
- "optional": true
95
- },
96
- "@deepseek-ai/dsh-client-ui-slots": {
97
- "optional": true
98
- }
99
- },
100
- "devDependencies": {
101
- "@eslint/js": "^10.0.1",
102
- "@types/react": "~18.3.1",
103
- "eslint": "^10.8.1",
104
- "react": "^18.2.0",
105
- "tsdown": "^0.22.2",
106
- "typescript": "^5.6.0",
107
- "typescript-eslint": "^8.67.0"
108
- }
109
- }
1
+ {
2
+ "name": "dsh-session-guard",
3
+ "version": "4.2.6",
4
+ "publishConfig": {
5
+ "registry": "https://registry.npmjs.org",
6
+ "tag": "latest"
7
+ },
8
+ "type": "module",
9
+ "description": "高峰自动会话门:周末模式 + 高峰自动暂停 + 官方源二维判定 + 会话级冻结 + 后端自动重试。",
10
+ "keywords": [
11
+ "deepseek-harness",
12
+ "dsh",
13
+ "plugin",
14
+ "peak",
15
+ "off-peak",
16
+ "weekend",
17
+ "pause",
18
+ "freeze",
19
+ "retry",
20
+ "session-gate"
21
+ ],
22
+ "license": "MIT",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/drscrewdriver/dsh-session-guard.git"
26
+ },
27
+ "homepage": "https://github.com/drscrewdriver/dsh-session-guard",
28
+ "main": "src/index.js",
29
+ "exports": {
30
+ ".": "./src/index.js",
31
+ "./client": "./lib/client.js",
32
+ "./package.json": "./package.json"
33
+ },
34
+ "files": [
35
+ "src/",
36
+ "lib/",
37
+ "cordis.patch.yml",
38
+ "dsh.plugin.json",
39
+ "README.md",
40
+ "README.en.md",
41
+ "README.ja.md",
42
+ "README.ko.md",
43
+ "INSTALL.md",
44
+ "INSTALL.zh.md",
45
+ "INSTALL.ja.md",
46
+ "INSTALL.ko.md",
47
+ "CHANGELOG.md",
48
+ "CHANGELOG.ja.md",
49
+ "CHANGELOG.ko.md",
50
+ "LICENSE"
51
+ ],
52
+ "dsh": {
53
+ "client": {
54
+ "inject": [
55
+ "@deepseek-ai/dsh-client-locale"
56
+ ],
57
+ "platform": "web"
58
+ },
59
+ "bundle": {
60
+ "patch": "./cordis.patch.yml"
61
+ }
62
+ },
63
+ "scripts": {
64
+ "build": "tsdown",
65
+ "prepack": "npm run build",
66
+ "lint": "eslint src tests",
67
+ "test": "node --test \"tests/*.test.mjs\""
68
+ },
69
+ "engines": {
70
+ "node": ">=20",
71
+ "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 || 0.2.1-rc.4 || 0.2.1-rc.5"
72
+ },
73
+ "dependencies": {
74
+ "@deepseek-ai/schemastery": "^3.18.4"
75
+ },
76
+ "peerDependencies": {
77
+ "@deepseek-ai/cordis": "^4.0.4",
78
+ "@deepseek-ai/dsh-client-locale": "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 || 0.2.1-rc.4 || 0.2.1-rc.5",
79
+ "@deepseek-ai/dsh-client-ui-renderer": "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 || 0.2.1-rc.4 || 0.2.1-rc.5",
80
+ "@deepseek-ai/dsh-client-ui-settings": "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 || 0.2.1-rc.4 || 0.2.1-rc.5",
81
+ "@deepseek-ai/dsh-client-ui-slots": "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 || 0.2.1-rc.4 || 0.2.1-rc.5"
82
+ },
83
+ "peerDependenciesMeta": {
84
+ "@deepseek-ai/cordis": {
85
+ "optional": true
86
+ },
87
+ "@deepseek-ai/dsh-client-locale": {
88
+ "optional": true
89
+ },
90
+ "@deepseek-ai/dsh-client-ui-renderer": {
91
+ "optional": true
92
+ },
93
+ "@deepseek-ai/dsh-client-ui-settings": {
94
+ "optional": true
95
+ },
96
+ "@deepseek-ai/dsh-client-ui-slots": {
97
+ "optional": true
98
+ }
99
+ },
100
+ "devDependencies": {
101
+ "@eslint/js": "^10.0.1",
102
+ "@types/react": "~18.3.1",
103
+ "eslint": "^10.8.1",
104
+ "react": "^18.2.0",
105
+ "tsdown": "^0.22.2",
106
+ "typescript": "^5.6.0",
107
+ "typescript-eslint": "^8.67.0"
108
+ }
109
+ }
@@ -7,11 +7,12 @@
7
7
  * 贡献卡(含本插件自己的,因为接管时本插件也声明了该子席位)按 order
8
8
  * 依次 renderSlot —— 卡片本身是默认展开的抽屉,整节即一页抽屉。
9
9
  *
10
- * 与 thinking-levels 的 FamilySettingsSection 的差别仅在不需要 thinking-
11
- * levels 自己的卡(宿主不在了,它的卡也不在):渲染循环没有 own-tab 特例。
10
+ * 与 thinking-levels 的 FamilySettingsSection 一致:接管时本插件既是 owner 又是成员,
11
+ * 自宣 dsh-family.tab 不触发自身 inject(账本恒无本卡),故本卡作 OWN 行内联直挂
12
+ * (props.renderOwn/ownId),其余成员仍走账本。缺 renderOwn 时退回纯账本渲染(向后兼容)。
12
13
  */
13
14
  import { useEffect, useState } from 'react'
14
- import type { JSX } from 'react'
15
+ import type { JSX, ReactNode } from 'react'
15
16
 
16
17
  /** 与 FamilySectionInjected.hooks.tabs 同形的账本投影(结构化镜像)。 */
17
18
  type HostObservable<T> = {
@@ -38,6 +39,10 @@ export interface GuardFamilySectionProps {
38
39
  /** 直接挂载面(≤0.1.5 壳无 renderSlot 时):注册侧从账本原始条目
39
40
  * (entries 自带 component + inject)现挂激活卡。失败一律 null。 */
40
41
  renderContributor?: (id: string) => JSX.Element | null
42
+ /** 接管态内联直挂本插件自己的卡(自宣子槽不触发自身 inject,账本恒无本卡)。缺省时退回纯账本。 */
43
+ renderOwn?: () => ReactNode
44
+ /** 内联 own 行的账本 id(与账本条目去重用);仅 renderOwn 存在时生效。 */
45
+ ownId?: string
41
46
  }
42
47
 
43
48
  const NO_TABS: readonly FamilyTabEntry[] = []
@@ -52,13 +57,21 @@ export function GuardFamilySection(props: GuardFamilySectionProps): JSX.Element
52
57
  return raw.subscribe(() => setPolled(raw.getSnapshot()))
53
58
  })
54
59
  const tabs = props.useTabs !== undefined ? props.useTabs(value => value) : polled
60
+ // 接管时本插件既是容器 owner 又是成员:自宣的 dsh-family.tab 不触发自身 inject(账本恒无本卡),
61
+ // 故本卡作 OWN 行内联直挂、其余走账本;已在账本则去重不双渲。对齐 thinking-levels OWN_TAB_ID。
62
+ const ownId = props.ownId ?? '__own__'
63
+ const rows: readonly FamilyTabEntry[] = props.renderOwn
64
+ ? [{ id: ownId, order: Number.NEGATIVE_INFINITY, label: ownId }, ...tabs.filter(tab => tab.id !== ownId)]
65
+ : tabs
55
66
  return (
56
67
  <div style={{ display: 'grid', gap: '12px' }}>
57
- {tabs.map(row => (
68
+ {rows.map(row => (
58
69
  <div key={row.id}>
59
- {props.renderSlot
60
- ? props.renderSlot('dsh-family.tab', {}, { only: row.id, fallback: null })
61
- : props.renderContributor?.(row.id) ?? null}
70
+ {props.renderOwn && row.id === ownId
71
+ ? props.renderOwn()
72
+ : props.renderSlot
73
+ ? props.renderSlot('dsh-family.tab', {}, { only: row.id, fallback: null })
74
+ : props.renderContributor?.(row.id) ?? null}
62
75
  </div>
63
76
  ))}
64
77
  </div>
@@ -236,6 +236,10 @@ export function apply(ctx: ClientCtx) {
236
236
  inject: () => ({
237
237
  hooks: makeGuardFamilyTabsHooks(ctx.slots),
238
238
  renderContributor,
239
+ // 接管时本插件既是 owner 又是成员:自宣子槽不触发自身 inject(账本恒无本卡),
240
+ // 故本卡内联直挂(ownId/renderOwn)。scope 走 currentScope()——apply 级原生/桥两轨兜底,恒非空。
241
+ ownId: 'session-guard',
242
+ renderOwn: () => createElement(SessionGuardCard, { scope: currentScope() }),
239
243
  }),
240
244
  }
241
245
  try {