@superbenxxxh/feishu 2.0.1 → 3.0.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/index.ts CHANGED
@@ -1,7 +1,11 @@
1
- import type { ClawdbotPluginApi } from "openclaw/plugin-sdk";
2
- import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
3
- import { feishuPlugin } from "./src/channel.js";
4
- import { setFeishuRuntime } from "./src/runtime.js";
1
+ import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
2
+ import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
3
+ import { feishuPlugin } from "./src/channel.js";
4
+ import { setFeishuRuntime } from "./src/runtime.js";
5
+ import { registerFeishuDocTools } from "./src/docx.js";
6
+ import { registerFeishuWikiTools } from "./src/wiki.js";
7
+ import { registerFeishuDriveTools } from "./src/drive.js";
8
+ import { registerFeishuPermTools } from "./src/perm.js";
5
9
 
6
10
  export { monitorFeishuProvider } from "./src/monitor.js";
7
11
  export {
@@ -40,14 +44,18 @@ export {
40
44
  export { feishuPlugin } from "./src/channel.js";
41
45
 
42
46
  const plugin = {
43
- id: "feishu",
44
- name: "Feishu",
45
- description: "Feishu/Lark channel plugin",
46
- configSchema: emptyPluginConfigSchema(),
47
- register(api: ClawdbotPluginApi) {
48
- setFeishuRuntime(api.runtime);
49
- api.registerChannel({ plugin: feishuPlugin });
50
- },
51
- };
47
+ id: "feishu",
48
+ name: "Feishu",
49
+ description: "Feishu/Lark channel plugin",
50
+ configSchema: emptyPluginConfigSchema(),
51
+ register(api: OpenClawPluginApi) {
52
+ setFeishuRuntime(api.runtime);
53
+ api.registerChannel({ plugin: feishuPlugin });
54
+ registerFeishuDocTools(api);
55
+ registerFeishuWikiTools(api);
56
+ registerFeishuDriveTools(api);
57
+ registerFeishuPermTools(api);
58
+ },
59
+ };
52
60
 
53
61
  export default plugin;
@@ -1,9 +1,10 @@
1
- {
2
- "id": "feishu",
3
- "channels": ["feishu"],
4
- "configSchema": {
5
- "type": "object",
6
- "additionalProperties": false,
7
- "properties": {}
8
- }
9
- }
1
+ {
2
+ "id": "feishu",
3
+ "channels": ["feishu"],
4
+ "skills": ["./skills"],
5
+ "configSchema": {
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "properties": {}
9
+ }
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superbenxxxh/feishu",
3
- "version": "2.0.1",
3
+ "version": "3.0.0",
4
4
  "type": "module",
5
5
  "description": "OpenClaw Feishu/Lark channel plugin",
6
6
  "license": "MIT",
@@ -46,6 +46,7 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@larksuiteoapi/node-sdk": "^1.30.0",
49
+ "@sinclair/typebox": "^0.34.48",
49
50
  "zod": "^4.3.6"
50
51
  },
51
52
  "devDependencies": {
package/src/channel.ts CHANGED
@@ -83,9 +83,20 @@ export const feishuPlugin: ChannelPlugin<ResolvedFeishuAccount> = {
83
83
  historyLimit: { type: "integer", minimum: 0 },
84
84
  dmHistoryLimit: { type: "integer", minimum: 0 },
85
85
  textChunkLimit: { type: "integer", minimum: 1 },
86
- chunkMode: { type: "string", enum: ["length", "newline"] },
87
- mediaMaxMb: { type: "number", minimum: 0 },
86
+ chunkMode: { type: "string", enum: ["length", "newline"] },
87
+ mediaMaxMb: { type: "number", minimum: 0 },
88
88
  renderMode: { type: "string", enum: ["auto", "raw", "post", "card"] },
89
+ tools: {
90
+ type: "object",
91
+ additionalProperties: false,
92
+ properties: {
93
+ doc: { type: "boolean" },
94
+ wiki: { type: "boolean" },
95
+ drive: { type: "boolean" },
96
+ perm: { type: "boolean" },
97
+ scopes: { type: "boolean" },
98
+ },
99
+ },
89
100
  },
90
101
  },
91
102
  },
@@ -42,13 +42,32 @@ const BlockStreamingCoalesceSchema = z
42
42
  .strict()
43
43
  .optional();
44
44
 
45
- const ChannelHeartbeatVisibilitySchema = z
46
- .object({
47
- visibility: z.enum(["visible", "hidden"]).optional(),
48
- intervalMs: z.number().int().positive().optional(),
49
- })
50
- .strict()
51
- .optional();
45
+ const ChannelHeartbeatVisibilitySchema = z
46
+ .object({
47
+ visibility: z.enum(["visible", "hidden"]).optional(),
48
+ intervalMs: z.number().int().positive().optional(),
49
+ })
50
+ .strict()
51
+ .optional();
52
+
53
+ /**
54
+ * Feishu tools configuration.
55
+ * Controls which tool categories are enabled.
56
+ *
57
+ * Dependencies:
58
+ * - wiki requires doc (wiki content is edited via doc tools)
59
+ * - perm can work independently but is typically used with drive
60
+ */
61
+ const FeishuToolsConfigSchema = z
62
+ .object({
63
+ doc: z.boolean().optional(), // Document operations (default: true)
64
+ wiki: z.boolean().optional(), // Knowledge base operations (default: true, requires doc)
65
+ drive: z.boolean().optional(), // Cloud storage operations (default: true)
66
+ perm: z.boolean().optional(), // Permission management (default: false, sensitive)
67
+ scopes: z.boolean().optional(), // App scopes diagnostic (default: true)
68
+ })
69
+ .strict()
70
+ .optional();
52
71
 
53
72
  export const FeishuGroupSchema = z
54
73
  .object({
@@ -86,12 +105,13 @@ export const FeishuConfigSchema = z
86
105
  dms: z.record(z.string(), DmConfigSchema).optional(),
87
106
  textChunkLimit: z.number().int().positive().optional(),
88
107
  chunkMode: z.enum(["length", "newline"]).optional(),
89
- blockStreamingCoalesce: BlockStreamingCoalesceSchema,
90
- mediaMaxMb: z.number().positive().optional(),
91
- heartbeat: ChannelHeartbeatVisibilitySchema,
108
+ blockStreamingCoalesce: BlockStreamingCoalesceSchema,
109
+ mediaMaxMb: z.number().positive().optional(),
110
+ heartbeat: ChannelHeartbeatVisibilitySchema,
92
111
  renderMode: RenderModeSchema, // post = rich text (default), raw = plain text, card = interactive card
112
+ tools: FeishuToolsConfigSchema,
93
113
  })
94
- .strict()
114
+ .strict()
95
115
  .superRefine((value, ctx) => {
96
116
  if (value.dmPolicy === "open") {
97
117
  const allowFrom = value.allowFrom ?? [];
@@ -0,0 +1,47 @@
1
+ import { Type, type Static } from "@sinclair/typebox";
2
+
3
+ export const FeishuDocSchema = Type.Union([
4
+ Type.Object({
5
+ action: Type.Literal("read"),
6
+ doc_token: Type.String({ description: "Document token (extract from URL /docx/XXX)" }),
7
+ }),
8
+ Type.Object({
9
+ action: Type.Literal("write"),
10
+ doc_token: Type.String({ description: "Document token" }),
11
+ content: Type.String({
12
+ description: "Markdown content to write (replaces entire document content)",
13
+ }),
14
+ }),
15
+ Type.Object({
16
+ action: Type.Literal("append"),
17
+ doc_token: Type.String({ description: "Document token" }),
18
+ content: Type.String({ description: "Markdown content to append to end of document" }),
19
+ }),
20
+ Type.Object({
21
+ action: Type.Literal("create"),
22
+ title: Type.String({ description: "Document title" }),
23
+ folder_token: Type.Optional(Type.String({ description: "Target folder token (optional)" })),
24
+ }),
25
+ Type.Object({
26
+ action: Type.Literal("list_blocks"),
27
+ doc_token: Type.String({ description: "Document token" }),
28
+ }),
29
+ Type.Object({
30
+ action: Type.Literal("get_block"),
31
+ doc_token: Type.String({ description: "Document token" }),
32
+ block_id: Type.String({ description: "Block ID (from list_blocks)" }),
33
+ }),
34
+ Type.Object({
35
+ action: Type.Literal("update_block"),
36
+ doc_token: Type.String({ description: "Document token" }),
37
+ block_id: Type.String({ description: "Block ID (from list_blocks)" }),
38
+ content: Type.String({ description: "New text content" }),
39
+ }),
40
+ Type.Object({
41
+ action: Type.Literal("delete_block"),
42
+ doc_token: Type.String({ description: "Document token" }),
43
+ block_id: Type.String({ description: "Block ID" }),
44
+ }),
45
+ ]);
46
+
47
+ export type FeishuDocParams = Static<typeof FeishuDocSchema>;