@m1heng-clawd/feishu 0.1.11 → 0.1.13
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/README.md +183 -14
- package/index.ts +6 -6
- package/package.json +13 -3
- package/skills/feishu-doc/SKILL.md +40 -2
- package/skills/feishu-task/SKILL.md +210 -0
- package/src/bitable-tools/index.ts +1 -0
- package/src/bot.ts +181 -70
- package/src/channel.ts +4 -0
- package/src/config-schema.ts +6 -0
- package/src/doc-tools/actions.ts +341 -0
- package/src/doc-tools/common.ts +33 -0
- package/src/doc-tools/index.ts +2 -0
- package/src/doc-tools/register.ts +90 -0
- package/src/{doc-schema.ts → doc-tools/schemas.ts} +31 -1
- package/src/drive-tools/actions.ts +182 -0
- package/src/drive-tools/common.ts +18 -0
- package/src/drive-tools/index.ts +2 -0
- package/src/drive-tools/register.ts +71 -0
- package/src/{drive-schema.ts → drive-tools/schemas.ts} +2 -1
- package/src/media.ts +29 -7
- package/src/perm-tools/actions.ts +111 -0
- package/src/perm-tools/common.ts +18 -0
- package/src/perm-tools/index.ts +2 -0
- package/src/perm-tools/register.ts +65 -0
- package/src/policy.ts +13 -0
- package/src/reply-dispatcher.ts +7 -5
- package/src/send.ts +33 -2
- package/src/streaming-card.ts +11 -8
- package/src/task-tools/actions.ts +468 -13
- package/src/task-tools/constants.ts +13 -0
- package/src/task-tools/index.ts +1 -0
- package/src/task-tools/register.ts +175 -13
- package/src/task-tools/schemas.ts +422 -4
- package/src/text/markdown-links.ts +104 -0
- package/src/types.ts +1 -0
- package/src/wiki-tools/actions.ts +166 -0
- package/src/wiki-tools/common.ts +18 -0
- package/src/wiki-tools/index.ts +2 -0
- package/src/wiki-tools/register.ts +66 -0
- package/src/bitable.ts +0 -1
- package/src/docx.ts +0 -276
- package/src/drive.ts +0 -237
- package/src/perm.ts +0 -165
- package/src/task.ts +0 -1
- package/src/wiki.ts +0 -223
- /package/src/{perm-schema.ts → perm-tools/schemas.ts} +0 -0
- /package/src/{wiki-schema.ts → wiki-tools/schemas.ts} +0 -0
package/README.md
CHANGED
|
@@ -5,6 +5,12 @@ Feishu/Lark (飞书) channel plugin for [OpenClaw](https://github.com/openclaw/o
|
|
|
5
5
|
> **中文社区资料** - 配置教程、常见问题、使用技巧:[Wiki](https://github.com/m1heng/clawdbot-feishu/wiki)
|
|
6
6
|
>
|
|
7
7
|
> **Contributing / 贡献指南**: [CONTRIBUTING.md](./CONTRIBUTING.md)
|
|
8
|
+
>
|
|
9
|
+
> **Issue Reporting / 问题反馈**: Please check [Discussions](https://github.com/m1heng/clawdbot-feishu/discussions) first for common solutions, then open a structured Issue Form if needed.
|
|
10
|
+
> 问题反馈前请先查看 [Discussions](https://github.com/m1heng/clawdbot-feishu/discussions) 是否已有常见解答;如仍未解决,再提交结构化 Issue 模板。
|
|
11
|
+
>
|
|
12
|
+
> **Questions / 使用咨询**: Use `Question` issue for troubleshooting; use [Discussions](https://github.com/m1heng/clawdbot-feishu/discussions) for open-ended Q&A.
|
|
13
|
+
> 排查型咨询请提交 `Question` Issue;开放式交流请使用 [Discussions](https://github.com/m1heng/clawdbot-feishu/discussions)。
|
|
8
14
|
|
|
9
15
|
[English](#english) | [中文](#中文)
|
|
10
16
|
|
|
@@ -21,14 +27,33 @@ openclaw plugins install @m1heng-clawd/feishu
|
|
|
21
27
|
> [!IMPORTANT]
|
|
22
28
|
> **Windows Troubleshooting (`spawn npm ENOENT`)**
|
|
23
29
|
>
|
|
24
|
-
> If `openclaw plugins install` fails, install manually:
|
|
30
|
+
> If `openclaw plugins install` fails, install manually with the latest tarball:
|
|
31
|
+
>
|
|
32
|
+
> ```bash
|
|
33
|
+
> # Option A (recommended): download latest package tarball
|
|
34
|
+
> npm pack @m1heng-clawd/feishu
|
|
35
|
+
> openclaw plugins install ./m1heng-clawd-feishu-<version>.tgz
|
|
36
|
+
> ```
|
|
25
37
|
>
|
|
26
38
|
> ```bash
|
|
27
|
-
> #
|
|
28
|
-
>
|
|
39
|
+
> # Option B (keep curl flow): resolve latest tarball URL, then download/install
|
|
40
|
+
> TARBALL_URL="$(npm view @m1heng-clawd/feishu dist.tarball)"
|
|
41
|
+
> curl -L -o feishu-latest.tgz "$TARBALL_URL"
|
|
42
|
+
> openclaw plugins install ./feishu-latest.tgz
|
|
43
|
+
> ```
|
|
29
44
|
>
|
|
30
|
-
>
|
|
31
|
-
>
|
|
45
|
+
> ```powershell
|
|
46
|
+
> # Windows PowerShell (Option B)
|
|
47
|
+
> $tarball = npm view @m1heng-clawd/feishu dist.tarball
|
|
48
|
+
> curl.exe -L $tarball -o feishu-latest.tgz
|
|
49
|
+
> openclaw plugins install .\feishu-latest.tgz
|
|
50
|
+
> ```
|
|
51
|
+
>
|
|
52
|
+
> ```bash
|
|
53
|
+
> # Option C (no npm command): use URL template with latest version from npm Versions tab
|
|
54
|
+
> # https://www.npmjs.com/package/@m1heng-clawd/feishu?activeTab=versions
|
|
55
|
+
> curl -L -o feishu-latest.tgz https://registry.npmjs.org/@m1heng-clawd/feishu/-/feishu-<version>.tgz
|
|
56
|
+
> openclaw plugins install ./feishu-latest.tgz
|
|
32
57
|
> ```
|
|
33
58
|
|
|
34
59
|
### Upgrade
|
|
@@ -37,6 +62,12 @@ openclaw plugins install @m1heng-clawd/feishu
|
|
|
37
62
|
openclaw plugins update feishu
|
|
38
63
|
```
|
|
39
64
|
|
|
65
|
+
Check installed version:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
openclaw plugins list | rg -i feishu
|
|
69
|
+
```
|
|
70
|
+
|
|
40
71
|
### Configuration
|
|
41
72
|
|
|
42
73
|
1. Create a self-built app on [Feishu Open Platform](https://open.feishu.cn)
|
|
@@ -77,6 +108,9 @@ openclaw plugins update feishu
|
|
|
77
108
|
| `wiki:wiki:readonly` | `feishu_wiki` | List spaces, list nodes, get node info, search |
|
|
78
109
|
| `bitable:app:readonly` | `feishu_bitable` | Read bitable records and fields |
|
|
79
110
|
| `task:task:read` | `feishu_task_get` | Get task details |
|
|
111
|
+
| `task:tasklist:read` | `feishu_tasklist_get`, `feishu_tasklist_list` | Get/list tasklists |
|
|
112
|
+
| `task:comment:read` | `feishu_task_comment_list`, `feishu_task_comment_get` | List/get task comments |
|
|
113
|
+
| `task:attachment:read` | `feishu_task_attachment_list`, `feishu_task_attachment_get` | List/get task attachments |
|
|
80
114
|
|
|
81
115
|
**Read-write** (optional, for create/edit/delete operations):
|
|
82
116
|
|
|
@@ -87,9 +121,44 @@ openclaw plugins update feishu
|
|
|
87
121
|
| `drive:drive` | `feishu_doc`, `feishu_drive` | Upload images to documents, create folders, move/delete files |
|
|
88
122
|
| `wiki:wiki` | `feishu_wiki` | Create/move/rename wiki nodes |
|
|
89
123
|
| `bitable:app` | `feishu_bitable` | Create/update/delete bitable records and manage fields |
|
|
90
|
-
| `task:task:write` | `feishu_task_create`, `feishu_task_update`, `feishu_task_delete` | Create/update/delete tasks |
|
|
124
|
+
| `task:task:write` | `feishu_task_create`, `feishu_task_subtask_create`, `feishu_task_update`, `feishu_task_delete` | Create/update/delete tasks |
|
|
125
|
+
| `task:tasklist:write` | `feishu_tasklist_create`, `feishu_tasklist_update`, `feishu_tasklist_delete`, `feishu_tasklist_add_members`, `feishu_tasklist_remove_members`, `feishu_task_add_tasklist`, `feishu_task_remove_tasklist` | Create/update/delete tasklists and manage membership |
|
|
126
|
+
| `task:comment:write` | `feishu_task_comment_create`, `feishu_task_comment_update`, `feishu_task_comment_delete` | Create/update/delete task comments |
|
|
127
|
+
| `task:attachment:write` | `feishu_task_attachment_upload`, `feishu_task_attachment_delete` | Upload/delete task attachments |
|
|
128
|
+
|
|
129
|
+
> Task scope names may vary slightly in Feishu console UI. If needed, search for Task / Tasklist / Comment / Attachment-related permissions and grant read/write accordingly.
|
|
130
|
+
|
|
131
|
+
#### Task Comment Scopes ⚠️
|
|
91
132
|
|
|
92
|
-
|
|
133
|
+
Task comments require dedicated scopes:
|
|
134
|
+
1. Read comments: grant `task:comment:read`.
|
|
135
|
+
2. Create/update/delete comments: grant `task:comment:write`.
|
|
136
|
+
|
|
137
|
+
If these scopes are missing, comment APIs will return permission-denied errors.
|
|
138
|
+
|
|
139
|
+
#### Task Attachment Upload ⚠️
|
|
140
|
+
|
|
141
|
+
Task attachments support upload/get/list/delete. Upload sources:
|
|
142
|
+
1. Local files on the OpenClaw/Node host (`file_path`)
|
|
143
|
+
2. Remote links (`file_url`, public or presigned)
|
|
144
|
+
|
|
145
|
+
For `file_url`, OpenClaw runtime media loader is used with safety checks and size limit (`mediaMaxMb`), then the downloaded file is uploaded via a temporary local file.
|
|
146
|
+
|
|
147
|
+
#### Tasklist Ownership ⚠️
|
|
148
|
+
|
|
149
|
+
> **Important:** Keep tasklist owner as the bot. Add users as members instead.
|
|
150
|
+
|
|
151
|
+
Tasklist access is granted based on owner + member roles. If you change the owner to a user and the bot is not a member, the bot may lose permission to read/edit/manage that tasklist (and subsequent operations will fail).
|
|
152
|
+
|
|
153
|
+
#### Task Visibility & Subtasks ⚠️
|
|
154
|
+
|
|
155
|
+
> **Important:** A user can only view a task when they are included as an assignee.
|
|
156
|
+
>
|
|
157
|
+
> **Limitation:** The bot can currently only create subtasks for tasks created by itself.
|
|
158
|
+
|
|
159
|
+
To avoid “task created but not visible” issues:
|
|
160
|
+
1. When creating a task, set the requesting user as an assignee.
|
|
161
|
+
2. If you need more flexible subtask organization/visibility, consider using tasklists.
|
|
93
162
|
|
|
94
163
|
#### Drive Access ⚠️
|
|
95
164
|
|
|
@@ -174,6 +243,10 @@ channels:
|
|
|
174
243
|
groupPolicy: "allowlist"
|
|
175
244
|
# Require @mention in groups
|
|
176
245
|
requireMention: true
|
|
246
|
+
# Group command mention bypass: "never" | "single_bot" | "always"
|
|
247
|
+
# Default "single_bot": allow authorized command-only messages without @
|
|
248
|
+
# only when the group has a single bot.
|
|
249
|
+
groupCommandMentionBypass: "single_bot"
|
|
177
250
|
# Max media size in MB (default: 30)
|
|
178
251
|
mediaMaxMb: 30
|
|
179
252
|
# Render mode for bot replies: "auto" | "raw" | "card"
|
|
@@ -255,6 +328,21 @@ Top-level `channels.feishu.dmPolicy` / `channels.feishu.allowFrom` are fallback
|
|
|
255
328
|
> `dmPolicy` only controls who can trigger the bot.
|
|
256
329
|
> To actually read/write docs or files, you still need: (1) correct Feishu app scopes, and (2) sharing the target resources (Drive/Wiki/Bitable) with the bot.
|
|
257
330
|
|
|
331
|
+
#### Group Command Mention Bypass
|
|
332
|
+
|
|
333
|
+
When `requireMention: true`, Feishu can still allow authorized control commands (such as `/new`) without `@bot`.
|
|
334
|
+
|
|
335
|
+
| `groupCommandMentionBypass` | Behavior |
|
|
336
|
+
|----------------------------|----------|
|
|
337
|
+
| `never` | Never bypass `@` requirement for group commands. |
|
|
338
|
+
| `single_bot` | Bypass only when the group contains at most one bot (default). |
|
|
339
|
+
| `always` | Always allow authorized control commands to bypass mention gating. |
|
|
340
|
+
|
|
341
|
+
Notes:
|
|
342
|
+
- Bypass only applies to authorized control commands in group chats.
|
|
343
|
+
- If any user is explicitly `@`-mentioned in the same message, bypass is disabled.
|
|
344
|
+
- In DMs, this setting does not apply.
|
|
345
|
+
|
|
258
346
|
#### Connection Mode
|
|
259
347
|
|
|
260
348
|
Two connection modes are available for receiving events from Feishu:
|
|
@@ -415,14 +503,33 @@ openclaw plugins install @m1heng-clawd/feishu
|
|
|
415
503
|
> [!IMPORTANT]
|
|
416
504
|
> **Windows 排错(`spawn npm ENOENT`)**
|
|
417
505
|
>
|
|
418
|
-
> 如果 `openclaw plugins install`
|
|
506
|
+
> 如果 `openclaw plugins install` 失败,可通过最新 tarball 手动安装:
|
|
507
|
+
>
|
|
508
|
+
> ```bash
|
|
509
|
+
> # 方案 A(推荐):下载最新插件 tarball
|
|
510
|
+
> npm pack @m1heng-clawd/feishu
|
|
511
|
+
> openclaw plugins install ./m1heng-clawd-feishu-<version>.tgz
|
|
512
|
+
> ```
|
|
419
513
|
>
|
|
420
514
|
> ```bash
|
|
421
|
-
> #
|
|
422
|
-
>
|
|
515
|
+
> # 方案 B(保留 curl 路径):先解析最新 tarball 地址,再下载安装
|
|
516
|
+
> TARBALL_URL="$(npm view @m1heng-clawd/feishu dist.tarball)"
|
|
517
|
+
> curl -L -o feishu-latest.tgz "$TARBALL_URL"
|
|
518
|
+
> openclaw plugins install ./feishu-latest.tgz
|
|
519
|
+
> ```
|
|
520
|
+
>
|
|
521
|
+
> ```powershell
|
|
522
|
+
> # Windows PowerShell(方案 B)
|
|
523
|
+
> $tarball = npm view @m1heng-clawd/feishu dist.tarball
|
|
524
|
+
> curl.exe -L $tarball -o feishu-latest.tgz
|
|
525
|
+
> openclaw plugins install .\feishu-latest.tgz
|
|
526
|
+
> ```
|
|
423
527
|
>
|
|
424
|
-
>
|
|
425
|
-
>
|
|
528
|
+
> ```bash
|
|
529
|
+
> # 方案 C(无 npm 命令):先在 npm Versions 页查到最新版本号,再套用 URL 模板
|
|
530
|
+
> # https://www.npmjs.com/package/@m1heng-clawd/feishu?activeTab=versions
|
|
531
|
+
> curl -L -o feishu-latest.tgz https://registry.npmjs.org/@m1heng-clawd/feishu/-/feishu-<version>.tgz
|
|
532
|
+
> openclaw plugins install ./feishu-latest.tgz
|
|
426
533
|
> ```
|
|
427
534
|
|
|
428
535
|
### 升级
|
|
@@ -431,6 +538,12 @@ openclaw plugins install @m1heng-clawd/feishu
|
|
|
431
538
|
openclaw plugins update feishu
|
|
432
539
|
```
|
|
433
540
|
|
|
541
|
+
查看已安装版本:
|
|
542
|
+
|
|
543
|
+
```bash
|
|
544
|
+
openclaw plugins list | rg -i feishu
|
|
545
|
+
```
|
|
546
|
+
|
|
434
547
|
### 配置
|
|
435
548
|
|
|
436
549
|
1. 在 [飞书开放平台](https://open.feishu.cn) 创建自建应用
|
|
@@ -471,6 +584,9 @@ openclaw plugins update feishu
|
|
|
471
584
|
| `wiki:wiki:readonly` | `feishu_wiki` | 列出空间、列出节点、获取节点详情、搜索 |
|
|
472
585
|
| `bitable:app:readonly` | `feishu_bitable` | 读取多维表格记录和字段 |
|
|
473
586
|
| `task:task:read` | `feishu_task_get` | 获取任务详情 |
|
|
587
|
+
| `task:tasklist:read` | `feishu_tasklist_get`, `feishu_tasklist_list` | 获取/列出任务清单(tasklists) |
|
|
588
|
+
| `task:comment:read` | `feishu_task_comment_list`, `feishu_task_comment_get` | 列出/获取任务评论 |
|
|
589
|
+
| `task:attachment:read` | `feishu_task_attachment_list`, `feishu_task_attachment_get` | 列出/获取任务附件 |
|
|
474
590
|
|
|
475
591
|
**读写权限**(可选,用于创建/编辑/删除操作):
|
|
476
592
|
|
|
@@ -481,9 +597,44 @@ openclaw plugins update feishu
|
|
|
481
597
|
| `drive:drive` | `feishu_doc`, `feishu_drive` | 上传图片到文档、创建文件夹、移动/删除文件 |
|
|
482
598
|
| `wiki:wiki` | `feishu_wiki` | 创建/移动/重命名知识库节点 |
|
|
483
599
|
| `bitable:app` | `feishu_bitable` | 创建/更新/删除多维表格记录并管理字段 |
|
|
484
|
-
| `task:task:write` | `feishu_task_create`, `feishu_task_update`, `feishu_task_delete` | 创建/更新/删除任务 |
|
|
600
|
+
| `task:task:write` | `feishu_task_create`, `feishu_task_subtask_create`, `feishu_task_update`, `feishu_task_delete` | 创建/更新/删除任务 |
|
|
601
|
+
| `task:tasklist:write` | `feishu_tasklist_create`, `feishu_tasklist_update`, `feishu_tasklist_delete`, `feishu_tasklist_add_members`, `feishu_tasklist_remove_members`, `feishu_task_add_tasklist`, `feishu_task_remove_tasklist` | 创建/更新/删除任务清单并管理成员/关联任务 |
|
|
602
|
+
| `task:comment:write` | `feishu_task_comment_create`, `feishu_task_comment_update`, `feishu_task_comment_delete` | 创建/更新/删除任务评论 |
|
|
603
|
+
| `task:attachment:write` | `feishu_task_attachment_upload`, `feishu_task_attachment_delete` | 上传/删除任务附件 |
|
|
604
|
+
|
|
605
|
+
> 飞书控制台中任务权限的显示名称可能略有差异,必要时可按关键字 `task` / `tasklist` / `comment` / `attachment` 搜索并授予对应读写权限。
|
|
606
|
+
|
|
607
|
+
#### 任务评论权限 ⚠️
|
|
608
|
+
|
|
609
|
+
任务评论需要单独授权:
|
|
610
|
+
1. 读取评论:授予 `task:comment:read`。
|
|
611
|
+
2. 创建/更新/删除评论:授予 `task:comment:write`。
|
|
485
612
|
|
|
486
|
-
|
|
613
|
+
缺少上述权限时,评论相关接口会返回权限不足错误。
|
|
614
|
+
|
|
615
|
+
#### 任务附件上传 ⚠️
|
|
616
|
+
|
|
617
|
+
任务附件支持上传/获取/列表/删除。上传来源:
|
|
618
|
+
1. OpenClaw/Node 所在机器的本地文件路径(`file_path`)
|
|
619
|
+
2. 可直接下载的远程链接(`file_url`,公开/预签名 URL)
|
|
620
|
+
|
|
621
|
+
`file_url` 上传路径会使用 OpenClaw 运行时的媒体下载安全校验与大小限制(`mediaMaxMb`),随后经临时本地文件上传到任务附件。
|
|
622
|
+
|
|
623
|
+
#### 任务清单所有者限制 ⚠️
|
|
624
|
+
|
|
625
|
+
> **重要:** 创建/修改任务清单时,请保持清单所有者为机器人本身,只把用户作为协作人添加。
|
|
626
|
+
|
|
627
|
+
任务清单权限基于“所有者 + 协作成员角色”授予。如果把清单所有者改成用户、且机器人不在协作成员中,机器人可能会失去对该清单的读取/编辑/管理权限,导致后续对清单的操作失败。
|
|
628
|
+
|
|
629
|
+
#### 任务限制 ⚠️
|
|
630
|
+
|
|
631
|
+
> **重要:** 只有当任务责任人包含用户时,用户才能查看到该任务。
|
|
632
|
+
>
|
|
633
|
+
> **限制:** 机器人目前只能给自己创建出来的任务创建子任务。
|
|
634
|
+
|
|
635
|
+
为避免“任务创建了但用户看不到”的问题:
|
|
636
|
+
1. 创建任务时,请把发起用户设为任务负责人(`assignee`)。
|
|
637
|
+
2. 如需更灵活的子任务创建/组织/可见性管理,建议使用任务清单(tasklists)。
|
|
487
638
|
|
|
488
639
|
#### 云空间访问权限 ⚠️
|
|
489
640
|
|
|
@@ -568,6 +719,9 @@ channels:
|
|
|
568
719
|
groupPolicy: "allowlist"
|
|
569
720
|
# 群聊是否需要 @机器人
|
|
570
721
|
requireMention: true
|
|
722
|
+
# 群聊命令绕过 @ 策略: "never" | "single_bot" | "always"
|
|
723
|
+
# 默认 "single_bot":仅当群内机器人数量 <= 1 时,允许已授权命令免 @
|
|
724
|
+
groupCommandMentionBypass: "single_bot"
|
|
571
725
|
# 媒体文件最大大小 (MB, 默认 30)
|
|
572
726
|
mediaMaxMb: 30
|
|
573
727
|
# 回复渲染模式: "auto" | "raw" | "card"
|
|
@@ -649,6 +803,21 @@ channels:
|
|
|
649
803
|
> `dmPolicy` 只控制“是否允许触发机器人”。
|
|
650
804
|
> 真正执行文档/云盘/知识库/多维表格操作,还需要两层权限:1)应用 API 权限(scopes);2)把目标资源分享给机器人。
|
|
651
805
|
|
|
806
|
+
#### 群聊命令免 @ 策略
|
|
807
|
+
|
|
808
|
+
当 `requireMention: true` 时,Feishu 仍可让“已授权控制命令(如 `/new`)”在不 `@bot` 的情况下通过。
|
|
809
|
+
|
|
810
|
+
| `groupCommandMentionBypass` | 行为 |
|
|
811
|
+
|----------------------------|------|
|
|
812
|
+
| `never` | 群聊命令永不绕过 `@` 校验。 |
|
|
813
|
+
| `single_bot` | 仅当群内机器人数量不超过 1 个时才允许绕过(默认)。 |
|
|
814
|
+
| `always` | 已授权控制命令始终可绕过 `@` 校验。 |
|
|
815
|
+
|
|
816
|
+
说明:
|
|
817
|
+
- 仅对群聊中的“已授权控制命令”生效。
|
|
818
|
+
- 同一条消息里如果显式 `@` 了任意用户,则不会触发命令免 `@`。
|
|
819
|
+
- 私聊场景不受该配置影响。
|
|
820
|
+
|
|
652
821
|
#### 连接模式
|
|
653
822
|
|
|
654
823
|
支持两种从飞书接收事件的连接模式:
|
package/index.ts
CHANGED
|
@@ -2,12 +2,12 @@ import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
|
2
2
|
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
|
|
3
3
|
import { feishuPlugin } from "./src/channel.js";
|
|
4
4
|
import { setFeishuRuntime } from "./src/runtime.js";
|
|
5
|
-
import { registerFeishuDocTools } from "./src/
|
|
6
|
-
import { registerFeishuWikiTools } from "./src/wiki.js";
|
|
7
|
-
import { registerFeishuDriveTools } from "./src/drive.js";
|
|
8
|
-
import { registerFeishuPermTools } from "./src/perm.js";
|
|
9
|
-
import { registerFeishuBitableTools } from "./src/bitable.js";
|
|
10
|
-
import { registerFeishuTaskTools } from "./src/task.js";
|
|
5
|
+
import { registerFeishuDocTools } from "./src/doc-tools/index.js";
|
|
6
|
+
import { registerFeishuWikiTools } from "./src/wiki-tools/index.js";
|
|
7
|
+
import { registerFeishuDriveTools } from "./src/drive-tools/index.js";
|
|
8
|
+
import { registerFeishuPermTools } from "./src/perm-tools/index.js";
|
|
9
|
+
import { registerFeishuBitableTools } from "./src/bitable-tools/index.js";
|
|
10
|
+
import { registerFeishuTaskTools } from "./src/task-tools/index.js";
|
|
11
11
|
|
|
12
12
|
export { monitorFeishuProvider } from "./src/monitor.js";
|
|
13
13
|
export {
|
package/package.json
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m1heng-clawd/feishu",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenClaw Feishu/Lark channel plugin",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test:unit": "vitest run",
|
|
8
|
+
"test:unit:watch": "vitest",
|
|
9
|
+
"test:coverage": "vitest run --coverage",
|
|
10
|
+
"ci:check": "npx tsc --noEmit && npm run test:coverage"
|
|
11
|
+
},
|
|
6
12
|
"license": "MIT",
|
|
7
13
|
"files": [
|
|
8
14
|
"index.ts",
|
|
9
|
-
"src",
|
|
15
|
+
"src/**/*.ts",
|
|
16
|
+
"!src/**/__tests__/**",
|
|
17
|
+
"!src/**/*.test.ts",
|
|
10
18
|
"skills",
|
|
11
19
|
"openclaw.plugin.json"
|
|
12
20
|
],
|
|
@@ -51,10 +59,12 @@
|
|
|
51
59
|
"zod": "^4.3.6"
|
|
52
60
|
},
|
|
53
61
|
"devDependencies": {
|
|
62
|
+
"@vitest/coverage-v8": "^2.1.8",
|
|
54
63
|
"@types/node": "^25.0.10",
|
|
55
64
|
"openclaw": "2026.2.13",
|
|
56
65
|
"tsx": "^4.21.0",
|
|
57
|
-
"typescript": "^5.7.0"
|
|
66
|
+
"typescript": "^5.7.0",
|
|
67
|
+
"vitest": "^2.1.8"
|
|
58
68
|
},
|
|
59
69
|
"peerDependencies": {
|
|
60
70
|
"openclaw": ">=2026.2.13"
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: feishu-doc
|
|
3
3
|
description: |
|
|
4
|
-
Feishu document read/write operations. Activate when user mentions Feishu docs, cloud docs, or
|
|
4
|
+
Feishu document read/write operations + comment management. Activate when user mentions Feishu docs, cloud docs, docx links, or document comments.
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Feishu Document Tool
|
|
8
8
|
|
|
9
|
-
Single tool `feishu_doc` with action parameter for all document operations.
|
|
9
|
+
Single tool `feishu_doc` with action parameter for all document operations including comment management.
|
|
10
10
|
|
|
11
11
|
## Token Extraction
|
|
12
12
|
|
|
13
13
|
From URL `https://xxx.feishu.cn/docx/ABC123def` → `doc_token` = `ABC123def`
|
|
14
|
+
From URL `https://xxx.feishu.cn/docs/doccn123c` → `doc_token` = `doccn123c`
|
|
14
15
|
|
|
15
16
|
## Actions
|
|
16
17
|
|
|
@@ -101,6 +102,39 @@ Returns full block data including tables, images. Use this to read structured co
|
|
|
101
102
|
{ "action": "delete_block", "doc_token": "ABC123def", "block_id": "doxcnXXX" }
|
|
102
103
|
```
|
|
103
104
|
|
|
105
|
+
### List Comments
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{ "action": "list_comments", "doc_token": "ABC123def", "page_size": 50 }
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Returns all comments for the document. Use `page_token` for pagination. Comments include `is_whole` field to distinguish between whole-document comments (true) and block-level comments (false).
|
|
112
|
+
|
|
113
|
+
### Get Single Comment
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{ "action": "get_comment", "doc_token": "ABC123def", "comment_id": "comment_xxx" }
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Create Comment
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{ "action": "create_comment", "doc_token": "ABC123def", "content": "Comment text" }
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### List Comment Replies
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{ "action": "list_comment_replies", "doc_token": "ABC123def", "comment_id": "comment_xxx", "page_size": 50 }
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
`page_size` should be a positive integer. If omitted, tool defaults to `50`.
|
|
132
|
+
|
|
133
|
+
### Comment Write Scope
|
|
134
|
+
|
|
135
|
+
Current tool provides documented comment write action `create_comment` (global comment creation).
|
|
136
|
+
For replies, use `list_comment_replies` for retrieval; the reply creation endpoint is not exposed in current SDK surface.
|
|
137
|
+
|
|
104
138
|
## Reading Workflow
|
|
105
139
|
|
|
106
140
|
1. Start with `action: "read"` - get plain text + statistics
|
|
@@ -121,3 +155,7 @@ channels:
|
|
|
121
155
|
## Permissions
|
|
122
156
|
|
|
123
157
|
Required: `docx:document`, `docx:document:readonly`, `docx:document.block:convert`, `drive:drive`
|
|
158
|
+
|
|
159
|
+
For comment operations:
|
|
160
|
+
- Read comments: `docx:document.comment:read`
|
|
161
|
+
- Write comments: `docx:document.comment` (optional, for create_comment)
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: feishu-task
|
|
3
|
+
description: |
|
|
4
|
+
Feishu Task, tasklist, subtask, comment, and attachment management. Activate when user mentions tasks, tasklists, subtasks, task comments, task attachments, or task links.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Feishu Task Tools
|
|
8
|
+
|
|
9
|
+
Tools:
|
|
10
|
+
- `feishu_task_create`
|
|
11
|
+
- `feishu_task_subtask_create`
|
|
12
|
+
- `feishu_task_get`
|
|
13
|
+
- `feishu_task_update`
|
|
14
|
+
- `feishu_task_delete`
|
|
15
|
+
- `feishu_task_comment_create`
|
|
16
|
+
- `feishu_task_comment_list`
|
|
17
|
+
- `feishu_task_comment_get`
|
|
18
|
+
- `feishu_task_comment_update`
|
|
19
|
+
- `feishu_task_comment_delete`
|
|
20
|
+
- `feishu_task_attachment_upload`
|
|
21
|
+
- `feishu_task_attachment_list`
|
|
22
|
+
- `feishu_task_attachment_get`
|
|
23
|
+
- `feishu_task_attachment_delete`
|
|
24
|
+
- `feishu_task_add_tasklist`
|
|
25
|
+
- `feishu_task_remove_tasklist`
|
|
26
|
+
- `feishu_tasklist_create`
|
|
27
|
+
- `feishu_tasklist_get`
|
|
28
|
+
- `feishu_tasklist_list`
|
|
29
|
+
- `feishu_tasklist_update`
|
|
30
|
+
- `feishu_tasklist_delete`
|
|
31
|
+
- `feishu_tasklist_add_members`
|
|
32
|
+
- `feishu_tasklist_remove_members`
|
|
33
|
+
|
|
34
|
+
## Notes
|
|
35
|
+
|
|
36
|
+
- `task_guid` can be taken from a task URL (guid query param) or from `feishu_task_get` output.
|
|
37
|
+
- `comment_id` can be obtained from `feishu_task_comment_list` output.
|
|
38
|
+
- `attachment_guid` can be obtained from `feishu_task_attachment_list` output.
|
|
39
|
+
- `user_id_type` controls returned/accepted user identity type (`open_id`, `user_id`, `union_id`).
|
|
40
|
+
- If no assignee is specified, set the assignee to the requesting user. Avoid creating unassigned tasks because the user may not be able to view them.
|
|
41
|
+
- Task visibility: users can only view tasks when they are included as assignee.
|
|
42
|
+
- Current limitation: the bot can only create subtasks for tasks created by itself.
|
|
43
|
+
- Attachment upload supports local `file_path` and remote `file_url`. Remote URLs are fetched with runtime media safety checks and size limit (`mediaMaxMb`).
|
|
44
|
+
- Keep tasklist owner as the bot. Add users as members to avoid losing bot access.
|
|
45
|
+
- Use tasklist tools for tasklist membership changes; do not use `feishu_task_update` to move tasks between tasklists.
|
|
46
|
+
|
|
47
|
+
## Create Task
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"summary": "Quarterly review",
|
|
52
|
+
"description": "Prepare review notes",
|
|
53
|
+
"due": { "timestamp": "1735689600000", "is_all_day": true },
|
|
54
|
+
"members": [
|
|
55
|
+
{ "id": "ou_xxx", "role": "assignee", "type": "user" }
|
|
56
|
+
],
|
|
57
|
+
"user_id_type": "open_id"
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Create Subtask
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"task_guid": "e297ddff-06ca-4166-b917-4ce57cd3a7a0",
|
|
66
|
+
"summary": "Draft report outline",
|
|
67
|
+
"description": "Collect key metrics",
|
|
68
|
+
"due": { "timestamp": "1735689600000", "is_all_day": true },
|
|
69
|
+
"members": [
|
|
70
|
+
{ "id": "ou_xxx", "role": "assignee", "type": "user" }
|
|
71
|
+
],
|
|
72
|
+
"user_id_type": "open_id"
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Create Comment
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"task_guid": "e297ddff-06ca-4166-b917-4ce57cd3a7a0",
|
|
81
|
+
"content": "Looks good to me",
|
|
82
|
+
"user_id_type": "open_id"
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Upload Attachment (file_path)
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"task_guid": "e297ddff-06ca-4166-b917-4ce57cd3a7a0",
|
|
91
|
+
"file_path": "/path/to/report.pdf",
|
|
92
|
+
"user_id_type": "open_id"
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Upload Attachment (file_url)
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"task_guid": "e297ddff-06ca-4166-b917-4ce57cd3a7a0",
|
|
101
|
+
"file_url": "https://oss-example.com/bucket/report.pdf",
|
|
102
|
+
"filename": "report.pdf",
|
|
103
|
+
"user_id_type": "open_id"
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Tasklist Membership For Tasks
|
|
108
|
+
|
|
109
|
+
### Add Task to Tasklist
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"task_guid": "e297ddff-06ca-4166-b917-4ce57cd3a7a0",
|
|
114
|
+
"tasklist_guid": "cc371766-6584-cf50-a222-c22cd9055004",
|
|
115
|
+
"section_guid": "6d0f9f48-2e06-4e3d-8a0f-acde196e8c61",
|
|
116
|
+
"user_id_type": "open_id"
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Remove Task from Tasklist
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"task_guid": "e297ddff-06ca-4166-b917-4ce57cd3a7a0",
|
|
125
|
+
"tasklist_guid": "cc371766-6584-cf50-a222-c22cd9055004",
|
|
126
|
+
"user_id_type": "open_id"
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Tasklists
|
|
131
|
+
|
|
132
|
+
Tasklists support three roles: owner (read/edit/manage), editor (read/edit), viewer (read).
|
|
133
|
+
|
|
134
|
+
### Create Tasklist
|
|
135
|
+
|
|
136
|
+
```json
|
|
137
|
+
{
|
|
138
|
+
"name": "Project Alpha Tasklist",
|
|
139
|
+
"members": [
|
|
140
|
+
{ "id": "ou_xxx", "type": "user", "role": "editor" }
|
|
141
|
+
],
|
|
142
|
+
"user_id_type": "open_id"
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Get Tasklist
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
{
|
|
150
|
+
"tasklist_guid": "cc371766-6584-cf50-a222-c22cd9055004",
|
|
151
|
+
"user_id_type": "open_id"
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### List Tasklists
|
|
156
|
+
|
|
157
|
+
```json
|
|
158
|
+
{
|
|
159
|
+
"page_size": 50,
|
|
160
|
+
"page_token": "aWQ9NzEwMjMzMjMxMDE=",
|
|
161
|
+
"user_id_type": "open_id"
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Update Tasklist
|
|
166
|
+
|
|
167
|
+
```json
|
|
168
|
+
{
|
|
169
|
+
"tasklist_guid": "cc371766-6584-cf50-a222-c22cd9055004",
|
|
170
|
+
"tasklist": {
|
|
171
|
+
"name": "Renamed Tasklist",
|
|
172
|
+
"owner": { "id": "ou_xxx", "type": "user", "role": "owner" }
|
|
173
|
+
},
|
|
174
|
+
"update_fields": ["name", "owner"],
|
|
175
|
+
"origin_owner_to_role": "editor",
|
|
176
|
+
"user_id_type": "open_id"
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Delete Tasklist
|
|
181
|
+
|
|
182
|
+
```json
|
|
183
|
+
{
|
|
184
|
+
"tasklist_guid": "cc371766-6584-cf50-a222-c22cd9055004"
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Add Tasklist Members
|
|
189
|
+
|
|
190
|
+
```json
|
|
191
|
+
{
|
|
192
|
+
"tasklist_guid": "cc371766-6584-cf50-a222-c22cd9055004",
|
|
193
|
+
"members": [
|
|
194
|
+
{ "id": "ou_xxx", "type": "user", "role": "editor" }
|
|
195
|
+
],
|
|
196
|
+
"user_id_type": "open_id"
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Remove Tasklist Members
|
|
201
|
+
|
|
202
|
+
```json
|
|
203
|
+
{
|
|
204
|
+
"tasklist_guid": "cc371766-6584-cf50-a222-c22cd9055004",
|
|
205
|
+
"members": [
|
|
206
|
+
{ "id": "ou_xxx", "type": "user", "role": "viewer" }
|
|
207
|
+
],
|
|
208
|
+
"user_id_type": "open_id"
|
|
209
|
+
}
|
|
210
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { registerFeishuBitableTools } from "./register.js";
|