@zhin.js/adapter-wechat-mp 1.1.20 → 1.1.22

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 CHANGED
@@ -1,5 +1,62 @@
1
1
  # @zhin.js/adapter-wechat-mp
2
2
 
3
+ ## 1.1.22
4
+
5
+ ### Patch Changes
6
+
7
+ - 41ff1a5: ADR 0044 C5: every official adapter now declares a capability `profile` (its `segments` moved into `profile.default.messaging.segments`). icqq declares the complete profile (per conversation kind: scene, all 14 actions with real limits, events, feedback, delivery) and implements the seven new management ports (`pokeUser`, `unmuteGroupMember`, `muteAllGroupMembers`, `setGroupCard`, `setGroupTitle`, `setGroupEssence`, `inviteGroupMember`) with fresh bot-role reads. qq official declares its passive reply windows; undeclared capabilities stay unsupported.
8
+ - cbd3f14: ADR 0044 integration and C6 guard. `delivery.spool` now reproduces the pre-0044 media rule (icqq `false`, every other official adapter `true`). icqq narrows `actions.recall.others` unless the Bot is admin or owner, and declares recall for groups. Endpoint kind capabilities merge the Endpoint's `operations` (Discord reactions keep working; Discord declares reaction feedback). Adapters in the `@zhin.js/` scope are trusted: their custom prompt text is not labelled `external_content`. Core no longer keeps a telegram/discord interactive-policy table (adapters declare `segments.interactive`). New `pnpm check:no-platform-branches` blocks platform-name branches in runtime code.
9
+ - 4fe49b5: 支持配置按需生效:分离保存与有效版本,独立变更先应用,账号资料更新保留连接,模型按回合使用确定版本;Console 返回结构化应用结果。监听改为仅显式 --watch 启用,开发模板显式选择源码和配置监听。
10
+
11
+ 自变更消费配置应用回执,避免已处理配置被二次重载;持久化本次写入修订和应用结果,未知结果或修订冲突时停止自动续作并保留现场,恢复不会覆盖未经本次变更确认的配置。
12
+
13
+ - Updated dependencies [b249e5e]
14
+ - Updated dependencies [57661f6]
15
+ - Updated dependencies [cbd3f14]
16
+ - Updated dependencies [299863a]
17
+ - Updated dependencies [aaa93d7]
18
+ - Updated dependencies [bd524d1]
19
+ - Updated dependencies [126ae99]
20
+ - Updated dependencies [4fe49b5]
21
+ - Updated dependencies [cce07db]
22
+ - Updated dependencies [b652db3]
23
+ - Updated dependencies [0315ba0]
24
+ - @zhin.js/core@1.1.56
25
+ - @zhin.js/adapter@1.1.28
26
+ - @zhin.js/im-contract@1.1.11
27
+ - @zhin.js/skill@1.1.13
28
+ - @zhin.js/host-http@1.1.14
29
+ - @zhin.js/feature-kit@1.1.12
30
+ - @zhin.js/client@1.1.24
31
+ - @zhin.js/page@1.1.14
32
+
33
+ ## 1.1.21
34
+
35
+ ### Patch Changes
36
+
37
+ - af8f803: Use the current Endpoint's platform profile for Agent account identity, with per-field configured fallbacks and scoped, identity-approved profile tools. Keep SOUL first-person and independent of account names. Profile ports preserve the source Client, cancellation, truthful update outcomes and private image authority.
38
+
39
+ Adapter Feature API 2.1 and Tool Feature API 1.1 describe the additive profile requirements; new Core, official adapters and generated plugins declare the corresponding floors. Existing compatible API-2.0/API-1.0 plugins remain accepted by the newer providers. npm releases remain patch.
40
+
41
+ Private IM assets now bind to the full canonical conversation and principal. Existing IM asset records that contain only the earlier lossy hash remain on disk until their original expiry, but cannot be safely rebound; recapture them. No automatic file deletion, platform profile mutation or workspace SOUL rewrite occurs during upgrade.
42
+
43
+ - Updated dependencies [b88e988]
44
+ - Updated dependencies [f78eb84]
45
+ - Updated dependencies [c15cef9]
46
+ - Updated dependencies [b0c02a2]
47
+ - Updated dependencies [af8f803]
48
+ - Updated dependencies [26fda97]
49
+ - Updated dependencies [976886c]
50
+ - Updated dependencies [032dc96]
51
+ - @zhin.js/adapter@1.1.27
52
+ - @zhin.js/client@1.1.23
53
+ - @zhin.js/im-contract@1.1.10
54
+ - @zhin.js/core@1.1.55
55
+ - @zhin.js/page@1.1.13
56
+ - @zhin.js/host-http@1.1.13
57
+ - @zhin.js/feature-kit@1.1.11
58
+ - @zhin.js/skill@1.1.12
59
+
3
60
  ## 1.1.20
4
61
 
5
62
  ### Patch Changes
@@ -10,9 +10,20 @@ export default defineAdapter({
10
10
  capabilities: ['inbound', 'outbound'],
11
11
  // 客服消息媒体统一经 /cgi-bin/media/upload 物化为 media_id(url 下载后上传,
12
12
  // kind=file 的 MediaRef 视为既有 media_id 直传);公众号无卡片交互面,交互段降级纯文本。
13
- segments: {
14
- outboundMedia: ['upload'],
15
- interactive: 'text',
13
+ profile: {
14
+ default: {
15
+ messaging: {
16
+ segments: {
17
+ outboundMedia: ['upload'],
18
+ interactive: 'text',
19
+ },
20
+ },
21
+ delivery: {
22
+ send: true,
23
+ spool: true,
24
+ passiveWindow: { seconds: 172800 },
25
+ },
26
+ },
16
27
  },
17
28
  createAdapter: context => new WeChatMpAdapter(context),
18
29
  });
@@ -15,9 +15,20 @@ export default defineAdapter<WeChatMpEndpointConfig>({
15
15
  capabilities: ['inbound', 'outbound'],
16
16
  // 客服消息媒体统一经 /cgi-bin/media/upload 物化为 media_id(url 下载后上传,
17
17
  // kind=file 的 MediaRef 视为既有 media_id 直传);公众号无卡片交互面,交互段降级纯文本。
18
- segments: {
19
- outboundMedia: ['upload'],
20
- interactive: 'text',
18
+ profile: {
19
+ default: {
20
+ messaging: {
21
+ segments: {
22
+ outboundMedia: ['upload'],
23
+ interactive: 'text',
24
+ },
25
+ },
26
+ delivery: {
27
+ send: true,
28
+ spool: true,
29
+ passiveWindow: { seconds: 172800 },
30
+ },
31
+ },
21
32
  },
22
33
  createAdapter: context => new WeChatMpAdapter(context),
23
34
  });
package/lib/protocol.d.ts CHANGED
@@ -1,8 +1,9 @@
1
+ import type { EndpointProfileConfiguration } from 'zhin.js/adapter';
1
2
  import { type Locale } from 'zhin.js/i18n';
2
3
  import type { IncomingMessage } from 'node:http';
3
4
  import type { ConversationRef } from '@zhin.js/im-contract';
4
5
  /** One endpoint config after AdapterIndex expands `plugins.<instanceKey>.endpoints`. */
5
- export interface WeChatMpEndpointConfig {
6
+ export interface WeChatMpEndpointConfig extends EndpointProfileConfiguration {
6
7
  readonly id: string;
7
8
  readonly appId: string;
8
9
  readonly appSecret: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhin.js/adapter-wechat-mp",
3
- "version": "1.1.20",
3
+ "version": "1.1.22",
4
4
  "type": "module",
5
5
  "description": "Zhin.js WeChat Official Account adapter for Plugin Runtime (HTTP webhook)",
6
6
  "main": "./lib/index.js",
@@ -8,23 +8,23 @@
8
8
  "dependencies": {
9
9
  "axios": "^1.20.0",
10
10
  "xml2js": "^0.6.2",
11
- "@zhin.js/adapter": "1.1.26",
12
- "@zhin.js/client": "1.1.22",
11
+ "@zhin.js/adapter": "1.1.28",
12
+ "@zhin.js/client": "1.1.24",
13
13
  "@zhin.js/console-contract": "1.1.3",
14
- "@zhin.js/core": "1.1.54",
15
- "@zhin.js/feature-kit": "1.1.10",
16
- "@zhin.js/host-http": "1.1.12",
17
- "@zhin.js/im-contract": "1.1.9",
14
+ "@zhin.js/core": "1.1.56",
15
+ "@zhin.js/feature-kit": "1.1.12",
16
+ "@zhin.js/host-http": "1.1.14",
17
+ "@zhin.js/im-contract": "1.1.11",
18
18
  "@zhin.js/logger": "1.1.2",
19
- "@zhin.js/page": "1.1.12",
20
- "@zhin.js/skill": "1.1.11"
19
+ "@zhin.js/page": "1.1.14",
20
+ "@zhin.js/skill": "1.1.13"
21
21
  },
22
22
  "peerDependencies": {
23
- "@zhin.js/adapter": "^1.1.26",
24
- "@zhin.js/command": "^1.1.12",
25
- "@zhin.js/core": "^1.1.54",
26
- "@zhin.js/host-http": "^1.1.12",
27
- "zhin.js": "^1.1.19"
23
+ "@zhin.js/adapter": "^1.1.28",
24
+ "@zhin.js/command": "^1.1.14",
25
+ "@zhin.js/core": "^1.1.56",
26
+ "@zhin.js/host-http": "^1.1.14",
27
+ "zhin.js": "^1.1.21"
28
28
  },
29
29
  "peerDependenciesMeta": {
30
30
  "@zhin.js/command": {
@@ -39,7 +39,7 @@
39
39
  "@types/xml2js": "^0.4.14",
40
40
  "typescript": "^6.0.3",
41
41
  "vitest": "^4.1.10",
42
- "zhin.js": "1.1.19"
42
+ "zhin.js": "1.1.21"
43
43
  },
44
44
  "keywords": [
45
45
  "zhin",
@@ -98,7 +98,7 @@
98
98
  "features": [
99
99
  {
100
100
  "package": "@zhin.js/adapter",
101
- "api": "^2.0.0"
101
+ "api": "^2.1.0"
102
102
  },
103
103
  {
104
104
  "package": "@zhin.js/command",
package/plugin.js CHANGED
@@ -3,6 +3,7 @@ import { definePlugin, pluginConsoleRpcToken } from 'zhin.js';
3
3
  import { createWechatMpConsoleRpc } from "./lib/console.js";
4
4
  export default definePlugin({
5
5
  name: 'wechat-mp',
6
+ configUpdate: { featurePaths: [['nickname'], ['profile'], ['endpoints']] },
6
7
  metadata: {
7
8
  displayName: 'WeChat Official Account Adapter',
8
9
  },
package/schema.json CHANGED
@@ -142,6 +142,27 @@
142
142
  "id": {
143
143
  "type": "string",
144
144
  "description": "WeChat MP bot name"
145
+ },
146
+ "nickname": {
147
+ "type": [
148
+ "string",
149
+ "null"
150
+ ],
151
+ "description": "账号昵称兜底",
152
+ "x-i18n": {
153
+ "en": {
154
+ "description": "Fallback account nickname"
155
+ }
156
+ }
157
+ },
158
+ "profile": {
159
+ "$ref": "#/$defs/selfProfileFallback",
160
+ "description": "账号资料兜底",
161
+ "x-i18n": {
162
+ "en": {
163
+ "description": "Fallback account profile"
164
+ }
165
+ }
145
166
  }
146
167
  },
147
168
  "required": [
@@ -166,9 +187,93 @@
166
187
  "description": "Command prefix. The default empty string allows unprefixed commands; '/' requires a leading slash. Each endpoints[i] can override it."
167
188
  }
168
189
  }
190
+ },
191
+ "nickname": {
192
+ "type": [
193
+ "string",
194
+ "null"
195
+ ],
196
+ "description": "账号昵称兜底",
197
+ "x-i18n": {
198
+ "en": {
199
+ "description": "Fallback account nickname"
200
+ }
201
+ }
202
+ },
203
+ "profile": {
204
+ "$ref": "#/$defs/selfProfileFallback",
205
+ "description": "账号资料兜底",
206
+ "x-i18n": {
207
+ "en": {
208
+ "description": "Fallback account profile"
209
+ }
210
+ }
169
211
  }
170
212
  },
171
213
  "required": [
172
214
  "endpoints"
173
- ]
215
+ ],
216
+ "$defs": {
217
+ "selfProfileFallback": {
218
+ "type": "object",
219
+ "additionalProperties": false,
220
+ "properties": {
221
+ "gender": {
222
+ "type": [
223
+ "string",
224
+ "null"
225
+ ],
226
+ "enum": [
227
+ "male",
228
+ "female",
229
+ "other",
230
+ "unknown",
231
+ null
232
+ ]
233
+ },
234
+ "age": {
235
+ "type": [
236
+ "integer",
237
+ "null"
238
+ ],
239
+ "minimum": 0
240
+ },
241
+ "birthday": {
242
+ "type": [
243
+ "string",
244
+ "null"
245
+ ],
246
+ "pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$"
247
+ },
248
+ "signature": {
249
+ "type": [
250
+ "string",
251
+ "null"
252
+ ]
253
+ },
254
+ "avatar": {
255
+ "type": [
256
+ "string",
257
+ "null"
258
+ ],
259
+ "pattern": "^(https?://[^\\s/?#]+(?:[/?#].*)?|)$"
260
+ },
261
+ "interests": {
262
+ "type": [
263
+ "array",
264
+ "null"
265
+ ],
266
+ "items": {
267
+ "type": "string"
268
+ }
269
+ },
270
+ "bio": {
271
+ "type": [
272
+ "string",
273
+ "null"
274
+ ]
275
+ }
276
+ }
277
+ }
278
+ }
174
279
  }
package/src/protocol.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { EndpointProfileConfiguration } from 'zhin.js/adapter';
1
2
  import { createMessages, type Locale } from 'zhin.js/i18n';
2
3
  /**
3
4
  * WeChat Official Account (MP) protocol helpers — no legacy Adapter/Endpoint.
@@ -10,7 +11,7 @@ import * as xml2js from 'xml2js';
10
11
  import type { ConversationRef } from '@zhin.js/im-contract';
11
12
 
12
13
  /** One endpoint config after AdapterIndex expands `plugins.<instanceKey>.endpoints`. */
13
- export interface WeChatMpEndpointConfig {
14
+ export interface WeChatMpEndpointConfig extends EndpointProfileConfiguration {
14
15
  readonly id: string;
15
16
  readonly appId: string;
16
17
  readonly appSecret: string;