@openclaw/feishu 2026.2.25 → 2026.3.1

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 (64) hide show
  1. package/index.ts +2 -0
  2. package/package.json +2 -1
  3. package/skills/feishu-doc/SKILL.md +109 -3
  4. package/src/accounts.test.ts +90 -0
  5. package/src/accounts.ts +11 -2
  6. package/src/async.ts +62 -0
  7. package/src/bitable.ts +189 -215
  8. package/src/bot.card-action.test.ts +63 -0
  9. package/src/bot.checkBotMentioned.test.ts +55 -0
  10. package/src/bot.test.ts +863 -9
  11. package/src/bot.ts +414 -200
  12. package/src/card-action.ts +79 -0
  13. package/src/channel.ts +6 -0
  14. package/src/chat-schema.ts +24 -0
  15. package/src/chat.test.ts +89 -0
  16. package/src/chat.ts +130 -0
  17. package/src/client.test.ts +107 -0
  18. package/src/client.ts +13 -0
  19. package/src/config-schema.test.ts +82 -1
  20. package/src/config-schema.ts +54 -3
  21. package/src/doc-schema.ts +141 -0
  22. package/src/docx-batch-insert.ts +190 -0
  23. package/src/docx-color-text.ts +149 -0
  24. package/src/docx-table-ops.ts +298 -0
  25. package/src/docx.account-selection.test.ts +76 -0
  26. package/src/docx.test.ts +470 -0
  27. package/src/docx.ts +996 -72
  28. package/src/drive.ts +38 -33
  29. package/src/media.test.ts +123 -6
  30. package/src/media.ts +31 -10
  31. package/src/monitor.account.ts +286 -0
  32. package/src/monitor.reaction.test.ts +235 -0
  33. package/src/monitor.startup.test.ts +187 -0
  34. package/src/monitor.startup.ts +51 -0
  35. package/src/monitor.state.ts +76 -0
  36. package/src/monitor.transport.ts +163 -0
  37. package/src/monitor.ts +44 -346
  38. package/src/monitor.webhook-security.test.ts +27 -1
  39. package/src/outbound.test.ts +181 -0
  40. package/src/outbound.ts +94 -7
  41. package/src/perm.ts +37 -30
  42. package/src/policy.test.ts +56 -1
  43. package/src/policy.ts +5 -1
  44. package/src/post.test.ts +105 -0
  45. package/src/post.ts +274 -0
  46. package/src/probe.test.ts +253 -0
  47. package/src/probe.ts +99 -7
  48. package/src/reply-dispatcher.test.ts +259 -0
  49. package/src/reply-dispatcher.ts +139 -45
  50. package/src/send.reply-fallback.test.ts +105 -0
  51. package/src/send.test.ts +168 -0
  52. package/src/send.ts +143 -18
  53. package/src/streaming-card.ts +131 -43
  54. package/src/targets.test.ts +26 -1
  55. package/src/targets.ts +11 -6
  56. package/src/tool-account-routing.test.ts +129 -0
  57. package/src/tool-account.ts +70 -0
  58. package/src/tool-factory-test-harness.ts +76 -0
  59. package/src/tools-config.test.ts +21 -0
  60. package/src/tools-config.ts +2 -1
  61. package/src/types.ts +1 -0
  62. package/src/typing.test.ts +144 -0
  63. package/src/typing.ts +140 -10
  64. package/src/wiki.ts +55 -50
package/src/wiki.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  import type * as Lark from "@larksuiteoapi/node-sdk";
2
2
  import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
3
3
  import { listEnabledFeishuAccounts } from "./accounts.js";
4
- import { createFeishuClient } from "./client.js";
5
- import { resolveToolsConfig } from "./tools-config.js";
4
+ import { createFeishuToolClient, resolveAnyEnabledFeishuToolsConfig } from "./tool-account.js";
6
5
  import { FeishuWikiSchema, type FeishuWikiParams } from "./wiki-schema.js";
7
6
 
8
7
  // ============ Helpers ============
@@ -168,62 +167,68 @@ export function registerFeishuWikiTools(api: OpenClawPluginApi) {
168
167
  return;
169
168
  }
170
169
 
171
- const firstAccount = accounts[0];
172
- const toolsCfg = resolveToolsConfig(firstAccount.config.tools);
170
+ const toolsCfg = resolveAnyEnabledFeishuToolsConfig(accounts);
173
171
  if (!toolsCfg.wiki) {
174
172
  api.logger.debug?.("feishu_wiki: wiki tool disabled in config");
175
173
  return;
176
174
  }
177
175
 
178
- const getClient = () => createFeishuClient(firstAccount);
176
+ type FeishuWikiExecuteParams = FeishuWikiParams & { accountId?: string };
179
177
 
180
178
  api.registerTool(
181
- {
182
- name: "feishu_wiki",
183
- label: "Feishu Wiki",
184
- description:
185
- "Feishu knowledge base operations. Actions: spaces, nodes, get, create, move, rename",
186
- parameters: FeishuWikiSchema,
187
- async execute(_toolCallId, params) {
188
- const p = params as FeishuWikiParams;
189
- try {
190
- const client = getClient();
191
- switch (p.action) {
192
- case "spaces":
193
- return json(await listSpaces(client));
194
- case "nodes":
195
- return json(await listNodes(client, p.space_id, p.parent_node_token));
196
- case "get":
197
- return json(await getNode(client, p.token));
198
- case "search":
199
- return json({
200
- error:
201
- "Search is not available. Use feishu_wiki with action: 'nodes' to browse or action: 'get' to lookup by token.",
202
- });
203
- case "create":
204
- return json(
205
- await createNode(client, p.space_id, p.title, p.obj_type, p.parent_node_token),
206
- );
207
- case "move":
208
- return json(
209
- await moveNode(
210
- client,
211
- p.space_id,
212
- p.node_token,
213
- p.target_space_id,
214
- p.target_parent_token,
215
- ),
216
- );
217
- case "rename":
218
- return json(await renameNode(client, p.space_id, p.node_token, p.title));
219
- default:
220
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- exhaustive check fallback
221
- return json({ error: `Unknown action: ${(p as any).action}` });
179
+ (ctx) => {
180
+ const defaultAccountId = ctx.agentAccountId;
181
+ return {
182
+ name: "feishu_wiki",
183
+ label: "Feishu Wiki",
184
+ description:
185
+ "Feishu knowledge base operations. Actions: spaces, nodes, get, create, move, rename",
186
+ parameters: FeishuWikiSchema,
187
+ async execute(_toolCallId, params) {
188
+ const p = params as FeishuWikiExecuteParams;
189
+ try {
190
+ const client = createFeishuToolClient({
191
+ api,
192
+ executeParams: p,
193
+ defaultAccountId,
194
+ });
195
+ switch (p.action) {
196
+ case "spaces":
197
+ return json(await listSpaces(client));
198
+ case "nodes":
199
+ return json(await listNodes(client, p.space_id, p.parent_node_token));
200
+ case "get":
201
+ return json(await getNode(client, p.token));
202
+ case "search":
203
+ return json({
204
+ error:
205
+ "Search is not available. Use feishu_wiki with action: 'nodes' to browse or action: 'get' to lookup by token.",
206
+ });
207
+ case "create":
208
+ return json(
209
+ await createNode(client, p.space_id, p.title, p.obj_type, p.parent_node_token),
210
+ );
211
+ case "move":
212
+ return json(
213
+ await moveNode(
214
+ client,
215
+ p.space_id,
216
+ p.node_token,
217
+ p.target_space_id,
218
+ p.target_parent_token,
219
+ ),
220
+ );
221
+ case "rename":
222
+ return json(await renameNode(client, p.space_id, p.node_token, p.title));
223
+ default:
224
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- exhaustive check fallback
225
+ return json({ error: `Unknown action: ${(p as any).action}` });
226
+ }
227
+ } catch (err) {
228
+ return json({ error: err instanceof Error ? err.message : String(err) });
222
229
  }
223
- } catch (err) {
224
- return json({ error: err instanceof Error ? err.message : String(err) });
225
- }
226
- },
230
+ },
231
+ };
227
232
  },
228
233
  { name: "feishu_wiki" },
229
234
  );