@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,512 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*
|
|
6
|
+
* feishu_task_task tool -- Manage Feishu tasks.
|
|
7
|
+
*
|
|
8
|
+
* P0 Actions: create, get, list, patch
|
|
9
|
+
* P1 Actions: add_members, append_steps
|
|
10
|
+
*
|
|
11
|
+
* Uses the Feishu Task v2 API:
|
|
12
|
+
* - create: POST /open-apis/task/v2/tasks
|
|
13
|
+
* - get: GET /open-apis/task/v2/tasks/:task_guid
|
|
14
|
+
* - list: GET /open-apis/task/v2/tasks
|
|
15
|
+
* - patch: PATCH /open-apis/task/v2/tasks/:task_guid
|
|
16
|
+
* - add_members: POST /open-apis/task/v2/tasks/:task_guid/add_members
|
|
17
|
+
* - append_steps: POST /open-apis/task/v2/agent_task_step_info/append_task_steps
|
|
18
|
+
*/
|
|
19
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.registerFeishuTaskTaskTool = registerFeishuTaskTaskTool;
|
|
22
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
23
|
+
const helpers_1 = require("../helpers.js");
|
|
24
|
+
const raw_request_1 = require("../../../core/raw-request.js");
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
// Schema
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
const FeishuTaskTaskSchema = typebox_1.Type.Union([
|
|
29
|
+
// CREATE
|
|
30
|
+
typebox_1.Type.Object({
|
|
31
|
+
action: typebox_1.Type.Literal('create'),
|
|
32
|
+
summary: typebox_1.Type.String({
|
|
33
|
+
description: '任务标题',
|
|
34
|
+
}),
|
|
35
|
+
current_user_id: typebox_1.Type.Optional(typebox_1.Type.String({
|
|
36
|
+
description: '当前用户的 open_id(强烈建议,从消息上下文的 SenderId 获取)。如果 members 中不包含此用户,工具会自动添加为 follower,确保创建者可以编辑任务。',
|
|
37
|
+
})),
|
|
38
|
+
description: typebox_1.Type.Optional(typebox_1.Type.String({
|
|
39
|
+
description: '任务描述',
|
|
40
|
+
})),
|
|
41
|
+
due: typebox_1.Type.Optional(typebox_1.Type.Object({
|
|
42
|
+
timestamp: typebox_1.Type.String({
|
|
43
|
+
description: "截止时间(ISO 8601 / RFC 3339 格式(包含时区),例如 '2024-01-01T00:00:00+08:00')",
|
|
44
|
+
}),
|
|
45
|
+
is_all_day: typebox_1.Type.Optional(typebox_1.Type.Boolean({
|
|
46
|
+
description: '是否为全天任务',
|
|
47
|
+
})),
|
|
48
|
+
})),
|
|
49
|
+
start: typebox_1.Type.Optional(typebox_1.Type.Object({
|
|
50
|
+
timestamp: typebox_1.Type.String({
|
|
51
|
+
description: "开始时间(ISO 8601 / RFC 3339 格式(包含时区),例如 '2024-01-01T00:00:00+08:00')",
|
|
52
|
+
}),
|
|
53
|
+
is_all_day: typebox_1.Type.Optional(typebox_1.Type.Boolean({
|
|
54
|
+
description: '是否为全天',
|
|
55
|
+
})),
|
|
56
|
+
})),
|
|
57
|
+
members: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Object({
|
|
58
|
+
id: typebox_1.Type.String({
|
|
59
|
+
description: '成员 ID(通常为 open_id)',
|
|
60
|
+
}),
|
|
61
|
+
type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['user', 'app'])),
|
|
62
|
+
role: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['assignee', 'follower'])),
|
|
63
|
+
}), {
|
|
64
|
+
description: '任务成员列表(assignee=负责人,follower=关注人)。成员类型(type)支持 user 和 app,默认为 user。机器人和应用应该使用app',
|
|
65
|
+
})),
|
|
66
|
+
repeat_rule: typebox_1.Type.Optional(typebox_1.Type.String({
|
|
67
|
+
description: '重复规则(RRULE 格式)',
|
|
68
|
+
})),
|
|
69
|
+
tasklists: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Object({
|
|
70
|
+
tasklist_guid: typebox_1.Type.String({
|
|
71
|
+
description: '清单 GUID',
|
|
72
|
+
}),
|
|
73
|
+
section_guid: typebox_1.Type.Optional(typebox_1.Type.String({
|
|
74
|
+
description: '分组 GUID',
|
|
75
|
+
})),
|
|
76
|
+
}), {
|
|
77
|
+
description: '任务所属清单列表',
|
|
78
|
+
})),
|
|
79
|
+
auth_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['tenant', 'user'], {
|
|
80
|
+
description: '授权类型,默认 user。使用 user 时为用户身份(只能查看/操作自己有权限的任务),使用 tenant 时为应用身份。',
|
|
81
|
+
})),
|
|
82
|
+
user_id_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['open_id', 'union_id', 'user_id'])),
|
|
83
|
+
}),
|
|
84
|
+
// GET
|
|
85
|
+
typebox_1.Type.Object({
|
|
86
|
+
action: typebox_1.Type.Literal('get'),
|
|
87
|
+
task_guid: typebox_1.Type.String({
|
|
88
|
+
description: 'Task GUID',
|
|
89
|
+
}),
|
|
90
|
+
auth_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['tenant', 'user'], {
|
|
91
|
+
description: '授权类型,默认 user。',
|
|
92
|
+
})),
|
|
93
|
+
user_id_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['open_id', 'union_id', 'user_id'])),
|
|
94
|
+
}),
|
|
95
|
+
// LIST
|
|
96
|
+
typebox_1.Type.Object({
|
|
97
|
+
action: typebox_1.Type.Literal('list'),
|
|
98
|
+
page_size: typebox_1.Type.Optional(typebox_1.Type.Number({
|
|
99
|
+
description: '每页数量(默认 50,最大 100)。',
|
|
100
|
+
})),
|
|
101
|
+
page_token: typebox_1.Type.Optional(typebox_1.Type.String({
|
|
102
|
+
description: '分页标记',
|
|
103
|
+
})),
|
|
104
|
+
completed: typebox_1.Type.Optional(typebox_1.Type.Boolean({
|
|
105
|
+
description: '是否筛选已完成任务',
|
|
106
|
+
})),
|
|
107
|
+
agent_task_status: typebox_1.Type.Optional(typebox_1.Type.Integer({
|
|
108
|
+
description: 'Agent 任务状态',
|
|
109
|
+
})),
|
|
110
|
+
auth_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['tenant', 'user'], {
|
|
111
|
+
description: '授权类型,默认 user。',
|
|
112
|
+
})),
|
|
113
|
+
user_id_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['open_id', 'union_id', 'user_id'])),
|
|
114
|
+
}),
|
|
115
|
+
// PATCH
|
|
116
|
+
typebox_1.Type.Object({
|
|
117
|
+
action: typebox_1.Type.Literal('patch'),
|
|
118
|
+
task_guid: typebox_1.Type.String({
|
|
119
|
+
description: 'Task GUID',
|
|
120
|
+
}),
|
|
121
|
+
summary: typebox_1.Type.Optional(typebox_1.Type.String({
|
|
122
|
+
description: '新的任务标题',
|
|
123
|
+
})),
|
|
124
|
+
description: typebox_1.Type.Optional(typebox_1.Type.String({
|
|
125
|
+
description: '新的任务描述',
|
|
126
|
+
})),
|
|
127
|
+
due: typebox_1.Type.Optional(typebox_1.Type.Object({
|
|
128
|
+
timestamp: typebox_1.Type.String({
|
|
129
|
+
description: "新的截止时间(ISO 8601 / RFC 3339 格式(包含时区),例如 '2024-01-01T00:00:00+08:00')",
|
|
130
|
+
}),
|
|
131
|
+
is_all_day: typebox_1.Type.Optional(typebox_1.Type.Boolean({
|
|
132
|
+
description: '是否为全天任务',
|
|
133
|
+
})),
|
|
134
|
+
})),
|
|
135
|
+
start: typebox_1.Type.Optional(typebox_1.Type.Object({
|
|
136
|
+
timestamp: typebox_1.Type.String({
|
|
137
|
+
description: "新的开始时间(ISO 8601 / RFC 3339 格式(包含时区),例如 '2024-01-01T00:00:00+08:00')",
|
|
138
|
+
}),
|
|
139
|
+
is_all_day: typebox_1.Type.Optional(typebox_1.Type.Boolean({
|
|
140
|
+
description: '是否为全天',
|
|
141
|
+
})),
|
|
142
|
+
})),
|
|
143
|
+
completed_at: typebox_1.Type.Optional(typebox_1.Type.String({
|
|
144
|
+
description: "完成时间。支持三种格式:1) ISO 8601 / RFC 3339 格式(包含时区),例如 '2024-01-01T00:00:00+08:00'(设为已完成);2) '0'(反完成,任务变为未完成);3) 毫秒时间戳字符串。",
|
|
145
|
+
})),
|
|
146
|
+
agent_task_progress: typebox_1.Type.Optional(typebox_1.Type.String({
|
|
147
|
+
description: 'Agent 任务进度',
|
|
148
|
+
})),
|
|
149
|
+
agent_task_status: typebox_1.Type.Optional(typebox_1.Type.Integer({
|
|
150
|
+
description: 'Agent 任务状态',
|
|
151
|
+
})),
|
|
152
|
+
text_deliveries: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.String(), {
|
|
153
|
+
description: '文本交付列表',
|
|
154
|
+
})),
|
|
155
|
+
members: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Object({
|
|
156
|
+
id: typebox_1.Type.String({
|
|
157
|
+
description: '成员 ID(通常为 open_id)',
|
|
158
|
+
}),
|
|
159
|
+
type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['user', 'app'])),
|
|
160
|
+
role: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['assignee', 'follower'])),
|
|
161
|
+
}), {
|
|
162
|
+
description: '新的任务成员列表。成员类型支持 user 和 app,默认为 user。',
|
|
163
|
+
})),
|
|
164
|
+
repeat_rule: typebox_1.Type.Optional(typebox_1.Type.String({
|
|
165
|
+
description: '新的重复规则(RRULE 格式)',
|
|
166
|
+
})),
|
|
167
|
+
auth_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['tenant', 'user'], {
|
|
168
|
+
description: '授权类型,默认 user。',
|
|
169
|
+
})),
|
|
170
|
+
user_id_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['open_id', 'union_id', 'user_id'])),
|
|
171
|
+
}),
|
|
172
|
+
// ADD_MEMBERS
|
|
173
|
+
typebox_1.Type.Object({
|
|
174
|
+
action: typebox_1.Type.Literal('add_members'),
|
|
175
|
+
task_guid: typebox_1.Type.String({
|
|
176
|
+
description: 'Task GUID',
|
|
177
|
+
}),
|
|
178
|
+
members: typebox_1.Type.Array(typebox_1.Type.Object({
|
|
179
|
+
id: typebox_1.Type.String({
|
|
180
|
+
description: '成员 ID(通常为 open_id)',
|
|
181
|
+
}),
|
|
182
|
+
type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['user', 'app'])),
|
|
183
|
+
role: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['assignee', 'follower'])),
|
|
184
|
+
}), {
|
|
185
|
+
description: '要添加的成员列表(assignee=负责人,follower=关注人)。成员类型支持 user 和 app,默认为 user。',
|
|
186
|
+
}),
|
|
187
|
+
client_token: typebox_1.Type.Optional(typebox_1.Type.String({
|
|
188
|
+
description: '幂等token,如果提供则实现幂等行为',
|
|
189
|
+
})),
|
|
190
|
+
auth_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['tenant', 'user'], {
|
|
191
|
+
description: '授权类型,默认 user。',
|
|
192
|
+
})),
|
|
193
|
+
user_id_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['open_id', 'union_id', 'user_id'])),
|
|
194
|
+
}),
|
|
195
|
+
// APPEND_STEPS
|
|
196
|
+
typebox_1.Type.Object({
|
|
197
|
+
action: typebox_1.Type.Literal('append_steps'),
|
|
198
|
+
task_guid: typebox_1.Type.String({
|
|
199
|
+
description: '任务 GUID',
|
|
200
|
+
}),
|
|
201
|
+
idempotent_key: typebox_1.Type.String({
|
|
202
|
+
description: '幂等键',
|
|
203
|
+
}),
|
|
204
|
+
task_steps: typebox_1.Type.Array(typebox_1.Type.Object({
|
|
205
|
+
quote: typebox_1.Type.String({
|
|
206
|
+
description: '步骤引用信息',
|
|
207
|
+
}),
|
|
208
|
+
content: typebox_1.Type.String({
|
|
209
|
+
description: '步骤内容',
|
|
210
|
+
}),
|
|
211
|
+
timestamp: typebox_1.Type.Integer({
|
|
212
|
+
description: '步骤时间戳',
|
|
213
|
+
}),
|
|
214
|
+
}), {
|
|
215
|
+
description: '要追加的任务步骤列表',
|
|
216
|
+
minItems: 1,
|
|
217
|
+
}),
|
|
218
|
+
}),
|
|
219
|
+
]);
|
|
220
|
+
// ---------------------------------------------------------------------------
|
|
221
|
+
// Registration
|
|
222
|
+
// ---------------------------------------------------------------------------
|
|
223
|
+
function registerFeishuTaskTaskTool(api) {
|
|
224
|
+
if (!api.config)
|
|
225
|
+
return;
|
|
226
|
+
const cfg = api.config;
|
|
227
|
+
const { toolClient, log } = (0, helpers_1.createToolContext)(api, 'feishu_task_task');
|
|
228
|
+
(0, helpers_1.registerTool)(api, {
|
|
229
|
+
name: 'feishu_task_task',
|
|
230
|
+
label: 'Feishu Task Management',
|
|
231
|
+
description: "【以用户或应用身份】飞书任务管理工具。用于创建、查询、更新任务。Actions: create(创建任务), get(获取任务详情), list(查询任务列表,仅返回我负责的任务), patch(更新任务), add_members(添加任务成员), append_steps(追加任务步骤记录)。时间参数使用ISO 8601 / RFC 3339 格式(包含时区),例如 '2024-01-01T00:00:00+08:00'。支持通过 auth_type 参数切换用户(user)或应用(tenant)身份;append_steps 固定使用应用身份。",
|
|
232
|
+
parameters: FeishuTaskTaskSchema,
|
|
233
|
+
async execute(_toolCallId, params) {
|
|
234
|
+
const p = params;
|
|
235
|
+
try {
|
|
236
|
+
const client = toolClient();
|
|
237
|
+
switch (p.action) {
|
|
238
|
+
// -----------------------------------------------------------------
|
|
239
|
+
// CREATE TASK
|
|
240
|
+
// -----------------------------------------------------------------
|
|
241
|
+
case 'create': {
|
|
242
|
+
log.info(`create: summary=${p.summary}`);
|
|
243
|
+
const taskData = {
|
|
244
|
+
summary: p.summary,
|
|
245
|
+
};
|
|
246
|
+
if (p.description)
|
|
247
|
+
taskData.description = p.description;
|
|
248
|
+
// Handle due time conversion
|
|
249
|
+
if (p.due?.timestamp) {
|
|
250
|
+
const dueTs = (0, helpers_1.parseTimeToTimestampMs)(p.due.timestamp);
|
|
251
|
+
if (!dueTs) {
|
|
252
|
+
return (0, helpers_1.json)({
|
|
253
|
+
error: "due 时间格式错误!必须使用ISO 8601 / RFC 3339 格式(包含时区),例如 '2024-01-01T00:00:00+08:00',例如 '2026-02-25 18:00'。",
|
|
254
|
+
received: p.due.timestamp,
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
taskData.due = {
|
|
258
|
+
timestamp: dueTs,
|
|
259
|
+
is_all_day: p.due.is_all_day ?? false,
|
|
260
|
+
};
|
|
261
|
+
log.info(`create: due time converted: ${p.due.timestamp} -> ${dueTs}ms`);
|
|
262
|
+
}
|
|
263
|
+
// Handle start time conversion
|
|
264
|
+
if (p.start?.timestamp) {
|
|
265
|
+
const startTs = (0, helpers_1.parseTimeToTimestampMs)(p.start.timestamp);
|
|
266
|
+
if (!startTs) {
|
|
267
|
+
return (0, helpers_1.json)({
|
|
268
|
+
error: "start 时间格式错误!必须使用ISO 8601 / RFC 3339 格式(包含时区),例如 '2024-01-01T00:00:00+08:00'。",
|
|
269
|
+
received: p.start.timestamp,
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
taskData.start = {
|
|
273
|
+
timestamp: startTs,
|
|
274
|
+
is_all_day: p.start.is_all_day ?? false,
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
if (p.members)
|
|
278
|
+
taskData.members = p.members;
|
|
279
|
+
if (p.repeat_rule)
|
|
280
|
+
taskData.repeat_rule = p.repeat_rule;
|
|
281
|
+
if (p.tasklists)
|
|
282
|
+
taskData.tasklists = p.tasklists;
|
|
283
|
+
const authType = p.auth_type || 'user';
|
|
284
|
+
const res = await client.invoke('feishu_task_task.create', (sdk, opts) => sdk.task.v2.task.create({
|
|
285
|
+
data: taskData,
|
|
286
|
+
params: {
|
|
287
|
+
user_id_type: (p.user_id_type || 'open_id'),
|
|
288
|
+
},
|
|
289
|
+
}, opts), { as: authType });
|
|
290
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
291
|
+
const data = res.data;
|
|
292
|
+
log.info(`create: task created: task_guid=${data?.task?.guid}`);
|
|
293
|
+
return (0, helpers_1.json)({
|
|
294
|
+
task: res.data?.task,
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
// -----------------------------------------------------------------
|
|
298
|
+
// GET TASK
|
|
299
|
+
// -----------------------------------------------------------------
|
|
300
|
+
case 'get': {
|
|
301
|
+
log.info(`get: task_guid=${p.task_guid}`);
|
|
302
|
+
const authType = p.auth_type || 'user';
|
|
303
|
+
const res = await client.invoke('feishu_task_task.get', (sdk, opts) => sdk.task.v2.task.get({
|
|
304
|
+
path: { task_guid: p.task_guid },
|
|
305
|
+
params: {
|
|
306
|
+
user_id_type: (p.user_id_type || 'open_id'),
|
|
307
|
+
},
|
|
308
|
+
}, opts), { as: authType });
|
|
309
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
310
|
+
log.info(`get: retrieved task ${p.task_guid}`);
|
|
311
|
+
return (0, helpers_1.json)({
|
|
312
|
+
task: res.data?.task,
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
// -----------------------------------------------------------------
|
|
316
|
+
// LIST TASKS
|
|
317
|
+
// -----------------------------------------------------------------
|
|
318
|
+
case 'list': {
|
|
319
|
+
log.info(`list: page_size=${p.page_size ?? 50}, completed=${p.completed ?? false}`);
|
|
320
|
+
const authType = p.auth_type || 'user';
|
|
321
|
+
const res = await client.invoke('feishu_task_task.list', (sdk, opts) => sdk.task.v2.task.list({
|
|
322
|
+
params: {
|
|
323
|
+
page_size: p.page_size,
|
|
324
|
+
page_token: p.page_token,
|
|
325
|
+
completed: p.completed,
|
|
326
|
+
agent_task_status: p.agent_task_status,
|
|
327
|
+
user_id_type: p.user_id_type || 'open_id',
|
|
328
|
+
},
|
|
329
|
+
}, opts), { as: authType });
|
|
330
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
331
|
+
const data = res.data;
|
|
332
|
+
log.info(`list: returned ${data?.items?.length ?? 0} tasks`);
|
|
333
|
+
return (0, helpers_1.json)({
|
|
334
|
+
tasks: data?.items,
|
|
335
|
+
has_more: data?.has_more ?? false,
|
|
336
|
+
page_token: data?.page_token,
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
// -----------------------------------------------------------------
|
|
340
|
+
// PATCH TASK
|
|
341
|
+
// -----------------------------------------------------------------
|
|
342
|
+
case 'patch': {
|
|
343
|
+
log.info(`patch: task_guid=${p.task_guid}`);
|
|
344
|
+
const updateData = {};
|
|
345
|
+
if (p.summary)
|
|
346
|
+
updateData.summary = p.summary;
|
|
347
|
+
if (p.description !== undefined)
|
|
348
|
+
updateData.description = p.description;
|
|
349
|
+
// Handle due time conversion
|
|
350
|
+
if (p.due?.timestamp) {
|
|
351
|
+
const dueTs = (0, helpers_1.parseTimeToTimestampMs)(p.due.timestamp);
|
|
352
|
+
if (!dueTs) {
|
|
353
|
+
return (0, helpers_1.json)({
|
|
354
|
+
error: "due 时间格式错误!必须使用ISO 8601 / RFC 3339 格式(包含时区),例如 '2024-01-01T00:00:00+08:00'。",
|
|
355
|
+
received: p.due.timestamp,
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
updateData.due = {
|
|
359
|
+
timestamp: dueTs,
|
|
360
|
+
is_all_day: p.due.is_all_day ?? false,
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
// Handle start time conversion
|
|
364
|
+
if (p.start?.timestamp) {
|
|
365
|
+
const startTs = (0, helpers_1.parseTimeToTimestampMs)(p.start.timestamp);
|
|
366
|
+
if (!startTs) {
|
|
367
|
+
return (0, helpers_1.json)({
|
|
368
|
+
error: "start 时间格式错误!必须使用ISO 8601 / RFC 3339 格式(包含时区),例如 '2024-01-01T00:00:00+08:00'。",
|
|
369
|
+
received: p.start.timestamp,
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
updateData.start = {
|
|
373
|
+
timestamp: startTs,
|
|
374
|
+
is_all_day: p.start.is_all_day ?? false,
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
// Handle completed_at conversion
|
|
378
|
+
if (p.completed_at !== undefined) {
|
|
379
|
+
// 特殊值:反完成(设为未完成)
|
|
380
|
+
if (p.completed_at === '0') {
|
|
381
|
+
updateData.completed_at = '0';
|
|
382
|
+
}
|
|
383
|
+
// 数字字符串时间戳(直通)
|
|
384
|
+
else if (/^\d+$/.test(p.completed_at)) {
|
|
385
|
+
updateData.completed_at = p.completed_at;
|
|
386
|
+
}
|
|
387
|
+
// 时间格式字符串(需要转换)
|
|
388
|
+
else {
|
|
389
|
+
const completedTs = (0, helpers_1.parseTimeToTimestampMs)(p.completed_at);
|
|
390
|
+
if (!completedTs) {
|
|
391
|
+
return (0, helpers_1.json)({
|
|
392
|
+
error: "completed_at 格式错误!支持:1) ISO 8601 / RFC 3339 格式(包含时区),例如 '2024-01-01T00:00:00+08:00';2) '0'(反完成);3) 毫秒时间戳字符串。",
|
|
393
|
+
received: p.completed_at,
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
updateData.completed_at = completedTs;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
if (p.agent_task_progress !== undefined) {
|
|
400
|
+
updateData.agent_task_progress = p.agent_task_progress;
|
|
401
|
+
}
|
|
402
|
+
if (p.agent_task_status !== undefined) {
|
|
403
|
+
updateData.agent_task_status = p.agent_task_status;
|
|
404
|
+
}
|
|
405
|
+
if (p.text_deliveries !== undefined) {
|
|
406
|
+
updateData.text_deliveries = p.text_deliveries;
|
|
407
|
+
}
|
|
408
|
+
if (p.members)
|
|
409
|
+
updateData.members = p.members;
|
|
410
|
+
if (p.repeat_rule)
|
|
411
|
+
updateData.repeat_rule = p.repeat_rule;
|
|
412
|
+
// Build update_fields list (required by Task API)
|
|
413
|
+
const updateFields = Object.keys(updateData);
|
|
414
|
+
if (updateFields.length === 0) {
|
|
415
|
+
return (0, helpers_1.json)({
|
|
416
|
+
error: 'patch 至少需要提供一个可更新字段:summary、description、due、start、completed_at、agent_task_progress、agent_task_status、text_deliveries、members、repeat_rule',
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
const authType = p.auth_type || 'user';
|
|
420
|
+
const res = await client.invoke('feishu_task_task.patch', (sdk, opts) => sdk.task.v2.task.patch({
|
|
421
|
+
path: { task_guid: p.task_guid },
|
|
422
|
+
data: {
|
|
423
|
+
task: updateData,
|
|
424
|
+
update_fields: updateFields,
|
|
425
|
+
},
|
|
426
|
+
params: {
|
|
427
|
+
user_id_type: (p.user_id_type || 'open_id'),
|
|
428
|
+
},
|
|
429
|
+
}, opts), { as: authType });
|
|
430
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
431
|
+
log.info(`patch: task ${p.task_guid} updated`);
|
|
432
|
+
return (0, helpers_1.json)({
|
|
433
|
+
task: res.data?.task,
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
// -----------------------------------------------------------------
|
|
437
|
+
// ADD_MEMBERS
|
|
438
|
+
// -----------------------------------------------------------------
|
|
439
|
+
case 'add_members': {
|
|
440
|
+
if (!p.members || p.members.length === 0) {
|
|
441
|
+
return (0, helpers_1.json)({
|
|
442
|
+
error: 'members is required and cannot be empty',
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
log.info(`add_members: task_guid=${p.task_guid}, members_count=${p.members.length}`);
|
|
446
|
+
const memberData = p.members.map((m) => ({
|
|
447
|
+
id: m.id,
|
|
448
|
+
type: m.type || 'user',
|
|
449
|
+
role: m.role || 'follower',
|
|
450
|
+
}));
|
|
451
|
+
const requestData = { members: memberData };
|
|
452
|
+
if (p.client_token) {
|
|
453
|
+
requestData.client_token = p.client_token;
|
|
454
|
+
}
|
|
455
|
+
const authType = p.auth_type || 'user';
|
|
456
|
+
const res = await client.invoke('feishu_task_task.add_members', (sdk, opts) => sdk.task.v2.task.addMembers({
|
|
457
|
+
path: {
|
|
458
|
+
task_guid: p.task_guid,
|
|
459
|
+
},
|
|
460
|
+
params: {
|
|
461
|
+
user_id_type: (p.user_id_type || 'open_id'),
|
|
462
|
+
},
|
|
463
|
+
data: requestData,
|
|
464
|
+
}, opts), { as: authType });
|
|
465
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
466
|
+
log.info(`add_members: added ${p.members.length} members to task ${p.task_guid}`);
|
|
467
|
+
return (0, helpers_1.json)({
|
|
468
|
+
task: res.data?.task,
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
// -----------------------------------------------------------------
|
|
472
|
+
// APPEND TASK STEPS
|
|
473
|
+
// -----------------------------------------------------------------
|
|
474
|
+
case 'append_steps': {
|
|
475
|
+
if (!p.task_steps.length) {
|
|
476
|
+
return (0, helpers_1.json)({
|
|
477
|
+
error: 'task_steps is required and cannot be empty',
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
const tatRes = await (0, raw_request_1.rawLarkRequest)({
|
|
481
|
+
brand: client.account.brand,
|
|
482
|
+
path: '/open-apis/auth/v3/tenant_access_token/internal/',
|
|
483
|
+
method: 'POST',
|
|
484
|
+
body: {
|
|
485
|
+
app_id: client.sdk.appId,
|
|
486
|
+
app_secret: client.sdk.appSecret,
|
|
487
|
+
},
|
|
488
|
+
});
|
|
489
|
+
;
|
|
490
|
+
const token = tatRes?.tenant_access_token ?? "";
|
|
491
|
+
const res = await client.invokeByPath('feishu_task_task.append_steps', '/open-apis/task/v2/agent_task_step_info/append_task_steps', {
|
|
492
|
+
method: 'POST',
|
|
493
|
+
as: 'tenant',
|
|
494
|
+
body: {
|
|
495
|
+
task_guid: p.task_guid,
|
|
496
|
+
idempotent_key: p.idempotent_key,
|
|
497
|
+
task_steps: p.task_steps,
|
|
498
|
+
},
|
|
499
|
+
headers: {
|
|
500
|
+
'authorization': `Bearer ${token}`,
|
|
501
|
+
},
|
|
502
|
+
});
|
|
503
|
+
return (0, helpers_1.json)(res);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
catch (err) {
|
|
508
|
+
return await (0, helpers_1.handleInvokeErrorWithAutoAuth)(err, cfg);
|
|
509
|
+
}
|
|
510
|
+
},
|
|
511
|
+
}, { name: 'feishu_task_task' });
|
|
512
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*
|
|
5
|
+
* feishu_task_agent tool -- Manage Feishu Task Agent registration.
|
|
6
|
+
*
|
|
7
|
+
* Actions:
|
|
8
|
+
* - register: Register task agent (tenant identity)
|
|
9
|
+
* - update_profile: Update task agent profile (tenant identity)
|
|
10
|
+
*
|
|
11
|
+
|
|
12
|
+
*/
|
|
13
|
+
import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
|
|
14
|
+
export declare function registerFeishuTaskAgentTool(api: OpenClawPluginApi): void;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*
|
|
6
|
+
* feishu_task_agent tool -- Manage Feishu Task Agent registration.
|
|
7
|
+
*
|
|
8
|
+
* Actions:
|
|
9
|
+
* - register: Register task agent (tenant identity)
|
|
10
|
+
* - update_profile: Update task agent profile (tenant identity)
|
|
11
|
+
*
|
|
12
|
+
|
|
13
|
+
*/
|
|
14
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.registerFeishuTaskAgentTool = registerFeishuTaskAgentTool;
|
|
17
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
18
|
+
const helpers_1 = require("../helpers.js");
|
|
19
|
+
const raw_request_1 = require("../../../core/raw-request.js");
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// Schema
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
const FeishuTaskAgentSchema = typebox_1.Type.Union([
|
|
24
|
+
typebox_1.Type.Object({
|
|
25
|
+
action: typebox_1.Type.Literal('register'),
|
|
26
|
+
}),
|
|
27
|
+
typebox_1.Type.Object({
|
|
28
|
+
action: typebox_1.Type.Literal('update_profile'),
|
|
29
|
+
profile_content: typebox_1.Type.String(),
|
|
30
|
+
}),
|
|
31
|
+
]);
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
// Internal helpers
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
function resolvePathForAction(action) {
|
|
36
|
+
if (action === 'register') {
|
|
37
|
+
return { path: '/open-apis/task/v2/agent/register_agent', env: [] };
|
|
38
|
+
}
|
|
39
|
+
return { path: '/open-apis/task/v2/agent/update_agent_profile', env: [] };
|
|
40
|
+
}
|
|
41
|
+
// ---------------------------------------------------------------------------
|
|
42
|
+
// Registration
|
|
43
|
+
// ---------------------------------------------------------------------------
|
|
44
|
+
function registerFeishuTaskAgentTool(api) {
|
|
45
|
+
if (!api.config)
|
|
46
|
+
return;
|
|
47
|
+
const cfg = api.config;
|
|
48
|
+
const { toolClient } = (0, helpers_1.createToolContext)(api, 'feishu_task_agent');
|
|
49
|
+
(0, helpers_1.registerTool)(api, {
|
|
50
|
+
name: 'feishu_task_agent',
|
|
51
|
+
label: 'Feishu Task Agent Registration',
|
|
52
|
+
description: '飞书任务 Agent 注册管理工具。用于注册/取消注册 Task Agent,以及查询已注册列表。',
|
|
53
|
+
parameters: FeishuTaskAgentSchema,
|
|
54
|
+
async execute(_toolCallId, params) {
|
|
55
|
+
const p = params;
|
|
56
|
+
try {
|
|
57
|
+
const normalizedAction = p.action;
|
|
58
|
+
const resolved = resolvePathForAction(p.action);
|
|
59
|
+
const client = toolClient();
|
|
60
|
+
const tatRes = await (0, raw_request_1.rawLarkRequest)({
|
|
61
|
+
brand: client.account.brand,
|
|
62
|
+
path: '/open-apis/auth/v3/tenant_access_token/internal/',
|
|
63
|
+
method: 'POST',
|
|
64
|
+
body: {
|
|
65
|
+
app_id: client.sdk.appId,
|
|
66
|
+
app_secret: client.sdk.appSecret,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
const token = tatRes?.tenant_access_token ?? "";
|
|
70
|
+
// Match openclaw-lark-task semantics:
|
|
71
|
+
// - register/update_profile use tenant identity (TAT)
|
|
72
|
+
const as = normalizedAction === 'register' || normalizedAction === 'update_profile'
|
|
73
|
+
? 'tenant'
|
|
74
|
+
: 'user';
|
|
75
|
+
if (normalizedAction === 'update_profile') {
|
|
76
|
+
const res = await client.invokeByPath('feishu_task_agent.update_profile', resolved.path, {
|
|
77
|
+
method: 'POST',
|
|
78
|
+
as,
|
|
79
|
+
body: {
|
|
80
|
+
profile_content: p.profile_content,
|
|
81
|
+
},
|
|
82
|
+
headers: {
|
|
83
|
+
'authorization': `Bearer ${token}`,
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
return (0, helpers_1.json)(res);
|
|
87
|
+
}
|
|
88
|
+
// register
|
|
89
|
+
if (normalizedAction === 'register') {
|
|
90
|
+
const res = await client.invokeByPath('feishu_task_agent.register', resolved.path, {
|
|
91
|
+
method: 'POST',
|
|
92
|
+
as,
|
|
93
|
+
headers: {
|
|
94
|
+
'authorization': `Bearer ${token}`,
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
return (0, helpers_1.json)(res);
|
|
98
|
+
}
|
|
99
|
+
return (0, helpers_1.json)({
|
|
100
|
+
error: `p.action is invalid ${normalizedAction}`,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
catch (err) {
|
|
104
|
+
return await (0, helpers_1.handleInvokeErrorWithAutoAuth)(err, cfg);
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
}, { name: 'feishu_task_agent' });
|
|
108
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*
|
|
5
|
+
* feishu_task_tasklist tool -- Manage Feishu task lists.
|
|
6
|
+
*
|
|
7
|
+
* P0 Actions: create, get, list, tasks 支持通过 auth_type 参数切换用户(user)或应用(tenant)身份。
|
|
8
|
+
* P1 Actions: patch, add_members
|
|
9
|
+
*
|
|
10
|
+
* Uses the Feishu Task v2 API:
|
|
11
|
+
* - create: POST /open-apis/task/v2/tasklists
|
|
12
|
+
* - get: GET /open-apis/task/v2/tasklists/:tasklist_guid
|
|
13
|
+
* - list: GET /open-apis/task/v2/tasklists
|
|
14
|
+
* - tasks: GET /open-apis/task/v2/tasklists/:tasklist_guid/tasks
|
|
15
|
+
* - patch: PATCH /open-apis/task/v2/tasklists/:tasklist_guid
|
|
16
|
+
* - add_members: POST /open-apis/task/v2/tasklists/:tasklist_guid/add_members
|
|
17
|
+
*/
|
|
18
|
+
import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
|
|
19
|
+
export declare function registerFeishuTaskTasklistTool(api: OpenClawPluginApi): void;
|