@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,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*
|
|
6
|
+
* Message fetching for the Lark/Feishu channel plugin.
|
|
7
|
+
*
|
|
8
|
+
* Shared between inbound (reaction handler, enrich) and outbound modules.
|
|
9
|
+
* Extracted from `outbound/fetch.ts` to eliminate inbound→outbound
|
|
10
|
+
* dependency inversion.
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.getMessageFeishu = getMessageFeishu;
|
|
14
|
+
const content_converter_1 = require("../converters/content-converter.js");
|
|
15
|
+
const lark_client_1 = require("../../core/lark-client.js");
|
|
16
|
+
const lark_logger_1 = require("../../core/lark-logger.js");
|
|
17
|
+
const log = (0, lark_logger_1.larkLogger)('shared/message-lookup');
|
|
18
|
+
const user_name_cache_1 = require("../inbound/user-name-cache.js");
|
|
19
|
+
const accounts_1 = require("../../core/accounts.js");
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// getMessageFeishu
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
/**
|
|
24
|
+
* Retrieve a single message by its ID from the Feishu IM API.
|
|
25
|
+
*
|
|
26
|
+
* Returns a normalised {@link FeishuMessageInfo} object, or `null` if the
|
|
27
|
+
* message cannot be found or the API returns an error.
|
|
28
|
+
*
|
|
29
|
+
* @param params.cfg - Plugin configuration with Feishu credentials.
|
|
30
|
+
* @param params.messageId - The message ID to fetch.
|
|
31
|
+
* @param params.accountId - Optional account identifier for multi-account setups.
|
|
32
|
+
*/
|
|
33
|
+
async function getMessageFeishu(params) {
|
|
34
|
+
const { cfg, messageId, accountId, expandForward } = params;
|
|
35
|
+
const larkClient = lark_client_1.LarkClient.fromCfg(cfg, accountId);
|
|
36
|
+
const sdk = larkClient.sdk;
|
|
37
|
+
try {
|
|
38
|
+
const requestOpts = {
|
|
39
|
+
method: 'GET',
|
|
40
|
+
url: `/open-apis/im/v1/messages/mget`,
|
|
41
|
+
params: {
|
|
42
|
+
message_ids: messageId,
|
|
43
|
+
user_id_type: 'open_id',
|
|
44
|
+
card_msg_content_type: 'raw_card_content',
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
|
+
const response = await sdk.request(requestOpts);
|
|
49
|
+
const items = response?.data?.items;
|
|
50
|
+
if (!items || items.length === 0) {
|
|
51
|
+
log.info(`getMessageFeishu: no items returned for ${messageId}`);
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const expandCtx = expandForward
|
|
55
|
+
? {
|
|
56
|
+
cfg,
|
|
57
|
+
accountId,
|
|
58
|
+
fetchSubMessages: async (msgId) => {
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
60
|
+
const res = await larkClient.sdk.request({
|
|
61
|
+
method: 'GET',
|
|
62
|
+
url: `/open-apis/im/v1/messages/${msgId}`,
|
|
63
|
+
params: { user_id_type: 'open_id', card_msg_content_type: 'raw_card_content' },
|
|
64
|
+
});
|
|
65
|
+
if (res?.code !== 0) {
|
|
66
|
+
throw new Error(`API error: code=${res?.code} msg=${res?.msg}`);
|
|
67
|
+
}
|
|
68
|
+
return res?.data?.items ?? [];
|
|
69
|
+
},
|
|
70
|
+
batchResolveNames: (0, user_name_cache_1.createBatchResolveNames)((0, accounts_1.getLarkAccount)(cfg, accountId), (...args) => log.info(args.map(String).join(' '))),
|
|
71
|
+
}
|
|
72
|
+
: undefined;
|
|
73
|
+
return await parseMessageItem(items[0], messageId, expandCtx);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
log.error(`get message failed (${messageId}): ${error instanceof Error ? error.message : String(error)}`);
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// ---------------------------------------------------------------------------
|
|
81
|
+
// Helpers
|
|
82
|
+
// ---------------------------------------------------------------------------
|
|
83
|
+
/**
|
|
84
|
+
* Parse a single message item from the Feishu IM API response into a
|
|
85
|
+
* normalised {@link FeishuMessageInfo}.
|
|
86
|
+
*
|
|
87
|
+
* Content parsing is delegated to the shared converter system so that
|
|
88
|
+
* every message-type mapping is defined in exactly one place.
|
|
89
|
+
*/
|
|
90
|
+
async function parseMessageItem(
|
|
91
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
92
|
+
msg, fallbackMessageId, expandCtx) {
|
|
93
|
+
const msgType = msg.msg_type ?? 'text';
|
|
94
|
+
const rawContent = msg.body?.content ?? '{}';
|
|
95
|
+
const messageId = msg.message_id ?? fallbackMessageId;
|
|
96
|
+
const acctId = expandCtx?.accountId;
|
|
97
|
+
const ctx = {
|
|
98
|
+
...(0, content_converter_1.buildConvertContextFromItem)(msg, fallbackMessageId, acctId),
|
|
99
|
+
cfg: expandCtx?.cfg,
|
|
100
|
+
accountId: acctId,
|
|
101
|
+
fetchSubMessages: expandCtx?.fetchSubMessages,
|
|
102
|
+
batchResolveNames: expandCtx?.batchResolveNames,
|
|
103
|
+
};
|
|
104
|
+
const { content } = await (0, content_converter_1.convertMessageContent)(rawContent, msgType, ctx);
|
|
105
|
+
const senderId = msg.sender?.id ?? undefined;
|
|
106
|
+
const senderType = msg.sender?.sender_type ?? undefined;
|
|
107
|
+
const senderName = senderId && acctId ? (0, user_name_cache_1.getUserNameCache)(acctId).get(senderId) : undefined;
|
|
108
|
+
return {
|
|
109
|
+
messageId,
|
|
110
|
+
chatId: msg.chat_id ?? '',
|
|
111
|
+
chatType: msg.chat_type ?? undefined,
|
|
112
|
+
senderId,
|
|
113
|
+
senderName,
|
|
114
|
+
senderType,
|
|
115
|
+
content,
|
|
116
|
+
contentType: msgType,
|
|
117
|
+
createTime: msg.create_time ? parseInt(String(msg.create_time), 10) : undefined,
|
|
118
|
+
threadId: msg.thread_id || undefined,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*
|
|
5
|
+
* Messaging type definitions for the Lark/Feishu channel plugin.
|
|
6
|
+
*
|
|
7
|
+
* Pure shape types for inbound message events, normalised message context,
|
|
8
|
+
* mention targets, and media metadata.
|
|
9
|
+
*/
|
|
10
|
+
export interface FeishuMessageEvent {
|
|
11
|
+
sender: {
|
|
12
|
+
sender_id: {
|
|
13
|
+
open_id?: string;
|
|
14
|
+
user_id?: string;
|
|
15
|
+
union_id?: string;
|
|
16
|
+
};
|
|
17
|
+
sender_type?: string;
|
|
18
|
+
tenant_key?: string;
|
|
19
|
+
};
|
|
20
|
+
message: {
|
|
21
|
+
message_id: string;
|
|
22
|
+
root_id?: string;
|
|
23
|
+
parent_id?: string;
|
|
24
|
+
create_time?: string;
|
|
25
|
+
update_time?: string;
|
|
26
|
+
chat_id: string;
|
|
27
|
+
thread_id?: string;
|
|
28
|
+
chat_type: 'p2p' | 'group';
|
|
29
|
+
message_type: string;
|
|
30
|
+
content: string;
|
|
31
|
+
mentions?: Array<{
|
|
32
|
+
key: string;
|
|
33
|
+
id: {
|
|
34
|
+
open_id?: string;
|
|
35
|
+
user_id?: string;
|
|
36
|
+
union_id?: string;
|
|
37
|
+
};
|
|
38
|
+
name: string;
|
|
39
|
+
tenant_key?: string;
|
|
40
|
+
}>;
|
|
41
|
+
user_agent?: string;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export interface FeishuReactionCreatedEvent {
|
|
45
|
+
message_id: string;
|
|
46
|
+
chat_id?: string;
|
|
47
|
+
chat_type?: 'p2p' | 'group' | 'private';
|
|
48
|
+
reaction_type?: {
|
|
49
|
+
emoji_type?: string;
|
|
50
|
+
};
|
|
51
|
+
operator_type?: string;
|
|
52
|
+
user_id?: {
|
|
53
|
+
open_id?: string;
|
|
54
|
+
user_id?: string;
|
|
55
|
+
union_id?: string;
|
|
56
|
+
};
|
|
57
|
+
action_time?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Raw event shape for `drive.notice.comment_add_v1`.
|
|
61
|
+
*
|
|
62
|
+
* Fired when a user adds a comment or reply on a Drive document.
|
|
63
|
+
* The SDK flattens the v2 envelope header into the handler `data` object,
|
|
64
|
+
* so `app_id` is available directly on the event.
|
|
65
|
+
*
|
|
66
|
+
* **Real event structure** (SDK-flattened):
|
|
67
|
+
* ```json
|
|
68
|
+
* {
|
|
69
|
+
* "app_id": "cli_xxx",
|
|
70
|
+
* "file_token": "xxx",
|
|
71
|
+
* "file_type": "docx",
|
|
72
|
+
* "comment_id": "xxx",
|
|
73
|
+
* "reply_id": "xxx", // optional, present for replies
|
|
74
|
+
* "notice_meta": {
|
|
75
|
+
* "from_user_id": { "open_id": "ou_xxx", "user_id": "xxx", "union_id": "xxx" },
|
|
76
|
+
* "timestamp": "1712000000000",
|
|
77
|
+
* "is_mentioned": true
|
|
78
|
+
* }
|
|
79
|
+
* }
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* Some fields may also appear at top-level depending on SDK version,
|
|
83
|
+
* so the parser checks both locations.
|
|
84
|
+
*/
|
|
85
|
+
export interface FeishuDriveCommentEvent {
|
|
86
|
+
/** App ID from the event envelope header. */
|
|
87
|
+
app_id?: string;
|
|
88
|
+
/** File token of the document where the comment was added. */
|
|
89
|
+
file_token?: string;
|
|
90
|
+
/** File type: doc, docx, sheet, file, slides, etc. */
|
|
91
|
+
file_type?: string;
|
|
92
|
+
/** Comment ID of the root comment. */
|
|
93
|
+
comment_id?: string;
|
|
94
|
+
/** Reply ID (present when the event is a reply, not a root comment). */
|
|
95
|
+
reply_id?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Metadata about the notice — primary location for user info and timestamp.
|
|
98
|
+
* Present in the real event structure; not always at top level.
|
|
99
|
+
*/
|
|
100
|
+
notice_meta?: {
|
|
101
|
+
from_user_id?: {
|
|
102
|
+
open_id?: string;
|
|
103
|
+
user_id?: string;
|
|
104
|
+
union_id?: string;
|
|
105
|
+
};
|
|
106
|
+
file_token?: string;
|
|
107
|
+
file_type?: string;
|
|
108
|
+
timestamp?: string;
|
|
109
|
+
is_mentioned?: boolean;
|
|
110
|
+
};
|
|
111
|
+
/** Whether the bot was @-mentioned in this comment. */
|
|
112
|
+
is_mention?: boolean;
|
|
113
|
+
/** Fallback: user ID at top level (some SDK flattening styles). */
|
|
114
|
+
user_id?: {
|
|
115
|
+
open_id?: string;
|
|
116
|
+
user_id?: string;
|
|
117
|
+
union_id?: string;
|
|
118
|
+
};
|
|
119
|
+
/** Fallback: event timestamp at top level. */
|
|
120
|
+
action_time?: string;
|
|
121
|
+
}
|
|
122
|
+
export interface FeishuBotAddedEvent {
|
|
123
|
+
chat_id: string;
|
|
124
|
+
operator_id: {
|
|
125
|
+
open_id?: string;
|
|
126
|
+
user_id?: string;
|
|
127
|
+
union_id?: string;
|
|
128
|
+
};
|
|
129
|
+
external: boolean;
|
|
130
|
+
operator_tenant_key?: string;
|
|
131
|
+
name?: string;
|
|
132
|
+
i18n_names?: {
|
|
133
|
+
zh_cn?: string;
|
|
134
|
+
en_us?: string;
|
|
135
|
+
ja_jp?: string;
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Raw event shape for `vc.bot.meeting_invited_v1`.
|
|
140
|
+
*
|
|
141
|
+
* Fired when a user invites the bot to join a meeting.
|
|
142
|
+
*
|
|
143
|
+
* Identity fields (for bot / inviter / host_user) are nested under an
|
|
144
|
+
* `id` object; individual id variants (open_id / user_id / union_id)
|
|
145
|
+
* may be null depending on the tenant configuration.
|
|
146
|
+
*/
|
|
147
|
+
export interface FeishuVcMeetingInvitedEvent {
|
|
148
|
+
app_id?: string;
|
|
149
|
+
event_id?: string;
|
|
150
|
+
meeting?: {
|
|
151
|
+
id?: string;
|
|
152
|
+
meeting_no?: string;
|
|
153
|
+
topic?: string;
|
|
154
|
+
host_user?: {
|
|
155
|
+
id?: {
|
|
156
|
+
open_id?: string | null;
|
|
157
|
+
user_id?: string | null;
|
|
158
|
+
union_id?: string | null;
|
|
159
|
+
};
|
|
160
|
+
user_name?: string;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
bot?: {
|
|
164
|
+
id?: {
|
|
165
|
+
open_id?: string | null;
|
|
166
|
+
user_id?: string | null;
|
|
167
|
+
union_id?: string | null;
|
|
168
|
+
};
|
|
169
|
+
user_name?: string;
|
|
170
|
+
};
|
|
171
|
+
inviter?: {
|
|
172
|
+
id?: {
|
|
173
|
+
open_id?: string | null;
|
|
174
|
+
user_id?: string | null;
|
|
175
|
+
union_id?: string | null;
|
|
176
|
+
};
|
|
177
|
+
user_name?: string;
|
|
178
|
+
};
|
|
179
|
+
invite_time?: string;
|
|
180
|
+
/** Correlation id carried by the invite event; forward to the join tool when present. */
|
|
181
|
+
call_id?: string;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Internal synthetic event model for VC meeting-invited flows.
|
|
185
|
+
*
|
|
186
|
+
* This preserves the business semantics before the event is converted into a
|
|
187
|
+
* synthetic MessageContext for dispatchToAgent().
|
|
188
|
+
*/
|
|
189
|
+
export interface VcMeetingInvitedSyntheticEvent {
|
|
190
|
+
eventType: 'vc.bot.meeting_invited_v1';
|
|
191
|
+
source: 'feishu-vc-event';
|
|
192
|
+
eventId?: string;
|
|
193
|
+
meetingId?: string;
|
|
194
|
+
meetingNo: string;
|
|
195
|
+
topic?: string;
|
|
196
|
+
senderId: string;
|
|
197
|
+
senderOpenId?: string;
|
|
198
|
+
senderUserId?: string;
|
|
199
|
+
senderUnionId?: string;
|
|
200
|
+
senderName?: string;
|
|
201
|
+
inviteTime?: string;
|
|
202
|
+
/** Correlation id forwarded from the invite event; pass through to the join tool. */
|
|
203
|
+
callId?: string;
|
|
204
|
+
}
|
|
205
|
+
/** Metadata describing a media resource in a message (no binary data). */
|
|
206
|
+
export interface ResourceDescriptor {
|
|
207
|
+
type: 'image' | 'file' | 'audio' | 'video' | 'sticker';
|
|
208
|
+
/** image_key or file_key from the raw message content. */
|
|
209
|
+
fileKey: string;
|
|
210
|
+
/** Original file name (file/video messages). */
|
|
211
|
+
fileName?: string;
|
|
212
|
+
/** Duration in milliseconds (audio/video messages). */
|
|
213
|
+
duration?: number;
|
|
214
|
+
/** Video cover image key. */
|
|
215
|
+
coverImageKey?: string;
|
|
216
|
+
}
|
|
217
|
+
/** Structured @mention information from a message. */
|
|
218
|
+
export interface MentionInfo {
|
|
219
|
+
/** Placeholder key in raw content (e.g. "@_user_1"). */
|
|
220
|
+
key: string;
|
|
221
|
+
/** Feishu Open ID of the mentioned user. */
|
|
222
|
+
openId: string;
|
|
223
|
+
/** Display name. */
|
|
224
|
+
name: string;
|
|
225
|
+
/** True iff this mention targets the receiving bot itself (openId === botOpenId). */
|
|
226
|
+
isBot: boolean;
|
|
227
|
+
}
|
|
228
|
+
/** Raw message body, directly mapped from FeishuMessageEvent.message. */
|
|
229
|
+
export interface RawMessage {
|
|
230
|
+
message_id: string;
|
|
231
|
+
root_id?: string;
|
|
232
|
+
parent_id?: string;
|
|
233
|
+
create_time?: string;
|
|
234
|
+
update_time?: string;
|
|
235
|
+
chat_id: string;
|
|
236
|
+
thread_id?: string;
|
|
237
|
+
chat_type: 'p2p' | 'group';
|
|
238
|
+
message_type: string;
|
|
239
|
+
content: string;
|
|
240
|
+
mentions?: Array<{
|
|
241
|
+
key: string;
|
|
242
|
+
id: {
|
|
243
|
+
open_id?: string;
|
|
244
|
+
user_id?: string;
|
|
245
|
+
union_id?: string;
|
|
246
|
+
};
|
|
247
|
+
name: string;
|
|
248
|
+
tenant_key?: string;
|
|
249
|
+
}>;
|
|
250
|
+
user_agent?: string;
|
|
251
|
+
}
|
|
252
|
+
/** Raw sender data, directly mapped from FeishuMessageEvent.sender. */
|
|
253
|
+
export interface RawSender {
|
|
254
|
+
sender_id: {
|
|
255
|
+
open_id?: string;
|
|
256
|
+
user_id?: string;
|
|
257
|
+
union_id?: string;
|
|
258
|
+
};
|
|
259
|
+
sender_type?: string;
|
|
260
|
+
tenant_key?: string;
|
|
261
|
+
}
|
|
262
|
+
/** Normalised representation of an inbound Feishu message. */
|
|
263
|
+
export interface MessageContext {
|
|
264
|
+
chatId: string;
|
|
265
|
+
messageId: string;
|
|
266
|
+
senderId: string;
|
|
267
|
+
senderName?: string;
|
|
268
|
+
chatType: 'p2p' | 'group';
|
|
269
|
+
content: string;
|
|
270
|
+
contentType: string;
|
|
271
|
+
/** Media resource descriptors extracted during parsing. */
|
|
272
|
+
resources: ResourceDescriptor[];
|
|
273
|
+
/** All @mentions in the message (including bot). */
|
|
274
|
+
mentions: MentionInfo[];
|
|
275
|
+
/** Whether an @all / @所有人 mention was detected in the message. */
|
|
276
|
+
mentionAll: boolean;
|
|
277
|
+
/**
|
|
278
|
+
* True when the event sender is a bot/app (sender_type === 'app').
|
|
279
|
+
*
|
|
280
|
+
* Set by parseMessageEvent. Optional because synthetic construction sites
|
|
281
|
+
* (comment / reaction / vc-invited handlers) omit it — absence is treated
|
|
282
|
+
* as `false` since those paths only originate from human actors today.
|
|
283
|
+
*/
|
|
284
|
+
senderIsBot?: boolean;
|
|
285
|
+
rootId?: string;
|
|
286
|
+
parentId?: string;
|
|
287
|
+
threadId?: string;
|
|
288
|
+
createTime?: number;
|
|
289
|
+
rawMessage: RawMessage;
|
|
290
|
+
rawSender: RawSender;
|
|
291
|
+
}
|
|
292
|
+
/** @deprecated Use {@link MessageContext} instead. */
|
|
293
|
+
export type FeishuMessageContext = MessageContext;
|
|
294
|
+
/** Metadata about a media attachment received in or sent through Feishu. */
|
|
295
|
+
export interface FeishuMediaInfo {
|
|
296
|
+
path: string;
|
|
297
|
+
contentType?: string;
|
|
298
|
+
placeholder: string;
|
|
299
|
+
/** Original Feishu file_key / image_key that was downloaded. */
|
|
300
|
+
fileKey: string;
|
|
301
|
+
/** Resource type from the original descriptor. */
|
|
302
|
+
resourceType: ResourceDescriptor['type'];
|
|
303
|
+
}
|
|
304
|
+
/** Result of sending a message via the Feishu API. */
|
|
305
|
+
export interface FeishuSendResult {
|
|
306
|
+
messageId: string;
|
|
307
|
+
chatId: string;
|
|
308
|
+
/**
|
|
309
|
+
* Human-readable warning when the send succeeded but with degradation
|
|
310
|
+
* (e.g. media upload failed, fell back to a text link).
|
|
311
|
+
*
|
|
312
|
+
* Populated so upstream callers (and the AI) can detect that the
|
|
313
|
+
* delivery was not fully as intended and take corrective action.
|
|
314
|
+
*/
|
|
315
|
+
warning?: string;
|
|
316
|
+
}
|
|
@@ -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
|
+
* Messaging type definitions for the Lark/Feishu channel plugin.
|
|
7
|
+
*
|
|
8
|
+
* Pure shape types for inbound message events, normalised message context,
|
|
9
|
+
* mention targets, and media metadata.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*
|
|
5
|
+
* AskUserQuestion tool — AI agent 主动向用户提问并等待回答。
|
|
6
|
+
*
|
|
7
|
+
* 流程(非阻塞,遵循 auto-auth synthetic message 模式):
|
|
8
|
+
* 1. AI 调用 AskUserQuestion 工具,传入问题和选项
|
|
9
|
+
* 2. 发送 form 交互式飞书卡片
|
|
10
|
+
* 3. 工具 execute() 立即返回 { status: 'pending' }
|
|
11
|
+
* 4. 用户填写表单并点击提交,form_value 一次性回传
|
|
12
|
+
* 5. handleAskUserAction 解析答案,注入 synthetic message
|
|
13
|
+
* 6. AI 在新一轮对话中收到用户答案
|
|
14
|
+
*
|
|
15
|
+
* 所有卡片统一使用 form 容器,交互组件在本地缓存值,
|
|
16
|
+
* 提交时通过 form_value 一次性回调,避免独立回调导致的 loading 闪烁。
|
|
17
|
+
*
|
|
18
|
+
* 注意:提交按钮必须设置 value 字段。飞书客户端会校验交互组件是否携带 value,
|
|
19
|
+
* 缺失时直接报 200340 错误,回调不会发送到服务端。虽然 form_submit 场景下
|
|
20
|
+
* form_value 是主要数据载体,但 value 作为按钮的合法性标记仍需存在。
|
|
21
|
+
*/
|
|
22
|
+
import type { ClawdbotConfig, OpenClawPluginApi } from 'openclaw/plugin-sdk';
|
|
23
|
+
/**
|
|
24
|
+
* 处理 form 表单提交事件。
|
|
25
|
+
*
|
|
26
|
+
* 统一使用 form 后,所有值通过 form_value 一次性提交。
|
|
27
|
+
* 解析答案后注入 synthetic message,AI 在新一轮对话中收到答案。
|
|
28
|
+
*
|
|
29
|
+
* @returns 卡片回调响应,或 undefined 表示非本模块的 action
|
|
30
|
+
*/
|
|
31
|
+
export declare function handleAskUserAction(data: unknown, _cfg: ClawdbotConfig, accountId: string): unknown | undefined;
|
|
32
|
+
export declare function registerAskUserQuestionTool(api: OpenClawPluginApi): void;
|