@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,439 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*
|
|
6
|
+
* feishu_bitable_app_table_record tool -- Manage Feishu Bitable records.
|
|
7
|
+
*
|
|
8
|
+
* P0 Actions: create, list, update, delete
|
|
9
|
+
* P1 Actions: batch_create, batch_update, batch_delete
|
|
10
|
+
*
|
|
11
|
+
* Uses the Feishu Bitable v1 API:
|
|
12
|
+
* - create: POST /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records
|
|
13
|
+
* - list: POST /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/search (旧 list API 已废弃)
|
|
14
|
+
* - update: PUT /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id
|
|
15
|
+
* - delete: DELETE /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id
|
|
16
|
+
* - batch_create: POST /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/batch_create
|
|
17
|
+
* - batch_update: POST /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/batch_update
|
|
18
|
+
* - batch_delete: POST /open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/batch_delete
|
|
19
|
+
*/
|
|
20
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.registerFeishuBitableAppTableRecordTool = registerFeishuBitableAppTableRecordTool;
|
|
23
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
24
|
+
const helpers_1 = require("../helpers.js");
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
// Schema
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
const FeishuBitableAppTableRecordSchema = typebox_1.Type.Union([
|
|
29
|
+
// CREATE (P0)
|
|
30
|
+
typebox_1.Type.Object({
|
|
31
|
+
action: typebox_1.Type.Literal('create'),
|
|
32
|
+
app_token: typebox_1.Type.String({ description: '多维表格 token' }),
|
|
33
|
+
table_id: typebox_1.Type.String({ description: '数据表 ID' }),
|
|
34
|
+
fields: typebox_1.Type.Object({}, {
|
|
35
|
+
additionalProperties: true,
|
|
36
|
+
description: "记录字段(单条记录)。键为字段名,值根据字段类型而定:\n- 文本:string\n- 数字:number\n- 单选:string(选项名)\n- 多选:string[](选项名数组)\n- 日期:number(毫秒时间戳,如 1740441600000)\n- 复选框:boolean\n- 人员:[{id: 'ou_xxx'}]\n- 附件:[{file_token: 'xxx'}]\n⚠️ 注意:create 只创建单条记录;批量创建请使用 batch_create",
|
|
37
|
+
}),
|
|
38
|
+
}),
|
|
39
|
+
// UPDATE (P0)
|
|
40
|
+
typebox_1.Type.Object({
|
|
41
|
+
action: typebox_1.Type.Literal('update'),
|
|
42
|
+
app_token: typebox_1.Type.String({ description: '多维表格 token' }),
|
|
43
|
+
table_id: typebox_1.Type.String({ description: '数据表 ID' }),
|
|
44
|
+
record_id: typebox_1.Type.String({ description: '记录 ID' }),
|
|
45
|
+
fields: typebox_1.Type.Object({}, {
|
|
46
|
+
additionalProperties: true,
|
|
47
|
+
description: '要更新的字段',
|
|
48
|
+
}),
|
|
49
|
+
}),
|
|
50
|
+
// DELETE (P0)
|
|
51
|
+
typebox_1.Type.Object({
|
|
52
|
+
action: typebox_1.Type.Literal('delete'),
|
|
53
|
+
app_token: typebox_1.Type.String({ description: '多维表格 token' }),
|
|
54
|
+
table_id: typebox_1.Type.String({ description: '数据表 ID' }),
|
|
55
|
+
record_id: typebox_1.Type.String({ description: '记录 ID' }),
|
|
56
|
+
}),
|
|
57
|
+
// BATCH_CREATE (P1)
|
|
58
|
+
typebox_1.Type.Object({
|
|
59
|
+
action: typebox_1.Type.Literal('batch_create'),
|
|
60
|
+
app_token: typebox_1.Type.String({ description: '多维表格 token' }),
|
|
61
|
+
table_id: typebox_1.Type.String({ description: '数据表 ID' }),
|
|
62
|
+
records: typebox_1.Type.Array(typebox_1.Type.Object({
|
|
63
|
+
fields: typebox_1.Type.Object({}, { additionalProperties: true }),
|
|
64
|
+
}), { description: '要批量创建的记录列表(最多 500 条)' }),
|
|
65
|
+
}),
|
|
66
|
+
// BATCH_UPDATE (P1)
|
|
67
|
+
typebox_1.Type.Object({
|
|
68
|
+
action: typebox_1.Type.Literal('batch_update'),
|
|
69
|
+
app_token: typebox_1.Type.String({ description: '多维表格 token' }),
|
|
70
|
+
table_id: typebox_1.Type.String({ description: '数据表 ID' }),
|
|
71
|
+
records: typebox_1.Type.Array(typebox_1.Type.Object({
|
|
72
|
+
record_id: typebox_1.Type.String(),
|
|
73
|
+
fields: typebox_1.Type.Object({}, { additionalProperties: true }),
|
|
74
|
+
}), { description: '要批量更新的记录列表(最多 500 条)' }),
|
|
75
|
+
}),
|
|
76
|
+
// BATCH_DELETE (P1)
|
|
77
|
+
typebox_1.Type.Object({
|
|
78
|
+
action: typebox_1.Type.Literal('batch_delete'),
|
|
79
|
+
app_token: typebox_1.Type.String({ description: '多维表格 token' }),
|
|
80
|
+
table_id: typebox_1.Type.String({ description: '数据表 ID' }),
|
|
81
|
+
record_ids: typebox_1.Type.Array(typebox_1.Type.String(), { description: '要删除的记录 ID 列表(最多 500 条)' }),
|
|
82
|
+
}),
|
|
83
|
+
// LIST (P0) - 使用 search API(旧 list API 已废弃)
|
|
84
|
+
typebox_1.Type.Object({
|
|
85
|
+
action: typebox_1.Type.Literal('list'),
|
|
86
|
+
app_token: typebox_1.Type.String({ description: '多维表格 token' }),
|
|
87
|
+
table_id: typebox_1.Type.String({ description: '数据表 ID' }),
|
|
88
|
+
view_id: typebox_1.Type.Optional(typebox_1.Type.String({ description: '视图 ID(可选,建议指定以获得更好的性能)' })),
|
|
89
|
+
field_names: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.String(), {
|
|
90
|
+
description: '要返回的字段名列表(可选,不指定则返回所有字段)',
|
|
91
|
+
})),
|
|
92
|
+
filter: typebox_1.Type.Optional(typebox_1.Type.Object({
|
|
93
|
+
conjunction: (0, helpers_1.StringEnum)(['and', 'or'], {
|
|
94
|
+
description: '条件逻辑:and(全部满足)or(任一满足)',
|
|
95
|
+
}),
|
|
96
|
+
conditions: typebox_1.Type.Array(typebox_1.Type.Object({
|
|
97
|
+
field_name: typebox_1.Type.String({ description: '字段名' }),
|
|
98
|
+
operator: (0, helpers_1.StringEnum)(['is', 'isNot', 'contains', 'doesNotContain', 'isEmpty', 'isNotEmpty', 'isGreater', 'isGreaterEqual', 'isLess', 'isLessEqual'], { description: '运算符' }),
|
|
99
|
+
value: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.String(), {
|
|
100
|
+
description: '条件值(isEmpty/isNotEmpty 时可省略)',
|
|
101
|
+
})),
|
|
102
|
+
}), { description: '筛选条件列表' }),
|
|
103
|
+
}, {
|
|
104
|
+
description: "筛选条件(必须是结构化对象)。示例:{conjunction: 'and', conditions: [{field_name: '文本', operator: 'is', value: ['测试']}]}",
|
|
105
|
+
})),
|
|
106
|
+
sort: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Object({
|
|
107
|
+
field_name: typebox_1.Type.String({ description: '排序字段名' }),
|
|
108
|
+
desc: typebox_1.Type.Boolean({ description: '是否降序' }),
|
|
109
|
+
}), { description: '排序规则' })),
|
|
110
|
+
automatic_fields: typebox_1.Type.Optional(typebox_1.Type.Boolean({
|
|
111
|
+
description: '是否返回自动字段(created_time, last_modified_time, created_by, last_modified_by),默认 false',
|
|
112
|
+
})),
|
|
113
|
+
page_size: typebox_1.Type.Optional(typebox_1.Type.Number({ description: '每页数量,默认 50,最大 500' })),
|
|
114
|
+
page_token: typebox_1.Type.Optional(typebox_1.Type.String({ description: '分页标记' })),
|
|
115
|
+
}),
|
|
116
|
+
]);
|
|
117
|
+
// ---------------------------------------------------------------------------
|
|
118
|
+
// Registration
|
|
119
|
+
// ---------------------------------------------------------------------------
|
|
120
|
+
function registerFeishuBitableAppTableRecordTool(api) {
|
|
121
|
+
if (!api.config)
|
|
122
|
+
return;
|
|
123
|
+
const cfg = api.config;
|
|
124
|
+
const { toolClient, log } = (0, helpers_1.createToolContext)(api, 'feishu_bitable_app_table_record');
|
|
125
|
+
(0, helpers_1.registerTool)(api, {
|
|
126
|
+
name: 'feishu_bitable_app_table_record',
|
|
127
|
+
label: 'Feishu Bitable Records',
|
|
128
|
+
description: '【以用户身份】飞书多维表格记录(行)管理工具。当用户要求创建/查询/更新/删除记录、搜索数据时使用。\n\n' +
|
|
129
|
+
'Actions:\n' +
|
|
130
|
+
'- create(创建单条记录,使用 fields 参数)\n' +
|
|
131
|
+
'- batch_create(批量创建记录,使用 records 数组参数)\n' +
|
|
132
|
+
'- list(列出/搜索记录)\n' +
|
|
133
|
+
'- update(更新记录)\n' +
|
|
134
|
+
'- delete(删除记录)\n' +
|
|
135
|
+
'- batch_update(批量更新)\n' +
|
|
136
|
+
'- batch_delete(批量删除)\n\n' +
|
|
137
|
+
'⚠️ 注意参数区别:\n' +
|
|
138
|
+
"- create 使用 'fields' 对象(单条)\n" +
|
|
139
|
+
"- batch_create 使用 'records' 数组(批量)",
|
|
140
|
+
parameters: FeishuBitableAppTableRecordSchema,
|
|
141
|
+
async execute(_toolCallId, params) {
|
|
142
|
+
const p = params;
|
|
143
|
+
try {
|
|
144
|
+
const client = toolClient();
|
|
145
|
+
switch (p.action) {
|
|
146
|
+
// -----------------------------------------------------------------
|
|
147
|
+
// CREATE
|
|
148
|
+
// -----------------------------------------------------------------
|
|
149
|
+
case 'create': {
|
|
150
|
+
// 参数验证:检查是否误用了 batch_create 的参数格式
|
|
151
|
+
if (p.records) {
|
|
152
|
+
return (0, helpers_1.json)({
|
|
153
|
+
error: "create action does not accept 'records' parameter",
|
|
154
|
+
hint: "Use 'fields' for single record creation. For batch creation, use action: 'batch_create' with 'records' parameter.",
|
|
155
|
+
correct_format: {
|
|
156
|
+
action: 'create',
|
|
157
|
+
fields: { 字段名: '字段值' },
|
|
158
|
+
},
|
|
159
|
+
batch_create_format: {
|
|
160
|
+
action: 'batch_create',
|
|
161
|
+
records: [{ fields: { 字段名: '字段值' } }],
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
if (!p.fields || Object.keys(p.fields).length === 0) {
|
|
166
|
+
return (0, helpers_1.json)({
|
|
167
|
+
error: 'fields is required and cannot be empty',
|
|
168
|
+
hint: "create action requires 'fields' parameter, e.g. { 'field_name': 'value', ... }",
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
log.info(`create: app_token=${p.app_token}, table_id=${p.table_id}`);
|
|
172
|
+
const res = await client.invoke('feishu_bitable_app_table_record.create', (sdk, opts) => sdk.bitable.appTableRecord.create({
|
|
173
|
+
path: {
|
|
174
|
+
app_token: p.app_token,
|
|
175
|
+
table_id: p.table_id,
|
|
176
|
+
},
|
|
177
|
+
params: {
|
|
178
|
+
user_id_type: 'open_id',
|
|
179
|
+
},
|
|
180
|
+
data: {
|
|
181
|
+
fields: p.fields,
|
|
182
|
+
},
|
|
183
|
+
}, opts), { as: 'user' });
|
|
184
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
185
|
+
log.info(`create: created record ${res.data?.record?.record_id}`);
|
|
186
|
+
return (0, helpers_1.json)({
|
|
187
|
+
record: res.data?.record,
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
// -----------------------------------------------------------------
|
|
191
|
+
// UPDATE
|
|
192
|
+
// -----------------------------------------------------------------
|
|
193
|
+
case 'update': {
|
|
194
|
+
// 参数验证:检查是否误用了 batch_update 的参数格式
|
|
195
|
+
if (p.records) {
|
|
196
|
+
return (0, helpers_1.json)({
|
|
197
|
+
error: "update action does not accept 'records' parameter",
|
|
198
|
+
hint: "Use 'record_id' + 'fields' for single record update. For batch update, use action: 'batch_update' with 'records' parameter.",
|
|
199
|
+
correct_format: {
|
|
200
|
+
action: 'update',
|
|
201
|
+
record_id: 'recXXX',
|
|
202
|
+
fields: { 字段名: '字段值' },
|
|
203
|
+
},
|
|
204
|
+
batch_update_format: {
|
|
205
|
+
action: 'batch_update',
|
|
206
|
+
records: [{ record_id: 'recXXX', fields: { 字段名: '字段值' } }],
|
|
207
|
+
},
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
log.info(`update: app_token=${p.app_token}, table_id=${p.table_id}, record_id=${p.record_id}`);
|
|
211
|
+
const res = await client.invoke('feishu_bitable_app_table_record.update', (sdk, opts) => sdk.bitable.appTableRecord.update({
|
|
212
|
+
path: {
|
|
213
|
+
app_token: p.app_token,
|
|
214
|
+
table_id: p.table_id,
|
|
215
|
+
record_id: p.record_id,
|
|
216
|
+
},
|
|
217
|
+
params: {
|
|
218
|
+
user_id_type: 'open_id',
|
|
219
|
+
},
|
|
220
|
+
data: {
|
|
221
|
+
fields: p.fields,
|
|
222
|
+
},
|
|
223
|
+
}, opts), { as: 'user' });
|
|
224
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
225
|
+
log.info(`update: updated record ${p.record_id}`);
|
|
226
|
+
return (0, helpers_1.json)({
|
|
227
|
+
record: res.data?.record,
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
// -----------------------------------------------------------------
|
|
231
|
+
// DELETE
|
|
232
|
+
// -----------------------------------------------------------------
|
|
233
|
+
case 'delete': {
|
|
234
|
+
log.info(`delete: app_token=${p.app_token}, table_id=${p.table_id}, record_id=${p.record_id}`);
|
|
235
|
+
const res = await client.invoke('feishu_bitable_app_table_record.delete', (sdk, opts) => sdk.bitable.appTableRecord.delete({
|
|
236
|
+
path: {
|
|
237
|
+
app_token: p.app_token,
|
|
238
|
+
table_id: p.table_id,
|
|
239
|
+
record_id: p.record_id,
|
|
240
|
+
},
|
|
241
|
+
}, opts), { as: 'user' });
|
|
242
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
243
|
+
log.info(`delete: deleted record ${p.record_id}`);
|
|
244
|
+
return (0, helpers_1.json)({
|
|
245
|
+
success: true,
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
// -----------------------------------------------------------------
|
|
249
|
+
// BATCH_CREATE (P1)
|
|
250
|
+
// -----------------------------------------------------------------
|
|
251
|
+
case 'batch_create': {
|
|
252
|
+
// 参数验证:检查是否误用了 create 的参数格式
|
|
253
|
+
if (p.fields) {
|
|
254
|
+
return (0, helpers_1.json)({
|
|
255
|
+
error: "batch_create action does not accept 'fields' parameter",
|
|
256
|
+
hint: "Use 'records' array for batch creation. For single record, use action: 'create' with 'fields' parameter.",
|
|
257
|
+
correct_format: {
|
|
258
|
+
action: 'batch_create',
|
|
259
|
+
records: [{ fields: { 字段名: '字段值' } }],
|
|
260
|
+
},
|
|
261
|
+
single_create_format: {
|
|
262
|
+
action: 'create',
|
|
263
|
+
fields: { 字段名: '字段值' },
|
|
264
|
+
},
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
if (!p.records || p.records.length === 0) {
|
|
268
|
+
return (0, helpers_1.json)({
|
|
269
|
+
error: 'records is required and cannot be empty',
|
|
270
|
+
hint: "batch_create requires 'records' array, e.g. [{ fields: {...} }, ...]",
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
if (p.records.length > 500) {
|
|
274
|
+
return (0, helpers_1.json)({
|
|
275
|
+
error: 'records count exceeds limit (maximum 500)',
|
|
276
|
+
received_count: p.records.length,
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
log.info(`batch_create: app_token=${p.app_token}, table_id=${p.table_id}, records_count=${p.records.length}`);
|
|
280
|
+
const res = await client.invoke('feishu_bitable_app_table_record.batch_create', (sdk, opts) => sdk.bitable.appTableRecord.batchCreate({
|
|
281
|
+
path: {
|
|
282
|
+
app_token: p.app_token,
|
|
283
|
+
table_id: p.table_id,
|
|
284
|
+
},
|
|
285
|
+
params: {
|
|
286
|
+
user_id_type: 'open_id',
|
|
287
|
+
},
|
|
288
|
+
data: {
|
|
289
|
+
records: p.records,
|
|
290
|
+
},
|
|
291
|
+
}, opts), { as: 'user' });
|
|
292
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
293
|
+
log.info(`batch_create: created ${p.records.length} records in table ${p.table_id}`);
|
|
294
|
+
return (0, helpers_1.json)({
|
|
295
|
+
records: res.data?.records,
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
// -----------------------------------------------------------------
|
|
299
|
+
// BATCH_UPDATE (P1)
|
|
300
|
+
// -----------------------------------------------------------------
|
|
301
|
+
case 'batch_update': {
|
|
302
|
+
// 参数验证:检查是否误用了 update 的参数格式
|
|
303
|
+
if (p.record_id || p.fields) {
|
|
304
|
+
return (0, helpers_1.json)({
|
|
305
|
+
error: "batch_update action does not accept 'record_id' or 'fields' parameters",
|
|
306
|
+
hint: "Use 'records' array for batch update. For single record, use action: 'update' with 'record_id' + 'fields' parameters.",
|
|
307
|
+
correct_format: {
|
|
308
|
+
action: 'batch_update',
|
|
309
|
+
records: [{ record_id: 'recXXX', fields: { 字段名: '字段值' } }],
|
|
310
|
+
},
|
|
311
|
+
single_update_format: {
|
|
312
|
+
action: 'update',
|
|
313
|
+
record_id: 'recXXX',
|
|
314
|
+
fields: { 字段名: '字段值' },
|
|
315
|
+
},
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
if (!p.records || p.records.length === 0) {
|
|
319
|
+
return (0, helpers_1.json)({
|
|
320
|
+
error: 'records is required and cannot be empty',
|
|
321
|
+
hint: "batch_update requires 'records' array, e.g. [{ record_id: 'recXXX', fields: {...} }, ...]",
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
if (p.records.length > 500) {
|
|
325
|
+
return (0, helpers_1.json)({
|
|
326
|
+
error: 'records cannot exceed 500 items',
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
log.info(`batch_update: app_token=${p.app_token}, table_id=${p.table_id}, records_count=${p.records.length}`);
|
|
330
|
+
const res = await client.invoke('feishu_bitable_app_table_record.batch_update', (sdk, opts) => sdk.bitable.appTableRecord.batchUpdate({
|
|
331
|
+
path: {
|
|
332
|
+
app_token: p.app_token,
|
|
333
|
+
table_id: p.table_id,
|
|
334
|
+
},
|
|
335
|
+
params: {
|
|
336
|
+
user_id_type: 'open_id',
|
|
337
|
+
},
|
|
338
|
+
data: {
|
|
339
|
+
records: p.records,
|
|
340
|
+
},
|
|
341
|
+
}, opts), { as: 'user' });
|
|
342
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
343
|
+
log.info(`batch_update: updated ${p.records.length} records in table ${p.table_id}`);
|
|
344
|
+
return (0, helpers_1.json)({
|
|
345
|
+
records: res.data?.records,
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
// -----------------------------------------------------------------
|
|
349
|
+
// BATCH_DELETE (P1)
|
|
350
|
+
// -----------------------------------------------------------------
|
|
351
|
+
case 'batch_delete': {
|
|
352
|
+
if (!p.record_ids || p.record_ids.length === 0) {
|
|
353
|
+
return (0, helpers_1.json)({
|
|
354
|
+
error: 'record_ids is required and cannot be empty',
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
if (p.record_ids.length > 500) {
|
|
358
|
+
return (0, helpers_1.json)({
|
|
359
|
+
error: 'record_ids cannot exceed 500 items',
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
log.info(`batch_delete: app_token=${p.app_token}, table_id=${p.table_id}, record_ids_count=${p.record_ids.length}`);
|
|
363
|
+
const res = await client.invoke('feishu_bitable_app_table_record.batch_delete', (sdk, opts) => sdk.bitable.appTableRecord.batchDelete({
|
|
364
|
+
path: {
|
|
365
|
+
app_token: p.app_token,
|
|
366
|
+
table_id: p.table_id,
|
|
367
|
+
},
|
|
368
|
+
data: {
|
|
369
|
+
records: p.record_ids,
|
|
370
|
+
},
|
|
371
|
+
}, opts), { as: 'user' });
|
|
372
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
373
|
+
log.info(`batch_delete: deleted ${p.record_ids.length} records from table ${p.table_id}`);
|
|
374
|
+
return (0, helpers_1.json)({
|
|
375
|
+
success: true,
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
// -----------------------------------------------------------------
|
|
379
|
+
// LIST (P0) - 使用 search API(旧 list API 已废弃)
|
|
380
|
+
// -----------------------------------------------------------------
|
|
381
|
+
case 'list': {
|
|
382
|
+
log.info(`list: app_token=${p.app_token}, table_id=${p.table_id}, view_id=${p.view_id ?? 'none'}, field_names=${p.field_names?.length ?? 0}, filter=${p.filter ? 'yes' : 'no'}`);
|
|
383
|
+
const searchData = {};
|
|
384
|
+
if (p.view_id !== undefined)
|
|
385
|
+
searchData.view_id = p.view_id;
|
|
386
|
+
if (p.field_names !== undefined)
|
|
387
|
+
searchData.field_names = p.field_names;
|
|
388
|
+
// 特殊处理:isEmpty/isNotEmpty 必须带 value=[](即使逻辑上不需要值)
|
|
389
|
+
if (p.filter !== undefined) {
|
|
390
|
+
const filter = { ...p.filter };
|
|
391
|
+
if (filter.conditions) {
|
|
392
|
+
filter.conditions = filter.conditions.map((cond) => {
|
|
393
|
+
if ((cond.operator === 'isEmpty' || cond.operator === 'isNotEmpty') && !cond.value) {
|
|
394
|
+
log.warn(`list: ${cond.operator} operator detected without value. Auto-adding value=[] to avoid API error.`);
|
|
395
|
+
return { ...cond, value: [] };
|
|
396
|
+
}
|
|
397
|
+
return cond;
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
searchData.filter = filter;
|
|
401
|
+
}
|
|
402
|
+
if (p.sort !== undefined)
|
|
403
|
+
searchData.sort = p.sort;
|
|
404
|
+
if (p.automatic_fields !== undefined)
|
|
405
|
+
searchData.automatic_fields = p.automatic_fields;
|
|
406
|
+
const res = await client.invoke('feishu_bitable_app_table_record.list', (sdk, opts) => sdk.bitable.appTableRecord.search({
|
|
407
|
+
path: {
|
|
408
|
+
app_token: p.app_token,
|
|
409
|
+
table_id: p.table_id,
|
|
410
|
+
},
|
|
411
|
+
params: {
|
|
412
|
+
user_id_type: 'open_id',
|
|
413
|
+
page_size: p.page_size,
|
|
414
|
+
page_token: p.page_token,
|
|
415
|
+
},
|
|
416
|
+
data: searchData,
|
|
417
|
+
}, opts), { as: 'user' });
|
|
418
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
419
|
+
const data = res.data;
|
|
420
|
+
log.info(`list: returned ${data?.items?.length ?? 0} records`);
|
|
421
|
+
return (0, helpers_1.json)({
|
|
422
|
+
records: data?.items,
|
|
423
|
+
has_more: data?.has_more ?? false,
|
|
424
|
+
page_token: data?.page_token,
|
|
425
|
+
total: data?.total,
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
default:
|
|
429
|
+
return (0, helpers_1.json)({
|
|
430
|
+
error: `Unknown action: ${p.action}`,
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
catch (err) {
|
|
435
|
+
return await (0, helpers_1.handleInvokeErrorWithAutoAuth)(err, cfg);
|
|
436
|
+
}
|
|
437
|
+
},
|
|
438
|
+
}, { name: 'feishu_bitable_app_table_record' });
|
|
439
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*
|
|
5
|
+
* feishu_bitable_app_table_view tool -- Manage Feishu Bitable views.
|
|
6
|
+
*
|
|
7
|
+
* P1 Actions: create, get, list, patch
|
|
8
|
+
*
|
|
9
|
+
* Uses the Feishu Bitable v1 API:
|
|
10
|
+
* - create: POST /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views
|
|
11
|
+
* - get: GET /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views/:view_id
|
|
12
|
+
* - list: GET /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views
|
|
13
|
+
* - patch: PATCH /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views/:view_id
|
|
14
|
+
*/
|
|
15
|
+
import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
|
|
16
|
+
export declare function registerFeishuBitableAppTableViewTool(api: OpenClawPluginApi): void;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*
|
|
6
|
+
* feishu_bitable_app_table_view tool -- Manage Feishu Bitable views.
|
|
7
|
+
*
|
|
8
|
+
* P1 Actions: create, get, list, patch
|
|
9
|
+
*
|
|
10
|
+
* Uses the Feishu Bitable v1 API:
|
|
11
|
+
* - create: POST /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views
|
|
12
|
+
* - get: GET /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views/:view_id
|
|
13
|
+
* - list: GET /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views
|
|
14
|
+
* - patch: PATCH /open-apis/bitable/v1/apps/:app_token/tables/:table_id/views/:view_id
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.registerFeishuBitableAppTableViewTool = registerFeishuBitableAppTableViewTool;
|
|
18
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
19
|
+
const helpers_1 = require("../helpers.js");
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// Schema
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
const FeishuBitableAppTableViewSchema = typebox_1.Type.Union([
|
|
24
|
+
// CREATE (P1)
|
|
25
|
+
typebox_1.Type.Object({
|
|
26
|
+
action: typebox_1.Type.Literal('create'),
|
|
27
|
+
app_token: typebox_1.Type.String({ description: '多维表格 token' }),
|
|
28
|
+
table_id: typebox_1.Type.String({ description: '数据表 ID' }),
|
|
29
|
+
view_name: typebox_1.Type.String({ description: '视图名称' }),
|
|
30
|
+
view_type: typebox_1.Type.Optional(typebox_1.Type.Union([
|
|
31
|
+
typebox_1.Type.Literal('grid'), // 表格视图
|
|
32
|
+
typebox_1.Type.Literal('kanban'), // 看板视图
|
|
33
|
+
typebox_1.Type.Literal('gallery'), // 画册视图
|
|
34
|
+
typebox_1.Type.Literal('gantt'), // 甘特图
|
|
35
|
+
typebox_1.Type.Literal('form'), // 表单视图
|
|
36
|
+
])),
|
|
37
|
+
}),
|
|
38
|
+
// GET (P1)
|
|
39
|
+
typebox_1.Type.Object({
|
|
40
|
+
action: typebox_1.Type.Literal('get'),
|
|
41
|
+
app_token: typebox_1.Type.String({ description: '多维表格 token' }),
|
|
42
|
+
table_id: typebox_1.Type.String({ description: '数据表 ID' }),
|
|
43
|
+
view_id: typebox_1.Type.String({ description: '视图 ID' }),
|
|
44
|
+
}),
|
|
45
|
+
// LIST (P1)
|
|
46
|
+
typebox_1.Type.Object({
|
|
47
|
+
action: typebox_1.Type.Literal('list'),
|
|
48
|
+
app_token: typebox_1.Type.String({ description: '多维表格 token' }),
|
|
49
|
+
table_id: typebox_1.Type.String({ description: '数据表 ID' }),
|
|
50
|
+
page_size: typebox_1.Type.Optional(typebox_1.Type.Number({ description: '每页数量,默认 50,最大 100' })),
|
|
51
|
+
page_token: typebox_1.Type.Optional(typebox_1.Type.String({ description: '分页标记' })),
|
|
52
|
+
}),
|
|
53
|
+
// PATCH (P1)
|
|
54
|
+
typebox_1.Type.Object({
|
|
55
|
+
action: typebox_1.Type.Literal('patch'),
|
|
56
|
+
app_token: typebox_1.Type.String({ description: '多维表格 token' }),
|
|
57
|
+
table_id: typebox_1.Type.String({ description: '数据表 ID' }),
|
|
58
|
+
view_id: typebox_1.Type.String({ description: '视图 ID' }),
|
|
59
|
+
view_name: typebox_1.Type.Optional(typebox_1.Type.String({ description: '新的视图名称' })),
|
|
60
|
+
}),
|
|
61
|
+
]);
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
// Registration
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
function registerFeishuBitableAppTableViewTool(api) {
|
|
66
|
+
if (!api.config)
|
|
67
|
+
return;
|
|
68
|
+
const cfg = api.config;
|
|
69
|
+
const { toolClient, log } = (0, helpers_1.createToolContext)(api, 'feishu_bitable_app_table_view');
|
|
70
|
+
(0, helpers_1.registerTool)(api, {
|
|
71
|
+
name: 'feishu_bitable_app_table_view',
|
|
72
|
+
label: 'Feishu Bitable Views',
|
|
73
|
+
description: '【以用户身份】飞书多维表格视图管理工具。当用户要求创建/查询/更新视图、切换展示方式时使用。Actions: create(创建视图), get(获取视图详情), list(列出所有视图), patch(更新视图)。',
|
|
74
|
+
parameters: FeishuBitableAppTableViewSchema,
|
|
75
|
+
async execute(_toolCallId, params) {
|
|
76
|
+
const p = params;
|
|
77
|
+
try {
|
|
78
|
+
const client = toolClient();
|
|
79
|
+
switch (p.action) {
|
|
80
|
+
// -----------------------------------------------------------------
|
|
81
|
+
// CREATE
|
|
82
|
+
// -----------------------------------------------------------------
|
|
83
|
+
case 'create': {
|
|
84
|
+
log.info(`create: app_token=${p.app_token}, table_id=${p.table_id}, view_name=${p.view_name}, view_type=${p.view_type ?? 'grid'}`);
|
|
85
|
+
const res = await client.invoke('feishu_bitable_app_table_view.create', (sdk, opts) => sdk.bitable.appTableView.create({
|
|
86
|
+
path: {
|
|
87
|
+
app_token: p.app_token,
|
|
88
|
+
table_id: p.table_id,
|
|
89
|
+
},
|
|
90
|
+
data: {
|
|
91
|
+
view_name: p.view_name,
|
|
92
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
93
|
+
view_type: (p.view_type || 'grid'),
|
|
94
|
+
},
|
|
95
|
+
}, opts), { as: 'user' });
|
|
96
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
97
|
+
log.info(`create: created view ${res.data?.view?.view_id}`);
|
|
98
|
+
return (0, helpers_1.json)({
|
|
99
|
+
view: res.data?.view,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
// -----------------------------------------------------------------
|
|
103
|
+
// GET
|
|
104
|
+
// -----------------------------------------------------------------
|
|
105
|
+
case 'get': {
|
|
106
|
+
log.info(`get: app_token=${p.app_token}, table_id=${p.table_id}, view_id=${p.view_id}`);
|
|
107
|
+
const res = await client.invoke('feishu_bitable_app_table_view.get', (sdk, opts) => sdk.bitable.appTableView.get({
|
|
108
|
+
path: {
|
|
109
|
+
app_token: p.app_token,
|
|
110
|
+
table_id: p.table_id,
|
|
111
|
+
view_id: p.view_id,
|
|
112
|
+
},
|
|
113
|
+
}, opts), { as: 'user' });
|
|
114
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
115
|
+
log.info(`get: returned view ${p.view_id}`);
|
|
116
|
+
return (0, helpers_1.json)({
|
|
117
|
+
view: res.data?.view,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
// -----------------------------------------------------------------
|
|
121
|
+
// LIST
|
|
122
|
+
// -----------------------------------------------------------------
|
|
123
|
+
case 'list': {
|
|
124
|
+
log.info(`list: app_token=${p.app_token}, table_id=${p.table_id}`);
|
|
125
|
+
const res = await client.invoke('feishu_bitable_app_table_view.list', (sdk, opts) => sdk.bitable.appTableView.list({
|
|
126
|
+
path: {
|
|
127
|
+
app_token: p.app_token,
|
|
128
|
+
table_id: p.table_id,
|
|
129
|
+
},
|
|
130
|
+
params: {
|
|
131
|
+
page_size: p.page_size,
|
|
132
|
+
page_token: p.page_token,
|
|
133
|
+
},
|
|
134
|
+
}, opts), { as: 'user' });
|
|
135
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
136
|
+
const data = res.data;
|
|
137
|
+
log.info(`list: returned ${data?.items?.length ?? 0} views`);
|
|
138
|
+
return (0, helpers_1.json)({
|
|
139
|
+
views: data?.items,
|
|
140
|
+
has_more: data?.has_more ?? false,
|
|
141
|
+
page_token: data?.page_token,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
// -----------------------------------------------------------------
|
|
145
|
+
// PATCH
|
|
146
|
+
// -----------------------------------------------------------------
|
|
147
|
+
case 'patch': {
|
|
148
|
+
log.info(`patch: app_token=${p.app_token}, table_id=${p.table_id}, view_id=${p.view_id}, view_name=${p.view_name}`);
|
|
149
|
+
const res = await client.invoke('feishu_bitable_app_table_view.patch', (sdk, opts) => sdk.bitable.appTableView.patch({
|
|
150
|
+
path: {
|
|
151
|
+
app_token: p.app_token,
|
|
152
|
+
table_id: p.table_id,
|
|
153
|
+
view_id: p.view_id,
|
|
154
|
+
},
|
|
155
|
+
data: {
|
|
156
|
+
view_name: p.view_name,
|
|
157
|
+
},
|
|
158
|
+
}, opts), { as: 'user' });
|
|
159
|
+
(0, helpers_1.assertLarkOk)(res);
|
|
160
|
+
log.info(`patch: updated view ${p.view_id}`);
|
|
161
|
+
return (0, helpers_1.json)({
|
|
162
|
+
view: res.data?.view,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
catch (err) {
|
|
168
|
+
return await (0, helpers_1.handleInvokeErrorWithAutoAuth)(err, cfg);
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
}, { name: 'feishu_bitable_app_table_view' });
|
|
172
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*
|
|
5
|
+
* feishu_bitable_app_table tool -- Manage Feishu Bitable tables.
|
|
6
|
+
*
|
|
7
|
+
* P0 Actions: create, list, patch
|
|
8
|
+
* P1 Actions: batch_create
|
|
9
|
+
*
|
|
10
|
+
* Uses the Feishu Bitable v1 API:
|
|
11
|
+
* - create: POST /open-apis/bitable/v1/apps/:app_token/tables
|
|
12
|
+
* - list: GET /open-apis/bitable/v1/apps/:app_token/tables
|
|
13
|
+
* - patch: PATCH /open-apis/bitable/v1/apps/:app_token/tables/:table_id
|
|
14
|
+
* - batch_create: POST /open-apis/bitable/v1/apps/:app_token/tables/batch_create
|
|
15
|
+
*/
|
|
16
|
+
import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
|
|
17
|
+
export declare function registerFeishuBitableAppTableTool(api: OpenClawPluginApi): void;
|