@heybox/hb-sdk-protocol 0.8.0-alpha → 0.8.0-alpha.12

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/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  `@heybox/hb-sdk-protocol` 拥有:
8
8
 
9
9
  - bridge namespace、协议版本、method 常量和事件名称;
10
- - capability metadata(module、capability、permission、risk);
10
+ - capability metadata(module、capability、requirement、risk)和权限机器目录;
11
11
  - method payload/result 与错误的 wire 类型;
12
12
  - `runtime_permissions` schema 解析器和相关类型。
13
13
 
@@ -32,17 +32,14 @@
32
32
  宿主/Runtime 维护代码直接使用协议包:
33
33
 
34
34
  ```ts
35
- import {
36
- MINI_PROGRAM_PROTOCOL_CAPABILITIES,
37
- type MiniProgramBridgeMessage,
38
- } from '@heybox/hb-sdk-protocol';
35
+ import { MINI_PROGRAM_PROTOCOL_CAPABILITIES, type MiniProgramBridgeMessage } from '@heybox/hb-sdk-protocol';
39
36
  ```
40
37
 
41
38
  小程序业务代码不应导入该包;业务只使用 `@heybox/hb-sdk`。为了兼容已有 Host/Runtime 消费者,`@heybox/hb-sdk/protocol` 继续 re-export 本包的公开值和类型,但协议 owner 是本包。
42
39
 
43
40
  ## 权限快照
44
41
 
45
- `parseMiniProgramRuntimePermissions()` 是唯一的 schema v1 fail-closed 解析器。它校验 schema、entry 唯一性、managed key 和状态;未知但结构合法的新 key 会被保留/忽略,不会让当前版本误放行能力。Runtime 再使用 `hasMiniProgramNetworkRequestPermission()` 判断 `network.request` 是否明确启用。
42
+ `MINI_PROGRAM_PERMISSION_CATALOG` 定义 8 个公开权限,`MINI_PROGRAM_PROTOCOL_CAPABILITIES[].requirement` 将每个 bridge method 显式分类为无需声明或要求全部列出的权限。`parseMiniProgramRuntimePermissions()` schema v1 fail-closed 解析器;旧 `network.request` entry 仅在解析边界归一为 `network`,不得进入新配置。跨语言目录由 `generated/permission-catalog.json` 提供。
46
43
 
47
44
  协议包不决定业务授权。`auth.login()` 的 UI、账号会话、授权码签发和 OpenAPI 都由 Host/服务端负责;协议层只传递经过约束的 request/response 数据。
48
45