@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,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*
|
|
5
|
+
* feishu_calendar_freebusy tool -- Query user/room calendar free/busy status.
|
|
6
|
+
*
|
|
7
|
+
* P0 Actions: list
|
|
8
|
+
*
|
|
9
|
+
* Uses the Feishu Calendar API:
|
|
10
|
+
* - list: POST /open-apis/calendar/v4/freebusy/batch (批量查询接口)
|
|
11
|
+
*/
|
|
12
|
+
import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
|
|
13
|
+
export declare function registerFeishuCalendarFreebusyTool(api: OpenClawPluginApi): void;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*
|
|
6
|
+
* feishu_calendar_freebusy tool -- Query user/room calendar free/busy status.
|
|
7
|
+
*
|
|
8
|
+
* P0 Actions: list
|
|
9
|
+
*
|
|
10
|
+
* Uses the Feishu Calendar API:
|
|
11
|
+
* - list: POST /open-apis/calendar/v4/freebusy/batch (批量查询接口)
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.registerFeishuCalendarFreebusyTool = registerFeishuCalendarFreebusyTool;
|
|
15
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
16
|
+
const helpers_1 = require("../helpers.js");
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Schema
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
const FeishuCalendarFreebusySchema = typebox_1.Type.Object({
|
|
21
|
+
action: typebox_1.Type.Literal('list'),
|
|
22
|
+
time_min: typebox_1.Type.String({
|
|
23
|
+
description: "查询起始时间(ISO 8601 / RFC 3339 格式(包含时区),例如 '2024-01-01T00:00:00+08:00')",
|
|
24
|
+
}),
|
|
25
|
+
time_max: typebox_1.Type.String({
|
|
26
|
+
description: "查询结束时间(ISO 8601 / RFC 3339 格式(包含时区),例如 '2024-01-01T00:00:00+08:00')",
|
|
27
|
+
}),
|
|
28
|
+
user_ids: typebox_1.Type.Array(typebox_1.Type.String({
|
|
29
|
+
description: '用户 open_id',
|
|
30
|
+
}), {
|
|
31
|
+
description: '要查询忙闲的用户 ID 列表(1-10 个用户)',
|
|
32
|
+
minItems: 1,
|
|
33
|
+
maxItems: 10,
|
|
34
|
+
}),
|
|
35
|
+
});
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
// Registration
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
function registerFeishuCalendarFreebusyTool(api) {
|
|
40
|
+
if (!api.config)
|
|
41
|
+
return;
|
|
42
|
+
const cfg = api.config;
|
|
43
|
+
const { toolClient, log } = (0, helpers_1.createToolContext)(api, 'feishu_calendar_freebusy');
|
|
44
|
+
(0, helpers_1.registerTool)(api, {
|
|
45
|
+
name: 'feishu_calendar_freebusy',
|
|
46
|
+
label: 'Feishu Calendar Free/Busy Status',
|
|
47
|
+
description: '【以用户身份】飞书日历忙闲查询工具。当用户要求查询某时间段内某人是否空闲、查看忙闲状态时使用。支持批量查询 1-10 个用户的主日历忙闲信息,用于安排会议时间。',
|
|
48
|
+
parameters: FeishuCalendarFreebusySchema,
|
|
49
|
+
async execute(_toolCallId, params) {
|
|
50
|
+
const p = params;
|
|
51
|
+
log.info(`[FREEBUSY] Execute called with params: ${JSON.stringify(p)}`);
|
|
52
|
+
try {
|
|
53
|
+
const client = toolClient();
|
|
54
|
+
if (p.action !== 'list') {
|
|
55
|
+
log.warn(`[FREEBUSY] Unknown action: ${p.action}`);
|
|
56
|
+
return (0, helpers_1.json)({ error: `Unknown action: ${p.action}` });
|
|
57
|
+
}
|
|
58
|
+
// Validate user_ids (batch API requires 1-10 users)
|
|
59
|
+
if (!p.user_ids || p.user_ids.length === 0) {
|
|
60
|
+
log.warn(`[FREEBUSY] user_ids is empty`);
|
|
61
|
+
return (0, helpers_1.json)({
|
|
62
|
+
error: 'user_ids is required (1-10 user IDs)',
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
if (p.user_ids.length > 10) {
|
|
66
|
+
log.warn(`[FREEBUSY] user_ids exceeds limit: ${p.user_ids.length}`);
|
|
67
|
+
return (0, helpers_1.json)({
|
|
68
|
+
error: `user_ids count exceeds limit, maximum 10 users (current: ${p.user_ids.length})`,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
log.info(`[FREEBUSY] Validation passed, user_ids count: ${p.user_ids.length}`);
|
|
72
|
+
// Convert time strings to RFC 3339 format (required by freebusy API)
|
|
73
|
+
const timeMin = (0, helpers_1.parseTimeToRFC3339)(p.time_min);
|
|
74
|
+
const timeMax = (0, helpers_1.parseTimeToRFC3339)(p.time_max);
|
|
75
|
+
if (!timeMin || !timeMax) {
|
|
76
|
+
log.warn(`[FREEBUSY] Time format error: time_min=${p.time_min}, time_max=${p.time_max}`);
|
|
77
|
+
return (0, helpers_1.json)({
|
|
78
|
+
error: "Invalid time format. Must use ISO 8601 / RFC 3339 with timezone, e.g. '2024-01-01T00:00:00+08:00' or '2026-02-25 14:00:00'.",
|
|
79
|
+
received_time_min: p.time_min,
|
|
80
|
+
received_time_max: p.time_max,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
log.info(`[FREEBUSY] Calling batch API: time_min=${p.time_min} -> ${timeMin}, time_max=${p.time_max} -> ${timeMax}, user_ids=${p.user_ids.length}`);
|
|
84
|
+
const res = await client.invoke('feishu_calendar_freebusy.list', (sdk, opts) => sdk.calendar.freebusy.batch({
|
|
85
|
+
data: {
|
|
86
|
+
time_min: timeMin,
|
|
87
|
+
time_max: timeMax,
|
|
88
|
+
user_ids: p.user_ids,
|
|
89
|
+
include_external_calendar: true,
|
|
90
|
+
only_busy: true,
|
|
91
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
92
|
+
}, // SDK 类型定义可能未包含所有字段
|
|
93
|
+
}, opts), { as: 'user' });
|
|
94
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
95
|
+
const data = res.data;
|
|
96
|
+
const freebusyLists = data?.freebusy_lists ?? [];
|
|
97
|
+
log.info(`[FREEBUSY] Success: returned ${freebusyLists.length} user(s) freebusy data`);
|
|
98
|
+
return (0, helpers_1.json)({
|
|
99
|
+
freebusy_lists: freebusyLists,
|
|
100
|
+
_debug: {
|
|
101
|
+
time_min_input: p.time_min,
|
|
102
|
+
time_min_rfc3339: timeMin,
|
|
103
|
+
time_max_input: p.time_max,
|
|
104
|
+
time_max_rfc3339: timeMax,
|
|
105
|
+
user_count: p.user_ids.length,
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
return await (0, helpers_1.handleInvokeErrorWithAutoAuth)(err, cfg);
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
}, { name: 'feishu_calendar_freebusy' });
|
|
114
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
export { registerFeishuCalendarCalendarTool } from './calendar';
|
|
6
|
+
export { registerFeishuCalendarEventTool } from './event';
|
|
7
|
+
export { registerFeishuCalendarEventAttendeeTool } from './event-attendee';
|
|
8
|
+
export { registerFeishuCalendarFreebusyTool } from './freebusy';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.registerFeishuCalendarFreebusyTool = exports.registerFeishuCalendarEventAttendeeTool = exports.registerFeishuCalendarEventTool = exports.registerFeishuCalendarCalendarTool = void 0;
|
|
8
|
+
var calendar_1 = require("./calendar.js");
|
|
9
|
+
Object.defineProperty(exports, "registerFeishuCalendarCalendarTool", { enumerable: true, get: function () { return calendar_1.registerFeishuCalendarCalendarTool; } });
|
|
10
|
+
var event_1 = require("./event.js");
|
|
11
|
+
Object.defineProperty(exports, "registerFeishuCalendarEventTool", { enumerable: true, get: function () { return event_1.registerFeishuCalendarEventTool; } });
|
|
12
|
+
var event_attendee_1 = require("./event-attendee.js");
|
|
13
|
+
Object.defineProperty(exports, "registerFeishuCalendarEventAttendeeTool", { enumerable: true, get: function () { return event_attendee_1.registerFeishuCalendarEventAttendeeTool; } });
|
|
14
|
+
var freebusy_1 = require("./freebusy.js");
|
|
15
|
+
Object.defineProperty(exports, "registerFeishuCalendarFreebusyTool", { enumerable: true, get: function () { return freebusy_1.registerFeishuCalendarFreebusyTool; } });
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*
|
|
5
|
+
* feishu_chat tool -- 管理飞书群聊
|
|
6
|
+
*
|
|
7
|
+
* Actions:
|
|
8
|
+
* - search: 搜索对用户或机器人可见的群列表
|
|
9
|
+
* - get: 获取指定群的详细信息
|
|
10
|
+
*
|
|
11
|
+
* Uses the Feishu IM v1 API:
|
|
12
|
+
* - search: GET /open-apis/im/v1/chats/search
|
|
13
|
+
* - get: GET /open-apis/im/v1/chats/:chat_id
|
|
14
|
+
*/
|
|
15
|
+
import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
|
|
16
|
+
export declare function registerChatSearchTool(api: OpenClawPluginApi): boolean;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*
|
|
6
|
+
* feishu_chat tool -- 管理飞书群聊
|
|
7
|
+
*
|
|
8
|
+
* Actions:
|
|
9
|
+
* - search: 搜索对用户或机器人可见的群列表
|
|
10
|
+
* - get: 获取指定群的详细信息
|
|
11
|
+
*
|
|
12
|
+
* Uses the Feishu IM v1 API:
|
|
13
|
+
* - search: GET /open-apis/im/v1/chats/search
|
|
14
|
+
* - get: GET /open-apis/im/v1/chats/:chat_id
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.registerChatSearchTool = registerChatSearchTool;
|
|
18
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
19
|
+
const helpers_1 = require("../helpers.js");
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// Schema
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
const FeishuChatSchema = typebox_1.Type.Union([
|
|
24
|
+
// SEARCH
|
|
25
|
+
typebox_1.Type.Object({
|
|
26
|
+
action: typebox_1.Type.Literal('search'),
|
|
27
|
+
query: typebox_1.Type.String({
|
|
28
|
+
description: '搜索关键词(必填)。支持匹配群名称、群成员名称。' + '支持多语种、拼音、前缀等模糊搜索。',
|
|
29
|
+
}),
|
|
30
|
+
page_size: typebox_1.Type.Optional(typebox_1.Type.Integer({
|
|
31
|
+
description: '分页大小(默认20)',
|
|
32
|
+
minimum: 1,
|
|
33
|
+
})),
|
|
34
|
+
page_token: typebox_1.Type.Optional(typebox_1.Type.String({
|
|
35
|
+
description: '分页标记。首次请求无需填写',
|
|
36
|
+
})),
|
|
37
|
+
user_id_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['open_id', 'union_id', 'user_id'], {
|
|
38
|
+
description: '用户 ID 类型(默认 open_id)',
|
|
39
|
+
})),
|
|
40
|
+
}),
|
|
41
|
+
// GET
|
|
42
|
+
typebox_1.Type.Object({
|
|
43
|
+
action: typebox_1.Type.Literal('get'),
|
|
44
|
+
chat_id: typebox_1.Type.String({
|
|
45
|
+
description: '群 ID(格式如 oc_xxx)',
|
|
46
|
+
}),
|
|
47
|
+
user_id_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['open_id', 'union_id', 'user_id'], {
|
|
48
|
+
description: '用户 ID 类型(默认 open_id)',
|
|
49
|
+
})),
|
|
50
|
+
}),
|
|
51
|
+
]);
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
// Registration
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
function registerChatSearchTool(api) {
|
|
56
|
+
if (!api.config)
|
|
57
|
+
return false;
|
|
58
|
+
const cfg = api.config;
|
|
59
|
+
const { toolClient, log } = (0, helpers_1.createToolContext)(api, 'feishu_chat');
|
|
60
|
+
return (0, helpers_1.registerTool)(api, {
|
|
61
|
+
name: 'feishu_chat',
|
|
62
|
+
label: 'Feishu: Chat Management',
|
|
63
|
+
description: '以用户身份调用飞书群聊管理工具。Actions: search(搜索群列表,支持关键词匹配群名称、群成员), get(获取指定群的详细信息,包括群名称、描述、头像、群主、权限配置等)。',
|
|
64
|
+
parameters: FeishuChatSchema,
|
|
65
|
+
async execute(_toolCallId, params) {
|
|
66
|
+
const p = params;
|
|
67
|
+
try {
|
|
68
|
+
const client = toolClient();
|
|
69
|
+
switch (p.action) {
|
|
70
|
+
// -----------------------------------------------------------------
|
|
71
|
+
// SEARCH
|
|
72
|
+
// -----------------------------------------------------------------
|
|
73
|
+
case 'search': {
|
|
74
|
+
log.info(`search: query="${p.query}", page_size=${p.page_size ?? 20}`);
|
|
75
|
+
const res = await client.invoke('feishu_chat.search', (sdk, opts) => sdk.im.v1.chat.search({
|
|
76
|
+
params: {
|
|
77
|
+
user_id_type: p.user_id_type || 'open_id',
|
|
78
|
+
query: p.query,
|
|
79
|
+
page_size: p.page_size,
|
|
80
|
+
page_token: p.page_token,
|
|
81
|
+
},
|
|
82
|
+
}, opts), { as: 'user' });
|
|
83
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
84
|
+
const data = res.data;
|
|
85
|
+
const chatCount = data?.items?.length ?? 0;
|
|
86
|
+
log.info(`search: found ${chatCount} chats`);
|
|
87
|
+
return (0, helpers_1.json)({
|
|
88
|
+
items: data?.items,
|
|
89
|
+
has_more: data?.has_more ?? false,
|
|
90
|
+
page_token: data?.page_token,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
// -----------------------------------------------------------------
|
|
94
|
+
// GET
|
|
95
|
+
// -----------------------------------------------------------------
|
|
96
|
+
case 'get': {
|
|
97
|
+
log.info(`get: chat_id=${p.chat_id}, user_id_type=${p.user_id_type ?? 'open_id'}`);
|
|
98
|
+
const res = await client.invoke('feishu_chat.get', (sdk, opts) => sdk.im.v1.chat.get({
|
|
99
|
+
path: {
|
|
100
|
+
chat_id: p.chat_id,
|
|
101
|
+
},
|
|
102
|
+
params: {
|
|
103
|
+
user_id_type: p.user_id_type || 'open_id',
|
|
104
|
+
},
|
|
105
|
+
}, {
|
|
106
|
+
...(opts ?? {}),
|
|
107
|
+
headers: {
|
|
108
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
109
|
+
...(opts?.headers ?? {}),
|
|
110
|
+
'X-Chat-Custom-Header': 'enable_chat_list_security_check',
|
|
111
|
+
},
|
|
112
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
113
|
+
}), { as: 'user' });
|
|
114
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
115
|
+
log.info(`get: retrieved chat info for ${p.chat_id}`);
|
|
116
|
+
return (0, helpers_1.json)({
|
|
117
|
+
chat: res.data,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
return await (0, helpers_1.handleInvokeErrorWithAutoAuth)(err, cfg);
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
}, { name: 'feishu_chat' });
|
|
127
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*
|
|
5
|
+
* Chat Tools Index
|
|
6
|
+
*
|
|
7
|
+
* 群组相关工具
|
|
8
|
+
*/
|
|
9
|
+
import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
|
|
10
|
+
export declare function registerFeishuChatTools(api: OpenClawPluginApi): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*
|
|
6
|
+
* Chat Tools Index
|
|
7
|
+
*
|
|
8
|
+
* 群组相关工具
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.registerFeishuChatTools = registerFeishuChatTools;
|
|
12
|
+
const chat_1 = require("./chat.js");
|
|
13
|
+
const members_1 = require("./members.js");
|
|
14
|
+
function registerFeishuChatTools(api) {
|
|
15
|
+
const registered = [];
|
|
16
|
+
if ((0, chat_1.registerChatSearchTool)(api))
|
|
17
|
+
registered.push('feishu_chat');
|
|
18
|
+
if ((0, members_1.registerChatMembersTool)(api))
|
|
19
|
+
registered.push('feishu_chat_members');
|
|
20
|
+
if (registered.length > 0) {
|
|
21
|
+
api.logger.debug?.(`feishu_chat: Registered ${registered.join(', ')}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*
|
|
5
|
+
* feishu_chat_members tool -- 获取群成员列表
|
|
6
|
+
*
|
|
7
|
+
* 获取指定群组的成员信息,包括成员名字与 ID
|
|
8
|
+
* 使用 sdk.im.v1.chatMembers.get 接口
|
|
9
|
+
*/
|
|
10
|
+
import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
|
|
11
|
+
export declare function registerChatMembersTool(api: OpenClawPluginApi): boolean;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*
|
|
6
|
+
* feishu_chat_members tool -- 获取群成员列表
|
|
7
|
+
*
|
|
8
|
+
* 获取指定群组的成员信息,包括成员名字与 ID
|
|
9
|
+
* 使用 sdk.im.v1.chatMembers.get 接口
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.registerChatMembersTool = registerChatMembersTool;
|
|
13
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
14
|
+
const helpers_1 = require("../helpers.js");
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
// Schema
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
const ChatMembersSchema = typebox_1.Type.Object({
|
|
19
|
+
chat_id: typebox_1.Type.String({
|
|
20
|
+
description: '群 ID(格式如 oc_xxx)。' + '可以通过 feishu_chat_search 工具搜索获取',
|
|
21
|
+
}),
|
|
22
|
+
member_id_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['open_id', 'union_id', 'user_id'])),
|
|
23
|
+
page_size: typebox_1.Type.Optional(typebox_1.Type.Integer({
|
|
24
|
+
description: '分页大小(默认20)',
|
|
25
|
+
minimum: 1,
|
|
26
|
+
})),
|
|
27
|
+
page_token: typebox_1.Type.Optional(typebox_1.Type.String({
|
|
28
|
+
description: '分页标记。首次请求无需填写',
|
|
29
|
+
})),
|
|
30
|
+
});
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// Registration
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
function registerChatMembersTool(api) {
|
|
35
|
+
if (!api.config)
|
|
36
|
+
return false;
|
|
37
|
+
const cfg = api.config;
|
|
38
|
+
const { toolClient, log } = (0, helpers_1.createToolContext)(api, 'feishu_chat_members');
|
|
39
|
+
return (0, helpers_1.registerTool)(api, {
|
|
40
|
+
name: 'feishu_chat_members',
|
|
41
|
+
label: 'Feishu: Get Chat Members',
|
|
42
|
+
description: '以用户的身份获取指定群组的成员列表。' +
|
|
43
|
+
'返回成员信息,包含成员 ID、姓名等。' +
|
|
44
|
+
'注意:不会返回群组内的机器人成员。',
|
|
45
|
+
parameters: ChatMembersSchema,
|
|
46
|
+
async execute(_toolCallId, params) {
|
|
47
|
+
const p = params;
|
|
48
|
+
try {
|
|
49
|
+
const client = toolClient();
|
|
50
|
+
log.info(`chat_members: chat_id="${p.chat_id}", page_size=${p.page_size ?? 20}`);
|
|
51
|
+
const res = await client.invoke('feishu_chat_members.default', (sdk, opts) => sdk.im.v1.chatMembers.get({
|
|
52
|
+
path: { chat_id: p.chat_id },
|
|
53
|
+
params: {
|
|
54
|
+
member_id_type: p.member_id_type || 'open_id',
|
|
55
|
+
page_size: p.page_size,
|
|
56
|
+
page_token: p.page_token,
|
|
57
|
+
},
|
|
58
|
+
}, {
|
|
59
|
+
...(opts ?? {}),
|
|
60
|
+
headers: {
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
62
|
+
...(opts?.headers ?? {}),
|
|
63
|
+
'X-Chat-Custom-Header': 'enable_chat_list_security_check',
|
|
64
|
+
},
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
66
|
+
}), { as: 'user' });
|
|
67
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
68
|
+
const data = res.data;
|
|
69
|
+
const memberCount = data?.items?.length ?? 0;
|
|
70
|
+
const memberTotal = data?.member_total ?? 0;
|
|
71
|
+
log.info(`chat_members: found ${memberCount} members (total: ${memberTotal})`);
|
|
72
|
+
return (0, helpers_1.json)({
|
|
73
|
+
items: data?.items,
|
|
74
|
+
has_more: data?.has_more ?? false,
|
|
75
|
+
page_token: data?.page_token,
|
|
76
|
+
member_total: memberTotal,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
return await (0, helpers_1.handleInvokeErrorWithAutoAuth)(err, cfg);
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
}, { name: 'feishu_chat_members' });
|
|
84
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*
|
|
5
|
+
* feishu_get_user tool -- 获取用户信息
|
|
6
|
+
*
|
|
7
|
+
* 支持两种模式:
|
|
8
|
+
* 1. 不传 user_id: 获取当前用户自己的信息 (sdk.authen.userInfo.get)
|
|
9
|
+
* 2. 传 user_id: 获取指定用户的信息 (sdk.contact.v3.user.get)
|
|
10
|
+
*/
|
|
11
|
+
import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
|
|
12
|
+
export declare function registerGetUserTool(api: OpenClawPluginApi): void;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*
|
|
6
|
+
* feishu_get_user tool -- 获取用户信息
|
|
7
|
+
*
|
|
8
|
+
* 支持两种模式:
|
|
9
|
+
* 1. 不传 user_id: 获取当前用户自己的信息 (sdk.authen.userInfo.get)
|
|
10
|
+
* 2. 传 user_id: 获取指定用户的信息 (sdk.contact.v3.user.get)
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.registerGetUserTool = registerGetUserTool;
|
|
14
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
15
|
+
const helpers_1 = require("../helpers.js");
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
// Schema
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
const GetUserSchema = typebox_1.Type.Object({
|
|
20
|
+
user_id: typebox_1.Type.Optional(typebox_1.Type.String({
|
|
21
|
+
description: '用户 ID(格式如 ou_xxx)。若不传入,则获取当前用户自己的信息',
|
|
22
|
+
})),
|
|
23
|
+
user_id_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['open_id', 'union_id', 'user_id'])),
|
|
24
|
+
});
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
// Registration
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
function registerGetUserTool(api) {
|
|
29
|
+
if (!api.config)
|
|
30
|
+
return;
|
|
31
|
+
const cfg = api.config;
|
|
32
|
+
const { toolClient, log } = (0, helpers_1.createToolContext)(api, 'feishu_get_user');
|
|
33
|
+
(0, helpers_1.registerTool)(api, {
|
|
34
|
+
name: 'feishu_get_user',
|
|
35
|
+
label: 'Feishu: Get User Info',
|
|
36
|
+
description: '获取用户信息。不传 user_id 时获取当前用户自己的信息;传 user_id 时获取指定用户的信息。' +
|
|
37
|
+
'返回用户姓名、头像、邮箱、手机号、部门等信息。',
|
|
38
|
+
parameters: GetUserSchema,
|
|
39
|
+
async execute(_toolCallId, params) {
|
|
40
|
+
const p = params;
|
|
41
|
+
try {
|
|
42
|
+
const client = toolClient();
|
|
43
|
+
// 模式 1: 获取当前用户自己的信息
|
|
44
|
+
if (!p.user_id) {
|
|
45
|
+
log.info('get_user: fetching current user info');
|
|
46
|
+
try {
|
|
47
|
+
const res = await client.invoke('feishu_get_user.default', (sdk, opts) => sdk.authen.userInfo.get({}, opts), { as: 'user' });
|
|
48
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
49
|
+
log.info('get_user: current user fetched successfully');
|
|
50
|
+
return (0, helpers_1.json)({
|
|
51
|
+
user: res.data,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
catch (invokeErr) {
|
|
55
|
+
// 特殊处理错误码 41050:用户组织架构可见范围限制
|
|
56
|
+
if (invokeErr && typeof invokeErr === 'object') {
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
58
|
+
const e = invokeErr;
|
|
59
|
+
if (e.response?.data?.code === 41050) {
|
|
60
|
+
return (0, helpers_1.json)({
|
|
61
|
+
error: '无权限查询该用户信息。\n\n' +
|
|
62
|
+
'说明:使用用户身份调用通讯录 API 时,可操作的权限范围不受应用的通讯录权限范围影响,' +
|
|
63
|
+
'而是受当前用户的组织架构可见范围影响。该范围限制了用户在企业内可见的组织架构数据范围。',
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
throw invokeErr;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// 模式 2: 获取指定用户的信息
|
|
71
|
+
log.info(`get_user: fetching user ${p.user_id}`);
|
|
72
|
+
const userIdType = p.user_id_type || 'open_id';
|
|
73
|
+
try {
|
|
74
|
+
const res = await client.invoke('feishu_get_user.default', (sdk, opts) => sdk.contact.v3.user.get({
|
|
75
|
+
path: { user_id: p.user_id },
|
|
76
|
+
params: {
|
|
77
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
78
|
+
user_id_type: userIdType,
|
|
79
|
+
},
|
|
80
|
+
}, opts), { as: 'user' });
|
|
81
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
82
|
+
log.info(`get_user: user ${p.user_id} fetched successfully`);
|
|
83
|
+
return (0, helpers_1.json)({
|
|
84
|
+
user: res.data?.user,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
catch (invokeErr) {
|
|
88
|
+
// 特殊处理错误码 41050:用户组织架构可见范围限制
|
|
89
|
+
if (invokeErr && typeof invokeErr === 'object') {
|
|
90
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
91
|
+
const e = invokeErr;
|
|
92
|
+
if (e.response?.data?.code === 41050) {
|
|
93
|
+
return (0, helpers_1.json)({
|
|
94
|
+
error: '无权限查询该用户信息。\n\n' +
|
|
95
|
+
'说明:使用用户身份调用通讯录 API 时,可操作的权限范围不受应用的通讯录权限范围影响,' +
|
|
96
|
+
'而是受当前用户的组织架构可见范围影响。该范围限制了用户在企业内可见的组织架构数据范围。\n\n' +
|
|
97
|
+
'建议:请联系管理员调整当前用户的组织架构可见范围,或使用应用身份(tenant_access_token)调用 API。',
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
throw invokeErr;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
return await (0, helpers_1.handleInvokeErrorWithAutoAuth)(err, cfg);
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
}, { name: 'feishu_get_user' });
|
|
109
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.registerSearchUserTool = exports.registerGetUserTool = void 0;
|
|
8
|
+
var get_user_1 = require("./get-user.js");
|
|
9
|
+
Object.defineProperty(exports, "registerGetUserTool", { enumerable: true, get: function () { return get_user_1.registerGetUserTool; } });
|
|
10
|
+
var search_user_1 = require("./search-user.js");
|
|
11
|
+
Object.defineProperty(exports, "registerSearchUserTool", { enumerable: true, get: function () { return search_user_1.registerSearchUserTool; } });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*
|
|
5
|
+
* feishu_search_user tool -- 搜索员工
|
|
6
|
+
*
|
|
7
|
+
* 通过关键词搜索员工,结果按亲密度排序
|
|
8
|
+
* 使用搜索接口(/open-apis/search/v1/user)
|
|
9
|
+
*/
|
|
10
|
+
import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
|
|
11
|
+
export declare function registerSearchUserTool(api: OpenClawPluginApi): void;
|