dsh-session-guard 0.1.2 → 0.1.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.
package/package.json CHANGED
@@ -1,79 +1,96 @@
1
- {
2
- "peerDependencies": {
3
- "@deepseek-ai/dsh-llm": "0.1.1-rc.2"
4
- },
5
- "version": "0.1.2",
6
- "license": "MIT",
7
- "files": [
8
- "src/",
9
- "lib/",
10
- "cordis.patch.yml",
11
- "README.md",
12
- "README.en.md",
13
- "README.ja.md",
14
- "README.ko.md",
15
- "INSTALL.md",
16
- "INSTALL.zh.md",
17
- "INSTALL.ja.md",
18
- "INSTALL.ko.md",
19
- "CHANGELOG.md",
20
- "CHANGELOG.ja.md",
21
- "CHANGELOG.ko.md",
22
- "LICENSE"
23
- ],
24
- "dependencies": {
25
- "@deepseek-ai/schemastery": "^3.18.1"
26
- },
27
- "name": "dsh-session-guard",
28
- "type": "module",
29
- "exports": {
30
- "./client": "./lib/client.js",
31
- "./package.json": "./package.json",
32
- ".": "./src/index.js"
33
- },
34
- "description": "Peak auto session gate: weekend mode + peak auto-pause + session-level freeze + backend auto-retry",
35
- "engines": {
36
- "node": "\u003e=20"
37
- },
38
- "dsh": {
39
- "client": {
40
- "inject": [
41
- "@deepseek-ai/dsh-client-runtime",
42
- "@deepseek-ai/dsh-client-locale",
43
- "@deepseek-ai/dsh-client-ui-slots",
44
- "@deepseek-ai/dsh-client-ui-settings"
45
- ],
46
- "platform": "web"
47
- },
48
- "bundle": {
49
- "patch": "./cordis.patch.yml"
50
- }
51
- },
52
- "keywords": [
53
- "deepseek-harness",
54
- "dsh",
55
- "plugin",
56
- "peak",
57
- "off-peak",
58
- "weekend",
59
- "pause",
60
- "freeze",
61
- "retry",
62
- "session-gate"
63
- ],
64
- "scripts": {
65
- "test": "node --test \"tests/*.test.mjs\"",
66
- "build": "tsdown",
67
- "lint": "eslint src tests"
68
- },
69
- "devDependencies": {
70
- "tsdown": "^0.22.2",
71
- "eslint": "^10.8.1",
72
- "typescript": "^5.6.0",
73
- "@types/react": "~18.3.1",
74
- "typescript-eslint": "^8.67.0",
75
- "react": "^18.2.0",
76
- "@eslint/js": "^10.0.1"
77
- },
78
- "main": "src/index.js"
1
+ {
2
+ "name": "dsh-session-guard",
3
+ "version": "0.1.3",
4
+ "type": "module",
5
+ "description": "高峰自动会话门:周末模式 + 高峰自动暂停(全局)+ 会话级冻结/恢复 + 后端自动重试;周末识别正确、退峰自动续跑。设置位于 设置 → 插件 → session-guard,简单开关。",
6
+ "keywords": [
7
+ "deepseek-harness",
8
+ "dsh",
9
+ "plugin",
10
+ "peak",
11
+ "off-peak",
12
+ "weekend",
13
+ "pause",
14
+ "freeze",
15
+ "retry",
16
+ "session-gate"
17
+ ],
18
+ "license": "MIT",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/drscrewdriver/session-guard.git"
22
+ },
23
+ "homepage": "https://github.com/drscrewdriver/session-guard",
24
+ "main": "src/index.js",
25
+ "exports": {
26
+ ".": "./src/index.js",
27
+ "./client": "./lib/client.js",
28
+ "./package.json": "./package.json"
29
+ },
30
+ "files": [
31
+ "src/",
32
+ "lib/",
33
+ "cordis.patch.yml",
34
+ "dsh.plugin.json",
35
+ "README.md",
36
+ "README.en.md",
37
+ "README.ja.md",
38
+ "README.ko.md",
39
+ "INSTALL.md",
40
+ "INSTALL.zh.md",
41
+ "INSTALL.ja.md",
42
+ "INSTALL.ko.md",
43
+ "CHANGELOG.md",
44
+ "CHANGELOG.ja.md",
45
+ "CHANGELOG.ko.md",
46
+ "LICENSE"
47
+ ],
48
+ "dsh": {
49
+ "client": {
50
+ "inject": [
51
+ "@deepseek-ai/dsh-client-runtime",
52
+ "@deepseek-ai/dsh-client-locale",
53
+ "@deepseek-ai/dsh-client-ui-slots",
54
+ "@deepseek-ai/dsh-client-ui-settings"
55
+ ],
56
+ "platform": "web"
57
+ },
58
+ "bundle": {
59
+ "patch": "./cordis.patch.yml"
60
+ }
61
+ },
62
+ "scripts": {
63
+ "build": "tsdown",
64
+ "lint": "eslint src tests",
65
+ "test": "node --test \"tests/*.test.mjs\""
66
+ },
67
+ "engines": {
68
+ "node": ">=20"
69
+ },
70
+ "dependencies": {
71
+ "@deepseek-ai/schemastery": "^3.18.1"
72
+ },
73
+ "peerDependencies": {
74
+ "@deepseek-ai/cordis": "^4.0.1",
75
+ "@deepseek-ai/dsh-client-runtime": ">=0.1.0-rc.5 <0.2.0-0",
76
+ "@deepseek-ai/dsh-client-locale": ">=0.1.0-rc.5 <0.2.0-0",
77
+ "@deepseek-ai/dsh-client-ui-settings": ">=0.1.0-rc.5 <0.2.0-0",
78
+ "@deepseek-ai/dsh-client-ui-slots": ">=0.1.0-rc.5 <0.2.0-0"
79
+ },
80
+ "peerDependenciesMeta": {
81
+ "@deepseek-ai/cordis": { "optional": true },
82
+ "@deepseek-ai/dsh-client-runtime": { "optional": true },
83
+ "@deepseek-ai/dsh-client-locale": { "optional": true },
84
+ "@deepseek-ai/dsh-client-ui-settings": { "optional": true },
85
+ "@deepseek-ai/dsh-client-ui-slots": { "optional": true }
86
+ },
87
+ "devDependencies": {
88
+ "@eslint/js": "^10.0.1",
89
+ "@types/react": "~18.3.1",
90
+ "eslint": "^10.8.1",
91
+ "react": "^18.2.0",
92
+ "tsdown": "^0.22.2",
93
+ "typescript": "^5.6.0",
94
+ "typescript-eslint": "^8.67.0"
95
+ }
79
96
  }
package/src/bridge.js CHANGED
@@ -1,76 +1,76 @@
1
- /**
2
- * dsh-session-guard — sessionGuard 冗余端口(D5/D6/D8)。
3
- *
4
- * `ctx.provide('sessionGuard', service)`:
5
- * - stopNextTurn / resume:会话门(透传 taskControl,或回退锁队列)。
6
- * - lockQueue / unlockQueue:显式队列锁(供 input-traffic 冻结按钮桥接,
7
- * 或未来手动触发)。
8
- * - state(sessionId):{ queueLocked, lockReason, taskControlAvailable, taskControl }。
9
- *
10
- * input-traffic(方案 A,基于 feat/absorb-auto-continue 分支改造)在冻结按钮
11
- * 触发时调用 stopNextTurn;本服务不存在时 input-traffic 静默跳过(fail-open,D8)。
12
- */
13
- import { idleState } from './store.js'
14
-
15
- /**
16
- * @param {object} ctx host context
17
- * @param {ReturnType<import('./gate.js').createGate>} gate
18
- * @param {ReturnType<import('./store.js').createStore>} store
19
- */
20
- export function createBridge(ctx, gate, store, pauseGate) {
21
- function taskControlState(sessionId) {
22
- let tcState = null
23
- try {
24
- const tc = ctx && typeof ctx.get === 'function' ? ctx.get('taskControl') : undefined
25
- if (tc && typeof tc.state === 'function') {
26
- const s = tc.state(sessionId)
27
- tcState = {
28
- status: s && s.status,
29
- paused: !!(s && s.paused),
30
- forced: !!(s && s.forced),
31
- }
32
- }
33
- } catch {
34
- /* 状态读取失败 → 保持 null,fail-open */
35
- }
36
- return tcState
37
- }
38
-
39
- return {
40
- /** 停掉 session 下一回合(会话门 / 回退锁队列)。 */
41
- stopNextTurn(sessionId, opts) {
42
- return gate.stopNextTurn(sessionId, opts)
43
- },
44
- /** 恢复。 */
45
- resume(sessionId, opts) {
46
- return gate.resume(sessionId, opts)
47
- },
48
- /** 显式锁队列(手动触发)。 */
49
- lockQueue(sessionId, reason = 'manual') {
50
- const next = gate.lockQueue(sessionId, reason)
51
- return { ok: true, state: next }
52
- },
53
- /** 显式解锁队列。 */
54
- unlockQueue(sessionId) {
55
- const next = gate.unlockQueue(sessionId)
56
- return { ok: true, state: next }
57
- },
58
- /** 读一会话状态。 */
59
- state(sessionId) {
60
- const cur = store.get(sessionId)
61
- const base = cur || idleState(sessionId)
62
- const pausedState = pauseGate ? (pauseGate.state(sessionId) || {}) : {}
63
- return {
64
- sessionId: String(sessionId),
65
- queueLocked: base.queueLocked === true,
66
- lockReason: base.lockReason ?? null,
67
- // 自研会话门真暂停状态(脱离 task-control)。
68
- paused: pausedState.paused === true,
69
- pausedForced: pausedState.forced === true,
70
- taskControlAvailable: gate.taskControlAvailable(),
71
- taskControl: taskControlState(sessionId),
72
- updatedAt: base.updatedAt ?? null,
73
- }
74
- },
75
- }
76
- }
1
+ /**
2
+ * dsh-session-guard — sessionGuard 冗余端口(D5/D6/D8)。
3
+ *
4
+ * `ctx.provide('sessionGuard', service)`:
5
+ * - stopNextTurn / resume:会话门(透传 taskControl,或回退锁队列)。
6
+ * - lockQueue / unlockQueue:显式队列锁(供 input-traffic 冻结按钮桥接,
7
+ * 或未来手动触发)。
8
+ * - state(sessionId):{ queueLocked, lockReason, taskControlAvailable, taskControl }。
9
+ *
10
+ * input-traffic(方案 A,基于 feat/absorb-auto-continue 分支改造)在冻结按钮
11
+ * 触发时调用 stopNextTurn;本服务不存在时 input-traffic 静默跳过(fail-open,D8)。
12
+ */
13
+ import { idleState } from './store.js'
14
+
15
+ /**
16
+ * @param {object} ctx host context
17
+ * @param {ReturnType<import('./gate.js').createGate>} gate
18
+ * @param {ReturnType<import('./store.js').createStore>} store
19
+ */
20
+ export function createBridge(ctx, gate, store, pauseGate) {
21
+ function taskControlState(sessionId) {
22
+ let tcState = null
23
+ try {
24
+ const tc = ctx && typeof ctx.get === 'function' ? ctx.get('taskControl') : undefined
25
+ if (tc && typeof tc.state === 'function') {
26
+ const s = tc.state(sessionId)
27
+ tcState = {
28
+ status: s && s.status,
29
+ paused: !!(s && s.paused),
30
+ forced: !!(s && s.forced),
31
+ }
32
+ }
33
+ } catch {
34
+ /* 状态读取失败 → 保持 null,fail-open */
35
+ }
36
+ return tcState
37
+ }
38
+
39
+ return {
40
+ /** 停掉 session 下一回合(会话门 / 回退锁队列)。 */
41
+ stopNextTurn(sessionId, opts) {
42
+ return gate.stopNextTurn(sessionId, opts)
43
+ },
44
+ /** 恢复。 */
45
+ resume(sessionId, opts) {
46
+ return gate.resume(sessionId, opts)
47
+ },
48
+ /** 显式锁队列(手动触发)。 */
49
+ lockQueue(sessionId, reason = 'manual') {
50
+ const next = gate.lockQueue(sessionId, reason)
51
+ return { ok: true, state: next }
52
+ },
53
+ /** 显式解锁队列。 */
54
+ unlockQueue(sessionId) {
55
+ const next = gate.unlockQueue(sessionId)
56
+ return { ok: true, state: next }
57
+ },
58
+ /** 读一会话状态。 */
59
+ state(sessionId) {
60
+ const cur = store.get(sessionId)
61
+ const base = cur || idleState(sessionId)
62
+ const pausedState = pauseGate ? (pauseGate.state(sessionId) || {}) : {}
63
+ return {
64
+ sessionId: String(sessionId),
65
+ queueLocked: base.queueLocked === true,
66
+ lockReason: base.lockReason ?? null,
67
+ // 自研会话门真暂停状态(脱离 task-control)。
68
+ paused: pausedState.paused === true,
69
+ pausedForced: pausedState.forced === true,
70
+ taskControlAvailable: gate.taskControlAvailable(),
71
+ taskControl: taskControlState(sessionId),
72
+ updatedAt: base.updatedAt ?? null,
73
+ }
74
+ },
75
+ }
76
+ }
@@ -1,56 +1,56 @@
1
- /**
2
- * dsh-session-guard — 浏览器 half。
3
- *
4
- * 职责(全部 fail-open,D8):
5
- * - 在 composer 输入区右侧注册一个**纯展示**状态徽标(高峰/谷时/周末),轮询
6
- * /session-guard/status;
7
- * - 注册 `settings.plugin.item` 设置卡片,经 `settingsScope.bind({ namespace })`
8
- * 绑定 host 已注册的 `session-guard` 命名空间——这正是“插件配置”面板显示本
9
- * 插件的**必要**机制(对齐 dsh-thinking-levels / dsh-context);
10
- * - **不做**冻结/会话动作——冻结按钮由 input-traffic 接管并经 /session-guard/rpc
11
- * 桥接 host 会话门;本插件客户端不注册任何按钮,避免与 input-traffic 冲突。
12
- *
13
- * 构建:tsdown → lib/client.js(__ModuleLoader__.load 注册,与 input-traffic 同构)。
14
- */
15
- import { StatusBadge } from './status-badge'
16
- import { SessionGuardCard } from './settings-card'
17
-
18
- /** 客户端所需服务:slots(状态徽标 + 设置卡片)+ locale + settingsScope(设置卡片绑定)。 */
19
- export const inject = ['slots', 'locale', 'settingsScope']
20
-
21
- /** 轻量 ctx 类型(仅本客户端用到的方法;构建时类型被剥离)。 */
22
- interface SlotsFace {
23
- inject: (_name: string, _fn: () => unknown) => () => void
24
- register: (_options: Record<string, unknown>, _component: unknown) => () => void
25
- }
26
- interface SettingsScopeFace {
27
- bind: (_spec: { namespace: string }) => unknown
28
- }
29
- interface ClientCtx {
30
- slots: SlotsFace
31
- settingsScope: SettingsScopeFace
32
- }
33
-
34
- /** host 侧 src/settings.js 注册的命名空间(保持一致)。 */
35
- const NS = 'session-guard'
36
-
37
- export function apply(ctx: ClientCtx) {
38
- // 状态徽标:输入区右侧,纯展示。
39
- ctx.slots.inject('conversation.input.right', () => ctx.slots.register({
40
- name: 'conversation.input.right',
41
- id: 'session-guard-status',
42
- order: 50,
43
- locale: 'session-guard',
44
- }, StatusBadge))
45
-
46
- // 插件配置卡片:绑定 session-guard 命名空间,经 settingsScope 渲染并提交。
47
- ctx.slots.inject('settings.plugin.item', () => ctx.slots.register({
48
- name: 'settings.plugin.item',
49
- id: NS,
50
- key: NS,
51
- locale: 'session-guard',
52
- inject: () => ({
53
- scope: ctx.settingsScope.bind({ namespace: NS }),
54
- }),
55
- }, SessionGuardCard))
56
- }
1
+ /**
2
+ * dsh-session-guard — 浏览器 half。
3
+ *
4
+ * 职责(全部 fail-open,D8):
5
+ * - 在 composer 输入区右侧注册一个**纯展示**状态徽标(高峰/谷时/周末),轮询
6
+ * /session-guard/status;
7
+ * - 注册 `settings.plugin.item` 设置卡片,经 `settingsScope.bind({ namespace })`
8
+ * 绑定 host 已注册的 `session-guard` 命名空间——这正是“插件配置”面板显示本
9
+ * 插件的**必要**机制(对齐 dsh-thinking-levels / dsh-context);
10
+ * - **不做**冻结/会话动作——冻结按钮由 input-traffic 接管并经 /session-guard/rpc
11
+ * 桥接 host 会话门;本插件客户端不注册任何按钮,避免与 input-traffic 冲突。
12
+ *
13
+ * 构建:tsdown → lib/client.js(__ModuleLoader__.load 注册,与 input-traffic 同构)。
14
+ */
15
+ import { StatusBadge } from './status-badge'
16
+ import { SessionGuardCard } from './settings-card'
17
+
18
+ /** 客户端所需服务:slots(状态徽标 + 设置卡片)+ locale + settingsScope(设置卡片绑定)。 */
19
+ export const inject = ['slots', 'locale', 'settingsScope']
20
+
21
+ /** 轻量 ctx 类型(仅本客户端用到的方法;构建时类型被剥离)。 */
22
+ interface SlotsFace {
23
+ inject: (_name: string, _fn: () => unknown) => () => void
24
+ register: (_options: Record<string, unknown>, _component: unknown) => () => void
25
+ }
26
+ interface SettingsScopeFace {
27
+ bind: (_spec: { namespace: string }) => unknown
28
+ }
29
+ interface ClientCtx {
30
+ slots: SlotsFace
31
+ settingsScope: SettingsScopeFace
32
+ }
33
+
34
+ /** host 侧 src/settings.js 注册的命名空间(保持一致)。 */
35
+ const NS = 'session-guard'
36
+
37
+ export function apply(ctx: ClientCtx) {
38
+ // 状态徽标:输入区右侧,纯展示。
39
+ ctx.slots.inject('conversation.input.right', () => ctx.slots.register({
40
+ name: 'conversation.input.right',
41
+ id: 'session-guard-status',
42
+ order: 50,
43
+ locale: 'session-guard',
44
+ }, StatusBadge))
45
+
46
+ // 插件配置卡片:绑定 session-guard 命名空间,经 settingsScope 渲染并提交。
47
+ ctx.slots.inject('settings.plugin.item', () => ctx.slots.register({
48
+ name: 'settings.plugin.item',
49
+ id: NS,
50
+ key: NS,
51
+ locale: 'session-guard',
52
+ inject: () => ({
53
+ scope: ctx.settingsScope.bind({ namespace: NS }),
54
+ }),
55
+ }, SessionGuardCard))
56
+ }
@@ -1,95 +1,95 @@
1
- /** `session-guard` client dictionaries (zh / en / ja / ko). */
2
-
3
- /** Dictionary namespace owned by this plugin. */
4
- export const NS = 'session-guard'
5
-
6
- /** Simplified Chinese dictionary (the key-set source of truth). */
7
- export const zh = {
8
- 'badge.normal': '正常',
9
- 'badge.paused': '已暂停(峰值)',
10
- 'badge_paused_peak': '峰值暂停中',
11
- 'settings.enabled': '高峰自动暂停',
12
- 'settings.enabled.desc': '高峰时段自动暂停运行中的会话',
13
- 'settings.offPeakAutoResume': '低谷自动恢复',
14
- 'settings.offPeakAutoResume.desc': '低峰时段自动恢复被暂停的会话',
15
- 'settings.weekendMode': '周末模式',
16
- 'settings.weekendMode.desc': '识别周末 → 周末不自动暂停',
17
- 'settings.queueFallback': '回退锁等待队列',
18
- 'settings.queueFallback.desc': '自研会话门不可用时回退锁等待队列(fail-open)',
19
- 'settings.retryEnabled': '自动重试',
20
- 'settings.retryEnabled.desc': '瞬时失败自动续跑(默认关,保守)',
21
- 'settings.timezone': '时区',
22
- 'settings.peakWindows': '高峰时间窗口',
23
- 'settings.unavailable': '设置不可用:请确认 dsh-session-guard 已装配进 profile。',
24
- 'status.normal': '正常运行',
25
- 'status.paused_peak': '峰值暂停中',
26
- } satisfies Record<string, string>
27
-
28
- /** English dictionary (keys mirror zh). */
29
- export const en: Record<keyof typeof zh, string> = {
30
- 'badge.normal': 'Normal',
31
- 'badge.paused': 'Paused (peak)',
32
- 'badge_paused_peak': 'Peak paused',
33
- 'settings.enabled': 'Peak auto-pause',
34
- 'settings.enabled.desc': 'Auto-pause running sessions during peak hours',
35
- 'settings.offPeakAutoResume': 'Off-peak auto-resume',
36
- 'settings.offPeakAutoResume.desc': 'Auto-resume paused sessions during off-peak hours',
37
- 'settings.weekendMode': 'Weekend mode',
38
- 'settings.weekendMode.desc': 'Detect weekends → no auto-pause on weekends',
39
- 'settings.queueFallback': 'Fallback lock-wait queue',
40
- 'settings.queueFallback.desc': 'Fallback to lock-wait queue when custom session gate is unavailable (fail-open)',
41
- 'settings.retryEnabled': 'Auto-retry',
42
- 'settings.retryEnabled.desc': 'Transient failure auto-resume (off by default, conservative)',
43
- 'settings.timezone': 'Timezone',
44
- 'settings.peakWindows': 'Peak time windows',
45
- 'settings.unavailable': 'Settings unavailable: make sure dsh-session-guard is assembled into this profile.',
46
- 'status.normal': 'Running normally',
47
- 'status.paused_peak': 'Peak paused',
48
- }
49
-
50
- /** Japanese dictionary (keys mirror zh). */
51
- export const ja: Record<keyof typeof zh, string> = {
52
- 'badge.normal': '通常',
53
- 'badge.paused': '一時停止(ピーク)',
54
- 'badge_paused_peak': 'ピーク一時停止中',
55
- 'settings.enabled': 'ピーク自動一時停止',
56
- 'settings.enabled.desc': 'ピーク時間帯に実行中セッションを自動一時停止',
57
- 'settings.offPeakAutoResume': 'オフピーク自動再開',
58
- 'settings.offPeakAutoResume.desc': 'オフピーク時に一時停止セッションを自動再開',
59
- 'settings.weekendMode': '週末モード',
60
- 'settings.weekendMode.desc': '週末を認識→週末は自動一時停止しない',
61
- 'settings.queueFallback': 'フォールバックロック待機キュー',
62
- 'settings.queueFallback.desc': 'カスタムセッションゲート利用不可時にロック待機キューにフォールバック(fail-open)',
63
- 'settings.retryEnabled': '自動リトライ',
64
- 'settings.retryEnabled.desc': '瞬時失敗自動再試行(デフォルトオフ、保守的)',
65
- 'settings.timezone': 'タイムゾーン',
66
- 'settings.peakWindows': 'ピーク時間ウィンドウ',
67
- 'settings.unavailable': '設定利用不可:dsh-session-guard が profile に組み込まれているか確認してください。',
68
- 'status.normal': '通常実行中',
69
- 'status.paused_peak': 'ピーク一時停止中',
70
- }
71
-
72
- /** Korean dictionary (keys mirror zh). */
73
- export const ko: Record<keyof typeof zh, string> = {
74
- 'badge.normal': '정상',
75
- 'badge.paused': '일시정지(피크)',
76
- 'badge_paused_peak': '피크 일시정지 중',
77
- 'settings.enabled': '피크 자동 일시정지',
78
- 'settings.enabled.desc': '피크 시간대에 실행 중인 세션을 자동 일시정지',
79
- 'settings.offPeakAutoResume': '오피크 자동 재개',
80
- 'settings.offPeakAutoResume.desc': '오피크 시간대에 일시정지된 세션을 자동 재개',
81
- 'settings.weekendMode': '주말 모드',
82
- 'settings.weekendMode.desc': '주말 감지 → 주말에는 자동 일시정지 안 함',
83
- 'settings.queueFallback': '폴백 잠금 대기 큐',
84
- 'settings.queueFallback.desc': '커스텀 세션 게이트 사용 불가 시 잠금 대기 큐로 폴백(fail-open)',
85
- 'settings.retryEnabled': '자동 재시도',
86
- 'settings.retryEnabled.desc': '일시적 실패 자동 재개(기본값 꺼짐, 보수적)',
87
- 'settings.timezone': '타임존',
88
- 'settings.peakWindows': '피크 시간대',
89
- 'settings.unavailable': '설정 사용 불가: dsh-session-guard가 이 profile에 조립되었는지 확인하세요.',
90
- 'status.normal': '정상 실행 중',
91
- 'status.paused_peak': '피크 일시정지 중',
92
- }
93
-
94
- /** Dictionary key union. */
95
- export type SessionGuardKey = keyof typeof zh
1
+ /** `session-guard` client dictionaries (zh / en / ja / ko). */
2
+
3
+ /** Dictionary namespace owned by this plugin. */
4
+ export const NS = 'session-guard'
5
+
6
+ /** Simplified Chinese dictionary (the key-set source of truth). */
7
+ export const zh = {
8
+ 'badge.normal': '正常',
9
+ 'badge.paused': '已暂停(峰值)',
10
+ 'badge_paused_peak': '峰值暂停中',
11
+ 'settings.enabled': '高峰自动暂停',
12
+ 'settings.enabled.desc': '高峰时段自动暂停运行中的会话',
13
+ 'settings.offPeakAutoResume': '低谷自动恢复',
14
+ 'settings.offPeakAutoResume.desc': '低峰时段自动恢复被暂停的会话',
15
+ 'settings.weekendMode': '周末模式',
16
+ 'settings.weekendMode.desc': '识别周末 → 周末不自动暂停',
17
+ 'settings.queueFallback': '回退锁等待队列',
18
+ 'settings.queueFallback.desc': '自研会话门不可用时回退锁等待队列(fail-open)',
19
+ 'settings.retryEnabled': '自动重试',
20
+ 'settings.retryEnabled.desc': '瞬时失败自动续跑(默认关,保守)',
21
+ 'settings.timezone': '时区',
22
+ 'settings.peakWindows': '高峰时间窗口',
23
+ 'settings.unavailable': '设置不可用:请确认 dsh-session-guard 已装配进 profile。',
24
+ 'status.normal': '正常运行',
25
+ 'status.paused_peak': '峰值暂停中',
26
+ } satisfies Record<string, string>
27
+
28
+ /** English dictionary (keys mirror zh). */
29
+ export const en: Record<keyof typeof zh, string> = {
30
+ 'badge.normal': 'Normal',
31
+ 'badge.paused': 'Paused (peak)',
32
+ 'badge_paused_peak': 'Peak paused',
33
+ 'settings.enabled': 'Peak auto-pause',
34
+ 'settings.enabled.desc': 'Auto-pause running sessions during peak hours',
35
+ 'settings.offPeakAutoResume': 'Off-peak auto-resume',
36
+ 'settings.offPeakAutoResume.desc': 'Auto-resume paused sessions during off-peak hours',
37
+ 'settings.weekendMode': 'Weekend mode',
38
+ 'settings.weekendMode.desc': 'Detect weekends → no auto-pause on weekends',
39
+ 'settings.queueFallback': 'Fallback lock-wait queue',
40
+ 'settings.queueFallback.desc': 'Fallback to lock-wait queue when custom session gate is unavailable (fail-open)',
41
+ 'settings.retryEnabled': 'Auto-retry',
42
+ 'settings.retryEnabled.desc': 'Transient failure auto-resume (off by default, conservative)',
43
+ 'settings.timezone': 'Timezone',
44
+ 'settings.peakWindows': 'Peak time windows',
45
+ 'settings.unavailable': 'Settings unavailable: make sure dsh-session-guard is assembled into this profile.',
46
+ 'status.normal': 'Running normally',
47
+ 'status.paused_peak': 'Peak paused',
48
+ }
49
+
50
+ /** Japanese dictionary (keys mirror zh). */
51
+ export const ja: Record<keyof typeof zh, string> = {
52
+ 'badge.normal': '通常',
53
+ 'badge.paused': '一時停止(ピーク)',
54
+ 'badge_paused_peak': 'ピーク一時停止中',
55
+ 'settings.enabled': 'ピーク自動一時停止',
56
+ 'settings.enabled.desc': 'ピーク時間帯に実行中セッションを自動一時停止',
57
+ 'settings.offPeakAutoResume': 'オフピーク自動再開',
58
+ 'settings.offPeakAutoResume.desc': 'オフピーク時に一時停止セッションを自動再開',
59
+ 'settings.weekendMode': '週末モード',
60
+ 'settings.weekendMode.desc': '週末を認識→週末は自動一時停止しない',
61
+ 'settings.queueFallback': 'フォールバックロック待機キュー',
62
+ 'settings.queueFallback.desc': 'カスタムセッションゲート利用不可時にロック待機キューにフォールバック(fail-open)',
63
+ 'settings.retryEnabled': '自動リトライ',
64
+ 'settings.retryEnabled.desc': '瞬時失敗自動再試行(デフォルトオフ、保守的)',
65
+ 'settings.timezone': 'タイムゾーン',
66
+ 'settings.peakWindows': 'ピーク時間ウィンドウ',
67
+ 'settings.unavailable': '設定利用不可:dsh-session-guard が profile に組み込まれているか確認してください。',
68
+ 'status.normal': '通常実行中',
69
+ 'status.paused_peak': 'ピーク一時停止中',
70
+ }
71
+
72
+ /** Korean dictionary (keys mirror zh). */
73
+ export const ko: Record<keyof typeof zh, string> = {
74
+ 'badge.normal': '정상',
75
+ 'badge.paused': '일시정지(피크)',
76
+ 'badge_paused_peak': '피크 일시정지 중',
77
+ 'settings.enabled': '피크 자동 일시정지',
78
+ 'settings.enabled.desc': '피크 시간대에 실행 중인 세션을 자동 일시정지',
79
+ 'settings.offPeakAutoResume': '오피크 자동 재개',
80
+ 'settings.offPeakAutoResume.desc': '오피크 시간대에 일시정지된 세션을 자동 재개',
81
+ 'settings.weekendMode': '주말 모드',
82
+ 'settings.weekendMode.desc': '주말 감지 → 주말에는 자동 일시정지 안 함',
83
+ 'settings.queueFallback': '폴백 잠금 대기 큐',
84
+ 'settings.queueFallback.desc': '커스텀 세션 게이트 사용 불가 시 잠금 대기 큐로 폴백(fail-open)',
85
+ 'settings.retryEnabled': '자동 재시도',
86
+ 'settings.retryEnabled.desc': '일시적 실패 자동 재개(기본값 꺼짐, 보수적)',
87
+ 'settings.timezone': '타임존',
88
+ 'settings.peakWindows': '피크 시간대',
89
+ 'settings.unavailable': '설정 사용 불가: dsh-session-guard가 이 profile에 조립되었는지 확인하세요.',
90
+ 'status.normal': '정상 실행 중',
91
+ 'status.paused_peak': '피크 일시정지 중',
92
+ }
93
+
94
+ /** Dictionary key union. */
95
+ export type SessionGuardKey = keyof typeof zh