@gloablehive/ipad-wechat-plugin 1.0.11 → 1.0.13

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.
@@ -206,6 +206,37 @@ export const ipadWeChatPlugin = createChatChannelPlugin({
206
206
  defaultPolicy: "allowlist",
207
207
  },
208
208
  },
209
+ // Messaging adapter - for target resolution
210
+ messaging: {
211
+ inferTargetChatType: ({ to }) => {
212
+ // WeChat chatroom IDs contain "@chatroom"
213
+ if (to?.includes("@chatroom"))
214
+ return "group";
215
+ return "direct";
216
+ },
217
+ targetResolver: {
218
+ looksLikeId: (raw, _normalized) => {
219
+ // WeChat IDs typically start with "wxid_" or are phone numbers
220
+ const trimmed = raw?.trim();
221
+ if (!trimmed)
222
+ return false;
223
+ return trimmed.startsWith("wxid_") || /^\d{5,15}$/.test(trimmed) || trimmed.includes("@chatroom");
224
+ },
225
+ hint: "<wxid_xxx|phone|xxx@chatroom>",
226
+ resolveTarget: async (params) => {
227
+ const target = params.input?.trim() || params.normalized?.trim();
228
+ if (!target)
229
+ return null;
230
+ // For WeChat, just pass through the ID - it's already valid
231
+ return {
232
+ to: target,
233
+ kind: target.includes("@chatroom") ? "group" : "user",
234
+ display: target,
235
+ source: "normalized"
236
+ };
237
+ },
238
+ },
239
+ },
209
240
  threading: {
210
241
  topLevelReplyToMode: "reply",
211
242
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gloablehive/ipad-wechat-plugin",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "type": "module",
5
5
  "description": "OpenClaw channel plugin for iPad WeChat protocol - enables sending/receiving WeChat messages through iPad protocol",
6
6
  "main": "index.ts",
package/src/channel.ts CHANGED
@@ -267,6 +267,36 @@ export const ipadWeChatPlugin = createChatChannelPlugin<IPadWeChatResolvedAccoun
267
267
  },
268
268
  },
269
269
 
270
+ // Messaging adapter - for target resolution
271
+ messaging: {
272
+ inferTargetChatType: ({ to }) => {
273
+ // WeChat chatroom IDs contain "@chatroom"
274
+ if (to?.includes("@chatroom")) return "group";
275
+ return "direct";
276
+ },
277
+ targetResolver: {
278
+ looksLikeId: (raw: string, _normalized?: string) => {
279
+ // WeChat IDs typically start with "wxid_" or are phone numbers
280
+ const trimmed = raw?.trim();
281
+ if (!trimmed) return false;
282
+ return trimmed.startsWith("wxid_") || /^\d{5,15}$/.test(trimmed) || trimmed.includes("@chatroom");
283
+ },
284
+ hint: "<wxid_xxx|phone|xxx@chatroom>",
285
+ resolveTarget: async (params: any) => {
286
+ const target = params.input?.trim() || params.normalized?.trim();
287
+ if (!target) return null;
288
+
289
+ // For WeChat, just pass through the ID - it's already valid
290
+ return {
291
+ to: target,
292
+ kind: target.includes("@chatroom") ? "group" : "user",
293
+ display: target,
294
+ source: "normalized"
295
+ };
296
+ },
297
+ },
298
+ },
299
+
270
300
  threading: {
271
301
  topLevelReplyToMode: "reply",
272
302
  },