@gloablehive/ipad-wechat-plugin 1.0.1 → 1.0.3

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.
@@ -67,8 +67,32 @@ function resolveAccount(cfg, accountId) {
67
67
  export const ipadWeChatPlugin = createChatChannelPlugin({
68
68
  base: createChannelPluginBase({
69
69
  id: "ipad-wechat",
70
+ capabilities: {
71
+ supportedMessageTypes: ["text", "image", "video", "file", "link", "location", "contact"],
72
+ maxAttachmentSize: 25 * 1024 * 1024,
73
+ supportsMarkdown: false,
74
+ supportsHtml: false,
75
+ supportsEmoji: true,
76
+ supportsReactions: false,
77
+ supportsThreads: true,
78
+ supportsEditing: false,
79
+ supportsDeleting: false,
80
+ },
70
81
  setup: {
71
- resolveAccount,
82
+ resolveAccountId: (params) => {
83
+ return resolveAccount(params.cfg, params.accountId)?.accountId || "";
84
+ },
85
+ listAccountIds: (cfg) => {
86
+ const section = cfg.channels?.["ipad-wechat"];
87
+ if (section?.wechatAccountId) {
88
+ return [section.wechatAccountId];
89
+ }
90
+ return ["default"];
91
+ },
92
+ defaultAccountId: (cfg) => {
93
+ const section = cfg.channels?.["ipad-wechat"];
94
+ return section?.wechatAccountId || "default";
95
+ },
72
96
  inspectAccount(cfg, accountId) {
73
97
  const section = cfg.channels?.["ipad-wechat"];
74
98
  const hasCredentials = Boolean(section?.appKey && section?.appSecret && section?.guid);
@@ -92,9 +116,10 @@ export const ipadWeChatPlugin = createChatChannelPlugin({
92
116
  topLevelReplyToMode: "reply",
93
117
  },
94
118
  outbound: {
119
+ channel: "ipad-wechat",
95
120
  attachedResults: {
96
121
  sendText: async (params) => {
97
- // Get the resolved account from params
122
+ // Get config from params.cfg
98
123
  const cfg = params.cfg;
99
124
  const section = cfg.channels?.["ipad-wechat"];
100
125
  const client = createIPadClient({
@@ -106,7 +106,14 @@ export function createIPadClient(config) {
106
106
  */
107
107
  async syncContacts() {
108
108
  const res = await callApi(config, "/contact/init_contact", {});
109
- return res.data?.contacts || [];
109
+ // API returns contactUsernameList array directly in response
110
+ const contactList = res.contactUsernameList || res.data?.contactUsernameList || [];
111
+ // Convert to Contact format (wechatId is the username)
112
+ return contactList.map((wechatId) => ({
113
+ wechatId,
114
+ nickName: "",
115
+ remark: "",
116
+ }));
110
117
  },
111
118
  /**
112
119
  * 获取联系人详细
@@ -42,19 +42,16 @@
42
42
  "appKey": {
43
43
  "type": "string",
44
44
  "description": "JuHeBot App Key (聚合聊天开放平台)",
45
- "secret": true,
46
- "required": true
45
+ "secret": true
47
46
  },
48
47
  "appSecret": {
49
48
  "type": "string",
50
49
  "description": "JuHeBot App Secret",
51
- "secret": true,
52
- "required": true
50
+ "secret": true
53
51
  },
54
52
  "guid": {
55
53
  "type": "string",
56
- "description": "实例/设备 ID (Guid)",
57
- "required": true
54
+ "description": "实例/设备 ID (Guid)"
58
55
  },
59
56
  "accountId": {
60
57
  "type": "string",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gloablehive/ipad-wechat-plugin",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
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
@@ -118,6 +118,17 @@ export const ipadWeChatPlugin = createChatChannelPlugin<IPadWeChatResolvedAccoun
118
118
  resolveAccountId: (params: any) => {
119
119
  return resolveAccount(params.cfg, params.accountId)?.accountId || "";
120
120
  },
121
+ listAccountIds: (cfg: any) => {
122
+ const section = (cfg.channels as Record<string, any>)?.["ipad-wechat"];
123
+ if (section?.wechatAccountId) {
124
+ return [section.wechatAccountId];
125
+ }
126
+ return ["default"];
127
+ },
128
+ defaultAccountId: (cfg: any) => {
129
+ const section = (cfg.channels as Record<string, any>)?.["ipad-wechat"];
130
+ return section?.wechatAccountId || "default";
131
+ },
121
132
  inspectAccount(cfg: any, accountId: any) {
122
133
  const section = (cfg.channels as Record<string, any>)?.["ipad-wechat"];
123
134
  const hasCredentials = Boolean(section?.appKey && section?.appSecret && section?.guid);