@larksuite/openclaw-lark 2025.7.15-beta.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/LICENSE +21 -0
- package/README.md +76 -0
- package/bin/openclaw-lark.js +39 -0
- package/index.d.ts +36 -0
- package/index.js +188 -0
- package/openclaw.plugin.json +64 -0
- package/package.json +63 -0
- package/secret-contract-api.d.ts +15 -0
- package/secret-contract-api.js +78 -0
- package/skills/feishu-bitable/SKILL.md +248 -0
- package/skills/feishu-bitable/references/examples.md +813 -0
- package/skills/feishu-bitable/references/field-properties.md +763 -0
- package/skills/feishu-bitable/references/record-values.md +911 -0
- package/skills/feishu-calendar/SKILL.md +242 -0
- package/skills/feishu-channel-rules/SKILL.md +18 -0
- package/skills/feishu-channel-rules/references/markdown-syntax.md +138 -0
- package/skills/feishu-create-doc/SKILL.md +719 -0
- package/skills/feishu-fetch-doc/SKILL.md +93 -0
- package/skills/feishu-im-read/SKILL.md +163 -0
- package/skills/feishu-task/SKILL.md +340 -0
- package/skills/feishu-troubleshoot/SKILL.md +70 -0
- package/skills/feishu-update-doc/SKILL.md +285 -0
- package/src/card/builder.d.ts +152 -0
- package/src/card/builder.js +794 -0
- package/src/card/card-error.d.ts +91 -0
- package/src/card/card-error.js +206 -0
- package/src/card/cardkit.d.ts +90 -0
- package/src/card/cardkit.js +203 -0
- package/src/card/flush-controller.d.ts +45 -0
- package/src/card/flush-controller.js +138 -0
- package/src/card/image-resolver.d.ts +45 -0
- package/src/card/image-resolver.js +116 -0
- package/src/card/markdown-style.d.ts +16 -0
- package/src/card/markdown-style.js +106 -0
- package/src/card/reasoning-utils.d.ts +14 -0
- package/src/card/reasoning-utils.js +64 -0
- package/src/card/reply-dispatcher-types.d.ts +132 -0
- package/src/card/reply-dispatcher-types.js +61 -0
- package/src/card/reply-dispatcher.d.ts +15 -0
- package/src/card/reply-dispatcher.js +447 -0
- package/src/card/reply-mode.d.ts +41 -0
- package/src/card/reply-mode.js +70 -0
- package/src/card/streaming-card-controller.d.ts +118 -0
- package/src/card/streaming-card-controller.js +1045 -0
- package/src/card/tool-use-config.d.ts +26 -0
- package/src/card/tool-use-config.js +76 -0
- package/src/card/tool-use-display.d.ts +37 -0
- package/src/card/tool-use-display.js +476 -0
- package/src/card/tool-use-trace-store.d.ts +51 -0
- package/src/card/tool-use-trace-store.js +271 -0
- package/src/card/unavailable-guard.d.ts +35 -0
- package/src/card/unavailable-guard.js +87 -0
- package/src/channel/abort-detect.d.ts +47 -0
- package/src/channel/abort-detect.js +219 -0
- package/src/channel/chat-queue.d.ts +41 -0
- package/src/channel/chat-queue.js +68 -0
- package/src/channel/config-adapter.d.ts +23 -0
- package/src/channel/config-adapter.js +107 -0
- package/src/channel/directory.d.ts +57 -0
- package/src/channel/directory.js +197 -0
- package/src/channel/event-handlers.d.ts +17 -0
- package/src/channel/event-handlers.js +380 -0
- package/src/channel/interactive-dispatch.d.ts +59 -0
- package/src/channel/interactive-dispatch.js +195 -0
- package/src/channel/monitor.d.ts +17 -0
- package/src/channel/monitor.js +140 -0
- package/src/channel/onboarding-config.d.ts +18 -0
- package/src/channel/onboarding-config.js +96 -0
- package/src/channel/onboarding-migrate.d.ts +25 -0
- package/src/channel/onboarding-migrate.js +70 -0
- package/src/channel/onboarding.d.ts +12 -0
- package/src/channel/onboarding.js +300 -0
- package/src/channel/plugin.d.ts +13 -0
- package/src/channel/plugin.js +310 -0
- package/src/channel/probe.d.ts +14 -0
- package/src/channel/probe.js +24 -0
- package/src/channel/types.d.ts +37 -0
- package/src/channel/types.js +8 -0
- package/src/commands/auth.d.ts +21 -0
- package/src/commands/auth.js +165 -0
- package/src/commands/diagnose.d.ts +69 -0
- package/src/commands/diagnose.js +848 -0
- package/src/commands/doctor.d.ts +27 -0
- package/src/commands/doctor.js +588 -0
- package/src/commands/index.d.ts +25 -0
- package/src/commands/index.js +219 -0
- package/src/commands/locale.d.ts +7 -0
- package/src/commands/locale.js +8 -0
- package/src/core/accounts.d.ts +51 -0
- package/src/core/accounts.js +219 -0
- package/src/core/agent-config.d.ts +100 -0
- package/src/core/agent-config.js +148 -0
- package/src/core/api-error.d.ts +48 -0
- package/src/core/api-error.js +117 -0
- package/src/core/app-owner-fallback.d.ts +22 -0
- package/src/core/app-owner-fallback.js +39 -0
- package/src/core/app-scope-checker.d.ts +87 -0
- package/src/core/app-scope-checker.js +198 -0
- package/src/core/auth-errors.d.ts +144 -0
- package/src/core/auth-errors.js +160 -0
- package/src/core/card-action-operator.d.ts +33 -0
- package/src/core/card-action-operator.js +30 -0
- package/src/core/chat-info-cache.d.ts +67 -0
- package/src/core/chat-info-cache.js +165 -0
- package/src/core/comment-target.d.ts +65 -0
- package/src/core/comment-target.js +100 -0
- package/src/core/config-schema.d.ts +490 -0
- package/src/core/config-schema.js +223 -0
- package/src/core/device-flow.d.ts +77 -0
- package/src/core/device-flow.js +217 -0
- package/src/core/domains.d.ts +18 -0
- package/src/core/domains.js +34 -0
- package/src/core/feishu-fetch.d.ts +18 -0
- package/src/core/feishu-fetch.js +28 -0
- package/src/core/footer-config.d.ts +24 -0
- package/src/core/footer-config.js +51 -0
- package/src/core/lark-client.d.ts +125 -0
- package/src/core/lark-client.js +468 -0
- package/src/core/lark-logger.d.ts +23 -0
- package/src/core/lark-logger.js +160 -0
- package/src/core/lark-ticket.d.ts +29 -0
- package/src/core/lark-ticket.js +40 -0
- package/src/core/message-unavailable.d.ts +53 -0
- package/src/core/message-unavailable.js +142 -0
- package/src/core/owner-policy.d.ts +32 -0
- package/src/core/owner-policy.js +55 -0
- package/src/core/permission-url.d.ts +22 -0
- package/src/core/permission-url.js +76 -0
- package/src/core/raw-request.d.ts +27 -0
- package/src/core/raw-request.js +90 -0
- package/src/core/runtime-store.d.ts +13 -0
- package/src/core/runtime-store.js +29 -0
- package/src/core/scope-manager.d.ts +168 -0
- package/src/core/scope-manager.js +224 -0
- package/src/core/sdk-compat.d.ts +20 -0
- package/src/core/sdk-compat.js +28 -0
- package/src/core/security-check.d.ts +72 -0
- package/src/core/security-check.js +184 -0
- package/src/core/shutdown-hooks.d.ts +22 -0
- package/src/core/shutdown-hooks.js +61 -0
- package/src/core/synthetic-target.d.ts +33 -0
- package/src/core/synthetic-target.js +40 -0
- package/src/core/targets.d.ts +60 -0
- package/src/core/targets.js +173 -0
- package/src/core/token-store.d.ts +54 -0
- package/src/core/token-store.js +326 -0
- package/src/core/tool-client.d.ts +176 -0
- package/src/core/tool-client.js +426 -0
- package/src/core/tool-scopes.d.ts +156 -0
- package/src/core/tool-scopes.js +344 -0
- package/src/core/tools-config.d.ts +55 -0
- package/src/core/tools-config.js +143 -0
- package/src/core/types.d.ts +91 -0
- package/src/core/types.js +12 -0
- package/src/core/uat-client.d.ts +46 -0
- package/src/core/uat-client.js +192 -0
- package/src/core/version.d.ts +31 -0
- package/src/core/version.js +69 -0
- package/src/messaging/converters/audio.d.ts +8 -0
- package/src/messaging/converters/audio.js +24 -0
- package/src/messaging/converters/calendar.d.ts +13 -0
- package/src/messaging/converters/calendar.js +56 -0
- package/src/messaging/converters/content-converter-helpers.d.ts +30 -0
- package/src/messaging/converters/content-converter-helpers.js +82 -0
- package/src/messaging/converters/content-converter.d.ts +24 -0
- package/src/messaging/converters/content-converter.js +40 -0
- package/src/messaging/converters/file.d.ts +8 -0
- package/src/messaging/converters/file.js +24 -0
- package/src/messaging/converters/folder.d.ts +8 -0
- package/src/messaging/converters/folder.js +24 -0
- package/src/messaging/converters/hongbao.d.ts +8 -0
- package/src/messaging/converters/hongbao.js +20 -0
- package/src/messaging/converters/image.d.ts +8 -0
- package/src/messaging/converters/image.js +22 -0
- package/src/messaging/converters/index.d.ts +8 -0
- package/src/messaging/converters/index.js +53 -0
- package/src/messaging/converters/interactive/card-converter.d.ts +76 -0
- package/src/messaging/converters/interactive/card-converter.js +1177 -0
- package/src/messaging/converters/interactive/card-utils.d.ts +9 -0
- package/src/messaging/converters/interactive/card-utils.js +47 -0
- package/src/messaging/converters/interactive/index.d.ts +8 -0
- package/src/messaging/converters/interactive/index.js +25 -0
- package/src/messaging/converters/interactive/legacy.d.ts +11 -0
- package/src/messaging/converters/interactive/legacy.js +60 -0
- package/src/messaging/converters/interactive/types.d.ts +23 -0
- package/src/messaging/converters/interactive/types.js +27 -0
- package/src/messaging/converters/location.d.ts +8 -0
- package/src/messaging/converters/location.js +23 -0
- package/src/messaging/converters/merge-forward.d.ts +32 -0
- package/src/messaging/converters/merge-forward.js +235 -0
- package/src/messaging/converters/post.d.ts +11 -0
- package/src/messaging/converters/post.js +235 -0
- package/src/messaging/converters/share.d.ts +9 -0
- package/src/messaging/converters/share.js +28 -0
- package/src/messaging/converters/sticker.d.ts +8 -0
- package/src/messaging/converters/sticker.js +22 -0
- package/src/messaging/converters/system.d.ts +12 -0
- package/src/messaging/converters/system.js +36 -0
- package/src/messaging/converters/text.d.ts +8 -0
- package/src/messaging/converters/text.js +18 -0
- package/src/messaging/converters/todo.d.ts +8 -0
- package/src/messaging/converters/todo.js +45 -0
- package/src/messaging/converters/types.d.ts +114 -0
- package/src/messaging/converters/types.js +8 -0
- package/src/messaging/converters/unknown.d.ts +8 -0
- package/src/messaging/converters/unknown.js +20 -0
- package/src/messaging/converters/utils.d.ts +22 -0
- package/src/messaging/converters/utils.js +57 -0
- package/src/messaging/converters/video-chat.d.ts +8 -0
- package/src/messaging/converters/video-chat.js +31 -0
- package/src/messaging/converters/video.d.ts +8 -0
- package/src/messaging/converters/video.js +35 -0
- package/src/messaging/converters/vote.d.ts +8 -0
- package/src/messaging/converters/vote.js +28 -0
- package/src/messaging/inbound/bot-content.d.ts +84 -0
- package/src/messaging/inbound/bot-content.js +117 -0
- package/src/messaging/inbound/bot-loop-guard.d.ts +48 -0
- package/src/messaging/inbound/bot-loop-guard.js +89 -0
- package/src/messaging/inbound/comment-context.d.ts +82 -0
- package/src/messaging/inbound/comment-context.js +353 -0
- package/src/messaging/inbound/comment-handler.d.ts +30 -0
- package/src/messaging/inbound/comment-handler.js +269 -0
- package/src/messaging/inbound/dedup.d.ts +59 -0
- package/src/messaging/inbound/dedup.js +121 -0
- package/src/messaging/inbound/dispatch-builders.d.ts +104 -0
- package/src/messaging/inbound/dispatch-builders.js +241 -0
- package/src/messaging/inbound/dispatch-commands.d.ts +22 -0
- package/src/messaging/inbound/dispatch-commands.js +131 -0
- package/src/messaging/inbound/dispatch-context.d.ts +67 -0
- package/src/messaging/inbound/dispatch-context.js +153 -0
- package/src/messaging/inbound/dispatch.d.ts +50 -0
- package/src/messaging/inbound/dispatch.js +477 -0
- package/src/messaging/inbound/enrich.d.ts +102 -0
- package/src/messaging/inbound/enrich.js +236 -0
- package/src/messaging/inbound/gate-effects.d.ts +23 -0
- package/src/messaging/inbound/gate-effects.js +46 -0
- package/src/messaging/inbound/gate.d.ts +91 -0
- package/src/messaging/inbound/gate.js +342 -0
- package/src/messaging/inbound/handler-registry.d.ts +25 -0
- package/src/messaging/inbound/handler-registry.js +23 -0
- package/src/messaging/inbound/handler.d.ts +37 -0
- package/src/messaging/inbound/handler.js +286 -0
- package/src/messaging/inbound/media-resolver.d.ts +32 -0
- package/src/messaging/inbound/media-resolver.js +91 -0
- package/src/messaging/inbound/mention-registry.d.ts +59 -0
- package/src/messaging/inbound/mention-registry.js +115 -0
- package/src/messaging/inbound/mention.d.ts +48 -0
- package/src/messaging/inbound/mention.js +102 -0
- package/src/messaging/inbound/parse-io.d.ts +50 -0
- package/src/messaging/inbound/parse-io.js +86 -0
- package/src/messaging/inbound/parse.d.ts +28 -0
- package/src/messaging/inbound/parse.js +128 -0
- package/src/messaging/inbound/permission.d.ts +17 -0
- package/src/messaging/inbound/permission.js +44 -0
- package/src/messaging/inbound/policy.d.ts +95 -0
- package/src/messaging/inbound/policy.js +168 -0
- package/src/messaging/inbound/reaction-handler.d.ts +62 -0
- package/src/messaging/inbound/reaction-handler.js +259 -0
- package/src/messaging/inbound/sentinel-store.d.ts +37 -0
- package/src/messaging/inbound/sentinel-store.js +98 -0
- package/src/messaging/inbound/synthetic-message.d.ts +26 -0
- package/src/messaging/inbound/synthetic-message.js +59 -0
- package/src/messaging/inbound/user-name-cache-store.d.ts +62 -0
- package/src/messaging/inbound/user-name-cache-store.js +236 -0
- package/src/messaging/inbound/user-name-cache.d.ts +78 -0
- package/src/messaging/inbound/user-name-cache.js +306 -0
- package/src/messaging/inbound/vc-meeting-invited-handler.d.ts +20 -0
- package/src/messaging/inbound/vc-meeting-invited-handler.js +236 -0
- package/src/messaging/inbound/vc-sender.d.ts +41 -0
- package/src/messaging/inbound/vc-sender.js +53 -0
- package/src/messaging/outbound/actions.d.ts +16 -0
- package/src/messaging/outbound/actions.js +329 -0
- package/src/messaging/outbound/bot-peer-context.d.ts +42 -0
- package/src/messaging/outbound/bot-peer-context.js +40 -0
- package/src/messaging/outbound/chat-manage.d.ts +64 -0
- package/src/messaging/outbound/chat-manage.js +117 -0
- package/src/messaging/outbound/deliver.d.ts +186 -0
- package/src/messaging/outbound/deliver.js +410 -0
- package/src/messaging/outbound/fetch.d.ts +12 -0
- package/src/messaging/outbound/fetch.js +17 -0
- package/src/messaging/outbound/forward.d.ts +26 -0
- package/src/messaging/outbound/forward.js +51 -0
- package/src/messaging/outbound/media-url-utils.d.ts +29 -0
- package/src/messaging/outbound/media-url-utils.js +172 -0
- package/src/messaging/outbound/media.d.ts +260 -0
- package/src/messaging/outbound/media.js +865 -0
- package/src/messaging/outbound/normalize-mentions.d.ts +50 -0
- package/src/messaging/outbound/normalize-mentions.js +166 -0
- package/src/messaging/outbound/outbound-mention.d.ts +41 -0
- package/src/messaging/outbound/outbound-mention.js +112 -0
- package/src/messaging/outbound/outbound.d.ts +79 -0
- package/src/messaging/outbound/outbound.js +195 -0
- package/src/messaging/outbound/reactions.d.ts +124 -0
- package/src/messaging/outbound/reactions.js +384 -0
- package/src/messaging/outbound/send.d.ts +153 -0
- package/src/messaging/outbound/send.js +417 -0
- package/src/messaging/outbound/typing.d.ts +60 -0
- package/src/messaging/outbound/typing.js +139 -0
- package/src/messaging/shared/message-lookup.d.ts +54 -0
- package/src/messaging/shared/message-lookup.js +120 -0
- package/src/messaging/types.d.ts +316 -0
- package/src/messaging/types.js +11 -0
- package/src/tools/ask-user-question.d.ts +32 -0
- package/src/tools/ask-user-question.js +922 -0
- package/src/tools/auto-auth.d.ts +57 -0
- package/src/tools/auto-auth.js +904 -0
- package/src/tools/helpers.d.ts +264 -0
- package/src/tools/helpers.js +389 -0
- package/src/tools/mcp/doc/create.d.ts +12 -0
- package/src/tools/mcp/doc/create.js +47 -0
- package/src/tools/mcp/doc/fetch.d.ts +12 -0
- package/src/tools/mcp/doc/fetch.js +39 -0
- package/src/tools/mcp/doc/index.d.ts +12 -0
- package/src/tools/mcp/doc/index.js +50 -0
- package/src/tools/mcp/doc/update.d.ts +12 -0
- package/src/tools/mcp/doc/update.js +64 -0
- package/src/tools/mcp/shared.d.ts +59 -0
- package/src/tools/mcp/shared.js +239 -0
- package/src/tools/oapi/bitable/app-table-field.d.ts +16 -0
- package/src/tools/oapi/bitable/app-table-field.js +225 -0
- package/src/tools/oapi/bitable/app-table-record.d.ts +20 -0
- package/src/tools/oapi/bitable/app-table-record.js +439 -0
- package/src/tools/oapi/bitable/app-table-view.d.ts +16 -0
- package/src/tools/oapi/bitable/app-table-view.js +172 -0
- package/src/tools/oapi/bitable/app-table.d.ts +17 -0
- package/src/tools/oapi/bitable/app-table.js +195 -0
- package/src/tools/oapi/bitable/app.d.ts +18 -0
- package/src/tools/oapi/bitable/app.js +189 -0
- package/src/tools/oapi/bitable/index.d.ts +9 -0
- package/src/tools/oapi/bitable/index.js +17 -0
- package/src/tools/oapi/calendar/calendar.d.ts +15 -0
- package/src/tools/oapi/calendar/calendar.js +125 -0
- package/src/tools/oapi/calendar/event-attendee.d.ts +14 -0
- package/src/tools/oapi/calendar/event-attendee.js +161 -0
- package/src/tools/oapi/calendar/event.d.ts +16 -0
- package/src/tools/oapi/calendar/event.js +712 -0
- package/src/tools/oapi/calendar/freebusy.d.ts +13 -0
- package/src/tools/oapi/calendar/freebusy.js +114 -0
- package/src/tools/oapi/calendar/index.d.ts +8 -0
- package/src/tools/oapi/calendar/index.js +15 -0
- package/src/tools/oapi/chat/chat.d.ts +16 -0
- package/src/tools/oapi/chat/chat.js +127 -0
- package/src/tools/oapi/chat/index.d.ts +10 -0
- package/src/tools/oapi/chat/index.js +23 -0
- package/src/tools/oapi/chat/members.d.ts +11 -0
- package/src/tools/oapi/chat/members.js +84 -0
- package/src/tools/oapi/common/get-user.d.ts +12 -0
- package/src/tools/oapi/common/get-user.js +109 -0
- package/src/tools/oapi/common/index.d.ts +6 -0
- package/src/tools/oapi/common/index.js +11 -0
- package/src/tools/oapi/common/search-user.d.ts +11 -0
- package/src/tools/oapi/common/search-user.js +76 -0
- package/src/tools/oapi/drive/doc-comments.d.ts +15 -0
- package/src/tools/oapi/drive/doc-comments.js +351 -0
- package/src/tools/oapi/drive/doc-media.d.ts +19 -0
- package/src/tools/oapi/drive/doc-media.js +371 -0
- package/src/tools/oapi/drive/file.d.ts +19 -0
- package/src/tools/oapi/drive/file.js +519 -0
- package/src/tools/oapi/drive/index.d.ts +12 -0
- package/src/tools/oapi/drive/index.js +45 -0
- package/src/tools/oapi/helpers.d.ts +183 -0
- package/src/tools/oapi/helpers.js +385 -0
- package/src/tools/oapi/im/format-messages.d.ts +50 -0
- package/src/tools/oapi/im/format-messages.js +169 -0
- package/src/tools/oapi/im/index.d.ts +10 -0
- package/src/tools/oapi/im/index.js +25 -0
- package/src/tools/oapi/im/message-read.d.ts +13 -0
- package/src/tools/oapi/im/message-read.js +419 -0
- package/src/tools/oapi/im/message.d.ts +16 -0
- package/src/tools/oapi/im/message.js +152 -0
- package/src/tools/oapi/im/resource.d.ts +13 -0
- package/src/tools/oapi/im/resource.js +186 -0
- package/src/tools/oapi/im/time-utils.d.ts +46 -0
- package/src/tools/oapi/im/time-utils.js +212 -0
- package/src/tools/oapi/im/user-name-uat.d.ts +26 -0
- package/src/tools/oapi/im/user-name-uat.js +143 -0
- package/src/tools/oapi/index.d.ts +11 -0
- package/src/tools/oapi/index.js +64 -0
- package/src/tools/oapi/sdk-types.d.ts +96 -0
- package/src/tools/oapi/sdk-types.js +13 -0
- package/src/tools/oapi/search/doc-search.d.ts +13 -0
- package/src/tools/oapi/search/doc-search.js +194 -0
- package/src/tools/oapi/search/index.d.ts +12 -0
- package/src/tools/oapi/search/index.js +37 -0
- package/src/tools/oapi/sheets/index.d.ts +12 -0
- package/src/tools/oapi/sheets/index.js +35 -0
- package/src/tools/oapi/sheets/sheet.d.ts +16 -0
- package/src/tools/oapi/sheets/sheet.js +688 -0
- package/src/tools/oapi/task/attachment.d.ts +18 -0
- package/src/tools/oapi/task/attachment.js +107 -0
- package/src/tools/oapi/task/comment.d.ts +15 -0
- package/src/tools/oapi/task/comment.js +149 -0
- package/src/tools/oapi/task/index.d.ts +11 -0
- package/src/tools/oapi/task/index.js +21 -0
- package/src/tools/oapi/task/section.d.ts +17 -0
- package/src/tools/oapi/task/section.js +293 -0
- package/src/tools/oapi/task/subtask.d.ts +14 -0
- package/src/tools/oapi/task/subtask.js +171 -0
- package/src/tools/oapi/task/task.d.ts +19 -0
- package/src/tools/oapi/task/task.js +512 -0
- package/src/tools/oapi/task/task_agent.d.ts +14 -0
- package/src/tools/oapi/task/task_agent.js +108 -0
- package/src/tools/oapi/task/tasklist.d.ts +19 -0
- package/src/tools/oapi/task/tasklist.js +276 -0
- package/src/tools/oapi/wiki/index.d.ts +12 -0
- package/src/tools/oapi/wiki/index.js +42 -0
- package/src/tools/oapi/wiki/space-node.d.ts +17 -0
- package/src/tools/oapi/wiki/space-node.js +233 -0
- package/src/tools/oapi/wiki/space.d.ts +15 -0
- package/src/tools/oapi/wiki/space.js +133 -0
- package/src/tools/oauth-batch-auth.d.ts +11 -0
- package/src/tools/oauth-batch-auth.js +150 -0
- package/src/tools/oauth-cards.d.ts +39 -0
- package/src/tools/oauth-cards.js +324 -0
- package/src/tools/oauth.d.ts +47 -0
- package/src/tools/oauth.js +592 -0
- package/src/tools/onboarding-auth.d.ts +27 -0
- package/src/tools/onboarding-auth.js +133 -0
- package/src/tools/tat/im/index.d.ts +15 -0
- package/src/tools/tat/im/index.js +22 -0
- package/src/tools/tat/im/resource.d.ts +15 -0
- package/src/tools/tat/im/resource.js +192 -0
- package/tsdown.config.d.ts +2 -0
- package/tsdown.config.js +25 -0
- package/vitest.config.d.ts +2 -0
- package/vitest.config.js +12 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*
|
|
6
|
+
* feishu_search_user tool -- 搜索员工
|
|
7
|
+
*
|
|
8
|
+
* 通过关键词搜索员工,结果按亲密度排序
|
|
9
|
+
* 使用搜索接口(/open-apis/search/v1/user)
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.registerSearchUserTool = registerSearchUserTool;
|
|
13
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
14
|
+
const helpers_1 = require("../helpers.js");
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
// Schema
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
const SearchUserSchema = typebox_1.Type.Object({
|
|
19
|
+
query: typebox_1.Type.String({
|
|
20
|
+
description: '搜索关键词,用于匹配用户名(必填)',
|
|
21
|
+
}),
|
|
22
|
+
page_size: typebox_1.Type.Optional(typebox_1.Type.Integer({
|
|
23
|
+
description: '分页大小,控制每次返回的用户数量(默认20,最大200)',
|
|
24
|
+
minimum: 1,
|
|
25
|
+
maximum: 200,
|
|
26
|
+
})),
|
|
27
|
+
page_token: typebox_1.Type.Optional(typebox_1.Type.String({
|
|
28
|
+
description: '分页标识。首次请求无需填写;当返回结果中包含 page_token 时,可传入该值继续请求下一页',
|
|
29
|
+
})),
|
|
30
|
+
});
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// Registration
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
function registerSearchUserTool(api) {
|
|
35
|
+
if (!api.config)
|
|
36
|
+
return;
|
|
37
|
+
const cfg = api.config;
|
|
38
|
+
const { toolClient, log } = (0, helpers_1.createToolContext)(api, 'feishu_search_user');
|
|
39
|
+
(0, helpers_1.registerTool)(api, {
|
|
40
|
+
name: 'feishu_search_user',
|
|
41
|
+
label: 'Feishu: Search User',
|
|
42
|
+
description: '搜索员工信息(通过关键词搜索姓名、手机号、邮箱)。' + '返回匹配的员工列表,包含姓名、部门、open_id 等信息。',
|
|
43
|
+
parameters: SearchUserSchema,
|
|
44
|
+
async execute(_toolCallId, params) {
|
|
45
|
+
const p = params;
|
|
46
|
+
try {
|
|
47
|
+
const client = toolClient();
|
|
48
|
+
log.info(`search_user: query="${p.query}", page_size=${p.page_size ?? 20}`);
|
|
49
|
+
const requestQuery = {
|
|
50
|
+
query: p.query,
|
|
51
|
+
page_size: String(p.page_size ?? 20),
|
|
52
|
+
};
|
|
53
|
+
if (p.page_token)
|
|
54
|
+
requestQuery.page_token = p.page_token;
|
|
55
|
+
const res = await client.invokeByPath('feishu_search_user.default', '/open-apis/search/v1/user', {
|
|
56
|
+
method: 'GET',
|
|
57
|
+
query: requestQuery,
|
|
58
|
+
as: 'user',
|
|
59
|
+
});
|
|
60
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
61
|
+
const data = res.data;
|
|
62
|
+
const users = data?.users ?? [];
|
|
63
|
+
const userCount = users.length;
|
|
64
|
+
log.info(`search_user: found ${userCount} users`);
|
|
65
|
+
return (0, helpers_1.json)({
|
|
66
|
+
users,
|
|
67
|
+
has_more: data?.has_more ?? false,
|
|
68
|
+
page_token: data?.page_token,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
return await (0, helpers_1.handleInvokeErrorWithAutoAuth)(err, cfg);
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
}, { name: 'feishu_search_user' });
|
|
76
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*
|
|
5
|
+
* feishu_doc_comments tool -- 云文档评论管理
|
|
6
|
+
*
|
|
7
|
+
* 支持获取、创建、解决/恢复云文档评论
|
|
8
|
+
* 使用以下 SDK 接口:
|
|
9
|
+
* - sdk.drive.v1.fileComment.list - 获取评论列表
|
|
10
|
+
* - sdk.drive.v1.fileComment.create - 创建全文评论
|
|
11
|
+
* - sdk.drive.v1.fileComment.patch - 解决/恢复评论
|
|
12
|
+
* - sdk.drive.v1.fileCommentReply.list - 获取回复列表
|
|
13
|
+
*/
|
|
14
|
+
import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
|
|
15
|
+
export declare function registerDocCommentsTool(api: OpenClawPluginApi): boolean;
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*
|
|
6
|
+
* feishu_doc_comments tool -- 云文档评论管理
|
|
7
|
+
*
|
|
8
|
+
* 支持获取、创建、解决/恢复云文档评论
|
|
9
|
+
* 使用以下 SDK 接口:
|
|
10
|
+
* - sdk.drive.v1.fileComment.list - 获取评论列表
|
|
11
|
+
* - sdk.drive.v1.fileComment.create - 创建全文评论
|
|
12
|
+
* - sdk.drive.v1.fileComment.patch - 解决/恢复评论
|
|
13
|
+
* - sdk.drive.v1.fileCommentReply.list - 获取回复列表
|
|
14
|
+
*/
|
|
15
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.registerDocCommentsTool = registerDocCommentsTool;
|
|
18
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
19
|
+
const helpers_1 = require("../helpers.js");
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// Schema
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
const ReplyElementSchema = typebox_1.Type.Object({
|
|
24
|
+
type: (0, helpers_1.StringEnum)(['text', 'mention', 'link']),
|
|
25
|
+
text: typebox_1.Type.Optional(typebox_1.Type.String({ description: '文本内容(type=text时必填)' })),
|
|
26
|
+
open_id: typebox_1.Type.Optional(typebox_1.Type.String({ description: '被@用户的open_id(type=mention时必填)' })),
|
|
27
|
+
url: typebox_1.Type.Optional(typebox_1.Type.String({ description: '链接URL(type=link时必填)' })),
|
|
28
|
+
});
|
|
29
|
+
const DocCommentsSchema = typebox_1.Type.Object({
|
|
30
|
+
action: (0, helpers_1.StringEnum)(['list', 'list_replies', 'create', 'reply', 'patch']),
|
|
31
|
+
file_token: typebox_1.Type.String({
|
|
32
|
+
description: '云文档token或wiki节点token(可从文档URL获取)。如果是wiki token,会自动转换为实际文档的obj_token',
|
|
33
|
+
}),
|
|
34
|
+
file_type: (0, helpers_1.StringEnum)(['doc', 'docx', 'sheet', 'file', 'slides', 'wiki'], {
|
|
35
|
+
description: '文档类型。wiki类型会自动解析为实际文档类型(docx/sheet/bitable等)',
|
|
36
|
+
}),
|
|
37
|
+
// list action参数
|
|
38
|
+
is_whole: typebox_1.Type.Optional(typebox_1.Type.Boolean({
|
|
39
|
+
description: '是否只获取全文评论(action=list时可选)',
|
|
40
|
+
})),
|
|
41
|
+
is_solved: typebox_1.Type.Optional(typebox_1.Type.Boolean({
|
|
42
|
+
description: '是否只获取已解决的评论(action=list时可选)',
|
|
43
|
+
})),
|
|
44
|
+
page_size: typebox_1.Type.Optional(typebox_1.Type.Integer({ description: '分页大小' })),
|
|
45
|
+
page_token: typebox_1.Type.Optional(typebox_1.Type.String({ description: '分页标记' })),
|
|
46
|
+
// create / reply action参数
|
|
47
|
+
elements: typebox_1.Type.Optional(typebox_1.Type.Array(ReplyElementSchema, {
|
|
48
|
+
description: '评论内容元素数组(action=create/reply时必填)。' + '支持text(纯文本)、mention(@用户)、link(超链接)三种类型',
|
|
49
|
+
})),
|
|
50
|
+
// list_replies / reply / patch action参数
|
|
51
|
+
comment_id: typebox_1.Type.Optional(typebox_1.Type.String({
|
|
52
|
+
description: '评论ID(action=list_replies/reply/patch时必填)',
|
|
53
|
+
})),
|
|
54
|
+
is_solved_value: typebox_1.Type.Optional(typebox_1.Type.Boolean({
|
|
55
|
+
description: '解决状态:true=解决,false=恢复(action=patch时必填)',
|
|
56
|
+
})),
|
|
57
|
+
user_id_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['open_id', 'union_id', 'user_id'])),
|
|
58
|
+
});
|
|
59
|
+
// ---------------------------------------------------------------------------
|
|
60
|
+
// Helper functions
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
function convertElementsToSDKFormat(elements) {
|
|
63
|
+
return elements.map((el) => {
|
|
64
|
+
if (el.type === 'text') {
|
|
65
|
+
return {
|
|
66
|
+
type: 'text_run',
|
|
67
|
+
text_run: { text: el.text },
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
else if (el.type === 'mention') {
|
|
71
|
+
return {
|
|
72
|
+
type: 'person',
|
|
73
|
+
person: { user_id: el.open_id },
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
else if (el.type === 'link') {
|
|
77
|
+
return {
|
|
78
|
+
type: 'docs_link',
|
|
79
|
+
docs_link: { url: el.url },
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return { type: 'text_run', text_run: { text: '' } };
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* 组装评论和回复数据
|
|
87
|
+
* 获取评论列表API会返回部分回复,但可能不完整
|
|
88
|
+
* 此函数会为每个评论获取完整的回复列表
|
|
89
|
+
*/
|
|
90
|
+
async function assembleCommentsWithReplies(client, file_token, file_type, comments, user_id_type, log) {
|
|
91
|
+
const result = [];
|
|
92
|
+
for (const comment of comments) {
|
|
93
|
+
const assembled = { ...comment };
|
|
94
|
+
// 如果评论有回复,获取完整的回复列表
|
|
95
|
+
if (comment.reply_list?.replies?.length > 0 || comment.has_more) {
|
|
96
|
+
try {
|
|
97
|
+
const replies = [];
|
|
98
|
+
let pageToken = undefined;
|
|
99
|
+
let hasMore = true;
|
|
100
|
+
while (hasMore) {
|
|
101
|
+
const replyRes = await client.invoke('drive.v1.fileCommentReply.list', (sdk, opts) => sdk.drive.v1.fileCommentReply.list({
|
|
102
|
+
path: {
|
|
103
|
+
file_token,
|
|
104
|
+
comment_id: comment.comment_id,
|
|
105
|
+
},
|
|
106
|
+
params: {
|
|
107
|
+
file_type,
|
|
108
|
+
page_token: pageToken,
|
|
109
|
+
page_size: 50,
|
|
110
|
+
user_id_type,
|
|
111
|
+
},
|
|
112
|
+
}, opts), { as: 'tenant' });
|
|
113
|
+
const replyData = replyRes.data;
|
|
114
|
+
if (replyRes.code === 0 && replyData?.items) {
|
|
115
|
+
replies.push(...(replyData.items || []));
|
|
116
|
+
hasMore = replyData.has_more || false;
|
|
117
|
+
pageToken = replyData.page_token;
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
assembled.reply_list = { replies };
|
|
124
|
+
log.info(`Assembled ${replies.length} replies for comment ${comment.comment_id}`);
|
|
125
|
+
}
|
|
126
|
+
catch (err) {
|
|
127
|
+
log.warn(`Failed to fetch replies for comment ${comment.comment_id}: ${err}`);
|
|
128
|
+
// 保留原始回复数据
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
result.push(assembled);
|
|
132
|
+
}
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
135
|
+
// ---------------------------------------------------------------------------
|
|
136
|
+
// Registration
|
|
137
|
+
// ---------------------------------------------------------------------------
|
|
138
|
+
function registerDocCommentsTool(api) {
|
|
139
|
+
if (!api.config)
|
|
140
|
+
return false;
|
|
141
|
+
const cfg = api.config;
|
|
142
|
+
const { toolClient, log } = (0, helpers_1.createToolContext)(api, 'feishu_doc_comments');
|
|
143
|
+
return (0, helpers_1.registerTool)(api, {
|
|
144
|
+
name: 'feishu_doc_comments',
|
|
145
|
+
label: 'Feishu: Doc Comments',
|
|
146
|
+
description: '【以用户身份】管理云文档评论。支持: ' +
|
|
147
|
+
'(1) list - 获取评论列表(含完整回复); ' +
|
|
148
|
+
'(2) list_replies - 获取指定评论的回复列表; ' +
|
|
149
|
+
'(3) create - 添加全文评论(支持文本、@用户、超链接); ' +
|
|
150
|
+
'(4) reply - 回复已有评论; ' +
|
|
151
|
+
'(5) patch - 解决/恢复评论。' +
|
|
152
|
+
'支持 wiki token。',
|
|
153
|
+
parameters: DocCommentsSchema,
|
|
154
|
+
async execute(_toolCallId, params) {
|
|
155
|
+
const p = params;
|
|
156
|
+
try {
|
|
157
|
+
const client = toolClient();
|
|
158
|
+
const userIdType = p.user_id_type || 'open_id';
|
|
159
|
+
// 如果是 wiki token,先转换为实际的 obj_token 和 obj_type
|
|
160
|
+
let actualFileToken = p.file_token;
|
|
161
|
+
let actualFileType = p.file_type;
|
|
162
|
+
if (p.file_type === 'wiki') {
|
|
163
|
+
log.info(`doc_comments: detected wiki token="${p.file_token}", converting to obj_token...`);
|
|
164
|
+
try {
|
|
165
|
+
const wikiNodeRes = await client.invoke('feishu_wiki_space_node.get', (sdk, opts) => sdk.wiki.space.getNode({
|
|
166
|
+
params: {
|
|
167
|
+
token: p.file_token,
|
|
168
|
+
obj_type: 'wiki',
|
|
169
|
+
},
|
|
170
|
+
}, opts), { as: 'user' });
|
|
171
|
+
(0, helpers_1.assertLarkOk)(wikiNodeRes);
|
|
172
|
+
const node = wikiNodeRes.data?.node;
|
|
173
|
+
if (!node || !node.obj_token || !node.obj_type) {
|
|
174
|
+
return (0, helpers_1.json)({
|
|
175
|
+
error: `failed to resolve wiki token "${p.file_token}" to document object (may be a folder node rather than a document)`,
|
|
176
|
+
wiki_node: node,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
actualFileToken = node.obj_token;
|
|
180
|
+
actualFileType = node.obj_type;
|
|
181
|
+
log.info(`doc_comments: wiki token converted, obj_type="${actualFileType}"`);
|
|
182
|
+
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
log.error(`doc_comments: failed to convert wiki token: ${err}`);
|
|
185
|
+
return (0, helpers_1.json)({
|
|
186
|
+
error: `failed to resolve wiki token "${p.file_token}": ${err}`,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
// Action: list - 获取评论列表
|
|
191
|
+
if (p.action === 'list') {
|
|
192
|
+
log.info(`doc_comments.list: file_type=${actualFileType}`);
|
|
193
|
+
const res = await client.invoke('feishu_doc_comments.list', (sdk, opts) => sdk.drive.v1.fileComment.list({
|
|
194
|
+
path: { file_token: actualFileToken },
|
|
195
|
+
params: {
|
|
196
|
+
file_type: actualFileType,
|
|
197
|
+
is_whole: p.is_whole,
|
|
198
|
+
is_solved: p.is_solved,
|
|
199
|
+
page_size: p.page_size || 50,
|
|
200
|
+
page_token: p.page_token,
|
|
201
|
+
user_id_type: userIdType,
|
|
202
|
+
},
|
|
203
|
+
}, opts), { as: 'tenant' });
|
|
204
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
205
|
+
const items = res.data?.items || [];
|
|
206
|
+
log.info(`doc_comments.list: found ${items.length} comments`);
|
|
207
|
+
// 组装评论和完整回复
|
|
208
|
+
const assembledItems = await assembleCommentsWithReplies(client, actualFileToken, actualFileType, items, userIdType, log);
|
|
209
|
+
return (0, helpers_1.json)({
|
|
210
|
+
items: assembledItems,
|
|
211
|
+
has_more: res.data?.has_more ?? false,
|
|
212
|
+
page_token: res.data?.page_token,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
// Action: list_replies - 获取指定评论的回复列表
|
|
216
|
+
if (p.action === 'list_replies') {
|
|
217
|
+
if (!p.comment_id) {
|
|
218
|
+
return (0, helpers_1.json)({ error: 'comment_id 参数必填' });
|
|
219
|
+
}
|
|
220
|
+
log.info(`doc_comments.list_replies: comment_id="${p.comment_id}"`);
|
|
221
|
+
// Single-page fetch — return items + pagination metadata,
|
|
222
|
+
// consistent with the list action's API semantics.
|
|
223
|
+
const replyRes = await client.invoke('feishu_doc_comments.list_replies', (sdk, opts) => sdk.drive.v1.fileCommentReply.list({
|
|
224
|
+
path: {
|
|
225
|
+
file_token: actualFileToken,
|
|
226
|
+
comment_id: p.comment_id,
|
|
227
|
+
},
|
|
228
|
+
params: {
|
|
229
|
+
file_type: actualFileType,
|
|
230
|
+
page_token: p.page_token,
|
|
231
|
+
page_size: p.page_size || 50,
|
|
232
|
+
user_id_type: userIdType,
|
|
233
|
+
},
|
|
234
|
+
}, opts), { as: 'tenant' });
|
|
235
|
+
(0, helpers_1.assertLarkOk)(replyRes);
|
|
236
|
+
const replyData = replyRes.data;
|
|
237
|
+
log.info(`doc_comments.list_replies: found ${replyData?.items?.length ?? 0} replies`);
|
|
238
|
+
return (0, helpers_1.json)({
|
|
239
|
+
items: replyData?.items ?? [],
|
|
240
|
+
has_more: replyData?.has_more ?? false,
|
|
241
|
+
page_token: replyData?.page_token,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
// Action: create - 创建评论
|
|
245
|
+
if (p.action === 'create') {
|
|
246
|
+
if (!p.elements || p.elements.length === 0) {
|
|
247
|
+
return (0, helpers_1.json)({
|
|
248
|
+
error: 'elements 参数必填且不能为空',
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
log.info(`doc_comments.create: file_type=${actualFileType}, elements=${p.elements.length}`);
|
|
252
|
+
const sdkElements = convertElementsToSDKFormat(p.elements);
|
|
253
|
+
const commentData = {
|
|
254
|
+
reply_list: {
|
|
255
|
+
replies: [
|
|
256
|
+
{
|
|
257
|
+
content: {
|
|
258
|
+
elements: sdkElements,
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
],
|
|
262
|
+
},
|
|
263
|
+
};
|
|
264
|
+
const res = await client.invoke('feishu_doc_comments.create', (sdk, opts) => sdk.drive.v1.fileComment.create({
|
|
265
|
+
path: { file_token: actualFileToken },
|
|
266
|
+
params: {
|
|
267
|
+
file_type: actualFileType,
|
|
268
|
+
user_id_type: userIdType,
|
|
269
|
+
},
|
|
270
|
+
data: commentData,
|
|
271
|
+
}, opts), { as: 'tenant' });
|
|
272
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
273
|
+
log.info(`doc_comments.create: created comment ${res.data?.comment_id}`);
|
|
274
|
+
return (0, helpers_1.json)(res.data);
|
|
275
|
+
}
|
|
276
|
+
// Action: reply - 回复已有评论
|
|
277
|
+
if (p.action === 'reply') {
|
|
278
|
+
if (!p.comment_id) {
|
|
279
|
+
return (0, helpers_1.json)({ error: 'comment_id 参数必填' });
|
|
280
|
+
}
|
|
281
|
+
if (!p.elements || p.elements.length === 0) {
|
|
282
|
+
return (0, helpers_1.json)({ error: 'elements 参数必填且不能为空' });
|
|
283
|
+
}
|
|
284
|
+
log.info(`doc_comments.reply: comment_id="${p.comment_id}", elements=${p.elements.length}`);
|
|
285
|
+
const sdkElements = convertElementsToSDKFormat(p.elements);
|
|
286
|
+
// 使用 sdk.request() 发起请求(与 deliver.ts 一致),SDK 内部自动管理 TAT。
|
|
287
|
+
// 双重 payload 格式兜底:先试 content.elements,失败再试 reply_elements。
|
|
288
|
+
const replyUrl = `/open-apis/drive/v1/files/${actualFileToken}/comments/${p.comment_id}/replies`;
|
|
289
|
+
const replyParams = { file_type: actualFileType, user_id_type: userIdType };
|
|
290
|
+
let res;
|
|
291
|
+
try {
|
|
292
|
+
res = await client.invoke('feishu_doc_comments.reply', (sdk) => sdk.request({
|
|
293
|
+
method: 'POST',
|
|
294
|
+
url: replyUrl,
|
|
295
|
+
params: replyParams,
|
|
296
|
+
data: { content: { elements: sdkElements } },
|
|
297
|
+
}), { as: 'tenant' });
|
|
298
|
+
}
|
|
299
|
+
catch (_firstErr) {
|
|
300
|
+
// Fallback: 部分 API 版本使用 reply_elements 格式
|
|
301
|
+
log.info(`doc_comments.reply: first attempt failed, trying reply_elements format`);
|
|
302
|
+
res = await client.invoke('feishu_doc_comments.reply', (sdk) => sdk.request({
|
|
303
|
+
method: 'POST',
|
|
304
|
+
url: replyUrl,
|
|
305
|
+
params: replyParams,
|
|
306
|
+
data: { reply_elements: sdkElements },
|
|
307
|
+
}), { as: 'tenant' });
|
|
308
|
+
}
|
|
309
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
310
|
+
log.info(`doc_comments.reply: created reply`);
|
|
311
|
+
return (0, helpers_1.json)(res.data ?? res);
|
|
312
|
+
}
|
|
313
|
+
// Action: patch - 解决/恢复评论
|
|
314
|
+
if (p.action === 'patch') {
|
|
315
|
+
if (!p.comment_id) {
|
|
316
|
+
return (0, helpers_1.json)({
|
|
317
|
+
error: 'comment_id 参数必填',
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
if (p.is_solved_value === undefined) {
|
|
321
|
+
return (0, helpers_1.json)({
|
|
322
|
+
error: 'is_solved_value 参数必填',
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
log.info(`doc_comments.patch: comment_id="${p.comment_id}", is_solved=${p.is_solved_value}`);
|
|
326
|
+
const res = await client.invoke('feishu_doc_comments.patch', (sdk, opts) => sdk.drive.v1.fileComment.patch({
|
|
327
|
+
path: {
|
|
328
|
+
file_token: actualFileToken,
|
|
329
|
+
comment_id: p.comment_id,
|
|
330
|
+
},
|
|
331
|
+
params: {
|
|
332
|
+
file_type: actualFileType,
|
|
333
|
+
},
|
|
334
|
+
data: {
|
|
335
|
+
is_solved: p.is_solved_value,
|
|
336
|
+
},
|
|
337
|
+
}, opts), { as: 'user' });
|
|
338
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
339
|
+
log.info(`doc_comments.patch: success`);
|
|
340
|
+
return (0, helpers_1.json)({ success: true });
|
|
341
|
+
}
|
|
342
|
+
return (0, helpers_1.json)({
|
|
343
|
+
error: `未知的 action: ${p.action}`,
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
catch (err) {
|
|
347
|
+
return await (0, helpers_1.handleInvokeErrorWithAutoAuth)(err, cfg);
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
}, { name: 'feishu_doc_comments' });
|
|
351
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*
|
|
5
|
+
* feishu_doc_media tool -- 文档媒体管理(插入 + 下载)
|
|
6
|
+
*
|
|
7
|
+
* Actions:
|
|
8
|
+
* insert - 在飞书文档末尾插入本地图片或文件(3 步流程)
|
|
9
|
+
* download - 下载文档素材或画板缩略图到本地
|
|
10
|
+
*
|
|
11
|
+
* 使用以下 SDK 接口:
|
|
12
|
+
* - sdk.docx.documentBlockChildren.create - 创建子块
|
|
13
|
+
* - sdk.drive.v1.media.uploadAll - 上传素材
|
|
14
|
+
* - sdk.docx.documentBlock.batchUpdate - 批量更新块
|
|
15
|
+
* - sdk.drive.v1.media.download - 下载素材
|
|
16
|
+
* - sdk.board.v1.whiteboard.downloadAsImage - 下载画板缩略图
|
|
17
|
+
*/
|
|
18
|
+
import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
|
|
19
|
+
export declare function registerDocMediaTool(api: OpenClawPluginApi): boolean;
|