@lark-project/openclaw-lark-project 2026.3.131
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 +80 -0
- package/README.zh.md +80 -0
- package/dist/index.js +172 -0
- package/dist/index.js.map +7 -0
- package/dist/skills/feishu-bitable/SKILL.md +248 -0
- package/dist/skills/feishu-bitable/references/examples.md +813 -0
- package/dist/skills/feishu-bitable/references/field-properties.md +763 -0
- package/dist/skills/feishu-bitable/references/record-values.md +911 -0
- package/dist/skills/feishu-calendar/SKILL.md +244 -0
- package/dist/skills/feishu-channel-rules/SKILL.md +18 -0
- package/dist/skills/feishu-channel-rules/references/markdown-syntax.md +138 -0
- package/dist/skills/feishu-create-doc/SKILL.md +719 -0
- package/dist/skills/feishu-fetch-doc/SKILL.md +93 -0
- package/dist/skills/feishu-im-read/SKILL.md +163 -0
- package/dist/skills/feishu-project/SKILL.md +122 -0
- package/dist/skills/feishu-task/SKILL.md +293 -0
- package/dist/skills/feishu-troubleshoot/SKILL.md +70 -0
- package/dist/skills/feishu-update-doc/SKILL.md +285 -0
- package/dist/src/card/builder.js +293 -0
- package/dist/src/card/builder.js.map +7 -0
- package/dist/src/card/cardkit.js +126 -0
- package/dist/src/card/cardkit.js.map +7 -0
- package/dist/src/card/flush-controller.js +107 -0
- package/dist/src/card/flush-controller.js.map +7 -0
- package/dist/src/card/markdown-style.js +57 -0
- package/dist/src/card/markdown-style.js.map +7 -0
- package/dist/src/card/reply-dispatcher-types.js +39 -0
- package/dist/src/card/reply-dispatcher-types.js.map +7 -0
- package/dist/src/card/reply-dispatcher.js +245 -0
- package/dist/src/card/reply-dispatcher.js.map +7 -0
- package/dist/src/card/reply-mode.js +29 -0
- package/dist/src/card/reply-mode.js.map +7 -0
- package/dist/src/card/streaming-card-controller.js +653 -0
- package/dist/src/card/streaming-card-controller.js.map +7 -0
- package/dist/src/card/unavailable-guard.js +76 -0
- package/dist/src/card/unavailable-guard.js.map +7 -0
- package/dist/src/channel/abort-detect.js +79 -0
- package/dist/src/channel/abort-detect.js.map +7 -0
- package/dist/src/channel/chat-queue.js +50 -0
- package/dist/src/channel/chat-queue.js.map +7 -0
- package/dist/src/channel/config-adapter.js +89 -0
- package/dist/src/channel/config-adapter.js.map +7 -0
- package/dist/src/channel/directory.js +133 -0
- package/dist/src/channel/directory.js.map +7 -0
- package/dist/src/channel/event-handlers.js +175 -0
- package/dist/src/channel/event-handlers.js.map +7 -0
- package/dist/src/channel/monitor.js +108 -0
- package/dist/src/channel/monitor.js.map +7 -0
- package/dist/src/channel/onboarding-config.js +76 -0
- package/dist/src/channel/onboarding-config.js.map +7 -0
- package/dist/src/channel/onboarding-migrate.js +55 -0
- package/dist/src/channel/onboarding-migrate.js.map +7 -0
- package/dist/src/channel/onboarding.js +285 -0
- package/dist/src/channel/onboarding.js.map +7 -0
- package/dist/src/channel/plugin.js +260 -0
- package/dist/src/channel/plugin.js.map +7 -0
- package/dist/src/channel/probe.js +14 -0
- package/dist/src/channel/probe.js.map +7 -0
- package/dist/src/channel/types.js +1 -0
- package/dist/src/channel/types.js.map +7 -0
- package/dist/src/commands/auth.js +73 -0
- package/dist/src/commands/auth.js.map +7 -0
- package/dist/src/commands/diagnose.js +658 -0
- package/dist/src/commands/diagnose.js.map +7 -0
- package/dist/src/commands/doctor.js +327 -0
- package/dist/src/commands/doctor.js.map +7 -0
- package/dist/src/commands/index.js +124 -0
- package/dist/src/commands/index.js.map +7 -0
- package/dist/src/core/accounts.js +129 -0
- package/dist/src/core/accounts.js.map +7 -0
- package/dist/src/core/agent-config.js +60 -0
- package/dist/src/core/agent-config.js.map +7 -0
- package/dist/src/core/api-error.js +55 -0
- package/dist/src/core/api-error.js.map +7 -0
- package/dist/src/core/app-owner-fallback.js +17 -0
- package/dist/src/core/app-owner-fallback.js.map +7 -0
- package/dist/src/core/app-scope-checker.js +95 -0
- package/dist/src/core/app-scope-checker.js.map +7 -0
- package/dist/src/core/auth-errors.js +120 -0
- package/dist/src/core/auth-errors.js.map +7 -0
- package/dist/src/core/chat-info-cache.js +102 -0
- package/dist/src/core/chat-info-cache.js.map +7 -0
- package/dist/src/core/config-schema.js +150 -0
- package/dist/src/core/config-schema.js.map +7 -0
- package/dist/src/core/device-flow.js +174 -0
- package/dist/src/core/device-flow.js.map +7 -0
- package/dist/src/core/feishu-fetch.js +12 -0
- package/dist/src/core/feishu-fetch.js.map +7 -0
- package/dist/src/core/footer-config.js +16 -0
- package/dist/src/core/footer-config.js.map +7 -0
- package/dist/src/core/lark-client.js +322 -0
- package/dist/src/core/lark-client.js.map +7 -0
- package/dist/src/core/lark-logger.js +92 -0
- package/dist/src/core/lark-logger.js.map +7 -0
- package/dist/src/core/lark-ticket.js +18 -0
- package/dist/src/core/lark-ticket.js.map +7 -0
- package/dist/src/core/message-unavailable.js +119 -0
- package/dist/src/core/message-unavailable.js.map +7 -0
- package/dist/src/core/owner-policy.js +25 -0
- package/dist/src/core/owner-policy.js.map +7 -0
- package/dist/src/core/permission-url.js +37 -0
- package/dist/src/core/permission-url.js.map +7 -0
- package/dist/src/core/project-auth.js +177 -0
- package/dist/src/core/project-auth.js.map +7 -0
- package/dist/src/core/project-oauth-flow.js +124 -0
- package/dist/src/core/project-oauth-flow.js.map +7 -0
- package/dist/src/core/project-token-store.js +172 -0
- package/dist/src/core/project-token-store.js.map +7 -0
- package/dist/src/core/raw-request.js +45 -0
- package/dist/src/core/raw-request.js.map +7 -0
- package/dist/src/core/scope-manager.js +62 -0
- package/dist/src/core/scope-manager.js.map +7 -0
- package/dist/src/core/security-check.js +118 -0
- package/dist/src/core/security-check.js.map +7 -0
- package/dist/src/core/shutdown-hooks.js +37 -0
- package/dist/src/core/shutdown-hooks.js.map +7 -0
- package/dist/src/core/targets.js +55 -0
- package/dist/src/core/targets.js.map +7 -0
- package/dist/src/core/token-store.js +215 -0
- package/dist/src/core/token-store.js.map +7 -0
- package/dist/src/core/tool-client.js +335 -0
- package/dist/src/core/tool-client.js.map +7 -0
- package/dist/src/core/tool-scopes.js +207 -0
- package/dist/src/core/tool-scopes.js.map +7 -0
- package/dist/src/core/tools-config.js +57 -0
- package/dist/src/core/tools-config.js.map +7 -0
- package/dist/src/core/types.js +1 -0
- package/dist/src/core/types.js.map +7 -0
- package/dist/src/core/uat-client.js +124 -0
- package/dist/src/core/uat-client.js.map +7 -0
- package/dist/src/core/version.js +27 -0
- package/dist/src/core/version.js.map +7 -0
- package/dist/src/messaging/converters/audio.js +19 -0
- package/dist/src/messaging/converters/audio.js.map +7 -0
- package/dist/src/messaging/converters/calendar.js +46 -0
- package/dist/src/messaging/converters/calendar.js.map +7 -0
- package/dist/src/messaging/converters/content-converter.js +61 -0
- package/dist/src/messaging/converters/content-converter.js.map +7 -0
- package/dist/src/messaging/converters/file.js +18 -0
- package/dist/src/messaging/converters/file.js.map +7 -0
- package/dist/src/messaging/converters/folder.js +18 -0
- package/dist/src/messaging/converters/folder.js.map +7 -0
- package/dist/src/messaging/converters/hongbao.js +14 -0
- package/dist/src/messaging/converters/hongbao.js.map +7 -0
- package/dist/src/messaging/converters/image.js +16 -0
- package/dist/src/messaging/converters/image.js.map +7 -0
- package/dist/src/messaging/converters/index.js +48 -0
- package/dist/src/messaging/converters/index.js.map +7 -0
- package/dist/src/messaging/converters/interactive/card-converter.js +1040 -0
- package/dist/src/messaging/converters/interactive/card-converter.js.map +7 -0
- package/dist/src/messaging/converters/interactive/card-utils.js +36 -0
- package/dist/src/messaging/converters/interactive/card-utils.js.map +7 -0
- package/dist/src/messaging/converters/interactive/index.js +19 -0
- package/dist/src/messaging/converters/interactive/index.js.map +7 -0
- package/dist/src/messaging/converters/interactive/legacy.js +53 -0
- package/dist/src/messaging/converters/interactive/legacy.js.map +7 -0
- package/dist/src/messaging/converters/interactive/types.js +23 -0
- package/dist/src/messaging/converters/interactive/types.js.map +7 -0
- package/dist/src/messaging/converters/location.js +17 -0
- package/dist/src/messaging/converters/location.js.map +7 -0
- package/dist/src/messaging/converters/merge-forward.js +143 -0
- package/dist/src/messaging/converters/merge-forward.js.map +7 -0
- package/dist/src/messaging/converters/post.js +113 -0
- package/dist/src/messaging/converters/post.js.map +7 -0
- package/dist/src/messaging/converters/share.js +22 -0
- package/dist/src/messaging/converters/share.js.map +7 -0
- package/dist/src/messaging/converters/sticker.js +16 -0
- package/dist/src/messaging/converters/sticker.js.map +7 -0
- package/dist/src/messaging/converters/system.js +25 -0
- package/dist/src/messaging/converters/system.js.map +7 -0
- package/dist/src/messaging/converters/text.js +12 -0
- package/dist/src/messaging/converters/text.js.map +7 -0
- package/dist/src/messaging/converters/todo.js +37 -0
- package/dist/src/messaging/converters/todo.js.map +7 -0
- package/dist/src/messaging/converters/types.js +1 -0
- package/dist/src/messaging/converters/types.js.map +7 -0
- package/dist/src/messaging/converters/unknown.js +13 -0
- package/dist/src/messaging/converters/unknown.js.map +7 -0
- package/dist/src/messaging/converters/utils.js +35 -0
- package/dist/src/messaging/converters/utils.js.map +7 -0
- package/dist/src/messaging/converters/video-chat.js +21 -0
- package/dist/src/messaging/converters/video-chat.js.map +7 -0
- package/dist/src/messaging/converters/video.js +30 -0
- package/dist/src/messaging/converters/video.js.map +7 -0
- package/dist/src/messaging/converters/vote.js +24 -0
- package/dist/src/messaging/converters/vote.js.map +7 -0
- package/dist/src/messaging/inbound/dedup.js +82 -0
- package/dist/src/messaging/inbound/dedup.js.map +7 -0
- package/dist/src/messaging/inbound/dispatch-builders.js +98 -0
- package/dist/src/messaging/inbound/dispatch-builders.js.map +7 -0
- package/dist/src/messaging/inbound/dispatch-commands.js +94 -0
- package/dist/src/messaging/inbound/dispatch-commands.js.map +7 -0
- package/dist/src/messaging/inbound/dispatch-context.js +96 -0
- package/dist/src/messaging/inbound/dispatch-context.js.map +7 -0
- package/dist/src/messaging/inbound/dispatch.js +150 -0
- package/dist/src/messaging/inbound/dispatch.js.map +7 -0
- package/dist/src/messaging/inbound/enrich.js +137 -0
- package/dist/src/messaging/inbound/enrich.js.map +7 -0
- package/dist/src/messaging/inbound/gate-effects.js +28 -0
- package/dist/src/messaging/inbound/gate-effects.js.map +7 -0
- package/dist/src/messaging/inbound/gate.js +163 -0
- package/dist/src/messaging/inbound/gate.js.map +7 -0
- package/dist/src/messaging/inbound/handler.js +132 -0
- package/dist/src/messaging/inbound/handler.js.map +7 -0
- package/dist/src/messaging/inbound/media-resolver.js +70 -0
- package/dist/src/messaging/inbound/media-resolver.js.map +7 -0
- package/dist/src/messaging/inbound/mention.js +50 -0
- package/dist/src/messaging/inbound/mention.js.map +7 -0
- package/dist/src/messaging/inbound/parse-io.js +41 -0
- package/dist/src/messaging/inbound/parse-io.js.map +7 -0
- package/dist/src/messaging/inbound/parse.js +79 -0
- package/dist/src/messaging/inbound/parse.js.map +7 -0
- package/dist/src/messaging/inbound/permission.js +30 -0
- package/dist/src/messaging/inbound/permission.js.map +7 -0
- package/dist/src/messaging/inbound/policy.js +83 -0
- package/dist/src/messaging/inbound/policy.js.map +7 -0
- package/dist/src/messaging/inbound/reaction-handler.js +162 -0
- package/dist/src/messaging/inbound/reaction-handler.js.map +7 -0
- package/dist/src/messaging/inbound/user-name-cache.js +172 -0
- package/dist/src/messaging/inbound/user-name-cache.js.map +7 -0
- package/dist/src/messaging/outbound/actions.js +239 -0
- package/dist/src/messaging/outbound/actions.js.map +7 -0
- package/dist/src/messaging/outbound/chat-manage.js +74 -0
- package/dist/src/messaging/outbound/chat-manage.js.map +7 -0
- package/dist/src/messaging/outbound/deliver.js +162 -0
- package/dist/src/messaging/outbound/deliver.js.map +7 -0
- package/dist/src/messaging/outbound/fetch.js +7 -0
- package/dist/src/messaging/outbound/fetch.js.map +7 -0
- package/dist/src/messaging/outbound/forward.js +31 -0
- package/dist/src/messaging/outbound/forward.js.map +7 -0
- package/dist/src/messaging/outbound/media-url-utils.js +101 -0
- package/dist/src/messaging/outbound/media-url-utils.js.map +7 -0
- package/dist/src/messaging/outbound/media.js +463 -0
- package/dist/src/messaging/outbound/media.js.map +7 -0
- package/dist/src/messaging/outbound/outbound.js +95 -0
- package/dist/src/messaging/outbound/outbound.js.map +7 -0
- package/dist/src/messaging/outbound/reactions.js +312 -0
- package/dist/src/messaging/outbound/reactions.js.map +7 -0
- package/dist/src/messaging/outbound/send.js +194 -0
- package/dist/src/messaging/outbound/send.js.map +7 -0
- package/dist/src/messaging/outbound/typing.js +77 -0
- package/dist/src/messaging/outbound/typing.js.map +7 -0
- package/dist/src/messaging/shared/message-lookup.js +84 -0
- package/dist/src/messaging/shared/message-lookup.js.map +7 -0
- package/dist/src/messaging/types.js +1 -0
- package/dist/src/messaging/types.js.map +7 -0
- package/dist/src/tools/auto-auth.js +714 -0
- package/dist/src/tools/auto-auth.js.map +7 -0
- package/dist/src/tools/helpers.js +133 -0
- package/dist/src/tools/helpers.js.map +7 -0
- package/dist/src/tools/mcp/doc/create.js +35 -0
- package/dist/src/tools/mcp/doc/create.js.map +7 -0
- package/dist/src/tools/mcp/doc/fetch.js +33 -0
- package/dist/src/tools/mcp/doc/fetch.js.map +7 -0
- package/dist/src/tools/mcp/doc/index.js +32 -0
- package/dist/src/tools/mcp/doc/index.js.map +7 -0
- package/dist/src/tools/mcp/doc/update.js +61 -0
- package/dist/src/tools/mcp/doc/update.js.map +7 -0
- package/dist/src/tools/mcp/project/endpoint.js +25 -0
- package/dist/src/tools/mcp/project/endpoint.js.map +7 -0
- package/dist/src/tools/mcp/project/index.js +27 -0
- package/dist/src/tools/mcp/project/index.js.map +7 -0
- package/dist/src/tools/mcp/project/tools.js +579 -0
- package/dist/src/tools/mcp/project/tools.js.map +7 -0
- package/dist/src/tools/mcp/shared.js +170 -0
- package/dist/src/tools/mcp/shared.js.map +7 -0
- package/dist/src/tools/oapi/bitable/app-table-field.js +244 -0
- package/dist/src/tools/oapi/bitable/app-table-field.js.map +7 -0
- package/dist/src/tools/oapi/bitable/app-table-record.js +501 -0
- package/dist/src/tools/oapi/bitable/app-table-record.js.map +7 -0
- package/dist/src/tools/oapi/bitable/app-table-view.js +226 -0
- package/dist/src/tools/oapi/bitable/app-table-view.js.map +7 -0
- package/dist/src/tools/oapi/bitable/app-table.js +278 -0
- package/dist/src/tools/oapi/bitable/app-table.js.map +7 -0
- package/dist/src/tools/oapi/bitable/app.js +200 -0
- package/dist/src/tools/oapi/bitable/app.js.map +7 -0
- package/dist/src/tools/oapi/bitable/index.js +13 -0
- package/dist/src/tools/oapi/bitable/index.js.map +7 -0
- package/dist/src/tools/oapi/calendar/calendar.js +131 -0
- package/dist/src/tools/oapi/calendar/calendar.js.map +7 -0
- package/dist/src/tools/oapi/calendar/event-attendee.js +301 -0
- package/dist/src/tools/oapi/calendar/event-attendee.js.map +7 -0
- package/dist/src/tools/oapi/calendar/event.js +834 -0
- package/dist/src/tools/oapi/calendar/event.js.map +7 -0
- package/dist/src/tools/oapi/calendar/freebusy.js +111 -0
- package/dist/src/tools/oapi/calendar/freebusy.js.map +7 -0
- package/dist/src/tools/oapi/calendar/index.js +11 -0
- package/dist/src/tools/oapi/calendar/index.js.map +7 -0
- package/dist/src/tools/oapi/chat/chat.js +132 -0
- package/dist/src/tools/oapi/chat/chat.js.map +7 -0
- package/dist/src/tools/oapi/chat/index.js +11 -0
- package/dist/src/tools/oapi/chat/index.js.map +7 -0
- package/dist/src/tools/oapi/chat/members.js +83 -0
- package/dist/src/tools/oapi/chat/members.js.map +7 -0
- package/dist/src/tools/oapi/common/get-user.js +95 -0
- package/dist/src/tools/oapi/common/get-user.js.map +7 -0
- package/dist/src/tools/oapi/common/index.js +7 -0
- package/dist/src/tools/oapi/common/index.js.map +7 -0
- package/dist/src/tools/oapi/common/search-user.js +67 -0
- package/dist/src/tools/oapi/common/search-user.js.map +7 -0
- package/dist/src/tools/oapi/drive/doc-comments.js +310 -0
- package/dist/src/tools/oapi/drive/doc-comments.js.map +7 -0
- package/dist/src/tools/oapi/drive/doc-media.js +314 -0
- package/dist/src/tools/oapi/drive/doc-media.js.map +7 -0
- package/dist/src/tools/oapi/drive/file.js +548 -0
- package/dist/src/tools/oapi/drive/file.js.map +7 -0
- package/dist/src/tools/oapi/drive/index.js +29 -0
- package/dist/src/tools/oapi/drive/index.js.map +7 -0
- package/dist/src/tools/oapi/helpers.js +199 -0
- package/dist/src/tools/oapi/helpers.js.map +7 -0
- package/dist/src/tools/oapi/im/format-messages.js +128 -0
- package/dist/src/tools/oapi/im/format-messages.js.map +7 -0
- package/dist/src/tools/oapi/im/index.js +15 -0
- package/dist/src/tools/oapi/im/index.js.map +7 -0
- package/dist/src/tools/oapi/im/message-read.js +404 -0
- package/dist/src/tools/oapi/im/message-read.js.map +7 -0
- package/dist/src/tools/oapi/im/message.js +179 -0
- package/dist/src/tools/oapi/im/message.js.map +7 -0
- package/dist/src/tools/oapi/im/resource.js +126 -0
- package/dist/src/tools/oapi/im/resource.js.map +7 -0
- package/dist/src/tools/oapi/im/time-utils.js +169 -0
- package/dist/src/tools/oapi/im/time-utils.js.map +7 -0
- package/dist/src/tools/oapi/im/user-name-uat.js +103 -0
- package/dist/src/tools/oapi/im/user-name-uat.js.map +7 -0
- package/dist/src/tools/oapi/index.js +56 -0
- package/dist/src/tools/oapi/index.js.map +7 -0
- package/dist/src/tools/oapi/sdk-types.js +1 -0
- package/dist/src/tools/oapi/sdk-types.js.map +7 -0
- package/dist/src/tools/oapi/search/doc-search.js +215 -0
- package/dist/src/tools/oapi/search/doc-search.js.map +7 -0
- package/dist/src/tools/oapi/search/index.js +25 -0
- package/dist/src/tools/oapi/search/index.js.map +7 -0
- package/dist/src/tools/oapi/sheets/index.js +25 -0
- package/dist/src/tools/oapi/sheets/index.js.map +7 -0
- package/dist/src/tools/oapi/sheets/sheet.js +652 -0
- package/dist/src/tools/oapi/sheets/sheet.js.map +7 -0
- package/dist/src/tools/oapi/task/comment.js +151 -0
- package/dist/src/tools/oapi/task/comment.js.map +7 -0
- package/dist/src/tools/oapi/task/index.js +11 -0
- package/dist/src/tools/oapi/task/index.js.map +7 -0
- package/dist/src/tools/oapi/task/subtask.js +175 -0
- package/dist/src/tools/oapi/task/subtask.js.map +7 -0
- package/dist/src/tools/oapi/task/task.js +405 -0
- package/dist/src/tools/oapi/task/task.js.map +7 -0
- package/dist/src/tools/oapi/task/tasklist.js +366 -0
- package/dist/src/tools/oapi/task/tasklist.js.map +7 -0
- package/dist/src/tools/oapi/wiki/index.js +27 -0
- package/dist/src/tools/oapi/wiki/index.js.map +7 -0
- package/dist/src/tools/oapi/wiki/space-node.js +311 -0
- package/dist/src/tools/oapi/wiki/space-node.js.map +7 -0
- package/dist/src/tools/oapi/wiki/space.js +148 -0
- package/dist/src/tools/oapi/wiki/space.js.map +7 -0
- package/dist/src/tools/oauth-batch-auth.js +125 -0
- package/dist/src/tools/oauth-batch-auth.js.map +7 -0
- package/dist/src/tools/oauth-cards.js +269 -0
- package/dist/src/tools/oauth-cards.js.map +7 -0
- package/dist/src/tools/oauth.js +538 -0
- package/dist/src/tools/oauth.js.map +7 -0
- package/dist/src/tools/onboarding-auth.js +101 -0
- package/dist/src/tools/onboarding-auth.js.map +7 -0
- package/dist/src/tools/project-oauth.js +305 -0
- package/dist/src/tools/project-oauth.js.map +7 -0
- package/dist/src/tools/tat/im/index.js +9 -0
- package/dist/src/tools/tat/im/index.js.map +7 -0
- package/dist/src/tools/tat/im/resource.js +123 -0
- package/dist/src/tools/tat/im/resource.js.map +7 -0
- package/package.json +64 -0
|
@@ -0,0 +1,834 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import {
|
|
3
|
+
json,
|
|
4
|
+
createToolContext,
|
|
5
|
+
parseTimeToTimestamp,
|
|
6
|
+
assertLarkOk,
|
|
7
|
+
handleInvokeErrorWithAutoAuth,
|
|
8
|
+
formatLarkError,
|
|
9
|
+
unixTimestampToISO8601
|
|
10
|
+
} from "../helpers";
|
|
11
|
+
const FeishuCalendarEventSchema = Type.Union([
|
|
12
|
+
// CREATE
|
|
13
|
+
Type.Object({
|
|
14
|
+
action: Type.Literal("create"),
|
|
15
|
+
start_time: Type.String({
|
|
16
|
+
description: "\u5F00\u59CB\u65F6\u95F4\uFF08\u5FC5\u586B\uFF09\u3002ISO 8601 / RFC 3339 \u683C\u5F0F\uFF08\u5305\u542B\u65F6\u533A\uFF09\uFF0C\u4F8B\u5982 '2024-01-01T00:00:00+08:00'"
|
|
17
|
+
}),
|
|
18
|
+
end_time: Type.String({
|
|
19
|
+
description: "\u7ED3\u675F\u65F6\u95F4\uFF08\u5FC5\u586B\uFF09\u3002\u683C\u5F0F\u540C start_time\u3002\u5982\u679C\u7528\u6237\u672A\u6307\u5B9A\u65F6\u957F\uFF0C\u9ED8\u8BA4\u4E3A\u5F00\u59CB\u65F6\u95F4\u540E1\u5C0F\u65F6\u3002"
|
|
20
|
+
}),
|
|
21
|
+
summary: Type.Optional(
|
|
22
|
+
Type.String({
|
|
23
|
+
description: "\u65E5\u7A0B\u6807\u9898\uFF08\u53EF\u9009\uFF0C\u4F46\u5F3A\u70C8\u5EFA\u8BAE\u63D0\u4F9B\uFF09"
|
|
24
|
+
})
|
|
25
|
+
),
|
|
26
|
+
user_open_id: Type.Optional(
|
|
27
|
+
Type.String({
|
|
28
|
+
description: "\u5F53\u524D\u8BF7\u6C42\u7528\u6237\u7684 open_id\uFF08\u53EF\u9009\uFF0C\u4F46\u5F3A\u70C8\u5EFA\u8BAE\u63D0\u4F9B\uFF09\u3002\u4ECE\u6D88\u606F\u4E0A\u4E0B\u6587\u7684 SenderId \u5B57\u6BB5\u83B7\u53D6\uFF0C\u683C\u5F0F\u4E3A ou_xxx\u3002\u65E5\u7A0B\u521B\u5EFA\u5728\u5E94\u7528\u65E5\u5386\u4E0A\uFF0C\u5FC5\u987B\u901A\u8FC7\u6B64\u53C2\u6570\u5C06\u7528\u6237\u52A0\u4E3A\u53C2\u4F1A\u4EBA\uFF0C\u65E5\u7A0B\u624D\u4F1A\u51FA\u73B0\u5728\u7528\u6237\u7684\u98DE\u4E66\u65E5\u5386\u4E2D\u3002"
|
|
29
|
+
})
|
|
30
|
+
),
|
|
31
|
+
calendar_id: Type.Optional(
|
|
32
|
+
Type.String({
|
|
33
|
+
description: "Calendar ID (optional; primary calendar used if omitted)"
|
|
34
|
+
})
|
|
35
|
+
),
|
|
36
|
+
description: Type.Optional(
|
|
37
|
+
Type.String({
|
|
38
|
+
description: "\u65E5\u7A0B\u63CF\u8FF0"
|
|
39
|
+
})
|
|
40
|
+
),
|
|
41
|
+
attendees: Type.Optional(
|
|
42
|
+
Type.Array(
|
|
43
|
+
Type.Object({
|
|
44
|
+
type: Type.Union([
|
|
45
|
+
Type.Literal("user"),
|
|
46
|
+
Type.Literal("chat"),
|
|
47
|
+
Type.Literal("resource"),
|
|
48
|
+
Type.Literal("third_party")
|
|
49
|
+
]),
|
|
50
|
+
id: Type.String({
|
|
51
|
+
description: "Attendee open_id, chat_id, resource_id, or email"
|
|
52
|
+
})
|
|
53
|
+
}),
|
|
54
|
+
{
|
|
55
|
+
description: "\u53C2\u4F1A\u4EBA\u5217\u8868\uFF08\u5F3A\u70C8\u5EFA\u8BAE\u63D0\u4F9B\uFF0C\u5426\u5219\u65E5\u7A0B\u53EA\u5728\u5E94\u7528\u65E5\u5386\u4E0A\uFF0C\u7528\u6237\u770B\u4E0D\u5230\uFF09\u3002type='user' \u65F6 id \u586B open_id\uFF0Ctype='third_party' \u65F6 id \u586B\u90AE\u7BB1\u3002"
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
),
|
|
59
|
+
vchat: Type.Optional(
|
|
60
|
+
Type.Object(
|
|
61
|
+
{
|
|
62
|
+
vc_type: Type.Optional(
|
|
63
|
+
Type.Union([Type.Literal("vc"), Type.Literal("third_party"), Type.Literal("no_meeting")], {
|
|
64
|
+
description: "\u89C6\u9891\u4F1A\u8BAE\u7C7B\u578B\uFF1Avc\uFF08\u98DE\u4E66\u89C6\u9891\u4F1A\u8BAE\uFF09\u3001third_party\uFF08\u7B2C\u4E09\u65B9\u94FE\u63A5\uFF09\u3001no_meeting\uFF08\u65E0\u89C6\u9891\u4F1A\u8BAE\uFF09\u3002\u9ED8\u8BA4\u4E3A\u7A7A\uFF0C\u9996\u6B21\u6DFB\u52A0\u53C2\u4E0E\u4EBA\u65F6\u81EA\u52A8\u751F\u6210\u98DE\u4E66\u89C6\u9891\u4F1A\u8BAE\u3002"
|
|
65
|
+
})
|
|
66
|
+
),
|
|
67
|
+
icon_type: Type.Optional(
|
|
68
|
+
Type.Union([Type.Literal("vc"), Type.Literal("live"), Type.Literal("default")], {
|
|
69
|
+
description: "\u7B2C\u4E09\u65B9\u89C6\u9891\u4F1A\u8BAE icon \u7C7B\u578B\uFF08\u4EC5 vc_type=third_party \u65F6\u6709\u6548\uFF09\u3002"
|
|
70
|
+
})
|
|
71
|
+
),
|
|
72
|
+
description: Type.Optional(
|
|
73
|
+
Type.String({
|
|
74
|
+
description: "\u7B2C\u4E09\u65B9\u89C6\u9891\u4F1A\u8BAE\u6587\u6848\uFF08\u4EC5 vc_type=third_party \u65F6\u6709\u6548\uFF09\u3002"
|
|
75
|
+
})
|
|
76
|
+
),
|
|
77
|
+
meeting_url: Type.Optional(
|
|
78
|
+
Type.String({
|
|
79
|
+
description: "\u7B2C\u4E09\u65B9\u89C6\u9891\u4F1A\u8BAE\u94FE\u63A5\uFF08\u4EC5 vc_type=third_party \u65F6\u6709\u6548\uFF09\u3002"
|
|
80
|
+
})
|
|
81
|
+
)
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
description: "\u89C6\u9891\u4F1A\u8BAE\u4FE1\u606F\u3002\u4E0D\u4F20\u5219\u9ED8\u8BA4\u5728\u9996\u6B21\u6DFB\u52A0\u53C2\u4E0E\u4EBA\u65F6\u81EA\u52A8\u751F\u6210\u98DE\u4E66\u89C6\u9891\u4F1A\u8BAE\u3002"
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
),
|
|
88
|
+
visibility: Type.Optional(
|
|
89
|
+
Type.Union([Type.Literal("default"), Type.Literal("public"), Type.Literal("private")], {
|
|
90
|
+
description: "\u65E5\u7A0B\u516C\u5F00\u8303\u56F4\u3002default\uFF08\u9ED8\u8BA4\uFF0C\u8DDF\u968F\u65E5\u5386\u6743\u9650\uFF09\u3001public\uFF08\u516C\u5F00\u8BE6\u60C5\uFF09\u3001private\uFF08\u79C1\u5BC6\uFF0C\u4EC5\u81EA\u5DF1\u53EF\u89C1\uFF09\u3002\u9ED8\u8BA4\u503C\uFF1Adefault\u3002"
|
|
91
|
+
})
|
|
92
|
+
),
|
|
93
|
+
attendee_ability: Type.Optional(
|
|
94
|
+
Type.Union(
|
|
95
|
+
[
|
|
96
|
+
Type.Literal("none"),
|
|
97
|
+
Type.Literal("can_see_others"),
|
|
98
|
+
Type.Literal("can_invite_others"),
|
|
99
|
+
Type.Literal("can_modify_event")
|
|
100
|
+
],
|
|
101
|
+
{
|
|
102
|
+
description: "\u53C2\u4E0E\u4EBA\u6743\u9650\u3002none\uFF08\u65E0\u6CD5\u7F16\u8F91\u3001\u9080\u8BF7\u3001\u67E5\u770B\uFF09\u3001can_see_others\uFF08\u53EF\u67E5\u770B\u53C2\u4E0E\u4EBA\u5217\u8868\uFF09\u3001can_invite_others\uFF08\u53EF\u9080\u8BF7\u5176\u4ED6\u4EBA\uFF09\u3001can_modify_event\uFF08\u53EF\u7F16\u8F91\u65E5\u7A0B\uFF09\u3002\u9ED8\u8BA4\u503C\uFF1Anone\u3002"
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
),
|
|
106
|
+
free_busy_status: Type.Optional(
|
|
107
|
+
Type.Union([Type.Literal("busy"), Type.Literal("free")], {
|
|
108
|
+
description: "\u65E5\u7A0B\u5360\u7528\u7684\u5FD9\u95F2\u72B6\u6001\u3002busy\uFF08\u5FD9\u788C\uFF09\u3001free\uFF08\u7A7A\u95F2\uFF09\u3002\u9ED8\u8BA4\u503C\uFF1Abusy\u3002"
|
|
109
|
+
})
|
|
110
|
+
),
|
|
111
|
+
location: Type.Optional(
|
|
112
|
+
Type.Object(
|
|
113
|
+
{
|
|
114
|
+
name: Type.Optional(
|
|
115
|
+
Type.String({
|
|
116
|
+
description: "\u5730\u70B9\u540D\u79F0"
|
|
117
|
+
})
|
|
118
|
+
),
|
|
119
|
+
address: Type.Optional(
|
|
120
|
+
Type.String({
|
|
121
|
+
description: "\u5730\u70B9\u5730\u5740"
|
|
122
|
+
})
|
|
123
|
+
),
|
|
124
|
+
latitude: Type.Optional(
|
|
125
|
+
Type.Number({
|
|
126
|
+
description: "\u5730\u70B9\u5750\u6807\u7EAC\u5EA6\uFF08\u56FD\u5185\u91C7\u7528 GCJ-02 \u6807\u51C6\uFF0C\u6D77\u5916\u91C7\u7528 WGS84 \u6807\u51C6\uFF09"
|
|
127
|
+
})
|
|
128
|
+
),
|
|
129
|
+
longitude: Type.Optional(
|
|
130
|
+
Type.Number({
|
|
131
|
+
description: "\u5730\u70B9\u5750\u6807\u7ECF\u5EA6\uFF08\u56FD\u5185\u91C7\u7528 GCJ-02 \u6807\u51C6\uFF0C\u6D77\u5916\u91C7\u7528 WGS84 \u6807\u51C6\uFF09"
|
|
132
|
+
})
|
|
133
|
+
)
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
description: "\u65E5\u7A0B\u5730\u70B9\u4FE1\u606F"
|
|
137
|
+
}
|
|
138
|
+
)
|
|
139
|
+
),
|
|
140
|
+
reminders: Type.Optional(
|
|
141
|
+
Type.Array(
|
|
142
|
+
Type.Object({
|
|
143
|
+
minutes: Type.Number({
|
|
144
|
+
description: "\u65E5\u7A0B\u63D0\u9192\u65F6\u95F4\u7684\u504F\u79FB\u91CF\uFF08\u5206\u949F\uFF09\u3002\u6B63\u6570\u8868\u793A\u5728\u65E5\u7A0B\u5F00\u59CB\u524D\u63D0\u9192\uFF0C\u8D1F\u6570\u8868\u793A\u5728\u65E5\u7A0B\u5F00\u59CB\u540E\u63D0\u9192\u3002\u8303\u56F4\uFF1A-20160 ~ 20160\u3002"
|
|
145
|
+
})
|
|
146
|
+
}),
|
|
147
|
+
{
|
|
148
|
+
description: "\u65E5\u7A0B\u63D0\u9192\u5217\u8868"
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
),
|
|
152
|
+
recurrence: Type.Optional(
|
|
153
|
+
Type.String({
|
|
154
|
+
description: "\u91CD\u590D\u65E5\u7A0B\u7684\u91CD\u590D\u6027\u89C4\u5219\uFF08RFC5545 RRULE \u683C\u5F0F\uFF09\u3002\u4F8B\u5982\uFF1A'FREQ=DAILY;INTERVAL=1' \u8868\u793A\u6BCF\u5929\u91CD\u590D\u3002"
|
|
155
|
+
})
|
|
156
|
+
)
|
|
157
|
+
}),
|
|
158
|
+
// LIST (使用 instance_view 接口)
|
|
159
|
+
Type.Object({
|
|
160
|
+
action: Type.Literal("list"),
|
|
161
|
+
start_time: Type.String({
|
|
162
|
+
description: "\u5F00\u59CB\u65F6\u95F4\u3002ISO 8601 / RFC 3339 \u683C\u5F0F\uFF08\u5305\u542B\u65F6\u533A\uFF09\uFF0C\u4F8B\u5982 '2024-01-01T00:00:00+08:00'\u3002\u6CE8\u610F\uFF1Astart_time \u4E0E end_time \u4E4B\u95F4\u7684\u65F6\u95F4\u533A\u95F4\u9700\u8981\u5C0F\u4E8E 40 \u5929\u3002"
|
|
163
|
+
}),
|
|
164
|
+
end_time: Type.String({
|
|
165
|
+
description: "\u7ED3\u675F\u65F6\u95F4\u3002\u683C\u5F0F\u540C start_time\u3002\u6CE8\u610F\uFF1Astart_time \u4E0E end_time \u4E4B\u95F4\u7684\u65F6\u95F4\u533A\u95F4\u9700\u8981\u5C0F\u4E8E 40 \u5929\u3002"
|
|
166
|
+
}),
|
|
167
|
+
calendar_id: Type.Optional(
|
|
168
|
+
Type.String({
|
|
169
|
+
description: "Calendar ID (optional; primary calendar used if omitted)"
|
|
170
|
+
})
|
|
171
|
+
)
|
|
172
|
+
}),
|
|
173
|
+
// GET
|
|
174
|
+
Type.Object({
|
|
175
|
+
action: Type.Literal("get"),
|
|
176
|
+
event_id: Type.String({
|
|
177
|
+
description: "Event ID"
|
|
178
|
+
}),
|
|
179
|
+
calendar_id: Type.Optional(
|
|
180
|
+
Type.String({
|
|
181
|
+
description: "Calendar ID (optional; primary calendar used if omitted)"
|
|
182
|
+
})
|
|
183
|
+
)
|
|
184
|
+
}),
|
|
185
|
+
// PATCH (P1)
|
|
186
|
+
Type.Object({
|
|
187
|
+
action: Type.Literal("patch"),
|
|
188
|
+
event_id: Type.String({
|
|
189
|
+
description: "Event ID"
|
|
190
|
+
}),
|
|
191
|
+
calendar_id: Type.Optional(
|
|
192
|
+
Type.String({
|
|
193
|
+
description: "Calendar ID (optional; primary calendar used if omitted)"
|
|
194
|
+
})
|
|
195
|
+
),
|
|
196
|
+
summary: Type.Optional(
|
|
197
|
+
Type.String({
|
|
198
|
+
description: "\u65B0\u7684\u65E5\u7A0B\u6807\u9898"
|
|
199
|
+
})
|
|
200
|
+
),
|
|
201
|
+
description: Type.Optional(
|
|
202
|
+
Type.String({
|
|
203
|
+
description: "\u65B0\u7684\u65E5\u7A0B\u63CF\u8FF0"
|
|
204
|
+
})
|
|
205
|
+
),
|
|
206
|
+
start_time: Type.Optional(
|
|
207
|
+
Type.String({
|
|
208
|
+
description: "\u65B0\u7684\u5F00\u59CB\u65F6\u95F4\uFF08ISO 8601 / RFC 3339 \u683C\u5F0F\uFF08\u5305\u542B\u65F6\u533A\uFF09\uFF0C\u4F8B\u5982 '2024-01-01T00:00:00+08:00'\uFF09"
|
|
209
|
+
})
|
|
210
|
+
),
|
|
211
|
+
end_time: Type.Optional(
|
|
212
|
+
Type.String({
|
|
213
|
+
description: "\u65B0\u7684\u7ED3\u675F\u65F6\u95F4\uFF08ISO 8601 / RFC 3339 \u683C\u5F0F\uFF08\u5305\u542B\u65F6\u533A\uFF09\uFF0C\u4F8B\u5982 '2024-01-01T00:00:00+08:00'\uFF09"
|
|
214
|
+
})
|
|
215
|
+
),
|
|
216
|
+
location: Type.Optional(
|
|
217
|
+
Type.String({
|
|
218
|
+
description: "\u65B0\u7684\u5730\u70B9"
|
|
219
|
+
})
|
|
220
|
+
)
|
|
221
|
+
}),
|
|
222
|
+
// DELETE (P1)
|
|
223
|
+
Type.Object({
|
|
224
|
+
action: Type.Literal("delete"),
|
|
225
|
+
event_id: Type.String({
|
|
226
|
+
description: "Event ID"
|
|
227
|
+
}),
|
|
228
|
+
calendar_id: Type.Optional(
|
|
229
|
+
Type.String({
|
|
230
|
+
description: "Calendar ID (optional; primary calendar used if omitted)"
|
|
231
|
+
})
|
|
232
|
+
),
|
|
233
|
+
need_notification: Type.Optional(
|
|
234
|
+
Type.Boolean({
|
|
235
|
+
description: "\u662F\u5426\u901A\u77E5\u53C2\u4F1A\u4EBA\uFF08\u9ED8\u8BA4 true\uFF09"
|
|
236
|
+
})
|
|
237
|
+
)
|
|
238
|
+
}),
|
|
239
|
+
// SEARCH (P1)
|
|
240
|
+
Type.Object({
|
|
241
|
+
action: Type.Literal("search"),
|
|
242
|
+
query: Type.String({
|
|
243
|
+
description: "\u641C\u7D22\u5173\u952E\u8BCD"
|
|
244
|
+
}),
|
|
245
|
+
calendar_id: Type.Optional(
|
|
246
|
+
Type.String({
|
|
247
|
+
description: "Calendar ID (optional; primary calendar used if omitted)"
|
|
248
|
+
})
|
|
249
|
+
),
|
|
250
|
+
page_size: Type.Optional(
|
|
251
|
+
Type.Number({
|
|
252
|
+
description: "\u6BCF\u9875\u6570\u91CF"
|
|
253
|
+
})
|
|
254
|
+
),
|
|
255
|
+
page_token: Type.Optional(
|
|
256
|
+
Type.String({
|
|
257
|
+
description: "\u5206\u9875\u6807\u8BB0"
|
|
258
|
+
})
|
|
259
|
+
)
|
|
260
|
+
}),
|
|
261
|
+
// REPLY (P1)
|
|
262
|
+
Type.Object({
|
|
263
|
+
action: Type.Literal("reply"),
|
|
264
|
+
event_id: Type.String({
|
|
265
|
+
description: "Event ID"
|
|
266
|
+
}),
|
|
267
|
+
calendar_id: Type.Optional(
|
|
268
|
+
Type.String({
|
|
269
|
+
description: "Calendar ID (optional; primary calendar used if omitted)"
|
|
270
|
+
})
|
|
271
|
+
),
|
|
272
|
+
rsvp_status: Type.Union([Type.Literal("accept"), Type.Literal("decline"), Type.Literal("tentative")])
|
|
273
|
+
}),
|
|
274
|
+
// INSTANCES (P1)
|
|
275
|
+
Type.Object({
|
|
276
|
+
action: Type.Literal("instances"),
|
|
277
|
+
event_id: Type.String({
|
|
278
|
+
description: "\u91CD\u590D\u65E5\u7A0B\u7684 Event ID"
|
|
279
|
+
}),
|
|
280
|
+
calendar_id: Type.Optional(
|
|
281
|
+
Type.String({
|
|
282
|
+
description: "Calendar ID (optional; primary calendar used if omitted)"
|
|
283
|
+
})
|
|
284
|
+
),
|
|
285
|
+
start_time: Type.String({
|
|
286
|
+
description: "\u67E5\u8BE2\u8D77\u59CB\u65F6\u95F4\uFF08ISO 8601 / RFC 3339 \u683C\u5F0F\uFF08\u5305\u542B\u65F6\u533A\uFF09\uFF0C\u4F8B\u5982 '2024-01-01T00:00:00+08:00'\uFF09"
|
|
287
|
+
}),
|
|
288
|
+
end_time: Type.String({
|
|
289
|
+
description: "\u67E5\u8BE2\u7ED3\u675F\u65F6\u95F4\uFF08ISO 8601 / RFC 3339 \u683C\u5F0F\uFF08\u5305\u542B\u65F6\u533A\uFF09\uFF0C\u4F8B\u5982 '2024-01-01T00:00:00+08:00'\uFF09"
|
|
290
|
+
}),
|
|
291
|
+
page_size: Type.Optional(
|
|
292
|
+
Type.Number({
|
|
293
|
+
description: "\u6BCF\u9875\u6570\u91CF"
|
|
294
|
+
})
|
|
295
|
+
),
|
|
296
|
+
page_token: Type.Optional(
|
|
297
|
+
Type.String({
|
|
298
|
+
description: "\u5206\u9875\u6807\u8BB0"
|
|
299
|
+
})
|
|
300
|
+
)
|
|
301
|
+
}),
|
|
302
|
+
// INSTANCE_VIEW (P1)
|
|
303
|
+
Type.Object({
|
|
304
|
+
action: Type.Literal("instance_view"),
|
|
305
|
+
start_time: Type.String({
|
|
306
|
+
description: "\u67E5\u8BE2\u8D77\u59CB\u65F6\u95F4\uFF08ISO 8601 / RFC 3339 \u683C\u5F0F\uFF08\u5305\u542B\u65F6\u533A\uFF09\uFF0C\u4F8B\u5982 '2024-01-01T00:00:00+08:00'\uFF09"
|
|
307
|
+
}),
|
|
308
|
+
end_time: Type.String({
|
|
309
|
+
description: "\u67E5\u8BE2\u7ED3\u675F\u65F6\u95F4\uFF08ISO 8601 / RFC 3339 \u683C\u5F0F\uFF08\u5305\u542B\u65F6\u533A\uFF09\uFF0C\u4F8B\u5982 '2024-01-01T00:00:00+08:00'\uFF09"
|
|
310
|
+
}),
|
|
311
|
+
calendar_id: Type.Optional(
|
|
312
|
+
Type.String({
|
|
313
|
+
description: "Calendar ID (optional; primary calendar used if omitted)"
|
|
314
|
+
})
|
|
315
|
+
),
|
|
316
|
+
page_size: Type.Optional(
|
|
317
|
+
Type.Number({
|
|
318
|
+
description: "\u6BCF\u9875\u6570\u91CF"
|
|
319
|
+
})
|
|
320
|
+
),
|
|
321
|
+
page_token: Type.Optional(
|
|
322
|
+
Type.String({
|
|
323
|
+
description: "\u5206\u9875\u6807\u8BB0"
|
|
324
|
+
})
|
|
325
|
+
)
|
|
326
|
+
})
|
|
327
|
+
]);
|
|
328
|
+
function normalizeCalendarTimeValue(value) {
|
|
329
|
+
if (value === null || value === void 0) return void 0;
|
|
330
|
+
if (typeof value === "string") {
|
|
331
|
+
const iso = unixTimestampToISO8601(value);
|
|
332
|
+
return iso ?? value;
|
|
333
|
+
}
|
|
334
|
+
if (typeof value !== "object") return void 0;
|
|
335
|
+
const timeObj = value;
|
|
336
|
+
const fromTimestamp = unixTimestampToISO8601(timeObj.timestamp);
|
|
337
|
+
if (fromTimestamp) return fromTimestamp;
|
|
338
|
+
if (typeof timeObj.date === "string") return timeObj.date;
|
|
339
|
+
return void 0;
|
|
340
|
+
}
|
|
341
|
+
function normalizeEventTimeFields(event) {
|
|
342
|
+
if (!event) return event;
|
|
343
|
+
const normalized = { ...event };
|
|
344
|
+
const startTime = normalizeCalendarTimeValue(event.start_time);
|
|
345
|
+
if (startTime) {
|
|
346
|
+
normalized.start_time = startTime;
|
|
347
|
+
}
|
|
348
|
+
const endTime = normalizeCalendarTimeValue(event.end_time);
|
|
349
|
+
if (endTime) {
|
|
350
|
+
normalized.end_time = endTime;
|
|
351
|
+
}
|
|
352
|
+
const createTime = unixTimestampToISO8601(event.create_time);
|
|
353
|
+
if (createTime) {
|
|
354
|
+
normalized.create_time = createTime;
|
|
355
|
+
}
|
|
356
|
+
return normalized;
|
|
357
|
+
}
|
|
358
|
+
function normalizeEventListTimeFields(events) {
|
|
359
|
+
if (!events) return events;
|
|
360
|
+
return events.map((item) => normalizeEventTimeFields(item));
|
|
361
|
+
}
|
|
362
|
+
function registerFeishuCalendarEventTool(api) {
|
|
363
|
+
if (!api.config) return;
|
|
364
|
+
const cfg = api.config;
|
|
365
|
+
const { toolClient, log } = createToolContext(api, "feishu_calendar_event");
|
|
366
|
+
const resolveCalendarId = async (client) => {
|
|
367
|
+
const primaryRes = await client.invoke(
|
|
368
|
+
"feishu_calendar_calendar.primary",
|
|
369
|
+
(sdk, opts) => sdk.calendar.calendar.primary({}, opts),
|
|
370
|
+
{ as: "user" }
|
|
371
|
+
);
|
|
372
|
+
const data = primaryRes.data;
|
|
373
|
+
const cid = data?.calendars?.[0]?.calendar?.calendar_id;
|
|
374
|
+
if (cid) {
|
|
375
|
+
log.info(`resolveCalendarId: primary() returned calendar_id=${cid}`);
|
|
376
|
+
return cid;
|
|
377
|
+
}
|
|
378
|
+
return null;
|
|
379
|
+
};
|
|
380
|
+
const resolveCalendarIdOrFail = async (calendarId, client) => {
|
|
381
|
+
if (calendarId) return calendarId;
|
|
382
|
+
const resolved = await resolveCalendarId(client);
|
|
383
|
+
if (!resolved) throw new Error("Could not determine primary calendar");
|
|
384
|
+
return resolved;
|
|
385
|
+
};
|
|
386
|
+
api.registerTool(
|
|
387
|
+
{
|
|
388
|
+
name: "feishu_calendar_event",
|
|
389
|
+
label: "Feishu Calendar Events",
|
|
390
|
+
description: "\u3010\u4EE5\u7528\u6237\u8EAB\u4EFD\u3011\u98DE\u4E66\u65E5\u7A0B\u7BA1\u7406\u5DE5\u5177\u3002\u5F53\u7528\u6237\u8981\u6C42\u67E5\u770B\u65E5\u7A0B\u3001\u521B\u5EFA\u4F1A\u8BAE\u3001\u7EA6\u4F1A\u8BAE\u3001\u4FEE\u6539\u65E5\u7A0B\u3001\u5220\u9664\u65E5\u7A0B\u3001\u641C\u7D22\u65E5\u7A0B\u3001\u56DE\u590D\u65E5\u7A0B\u9080\u8BF7\u65F6\u4F7F\u7528\u3002Actions: create\uFF08\u521B\u5EFA\u65E5\u5386\u4E8B\u4EF6\uFF09, list\uFF08\u67E5\u8BE2\u65F6\u95F4\u8303\u56F4\u5185\u7684\u65E5\u7A0B\uFF0C\u81EA\u52A8\u5C55\u5F00\u91CD\u590D\u65E5\u7A0B\uFF09, get\uFF08\u83B7\u53D6\u65E5\u7A0B\u8BE6\u60C5\uFF09, patch\uFF08\u66F4\u65B0\u65E5\u7A0B\uFF09, delete\uFF08\u5220\u9664\u65E5\u7A0B\uFF09, search\uFF08\u641C\u7D22\u65E5\u7A0B\uFF09, reply\uFF08\u56DE\u590D\u65E5\u7A0B\u9080\u8BF7\uFF09, instances\uFF08\u83B7\u53D6\u91CD\u590D\u65E5\u7A0B\u7684\u5B9E\u4F8B\u5217\u8868\uFF0C\u4EC5\u5BF9\u91CD\u590D\u65E5\u7A0B\u6709\u6548\uFF09, instance_view\uFF08\u67E5\u770B\u5C55\u5F00\u540E\u7684\u65E5\u7A0B\u5217\u8868\uFF09\u3002\u3010\u91CD\u8981\u3011create \u65F6\u5FC5\u987B\u4F20 user_open_id \u53C2\u6570\uFF0C\u503C\u4E3A\u6D88\u606F\u4E0A\u4E0B\u6587\u4E2D\u7684 SenderId\uFF08\u683C\u5F0F ou_xxx\uFF09\uFF0C\u5426\u5219\u65E5\u7A0B\u53EA\u5728\u5E94\u7528\u65E5\u5386\u4E0A\uFF0C\u7528\u6237\u5B8C\u5168\u770B\u4E0D\u5230\u3002list \u64CD\u4F5C\u4F7F\u7528 instance_view \u63A5\u53E3\uFF0C\u4F1A\u81EA\u52A8\u5C55\u5F00\u91CD\u590D\u65E5\u7A0B\u4E3A\u591A\u4E2A\u5B9E\u4F8B\uFF0C\u65F6\u95F4\u533A\u95F4\u4E0D\u80FD\u8D85\u8FC740\u5929\uFF0C\u8FD4\u56DE\u5B9E\u4F8B\u6570\u91CF\u4E0A\u96501000\u3002\u65F6\u95F4\u53C2\u6570\u4F7F\u7528ISO 8601 / RFC 3339 \u683C\u5F0F\uFF08\u5305\u542B\u65F6\u533A\uFF09\uFF0C\u4F8B\u5982 '2024-01-01T00:00:00+08:00'\u3002",
|
|
391
|
+
parameters: FeishuCalendarEventSchema,
|
|
392
|
+
async execute(_toolCallId, params) {
|
|
393
|
+
const p = params;
|
|
394
|
+
try {
|
|
395
|
+
const client = toolClient();
|
|
396
|
+
switch (p.action) {
|
|
397
|
+
// -----------------------------------------------------------------
|
|
398
|
+
// CREATE EVENT
|
|
399
|
+
// -----------------------------------------------------------------
|
|
400
|
+
case "create": {
|
|
401
|
+
if (!p.summary) return json({ error: "summary is required" });
|
|
402
|
+
if (!p.start_time) return json({ error: "start_time is required" });
|
|
403
|
+
if (!p.end_time) return json({ error: "end_time is required" });
|
|
404
|
+
const startTs = parseTimeToTimestamp(p.start_time);
|
|
405
|
+
const endTs = parseTimeToTimestamp(p.end_time);
|
|
406
|
+
if (!startTs || !endTs)
|
|
407
|
+
return json({
|
|
408
|
+
error: "Invalid time format. Must use ISO 8601 / RFC 3339 with timezone, e.g. '2024-01-01T00:00:00+08:00' or '2026-02-25 14:00:00'. Do not pass Unix timestamp numbers.",
|
|
409
|
+
received_start: p.start_time,
|
|
410
|
+
received_end: p.end_time
|
|
411
|
+
});
|
|
412
|
+
log.info(
|
|
413
|
+
`create: summary=${p.summary}, start_time=${p.start_time} -> ts=${startTs}, end_time=${p.end_time} -> ts=${endTs}, user_open_id=${p.user_open_id ?? "MISSING"}, attendees=${JSON.stringify(p.attendees ?? [])}, vchat=${p.vchat?.vc_type ?? "auto"}, location=${p.location?.name ?? "none"}`
|
|
414
|
+
);
|
|
415
|
+
const calendarId = await resolveCalendarIdOrFail(p.calendar_id, client);
|
|
416
|
+
const eventData = {
|
|
417
|
+
summary: p.summary,
|
|
418
|
+
start_time: { timestamp: startTs },
|
|
419
|
+
end_time: { timestamp: endTs },
|
|
420
|
+
need_notification: true,
|
|
421
|
+
attendee_ability: p.attendee_ability ?? "can_modify_event"
|
|
422
|
+
};
|
|
423
|
+
if (p.description) eventData.description = p.description;
|
|
424
|
+
if (p.vchat) {
|
|
425
|
+
eventData.vchat = {};
|
|
426
|
+
if (p.vchat.vc_type) eventData.vchat.vc_type = p.vchat.vc_type;
|
|
427
|
+
if (p.vchat.icon_type) eventData.vchat.icon_type = p.vchat.icon_type;
|
|
428
|
+
if (p.vchat.description) eventData.vchat.description = p.vchat.description;
|
|
429
|
+
if (p.vchat.meeting_url) eventData.vchat.meeting_url = p.vchat.meeting_url;
|
|
430
|
+
}
|
|
431
|
+
if (p.visibility) eventData.visibility = p.visibility;
|
|
432
|
+
if (p.free_busy_status) eventData.free_busy_status = p.free_busy_status;
|
|
433
|
+
if (p.location) {
|
|
434
|
+
eventData.location = {};
|
|
435
|
+
if (p.location.name) eventData.location.name = p.location.name;
|
|
436
|
+
if (p.location.address) eventData.location.address = p.location.address;
|
|
437
|
+
if (p.location.latitude !== void 0) eventData.location.latitude = p.location.latitude;
|
|
438
|
+
if (p.location.longitude !== void 0) eventData.location.longitude = p.location.longitude;
|
|
439
|
+
}
|
|
440
|
+
if (p.reminders) {
|
|
441
|
+
eventData.reminders = p.reminders.map((r) => ({ minutes: r.minutes }));
|
|
442
|
+
}
|
|
443
|
+
if (p.recurrence) eventData.recurrence = p.recurrence;
|
|
444
|
+
const res = await client.invoke(
|
|
445
|
+
"feishu_calendar_event.create",
|
|
446
|
+
(sdk, opts) => sdk.calendar.calendarEvent.create(
|
|
447
|
+
{
|
|
448
|
+
path: { calendar_id: calendarId },
|
|
449
|
+
data: eventData
|
|
450
|
+
},
|
|
451
|
+
opts
|
|
452
|
+
),
|
|
453
|
+
{ as: "user" }
|
|
454
|
+
);
|
|
455
|
+
assertLarkOk(res);
|
|
456
|
+
log.info(`event created: event_id=${res.data?.event?.event_id}`);
|
|
457
|
+
const allAttendees = [...p.attendees ?? []];
|
|
458
|
+
if (p.user_open_id) {
|
|
459
|
+
const alreadyIncluded = allAttendees.some((a) => a.type === "user" && a.id === p.user_open_id);
|
|
460
|
+
if (!alreadyIncluded) {
|
|
461
|
+
allAttendees.push({ type: "user", id: p.user_open_id });
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
log.info(`allAttendees=${JSON.stringify(allAttendees)}`);
|
|
465
|
+
let attendeeError;
|
|
466
|
+
const operateId = p.user_open_id ?? p.attendees?.find((a) => a.type === "user")?.id;
|
|
467
|
+
if (allAttendees.length > 0 && res.data?.event?.event_id) {
|
|
468
|
+
const attendeeData = allAttendees.map((a) => ({
|
|
469
|
+
type: a.type,
|
|
470
|
+
user_id: a.type === "user" ? a.id : void 0,
|
|
471
|
+
chat_id: a.type === "chat" ? a.id : void 0,
|
|
472
|
+
room_id: a.type === "resource" ? a.id : void 0,
|
|
473
|
+
third_party_email: a.type === "third_party" ? a.id : void 0,
|
|
474
|
+
operate_id: operateId
|
|
475
|
+
}));
|
|
476
|
+
try {
|
|
477
|
+
const attendeeRes = await client.invoke(
|
|
478
|
+
"feishu_calendar_event.create",
|
|
479
|
+
(sdk, opts) => sdk.calendar.calendarEventAttendee.create(
|
|
480
|
+
{
|
|
481
|
+
path: {
|
|
482
|
+
calendar_id: calendarId,
|
|
483
|
+
event_id: res.data?.event?.event_id
|
|
484
|
+
},
|
|
485
|
+
params: { user_id_type: "open_id" },
|
|
486
|
+
data: {
|
|
487
|
+
attendees: attendeeData,
|
|
488
|
+
need_notification: true
|
|
489
|
+
}
|
|
490
|
+
},
|
|
491
|
+
opts
|
|
492
|
+
),
|
|
493
|
+
{ as: "user" }
|
|
494
|
+
);
|
|
495
|
+
assertLarkOk(attendeeRes);
|
|
496
|
+
log.info(`attendee API response: ${JSON.stringify(attendeeRes.data)}`);
|
|
497
|
+
} catch (attendeeErr) {
|
|
498
|
+
attendeeError = formatLarkError(attendeeErr);
|
|
499
|
+
log.info(`attendee add FAILED: ${attendeeError}`);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
const appLink = res.data?.event?.app_link;
|
|
503
|
+
const safeEvent = res.data?.event ? {
|
|
504
|
+
event_id: res.data.event.event_id,
|
|
505
|
+
summary: res.data.event.summary,
|
|
506
|
+
app_link: appLink,
|
|
507
|
+
start_time: unixTimestampToISO8601(startTs) ?? p.start_time,
|
|
508
|
+
end_time: unixTimestampToISO8601(endTs) ?? p.end_time
|
|
509
|
+
} : void 0;
|
|
510
|
+
const result = {
|
|
511
|
+
event: safeEvent,
|
|
512
|
+
attendees: allAttendees.map((a) => ({
|
|
513
|
+
type: a.type,
|
|
514
|
+
id: a.id
|
|
515
|
+
})),
|
|
516
|
+
_debug: {
|
|
517
|
+
calendar_id: calendarId,
|
|
518
|
+
operate_id: operateId,
|
|
519
|
+
start_input: p.start_time,
|
|
520
|
+
start_iso8601: unixTimestampToISO8601(startTs) ?? p.start_time,
|
|
521
|
+
end_input: p.end_time,
|
|
522
|
+
end_iso8601: unixTimestampToISO8601(endTs) ?? p.end_time,
|
|
523
|
+
attendees_count: allAttendees.length
|
|
524
|
+
}
|
|
525
|
+
};
|
|
526
|
+
if (attendeeError) {
|
|
527
|
+
result.warning = `\u65E5\u7A0B\u5DF2\u521B\u5EFA\uFF0C\u4F46\u6DFB\u52A0\u53C2\u4F1A\u4EBA\u5931\u8D25\uFF1A${attendeeError}`;
|
|
528
|
+
} else if (allAttendees.length === 0) {
|
|
529
|
+
result.error = "\u65E5\u7A0B\u5DF2\u521B\u5EFA\u5728\u5E94\u7528\u65E5\u5386\u4E0A\uFF0C\u4F46\u672A\u6DFB\u52A0\u4EFB\u4F55\u53C2\u4F1A\u4EBA\uFF0C\u7528\u6237\u770B\u4E0D\u5230\u6B64\u65E5\u7A0B\u3002\u8BF7\u91CD\u65B0\u8C03\u7528\u65F6\u4F20\u5165 user_open_id \u53C2\u6570\u3002";
|
|
530
|
+
} else {
|
|
531
|
+
result.note = `\u5DF2\u6210\u529F\u6DFB\u52A0 ${allAttendees.length} \u4F4D\u53C2\u4F1A\u4EBA\uFF0C\u65E5\u7A0B\u5E94\u51FA\u73B0\u5728\u53C2\u4F1A\u4EBA\u7684\u98DE\u4E66\u65E5\u5386\u4E2D\u3002`;
|
|
532
|
+
}
|
|
533
|
+
return json(result);
|
|
534
|
+
}
|
|
535
|
+
// -----------------------------------------------------------------
|
|
536
|
+
// LIST EVENTS (使用 instance_view 接口,自动展开重复日程)
|
|
537
|
+
// -----------------------------------------------------------------
|
|
538
|
+
case "list": {
|
|
539
|
+
if (!p.start_time) return json({ error: "start_time is required" });
|
|
540
|
+
if (!p.end_time) return json({ error: "end_time is required" });
|
|
541
|
+
const startTs = parseTimeToTimestamp(p.start_time);
|
|
542
|
+
const endTs = parseTimeToTimestamp(p.end_time);
|
|
543
|
+
if (!startTs || !endTs)
|
|
544
|
+
return json({
|
|
545
|
+
error: "Invalid time format. Must use ISO 8601 / RFC 3339 with timezone, e.g. '2024-01-01T00:00:00+08:00' or '2026-02-25 14:00:00'. Do not pass Unix timestamps.",
|
|
546
|
+
received_start: p.start_time,
|
|
547
|
+
received_end: p.end_time
|
|
548
|
+
});
|
|
549
|
+
const calendarId = await resolveCalendarIdOrFail(p.calendar_id, client);
|
|
550
|
+
log.info(
|
|
551
|
+
`list: calendar_id=${calendarId}, start_time=${startTs}, end_time=${endTs} (using instance_view)`
|
|
552
|
+
);
|
|
553
|
+
const res = await client.invoke(
|
|
554
|
+
"feishu_calendar_event.instance_view",
|
|
555
|
+
(sdk, opts) => sdk.calendar.calendarEvent.instanceView(
|
|
556
|
+
{
|
|
557
|
+
path: { calendar_id: calendarId },
|
|
558
|
+
params: {
|
|
559
|
+
start_time: startTs,
|
|
560
|
+
end_time: endTs,
|
|
561
|
+
user_id_type: "open_id"
|
|
562
|
+
}
|
|
563
|
+
},
|
|
564
|
+
opts
|
|
565
|
+
),
|
|
566
|
+
{ as: "user" }
|
|
567
|
+
);
|
|
568
|
+
assertLarkOk(res);
|
|
569
|
+
const data = res.data;
|
|
570
|
+
log.info(`list: returned ${data?.items?.length ?? 0} event instances`);
|
|
571
|
+
return json({
|
|
572
|
+
events: normalizeEventListTimeFields(data?.items),
|
|
573
|
+
has_more: data?.has_more ?? false,
|
|
574
|
+
page_token: data?.page_token
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
// -----------------------------------------------------------------
|
|
578
|
+
// GET EVENT
|
|
579
|
+
// -----------------------------------------------------------------
|
|
580
|
+
case "get": {
|
|
581
|
+
if (!p.event_id) return json({ error: "event_id is required" });
|
|
582
|
+
const calendarId = await resolveCalendarIdOrFail(p.calendar_id, client);
|
|
583
|
+
log.info(`get: calendar_id=${calendarId}, event_id=${p.event_id}`);
|
|
584
|
+
const res = await client.invoke(
|
|
585
|
+
"feishu_calendar_event.get",
|
|
586
|
+
(sdk, opts) => sdk.calendar.calendarEvent.get(
|
|
587
|
+
{
|
|
588
|
+
path: { calendar_id: calendarId, event_id: p.event_id }
|
|
589
|
+
},
|
|
590
|
+
opts
|
|
591
|
+
),
|
|
592
|
+
{ as: "user" }
|
|
593
|
+
);
|
|
594
|
+
assertLarkOk(res);
|
|
595
|
+
log.info(`get: retrieved event ${p.event_id}`);
|
|
596
|
+
return json({
|
|
597
|
+
event: normalizeEventTimeFields(res.data?.event)
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
// -----------------------------------------------------------------
|
|
601
|
+
// PATCH EVENT (P1)
|
|
602
|
+
// -----------------------------------------------------------------
|
|
603
|
+
case "patch": {
|
|
604
|
+
if (!p.event_id) return json({ error: "event_id is required" });
|
|
605
|
+
const calendarId = await resolveCalendarIdOrFail(p.calendar_id, client);
|
|
606
|
+
const updateData = {};
|
|
607
|
+
if (p.start_time) {
|
|
608
|
+
const startTs = parseTimeToTimestamp(p.start_time);
|
|
609
|
+
if (!startTs)
|
|
610
|
+
return json({
|
|
611
|
+
error: "start_time \u683C\u5F0F\u9519\u8BEF\uFF01\u5FC5\u987B\u4F7F\u7528ISO 8601 / RFC 3339 \u683C\u5F0F\uFF08\u5305\u542B\u65F6\u533A\uFF09\uFF0C\u4F8B\u5982 '2024-01-01T00:00:00+08:00'",
|
|
612
|
+
received: p.start_time
|
|
613
|
+
});
|
|
614
|
+
updateData.start_time = { timestamp: startTs };
|
|
615
|
+
}
|
|
616
|
+
if (p.end_time) {
|
|
617
|
+
const endTs = parseTimeToTimestamp(p.end_time);
|
|
618
|
+
if (!endTs)
|
|
619
|
+
return json({
|
|
620
|
+
error: "end_time \u683C\u5F0F\u9519\u8BEF\uFF01\u5FC5\u987B\u4F7F\u7528ISO 8601 / RFC 3339 \u683C\u5F0F\uFF08\u5305\u542B\u65F6\u533A\uFF09\uFF0C\u4F8B\u5982 '2024-01-01T00:00:00+08:00'",
|
|
621
|
+
received: p.end_time
|
|
622
|
+
});
|
|
623
|
+
updateData.end_time = { timestamp: endTs };
|
|
624
|
+
}
|
|
625
|
+
if (p.summary) updateData.summary = p.summary;
|
|
626
|
+
if (p.description) updateData.description = p.description;
|
|
627
|
+
if (p.location) updateData.location = { name: p.location };
|
|
628
|
+
log.info(
|
|
629
|
+
`patch: calendar_id=${calendarId}, event_id=${p.event_id}, fields=${Object.keys(updateData).join(",")}`
|
|
630
|
+
);
|
|
631
|
+
const res = await client.invoke(
|
|
632
|
+
"feishu_calendar_event.patch",
|
|
633
|
+
(sdk, opts) => sdk.calendar.calendarEvent.patch(
|
|
634
|
+
{
|
|
635
|
+
path: { calendar_id: calendarId, event_id: p.event_id },
|
|
636
|
+
data: updateData
|
|
637
|
+
},
|
|
638
|
+
opts
|
|
639
|
+
),
|
|
640
|
+
{ as: "user" }
|
|
641
|
+
);
|
|
642
|
+
assertLarkOk(res);
|
|
643
|
+
log.info(`patch: updated event ${p.event_id}`);
|
|
644
|
+
return json({
|
|
645
|
+
event: normalizeEventTimeFields(res.data?.event)
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
// -----------------------------------------------------------------
|
|
649
|
+
// DELETE EVENT (P1)
|
|
650
|
+
// -----------------------------------------------------------------
|
|
651
|
+
case "delete": {
|
|
652
|
+
if (!p.event_id) return json({ error: "event_id is required" });
|
|
653
|
+
const calendarId = await resolveCalendarIdOrFail(p.calendar_id, client);
|
|
654
|
+
log.info(
|
|
655
|
+
`delete: calendar_id=${calendarId}, event_id=${p.event_id}, notify=${p.need_notification ?? true}`
|
|
656
|
+
);
|
|
657
|
+
const res = await client.invoke(
|
|
658
|
+
"feishu_calendar_event.delete",
|
|
659
|
+
(sdk, opts) => sdk.calendar.calendarEvent.delete(
|
|
660
|
+
{
|
|
661
|
+
path: { calendar_id: calendarId, event_id: p.event_id },
|
|
662
|
+
params: {
|
|
663
|
+
need_notification: p.need_notification ?? true
|
|
664
|
+
}
|
|
665
|
+
},
|
|
666
|
+
opts
|
|
667
|
+
),
|
|
668
|
+
{ as: "user" }
|
|
669
|
+
);
|
|
670
|
+
assertLarkOk(res);
|
|
671
|
+
log.info(`delete: deleted event ${p.event_id}`);
|
|
672
|
+
return json({
|
|
673
|
+
success: true,
|
|
674
|
+
event_id: p.event_id
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
// -----------------------------------------------------------------
|
|
678
|
+
// SEARCH EVENT (P1)
|
|
679
|
+
// -----------------------------------------------------------------
|
|
680
|
+
case "search": {
|
|
681
|
+
if (!p.query) return json({ error: "query is required" });
|
|
682
|
+
const calendarId = await resolveCalendarIdOrFail(p.calendar_id, client);
|
|
683
|
+
log.info(`search: calendar_id=${calendarId}, query=${p.query}, page_size=${p.page_size ?? 50}`);
|
|
684
|
+
const res = await client.invoke(
|
|
685
|
+
"feishu_calendar_event.search",
|
|
686
|
+
(sdk, opts) => sdk.calendar.calendarEvent.search(
|
|
687
|
+
{
|
|
688
|
+
path: { calendar_id: calendarId },
|
|
689
|
+
params: {
|
|
690
|
+
page_size: p.page_size,
|
|
691
|
+
page_token: p.page_token
|
|
692
|
+
},
|
|
693
|
+
data: {
|
|
694
|
+
query: p.query
|
|
695
|
+
}
|
|
696
|
+
},
|
|
697
|
+
opts
|
|
698
|
+
),
|
|
699
|
+
{ as: "user" }
|
|
700
|
+
);
|
|
701
|
+
assertLarkOk(res);
|
|
702
|
+
const data = res.data;
|
|
703
|
+
log.info(`search: found ${data?.items?.length ?? 0} events`);
|
|
704
|
+
return json({
|
|
705
|
+
events: normalizeEventListTimeFields(data?.items),
|
|
706
|
+
has_more: data?.has_more ?? false,
|
|
707
|
+
page_token: data?.page_token
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
// -----------------------------------------------------------------
|
|
711
|
+
// REPLY EVENT (P1)
|
|
712
|
+
// -----------------------------------------------------------------
|
|
713
|
+
case "reply": {
|
|
714
|
+
if (!p.event_id) return json({ error: "event_id is required" });
|
|
715
|
+
if (!p.rsvp_status) return json({ error: "rsvp_status is required" });
|
|
716
|
+
const calendarId = await resolveCalendarIdOrFail(p.calendar_id, client);
|
|
717
|
+
log.info(`reply: calendar_id=${calendarId}, event_id=${p.event_id}, rsvp=${p.rsvp_status}`);
|
|
718
|
+
const res = await client.invoke(
|
|
719
|
+
"feishu_calendar_event.reply",
|
|
720
|
+
(sdk, opts) => sdk.calendar.calendarEvent.reply(
|
|
721
|
+
{
|
|
722
|
+
path: { calendar_id: calendarId, event_id: p.event_id },
|
|
723
|
+
data: {
|
|
724
|
+
rsvp_status: p.rsvp_status
|
|
725
|
+
}
|
|
726
|
+
},
|
|
727
|
+
opts
|
|
728
|
+
),
|
|
729
|
+
{ as: "user" }
|
|
730
|
+
);
|
|
731
|
+
assertLarkOk(res);
|
|
732
|
+
log.info(`reply: replied to event ${p.event_id} with ${p.rsvp_status}`);
|
|
733
|
+
return json({
|
|
734
|
+
success: true,
|
|
735
|
+
event_id: p.event_id,
|
|
736
|
+
rsvp_status: p.rsvp_status
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
// -----------------------------------------------------------------
|
|
740
|
+
// INSTANCES (P1)
|
|
741
|
+
// -----------------------------------------------------------------
|
|
742
|
+
case "instances": {
|
|
743
|
+
if (!p.event_id) return json({ error: "event_id is required" });
|
|
744
|
+
if (!p.start_time) return json({ error: "start_time is required" });
|
|
745
|
+
if (!p.end_time) return json({ error: "end_time is required" });
|
|
746
|
+
const calendarId = await resolveCalendarIdOrFail(p.calendar_id, client);
|
|
747
|
+
const startTs = parseTimeToTimestamp(p.start_time);
|
|
748
|
+
const endTs = parseTimeToTimestamp(p.end_time);
|
|
749
|
+
if (!startTs || !endTs)
|
|
750
|
+
return json({
|
|
751
|
+
error: "Invalid time format. Must use ISO 8601 / RFC 3339 with timezone, e.g. '2024-01-01T00:00:00+08:00'",
|
|
752
|
+
received_start: p.start_time,
|
|
753
|
+
received_end: p.end_time
|
|
754
|
+
});
|
|
755
|
+
log.info(`instances: calendar_id=${calendarId}, event_id=${p.event_id}, start=${startTs}, end=${endTs}`);
|
|
756
|
+
const res = await client.invoke(
|
|
757
|
+
"feishu_calendar_event.instances",
|
|
758
|
+
(sdk, opts) => sdk.calendar.calendarEvent.instances(
|
|
759
|
+
{
|
|
760
|
+
path: { calendar_id: calendarId, event_id: p.event_id },
|
|
761
|
+
params: {
|
|
762
|
+
start_time: startTs,
|
|
763
|
+
end_time: endTs,
|
|
764
|
+
page_size: p.page_size,
|
|
765
|
+
page_token: p.page_token
|
|
766
|
+
}
|
|
767
|
+
},
|
|
768
|
+
opts
|
|
769
|
+
),
|
|
770
|
+
{ as: "user" }
|
|
771
|
+
);
|
|
772
|
+
assertLarkOk(res);
|
|
773
|
+
const data = res.data;
|
|
774
|
+
log.info(`instances: returned ${data?.items?.length ?? 0} instances`);
|
|
775
|
+
return json({
|
|
776
|
+
instances: normalizeEventListTimeFields(data?.items),
|
|
777
|
+
has_more: data?.has_more ?? false,
|
|
778
|
+
page_token: data?.page_token
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
// -----------------------------------------------------------------
|
|
782
|
+
// INSTANCE_VIEW (P1)
|
|
783
|
+
// -----------------------------------------------------------------
|
|
784
|
+
case "instance_view": {
|
|
785
|
+
if (!p.start_time) return json({ error: "start_time is required" });
|
|
786
|
+
if (!p.end_time) return json({ error: "end_time is required" });
|
|
787
|
+
const calendarId = await resolveCalendarIdOrFail(p.calendar_id, client);
|
|
788
|
+
const startTs = parseTimeToTimestamp(p.start_time);
|
|
789
|
+
const endTs = parseTimeToTimestamp(p.end_time);
|
|
790
|
+
if (!startTs || !endTs)
|
|
791
|
+
return json({
|
|
792
|
+
error: "Invalid time format. Must use ISO 8601 / RFC 3339 with timezone, e.g. '2024-01-01T00:00:00+08:00'",
|
|
793
|
+
received_start: p.start_time,
|
|
794
|
+
received_end: p.end_time
|
|
795
|
+
});
|
|
796
|
+
log.info(`instance_view: calendar_id=${calendarId}, start=${startTs}, end=${endTs}`);
|
|
797
|
+
const res = await client.invoke(
|
|
798
|
+
"feishu_calendar_event.instance_view",
|
|
799
|
+
(sdk, opts) => sdk.calendar.calendarEvent.instanceView(
|
|
800
|
+
{
|
|
801
|
+
path: { calendar_id: calendarId },
|
|
802
|
+
params: {
|
|
803
|
+
start_time: startTs,
|
|
804
|
+
end_time: endTs,
|
|
805
|
+
user_id_type: "open_id"
|
|
806
|
+
}
|
|
807
|
+
},
|
|
808
|
+
opts
|
|
809
|
+
),
|
|
810
|
+
{ as: "user" }
|
|
811
|
+
);
|
|
812
|
+
assertLarkOk(res);
|
|
813
|
+
const data = res.data;
|
|
814
|
+
log.info(`instance_view: returned ${data?.items?.length ?? 0} events`);
|
|
815
|
+
return json({
|
|
816
|
+
events: normalizeEventListTimeFields(data?.items),
|
|
817
|
+
has_more: data?.has_more ?? false,
|
|
818
|
+
page_token: data?.page_token
|
|
819
|
+
});
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
} catch (err) {
|
|
823
|
+
return await handleInvokeErrorWithAutoAuth(err, cfg);
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
},
|
|
827
|
+
{ name: "feishu_calendar_event" }
|
|
828
|
+
);
|
|
829
|
+
api.logger.info?.("feishu_calendar_event: Registered feishu_calendar_event tool");
|
|
830
|
+
}
|
|
831
|
+
export {
|
|
832
|
+
registerFeishuCalendarEventTool
|
|
833
|
+
};
|
|
834
|
+
//# sourceMappingURL=event.js.map
|