@dsh-plus/access-gate 0.3.24 → 0.3.26

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/lib/client.js CHANGED
@@ -7,6 +7,42 @@ window.__ModuleLoader__.load({
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
8
  let react = require("react");
9
9
  require("@deepseek-ai/dsh-client-ui-primitives");
10
+ //#region ../shared/src/client/fields.tsx
11
+ /** 卡片按钮(与 CardChrome 页脚同一套类名与视觉)。 */
12
+ function Button(props) {
13
+ const p = props.prefix ?? "dshp";
14
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
15
+ type: "button",
16
+ className: `${p}-btn ${props.variant === "primary" ? `${p}-btnPrimary` : `${p}-btnGhost`}`,
17
+ disabled: props.disabled === true,
18
+ onClick: props.onClick,
19
+ children: props.label
20
+ });
21
+ }
22
+ /**
23
+ * 勾选行:自绘圆角扁平开关(switch),对齐官方 WebUI 无原生 checkbox 的
24
+ * 设计语言(官方选择类控件全走胶囊/菜单,见 cardCss 的 -switch 规则)。
25
+ * 语义保持 checkbox(无障碍树与表单语义不变),视觉自绘。
26
+ */
27
+ function CheckRow(props) {
28
+ const p = props.prefix ?? "dshp";
29
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
30
+ className: `${p}-checkRow`,
31
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
32
+ id: props.id,
33
+ type: "checkbox",
34
+ role: "switch",
35
+ "aria-checked": props.checked,
36
+ checked: props.checked,
37
+ disabled: props.disabled === true,
38
+ onChange: (event) => props.onEdit(event.target.checked)
39
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
40
+ htmlFor: props.id,
41
+ children: props.label
42
+ })]
43
+ });
44
+ }
45
+ //#endregion
10
46
  //#region ../shared/src/client/card.tsx
11
47
  const IDLE_STATUS = {
12
48
  kind: "idle",
@@ -55,12 +91,12 @@ window.__ModuleLoader__.load({
55
91
  className: `${p}-status${props.status.kind === "error" ? ` ${p}-statusError` : ""}`,
56
92
  role: "status",
57
93
  children: props.status.text
58
- }) : null, props.actions.map((action) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
59
- type: "button",
60
- className: `${p}-btn ${action.variant === "primary" ? `${p}-btnPrimary` : `${p}-btnGhost`}`,
61
- disabled: action.disabled === true,
62
- onClick: action.onClick,
63
- children: action.label
94
+ }) : null, props.actions.map((action) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
95
+ prefix: p,
96
+ label: action.label,
97
+ variant: action.variant,
98
+ disabled: action.disabled,
99
+ onClick: action.onClick
64
100
  }, action.key))]
65
101
  })
66
102
  ]
@@ -115,31 +151,6 @@ window.__ModuleLoader__.load({
115
151
  * @module @dsh-plus/shared/client/draft
116
152
  */
117
153
  //#endregion
118
- //#region ../shared/src/client/fields.tsx
119
- /**
120
- * 勾选行:自绘圆角扁平开关(switch),对齐官方 WebUI 无原生 checkbox 的
121
- * 设计语言(官方选择类控件全走胶囊/菜单,见 cardCss 的 -switch 规则)。
122
- * 语义保持 checkbox(无障碍树与表单语义不变),视觉自绘。
123
- */
124
- function CheckRow(props) {
125
- const p = props.prefix ?? "dshp";
126
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
127
- className: `${p}-checkRow`,
128
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
129
- id: props.id,
130
- type: "checkbox",
131
- role: "switch",
132
- "aria-checked": props.checked,
133
- checked: props.checked,
134
- disabled: props.disabled === true,
135
- onChange: (event) => props.onEdit(event.target.checked)
136
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
137
- htmlFor: props.id,
138
- children: props.label
139
- })]
140
- });
141
- }
142
- //#endregion
143
154
  //#region ../shared/src/client/i18n.ts
144
155
  /** 卡片通用文案(save/discard/unsaved/loading 等四插件共有键)。 */
145
156
  const commonZh = {
@@ -149,7 +160,7 @@ window.__ModuleLoader__.load({
149
160
  unsaved: "未保存",
150
161
  loading: "加载中…",
151
162
  unavailable: "配置服务不可用。",
152
- readOnly: "当前部署无 settings provider,配置为只读;请编辑 settings.yaml。",
163
+ readOnly: "当前部署无 settings provider,配置为只读;请在 profile 的 cordis.patch.yml 行级配置。",
153
164
  invalidNumber: "请输入正整数。",
154
165
  collapse: "收起",
155
166
  expand: "展开",
@@ -166,7 +177,7 @@ window.__ModuleLoader__.load({
166
177
  unsaved: "Unsaved",
167
178
  loading: "Loading…",
168
179
  unavailable: "Settings service unavailable.",
169
- readOnly: "No settings provider in this deployment; config is read-only. Edit settings.yaml.",
180
+ readOnly: "No settings provider in this deployment; config is read-only. Configure it at the profile row in cordis.patch.yml.",
170
181
  invalidNumber: "Enter a positive integer.",
171
182
  collapse: "Collapse",
172
183
  expand: "Expand",
@@ -373,7 +384,7 @@ ${extra}
373
384
  //#region src/ns.ts
374
385
  /**
375
386
  * settings 命名空间字面量(纯常量,零依赖,浏览器半可安全引入)。
376
- * 服务端直接以字面量注册(0.1.2-alpha.2 起 dsh-settings 对命名空间做编译期
387
+ * 服务端直接以字面量注册(dsh-settings 对命名空间做编译期
377
388
  * 语法校验,见 config.ts);浏览器半把它作为配置卡片的注册键
378
389
  * (插件页配置卡片挂在 row/bundle config 槽位上,与命名空间解耦,
379
390
  * 见 shared/config-slots),
@@ -388,7 +399,7 @@ ${extra}
388
399
  * plugins.bundle.config,view 分发 summary/page)。
389
400
  * 外壳与基础控件走 @dsh-plus/shared/client 套件(CardChrome/TextField/CheckRow),
390
401
  * 本文件保留业务字段(白名单 textarea/诊断面板)与保存逻辑。
391
- * 配置读写经共享层 ctx.remote.settings 直连(0.1.7 起 settingsScope 已由
402
+ * 配置读写经共享层 ctx.remote.settings 直连(settingsScope 已由
392
403
  * configForms 取代):value 为 schema 解析后的视图,保存经 settings.update 深合并。
393
404
  * 卡片顶部「当前页面诊断」读 /dsh-plus/gate/status(本页放行原因/客户端 IP/
394
405
  * 官方 cookie 状态)。
package/lib/index.d.ts CHANGED
@@ -13,7 +13,7 @@ declare const Config: z<Schemastery.ObjectS<NoInfer<{
13
13
  trustForwardedFor: z<boolean, boolean, "volatile-defined">;
14
14
  autoLoginTrustedIps: z<boolean, boolean, "volatile-defined">;
15
15
  }>>, "plain">;
16
- /** 活动字段形态(0.1.7 loader 解析产物:volatile 字段为活动引用)。 */
16
+ /** 活动字段形态(loader 解析产物:volatile 字段为活动引用)。 */
17
17
  type AccessGateConfigFields = Schemastery.TypeT<typeof Config>;
18
18
  /** 平面配置形态(服务与判定面的消费形态,由活动引用解包得到)。 */
19
19
  type AccessGateConfig = UnwrapVolatile<AccessGateConfigFields>;
@@ -26,7 +26,7 @@ declare module '@deepseek-ai/cordis' {
26
26
  accessGate: AccessGateService;
27
27
  }
28
28
  }
29
- /** 围栏服务:持有当前配置读取器(0.1.7 起为 volatile 活动引用的平面解包,读即最新)。 */
29
+ /** 围栏服务:持有当前配置读取器(volatile 活动引用的平面解包,读即最新)。 */
30
30
  declare class AccessGateService extends Service {
31
31
  private current;
32
32
  /** 官方 browser-auth 签名密钥(惰性读取缓存;读取失败 = null,autoLogin fail-safe 降级)。 */
package/lib/index.js CHANGED
@@ -8,7 +8,7 @@ import { join } from "node:path";
8
8
  //#region src/config.ts
9
9
  /**
10
10
  * 配置单一事实源:cordis 行级 Config(组合默认值,dev/prod patch 层可覆盖)
11
- * 与 settings namespace(用户层,经 dsh-settings-file 持久化到 $DSH_HOME/settings.yaml)
11
+ * 与 settings namespace(用户层=profile 行级覆盖层 cordis.patch.yml,热生效)
12
12
  * 共用同一 schemastery schema(notify-email 同款约定)。
13
13
  *
14
14
  * 与官方认证合并后:访问凭据唯一化为官方 browser-auth cookie(dsh-auth-*,
@@ -34,8 +34,8 @@ const Config = z.object({
34
34
  * 浏览器落罐,后续 /api、WS 的官方 requestRejection() 自然通过,
35
35
  * 用户全程无感、免启动 token。
36
36
  *
37
- * 契约(对 dsh 0.1.2-alpha.2 / 0.1.3-alpha.2 官方 client-connection
38
- * browser-auth 逐行核实,见 docs/README.md「信任模型」):
37
+ * 契约(对官方 client-connection browser-auth 逐行核实,见 docs/README.md
38
+ * 「信任模型」;0.2.1-alpha.1 复核不变):
39
39
  * - 签名密钥持久化于 $DSH_HOME/.credentials.yaml
40
40
  * (records → client-connection/browser-session → payload.secret,
41
41
  * base64url 无填充 32B;跨重启不变);
@@ -745,7 +745,7 @@ function assertGateStructure(server) {
745
745
  //#region src/index.ts
746
746
  const name = "dsh-plus-access-gate";
747
747
  const inject = ["webServer", "connection"];
748
- /** 围栏服务:持有当前配置读取器(0.1.7 起为 volatile 活动引用的平面解包,读即最新)。 */
748
+ /** 围栏服务:持有当前配置读取器(volatile 活动引用的平面解包,读即最新)。 */
749
749
  var AccessGateService = class extends Service {
750
750
  current;
751
751
  /** 官方 browser-auth 签名密钥(惰性读取缓存;读取失败 = null,autoLogin fail-safe 降级)。 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-plus/access-gate",
3
- "version": "0.3.24",
3
+ "version": "0.3.26",
4
4
  "description": "dsh-plus service+ui plugin: dsh web 全量访问围栏——与官方 browser-auth 合并:官方 cookie 为唯一凭据,可选 IP 附加围栏,未认证导航渲染 token 输入页(PWA 可恢复),loopback 管理通道",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -31,7 +31,7 @@
31
31
  }
32
32
  },
33
33
  "dependencies": {
34
- "@dsh-plus/shared": "0.1.34"
34
+ "@dsh-plus/shared": "0.1.36"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@deepseek-ai/cordis": "^4.0.5-alpha.1",
@@ -3,7 +3,7 @@
3
3
  * plugins.bundle.config,view 分发 summary/page)。
4
4
  * 外壳与基础控件走 @dsh-plus/shared/client 套件(CardChrome/TextField/CheckRow),
5
5
  * 本文件保留业务字段(白名单 textarea/诊断面板)与保存逻辑。
6
- * 配置读写经共享层 ctx.remote.settings 直连(0.1.7 起 settingsScope 已由
6
+ * 配置读写经共享层 ctx.remote.settings 直连(settingsScope 已由
7
7
  * configForms 取代):value 为 schema 解析后的视图,保存经 settings.update 深合并。
8
8
  * 卡片顶部「当前页面诊断」读 /dsh-plus/gate/status(本页放行原因/客户端 IP/
9
9
  * 官方 cookie 状态)。
@@ -7,8 +7,8 @@
7
7
  *
8
8
  * 类型说明:浏览器半只用到 slots/locale/remote 的很窄一面,
9
9
  * scope 与基础控件走 @dsh-plus/shared/client 套件(收编自本插件原实现)。
10
- * 配置读写经 ctx.remote.settings 直连(0.1.2-alpha.1 起 connection.api.settings
11
- * 已移除;0.1.7 起 settingsScope 服务亦删除——configForms 取代,自始直连)。
10
+ * 配置读写经 ctx.remote.settings 直连(connection.api.settings
11
+ * 已移除; settingsScope 服务亦删除——configForms 取代,自始直连)。
12
12
  * 卡片 key/rowId 约定见 @dsh-plus/shared/client/config-slots。
13
13
  * @module @dsh-plus/access-gate/client
14
14
  */
package/src/config.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * 配置单一事实源:cordis 行级 Config(组合默认值,dev/prod patch 层可覆盖)
3
- * 与 settings namespace(用户层,经 dsh-settings-file 持久化到 $DSH_HOME/settings.yaml)
3
+ * 与 settings namespace(用户层=profile 行级覆盖层 cordis.patch.yml,热生效)
4
4
  * 共用同一 schemastery schema(notify-email 同款约定)。
5
5
  *
6
6
  * 与官方认证合并后:访问凭据唯一化为官方 browser-auth cookie(dsh-auth-*,
@@ -15,10 +15,10 @@ import type { UnwrapVolatile } from '@dsh-plus/shared'
15
15
 
16
16
  import { SETTINGS_NS as NS_LITERAL } from './ns.ts'
17
17
 
18
- /** settings 命名空间(字面量即合法命名空间,0.1.2-alpha.2 起编译期校验;webui 配置卡片与插件运行期读取同一份)。 */
18
+ /** settings 命名空间(字面量即合法命名空间,编译期校验;webui 配置卡片与插件运行期读取同一份)。 */
19
19
  export const SETTINGS_NS = NS_LITERAL
20
20
 
21
- // 0.1.7:全部字段 `.volatile()`——loader 解析为活动引用(用户层 override 并入
21
+ // 全部字段 `.volatile()`——loader 解析为活动引用(用户层 override 并入
22
22
  // 行级 config,GUI 写入原位提交热生效),同时使本条目进入 settings describe
23
23
  // 视图(配置卡片可读写);缺 volatile 标记的条目会被 describe 跳过。
24
24
  export const Config = z.object({
@@ -50,7 +50,7 @@ export const Config = z.object({
50
50
  .volatile(),
51
51
  })
52
52
 
53
- /** 活动字段形态(0.1.7 loader 解析产物:volatile 字段为活动引用)。 */
53
+ /** 活动字段形态(loader 解析产物:volatile 字段为活动引用)。 */
54
54
  export type AccessGateConfigFields = Schemastery.TypeT<typeof Config>
55
55
  /** 平面配置形态(服务与判定面的消费形态,由活动引用解包得到)。 */
56
56
  export type AccessGateConfig = UnwrapVolatile<AccessGateConfigFields>
package/src/cookie.ts CHANGED
@@ -6,8 +6,8 @@
6
6
  * 浏览器落罐,后续 /api、WS 的官方 requestRejection() 自然通过,
7
7
  * 用户全程无感、免启动 token。
8
8
  *
9
- * 契约(对 dsh 0.1.2-alpha.2 / 0.1.3-alpha.2 官方 client-connection
10
- * browser-auth 逐行核实,见 docs/README.md「信任模型」):
9
+ * 契约(对官方 client-connection browser-auth 逐行核实,见 docs/README.md
10
+ * 「信任模型」;0.2.1-alpha.1 复核不变):
11
11
  * - 签名密钥持久化于 $DSH_HOME/.credentials.yaml
12
12
  * (records → client-connection/browser-session → payload.secret,
13
13
  * base64url 无填充 32B;跨重启不变);
package/src/index.ts CHANGED
@@ -56,7 +56,7 @@ declare module '@deepseek-ai/cordis' {
56
56
  }
57
57
  }
58
58
 
59
- /** 围栏服务:持有当前配置读取器(0.1.7 起为 volatile 活动引用的平面解包,读即最新)。 */
59
+ /** 围栏服务:持有当前配置读取器(volatile 活动引用的平面解包,读即最新)。 */
60
60
  export class AccessGateService extends Service {
61
61
  private current: () => AccessGateConfig
62
62
  /** 官方 browser-auth 签名密钥(惰性读取缓存;读取失败 = null,autoLogin fail-safe 降级)。 */
@@ -64,7 +64,7 @@ export class AccessGateService extends Service {
64
64
 
65
65
  constructor(ctx: Context, config: AccessGateConfig | AccessGateConfigFields) {
66
66
  super(ctx, 'accessGate')
67
- // 0.1.7 替代 0.1.6 installSection/setSource:loader 解析层已把用户层
67
+ // 替代已删除的 installSection/setSource:loader 解析层已把用户层
68
68
  // override 并入行级 config 并以活动引用原位提交,current() 现取即热。
69
69
  this.current = () => unwrapVolatile(config)
70
70
  const logger = ctx.logger('access-gate')
package/src/ns.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * settings 命名空间字面量(纯常量,零依赖,浏览器半可安全引入)。
3
- * 服务端直接以字面量注册(0.1.2-alpha.2 起 dsh-settings 对命名空间做编译期
3
+ * 服务端直接以字面量注册(dsh-settings 对命名空间做编译期
4
4
  * 语法校验,见 config.ts);浏览器半把它作为配置卡片的注册键
5
5
  * (插件页配置卡片挂在 row/bundle config 槽位上,与命名空间解耦,
6
6
  * 见 shared/config-slots),