dsh-session-guard 4.2.7 → 4.2.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/package.json CHANGED
@@ -1,109 +1,126 @@
1
- {
2
- "name": "dsh-session-guard",
3
- "version": "4.2.7",
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 || 0.2.2-rc.1"
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 || 0.2.2-rc.1",
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 || 0.2.2-rc.1",
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 || 0.2.2-rc.1",
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 || 0.2.2-rc.1"
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.9",
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
+ "./locale/*.json": "./locale/*.json",
33
+ "./package.json": "./package.json"
34
+ },
35
+ "files": [
36
+ "src/",
37
+ "lib/",
38
+ "cordis.patch.yml",
39
+ "dsh.plugin.json",
40
+ "README.md",
41
+ "README.en.md",
42
+ "README.ja.md",
43
+ "README.ko.md",
44
+ "README.fr.md",
45
+ "README.de.md",
46
+ "README.it.md",
47
+ "README.ru.md",
48
+ "README.es.md",
49
+ "INSTALL.md",
50
+ "INSTALL.zh.md",
51
+ "INSTALL.ja.md",
52
+ "INSTALL.ko.md",
53
+ "INSTALL.fr.md",
54
+ "INSTALL.de.md",
55
+ "INSTALL.it.md",
56
+ "INSTALL.ru.md",
57
+ "INSTALL.es.md",
58
+ "CHANGELOG.md",
59
+ "CHANGELOG.ja.md",
60
+ "CHANGELOG.ko.md",
61
+ "CHANGELOG.fr.md",
62
+ "CHANGELOG.de.md",
63
+ "CHANGELOG.it.md",
64
+ "CHANGELOG.ru.md",
65
+ "CHANGELOG.es.md",
66
+ "locale",
67
+ "LICENSE"
68
+ ],
69
+ "dsh": {
70
+ "client": {
71
+ "inject": [
72
+ "@deepseek-ai/dsh-client-locale"
73
+ ],
74
+ "platform": "web"
75
+ },
76
+ "bundle": {
77
+ "patch": "./cordis.patch.yml"
78
+ }
79
+ },
80
+ "scripts": {
81
+ "build": "tsdown",
82
+ "prepack": "npm run build",
83
+ "lint": "eslint src tests",
84
+ "test": "node --test \"tests/*.test.mjs\""
85
+ },
86
+ "engines": {
87
+ "node": ">=20",
88
+ "dsh": ">=0.1.0-rc.2 <0.3.0-0"
89
+ },
90
+ "dependencies": {
91
+ "@deepseek-ai/schemastery": "^3.18.4"
92
+ },
93
+ "peerDependencies": {
94
+ "@deepseek-ai/cordis": "^4.0.4",
95
+ "@deepseek-ai/dsh-client-locale": ">=0.1.0-rc.2 <0.3.0-0",
96
+ "@deepseek-ai/dsh-client-ui-renderer": ">=0.1.0-rc.2 <0.3.0-0",
97
+ "@deepseek-ai/dsh-client-ui-settings": ">=0.1.0-rc.2 <0.3.0-0",
98
+ "@deepseek-ai/dsh-client-ui-slots": ">=0.1.0-rc.2 <0.3.0-0"
99
+ },
100
+ "peerDependenciesMeta": {
101
+ "@deepseek-ai/cordis": {
102
+ "optional": true
103
+ },
104
+ "@deepseek-ai/dsh-client-locale": {
105
+ "optional": true
106
+ },
107
+ "@deepseek-ai/dsh-client-ui-renderer": {
108
+ "optional": true
109
+ },
110
+ "@deepseek-ai/dsh-client-ui-settings": {
111
+ "optional": true
112
+ },
113
+ "@deepseek-ai/dsh-client-ui-slots": {
114
+ "optional": true
115
+ }
116
+ },
117
+ "devDependencies": {
118
+ "@eslint/js": "^10.0.1",
119
+ "@types/react": "~18.3.1",
120
+ "eslint": "^10.8.1",
121
+ "react": "^18.2.0",
122
+ "tsdown": "^0.22.2",
123
+ "typescript": "^5.6.0",
124
+ "typescript-eslint": "^8.67.0"
125
+ }
126
+ }
@@ -23,6 +23,7 @@ import { BridgeDocHandle } from './settings-bridge.ts'
23
23
  import { GuardFamilySection, type FamilyTabEntry } from './family-section'
24
24
  import type { SessionGuardConfig } from './settings-card'
25
25
  import type { SettingsScope } from './scope-face'
26
+ import { NS, dictionaries } from './locales'
26
27
 
27
28
  // 起子插件族共用设置节:宿主 dsh-thinking-levels 注册顶级 `settings.section`
28
29
  // (id `dsh-family`)并声明 `dsh-family.tab` 子席位,本插件贡献卡片。宿主缺席
@@ -92,6 +93,14 @@ interface ClientCtx {
92
93
  _names: string[],
93
94
  _fn: (sctx: { configForms?: ConfigFormsFactoryFace; settingsScope?: SettingsScopeFactoryFace }) => void,
94
95
  ) => void
96
+ /** locale 服务(宿主 0.1.x 起提供;缺席时字典不注册,UI 回退到宿主默认文案)。 */
97
+ locale?: LocaleFace
98
+ effect?: (_fn: () => (() => void) | void, _label: string) => void
99
+ }
100
+
101
+ /** 宿主 locale 服务面:一次 register 激活全部语言。 */
102
+ interface LocaleFace {
103
+ register(_ns: string, _dicts: Record<string, Record<string, string>>): () => void
95
104
  }
96
105
 
97
106
  /** 单面注册护栏:某条宿主线上未知槽名/缺服务的同步异常不得带走其它面。 */
@@ -164,6 +173,19 @@ function mountConfigCards(ctx: ClientCtx): void {
164
173
  }
165
174
 
166
175
  export function apply(ctx: ClientCtx) {
176
+ // 注册全部 9 种语言字典(zh/en/ja/ko/fr/de/it/ru/es)。
177
+ // 本插件此前 locales.ts 未被任何模块 import → 字典从未进入 bundle、从未注册(死代码)。
178
+ // guarded:register 抛错不得带走下面的席位注册;effect 缺席时直接调一次(同语义)。
179
+ safe('locale/dictionaries', () => {
180
+ const locale = ctx.locale
181
+ if (!locale) return
182
+ if (typeof ctx.effect === 'function') {
183
+ ctx.effect(() => locale.register(NS, dictionaries), 'dsh-session-guard: dictionaries')
184
+ } else {
185
+ locale.register(NS, dictionaries)
186
+ }
187
+ })
188
+
167
189
  // 暂停会话按钮(v0.2.0):step 级门控的状态显示 + 手动解除。
168
190
  // order 20 < input-traffic 冻结按钮的 30 → 排在左侧,两者并列互不取代(ADR-001/002)。
169
191
  safe('conversation.input.right/pause', () => ctx.slots.inject('conversation.input.right', () => ctx.slots.register({