@zhin.js/adapter-weixin-ilink 1.0.0 → 1.1.0
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 +453 -0
- package/README.md +18 -41
- package/adapters/weixin-ilink.js +32 -0
- package/adapters/weixin-ilink.ts +43 -0
- package/commands/endpoint/add/[id].js +3 -0
- package/commands/endpoint/add/[id].ts +3 -0
- package/commands/endpoint/list.js +3 -0
- package/commands/endpoint/list.ts +3 -0
- package/commands/endpoint/remove/[id].js +3 -0
- package/commands/endpoint/remove/[id].ts +3 -0
- package/lib/aes-ecb.d.ts +0 -1
- package/lib/aes-ecb.js +0 -1
- package/lib/cdn-upload.d.ts +0 -1
- package/lib/cdn-upload.js +0 -1
- package/lib/cdn-url.d.ts +0 -1
- package/lib/cdn-url.js +0 -1
- package/lib/client.d.ts +34 -0
- package/lib/client.js +72 -0
- package/lib/context-store.d.ts +1 -2
- package/lib/context-store.js +1 -2
- package/lib/credentials.d.ts +6 -7
- package/lib/credentials.js +12 -13
- package/lib/endpoint.d.ts +37 -0
- package/lib/endpoint.js +418 -0
- package/lib/ilink-api.d.ts +1 -1
- package/lib/ilink-api.js +5 -2
- package/lib/ilink-config-cache.d.ts +0 -1
- package/lib/ilink-config-cache.js +0 -1
- package/lib/ilink-logger.d.ts +0 -1
- package/lib/ilink-logger.js +0 -1
- package/lib/ilink-meta.d.ts +0 -1
- package/lib/ilink-meta.js +0 -1
- package/lib/ilink-random.d.ts +0 -1
- package/lib/ilink-random.js +0 -1
- package/lib/ilink-redact.d.ts +0 -1
- package/lib/ilink-redact.js +0 -1
- package/lib/ilink-session-guard.d.ts +0 -1
- package/lib/ilink-session-guard.js +0 -1
- package/lib/ilink-types.d.ts +0 -1
- package/lib/ilink-types.js +0 -1
- package/lib/index.d.ts +5 -20
- package/lib/index.js +3 -38
- package/lib/login.d.ts +4 -6
- package/lib/login.js +73 -68
- package/lib/media-download.d.ts +1 -2
- package/lib/media-download.js +1 -2
- package/lib/mime.d.ts +0 -1
- package/lib/mime.js +0 -1
- package/lib/outbound-media.d.ts +4 -5
- package/lib/outbound-media.js +85 -86
- package/lib/pic-decrypt.d.ts +0 -1
- package/lib/pic-decrypt.js +0 -1
- package/lib/protocol.d.ts +63 -0
- package/lib/protocol.js +127 -0
- package/lib/silk-transcode.d.ts +0 -1
- package/lib/silk-transcode.js +0 -1
- package/lib/types.d.ts +2 -26
- package/lib/types.js +0 -1
- package/lib/upload.d.ts +1 -2
- package/lib/upload.js +1 -2
- package/lib/weixin-ilink-endpoint-commands.d.ts +1 -0
- package/lib/weixin-ilink-endpoint-commands.js +16 -0
- package/lib/weixin-ilink-runtime-state.d.ts +1 -0
- package/lib/weixin-ilink-runtime-state.js +6 -0
- package/lib/weixin-inbound.d.ts +10 -3
- package/lib/weixin-inbound.js +46 -23
- package/lib/weixin-send-media.d.ts +0 -1
- package/lib/weixin-send-media.js +0 -1
- package/lib/weixin-send.d.ts +1 -2
- package/lib/weixin-send.js +2 -3
- package/package.json +48 -35
- package/plugin.js +14 -0
- package/schema.json +88 -0
- package/src/client.ts +85 -0
- package/src/context-store.ts +2 -0
- package/src/credentials.ts +12 -12
- package/src/endpoint.ts +531 -0
- package/src/ilink-api.ts +5 -1
- package/src/index.ts +28 -56
- package/src/login.ts +89 -75
- package/src/media-download.ts +1 -2
- package/src/outbound-media.ts +97 -97
- package/src/protocol.ts +189 -0
- package/src/silk-wasm.d.ts +6 -2
- package/src/types.ts +6 -25
- package/src/upload.ts +2 -2
- package/src/weixin-ilink-endpoint-commands.ts +17 -0
- package/src/weixin-ilink-runtime-state.ts +7 -0
- package/src/weixin-inbound.ts +48 -18
- package/src/weixin-send.ts +4 -4
- package/client/LoginAssistPanel.tsx +0 -200
- package/client/WeixinIlinkManagement.tsx +0 -139
- package/client/index.tsx +0 -11
- package/client/tsconfig.json +0 -13
- package/client/utils/api.ts +0 -30
- package/dist/index.js +0 -29
- package/lib/adapter.d.ts +0 -11
- package/lib/adapter.d.ts.map +0 -1
- package/lib/adapter.js +0 -14
- package/lib/adapter.js.map +0 -1
- package/lib/aes-ecb.d.ts.map +0 -1
- package/lib/aes-ecb.js.map +0 -1
- package/lib/bot.d.ts +0 -37
- package/lib/bot.d.ts.map +0 -1
- package/lib/bot.js +0 -383
- package/lib/bot.js.map +0 -1
- package/lib/cdn-upload.d.ts.map +0 -1
- package/lib/cdn-upload.js.map +0 -1
- package/lib/cdn-upload.test.d.ts +0 -2
- package/lib/cdn-upload.test.d.ts.map +0 -1
- package/lib/cdn-upload.test.js +0 -150
- package/lib/cdn-upload.test.js.map +0 -1
- package/lib/cdn-url.d.ts.map +0 -1
- package/lib/cdn-url.js.map +0 -1
- package/lib/context-store.d.ts.map +0 -1
- package/lib/context-store.js.map +0 -1
- package/lib/credentials.d.ts.map +0 -1
- package/lib/credentials.js.map +0 -1
- package/lib/ilink-api.d.ts.map +0 -1
- package/lib/ilink-api.js.map +0 -1
- package/lib/ilink-config-cache.d.ts.map +0 -1
- package/lib/ilink-config-cache.js.map +0 -1
- package/lib/ilink-logger.d.ts.map +0 -1
- package/lib/ilink-logger.js.map +0 -1
- package/lib/ilink-meta.d.ts.map +0 -1
- package/lib/ilink-meta.js.map +0 -1
- package/lib/ilink-random.d.ts.map +0 -1
- package/lib/ilink-random.js.map +0 -1
- package/lib/ilink-redact.d.ts.map +0 -1
- package/lib/ilink-redact.js.map +0 -1
- package/lib/ilink-session-guard.d.ts.map +0 -1
- package/lib/ilink-session-guard.js.map +0 -1
- package/lib/ilink-types.d.ts.map +0 -1
- package/lib/ilink-types.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/login-assist-routes.d.ts +0 -7
- package/lib/login-assist-routes.d.ts.map +0 -1
- package/lib/login-assist-routes.js +0 -29
- package/lib/login-assist-routes.js.map +0 -1
- package/lib/login.d.ts.map +0 -1
- package/lib/login.js.map +0 -1
- package/lib/media-download.d.ts.map +0 -1
- package/lib/media-download.js.map +0 -1
- package/lib/mime.d.ts.map +0 -1
- package/lib/mime.js.map +0 -1
- package/lib/mime.test.d.ts +0 -2
- package/lib/mime.test.d.ts.map +0 -1
- package/lib/mime.test.js +0 -62
- package/lib/mime.test.js.map +0 -1
- package/lib/outbound-media.d.ts.map +0 -1
- package/lib/outbound-media.js.map +0 -1
- package/lib/pic-decrypt.d.ts.map +0 -1
- package/lib/pic-decrypt.js.map +0 -1
- package/lib/routes.d.ts +0 -8
- package/lib/routes.d.ts.map +0 -1
- package/lib/routes.js +0 -29
- package/lib/routes.js.map +0 -1
- package/lib/silk-transcode.d.ts.map +0 -1
- package/lib/silk-transcode.js.map +0 -1
- package/lib/silk-transcode.test.d.ts +0 -2
- package/lib/silk-transcode.test.d.ts.map +0 -1
- package/lib/silk-transcode.test.js +0 -53
- package/lib/silk-transcode.test.js.map +0 -1
- package/lib/types.d.ts.map +0 -1
- package/lib/types.js.map +0 -1
- package/lib/typing-indicator.d.ts +0 -32
- package/lib/typing-indicator.d.ts.map +0 -1
- package/lib/typing-indicator.js +0 -95
- package/lib/typing-indicator.js.map +0 -1
- package/lib/upload.d.ts.map +0 -1
- package/lib/upload.js.map +0 -1
- package/lib/upload.test.d.ts +0 -2
- package/lib/upload.test.d.ts.map +0 -1
- package/lib/upload.test.js +0 -250
- package/lib/upload.test.js.map +0 -1
- package/lib/weixin-inbound.d.ts.map +0 -1
- package/lib/weixin-inbound.js.map +0 -1
- package/lib/weixin-send-media.d.ts.map +0 -1
- package/lib/weixin-send-media.js.map +0 -1
- package/lib/weixin-send.d.ts.map +0 -1
- package/lib/weixin-send.js.map +0 -1
- package/src/adapter.ts +0 -16
- package/src/bot.ts +0 -483
- package/src/login-assist-routes.ts +0 -36
- package/src/routes.ts +0 -39
- package/src/typing-indicator.ts +0 -139
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,458 @@
|
|
|
1
1
|
# @zhin.js/adapter-weixin-ilink
|
|
2
2
|
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 1fc6270: Reset all 88 published official packages onto the owner-governed 1.1.x stable line. Packages whose historical 1.1.0 version is still available publish as 1.1.0; packages where npm permanently reserves that version use the next available 1.1.x patch. Historical higher version lines remain installable but are superseded, and routine releases after this reset are patch-only.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- a34bf91: Publish internal peer dependencies as compatible caret ranges instead of exact versions, preventing compatible internal minor releases from forcing unrelated major bumps.
|
|
12
|
+
- Updated dependencies [1fc6270]
|
|
13
|
+
- @zhin.js/adapter@1.1.12
|
|
14
|
+
- @zhin.js/core@1.1.35
|
|
15
|
+
- @zhin.js/feature-kit@1.1.0
|
|
16
|
+
- @zhin.js/im-contract@1.1.0
|
|
17
|
+
- @zhin.js/logger@1.1.0
|
|
18
|
+
|
|
19
|
+
## 7.0.1
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [f7ee28d]
|
|
24
|
+
- @zhin.js/adapter@1.2.2
|
|
25
|
+
- @zhin.js/core@1.5.16
|
|
26
|
+
- zhin.js@7.0.1
|
|
27
|
+
|
|
28
|
+
## 7.0.0
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- zhin.js@7.0.0
|
|
33
|
+
|
|
34
|
+
## 6.0.2
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- Updated dependencies [ba7e17a]
|
|
39
|
+
- Updated dependencies [7108d0b]
|
|
40
|
+
- @zhin.js/core@1.5.15
|
|
41
|
+
- zhin.js@6.0.15
|
|
42
|
+
|
|
43
|
+
## 6.0.1
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- 1fc78bc: Unify native platform Client access behind the literal `adapter` discriminant. Handlers infer both native events and Clients, while command, inbound/outbound middleware, and both Agent tool authoring surfaces expose the exact operation-scoped Client through a lazy `$client` getter. Definitions without `adapter` keep `$client` typed as `unknown`, and runtime dispatch rejects adapter mismatches before resolving the Client. Bundled platform tools now use this single path instead of model-provided endpoint ids and adapter-specific dependency wrappers. Every adapter registers one Client/EventMap contract, and protocol adapters including NapCat, Milky, OneBot and Satori now produce transport-independent Client objects rather than letting Endpoint instances impersonate Clients.
|
|
48
|
+
- Updated dependencies [4e8117c]
|
|
49
|
+
- Updated dependencies [54bfd6b]
|
|
50
|
+
- Updated dependencies [12025ee]
|
|
51
|
+
- Updated dependencies [09b14d6]
|
|
52
|
+
- Updated dependencies [1fc78bc]
|
|
53
|
+
- @zhin.js/adapter@1.2.1
|
|
54
|
+
- @zhin.js/core@1.5.14
|
|
55
|
+
- @zhin.js/command@1.0.16
|
|
56
|
+
- @zhin.js/logger@1.0.77
|
|
57
|
+
- zhin.js@6.0.14
|
|
58
|
+
- @zhin.js/feature-kit@1.0.13
|
|
59
|
+
|
|
60
|
+
## 6.0.0
|
|
61
|
+
|
|
62
|
+
### Patch Changes
|
|
63
|
+
|
|
64
|
+
- f2c532f: Expose exact per-Endpoint message operations through one validated Adapter capability model, route Core control calls through declared active capabilities, and connect existing recall, edit, reaction, and typing implementations across platform adapters.
|
|
65
|
+
- Updated dependencies [f2c532f]
|
|
66
|
+
- @zhin.js/adapter@1.2.0
|
|
67
|
+
- @zhin.js/core@1.5.13
|
|
68
|
+
- zhin.js@6.0.13
|
|
69
|
+
|
|
70
|
+
## 5.0.13
|
|
71
|
+
|
|
72
|
+
### Patch Changes
|
|
73
|
+
|
|
74
|
+
- 5969c5b: Add SideEventGateway so adapters forward notice/request/system into HandlerIndex. HandlerContext now exposes only generation-safe capabilities and prompt ports; live Endpoint escape hatches are removed.
|
|
75
|
+
- 3b3ec03: Emit canonical reply and media segments instead of eager quote text and media placeholders.
|
|
76
|
+
- Updated dependencies [5969c5b]
|
|
77
|
+
- Updated dependencies [5969c5b]
|
|
78
|
+
- Updated dependencies [5969c5b]
|
|
79
|
+
- Updated dependencies [974772e]
|
|
80
|
+
- Updated dependencies [5969c5b]
|
|
81
|
+
- Updated dependencies [2f786bd]
|
|
82
|
+
- Updated dependencies [1312ca0]
|
|
83
|
+
- @zhin.js/im-contract@1.0.4
|
|
84
|
+
- @zhin.js/core@1.5.12
|
|
85
|
+
- @zhin.js/adapter@1.1.11
|
|
86
|
+
- @zhin.js/command@1.0.15
|
|
87
|
+
- zhin.js@6.0.12
|
|
88
|
+
|
|
89
|
+
## 5.0.12
|
|
90
|
+
|
|
91
|
+
### Patch Changes
|
|
92
|
+
|
|
93
|
+
- @zhin.js/core@1.5.11
|
|
94
|
+
- zhin.js@6.0.11
|
|
95
|
+
|
|
96
|
+
## 5.0.11
|
|
97
|
+
|
|
98
|
+
### Patch Changes
|
|
99
|
+
|
|
100
|
+
- 3556601: Declare Stable Feature packages referenced by `zhin.features` as optional `peerDependencies` on official plugins/adapters (`@zhin.js/runtime` ≥1.0.12 requires features to be declared in deps/peers). Keeps authoring via `zhin.js` facades without installing Feature implementation packages into `dependencies`, and removes the need for consumer postinstall peer-patch scripts. `zhin new` scaffolds the same peer shape.
|
|
101
|
+
- @zhin.js/core@1.5.10
|
|
102
|
+
- zhin.js@6.0.10
|
|
103
|
+
|
|
104
|
+
## 5.0.10
|
|
105
|
+
|
|
106
|
+
### Patch Changes
|
|
107
|
+
|
|
108
|
+
- eb84b77: fix: 更新文档,建立正确的依赖关系
|
|
109
|
+
- Updated dependencies [d3920e9]
|
|
110
|
+
- @zhin.js/core@1.5.10
|
|
111
|
+
- zhin.js@6.0.10
|
|
112
|
+
- @zhin.js/adapter@1.1.10
|
|
113
|
+
|
|
114
|
+
## 5.0.9
|
|
115
|
+
|
|
116
|
+
### Patch Changes
|
|
117
|
+
|
|
118
|
+
- Updated dependencies [e4757a8]
|
|
119
|
+
- Updated dependencies [c3c0ebf]
|
|
120
|
+
- @zhin.js/command@1.0.13
|
|
121
|
+
- @zhin.js/core@1.5.9
|
|
122
|
+
- @zhin.js/adapter@1.1.9
|
|
123
|
+
- zhin.js@6.0.9
|
|
124
|
+
|
|
125
|
+
## 5.0.8
|
|
126
|
+
|
|
127
|
+
### Patch Changes
|
|
128
|
+
|
|
129
|
+
- Updated dependencies [63253bb]
|
|
130
|
+
- Updated dependencies [8e973dc]
|
|
131
|
+
- Updated dependencies [953cfe1]
|
|
132
|
+
- Updated dependencies [0e73866]
|
|
133
|
+
- @zhin.js/plugin-runtime@1.1.6
|
|
134
|
+
- @zhin.js/core@1.5.8
|
|
135
|
+
- @zhin.js/adapter@1.1.8
|
|
136
|
+
- zhin.js@6.0.8
|
|
137
|
+
- @zhin.js/command@1.0.12
|
|
138
|
+
|
|
139
|
+
## 5.0.7
|
|
140
|
+
|
|
141
|
+
### Patch Changes
|
|
142
|
+
|
|
143
|
+
- Updated dependencies [36cb1ca]
|
|
144
|
+
- @zhin.js/core@1.5.7
|
|
145
|
+
- zhin.js@6.0.7
|
|
146
|
+
|
|
147
|
+
## 5.0.6
|
|
148
|
+
|
|
149
|
+
### Patch Changes
|
|
150
|
+
|
|
151
|
+
- Updated dependencies [7945544]
|
|
152
|
+
- @zhin.js/command@1.0.11
|
|
153
|
+
- @zhin.js/adapter@1.1.7
|
|
154
|
+
- @zhin.js/core@1.5.6
|
|
155
|
+
- zhin.js@6.0.6
|
|
156
|
+
|
|
157
|
+
## 5.0.5
|
|
158
|
+
|
|
159
|
+
### Patch Changes
|
|
160
|
+
|
|
161
|
+
- Updated dependencies [2d0a622]
|
|
162
|
+
- @zhin.js/command@1.0.10
|
|
163
|
+
- @zhin.js/adapter@1.1.7
|
|
164
|
+
- @zhin.js/core@1.5.5
|
|
165
|
+
- zhin.js@6.0.5
|
|
166
|
+
|
|
167
|
+
## 5.0.4
|
|
168
|
+
|
|
169
|
+
### Patch Changes
|
|
170
|
+
|
|
171
|
+
- Updated dependencies [c106ecc]
|
|
172
|
+
- Updated dependencies [ca92e03]
|
|
173
|
+
- Updated dependencies [b0f37ae]
|
|
174
|
+
- Updated dependencies [ba08a2f]
|
|
175
|
+
- Updated dependencies [daffd4c]
|
|
176
|
+
- Updated dependencies [36c7400]
|
|
177
|
+
- Updated dependencies [162fa34]
|
|
178
|
+
- Updated dependencies [e40b048]
|
|
179
|
+
- Updated dependencies [f1708c3]
|
|
180
|
+
- Updated dependencies [e53444f]
|
|
181
|
+
- Updated dependencies [92b0dd7]
|
|
182
|
+
- Updated dependencies [a7df753]
|
|
183
|
+
- @zhin.js/im-contract@1.0.3
|
|
184
|
+
- @zhin.js/adapter@1.1.7
|
|
185
|
+
- @zhin.js/plugin-runtime@1.1.5
|
|
186
|
+
- @zhin.js/command@1.0.9
|
|
187
|
+
- @zhin.js/core@1.5.4
|
|
188
|
+
- zhin.js@6.0.4
|
|
189
|
+
|
|
190
|
+
## 5.0.3
|
|
191
|
+
|
|
192
|
+
### Patch Changes
|
|
193
|
+
|
|
194
|
+
- f8c7a54: fix: im
|
|
195
|
+
- Updated dependencies [f8c7a54]
|
|
196
|
+
- @zhin.js/logger@1.0.76
|
|
197
|
+
- @zhin.js/adapter@1.1.6
|
|
198
|
+
- @zhin.js/command@1.0.8
|
|
199
|
+
- @zhin.js/core@1.5.3
|
|
200
|
+
- @zhin.js/im-contract@1.0.2
|
|
201
|
+
- @zhin.js/plugin-runtime@1.1.4
|
|
202
|
+
- zhin.js@6.0.3
|
|
203
|
+
|
|
204
|
+
## 5.0.2
|
|
205
|
+
|
|
206
|
+
### Patch Changes
|
|
207
|
+
|
|
208
|
+
- Updated dependencies [afc0e66]
|
|
209
|
+
- Updated dependencies [2e41ad5]
|
|
210
|
+
- Updated dependencies [9f57124]
|
|
211
|
+
- @zhin.js/core@1.5.2
|
|
212
|
+
- @zhin.js/adapter@1.1.5
|
|
213
|
+
- @zhin.js/im-contract@1.0.1
|
|
214
|
+
- @zhin.js/plugin-runtime@1.1.3
|
|
215
|
+
- @zhin.js/command@1.0.7
|
|
216
|
+
- zhin.js@6.0.2
|
|
217
|
+
|
|
218
|
+
## 5.0.1
|
|
219
|
+
|
|
220
|
+
### Patch Changes
|
|
221
|
+
|
|
222
|
+
- Updated dependencies [c8f4d45]
|
|
223
|
+
- @zhin.js/plugin-runtime@1.1.2
|
|
224
|
+
- @zhin.js/adapter@1.1.4
|
|
225
|
+
- @zhin.js/command@1.0.6
|
|
226
|
+
- @zhin.js/core@1.5.1
|
|
227
|
+
- zhin.js@6.0.1
|
|
228
|
+
|
|
229
|
+
## 5.0.0
|
|
230
|
+
|
|
231
|
+
### Patch Changes
|
|
232
|
+
|
|
233
|
+
- 4fbff5d: feat!: 多模态双向 Segment 一贯制(BREAKING,无兼容层)
|
|
234
|
+
|
|
235
|
+
全框架唯一媒体表达统一为 canonical `Segment` + `MediaRef{kind: url|path|base64|file, value, mime_type?, file_name?, size?}`,新增 audio/video/file 段类型;所有第二形状(legacy `data.url/file/base64` 字段、`mediaRefFromLegacyData`/`mediaRefToLegacyFields` 桥、双写)全部删除。
|
|
236
|
+
|
|
237
|
+
- **core**:`SendContent` 一等支持 `Segment[]`;endpoint 出站载荷只含 canonical 段;`resolveOutboundMediaPolicy` 改为纯声明驱动(adapter definition `segments.outboundMedia`),内置策略表删除,未声明回退 `url-or-text`;`ImageContent` 旧桥删除。
|
|
238
|
+
- **ai**:新增 `MediaContentBlock`/`MediaBlockRef`(Segment 同构)与 `UserMessage.media`(当前 turn 媒体,**不持久化**——存储层自动剥离);`createUserMessage(text, media?)` 签名变更(`ImageContent` 删除);provider 边界序列化器 `filterMediaBlocksForProvider` + 能力表(缺省 image-only,不支持类型降级占位文本);ai-sdk 桥媒体块 → SDK image/file parts。
|
|
239
|
+
- **agent**:入站 turn 注入(`turn/inbound-media.ts`)——commMessage 媒体段 → 当前 turn `UserMessage.media`;图片 path 物化、音频默认 STT(`@zhin.js/speech` 可选,失败降级占位)、视频/文件占位;`publishOutboundElements` 产出 canonical Segment;`transcribeAudioPayload` 导出。
|
|
240
|
+
- **cli**:`bridgeRuntimeMessage` 回复链路媒体段透传,不再压平为文本(`$reply` 直达 normalize → adapter)。
|
|
241
|
+
- **全部 20 个平台适配器**:出站媒体只消费 `data.media`(url 直发 / base64 直发 / 平台上传 / 读盘),入站媒体产出 canonical `data.media`;`segments.outboundMedia` 声明与实际消费逐一核对修正;QQ 入站新增 canonical segments(image/audio/video/file/mention/face/reply),图片/语音/视频不再丢失。
|
|
242
|
+
|
|
243
|
+
迁移:适配器/插件产媒体一律用 `{ type, data: { media: MediaRef } }`;发送 legacy `data.url/file/base64` 形状的段会被 warn 丢弃。
|
|
244
|
+
|
|
245
|
+
- Updated dependencies [7c1e63a]
|
|
246
|
+
- Updated dependencies [4fbff5d]
|
|
247
|
+
- Updated dependencies [5b94d9c]
|
|
248
|
+
- @zhin.js/command@1.0.5
|
|
249
|
+
- @zhin.js/adapter@1.1.3
|
|
250
|
+
- @zhin.js/core@1.5.0
|
|
251
|
+
- zhin.js@6.0.0
|
|
252
|
+
|
|
253
|
+
## 4.0.3
|
|
254
|
+
|
|
255
|
+
### Patch Changes
|
|
256
|
+
|
|
257
|
+
- Updated dependencies [45b3256]
|
|
258
|
+
- @zhin.js/core@1.4.3
|
|
259
|
+
- zhin.js@5.0.3
|
|
260
|
+
|
|
261
|
+
## 4.0.2
|
|
262
|
+
|
|
263
|
+
### Patch Changes
|
|
264
|
+
|
|
265
|
+
- d5cd4aa: Publish Plugin Runtime entry points and convention modules as JavaScript so
|
|
266
|
+
installed npm plugins load on Node without TypeScript stripping. Workspace
|
|
267
|
+
development continues to prefer TypeScript sources for local HMR.
|
|
268
|
+
|
|
269
|
+
Remove the unconsumed legacy game hub APIs from game-kit; game navigation and
|
|
270
|
+
records now use ordinary convention commands owned by the game hub plugin.
|
|
271
|
+
|
|
272
|
+
- Updated dependencies [d5cd4aa]
|
|
273
|
+
- @zhin.js/command@1.0.4
|
|
274
|
+
- zhin.js@5.0.2
|
|
275
|
+
- @zhin.js/adapter@1.1.2
|
|
276
|
+
- @zhin.js/core@1.4.2
|
|
277
|
+
|
|
278
|
+
## 4.0.1
|
|
279
|
+
|
|
280
|
+
### Patch Changes
|
|
281
|
+
|
|
282
|
+
- 5691aba: 第二轮全量审计修复批(8 面 ~60 bug):
|
|
283
|
+
|
|
284
|
+
- **安全**:email 附件路径穿越修复(basename + downloadPath 约束);lark/telegram/satori webhook 鉴权(缺密钥告警、timingSafeEqual、±5min 时效窗、chat_type 修正);onebot wss/webhook 缺 token 告警;qq webhook 改原始字节验签;renderJsx/JSX 转义注入修复;console runtime token 401 死循环。
|
|
285
|
+
- **P0 功能**:sandbox 多 endpoint 解析 + WS 路径隔离;short-url expand(undici opaqueredirect)改 follow;AI 压缩摘要失败不再静默丢历史(熔断恢复生效);console-ui 实时推送事件名归一化 + IndexedDB schema 对齐;process-monitor 热重载不再误判崩溃。
|
|
286
|
+
- **生命周期**:email IMAP 断线重连 + 在飞锁;onebot11/12 start 失败清理;line replyToken TTL + push 兜底;wechat-mp token 过期重试 + MsgId 去重;weixin-ilink buf 推进/防抖写盘/媒体 TTL/QR abort;satori PONG 看门狗;退避自毁修复。
|
|
287
|
+
- **游戏**:text-adventure 终局 restart 复活 + requires 服务端校验;tic-tac-toe PvP 占用/restart/队列清理/TTL;idiom-chain/word-riddle 闲聊不扣失误;别名中间件不劫持普通聊天。
|
|
288
|
+
- **共享库**:schema falsy 默认值/date/tuple/union 修复;database parseCondition Date/未知操作符、sqlite TEXT 往返、query 分派、belongsToMany 方言、migration dry-run;schedule DST 回拨死循环、重复 id 去重、flush 串行化;game-kit fallback 编号/onboarding 提示/尾缀边界/活引用拷贝。
|
|
289
|
+
- **渲染语音**:fetch 全部超时 + 渲染并发闸;sanitizeHtml form 保文本;STT 扩展名映射 + 删临时文件;TTS 未知 provider 报错;emojiCache LRU 负缓存/fontCache style/clearFonts 恢复;register 错误分类收窄。
|
|
290
|
+
|
|
291
|
+
- 74b035c: endpoint 管理命令扩展至 18/20 适配器:kook / discord / github(private_key 支持内联文件路径)/ icqq(bindFlow 登记式 add + `icqq login` 引导)/ dingtalk / lark / line / satori / wechat-mp / wecom / weixin-ilink 接入 `endpoint list/add/remove`(字段对齐各自 schema,凭据写 `.env`)。email(smtp/imap 嵌套对象)与 sandbox(无凭据)暂不接。
|
|
292
|
+
- 09d4f25: Console 社交读取面(management 语义端口)多平台落地:napcat/onebot11/onebot12/milky(好友+群+群成员,OneBot 标准动作);discord/kook/satori(guild+频道+成员,分页聚合,id 保精度留字符串);slack(workspace 成员+public channels+conversations.members);line(群/room 成员分页+profile 回退);wechat-mp(followers openid);weixin-ilink(context_token 对端推导);lark(chats+members 全分页)。`EndpointFriend.user_id`/`EndpointGroup.group_id` 放宽为 `number | string`(雪花 id 不丢精度)。telegram/wecom/dingtalk/github/email/sandbox 注明平台无列表面暂不接。
|
|
293
|
+
- Updated dependencies [cdf64e7]
|
|
294
|
+
- Updated dependencies [5691aba]
|
|
295
|
+
- Updated dependencies [078e3f7]
|
|
296
|
+
- Updated dependencies [50497a5]
|
|
297
|
+
- Updated dependencies [9c997b2]
|
|
298
|
+
- Updated dependencies [09d4f25]
|
|
299
|
+
- Updated dependencies [43485a9]
|
|
300
|
+
- Updated dependencies [f0ec5ab]
|
|
301
|
+
- Updated dependencies [3e925d0]
|
|
302
|
+
- Updated dependencies [fa66c4c]
|
|
303
|
+
- Updated dependencies [fa66c4c]
|
|
304
|
+
- Updated dependencies [6cb6152]
|
|
305
|
+
- @zhin.js/command@1.0.3
|
|
306
|
+
- @zhin.js/plugin-runtime@1.1.1
|
|
307
|
+
- zhin.js@5.0.1
|
|
308
|
+
- @zhin.js/adapter@1.1.1
|
|
309
|
+
- @zhin.js/core@1.4.1
|
|
310
|
+
|
|
311
|
+
## 4.0.0
|
|
312
|
+
|
|
313
|
+
### Patch Changes
|
|
314
|
+
|
|
315
|
+
- 7db69c1: 命令前缀改为适配器配置项:`MessageDispatcher` 不再硬编码 `/`,默认按消息所属适配器实例 config 的 `commandPrefix` 解析(默认 `''` 无前缀,任意文本按命令匹配),`endpoints[i].commandPrefix` 逐项覆盖;`ImRuntime({ commandPrefix })` 仍可设全局静态前缀。全部 20 个平台适配器 schema 新增 `commandPrefix` 属性。
|
|
316
|
+
|
|
317
|
+
BREAKING(行为变化):未配置时命令不再需要 `/` 前缀——原 `/zt` 写法不再命中,直接发 `zt` 即可;需要斜杠风格的适配器请在配置里显式设 `commandPrefix: '/'`。
|
|
318
|
+
|
|
319
|
+
- 713445c: 适配器配置格式定稿(不兼容旧格式):`plugins.<adapter>` 顶层仅共享字段 + `commandPrefix`,`endpoints[i]` 携带 endpoint 级字段(`name` + 凭据,各 schema 已类型化),`endpoints` 为必填(icqq 另需顶层 `master`);icqq 新增 `trusted` 列表(顶层/逐项均可)。scaffold-wizard 全部字段式与自定义 configure() 产出改为新格式,examples(full-bot / qq-games-bot)与 20 个适配器 README 同步迁移。
|
|
320
|
+
- Updated dependencies [7db69c1]
|
|
321
|
+
- Updated dependencies [e5c84ed]
|
|
322
|
+
- Updated dependencies [3ea84a0]
|
|
323
|
+
- Updated dependencies [1ddcd70]
|
|
324
|
+
- Updated dependencies [ac9da66]
|
|
325
|
+
- @zhin.js/core@1.4.0
|
|
326
|
+
- @zhin.js/adapter@1.1.0
|
|
327
|
+
- @zhin.js/plugin-runtime@1.1.0
|
|
328
|
+
- zhin.js@5.0.0
|
|
329
|
+
|
|
330
|
+
## 3.0.3
|
|
331
|
+
|
|
332
|
+
### Patch Changes
|
|
333
|
+
|
|
334
|
+
- cc5c94d: 约定式插件运行时迁移(breaking):插件与适配器由 `usePlugin()` / `extends Adapter` 迁移为 `definePlugin` / `defineAdapter` + `plugin.ts` + 约定目录(`adapters/`、`commands/`、`components/`、`tools/` 等)。
|
|
335
|
+
|
|
336
|
+
- 新增约定式运行时包:`@zhin.js/plugin-runtime`、`@zhin.js/adapter`、`@zhin.js/runtime`、`@zhin.js/host-http`(首版 1.0.0 走 init-publish,不在本 changeset 内 bump)。
|
|
337
|
+
- 全部 20 个平台适配器改为约定式 `defineAdapter`,旧 `usePlugin` / `extends Adapter` / `segment-mapper` 生产入口已删除;onebot11 反向 WSS、onebot12 webhook/wss、milky sse/webhook/wss、satori webhook、kook webhook、qq webhook/middleware 等 slice 1 推迟的连接模式已补齐。
|
|
338
|
+
- 游戏 / 工具 / 服务插件同步迁移到约定目录结构。
|
|
339
|
+
- CLI 增加 plugin-runtime host installer(http/database/outbound/schedule/console 等)。
|
|
340
|
+
|
|
341
|
+
后续加固(同批):
|
|
342
|
+
|
|
343
|
+
- CLI:`zhin runtime start --daemon`(pidfile/崩溃拉起/风暴保护),orphan watchdog 防僵尸进程;legacy `zhin dev` / `zhin start` 已移除(含 `zhin restart`),`zhin stop` 兼容新 daemon。
|
|
344
|
+
- 安全:builtin 工具统一走 `security/policy-facade.ts` 的 `runToolPolicies`(声明式策略表,deny 优先);审计日志 close flush + 背压队列;`splitCompoundCommand` 引号感知、`extractCommandName` 去引号堵绕过。
|
|
345
|
+
- 日志:Logger 双堆栈修复、本地时区、`getLogger` 挂树(`setLevel` 递归生效)、第三方库(log4js/discord)桥接、启动人读总结。
|
|
346
|
+
- 结构:`plugins/games/shared` 迁为 `packages/game-kit`(`@zhin.js/game-kit`);死目录 `plugins/adapters/common` 删除。
|
|
347
|
+
- 脚手架:`create-zhin-app` / `zhin new` / scaffold-wizard 生成物改为 Plugin Runtime 形态(minimal-bot 同构,新配置格式)。
|
|
348
|
+
- Console:endpoint.list 真实名称与 phase、schema:get-all 按 instanceKey 映射、db:\* 接 DatabaseHost。
|
|
349
|
+
|
|
350
|
+
注:按仓库发布惯例(见 1bb345dd2),本次 breaking 迁移统一使用 patch,避免 zhin.js 5.0 级联。
|
|
351
|
+
|
|
352
|
+
- Updated dependencies [16ec4e8]
|
|
353
|
+
- Updated dependencies [cc5c94d]
|
|
354
|
+
- Updated dependencies [447f3e2]
|
|
355
|
+
- @zhin.js/core@1.3.5
|
|
356
|
+
- zhin.js@4.1.3
|
|
357
|
+
- @zhin.js/logger@1.0.75
|
|
358
|
+
- @zhin.js/plugin-runtime@1.0.1
|
|
359
|
+
- @zhin.js/adapter@1.0.1
|
|
360
|
+
|
|
361
|
+
## 3.0.2
|
|
362
|
+
|
|
363
|
+
### Patch Changes
|
|
364
|
+
|
|
365
|
+
- 872c583: fix: 代码格式优化
|
|
366
|
+
- Updated dependencies [872c583]
|
|
367
|
+
- Updated dependencies [872c583]
|
|
368
|
+
- @zhin.js/agent@1.0.3
|
|
369
|
+
- @zhin.js/client@2.0.5
|
|
370
|
+
- @zhin.js/contract@1.0.3
|
|
371
|
+
- @zhin.js/core@1.3.4
|
|
372
|
+
- @zhin.js/host-api@2.0.5
|
|
373
|
+
- @zhin.js/host-router@2.0.3
|
|
374
|
+
- zhin.js@4.1.2
|
|
375
|
+
|
|
376
|
+
## 3.0.1
|
|
377
|
+
|
|
378
|
+
### Patch Changes
|
|
379
|
+
|
|
380
|
+
- 5cc9c03: fix: ai 优化
|
|
381
|
+
- b9b3881: fix: 增加游戏引擎以及部分游戏
|
|
382
|
+
- Updated dependencies [5b08052]
|
|
383
|
+
- Updated dependencies [5cc9c03]
|
|
384
|
+
- Updated dependencies [36d6db2]
|
|
385
|
+
- Updated dependencies [b9b3881]
|
|
386
|
+
- Updated dependencies [7700903]
|
|
387
|
+
- @zhin.js/agent@1.0.2
|
|
388
|
+
- @zhin.js/core@1.3.3
|
|
389
|
+
- @zhin.js/client@2.0.4
|
|
390
|
+
- @zhin.js/contract@1.0.2
|
|
391
|
+
- @zhin.js/host-api@2.0.4
|
|
392
|
+
- @zhin.js/host-router@2.0.2
|
|
393
|
+
- zhin.js@4.1.1
|
|
394
|
+
|
|
395
|
+
## 3.0.0
|
|
396
|
+
|
|
397
|
+
### Patch Changes
|
|
398
|
+
|
|
399
|
+
- c4575c9: fix: 输入输出优化,文档优化
|
|
400
|
+
- Updated dependencies [c4575c9]
|
|
401
|
+
- Updated dependencies [c4575c9]
|
|
402
|
+
- @zhin.js/host-router@2.0.1
|
|
403
|
+
- @zhin.js/host-api@2.0.3
|
|
404
|
+
- @zhin.js/agent@1.0.1
|
|
405
|
+
- @zhin.js/core@1.3.2
|
|
406
|
+
- zhin.js@4.1.0
|
|
407
|
+
|
|
408
|
+
## 2.0.2
|
|
409
|
+
|
|
410
|
+
### Patch Changes
|
|
411
|
+
|
|
412
|
+
- Updated dependencies [384ea11]
|
|
413
|
+
- @zhin.js/host-api@2.0.2
|
|
414
|
+
- zhin.js@4.0.1
|
|
415
|
+
|
|
416
|
+
## 2.0.1
|
|
417
|
+
|
|
418
|
+
### Patch Changes
|
|
419
|
+
|
|
420
|
+
- Updated dependencies [609da24]
|
|
421
|
+
- Updated dependencies [7dfafc2]
|
|
422
|
+
- Updated dependencies [93e58d9]
|
|
423
|
+
- Updated dependencies [ae5239c]
|
|
424
|
+
- @zhin.js/agent@0.3.1
|
|
425
|
+
- @zhin.js/core@1.3.1
|
|
426
|
+
- @zhin.js/host-api@2.0.1
|
|
427
|
+
- zhin.js@4.0.1
|
|
428
|
+
- @zhin.js/host-router@2.0.0
|
|
429
|
+
|
|
430
|
+
## 2.0.0
|
|
431
|
+
|
|
432
|
+
### Patch Changes
|
|
433
|
+
|
|
434
|
+
- Updated dependencies [db38da4]
|
|
435
|
+
- @zhin.js/agent@0.3.0
|
|
436
|
+
- @zhin.js/core@1.3.0
|
|
437
|
+
- zhin.js@3.0.0
|
|
438
|
+
- @zhin.js/host-api@2.0.0
|
|
439
|
+
- @zhin.js/host-router@2.0.0
|
|
440
|
+
|
|
441
|
+
## 1.0.1
|
|
442
|
+
|
|
443
|
+
### Patch Changes
|
|
444
|
+
|
|
445
|
+
- d8def69: fix: 性能优化
|
|
446
|
+
- 2ef4896: fix: 更新概念 Bot=>Endpoint,已适配后续更多的业务场景;统一角色权限
|
|
447
|
+
- Updated dependencies [d8def69]
|
|
448
|
+
- Updated dependencies [2ef4896]
|
|
449
|
+
- @zhin.js/host-router@1.0.1
|
|
450
|
+
- @zhin.js/host-api@1.0.1
|
|
451
|
+
- @zhin.js/agent@0.2.1
|
|
452
|
+
- @zhin.js/core@1.2.1
|
|
453
|
+
- zhin.js@2.0.1
|
|
454
|
+
- @zhin.js/client@2.0.3
|
|
455
|
+
|
|
3
456
|
## 1.0.0
|
|
4
457
|
|
|
5
458
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @zhin.js/adapter-weixin-ilink
|
|
2
2
|
|
|
3
|
-
通过微信 **iLink
|
|
3
|
+
通过微信 **iLink Endpoint API**(ClawBot 灰度入口)接入**个人微信**,支持文本与全量媒体收发。Plugin Runtime 约定式 `defineAdapter`(长轮询入站,无 host-router / Koa)。
|
|
4
4
|
|
|
5
5
|
协议实现移植自 [Tencent/openclaw-weixin](https://github.com/Tencent/openclaw-weixin)(MIT),已去除 OpenClaw 耦合,`bot_agent` 默认为 `Zhin.js/<version>`。
|
|
6
6
|
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
| 项 | weixin-ilink | wechat-mp |
|
|
10
10
|
|---|---|---|
|
|
11
11
|
| 账号类型 | 个人微信(ClawBot) | 微信公众号 |
|
|
12
|
-
| 入站 | 长轮询 `getupdates` | Webhook
|
|
13
|
-
| 登录 | 扫码
|
|
12
|
+
| 入站 | 长轮询 `getupdates` → `Endpoint.emit(...)` | Webhook(`httpHostToken`) |
|
|
13
|
+
| 登录 | 扫码 / 侧车凭证 / `botToken` | AppId/Secret/Token |
|
|
14
14
|
| 群聊 | 不支持(仅私聊) | 支持 |
|
|
15
15
|
|
|
16
16
|
可与 `@zhin.js/adapter-wechat-mp` **同时启用**。
|
|
@@ -19,78 +19,55 @@
|
|
|
19
19
|
|
|
20
20
|
- 微信客户端需已灰度 **ClawBot** 入口(最新版微信 + 灰度资格)
|
|
21
21
|
- Node.js ^20.19.0 或 >=22.12.0
|
|
22
|
-
- 可选:`@zhin.js/host-router` + `@zhin.js/host-api` 用于 Web 控制台扫码登录
|
|
23
22
|
|
|
24
23
|
## 最小配置
|
|
25
24
|
|
|
26
25
|
```yaml
|
|
27
|
-
bots:
|
|
28
|
-
- context: weixin-ilink
|
|
29
|
-
name: my-wechat
|
|
30
|
-
# botAgent: "Zhin.js/1.0.0" # 可选,观测用
|
|
31
|
-
# longPollTimeoutMs: 35000 # 可选
|
|
32
|
-
# baseUrl: https://ilinkai.weixin.qq.com
|
|
33
|
-
|
|
34
26
|
plugins:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
weixin-ilink:
|
|
28
|
+
# botAgent: "Zhin.js/1.0.0"
|
|
29
|
+
# longPollTimeoutMs: 35000
|
|
30
|
+
# baseUrl: https://ilinkai.weixin.qq.com
|
|
31
|
+
endpoints:
|
|
32
|
+
- name: my-wechat
|
|
33
|
+
# botToken: "..." # 或环境变量 WEIXIN_ILINK_TOKEN
|
|
38
34
|
```
|
|
39
35
|
|
|
40
|
-
`
|
|
36
|
+
`botToken` 也可保存在侧车文件(不进 git):
|
|
41
37
|
|
|
42
38
|
```
|
|
43
39
|
data/weixin-ilink/<bot-name>.json
|
|
44
40
|
```
|
|
45
41
|
|
|
46
|
-
也可通过环境变量 `WEIXIN_ILINK_TOKEN` 或配置项 `botToken` 覆盖(CI 场景)。
|
|
47
|
-
|
|
48
42
|
## 登录流程
|
|
49
43
|
|
|
50
|
-
1.
|
|
44
|
+
1. 首次启动无凭证时,调用 `get_bot_qrcode` 并在日志中打印二维码内容
|
|
51
45
|
2. 用户用微信扫码确认
|
|
52
46
|
3. 后台轮询 `get_qrcode_status` 直至 `confirmed`,写入 `data/weixin-ilink/<name>.json`
|
|
53
47
|
4. 调用 `notifyStart` 后进入长轮询
|
|
54
48
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
- Console 页面:`/weixin-ilink`(概览 + 登录辅助)
|
|
58
|
-
- HTTP API:`GET /api/login-assist/pending`、`POST /api/login-assist/submit`、`POST /api/login-assist/cancel`
|
|
59
|
-
- Bot 状态:`GET /api/weixin-ilink/bots`
|
|
60
|
-
|
|
61
|
-
## Typing Indicator
|
|
62
|
-
|
|
63
|
-
私聊使用 iLink `sendTyping` API,在微信侧显示**正在输入**(非文本消息、非 reaction)。长任务期间每 5s 保活一次(`keepaliveIntervalMs` 可配)。
|
|
64
|
-
|
|
65
|
-
```yaml
|
|
66
|
-
typingIndicator:
|
|
67
|
-
enabled: true
|
|
68
|
-
keepaliveIntervalMs: 5000
|
|
69
|
-
privateConfig:
|
|
70
|
-
type: typing
|
|
71
|
-
```
|
|
49
|
+
> Console 扫码面板(旧 `loginAssist` + host-router)已从生产路径移除;优先用 `botToken` / 侧车凭证。
|
|
72
50
|
|
|
73
51
|
## 出站说明
|
|
74
52
|
|
|
75
|
-
回复必须携带入站时缓存的 `context_token`(按 `
|
|
53
|
+
回复必须携带入站时缓存的 `context_token`(按 `endpointId + peerUserId`)。若用户久未发消息导致 token 缺失,出站会拒绝并打 warn。
|
|
76
54
|
|
|
77
|
-
|
|
55
|
+
出站经 Runtime:`OutboundMessageService` → `endpoint.send({ conversation, payload })`(`conversation` 为入站归一化出的 `ConversationRef`,kind 恒为 `private`,`id` 即对端 user_id)。
|
|
78
56
|
|
|
79
57
|
**图文限制**:微信单条消息不支持图文混排。适配器会自动:
|
|
58
|
+
|
|
80
59
|
- **出站**:先单独发文本,再发纯媒体(不带 caption)
|
|
81
|
-
-
|
|
60
|
+
- **入站**:文字与媒体路径写入同一条 gateway `content` 文本
|
|
82
61
|
|
|
83
62
|
## 故障排查
|
|
84
63
|
|
|
85
64
|
| 现象 | 可能原因 |
|
|
86
65
|
|---|---|
|
|
87
66
|
| 无法扫码 / 无 ClawBot 入口 | 未灰度;需最新微信 + 灰度资格 |
|
|
88
|
-
| 二维码过期 |
|
|
67
|
+
| 二维码过期 | 重启适配器重新获取 |
|
|
89
68
|
| 发不出消息 | 缺少 `context_token`;让用户先发一条消息 |
|
|
90
69
|
| `errcode -14` | 会话过期,适配器自动暂停 1 小时后重试 |
|
|
91
|
-
| Console 无待办 | 确认 `host-router` 已加载且访问 `/weixin-ilink` |
|
|
92
70
|
|
|
93
71
|
## 文档
|
|
94
72
|
|
|
95
|
-
- 架构与计划:仓库内 weixin-ilink 实现计划
|
|
96
73
|
- 适配器索引:[`plugins/adapters/README.md`](../README.md)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
/**
|
|
3
|
+
* Convention entry: discover `adapters/weixin-ilink.ts` → defineAdapter.
|
|
4
|
+
*/
|
|
5
|
+
import { defineAdapter } from 'zhin.js/adapter';
|
|
6
|
+
import { WeixinIlinkEndpoint } from "../lib/endpoint.js";
|
|
7
|
+
import { resolveWeixinIlinkConfig, } from "../lib/protocol.js";
|
|
8
|
+
import { weixinIlinkRuntimeStateToken } from "../lib/weixin-ilink-runtime-state.js";
|
|
9
|
+
export { WeixinIlinkEndpoint } from "../lib/endpoint.js";
|
|
10
|
+
export default defineAdapter({
|
|
11
|
+
capabilities: ['inbound', 'outbound'],
|
|
12
|
+
operations: ['typing'],
|
|
13
|
+
// 所有媒体(url 下载 / base64 落盘 / 本地 path)统一物化后走 CDN 上传(sendWeixinMediaFile),
|
|
14
|
+
// 无直发面;微信无卡片交互面,交互段降级纯文本。
|
|
15
|
+
segments: {
|
|
16
|
+
outboundMedia: ['upload'],
|
|
17
|
+
interactive: 'text',
|
|
18
|
+
},
|
|
19
|
+
create(context) {
|
|
20
|
+
const config = resolveWeixinIlinkConfig(context.config);
|
|
21
|
+
// 注册到插件运行时状态(weixin-ilink.endpoint list 的"运行中"数据源)
|
|
22
|
+
context.use(weixinIlinkRuntimeStateToken).endpoints.set(config.id, {
|
|
23
|
+
id: config.id,
|
|
24
|
+
// iLink 仅长轮询一种接入方式,无 config.connection 字段
|
|
25
|
+
mode: 'long-poll',
|
|
26
|
+
});
|
|
27
|
+
return new WeixinIlinkEndpoint({
|
|
28
|
+
id: context.id,
|
|
29
|
+
config,
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convention entry: discover `adapters/weixin-ilink.ts` → defineAdapter.
|
|
3
|
+
*/
|
|
4
|
+
import { defineAdapter } from 'zhin.js/adapter';
|
|
5
|
+
import { WeixinIlinkEndpoint } from '../src/endpoint.js';
|
|
6
|
+
import {
|
|
7
|
+
resolveWeixinIlinkConfig,
|
|
8
|
+
type WeixinIlinkAdapterConfig,
|
|
9
|
+
} from '../src/protocol.js';
|
|
10
|
+
import { weixinIlinkRuntimeStateToken } from '../src/weixin-ilink-runtime-state.js';
|
|
11
|
+
|
|
12
|
+
export { WeixinIlinkEndpoint } from '../src/endpoint.js';
|
|
13
|
+
export type {
|
|
14
|
+
WeixinIlinkEndpointOptions,
|
|
15
|
+
WeixinIlinkGetUpdates,
|
|
16
|
+
WeixinIlinkNotifyStart,
|
|
17
|
+
WeixinIlinkNotifyStop,
|
|
18
|
+
WeixinIlinkSendText,
|
|
19
|
+
} from '../src/endpoint.js';
|
|
20
|
+
|
|
21
|
+
export default defineAdapter<WeixinIlinkAdapterConfig>({
|
|
22
|
+
capabilities: ['inbound', 'outbound'],
|
|
23
|
+
operations: ['typing'],
|
|
24
|
+
// 所有媒体(url 下载 / base64 落盘 / 本地 path)统一物化后走 CDN 上传(sendWeixinMediaFile),
|
|
25
|
+
// 无直发面;微信无卡片交互面,交互段降级纯文本。
|
|
26
|
+
segments: {
|
|
27
|
+
outboundMedia: ['upload'],
|
|
28
|
+
interactive: 'text',
|
|
29
|
+
},
|
|
30
|
+
create(context) {
|
|
31
|
+
const config = resolveWeixinIlinkConfig(context.config);
|
|
32
|
+
// 注册到插件运行时状态(weixin-ilink.endpoint list 的"运行中"数据源)
|
|
33
|
+
context.use(weixinIlinkRuntimeStateToken).endpoints.set(config.id, {
|
|
34
|
+
id: config.id,
|
|
35
|
+
// iLink 仅长轮询一种接入方式,无 config.connection 字段
|
|
36
|
+
mode: 'long-poll',
|
|
37
|
+
});
|
|
38
|
+
return new WeixinIlinkEndpoint({
|
|
39
|
+
id: context.id,
|
|
40
|
+
config,
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
});
|