11// Feishu plugin module implements drive behavior.
22import type * as Lark from "@larksuiteoapi/node-sdk" ;
33import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime" ;
4+ import { jsonResult } from "openclaw/plugin-sdk/tool-results" ;
45import type { OpenClawPluginApi } from "../runtime-api.js" ;
56import { listEnabledFeishuAccounts } from "./accounts.js" ;
67import { cleanupAmbientCommentTypingReaction } from "./comment-reaction.js" ;
@@ -14,11 +15,7 @@ import {
1415import { parseFeishuCommentTarget , type CommentFileType } from "./comment-target.js" ;
1516import { FeishuDriveSchema , type FeishuDriveParams } from "./drive-schema.js" ;
1617import { createFeishuToolClient , resolveAnyEnabledFeishuToolsConfig } from "./tool-account.js" ;
17- import {
18- jsonToolResult ,
19- toolExecutionErrorResult ,
20- unknownToolActionResult ,
21- } from "./tool-result.js" ;
18+ import { toolExecutionErrorResult , unknownToolActionResult } from "./tool-result.js" ;
2219
2320// ============ Actions ============
2421
@@ -769,33 +766,33 @@ export function registerFeishuDriveTools(api: OpenClawPluginApi) {
769766 } ) ;
770767 switch ( p . action ) {
771768 case "list" :
772- return jsonToolResult ( await listFolder ( client , p . folder_token ) ) ;
769+ return jsonResult ( await listFolder ( client , p . folder_token ) ) ;
773770 case "info" :
774- return jsonToolResult ( await getFileInfo ( client , p . file_token ) ) ;
771+ return jsonResult ( await getFileInfo ( client , p . file_token ) ) ;
775772 case "create_folder" :
776- return jsonToolResult ( await createFolder ( client , p . name , p . folder_token ) ) ;
773+ return jsonResult ( await createFolder ( client , p . name , p . folder_token ) ) ;
777774 case "move" :
778- return jsonToolResult ( await moveFile ( client , p . file_token , p . type , p . folder_token ) ) ;
775+ return jsonResult ( await moveFile ( client , p . file_token , p . type , p . folder_token ) ) ;
779776 case "delete" :
780- return jsonToolResult ( await deleteFile ( client , p . file_token , p . type ) ) ;
777+ return jsonResult ( await deleteFile ( client , p . file_token , p . type ) ) ;
781778 case "list_comments" : {
782779 const resolved = applyCommentFileTypeDefault (
783780 applyAmbientCommentDefaults ( p , ctx ) ,
784781 "list_comments" ,
785782 ) ;
786- return jsonToolResult ( await listComments ( client , resolved ) ) ;
783+ return jsonResult ( await listComments ( client , resolved ) ) ;
787784 }
788785 case "list_comment_replies" : {
789786 const resolved = applyCommentFileTypeDefault (
790787 applyAmbientCommentDefaults ( p , ctx ) ,
791788 "list_comment_replies" ,
792789 ) ;
793- return jsonToolResult ( await listCommentReplies ( client , resolved ) ) ;
790+ return jsonResult ( await listCommentReplies ( client , resolved ) ) ;
794791 }
795792 case "add_comment" : {
796793 const resolved = applyAddCommentDefaults ( applyAddCommentAmbientDefaults ( p , ctx ) ) ;
797794 try {
798- return jsonToolResult ( await addComment ( client , resolved ) ) ;
795+ return jsonResult ( await addComment ( client , resolved ) ) ;
799796 } finally {
800797 void cleanupAmbientCommentTypingReaction ( {
801798 client : getDriveInternalClient ( client ) ,
@@ -809,7 +806,7 @@ export function registerFeishuDriveTools(api: OpenClawPluginApi) {
809806 "reply_comment" ,
810807 ) ;
811808 try {
812- return jsonToolResult ( await deliverCommentThreadText ( client , resolved ) ) ;
809+ return jsonResult ( await deliverCommentThreadText ( client , resolved ) ) ;
813810 } finally {
814811 void cleanupAmbientCommentTypingReaction ( {
815812 client : getDriveInternalClient ( client ) ,
0 commit comments