@lansenger-pm/openclaw-lansenger-channel 3.2.12 → 3.3.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/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { defineChannelPluginEntry } from "openclaw/plugin-sdk/channel-core";
2
2
  import { lansengerPlugin } from "./src/channel.js";
3
3
  import { startLansengerGateway } from "./src/runtime.js";
4
+ import { registerLansengerTools } from "./src/tools.js";
4
5
  export { resolveAccount, makeClient } from "./src/channel.js";
5
6
  export { getRunningClient, getRunningAccount, getLastInboundChatId } from "./src/runtime.js";
6
7
  export { LansengerClient } from "./src/client.js";
@@ -11,6 +12,7 @@ export default defineChannelPluginEntry({
11
12
  plugin: lansengerPlugin,
12
13
  registerFull(api) {
13
14
  startLansengerGateway(api);
15
+ registerLansengerTools(api);
14
16
  },
15
17
  });
16
18
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,eAAe,wBAAwB,CAAC;IACtC,EAAE,EAAE,WAAW;IACf,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,4DAA4D;IACzE,MAAM,EAAE,eAAe;IACvB,YAAY,CAAC,GAAG;QACd,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,eAAe,wBAAwB,CAAC;IACtC,EAAE,EAAE,WAAW;IACf,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,4DAA4D;IACzE,MAAM,EAAE,eAAe;IACvB,YAAY,CAAC,GAAG;QACd,qBAAqB,CAAC,GAAG,CAAC,CAAC;QAC3B,sBAAsB,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,408 @@
1
+ import * as path from "node:path";
2
+ import * as fs from "node:fs/promises";
3
+ import { getRunningClient, getRunningAccount, getLastInboundChatId } from "./runtime.js";
4
+ function resolveTarget(to) {
5
+ if (to)
6
+ return to;
7
+ return getLastInboundChatId() ?? "";
8
+ }
9
+ function jsonResult(data) {
10
+ return { content: [{ type: "text", text: JSON.stringify(data) }] };
11
+ }
12
+ function makeToolClient() {
13
+ const account = getRunningAccount();
14
+ if (!account)
15
+ return null;
16
+ const client = getRunningClient();
17
+ if (!client)
18
+ return null;
19
+ return { client, account };
20
+ }
21
+ const SendFileSchema = {
22
+ type: "object",
23
+ properties: {
24
+ filePath: { type: "string", description: "Absolute local path to the file to send. Any path works — Documents, Desktop, workspace, /tmp, etc." },
25
+ caption: { type: "string", description: "Plain-text caption for the file (Markdown will NOT render on Lansenger). Optional." },
26
+ to: { type: "string", description: "Chat ID to send to. Leave empty to auto-detect from current session." },
27
+ },
28
+ required: ["filePath"],
29
+ };
30
+ const SendTextSchema = {
31
+ type: "object",
32
+ properties: {
33
+ content: { type: "string", description: "Plain text content. No Markdown support — Markdown renders automatically in normal replies. Use this for text + file attachment or text + @mentions." },
34
+ filePath: { type: "string", description: "Optional local file/image/video to attach. If provided, content becomes the caption." },
35
+ to: { type: "string", description: "Chat ID to send to. Leave empty to auto-detect from current session." },
36
+ reminderAll: { type: "boolean", description: "@mention all members in a group (only works in group chat, not DMs)." },
37
+ reminderUserIds: { type: "array", items: { type: "string" }, description: "List of user IDs to @mention (group chat only). Include '@姓名' in the message text so users can see who was mentioned." },
38
+ },
39
+ required: ["content"],
40
+ };
41
+ const SendFormatTextSchema = {
42
+ type: "object",
43
+ properties: {
44
+ content: { type: "string", description: "Markdown-formatted text. Renders as rich text on Lansenger. Use this when you need Markdown + @mention. Does NOT support file attachments." },
45
+ to: { type: "string", description: "Chat ID to send to. Leave empty to auto-detect from current session." },
46
+ reminderAll: { type: "boolean", description: "@mention all members in a group (group chat only)." },
47
+ reminderUserIds: { type: "array", items: { type: "string" }, description: "List of user IDs to @mention (group chat only). Include '@姓名' in text so the mention is visible." },
48
+ },
49
+ required: ["content"],
50
+ };
51
+ const SendImageUrlSchema = {
52
+ type: "object",
53
+ properties: {
54
+ imageUrl: { type: "string", description: "URL of the image to download and send. Must be directly reachable from the gateway host." },
55
+ caption: { type: "string", description: "Optional plain-text caption (no Markdown)." },
56
+ to: { type: "string", description: "Chat ID to send to. Leave empty to auto-detect from current session." },
57
+ },
58
+ required: ["imageUrl"],
59
+ };
60
+ const RevokeMessageSchema = {
61
+ type: "object",
62
+ properties: {
63
+ messageIds: { type: "array", items: { type: "string" }, description: "List of message IDs to revoke." },
64
+ chatType: { type: "string", description: "Chat type: bot (default) or group. For group, senderId is required.", default: "bot" },
65
+ senderId: { type: "string", description: "Sender ID (required for group chat type)." },
66
+ },
67
+ required: ["messageIds"],
68
+ };
69
+ const SendLinkCardSchema = {
70
+ type: "object",
71
+ properties: {
72
+ title: { type: "string", description: "Card title." },
73
+ link: { type: "string", description: "Card click-through link URL." },
74
+ description: { type: "string", description: "Card description text (API-required, defaults to empty)." },
75
+ iconLink: { type: "string", description: "Card icon image URL (API-required, defaults to empty)." },
76
+ pcLink: { type: "string", description: "PC client link URL." },
77
+ fromName: { type: "string", description: "Card source name (API-required, defaults to empty)." },
78
+ fromIconLink: { type: "string", description: "Card source icon URL (API-required, defaults to empty)." },
79
+ to: { type: "string", description: "Chat ID to send to. Leave empty to auto-detect from current session." },
80
+ },
81
+ required: ["title", "link"],
82
+ };
83
+ const SendAppArticlesSchema = {
84
+ type: "object",
85
+ properties: {
86
+ articles: {
87
+ type: "array",
88
+ items: {
89
+ type: "object",
90
+ properties: {
91
+ imgUrl: { type: "string", description: "Article image URL." },
92
+ title: { type: "string", description: "Article title." },
93
+ url: { type: "string", description: "Article content link URL." },
94
+ pcUrl: { type: "string", description: "PC client content link URL." },
95
+ summary: { type: "string", description: "Optional article summary (摘要). NOT 'description' — that field is ignored by the API." },
96
+ },
97
+ required: ["imgUrl", "title", "url"],
98
+ },
99
+ description: "List of article entries. Each must have imgUrl, title, url.",
100
+ },
101
+ to: { type: "string", description: "Chat ID to send to. Leave empty to auto-detect from current session." },
102
+ },
103
+ required: ["articles"],
104
+ };
105
+ const SendAppCardSchema = {
106
+ type: "object",
107
+ properties: {
108
+ bodyTitle: { type: "string", description: "Card body title. Supports div-style: color, font-size, text-align." },
109
+ headTitle: { type: "string", description: "Card header title." },
110
+ bodySubTitle: { type: "string", description: "Card body subtitle. Supports div-style formatting." },
111
+ bodyContent: { type: "string", description: "Card body content. Supports div-style formatting. Always use text-indent:0em — bare 0 causes API failure." },
112
+ signature: { type: "string", description: "Card signature line. Supports color." },
113
+ isDynamic: { type: "boolean", description: "Enable dynamic card updates (default: false). When true, card can be updated via lansenger_update_dynamic_card.", default: false },
114
+ headStatusInfo: {
115
+ type: "object",
116
+ properties: {
117
+ description: { type: "string", description: "Status text (max 30 bytes). Supports div-style for color: e.g. '<div style=\"color:#FFB116\">待审批</div>'. Plain text also works." },
118
+ colour: { type: "string", description: "Status color (e.g. #FFB116 amber, #198754 green, #dc3545 red)." },
119
+ },
120
+ description: "Dynamic card status info. Required when isDynamic=true. description = text supporting div-style color (max 30 bytes). colour = status dot color (hex). These are TWO different things: description text color vs dot color.",
121
+ },
122
+ fields: {
123
+ type: "array",
124
+ items: { type: "object", properties: { key: { type: "string" }, value: { type: "string" } } },
125
+ description: "Key-value pairs (max 10). Both support color div-style.",
126
+ },
127
+ links: {
128
+ type: "array",
129
+ items: { type: "object", properties: { title: { type: "string" }, url: { type: "string" } } },
130
+ description: "Link entries (max 3). Title supports color and text-align.",
131
+ },
132
+ cardLink: { type: "string", description: "Card click-through link." },
133
+ staffId: { type: "string", description: "Staff openId for showing sender avatar." },
134
+ headIconUrl: { type: "string", description: "Header icon URL." },
135
+ to: { type: "string", description: "Chat ID to send to. Leave empty to auto-detect from current session." },
136
+ },
137
+ required: ["bodyTitle"],
138
+ };
139
+ const UpdateDynamicCardSchema = {
140
+ type: "object",
141
+ properties: {
142
+ msgId: { type: "string", description: "Message ID from original lansenger_send_app_card response (required)." },
143
+ headStatusInfo: {
144
+ type: "object",
145
+ properties: {
146
+ description: { type: "string", description: "Updated status text. Supports div-style for color." },
147
+ colour: { type: "string", description: "Updated status color (e.g. #198754 green, #dc3545 red)." },
148
+ },
149
+ description: "Updated status info for the card header.",
150
+ },
151
+ links: {
152
+ type: "array",
153
+ items: { type: "object", properties: { title: { type: "string" }, url: { type: "string" } } },
154
+ description: "Updated link entries (max 3).",
155
+ },
156
+ isLastUpdate: { type: "boolean", description: "True = final state, card becomes static (default: false).", default: false },
157
+ },
158
+ required: ["msgId"],
159
+ };
160
+ const QueryGroupsSchema = {
161
+ type: "object",
162
+ properties: {
163
+ pageOffset: { type: "integer", description: "Page number (default: 1).", default: 1 },
164
+ pageSize: { type: "integer", description: "Groups per page (max 100, default: 100).", default: 100 },
165
+ },
166
+ };
167
+ export function registerLansengerTools(api) {
168
+ api.registerTool({
169
+ name: "lansenger_send_file",
170
+ description: "Send a local file as an attachment on Lansenger (蓝信). Any local file works — workspace, Documents, /tmp, etc. Do NOT use MEDIA: tags for files outside the workspace; they silently fail. Always use this tool instead.",
171
+ parameters: SendFileSchema,
172
+ async execute(_toolCallId, params) {
173
+ const tc = makeToolClient();
174
+ if (!tc)
175
+ return jsonResult({ error: "Lansenger account not configured or not running." });
176
+ const filePath = params.filePath;
177
+ const caption = params.caption ?? "";
178
+ const to = resolveTarget(params.to);
179
+ if (!filePath)
180
+ return jsonResult({ error: "filePath is required" });
181
+ if (!to)
182
+ return jsonResult({ error: "No target specified. Provide a 'to' parameter (chat ID)." });
183
+ const resolved = path.resolve(filePath);
184
+ try {
185
+ const stat = await fs.stat(resolved);
186
+ if (!stat.isFile())
187
+ return jsonResult({ error: `Not a file: ${filePath}` });
188
+ }
189
+ catch {
190
+ return jsonResult({ error: `File not found: ${filePath}` });
191
+ }
192
+ const result = await tc.client.sendFile(to, resolved, caption);
193
+ return jsonResult({ success: result.success, messageId: result.messageId ?? null });
194
+ },
195
+ });
196
+ api.registerTool({
197
+ name: "lansenger_send_text",
198
+ description: "Send plain text on Lansenger (蓝信) with optional file attachment and @mentions. Uses msgType=text: plain text ONLY (NO Markdown). For Markdown, just write normally — it renders automatically in replies. If you need both Markdown AND a file, send Markdown first, then call this tool for the file.",
199
+ parameters: SendTextSchema,
200
+ async execute(_toolCallId, params) {
201
+ const tc = makeToolClient();
202
+ if (!tc)
203
+ return jsonResult({ error: "Lansenger account not configured or not running." });
204
+ const content = params.content ?? "";
205
+ const filePath = params.filePath ?? "";
206
+ const to = resolveTarget(params.to);
207
+ if (!to)
208
+ return jsonResult({ error: "No target specified. Provide a 'to' parameter (chat ID)." });
209
+ const client = tc.client;
210
+ if (filePath) {
211
+ const resolved = path.resolve(filePath);
212
+ try {
213
+ const stat = await fs.stat(resolved);
214
+ if (!stat.isFile())
215
+ return jsonResult({ error: `Not a file: ${filePath}` });
216
+ }
217
+ catch {
218
+ return jsonResult({ error: `File not found: ${filePath}` });
219
+ }
220
+ const uploadResult = await client.uploadMedia(resolved);
221
+ if ("error" in uploadResult)
222
+ return jsonResult({ error: uploadResult.error });
223
+ const reminder = (params.reminderAll || (params.reminderUserIds && params.reminderUserIds.length > 0))
224
+ ? { all: Boolean(params.reminderAll), userIds: params.reminderUserIds ?? [] }
225
+ : undefined;
226
+ const result = await client.sendTextWithMedia(to, content, 3, [uploadResult.mediaId], reminder);
227
+ return jsonResult({ success: result.success, messageId: result.messageId ?? null });
228
+ }
229
+ const reminder = (params.reminderAll || (params.reminderUserIds && params.reminderUserIds.length > 0))
230
+ ? { all: Boolean(params.reminderAll), userIds: params.reminderUserIds ?? [] }
231
+ : undefined;
232
+ const result = await client.sendText(to, content, reminder);
233
+ return jsonResult({ success: result.success, messageId: result.messageId ?? null });
234
+ },
235
+ });
236
+ api.registerTool({
237
+ name: "lansenger_send_format_text",
238
+ description: "Send Markdown-formatted text on Lansenger (蓝信) with optional @mentions. Uses msgType=formatText: Markdown renders as rich text. Supports @mentions via reminder params. Does NOT support file attachments — for Markdown + file, write the Markdown reply normally first, then use lansenger_send_file separately.",
239
+ parameters: SendFormatTextSchema,
240
+ async execute(_toolCallId, params) {
241
+ const tc = makeToolClient();
242
+ if (!tc)
243
+ return jsonResult({ error: "Lansenger account not configured or not running." });
244
+ const content = params.content ?? "";
245
+ const to = resolveTarget(params.to);
246
+ if (!to)
247
+ return jsonResult({ error: "No target specified. Provide a 'to' parameter (chat ID)." });
248
+ const reminder = (params.reminderAll || (params.reminderUserIds && params.reminderUserIds.length > 0))
249
+ ? { all: Boolean(params.reminderAll), userIds: params.reminderUserIds ?? [] }
250
+ : undefined;
251
+ const result = await tc.client.sendFormatText(to, content, reminder);
252
+ return jsonResult({ success: result.success, messageId: result.messageId ?? null });
253
+ },
254
+ });
255
+ api.registerTool({
256
+ name: "lansenger_send_image_url",
257
+ description: "Send an image from a URL to a Lansenger (蓝信) user or group. Downloads the image first, then uploads and sends. URL must be directly reachable from the gateway host. For local files, use lansenger_send_file instead.",
258
+ parameters: SendImageUrlSchema,
259
+ async execute(_toolCallId, params) {
260
+ const tc = makeToolClient();
261
+ if (!tc)
262
+ return jsonResult({ error: "Lansenger account not configured or not running." });
263
+ const imageUrl = params.imageUrl;
264
+ const caption = params.caption ?? "";
265
+ const to = resolveTarget(params.to);
266
+ if (!imageUrl)
267
+ return jsonResult({ error: "imageUrl is required" });
268
+ if (!to)
269
+ return jsonResult({ error: "No target specified. Provide a 'to' parameter (chat ID)." });
270
+ const result = await tc.client.sendImageUrl(to, imageUrl, caption);
271
+ return jsonResult({ success: result.success, messageId: result.messageId ?? null });
272
+ },
273
+ });
274
+ api.registerTool({
275
+ name: "lansenger_revoke_message",
276
+ description: "Revoke previously sent Lansenger (蓝信) messages. The recipient sees a 'message revoked' notification. For group chat, senderId is required.",
277
+ parameters: RevokeMessageSchema,
278
+ async execute(_toolCallId, params) {
279
+ const tc = makeToolClient();
280
+ if (!tc)
281
+ return jsonResult({ error: "Lansenger account not configured or not running." });
282
+ const messageIds = params.messageIds;
283
+ if (!messageIds || messageIds.length === 0)
284
+ return jsonResult({ error: "messageIds is required" });
285
+ const chatType = params.chatType ?? "bot";
286
+ const senderId = params.senderId;
287
+ if (chatType === "group" && !senderId) {
288
+ return jsonResult({ error: "chatType='group' requires senderId" });
289
+ }
290
+ const result = await tc.client.revokeMessage(messageIds, chatType, senderId);
291
+ return jsonResult({ success: result.success });
292
+ },
293
+ });
294
+ api.registerTool({
295
+ name: "lansenger_send_link_card",
296
+ description: "Send a link preview card on Lansenger (蓝信). Displays title, description, icon, and clickable link. API requires description, iconLink, fromName, fromIconLink (defaults to empty string if omitted).",
297
+ parameters: SendLinkCardSchema,
298
+ async execute(_toolCallId, params) {
299
+ const tc = makeToolClient();
300
+ if (!tc)
301
+ return jsonResult({ error: "Lansenger account not configured or not running." });
302
+ const title = params.title;
303
+ const link = params.link;
304
+ const to = resolveTarget(params.to);
305
+ if (!title || !link)
306
+ return jsonResult({ error: "title and link are required" });
307
+ if (!to)
308
+ return jsonResult({ error: "No target specified. Provide a 'to' parameter (chat ID)." });
309
+ const result = await tc.client.sendLinkCard(to, title, link, {
310
+ description: params.description ?? "",
311
+ iconLink: params.iconLink ?? "",
312
+ pcLink: params.pcLink ?? "",
313
+ fromName: params.fromName ?? "",
314
+ fromIconLink: params.fromIconLink ?? "",
315
+ });
316
+ return jsonResult({ success: result.success, messageId: result.messageId ?? null });
317
+ },
318
+ });
319
+ api.registerTool({
320
+ name: "lansenger_send_app_articles",
321
+ description: "Send a multi-article card (图文卡片) on Lansenger (蓝信). Each article has an image, title, and link. Article summary field is 'summary' (NOT 'description' — that field is silently ignored by the API). For a single link card, use lansenger_send_link_card instead.",
322
+ parameters: SendAppArticlesSchema,
323
+ async execute(_toolCallId, params) {
324
+ const tc = makeToolClient();
325
+ if (!tc)
326
+ return jsonResult({ error: "Lansenger account not configured or not running." });
327
+ const articles = params.articles;
328
+ const to = resolveTarget(params.to);
329
+ if (!articles || articles.length === 0)
330
+ return jsonResult({ error: "articles is required" });
331
+ if (!to)
332
+ return jsonResult({ error: "No target specified. Provide a 'to' parameter (chat ID)." });
333
+ const result = await tc.client.sendAppArticles(to, articles);
334
+ return jsonResult({ success: result.success, messageId: result.messageId ?? null });
335
+ },
336
+ });
337
+ api.registerTool({
338
+ name: "lansenger_send_app_card",
339
+ description: "Send a rich formatted card (应用卡片) on Lansenger (蓝信). Supports div-style formatting (color, font-size, text-align, text-indent). Set isDynamic=true for approval workflows. ⚠️ font-size MUST use pt units (12pt–36pt) — px causes 'invalid bodyContent'. ⚠️ text-indent MUST have units — bare 0 causes silent failure, use 0em. ⚠️ headStatusInfo: description is status TEXT (supports div-style for color, max 30 bytes), colour is the DOT/圆点 color (hex like #FFB116). These are TWO different things — text color vs dot color. ⚠️ Group chat does NOT support appCard msgType — falls back to plain text.",
340
+ parameters: SendAppCardSchema,
341
+ async execute(_toolCallId, params) {
342
+ const tc = makeToolClient();
343
+ if (!tc)
344
+ return jsonResult({ error: "Lansenger account not configured or not running." });
345
+ const bodyTitle = params.bodyTitle;
346
+ const to = resolveTarget(params.to);
347
+ if (!bodyTitle)
348
+ return jsonResult({ error: "bodyTitle is required" });
349
+ if (!to)
350
+ return jsonResult({ error: "No target specified. Provide a 'to' parameter (chat ID)." });
351
+ const cardData = {
352
+ bodyTitle,
353
+ headTitle: params.headTitle ?? "",
354
+ bodySubTitle: params.bodySubTitle ?? "",
355
+ bodyContent: params.bodyContent ?? "",
356
+ signature: params.signature ?? "",
357
+ isDynamic: params.isDynamic ?? false,
358
+ cardLink: params.cardLink ?? "",
359
+ staffId: params.staffId ?? "",
360
+ headIconUrl: params.headIconUrl ?? "",
361
+ };
362
+ if (params.fields)
363
+ cardData.fields = params.fields;
364
+ if (params.links)
365
+ cardData.links = params.links;
366
+ if (params.headStatusInfo)
367
+ cardData.headStatusInfo = params.headStatusInfo;
368
+ if (params.isDynamic && !params.headStatusInfo) {
369
+ cardData.headStatusInfo = {
370
+ description: '<div style="color:rgba(0,0,0,.47);text-align:left">Active</div>',
371
+ colour: "rgba(0,0,0,.47)",
372
+ };
373
+ }
374
+ const result = await tc.client.sendAppCard(to, cardData);
375
+ return jsonResult({ success: result.success, messageId: result.messageId ?? null });
376
+ },
377
+ });
378
+ api.registerTool({
379
+ name: "lansenger_update_dynamic_card",
380
+ description: "Update a dynamic appCard's status in-place on Lansenger (蓝信). The card must have been sent with isDynamic=true via lansenger_send_app_card. Use this for approval workflows: pending → approved/rejected. headStatusInfo: description supports div-style for color, colour is the status dot color.",
381
+ parameters: UpdateDynamicCardSchema,
382
+ async execute(_toolCallId, params) {
383
+ const tc = makeToolClient();
384
+ if (!tc)
385
+ return jsonResult({ error: "Lansenger account not configured or not running." });
386
+ const msgId = params.msgId;
387
+ if (!msgId)
388
+ return jsonResult({ error: "msgId is required" });
389
+ const result = await tc.client.updateDynamicCard(msgId, params.headStatusInfo, params.links, params.isLastUpdate ?? false);
390
+ return jsonResult({ success: result.success });
391
+ },
392
+ });
393
+ api.registerTool({
394
+ name: "lansenger_query_groups",
395
+ description: "Query the bot's group list on Lansenger (蓝信). Returns total count and group IDs. ⚠️ May return errCode=10005 'API服务无权限' on enterprise deployments where /v2/groups/fetch is not authorized. If permission denied, ask the user for group chatIds manually.",
396
+ parameters: QueryGroupsSchema,
397
+ async execute(_toolCallId, params) {
398
+ const tc = makeToolClient();
399
+ if (!tc)
400
+ return jsonResult({ error: "Lansenger account not configured or not running." });
401
+ const result = await tc.client.queryGroups(params.pageOffset ?? 1, params.pageSize ?? 100);
402
+ if ("error" in result)
403
+ return jsonResult({ error: result.error });
404
+ return jsonResult({ success: true, totalGroupIds: result.totalGroupIds, groupIds: result.groupIds });
405
+ },
406
+ });
407
+ }
408
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAIzF,SAAS,aAAa,CAAC,EAAW;IAChC,IAAI,EAAE;QAAE,OAAO,EAAE,CAAC;IAClB,OAAO,oBAAoB,EAAE,IAAI,EAAE,CAAC;AACtC,CAAC;AAED,SAAS,UAAU,CAAC,IAAa;IAC/B,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;AACrE,CAAC;AAED,SAAS,cAAc;IACrB,MAAM,O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AM,CAAC,KAAK,EAAE,CAAC,CAAC;YAClE,OAAO,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,CAAC,aAAa,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QACvG,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -11,11 +11,57 @@
11
11
  "channelEnvVars": {
12
12
  "lansenger": ["LANSENGER_APP_ID", "LANSENGER_APP_SECRET", "LANSENGER_API_GATEWAY_URL"]
13
13
  },
14
- "activation": {
14
+ "activation": {
15
15
  "onStartup": true,
16
16
  "onChannels": ["lansenger"],
17
17
  "onConfigPaths": ["channels.lansenger"]
18
18
  },
19
+ "contracts": {
20
+ "tools": [
21
+ "lansenger_send_file",
22
+ "lansenger_send_text",
23
+ "lansenger_send_format_text",
24
+ "lansenger_send_image_url",
25
+ "lansenger_revoke_message",
26
+ "lansenger_send_link_card",
27
+ "lansenger_send_app_articles",
28
+ "lansenger_send_app_card",
29
+ "lansenger_update_dynamic_card",
30
+ "lansenger_query_groups"
31
+ ]
32
+ },
33
+ "toolMetadata": {
34
+ "lansenger_send_file": {
35
+ "configSignals": [{ "rootPath": "channels.lansenger", "requiredAny": ["appId", "accounts"] }]
36
+ },
37
+ "lansenger_send_text": {
38
+ "configSignals": [{ "rootPath": "channels.lansenger", "requiredAny": ["appId", "accounts"] }]
39
+ },
40
+ "lansenger_send_format_text": {
41
+ "configSignals": [{ "rootPath": "channels.lansenger", "requiredAny": ["appId", "accounts"] }]
42
+ },
43
+ "lansenger_send_image_url": {
44
+ "configSignals": [{ "rootPath": "channels.lansenger", "requiredAny": ["appId", "accounts"] }]
45
+ },
46
+ "lansenger_revoke_message": {
47
+ "configSignals": [{ "rootPath": "channels.lansenger", "requiredAny": ["appId", "accounts"] }]
48
+ },
49
+ "lansenger_send_link_card": {
50
+ "configSignals": [{ "rootPath": "channels.lansenger", "requiredAny": ["appId", "accounts"] }]
51
+ },
52
+ "lansenger_send_app_articles": {
53
+ "configSignals": [{ "rootPath": "channels.lansenger", "requiredAny": ["appId", "accounts"] }]
54
+ },
55
+ "lansenger_send_app_card": {
56
+ "configSignals": [{ "rootPath": "channels.lansenger", "requiredAny": ["appId", "accounts"] }]
57
+ },
58
+ "lansenger_update_dynamic_card": {
59
+ "configSignals": [{ "rootPath": "channels.lansenger", "requiredAny": ["appId", "accounts"] }]
60
+ },
61
+ "lansenger_query_groups": {
62
+ "configSignals": [{ "rootPath": "channels.lansenger", "requiredAny": ["appId", "accounts"] }]
63
+ }
64
+ },
19
65
 
20
66
  "skills": ["./skills"],
21
67
  "channelConfigs": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lansenger-pm/openclaw-lansenger-channel",
3
- "version": "3.2.12",
3
+ "version": "3.3.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
@@ -88,7 +88,21 @@
88
88
  "description": "Lansenger API Gateway URL (default: https://open.e.lanxin.cn/open/apigw)",
89
89
  "sensitive": false
90
90
  }
91
- ]
91
+ ],
92
+ "contracts": {
93
+ "tools": [
94
+ "lansenger_send_file",
95
+ "lansenger_send_text",
96
+ "lansenger_send_format_text",
97
+ "lansenger_send_image_url",
98
+ "lansenger_revoke_message",
99
+ "lansenger_send_link_card",
100
+ "lansenger_send_app_articles",
101
+ "lansenger_send_app_card",
102
+ "lansenger_update_dynamic_card",
103
+ "lansenger_query_groups"
104
+ ]
105
+ }
92
106
  },
93
107
  "devDependencies": {
94
108
  "openclaw": "^2026.5.7",
@@ -97,14 +111,6 @@
97
111
  "typescript": "^6.0.3",
98
112
  "vitest": "^4.1.6"
99
113
  },
100
- "peerDependencies": {
101
- "@lansenger-pm/openclaw-lansenger-tools": ">=1.0.0"
102
- },
103
- "peerDependenciesMeta": {
104
- "@lansenger-pm/openclaw-lansenger-tools": {
105
- "optional": false
106
- }
107
- },
108
114
  "dependencies": {
109
115
  "ws": "^8.20.0"
110
116
  }