dsh-session-guard 0.3.2 → 0.3.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,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-session-guard",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public",
@@ -70,17 +70,17 @@
70
70
  },
71
71
  "engines": {
72
72
  "node": ">=20",
73
- "dsh": ">=0.1.2-rc.1 <0.2.0-0"
73
+ "dsh": ">=0.1.2-rc.1 <0.1.3-0"
74
74
  },
75
75
  "dependencies": {
76
76
  "@deepseek-ai/schemastery": "^3.18.1"
77
77
  },
78
78
  "peerDependencies": {
79
79
  "@deepseek-ai/cordis": "^4.0.1",
80
- "@deepseek-ai/dsh-client-locale": ">=0.1.2-rc.1 <0.2.0-0",
81
- "@deepseek-ai/dsh-client-ui-settings": ">=0.1.2-rc.1 <0.2.0-0",
82
- "@deepseek-ai/dsh-client-ui-slots": ">=0.1.2-rc.1 <0.2.0-0",
83
- "@deepseek-ai/dsh-client-ui-renderer": ">=0.1.2-rc.1 <0.2.0-0"
80
+ "@deepseek-ai/dsh-client-locale": ">=0.1.2-rc.1 <0.1.3-0",
81
+ "@deepseek-ai/dsh-client-ui-settings": ">=0.1.2-rc.1 <0.1.3-0",
82
+ "@deepseek-ai/dsh-client-ui-slots": ">=0.1.2-rc.1 <0.1.3-0",
83
+ "@deepseek-ai/dsh-client-ui-renderer": ">=0.1.2-rc.1 <0.1.3-0"
84
84
  },
85
85
  "peerDependenciesMeta": {
86
86
  "@deepseek-ai/cordis": {
@@ -1,66 +1,66 @@
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
- import { PauseButton } from './pause-button'
18
-
19
- /** 客户端所需服务:slots(状态徽标 + 设置卡片)+ locale + settingsScope(设置卡片绑定)。 */
20
- export const inject = ['slots', 'locale', 'settingsScope']
21
-
22
- /** 轻量 ctx 类型(仅本客户端用到的方法;构建时类型被剥离)。 */
23
- interface SlotsFace {
24
- inject: (_name: string, _fn: () => unknown) => () => void
25
- register: (_options: Record<string, unknown>, _component: unknown) => () => void
26
- }
27
- interface SettingsScopeFace {
28
- bind: (_spec: { namespace: string }) => unknown
29
- }
30
- interface ClientCtx {
31
- slots: SlotsFace
32
- settingsScope: SettingsScopeFace
33
- }
34
-
35
- /** host 侧 src/settings.js 注册的命名空间(保持一致)。 */
36
- const NS = 'session-guard'
37
-
38
- export function apply(ctx: ClientCtx) {
39
- // 暂停会话按钮(v0.2.0):step 级门控的状态显示 + 手动解除。
40
- // order 20 < input-traffic 冻结按钮的 30 → 排在左侧,两者并列互不取代(ADR-001/002)。
41
- ctx.slots.inject('conversation.input.right', () => ctx.slots.register({
42
- name: 'conversation.input.right',
43
- id: 'session-guard-pause',
44
- order: 20,
45
- locale: 'session-guard',
46
- }, PauseButton))
47
-
48
- // 状态徽标:输入区右侧,纯展示。
49
- ctx.slots.inject('conversation.input.right', () => ctx.slots.register({
50
- name: 'conversation.input.right',
51
- id: 'session-guard-status',
52
- order: 40,
53
- locale: 'session-guard',
54
- }, StatusBadge))
55
-
56
- // 插件配置卡片:绑定 session-guard 命名空间,经 settingsScope 渲染并提交。
57
- ctx.slots.inject('settings.plugin.item', () => ctx.slots.register({
58
- name: 'settings.plugin.item',
59
- id: NS,
60
- key: NS,
61
- locale: 'session-guard',
62
- inject: () => ({
63
- scope: ctx.settingsScope.bind({ namespace: NS }),
64
- }),
65
- }, SessionGuardCard))
66
- }
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
+ import { PauseButton } from './pause-button'
18
+
19
+ /** 客户端所需服务:slots(状态徽标 + 设置卡片)+ locale + settingsScope(设置卡片绑定)。 */
20
+ export const inject = ['slots', 'locale', 'settingsScope']
21
+
22
+ /** 轻量 ctx 类型(仅本客户端用到的方法;构建时类型被剥离)。 */
23
+ interface SlotsFace {
24
+ inject: (_name: string, _fn: () => unknown) => () => void
25
+ register: (_options: Record<string, unknown>, _component: unknown) => () => void
26
+ }
27
+ interface SettingsScopeFace {
28
+ bind: (_spec: { namespace: string }) => unknown
29
+ }
30
+ interface ClientCtx {
31
+ slots: SlotsFace
32
+ settingsScope: SettingsScopeFace
33
+ }
34
+
35
+ /** host 侧 src/settings.js 注册的命名空间(保持一致)。 */
36
+ const NS = 'session-guard'
37
+
38
+ export function apply(ctx: ClientCtx) {
39
+ // 暂停会话按钮(v0.2.0):step 级门控的状态显示 + 手动解除。
40
+ // order 20 < input-traffic 冻结按钮的 30 → 排在左侧,两者并列互不取代(ADR-001/002)。
41
+ ctx.slots.inject('conversation.input.right', () => ctx.slots.register({
42
+ name: 'conversation.input.right',
43
+ id: 'session-guard-pause',
44
+ order: 20,
45
+ locale: 'session-guard',
46
+ }, PauseButton))
47
+
48
+ // 状态徽标:输入区右侧,纯展示。
49
+ ctx.slots.inject('conversation.input.right', () => ctx.slots.register({
50
+ name: 'conversation.input.right',
51
+ id: 'session-guard-status',
52
+ order: 40,
53
+ locale: 'session-guard',
54
+ }, StatusBadge))
55
+
56
+ // 插件配置卡片:绑定 session-guard 命名空间,经 settingsScope 渲染并提交。
57
+ ctx.slots.inject('settings.plugin.item', () => ctx.slots.register({
58
+ name: 'settings.plugin.item',
59
+ id: NS,
60
+ key: NS,
61
+ locale: 'session-guard',
62
+ inject: () => ({
63
+ scope: ctx.settingsScope.bind({ namespace: NS }),
64
+ }),
65
+ }, SessionGuardCard))
66
+ }