@max1874/feishu 0.2.21 → 0.2.22

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/docx.ts +58 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@max1874/feishu",
3
- "version": "0.2.21",
3
+ "version": "0.2.22",
4
4
  "type": "module",
5
5
  "description": "OpenClaw Feishu/Lark channel plugin",
6
6
  "license": "MIT",
package/src/docx.ts CHANGED
@@ -865,7 +865,11 @@ export function registerFeishuDocTools(api: OpenClawPluginApi) {
865
865
  {
866
866
  name: "feishu_doc_read",
867
867
  label: "Feishu Doc Read",
868
- description: "Read plain text content and metadata from a Feishu document",
868
+ description:
869
+ "Read plain text content and metadata from a Feishu document. " +
870
+ "Use this for a quick overview of document content. " +
871
+ "For structured content (tables, block details), use feishu_doc_list_blocks instead. " +
872
+ "Extract doc_token from URL: /docx/XXX or /docs/XXX.",
869
873
  parameters: DocTokenSchema,
870
874
  async execute(_toolCallId, params) {
871
875
  const { doc_token } = params as { doc_token: string };
@@ -886,7 +890,10 @@ export function registerFeishuDocTools(api: OpenClawPluginApi) {
886
890
  name: "feishu_doc_create",
887
891
  label: "Feishu Doc Create",
888
892
  description:
889
- "Create a new empty Feishu document. Automatically grants full_access (manage) permission to the current conversation participant.",
893
+ "Create a new empty Feishu document. " +
894
+ "Automatically grants full_access permission to the conversation participant so they can edit. " +
895
+ "After creating, use feishu_doc_write to populate content. " +
896
+ "Set permission='tenant_editable' to allow anyone in the organization to edit via link.",
890
897
  parameters: CreateDocSchema,
891
898
  async execute(_toolCallId, params) {
892
899
  const { title, folder_token, permission } = params as {
@@ -911,7 +918,10 @@ export function registerFeishuDocTools(api: OpenClawPluginApi) {
911
918
  name: "feishu_doc_write",
912
919
  label: "Feishu Doc Write",
913
920
  description:
914
- "Write markdown content to a Feishu document (replaces all content). Supports headings, lists, code blocks, quotes, links, images, tables, and text styling.",
921
+ "Write markdown content to a Feishu document. WARNING: This REPLACES ALL existing content. " +
922
+ "Use for: initial document population, complete rewrites. " +
923
+ "For partial edits, use feishu_doc_update_block instead. " +
924
+ "Supports: headings, lists, code blocks, quotes, links, images, tables, bold/italic/strikethrough.",
915
925
  parameters: WriteDocSchema,
916
926
  async execute(_toolCallId, params) {
917
927
  const { doc_token, content } = params as { doc_token: string; content: string };
@@ -932,7 +942,10 @@ export function registerFeishuDocTools(api: OpenClawPluginApi) {
932
942
  name: "feishu_doc_append",
933
943
  label: "Feishu Doc Append",
934
944
  description:
935
- "Append markdown content to the end of a Feishu document. Supports same markdown syntax as write.",
945
+ "Append markdown content to the END of a Feishu document without touching existing content. " +
946
+ "Use for: adding new sections, logging, incremental content building. " +
947
+ "Cannot insert in the middle - for that, use feishu_doc_update_block or delete+append. " +
948
+ "Supports same markdown syntax as feishu_doc_write.",
936
949
  parameters: AppendDocSchema,
937
950
  async execute(_toolCallId, params) {
938
951
  const { doc_token, content } = params as { doc_token: string; content: string };
@@ -952,7 +965,11 @@ export function registerFeishuDocTools(api: OpenClawPluginApi) {
952
965
  {
953
966
  name: "feishu_doc_update_block",
954
967
  label: "Feishu Doc Update Block",
955
- description: "Update the text content of a specific block in a Feishu document",
968
+ description:
969
+ "Update the text content of a specific block without affecting other parts of the document. " +
970
+ "WORKFLOW: First call feishu_doc_list_blocks to find the block_id, then update it here. " +
971
+ "Use for: fixing typos, updating a paragraph, modifying specific sections. " +
972
+ "Only works on text-based blocks (paragraphs, headings, lists). Cannot change block type.",
956
973
  parameters: UpdateBlockSchema,
957
974
  async execute(_toolCallId, params) {
958
975
  const { doc_token, block_id, content } = params as {
@@ -976,7 +993,11 @@ export function registerFeishuDocTools(api: OpenClawPluginApi) {
976
993
  {
977
994
  name: "feishu_doc_delete_block",
978
995
  label: "Feishu Doc Delete Block",
979
- description: "Delete a specific block from a Feishu document",
996
+ description:
997
+ "Delete a specific block from a Feishu document. " +
998
+ "WORKFLOW: First call feishu_doc_list_blocks to find the block_id, then delete it here. " +
999
+ "Use for: removing outdated content, clearing sections before rewriting. " +
1000
+ "Combine with feishu_doc_append to replace content in the middle of a document.",
980
1001
  parameters: DeleteBlockSchema,
981
1002
  async execute(_toolCallId, params) {
982
1003
  const { doc_token, block_id } = params as { doc_token: string; block_id: string };
@@ -997,7 +1018,10 @@ export function registerFeishuDocTools(api: OpenClawPluginApi) {
997
1018
  name: "feishu_doc_list_blocks",
998
1019
  label: "Feishu Doc List Blocks",
999
1020
  description:
1000
- "List all blocks in a Feishu document with full content. Use this to read structured content like tables. Returns block_id for use with update/delete/get_block.",
1021
+ "List all blocks in a Feishu document with their block_id and full content. " +
1022
+ "ESSENTIAL for editing: returns block_id needed by update_block/delete_block/get_block. " +
1023
+ "Better than feishu_doc_read for: seeing document structure, reading tables, finding specific sections. " +
1024
+ "Block types include: text, headings (1-9), bullet/ordered lists, code, quote, table, image, divider.",
1001
1025
  parameters: DocTokenSchema,
1002
1026
  async execute(_toolCallId, params) {
1003
1027
  const { doc_token } = params as { doc_token: string };
@@ -1017,7 +1041,10 @@ export function registerFeishuDocTools(api: OpenClawPluginApi) {
1017
1041
  {
1018
1042
  name: "feishu_doc_get_block",
1019
1043
  label: "Feishu Doc Get Block",
1020
- description: "Get detailed content of a specific block by ID (from list_blocks)",
1044
+ description:
1045
+ "Get detailed content of a specific block by its block_id. " +
1046
+ "Use when feishu_doc_list_blocks output is truncated or you need fresh data for one block. " +
1047
+ "Returns full block structure including nested content (e.g., table cells).",
1021
1048
  parameters: GetBlockSchema,
1022
1049
  async execute(_toolCallId, params) {
1023
1050
  const { doc_token, block_id } = params as { doc_token: string; block_id: string };
@@ -1037,7 +1064,11 @@ export function registerFeishuDocTools(api: OpenClawPluginApi) {
1037
1064
  {
1038
1065
  name: "feishu_folder_list",
1039
1066
  label: "Feishu Folder List",
1040
- description: "List documents and subfolders in a Feishu folder",
1067
+ description:
1068
+ "List documents and subfolders in a Feishu Drive folder. " +
1069
+ "Extract folder_token from URL: /drive/folder/XXX. " +
1070
+ "Use to browse available documents or find a doc_token to read/edit. " +
1071
+ "Returns: file name, type (docx/sheet/folder/etc), token, URL, last modified time.",
1041
1072
  parameters: FolderTokenSchema,
1042
1073
  async execute(_toolCallId, params) {
1043
1074
  const { folder_token } = params as { folder_token: string };
@@ -1058,7 +1089,9 @@ export function registerFeishuDocTools(api: OpenClawPluginApi) {
1058
1089
  name: "feishu_doc_set_permission",
1059
1090
  label: "Feishu Doc Set Permission",
1060
1091
  description:
1061
- "Set document sharing permission. Use 'tenant_editable' to allow organization members to edit via link.",
1092
+ "Change document sharing permissions after creation. " +
1093
+ "Options: 'tenant_editable' = anyone in organization can edit via link; 'private' = only owner/explicitly granted users. " +
1094
+ "Note: feishu_doc_create already grants full_access to the conversation participant.",
1062
1095
  parameters: SetPermissionSchema,
1063
1096
  async execute(_toolCallId, params) {
1064
1097
  const { doc_token, permission } = params as { doc_token: string; permission: DocPermission };
@@ -1094,7 +1127,10 @@ export function registerFeishuDocTools(api: OpenClawPluginApi) {
1094
1127
  name: "feishu_wiki_read",
1095
1128
  label: "Feishu Wiki Read",
1096
1129
  description:
1097
- "Read content from a Feishu wiki page. Extract wiki_token from URL /wiki/XXX. Returns wiki metadata and document content if the underlying type is docx.",
1130
+ "Read content from a Feishu Wiki (knowledge base) page. " +
1131
+ "Extract wiki_token from URL: /wiki/XXX. " +
1132
+ "Different from feishu_doc_read - wikis have their own token format and metadata. " +
1133
+ "Returns wiki node info and document content if the underlying type is docx.",
1098
1134
  parameters: WikiTokenSchema,
1099
1135
  async execute(_toolCallId, params) {
1100
1136
  const { wiki_token } = params as { wiki_token: string };
@@ -1114,7 +1150,10 @@ export function registerFeishuDocTools(api: OpenClawPluginApi) {
1114
1150
  {
1115
1151
  name: "feishu_wiki_spaces",
1116
1152
  label: "Feishu Wiki Spaces",
1117
- description: "List available wiki spaces (knowledge bases) the app has access to.",
1153
+ description:
1154
+ "List all Wiki spaces (knowledge bases) the app has access to. " +
1155
+ "Returns space_id needed for feishu_wiki_nodes. " +
1156
+ "Use this first when browsing wikis to find the right knowledge base.",
1118
1157
  parameters: Type.Object({}),
1119
1158
  async execute() {
1120
1159
  try {
@@ -1134,7 +1173,10 @@ export function registerFeishuDocTools(api: OpenClawPluginApi) {
1134
1173
  name: "feishu_wiki_nodes",
1135
1174
  label: "Feishu Wiki Nodes",
1136
1175
  description:
1137
- "List wiki nodes (pages) in a space. Use parent_node_token to list children of a specific node.",
1176
+ "List wiki pages within a Wiki space. " +
1177
+ "WORKFLOW: First call feishu_wiki_spaces to get space_id, then list nodes here. " +
1178
+ "Use parent_node_token to browse nested pages (children of a specific node). " +
1179
+ "Returns node_token for use with feishu_wiki_read.",
1138
1180
  parameters: WikiSpaceIdSchema,
1139
1181
  async execute(_toolCallId, params) {
1140
1182
  const { space_id, parent_node_token } = params as {
@@ -1158,7 +1200,9 @@ export function registerFeishuDocTools(api: OpenClawPluginApi) {
1158
1200
  name: "feishu_app_scopes",
1159
1201
  label: "Feishu App Scopes",
1160
1202
  description:
1161
- "List current app permissions (scopes). Use to debug permission issues or check available capabilities.",
1203
+ "List the app's current permissions (scopes) granted in Feishu admin console. " +
1204
+ "Use when a tool fails with permission errors to diagnose what's missing. " +
1205
+ "Common required scopes: docx:document (read/edit docs), wiki:wiki (read wikis), drive:drive (folder access).",
1162
1206
  parameters: Type.Object({}),
1163
1207
  async execute() {
1164
1208
  try {