@colinlu50/openclaw-lark-stream 2026.3.17
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 +141 -0
- package/README.zh.md +70 -0
- package/bin/openclaw-lark.js +48 -0
- package/index.d.ts +36 -0
- package/index.js +118 -0
- package/openclaw.plugin.json +10 -0
- package/package.json +66 -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 +244 -0
- package/skills/feishu-channel-rules/SKILL.md +24 -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 +293 -0
- package/skills/feishu-troubleshoot/SKILL.md +70 -0
- package/skills/feishu-update-doc/SKILL.md +285 -0
- package/src/card/builder.d.ts +106 -0
- package/src/card/builder.js +443 -0
- package/src/card/cardkit.d.ts +90 -0
- package/src/card/cardkit.js +181 -0
- package/src/card/flush-controller.d.ts +45 -0
- package/src/card/flush-controller.js +134 -0
- package/src/card/image-resolver.d.ts +45 -0
- package/src/card/image-resolver.js +112 -0
- package/src/card/markdown-style.d.ts +16 -0
- package/src/card/markdown-style.js +97 -0
- package/src/card/reply-dispatcher-types.d.ts +120 -0
- package/src/card/reply-dispatcher-types.js +57 -0
- package/src/card/reply-dispatcher.d.ts +15 -0
- package/src/card/reply-dispatcher.js +299 -0
- package/src/card/reply-mode.d.ts +38 -0
- package/src/card/reply-mode.js +65 -0
- package/src/card/streaming-card-controller.d.ts +101 -0
- package/src/card/streaming-card-controller.js +810 -0
- package/src/card/unavailable-guard.d.ts +35 -0
- package/src/card/unavailable-guard.js +83 -0
- package/src/channel/abort-detect.d.ts +34 -0
- package/src/channel/abort-detect.js +124 -0
- package/src/channel/chat-queue.d.ts +41 -0
- package/src/channel/chat-queue.js +58 -0
- package/src/channel/config-adapter.d.ts +23 -0
- package/src/channel/config-adapter.js +101 -0
- package/src/channel/directory.d.ts +57 -0
- package/src/channel/directory.js +191 -0
- package/src/channel/event-handlers.d.ts +15 -0
- package/src/channel/event-handlers.js +221 -0
- package/src/channel/monitor.d.ts +17 -0
- package/src/channel/monitor.js +129 -0
- package/src/channel/onboarding-config.d.ts +17 -0
- package/src/channel/onboarding-config.js +88 -0
- package/src/channel/onboarding-migrate.d.ts +25 -0
- package/src/channel/onboarding-migrate.js +67 -0
- package/src/channel/onboarding.d.ts +12 -0
- package/src/channel/onboarding.js +296 -0
- package/src/channel/plugin.d.ts +13 -0
- package/src/channel/plugin.js +278 -0
- package/src/channel/probe.d.ts +14 -0
- package/src/channel/probe.js +21 -0
- package/src/channel/types.d.ts +36 -0
- package/src/channel/types.js +7 -0
- package/src/commands/auth.d.ts +21 -0
- package/src/commands/auth.js +161 -0
- package/src/commands/diagnose.d.ts +69 -0
- package/src/commands/diagnose.js +807 -0
- package/src/commands/doctor.d.ts +26 -0
- package/src/commands/doctor.js +584 -0
- package/src/commands/index.d.ts +25 -0
- package/src/commands/index.js +212 -0
- package/src/commands/locale.d.ts +7 -0
- package/src/commands/locale.js +7 -0
- package/src/core/accounts.d.ts +37 -0
- package/src/core/accounts.js +163 -0
- package/src/core/agent-config.d.ts +100 -0
- package/src/core/agent-config.js +139 -0
- package/src/core/api-error.d.ts +48 -0
- package/src/core/api-error.js +112 -0
- package/src/core/app-owner-fallback.d.ts +21 -0
- package/src/core/app-owner-fallback.js +38 -0
- package/src/core/app-scope-checker.d.ts +87 -0
- package/src/core/app-scope-checker.js +190 -0
- package/src/core/auth-errors.d.ts +144 -0
- package/src/core/auth-errors.js +154 -0
- package/src/core/chat-info-cache.d.ts +57 -0
- package/src/core/chat-info-cache.js +152 -0
- package/src/core/config-schema.d.ts +448 -0
- package/src/core/config-schema.js +200 -0
- package/src/core/device-flow.d.ts +77 -0
- package/src/core/device-flow.js +212 -0
- package/src/core/domains.d.ts +18 -0
- package/src/core/domains.js +28 -0
- package/src/core/feishu-fetch.d.ts +18 -0
- package/src/core/feishu-fetch.js +25 -0
- package/src/core/footer-config.d.ts +24 -0
- package/src/core/footer-config.js +39 -0
- package/src/core/lark-client.d.ts +108 -0
- package/src/core/lark-client.js +353 -0
- package/src/core/lark-logger.d.ts +23 -0
- package/src/core/lark-logger.js +154 -0
- package/src/core/lark-ticket.d.ts +29 -0
- package/src/core/lark-ticket.js +35 -0
- package/src/core/message-unavailable.d.ts +53 -0
- package/src/core/message-unavailable.js +130 -0
- package/src/core/owner-policy.d.ts +31 -0
- package/src/core/owner-policy.js +52 -0
- package/src/core/permission-url.d.ts +22 -0
- package/src/core/permission-url.js +72 -0
- package/src/core/raw-request.d.ts +27 -0
- package/src/core/raw-request.js +62 -0
- package/src/core/scope-manager.d.ts +168 -0
- package/src/core/scope-manager.js +213 -0
- package/src/core/security-check.d.ts +72 -0
- package/src/core/security-check.js +174 -0
- package/src/core/shutdown-hooks.d.ts +22 -0
- package/src/core/shutdown-hooks.js +56 -0
- package/src/core/targets.d.ts +60 -0
- package/src/core/targets.js +164 -0
- package/src/core/token-store.d.ts +54 -0
- package/src/core/token-store.js +314 -0
- package/src/core/tool-client.d.ts +176 -0
- package/src/core/tool-client.js +380 -0
- package/src/core/tool-scopes.d.ts +153 -0
- package/src/core/tool-scopes.js +326 -0
- package/src/core/tools-config.d.ts +55 -0
- package/src/core/tools-config.js +137 -0
- package/src/core/types.d.ts +87 -0
- package/src/core/types.js +11 -0
- package/src/core/uat-client.d.ts +46 -0
- package/src/core/uat-client.js +187 -0
- package/src/core/version.d.ts +25 -0
- package/src/core/version.js +49 -0
- package/src/messaging/converters/audio.d.ts +8 -0
- package/src/messaging/converters/audio.js +21 -0
- package/src/messaging/converters/calendar.d.ts +13 -0
- package/src/messaging/converters/calendar.js +50 -0
- package/src/messaging/converters/content-converter.d.ts +41 -0
- package/src/messaging/converters/content-converter.js +106 -0
- package/src/messaging/converters/file.d.ts +8 -0
- package/src/messaging/converters/file.js +20 -0
- package/src/messaging/converters/folder.d.ts +8 -0
- package/src/messaging/converters/folder.js +20 -0
- package/src/messaging/converters/hongbao.d.ts +8 -0
- package/src/messaging/converters/hongbao.js +16 -0
- package/src/messaging/converters/image.d.ts +8 -0
- package/src/messaging/converters/image.js +18 -0
- package/src/messaging/converters/index.d.ts +8 -0
- package/src/messaging/converters/index.js +50 -0
- package/src/messaging/converters/interactive/card-converter.d.ts +76 -0
- package/src/messaging/converters/interactive/card-converter.js +1173 -0
- package/src/messaging/converters/interactive/card-utils.d.ts +9 -0
- package/src/messaging/converters/interactive/card-utils.js +42 -0
- package/src/messaging/converters/interactive/index.d.ts +8 -0
- package/src/messaging/converters/interactive/index.js +21 -0
- package/src/messaging/converters/interactive/legacy.d.ts +11 -0
- package/src/messaging/converters/interactive/legacy.js +57 -0
- package/src/messaging/converters/interactive/types.d.ts +23 -0
- package/src/messaging/converters/interactive/types.js +24 -0
- package/src/messaging/converters/location.d.ts +8 -0
- package/src/messaging/converters/location.js +19 -0
- package/src/messaging/converters/merge-forward.d.ts +32 -0
- package/src/messaging/converters/merge-forward.js +225 -0
- package/src/messaging/converters/post.d.ts +11 -0
- package/src/messaging/converters/post.js +135 -0
- package/src/messaging/converters/share.d.ts +9 -0
- package/src/messaging/converters/share.js +23 -0
- package/src/messaging/converters/sticker.d.ts +8 -0
- package/src/messaging/converters/sticker.js +18 -0
- package/src/messaging/converters/system.d.ts +12 -0
- package/src/messaging/converters/system.js +32 -0
- package/src/messaging/converters/text.d.ts +8 -0
- package/src/messaging/converters/text.js +14 -0
- package/src/messaging/converters/todo.d.ts +8 -0
- package/src/messaging/converters/todo.js +41 -0
- package/src/messaging/converters/types.d.ts +107 -0
- package/src/messaging/converters/types.js +7 -0
- package/src/messaging/converters/unknown.d.ts +8 -0
- package/src/messaging/converters/unknown.js +16 -0
- package/src/messaging/converters/utils.d.ts +22 -0
- package/src/messaging/converters/utils.js +51 -0
- package/src/messaging/converters/video-chat.d.ts +8 -0
- package/src/messaging/converters/video-chat.js +23 -0
- package/src/messaging/converters/video.d.ts +8 -0
- package/src/messaging/converters/video.js +32 -0
- package/src/messaging/converters/vote.d.ts +8 -0
- package/src/messaging/converters/vote.js +24 -0
- package/src/messaging/inbound/dedup.d.ts +59 -0
- package/src/messaging/inbound/dedup.js +116 -0
- package/src/messaging/inbound/dispatch-builders.d.ts +84 -0
- package/src/messaging/inbound/dispatch-builders.js +152 -0
- package/src/messaging/inbound/dispatch-commands.d.ts +27 -0
- package/src/messaging/inbound/dispatch-commands.js +112 -0
- package/src/messaging/inbound/dispatch-context.d.ts +67 -0
- package/src/messaging/inbound/dispatch-context.js +136 -0
- package/src/messaging/inbound/dispatch.d.ts +47 -0
- package/src/messaging/inbound/dispatch.js +264 -0
- package/src/messaging/inbound/enrich.d.ts +102 -0
- package/src/messaging/inbound/enrich.js +227 -0
- package/src/messaging/inbound/gate-effects.d.ts +23 -0
- package/src/messaging/inbound/gate-effects.js +43 -0
- package/src/messaging/inbound/gate.d.ts +60 -0
- package/src/messaging/inbound/gate.js +233 -0
- package/src/messaging/inbound/handler.d.ts +35 -0
- package/src/messaging/inbound/handler.js +173 -0
- package/src/messaging/inbound/media-resolver.d.ts +32 -0
- package/src/messaging/inbound/media-resolver.js +87 -0
- package/src/messaging/inbound/mention.d.ts +39 -0
- package/src/messaging/inbound/mention.js +81 -0
- package/src/messaging/inbound/parse-io.d.ts +50 -0
- package/src/messaging/inbound/parse-io.js +81 -0
- package/src/messaging/inbound/parse.d.ts +28 -0
- package/src/messaging/inbound/parse.js +106 -0
- package/src/messaging/inbound/permission.d.ts +17 -0
- package/src/messaging/inbound/permission.js +40 -0
- package/src/messaging/inbound/policy.d.ts +94 -0
- package/src/messaging/inbound/policy.js +160 -0
- package/src/messaging/inbound/reaction-handler.d.ts +61 -0
- package/src/messaging/inbound/reaction-handler.js +221 -0
- package/src/messaging/inbound/user-name-cache.d.ts +82 -0
- package/src/messaging/inbound/user-name-cache.js +241 -0
- package/src/messaging/outbound/actions.d.ts +16 -0
- package/src/messaging/outbound/actions.js +309 -0
- package/src/messaging/outbound/chat-manage.d.ts +64 -0
- package/src/messaging/outbound/chat-manage.js +111 -0
- package/src/messaging/outbound/deliver.d.ts +155 -0
- package/src/messaging/outbound/deliver.js +298 -0
- package/src/messaging/outbound/fetch.d.ts +12 -0
- package/src/messaging/outbound/fetch.js +12 -0
- package/src/messaging/outbound/forward.d.ts +26 -0
- package/src/messaging/outbound/forward.js +48 -0
- package/src/messaging/outbound/media-url-utils.d.ts +29 -0
- package/src/messaging/outbound/media-url-utils.js +130 -0
- package/src/messaging/outbound/media.d.ts +260 -0
- package/src/messaging/outbound/media.js +758 -0
- package/src/messaging/outbound/outbound.d.ts +89 -0
- package/src/messaging/outbound/outbound.js +121 -0
- package/src/messaging/outbound/reactions.d.ts +124 -0
- package/src/messaging/outbound/reactions.js +378 -0
- package/src/messaging/outbound/send.d.ts +152 -0
- package/src/messaging/outbound/send.js +355 -0
- package/src/messaging/outbound/typing.d.ts +71 -0
- package/src/messaging/outbound/typing.js +179 -0
- package/src/messaging/shared/message-lookup.d.ts +54 -0
- package/src/messaging/shared/message-lookup.js +117 -0
- package/src/messaging/types.d.ts +176 -0
- package/src/messaging/types.js +10 -0
- package/src/tools/auto-auth.d.ts +56 -0
- package/src/tools/auto-auth.js +919 -0
- package/src/tools/helpers.d.ts +260 -0
- package/src/tools/helpers.js +364 -0
- package/src/tools/mcp/doc/create.d.ts +12 -0
- package/src/tools/mcp/doc/create.js +44 -0
- package/src/tools/mcp/doc/fetch.d.ts +12 -0
- package/src/tools/mcp/doc/fetch.js +36 -0
- package/src/tools/mcp/doc/index.d.ts +12 -0
- package/src/tools/mcp/doc/index.js +41 -0
- package/src/tools/mcp/doc/update.d.ts +12 -0
- package/src/tools/mcp/doc/update.js +61 -0
- package/src/tools/mcp/shared.d.ts +59 -0
- package/src/tools/mcp/shared.js +226 -0
- package/src/tools/oapi/bitable/app-table-field.d.ts +16 -0
- package/src/tools/oapi/bitable/app-table-field.js +222 -0
- package/src/tools/oapi/bitable/app-table-record.d.ts +20 -0
- package/src/tools/oapi/bitable/app-table-record.js +436 -0
- package/src/tools/oapi/bitable/app-table-view.d.ts +17 -0
- package/src/tools/oapi/bitable/app-table-view.js +195 -0
- package/src/tools/oapi/bitable/app-table.d.ts +19 -0
- package/src/tools/oapi/bitable/app-table.js +247 -0
- package/src/tools/oapi/bitable/app.d.ts +18 -0
- package/src/tools/oapi/bitable/app.js +186 -0
- package/src/tools/oapi/bitable/index.d.ts +9 -0
- package/src/tools/oapi/bitable/index.js +9 -0
- package/src/tools/oapi/calendar/calendar.d.ts +15 -0
- package/src/tools/oapi/calendar/calendar.js +122 -0
- package/src/tools/oapi/calendar/event-attendee.d.ts +16 -0
- package/src/tools/oapi/calendar/event-attendee.js +263 -0
- package/src/tools/oapi/calendar/event.d.ts +16 -0
- package/src/tools/oapi/calendar/event.js +709 -0
- package/src/tools/oapi/calendar/freebusy.d.ts +13 -0
- package/src/tools/oapi/calendar/freebusy.js +111 -0
- package/src/tools/oapi/calendar/index.d.ts +8 -0
- package/src/tools/oapi/calendar/index.js +8 -0
- package/src/tools/oapi/chat/chat.d.ts +16 -0
- package/src/tools/oapi/chat/chat.js +124 -0
- package/src/tools/oapi/chat/index.d.ts +10 -0
- package/src/tools/oapi/chat/index.js +15 -0
- package/src/tools/oapi/chat/members.d.ts +11 -0
- package/src/tools/oapi/chat/members.js +81 -0
- package/src/tools/oapi/common/get-user.d.ts +12 -0
- package/src/tools/oapi/common/get-user.js +106 -0
- package/src/tools/oapi/common/index.d.ts +6 -0
- package/src/tools/oapi/common/index.js +6 -0
- package/src/tools/oapi/common/search-user.d.ts +11 -0
- package/src/tools/oapi/common/search-user.js +73 -0
- package/src/tools/oapi/drive/doc-comments.d.ts +15 -0
- package/src/tools/oapi/drive/doc-comments.js +279 -0
- package/src/tools/oapi/drive/doc-media.d.ts +19 -0
- package/src/tools/oapi/drive/doc-media.js +335 -0
- package/src/tools/oapi/drive/file.d.ts +19 -0
- package/src/tools/oapi/drive/file.js +483 -0
- package/src/tools/oapi/drive/index.d.ts +12 -0
- package/src/tools/oapi/drive/index.js +36 -0
- package/src/tools/oapi/helpers.d.ts +182 -0
- package/src/tools/oapi/helpers.js +354 -0
- package/src/tools/oapi/im/format-messages.d.ts +50 -0
- package/src/tools/oapi/im/format-messages.js +165 -0
- package/src/tools/oapi/im/index.d.ts +10 -0
- package/src/tools/oapi/im/index.js +17 -0
- package/src/tools/oapi/im/message-read.d.ts +13 -0
- package/src/tools/oapi/im/message-read.js +411 -0
- package/src/tools/oapi/im/message.d.ts +16 -0
- package/src/tools/oapi/im/message.js +149 -0
- package/src/tools/oapi/im/resource.d.ts +13 -0
- package/src/tools/oapi/im/resource.js +150 -0
- package/src/tools/oapi/im/time-utils.d.ts +46 -0
- package/src/tools/oapi/im/time-utils.js +201 -0
- package/src/tools/oapi/im/user-name-uat.d.ts +26 -0
- package/src/tools/oapi/im/user-name-uat.js +140 -0
- package/src/tools/oapi/index.d.ts +11 -0
- package/src/tools/oapi/index.js +58 -0
- package/src/tools/oapi/sdk-types.d.ts +96 -0
- package/src/tools/oapi/sdk-types.js +12 -0
- package/src/tools/oapi/search/doc-search.d.ts +13 -0
- package/src/tools/oapi/search/doc-search.js +191 -0
- package/src/tools/oapi/search/index.d.ts +12 -0
- package/src/tools/oapi/search/index.js +33 -0
- package/src/tools/oapi/sheets/index.d.ts +12 -0
- package/src/tools/oapi/sheets/index.js +31 -0
- package/src/tools/oapi/sheets/sheet.d.ts +16 -0
- package/src/tools/oapi/sheets/sheet.js +652 -0
- package/src/tools/oapi/task/comment.d.ts +15 -0
- package/src/tools/oapi/task/comment.js +140 -0
- package/src/tools/oapi/task/index.d.ts +8 -0
- package/src/tools/oapi/task/index.js +8 -0
- package/src/tools/oapi/task/subtask.d.ts +14 -0
- package/src/tools/oapi/task/subtask.js +162 -0
- package/src/tools/oapi/task/task.d.ts +16 -0
- package/src/tools/oapi/task/task.js +344 -0
- package/src/tools/oapi/task/tasklist.d.ts +21 -0
- package/src/tools/oapi/task/tasklist.js +321 -0
- package/src/tools/oapi/wiki/index.d.ts +12 -0
- package/src/tools/oapi/wiki/index.js +34 -0
- package/src/tools/oapi/wiki/space-node.d.ts +17 -0
- package/src/tools/oapi/wiki/space-node.js +230 -0
- package/src/tools/oapi/wiki/space.d.ts +15 -0
- package/src/tools/oapi/wiki/space.js +130 -0
- package/src/tools/oauth-batch-auth.d.ts +11 -0
- package/src/tools/oauth-batch-auth.js +142 -0
- package/src/tools/oauth-cards.d.ts +39 -0
- package/src/tools/oauth-cards.js +315 -0
- package/src/tools/oauth.d.ts +47 -0
- package/src/tools/oauth.js +620 -0
- package/src/tools/onboarding-auth.d.ts +27 -0
- package/src/tools/onboarding-auth.js +130 -0
- package/src/tools/tat/im/index.d.ts +15 -0
- package/src/tools/tat/im/index.js +18 -0
- package/src/tools/tat/im/resource.d.ts +15 -0
- package/src/tools/tat/im/resource.js +157 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*
|
|
5
|
+
* feishu_calendar_event_attendee tool -- Manage Feishu calendar event attendees.
|
|
6
|
+
*
|
|
7
|
+
* P0 Actions: create, list
|
|
8
|
+
* P1 Actions: batch_delete
|
|
9
|
+
*
|
|
10
|
+
* Uses the Feishu Calendar API:
|
|
11
|
+
* - create: POST /open-apis/calendar/v4/calendars/:calendar_id/events/:event_id/attendees
|
|
12
|
+
* - list: GET /open-apis/calendar/v4/calendars/:calendar_id/events/:event_id/attendees
|
|
13
|
+
* - batch_delete: POST /open-apis/calendar/v4/calendars/:calendar_id/events/:event_id/attendees/batch_delete
|
|
14
|
+
*/
|
|
15
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
16
|
+
import { Type } from '@sinclair/typebox';
|
|
17
|
+
import { json, createToolContext, assertLarkOk, handleInvokeErrorWithAutoAuth, registerTool, StringEnum } from '../helpers';
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
// Schema
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
const FeishuCalendarEventAttendeeSchema = Type.Union([
|
|
22
|
+
// CREATE
|
|
23
|
+
Type.Object({
|
|
24
|
+
action: Type.Literal('create'),
|
|
25
|
+
calendar_id: Type.String({
|
|
26
|
+
description: '日历 ID',
|
|
27
|
+
}),
|
|
28
|
+
event_id: Type.String({
|
|
29
|
+
description: '日程 ID',
|
|
30
|
+
}),
|
|
31
|
+
attendees: Type.Array(Type.Object({
|
|
32
|
+
type: StringEnum(['user', 'chat', 'resource', 'third_party']),
|
|
33
|
+
attendee_id: Type.String({
|
|
34
|
+
description: '参会人 ID。type=user 时为 open_id,type=chat 时为 chat_id,type=resource 时为会议室 ID,type=third_party 时为邮箱地址',
|
|
35
|
+
}),
|
|
36
|
+
}), {
|
|
37
|
+
description: '参会人列表',
|
|
38
|
+
}),
|
|
39
|
+
need_notification: Type.Optional(Type.Boolean({
|
|
40
|
+
description: '是否给参会人发送通知(默认 true)',
|
|
41
|
+
})),
|
|
42
|
+
attendee_ability: Type.Optional(StringEnum(['none', 'can_see_others', 'can_invite_others', 'can_modify_event'])),
|
|
43
|
+
}),
|
|
44
|
+
// LIST
|
|
45
|
+
Type.Object({
|
|
46
|
+
action: Type.Literal('list'),
|
|
47
|
+
calendar_id: Type.String({
|
|
48
|
+
description: '日历 ID',
|
|
49
|
+
}),
|
|
50
|
+
event_id: Type.String({
|
|
51
|
+
description: '日程 ID',
|
|
52
|
+
}),
|
|
53
|
+
page_size: Type.Optional(Type.Number({
|
|
54
|
+
description: '每页数量(默认 50,最大 500)',
|
|
55
|
+
})),
|
|
56
|
+
page_token: Type.Optional(Type.String({
|
|
57
|
+
description: '分页标记',
|
|
58
|
+
})),
|
|
59
|
+
user_id_type: Type.Optional(StringEnum(['open_id', 'union_id', 'user_id'])),
|
|
60
|
+
}),
|
|
61
|
+
// BATCH_DELETE (P1)
|
|
62
|
+
Type.Object({
|
|
63
|
+
action: Type.Literal('batch_delete'),
|
|
64
|
+
calendar_id: Type.String({
|
|
65
|
+
description: '日历 ID',
|
|
66
|
+
}),
|
|
67
|
+
event_id: Type.String({
|
|
68
|
+
description: '日程 ID',
|
|
69
|
+
}),
|
|
70
|
+
user_open_ids: Type.Array(Type.String({
|
|
71
|
+
description: '要删除的参会人的 open_id(ou_...格式)',
|
|
72
|
+
}), {
|
|
73
|
+
description: '参会人 open_id 列表',
|
|
74
|
+
}),
|
|
75
|
+
need_notification: Type.Optional(Type.Boolean({
|
|
76
|
+
description: '是否给参会人发送通知(默认 false)',
|
|
77
|
+
})),
|
|
78
|
+
}),
|
|
79
|
+
]);
|
|
80
|
+
// ---------------------------------------------------------------------------
|
|
81
|
+
// Registration
|
|
82
|
+
// ---------------------------------------------------------------------------
|
|
83
|
+
export function registerFeishuCalendarEventAttendeeTool(api) {
|
|
84
|
+
if (!api.config)
|
|
85
|
+
return;
|
|
86
|
+
const cfg = api.config;
|
|
87
|
+
const { toolClient, log } = createToolContext(api, 'feishu_calendar_event_attendee');
|
|
88
|
+
registerTool(api, {
|
|
89
|
+
name: 'feishu_calendar_event_attendee',
|
|
90
|
+
label: 'Feishu Calendar Event Attendees',
|
|
91
|
+
description: '飞书日程参会人管理工具。当用户要求邀请/添加参会人、查看参会人列表、移除参会人时使用。Actions: create(添加参会人), list(查询参会人列表), batch_delete(批量删除参会人,注意:不能删除日程组织者)。',
|
|
92
|
+
parameters: FeishuCalendarEventAttendeeSchema,
|
|
93
|
+
async execute(_toolCallId, params) {
|
|
94
|
+
const p = params;
|
|
95
|
+
try {
|
|
96
|
+
const client = toolClient();
|
|
97
|
+
switch (p.action) {
|
|
98
|
+
// -----------------------------------------------------------------
|
|
99
|
+
// CREATE ATTENDEES
|
|
100
|
+
// -----------------------------------------------------------------
|
|
101
|
+
case 'create': {
|
|
102
|
+
if (!p.attendees || p.attendees.length === 0) {
|
|
103
|
+
return json({
|
|
104
|
+
error: 'attendees is required and cannot be empty',
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
log.info(`create: calendar_id=${p.calendar_id}, event_id=${p.event_id}, attendees_count=${p.attendees.length}`);
|
|
108
|
+
const attendeeData = p.attendees.map((a) => {
|
|
109
|
+
const base = {
|
|
110
|
+
type: a.type,
|
|
111
|
+
is_optional: false,
|
|
112
|
+
};
|
|
113
|
+
if (a.type === 'user') {
|
|
114
|
+
base.user_id = a.attendee_id;
|
|
115
|
+
}
|
|
116
|
+
else if (a.type === 'chat') {
|
|
117
|
+
base.chat_id = a.attendee_id;
|
|
118
|
+
}
|
|
119
|
+
else if (a.type === 'resource') {
|
|
120
|
+
base.room_id = a.attendee_id;
|
|
121
|
+
}
|
|
122
|
+
else if (a.type === 'third_party') {
|
|
123
|
+
base.third_party_email = a.attendee_id;
|
|
124
|
+
}
|
|
125
|
+
return base;
|
|
126
|
+
});
|
|
127
|
+
const res = await client.invoke('feishu_calendar_event.create', (sdk, opts) => sdk.calendar.calendarEventAttendee.create({
|
|
128
|
+
path: {
|
|
129
|
+
calendar_id: p.calendar_id,
|
|
130
|
+
event_id: p.event_id,
|
|
131
|
+
},
|
|
132
|
+
params: {
|
|
133
|
+
user_id_type: 'open_id',
|
|
134
|
+
},
|
|
135
|
+
data: {
|
|
136
|
+
attendees: attendeeData,
|
|
137
|
+
need_notification: p.need_notification ?? true,
|
|
138
|
+
},
|
|
139
|
+
}, opts), { as: 'user' });
|
|
140
|
+
assertLarkOk(res);
|
|
141
|
+
log.info(`create: added ${p.attendees.length} attendees to event ${p.event_id}`);
|
|
142
|
+
return json({
|
|
143
|
+
attendees: res.data?.attendees,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
// -----------------------------------------------------------------
|
|
147
|
+
// LIST ATTENDEES
|
|
148
|
+
// -----------------------------------------------------------------
|
|
149
|
+
case 'list': {
|
|
150
|
+
log.info(`list: calendar_id=${p.calendar_id}, event_id=${p.event_id}, page_size=${p.page_size ?? 50}`);
|
|
151
|
+
const res = await client.invoke('feishu_calendar_event_attendee.list', (sdk, opts) => sdk.calendar.calendarEventAttendee.list({
|
|
152
|
+
path: {
|
|
153
|
+
calendar_id: p.calendar_id,
|
|
154
|
+
event_id: p.event_id,
|
|
155
|
+
},
|
|
156
|
+
params: {
|
|
157
|
+
page_size: p.page_size,
|
|
158
|
+
page_token: p.page_token,
|
|
159
|
+
user_id_type: (p.user_id_type || 'open_id'),
|
|
160
|
+
},
|
|
161
|
+
}, opts), { as: 'user' });
|
|
162
|
+
assertLarkOk(res);
|
|
163
|
+
const data = res.data;
|
|
164
|
+
log.info(`list: returned ${data?.items?.length ?? 0} attendees`);
|
|
165
|
+
return json({
|
|
166
|
+
attendees: data?.items,
|
|
167
|
+
has_more: data?.has_more ?? false,
|
|
168
|
+
page_token: data?.page_token,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
// -----------------------------------------------------------------
|
|
172
|
+
// BATCH DELETE ATTENDEES (P1)
|
|
173
|
+
// -----------------------------------------------------------------
|
|
174
|
+
case 'batch_delete': {
|
|
175
|
+
if (!p.user_open_ids || p.user_open_ids.length === 0) {
|
|
176
|
+
return json({
|
|
177
|
+
error: 'user_open_ids is required and cannot be empty',
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
log.info(`batch_delete: calendar_id=${p.calendar_id}, event_id=${p.event_id}, user_open_ids=${p.user_open_ids.join(',')}`);
|
|
181
|
+
// Step 1: List all attendees to get attendee_id (user_...) from open_id (ou_...)
|
|
182
|
+
const listRes = await client.invoke('feishu_calendar_event_attendee.list', (sdk, opts) => sdk.calendar.calendarEventAttendee.list({
|
|
183
|
+
path: {
|
|
184
|
+
calendar_id: p.calendar_id,
|
|
185
|
+
event_id: p.event_id,
|
|
186
|
+
},
|
|
187
|
+
params: {
|
|
188
|
+
page_size: 500,
|
|
189
|
+
user_id_type: 'open_id',
|
|
190
|
+
},
|
|
191
|
+
}, opts), { as: 'user' });
|
|
192
|
+
assertLarkOk(listRes);
|
|
193
|
+
const listData = listRes.data;
|
|
194
|
+
const attendees = listData?.items || [];
|
|
195
|
+
// Step 2: Map open_id to attendee_id (user_...) and track organizers
|
|
196
|
+
const openIdToAttendeeId = new Map();
|
|
197
|
+
const organizerOpenIds = new Set();
|
|
198
|
+
for (const att of attendees) {
|
|
199
|
+
if (att.user_id && att.attendee_id) {
|
|
200
|
+
openIdToAttendeeId.set(att.user_id, att.attendee_id);
|
|
201
|
+
if (att.is_organizer) {
|
|
202
|
+
organizerOpenIds.add(att.user_id);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
// Step 2.5: Check if trying to delete organizer(s)
|
|
207
|
+
const attemptingToDeleteOrganizers = p.user_open_ids.filter((id) => organizerOpenIds.has(id));
|
|
208
|
+
if (attemptingToDeleteOrganizers.length > 0) {
|
|
209
|
+
return json({
|
|
210
|
+
error: 'cannot delete event organizer',
|
|
211
|
+
organizers_cannot_delete: attemptingToDeleteOrganizers,
|
|
212
|
+
hint: 'Event organizers cannot be removed. To remove organizer, consider deleting the event or transferring organizer role.',
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
// Step 3: Find attendee_ids for the given open_ids
|
|
216
|
+
const attendeeIdsToDelete = [];
|
|
217
|
+
const notFound = [];
|
|
218
|
+
for (const openId of p.user_open_ids) {
|
|
219
|
+
const attendeeId = openIdToAttendeeId.get(openId);
|
|
220
|
+
if (attendeeId) {
|
|
221
|
+
attendeeIdsToDelete.push(attendeeId);
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
notFound.push(openId);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (attendeeIdsToDelete.length === 0) {
|
|
228
|
+
return json({
|
|
229
|
+
error: 'None of the provided open_ids were found in the attendee list',
|
|
230
|
+
not_found: notFound,
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
log.info(`batch_delete: mapped ${attendeeIdsToDelete.length} open_ids to attendee_ids, not_found=${notFound.length}`);
|
|
234
|
+
// Step 4: Call batch_delete API with attendee_ids (user_...)
|
|
235
|
+
const res = await client.invoke('feishu_calendar_event_attendee.batch_delete', (sdk, opts) => sdk.calendar.calendarEventAttendee.batchDelete({
|
|
236
|
+
path: {
|
|
237
|
+
calendar_id: p.calendar_id,
|
|
238
|
+
event_id: p.event_id,
|
|
239
|
+
},
|
|
240
|
+
params: {
|
|
241
|
+
user_id_type: 'open_id',
|
|
242
|
+
},
|
|
243
|
+
data: {
|
|
244
|
+
attendee_ids: attendeeIdsToDelete,
|
|
245
|
+
need_notification: p.need_notification ?? false,
|
|
246
|
+
},
|
|
247
|
+
}, opts), { as: 'user' });
|
|
248
|
+
assertLarkOk(res);
|
|
249
|
+
log.info(`batch_delete: removed ${attendeeIdsToDelete.length} attendees from event ${p.event_id}`);
|
|
250
|
+
return json({
|
|
251
|
+
success: true,
|
|
252
|
+
removed_count: attendeeIdsToDelete.length,
|
|
253
|
+
not_found: notFound.length > 0 ? notFound : undefined,
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
catch (err) {
|
|
259
|
+
return await handleInvokeErrorWithAutoAuth(err, cfg);
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
}, { name: 'feishu_calendar_event_attendee' });
|
|
263
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*
|
|
5
|
+
* feishu_calendar_event tool -- Manage Feishu calendar events.
|
|
6
|
+
*
|
|
7
|
+
* P0 Actions: create, list, get
|
|
8
|
+
*
|
|
9
|
+
* Uses the Feishu Calendar API:
|
|
10
|
+
* - create: POST /open-apis/calendar/v4/calendars/:calendar_id/events
|
|
11
|
+
* POST /open-apis/calendar/v4/calendars/:calendar_id/events/:event_id/attendees/batch_create
|
|
12
|
+
* - list: GET /open-apis/calendar/v4/calendars/:calendar_id/events/instance_view
|
|
13
|
+
* - get: GET /open-apis/calendar/v4/calendars/:calendar_id/events/:event_id
|
|
14
|
+
*/
|
|
15
|
+
import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
|
|
16
|
+
export declare function registerFeishuCalendarEventTool(api: OpenClawPluginApi): void;
|