@zhin.js/adapter-wechat-mp 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.
Files changed (62) hide show
  1. package/CHANGELOG.md +478 -0
  2. package/README.md +40 -88
  3. package/adapters/wechat-mp.js +32 -0
  4. package/adapters/wechat-mp.ts +38 -0
  5. package/commands/endpoint/add/[id].js +3 -0
  6. package/commands/endpoint/add/[id].ts +3 -0
  7. package/commands/endpoint/list.js +3 -0
  8. package/commands/endpoint/list.ts +3 -0
  9. package/commands/endpoint/remove/[id].js +3 -0
  10. package/commands/endpoint/remove/[id].ts +3 -0
  11. package/lib/client.d.ts +32 -0
  12. package/lib/client.js +70 -0
  13. package/lib/endpoint.d.ts +32 -0
  14. package/lib/endpoint.js +264 -0
  15. package/lib/index.d.ts +6 -15
  16. package/lib/index.js +6 -25
  17. package/lib/media-upload.d.ts +22 -0
  18. package/lib/media-upload.js +64 -0
  19. package/lib/passive-reply.d.ts +0 -1
  20. package/lib/passive-reply.js +0 -1
  21. package/lib/protocol.d.ts +129 -0
  22. package/lib/protocol.js +349 -0
  23. package/lib/side-event-dispatch.d.ts +4 -0
  24. package/lib/side-event-dispatch.js +38 -0
  25. package/lib/webhook.d.ts +20 -0
  26. package/lib/webhook.js +152 -0
  27. package/lib/wechat-mp-endpoint-commands.d.ts +1 -0
  28. package/lib/wechat-mp-endpoint-commands.js +19 -0
  29. package/lib/wechat-mp-runtime-state.d.ts +1 -0
  30. package/lib/wechat-mp-runtime-state.js +6 -0
  31. package/package.json +53 -12
  32. package/plugin.js +14 -0
  33. package/schema.json +116 -0
  34. package/src/client.ts +121 -0
  35. package/src/endpoint.ts +313 -0
  36. package/src/index.ts +56 -35
  37. package/src/media-upload.ts +82 -0
  38. package/src/protocol.ts +507 -0
  39. package/src/side-event-dispatch.ts +45 -0
  40. package/src/webhook.ts +237 -0
  41. package/src/wechat-mp-endpoint-commands.ts +20 -0
  42. package/src/wechat-mp-runtime-state.ts +7 -0
  43. package/lib/adapter.d.ts +0 -13
  44. package/lib/adapter.d.ts.map +0 -1
  45. package/lib/adapter.js +0 -16
  46. package/lib/adapter.js.map +0 -1
  47. package/lib/bot.d.ts +0 -73
  48. package/lib/bot.d.ts.map +0 -1
  49. package/lib/bot.js +0 -783
  50. package/lib/bot.js.map +0 -1
  51. package/lib/index.d.ts.map +0 -1
  52. package/lib/index.js.map +0 -1
  53. package/lib/passive-reply.d.ts.map +0 -1
  54. package/lib/passive-reply.js.map +0 -1
  55. package/lib/types.d.ts +0 -58
  56. package/lib/types.d.ts.map +0 -1
  57. package/lib/types.js +0 -2
  58. package/lib/types.js.map +0 -1
  59. package/src/adapter.ts +0 -20
  60. package/src/bot.ts +0 -934
  61. package/src/types.ts +0 -60
  62. /package/{skills/wechat-mp/SKILL.md → agent/skills/wechat-mp.md} +0 -0
package/src/types.ts DELETED
@@ -1,60 +0,0 @@
1
- /**
2
- * 微信公众号适配器类型定义
3
- */
4
- export interface WeChatMPConfig {
5
- context: "wechat-mp";
6
- name: string;
7
- appId: string;
8
- appSecret: string;
9
- token: string;
10
- encodingAESKey?: string;
11
- path: string;
12
- encrypt?: boolean;
13
- /**
14
- * plain:明文入站/出站
15
- * compatible:入站可解密,被动回复用明文(微信兼容模式推荐)
16
- * secure:入站/出站均加密
17
- */
18
- encryptMode?: "plain" | "compatible" | "secure";
19
- /**
20
- * passive:订阅号默认,在 webhook 响应内被动回复(5 秒内)
21
- * customer_service:走客服消息 API(需接口权限)
22
- */
23
- replyMode?: "passive" | "customer_service";
24
- /** 被动回复等待入站处理的最长时间(毫秒),默认 4500 */
25
- passiveReplyTimeoutMs?: number;
26
- }
27
-
28
- export interface WeChatMessage {
29
- ToUserName: string;
30
- FromUserName: string;
31
- CreateTime: number;
32
- MsgType: string;
33
- MsgId?: string;
34
- Content?: string;
35
- PicUrl?: string;
36
- MediaId?: string;
37
- Format?: string;
38
- Recognition?: string;
39
- ThumbMediaId?: string;
40
- Location_X?: string;
41
- Location_Y?: string;
42
- Scale?: string;
43
- Label?: string;
44
- Title?: string;
45
- Description?: string;
46
- Url?: string;
47
- Event?: string;
48
- EventKey?: string;
49
- }
50
-
51
- export interface TokenResponse {
52
- access_token: string;
53
- expires_in: number;
54
- }
55
-
56
- export interface WeChatAPIResponse {
57
- errcode?: number;
58
- errmsg?: string;
59
- msgid?: number;
60
- }