@zhin.js/adapter-douyin-live 0.1.4 → 0.1.6

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/CHANGELOG.md ADDED
@@ -0,0 +1,126 @@
1
+ # @zhin.js/adapter-douyin-live
2
+
3
+ ## 0.1.6
4
+
5
+ ### Patch Changes
6
+
7
+ - e1fda87: fix: 按审计待审清单处理(安全、功能、清理)
8
+
9
+ **行为变更(升级前请阅读)**
10
+
11
+ - kernel / core / zhin.js:出站文本中的 `${…}` 不再用 `vm` 求值,只替换 `TemplateContext` 上能解析到值的属性路径(如 `${sender.name}`);表达式、函数调用、未知名字原样保留。整套 vm 沙箱(`evaluate` / `execute` / `compiler` / `getValueWithRuntime`)已移除。
12
+ - kernel / core / zhin.js:移除零引用的遗留导出——`Scheduler`、错误管理器与 `ZhinError` 子类、`compose`、`segment.from/toString`、AI 触发/准入函数、`@zhin.js/core/queue-im-field-contract`、`zhin.js/contexts`。
13
+ - agent:readonly 执行预设不再放行重定向、后台 `&`、进程替换、`find -delete/-exec`、`sed -i`、`sort -o`、`tee`、`xargs`、awk;curl/wget 校验每个 URL 与裸主机并识别更多上传参数;自定义 `execAllowlist` 中的只读命令带写入风险时改走审批。沙箱超时/取消会杀掉进程组或具名容器,默认镜像改为 `node:22-bookworm-slim` + `bash`。移除无生产调用的 `AuditLogger`、`AnomalyDetector`、旧 vision 回合等导出。
14
+ - ai:移除 `storage`、`FileStateCache`、`CostTracker`、`model-name-utils`、`./agent-step-checkpoint` 子路径、`ContextManager` 及旧压缩管线;延迟工具快照改为有界 LRU。
15
+ - cli:`zhin send` / `watch` / `schedule` 改为与运行中的 Host 通信(新增 `POST /message/send` 与 `/assistant/jobs` 写接口),`schedule` 不再支持离线改文件;移除 `zhin uninstall service`(用 `zhin service uninstall`)、`build --analyze`、`install -S`;`zhin stop` 杀不掉进程时保留 pid 文件并以非零退出;`runtime migrate` 新增 `verify`;未设置 `TZ` 时调度默认时区改为系统时区;不带 `ZHIN_SUPERVISOR_PID` 的进程被 init 接管后不再自行退出。
16
+ - schedule:后台 reconcile 出错不再产生未处理 rejection(新增 `onStoreError`);启动途中 `stop()` 不再遗留定时器。
17
+ - schema:元组校验与 `safeParse`、JSON Schema 一致(空数组不通过,缺省的可选元组为 `undefined`)。
18
+ - client / contract:删除无后端路由的 agent-stream API、未使用的 `definePage` 与旧 PageManager 类型;`@zhin.js/contract` 不再依赖 `@zhin.js/ai`;客户端收到 401 会清除已保存的凭据;安装/更新/卸载 RPC 默认超时 120 秒。
19
+ - a2a:流式响应中途出错写入 SSE error 并结束;未配置 token 的非生产环境只接受本机请求;任务存储有上限与过期;Mailbox 凭据回退与生产环境缺密钥检查修复。
20
+ - speech:`provider: openai` 不再套用 Ollama 的默认 host/model;识别语言改为可配置,不再写死 `zh`。
21
+ - adapter-lark:支持 `encryptKey` 加密事件解密。adapter-github:Device Flow 可取消、带超时并回复失败原因。adapter-wecom / dingtalk:请求加超时并校验 HTTP 状态。adapter-weixin-ilink:输入关闭期间暂停轮询。adapter-milky:SSE 支持 CRLF、缓冲上限与空闲重连。adapter-onebot-events:好友删除通知改为 `notice.friend.decrease`。
22
+ - plugin-group-suite:`teachAllowRegex` 默认关闭,正则安全检查更严格。plugin-qrcode:改为本地生成,回复 data URL 图片。plugin-rss / short-url / link-poster:拒绝解析到内网的地址;rss 修复条目每周重复推送;short-url 的 Console 创建改为真实调用 is.gd。plugin-lottery:按 `historyLimit` 同步。
23
+
24
+ **其余**
25
+
26
+ - host-http:插件市场详情加缓存与包名校验,SSE 回放容忍背压。host-http-contract:新增 `readTextBody()`,九个适配器改用它。
27
+ - pagemanager:页面外壳 importmap 升级到 React 19.2.8 / react-router 7.12.0。console-contract:`definePage` 接受 `description` / `group` / `parent` / `fullWidth`。
28
+ - command:进度提示本地化,匹配不再重复拷贝消息段。runtime:源码监听降级后退避重试原生监听。
29
+ - html-renderer:删除未接线的 `aiTextAsImage`。create-zhin-app / scaffold-wizard:移除不起作用的"全局安装 CLI"与运行时选择提示。
30
+ - 依赖声明清理、发布清单不再携带解析不到的 `src` 目录、移除未使用的 Skill 挂载、README 与示例配置按当前实现更正。
31
+
32
+ - 120e225: 聊天角色(ADR 0056,2026-11-12 修订):zhin 角色 owner / admin / trusted 分四级、只来自授予;发言者的平台身份与机器人自身的平台身份是独立维度,命令、Agent 工具 / 技能、中间件与按钮按三条维度共用一个评估器过滤。升级说明见 docs/migrations/chat-roles.md。
33
+
34
+ - zhin.js:实例首次启动把适配器 `master` / `trusted`、`endpoints[i].master|trusted` 与 `ai.trigger.masters|trusted` 迁入项目数据库 `chat_roles`(先记入 `.zhin/chat-roles-migration.json`,再从配置移除并记日志);之后配置再出现这些字段时启动报错并指向升级指南。平台身份不再映射为 zhin 角色:删除 `roles.mappings`(适配器块与 `endpoints[i].roles` 出现即启动报错)、`chat_role_mappings` 表与 Console `chat-roles.mappings` / `chat-roles.set-mappings`;`features.selfService.platformAdmins|roles|allowUsers` 删除;群内「功能」「角色」命令只认 zhin 角色,平台群主不再自动具备;聊天改配置、聊天重启、Agent 主人审批按 zhin `owner` 判断。
35
+ - @zhin.js/core(minor,破坏性):角色模型与解析移入 core(`ChatRoleService`、`createChatRoleSenderEnricher`),入站消息带 `sender.chatRole` 与归一的 `sender.platform`;删除 `SenderRole`、`senderRolesFromMessage`、`roleSatisfies` 等,`master` 改名 `owner`;删除映射规则 API(`createMappingChatRoleSource`、`DEFAULT_CHAT_ROLE_MAPPINGS` 等)与 `ChatRoleSource`;`createSenderEnricher` / `createConfigurationChatAuthorizer` 改为基于聊天角色。IM Runtime 为 PermissionHost 提供机器人自身身份(经 Adapter 索引缓存),机器人的角色变化事件使缓存失效;命令拒绝回复说明缺少的平台 / 机器人条件;`<Button permit>` 按点击者鉴权;场景治理工具工厂同时要求 `platform:*` 与 `bot:*`;`ai.trigger.masters|trusted` 删除。
36
+ - @zhin.js/permission(minor,破坏性):permit 语法 `owner` / `admin` / `trusted` / `role(...)`(zhin 角色)、`platform:owner|admin`、`platform-role:<id>`、`platform-permission:<name>`(发言者平台身份),新增 `bot:owner|admin`、`bot-role:<id>`、`bot-permission:<name>`(机器人自身平台身份,`PermissionSubject.bot`);`PermissionHost` 新增 `setBotStandingResolver`、`withBotStanding`、`firstDenied`,`checkAll` 可带 `source` 解析机器人身份;新增 `describeDeniedPermit`、`permitsNeedBotStanding`。删除 `role(master)`、`scene_admin`、`scene_owner`、`platform(adapter,perm)` 及 `registerPlatform`、`createSceneRolePlatformChecker`、`platformPermission`、`definePlatformPermission`,定义时报错并给出替代写法。
37
+ - @zhin.js/command(minor,破坏性):命令会话的发送者改为 `chatRole` / `platform`,不再从 metadata 读角色;`CONVERSATION_MANAGER_PERMIT` 改为 `admin`(平台群主不再自动满足);分发结果 `denied` 带 `denial`(第一条不满足的规则与原因);指令菜单只列出当前发送者在本会话可用的命令。
38
+ - @zhin.js/agent(minor,破坏性):危险工具、文件 / exec 策略、主人审批、Agent 回合主体只读 zhin 角色(`principal.roles` 只含展开的聊天角色,平台地位在 `principal.platform`);`SenderRole` → `PrincipalRole`,`SELF_CHANGE_MASTER_ROLE` → `SELF_CHANGE_OWNER_ROLE`;回合开始时读取机器人自身身份(`contextState.bot.platform`),按三条维度过滤 tool / skill / Agent 包后才披露,执行工具时再校验一次;群规「群主和管理员豁免」改为平台群主 / 管理员与 zhin `owner`。
39
+ - @zhin.js/feature-kit:`OperationSession.sender` 改为 `chatRole` / `platform`。
40
+ - @zhin.js/im-contract:新增 `PlatformStanding`、`SelfStandingRequest`、`standingFromMemberRole`。
41
+ - @zhin.js/adapter:入站 sender 可带 `platform`;账号管理命令需要聊天角色 `owner`;`EndpointManagement` 新增可选 `inspectSelfStanding`,能力画像新增 `scene.selfStanding`(声明即须实现),`AdapterIndex.selfStanding` / `invalidateSelfStanding` 按会话缓存机器人自身身份。
42
+ - @zhin.js/middleware:入站中间件可声明 `permit`,不满足时跳过该中间件(机器人身份只读缓存)。
43
+ - @zhin.js/tool:定义工具时拒绝已移除的 permit 写法。
44
+ - @zhin.js/ai:注释更新。
45
+ - @zhin.js/console-protocol:`chat-roles.list|grant|revoke`(`iam.manage`);`ConsoleChatRoleSource` 只有 `grant`。
46
+ - @zhin.js/runtime:Host 配置 Schema 删除 `features.selfService.platformAdmins|roles|allowUsers`。
47
+ - @zhin.js/testing:伪造消息与 `PluginTestKit` 用 `sender.chatRole` 声明测试身份。
48
+ - @zhin.js/scaffold-wizard:ICQQ 向导不再写 `master`,完成后提示在 Console 账号「角色」页签或聊天 `角色 授予` 设置 owner。
49
+ - 适配器:配置 Schema 删除 `master` / `trusted`(以及预览版的 `roles`);群管理类工具同时声明发言者条件与机器人条件(如 `platform:admin` + `bot:admin`、`bot-permission:manage_roles`),NapCat / OneBot11 工具不再使用已移除的 `platform(adapter,…)` 写法。
50
+ - 插件:内容审核以 `inbound.bypass`(permit 列表,默认 `owner` 或 `platform:admin`)取代 `masters` / `inbound.bypassMasters`;群管、音乐、日历、地震、B 站、轮盘赌的权限改用 zhin 角色,订阅类命令只认 zhin `admin` / `owner`。
51
+
52
+ - Updated dependencies [53932e5]
53
+ - Updated dependencies [57c6cdc]
54
+ - Updated dependencies [e1fda87]
55
+ - Updated dependencies [a9c7a13]
56
+ - Updated dependencies [120e225]
57
+ - Updated dependencies [63595fc]
58
+ - Updated dependencies [c2bbdcf]
59
+ - Updated dependencies [663473b]
60
+ - Updated dependencies [c606d51]
61
+ - Updated dependencies [5cd9d3d]
62
+ - Updated dependencies [d655ef0]
63
+ - Updated dependencies [1e54b1e]
64
+ - @zhin.js/adapter@1.1.33
65
+ - @zhin.js/core@1.2.0
66
+ - @zhin.js/logger@1.1.3
67
+ - @zhin.js/feature-kit@1.1.16
68
+ - @zhin.js/im-contract@1.1.14
69
+
70
+ ## 0.1.5
71
+
72
+ ### Patch Changes
73
+
74
+ - Updated dependencies [0d76a7c]
75
+ - @zhin.js/adapter@1.1.32
76
+ - @zhin.js/core@1.1.60
77
+
78
+ ## 0.1.4
79
+
80
+ ### Patch Changes
81
+
82
+ - Updated dependencies [8adce16]
83
+ - @zhin.js/core@1.1.59
84
+ - @zhin.js/adapter@1.1.31
85
+ - @zhin.js/feature-kit@1.1.15
86
+
87
+ ## 0.1.3
88
+
89
+ ### Patch Changes
90
+
91
+ - Updated dependencies [008ccad]
92
+ - Updated dependencies [a1f1028]
93
+ - @zhin.js/core@1.1.58
94
+ - @zhin.js/im-contract@1.1.13
95
+ - @zhin.js/adapter@1.1.30
96
+ - @zhin.js/feature-kit@1.1.14
97
+
98
+ ## 0.1.2
99
+
100
+ ### Patch Changes
101
+
102
+ - Updated dependencies [6163abc]
103
+ - Updated dependencies [bc6ccb1]
104
+ - Updated dependencies [72b5a12]
105
+ - @zhin.js/core@1.1.57
106
+ - @zhin.js/im-contract@1.1.12
107
+ - @zhin.js/adapter@1.1.29
108
+ - @zhin.js/feature-kit@1.1.13
109
+
110
+ ## 0.1.1
111
+
112
+ ### Patch Changes
113
+
114
+ - 3bcf636: #1135 Phase 2A-F: new Experimental Douyin live danmaku adapter (unofficial protocol). A lightweight WebSocket client (no browser/CDP) resolves the web_rid to the internal room_id, connects to the webcast push socket (optional external `signerUrl`, no vendored platform script), decodes gzip `PushFrame` → `Response` with a minimal protobuf reader and parses only `WebcastChatMessage`, with heartbeat, ack, watchdog and backoff reconnect. It declares `liveDanmaku`, so danmaku join the ADR 0038 E1 window; the conversation id is the web_rid and `metadata` carries `{ roomId: <internal room_id>, liveDanmaku: true }`. Outbound is listen-only: `sendMode` defaults to `off`, and `direct` returns `not_implemented`. Nothing is written to disk.
115
+ - Updated dependencies [b249e5e]
116
+ - Updated dependencies [57661f6]
117
+ - Updated dependencies [cbd3f14]
118
+ - Updated dependencies [299863a]
119
+ - Updated dependencies [aaa93d7]
120
+ - Updated dependencies [4fe49b5]
121
+ - Updated dependencies [b652db3]
122
+ - Updated dependencies [0315ba0]
123
+ - @zhin.js/core@1.1.56
124
+ - @zhin.js/adapter@1.1.28
125
+ - @zhin.js/im-contract@1.1.11
126
+ - @zhin.js/feature-kit@1.1.12
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 凉菜
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -40,6 +40,12 @@ Zhin.js 抖音直播弹幕适配器(Plugin Runtime):让 Bot 在**你自己
40
40
  3. 可选:自建签名服务地址 `signerUrl`(见下文「签名」)
41
41
  4. Agent 已启用(`ai.agent`):弹幕窗口由 Agent 的 `mailbox.live` 驱动
42
42
 
43
+ ## 安装
44
+
45
+ ```bash
46
+ pnpm add @zhin.js/adapter-douyin-live
47
+ ```
48
+
43
49
  ## 最小配置
44
50
 
45
51
  ```yaml
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhin.js/adapter-douyin-live",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Zhin.js Douyin live danmaku adapter for Plugin Runtime (Experimental; unofficial webcast WebSocket, listen-only by default, one reply per danmaku window)",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -34,16 +34,16 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "ws": "^8.21.1",
37
- "@zhin.js/adapter": "1.1.31",
38
- "@zhin.js/core": "1.1.59",
39
- "@zhin.js/feature-kit": "1.1.15",
40
- "@zhin.js/im-contract": "1.1.13",
41
- "@zhin.js/logger": "1.1.2"
37
+ "@zhin.js/adapter": "1.1.33",
38
+ "@zhin.js/core": "1.2.0",
39
+ "@zhin.js/feature-kit": "1.1.16",
40
+ "@zhin.js/im-contract": "1.1.14",
41
+ "@zhin.js/logger": "1.1.3"
42
42
  },
43
43
  "peerDependencies": {
44
- "@zhin.js/adapter": "^1.1.31",
45
- "@zhin.js/core": "^1.1.59",
46
- "zhin.js": "^1.1.24"
44
+ "@zhin.js/adapter": "^1.1.33",
45
+ "@zhin.js/core": "^1.2.0",
46
+ "zhin.js": "^1.1.26"
47
47
  },
48
48
  "peerDependenciesMeta": {
49
49
  "zhin.js": {
@@ -55,7 +55,7 @@
55
55
  "@types/ws": "^8.18.1",
56
56
  "typescript": "^6.0.3",
57
57
  "vitest": "^4.1.10",
58
- "zhin.js": "1.1.24"
58
+ "zhin.js": "1.1.26"
59
59
  },
60
60
  "files": [
61
61
  "adapters",
@@ -63,7 +63,8 @@
63
63
  "schema.json",
64
64
  "src",
65
65
  "lib",
66
- "README.md"
66
+ "README.md",
67
+ "CHANGELOG.md"
67
68
  ],
68
69
  "publishConfig": {
69
70
  "access": "public",
@@ -89,6 +90,6 @@
89
90
  "scripts": {
90
91
  "build": "tsc",
91
92
  "clean": "rimraf lib",
92
- "test": "NODE_OPTIONS=--experimental-strip-types vitest run --root ../../.. plugins/adapters/douyin-live/tests"
93
+ "test": "vitest run --root ../../.. plugins/adapters/douyin-live/tests"
93
94
  }
94
95
  }
package/schema.json CHANGED
@@ -62,39 +62,6 @@
62
62
  }
63
63
  }
64
64
  },
65
- "master": {
66
- "type": [
67
- "string",
68
- "number"
69
- ],
70
- "description": "框架 master(抖音 user id)。endpoints[i].master 可逐项覆盖",
71
- "x-i18n": {
72
- "en": {
73
- "description": "Framework masters (Douyin user id). endpoints[i].master can override this value."
74
- }
75
- }
76
- },
77
- "trusted": {
78
- "type": "array",
79
- "items": {
80
- "type": [
81
- "string",
82
- "number"
83
- ],
84
- "description": "信任的抖音用户 ID",
85
- "x-i18n": {
86
- "en": {
87
- "description": "Trusted Douyin user ID"
88
- }
89
- }
90
- },
91
- "description": "框架 trusted 用户列表(抖音 user id)",
92
- "x-i18n": {
93
- "en": {
94
- "description": "Framework trusted users (Douyin user id)."
95
- }
96
- }
97
- },
98
65
  "commandPrefix": {
99
66
  "type": "string",
100
67
  "default": "",
@@ -209,39 +176,6 @@
209
176
  }
210
177
  }
211
178
  },
212
- "master": {
213
- "type": [
214
- "string",
215
- "number"
216
- ],
217
- "description": "框架 master(抖音 user id)。endpoints[i].master 可逐项覆盖",
218
- "x-i18n": {
219
- "en": {
220
- "description": "Framework masters (Douyin user id). endpoints[i].master can override this value."
221
- }
222
- }
223
- },
224
- "trusted": {
225
- "type": "array",
226
- "items": {
227
- "type": [
228
- "string",
229
- "number"
230
- ],
231
- "description": "信任的抖音用户 ID",
232
- "x-i18n": {
233
- "en": {
234
- "description": "Trusted Douyin user ID"
235
- }
236
- }
237
- },
238
- "description": "框架 trusted 用户列表(抖音 user id)",
239
- "x-i18n": {
240
- "en": {
241
- "description": "Framework trusted users (Douyin user id)."
242
- }
243
- }
244
- },
245
179
  "commandPrefix": {
246
180
  "type": "string",
247
181
  "default": "",