@larksuite/openclaw-lark 2026.3.9
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 +10 -0
- package/README.md +283 -0
- package/index.d.ts +37 -0
- package/index.d.ts.map +1 -0
- package/index.js +119 -0
- package/index.js.map +1 -0
- package/openclaw.plugin.json +10 -0
- package/package.json +47 -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 +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 +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 +100 -0
- package/src/card/builder.d.ts.map +1 -0
- package/src/card/builder.js +381 -0
- package/src/card/builder.js.map +1 -0
- package/src/card/cardkit.d.ts +91 -0
- package/src/card/cardkit.d.ts.map +1 -0
- package/src/card/cardkit.js +182 -0
- package/src/card/cardkit.js.map +1 -0
- package/src/card/flush-controller.d.ts +46 -0
- package/src/card/flush-controller.d.ts.map +1 -0
- package/src/card/flush-controller.js +135 -0
- package/src/card/flush-controller.js.map +1 -0
- package/src/card/markdown-style.d.ts +17 -0
- package/src/card/markdown-style.d.ts.map +1 -0
- package/src/card/markdown-style.js +98 -0
- package/src/card/markdown-style.js.map +1 -0
- package/src/card/reply-dispatcher-types.d.ts +121 -0
- package/src/card/reply-dispatcher-types.d.ts.map +1 -0
- package/src/card/reply-dispatcher-types.js +58 -0
- package/src/card/reply-dispatcher-types.js.map +1 -0
- package/src/card/reply-dispatcher.d.ts +16 -0
- package/src/card/reply-dispatcher.d.ts.map +1 -0
- package/src/card/reply-dispatcher.js +293 -0
- package/src/card/reply-dispatcher.js.map +1 -0
- package/src/card/reply-mode.d.ts +39 -0
- package/src/card/reply-mode.d.ts.map +1 -0
- package/src/card/reply-mode.js +66 -0
- package/src/card/reply-mode.js.map +1 -0
- package/src/card/streaming-card-controller.d.ts +88 -0
- package/src/card/streaming-card-controller.d.ts.map +1 -0
- package/src/card/streaming-card-controller.js +717 -0
- package/src/card/streaming-card-controller.js.map +1 -0
- package/src/card/unavailable-guard.d.ts +36 -0
- package/src/card/unavailable-guard.d.ts.map +1 -0
- package/src/card/unavailable-guard.js +84 -0
- package/src/card/unavailable-guard.js.map +1 -0
- package/src/channel/abort-detect.d.ts +35 -0
- package/src/channel/abort-detect.d.ts.map +1 -0
- package/src/channel/abort-detect.js +125 -0
- package/src/channel/abort-detect.js.map +1 -0
- package/src/channel/chat-queue.d.ts +42 -0
- package/src/channel/chat-queue.d.ts.map +1 -0
- package/src/channel/chat-queue.js +59 -0
- package/src/channel/chat-queue.js.map +1 -0
- package/src/channel/config-adapter.d.ts +24 -0
- package/src/channel/config-adapter.d.ts.map +1 -0
- package/src/channel/config-adapter.js +102 -0
- package/src/channel/config-adapter.js.map +1 -0
- package/src/channel/directory.d.ts +58 -0
- package/src/channel/directory.d.ts.map +1 -0
- package/src/channel/directory.js +192 -0
- package/src/channel/directory.js.map +1 -0
- package/src/channel/event-handlers.d.ts +16 -0
- package/src/channel/event-handlers.d.ts.map +1 -0
- package/src/channel/event-handlers.js +222 -0
- package/src/channel/event-handlers.js.map +1 -0
- package/src/channel/monitor.d.ts +18 -0
- package/src/channel/monitor.d.ts.map +1 -0
- package/src/channel/monitor.js +128 -0
- package/src/channel/monitor.js.map +1 -0
- package/src/channel/onboarding-config.d.ts +18 -0
- package/src/channel/onboarding-config.d.ts.map +1 -0
- package/src/channel/onboarding-config.js +89 -0
- package/src/channel/onboarding-config.js.map +1 -0
- package/src/channel/onboarding-migrate.d.ts +26 -0
- package/src/channel/onboarding-migrate.d.ts.map +1 -0
- package/src/channel/onboarding-migrate.js +68 -0
- package/src/channel/onboarding-migrate.js.map +1 -0
- package/src/channel/onboarding.d.ts +13 -0
- package/src/channel/onboarding.d.ts.map +1 -0
- package/src/channel/onboarding.js +297 -0
- package/src/channel/onboarding.js.map +1 -0
- package/src/channel/plugin.d.ts +14 -0
- package/src/channel/plugin.d.ts.map +1 -0
- package/src/channel/plugin.js +279 -0
- package/src/channel/plugin.js.map +1 -0
- package/src/channel/probe.d.ts +15 -0
- package/src/channel/probe.d.ts.map +1 -0
- package/src/channel/probe.js +22 -0
- package/src/channel/probe.js.map +1 -0
- package/src/channel/types.d.ts +37 -0
- package/src/channel/types.d.ts.map +1 -0
- package/src/channel/types.js +8 -0
- package/src/channel/types.js.map +1 -0
- package/src/commands/auth.d.ts +16 -0
- package/src/commands/auth.d.ts.map +1 -0
- package/src/commands/auth.js +85 -0
- package/src/commands/auth.js.map +1 -0
- package/src/commands/diagnose.d.ts +70 -0
- package/src/commands/diagnose.d.ts.map +1 -0
- package/src/commands/diagnose.js +808 -0
- package/src/commands/diagnose.js.map +1 -0
- package/src/commands/doctor.d.ts +18 -0
- package/src/commands/doctor.d.ts.map +1 -0
- package/src/commands/doctor.js +439 -0
- package/src/commands/doctor.js.map +1 -0
- package/src/commands/index.d.ts +9 -0
- package/src/commands/index.d.ts.map +1 -0
- package/src/commands/index.js +208 -0
- package/src/commands/index.js.map +1 -0
- package/src/core/accounts.d.ts +38 -0
- package/src/core/accounts.d.ts.map +1 -0
- package/src/core/accounts.js +179 -0
- package/src/core/accounts.js.map +1 -0
- package/src/core/agent-config.d.ts +101 -0
- package/src/core/agent-config.d.ts.map +1 -0
- package/src/core/agent-config.js +140 -0
- package/src/core/agent-config.js.map +1 -0
- package/src/core/api-error.d.ts +49 -0
- package/src/core/api-error.d.ts.map +1 -0
- package/src/core/api-error.js +113 -0
- package/src/core/api-error.js.map +1 -0
- package/src/core/app-owner-fallback.d.ts +22 -0
- package/src/core/app-owner-fallback.d.ts.map +1 -0
- package/src/core/app-owner-fallback.js +39 -0
- package/src/core/app-owner-fallback.js.map +1 -0
- package/src/core/app-scope-checker.d.ts +88 -0
- package/src/core/app-scope-checker.d.ts.map +1 -0
- package/src/core/app-scope-checker.js +191 -0
- package/src/core/app-scope-checker.js.map +1 -0
- package/src/core/auth-errors.d.ts +143 -0
- package/src/core/auth-errors.d.ts.map +1 -0
- package/src/core/auth-errors.js +156 -0
- package/src/core/auth-errors.js.map +1 -0
- package/src/core/chat-info-cache.d.ts +58 -0
- package/src/core/chat-info-cache.d.ts.map +1 -0
- package/src/core/chat-info-cache.js +153 -0
- package/src/core/chat-info-cache.js.map +1 -0
- package/src/core/config-schema.d.ts +449 -0
- package/src/core/config-schema.d.ts.map +1 -0
- package/src/core/config-schema.js +201 -0
- package/src/core/config-schema.js.map +1 -0
- package/src/core/device-flow.d.ts +78 -0
- package/src/core/device-flow.d.ts.map +1 -0
- package/src/core/device-flow.js +213 -0
- package/src/core/device-flow.js.map +1 -0
- package/src/core/feishu-fetch.d.ts +19 -0
- package/src/core/feishu-fetch.d.ts.map +1 -0
- package/src/core/feishu-fetch.js +26 -0
- package/src/core/feishu-fetch.js.map +1 -0
- package/src/core/footer-config.d.ts +25 -0
- package/src/core/footer-config.d.ts.map +1 -0
- package/src/core/footer-config.js +40 -0
- package/src/core/footer-config.js.map +1 -0
- package/src/core/lark-client.d.ts +109 -0
- package/src/core/lark-client.d.ts.map +1 -0
- package/src/core/lark-client.js +354 -0
- package/src/core/lark-client.js.map +1 -0
- package/src/core/lark-logger.d.ts +24 -0
- package/src/core/lark-logger.d.ts.map +1 -0
- package/src/core/lark-logger.js +155 -0
- package/src/core/lark-logger.js.map +1 -0
- package/src/core/lark-ticket.d.ts +30 -0
- package/src/core/lark-ticket.d.ts.map +1 -0
- package/src/core/lark-ticket.js +36 -0
- package/src/core/lark-ticket.js.map +1 -0
- package/src/core/message-unavailable.d.ts +54 -0
- package/src/core/message-unavailable.d.ts.map +1 -0
- package/src/core/message-unavailable.js +131 -0
- package/src/core/message-unavailable.js.map +1 -0
- package/src/core/owner-policy.d.ts +32 -0
- package/src/core/owner-policy.d.ts.map +1 -0
- package/src/core/owner-policy.js +53 -0
- package/src/core/owner-policy.js.map +1 -0
- package/src/core/permission-url.d.ts +23 -0
- package/src/core/permission-url.d.ts.map +1 -0
- package/src/core/permission-url.js +73 -0
- package/src/core/permission-url.js.map +1 -0
- package/src/core/raw-request.d.ts +28 -0
- package/src/core/raw-request.d.ts.map +1 -0
- package/src/core/raw-request.js +63 -0
- package/src/core/raw-request.js.map +1 -0
- package/src/core/scope-manager.d.ts +169 -0
- package/src/core/scope-manager.d.ts.map +1 -0
- package/src/core/scope-manager.js +214 -0
- package/src/core/scope-manager.js.map +1 -0
- package/src/core/security-check.d.ts +73 -0
- package/src/core/security-check.d.ts.map +1 -0
- package/src/core/security-check.js +175 -0
- package/src/core/security-check.js.map +1 -0
- package/src/core/shutdown-hooks.d.ts +23 -0
- package/src/core/shutdown-hooks.d.ts.map +1 -0
- package/src/core/shutdown-hooks.js +57 -0
- package/src/core/shutdown-hooks.js.map +1 -0
- package/src/core/targets.d.ts +50 -0
- package/src/core/targets.d.ts.map +1 -0
- package/src/core/targets.js +128 -0
- package/src/core/targets.js.map +1 -0
- package/src/core/token-store.d.ts +55 -0
- package/src/core/token-store.d.ts.map +1 -0
- package/src/core/token-store.js +315 -0
- package/src/core/token-store.js.map +1 -0
- package/src/core/tool-client.d.ts +177 -0
- package/src/core/tool-client.d.ts.map +1 -0
- package/src/core/tool-client.js +381 -0
- package/src/core/tool-client.js.map +1 -0
- package/src/core/tool-scopes.d.ts +154 -0
- package/src/core/tool-scopes.d.ts.map +1 -0
- package/src/core/tool-scopes.js +326 -0
- package/src/core/tool-scopes.js.map +1 -0
- package/src/core/tools-config.d.ts +35 -0
- package/src/core/tools-config.d.ts.map +1 -0
- package/src/core/tools-config.js +88 -0
- package/src/core/tools-config.js.map +1 -0
- package/src/core/types.d.ts +88 -0
- package/src/core/types.d.ts.map +1 -0
- package/src/core/types.js +12 -0
- package/src/core/types.js.map +1 -0
- package/src/core/uat-client.d.ts +47 -0
- package/src/core/uat-client.d.ts.map +1 -0
- package/src/core/uat-client.js +173 -0
- package/src/core/uat-client.js.map +1 -0
- package/src/core/version.d.ts +26 -0
- package/src/core/version.d.ts.map +1 -0
- package/src/core/version.js +50 -0
- package/src/core/version.js.map +1 -0
- package/src/messaging/converters/audio.d.ts +9 -0
- package/src/messaging/converters/audio.d.ts.map +1 -0
- package/src/messaging/converters/audio.js +22 -0
- package/src/messaging/converters/audio.js.map +1 -0
- package/src/messaging/converters/calendar.d.ts +14 -0
- package/src/messaging/converters/calendar.d.ts.map +1 -0
- package/src/messaging/converters/calendar.js +51 -0
- package/src/messaging/converters/calendar.js.map +1 -0
- package/src/messaging/converters/content-converter.d.ts +42 -0
- package/src/messaging/converters/content-converter.d.ts.map +1 -0
- package/src/messaging/converters/content-converter.js +107 -0
- package/src/messaging/converters/content-converter.js.map +1 -0
- package/src/messaging/converters/file.d.ts +9 -0
- package/src/messaging/converters/file.d.ts.map +1 -0
- package/src/messaging/converters/file.js +21 -0
- package/src/messaging/converters/file.js.map +1 -0
- package/src/messaging/converters/folder.d.ts +9 -0
- package/src/messaging/converters/folder.d.ts.map +1 -0
- package/src/messaging/converters/folder.js +21 -0
- package/src/messaging/converters/folder.js.map +1 -0
- package/src/messaging/converters/hongbao.d.ts +9 -0
- package/src/messaging/converters/hongbao.d.ts.map +1 -0
- package/src/messaging/converters/hongbao.js +17 -0
- package/src/messaging/converters/hongbao.js.map +1 -0
- package/src/messaging/converters/image.d.ts +9 -0
- package/src/messaging/converters/image.d.ts.map +1 -0
- package/src/messaging/converters/image.js +19 -0
- package/src/messaging/converters/image.js.map +1 -0
- package/src/messaging/converters/index.d.ts +9 -0
- package/src/messaging/converters/index.d.ts.map +1 -0
- package/src/messaging/converters/index.js +51 -0
- package/src/messaging/converters/index.js.map +1 -0
- package/src/messaging/converters/interactive/card-converter.d.ts +77 -0
- package/src/messaging/converters/interactive/card-converter.d.ts.map +1 -0
- package/src/messaging/converters/interactive/card-converter.js +1174 -0
- package/src/messaging/converters/interactive/card-converter.js.map +1 -0
- package/src/messaging/converters/interactive/card-utils.d.ts +10 -0
- package/src/messaging/converters/interactive/card-utils.d.ts.map +1 -0
- package/src/messaging/converters/interactive/card-utils.js +43 -0
- package/src/messaging/converters/interactive/card-utils.js.map +1 -0
- package/src/messaging/converters/interactive/index.d.ts +9 -0
- package/src/messaging/converters/interactive/index.d.ts.map +1 -0
- package/src/messaging/converters/interactive/index.js +22 -0
- package/src/messaging/converters/interactive/index.js.map +1 -0
- package/src/messaging/converters/interactive/legacy.d.ts +12 -0
- package/src/messaging/converters/interactive/legacy.d.ts.map +1 -0
- package/src/messaging/converters/interactive/legacy.js +58 -0
- package/src/messaging/converters/interactive/legacy.js.map +1 -0
- package/src/messaging/converters/interactive/types.d.ts +24 -0
- package/src/messaging/converters/interactive/types.d.ts.map +1 -0
- package/src/messaging/converters/interactive/types.js +25 -0
- package/src/messaging/converters/interactive/types.js.map +1 -0
- package/src/messaging/converters/location.d.ts +9 -0
- package/src/messaging/converters/location.d.ts.map +1 -0
- package/src/messaging/converters/location.js +20 -0
- package/src/messaging/converters/location.js.map +1 -0
- package/src/messaging/converters/merge-forward.d.ts +33 -0
- package/src/messaging/converters/merge-forward.d.ts.map +1 -0
- package/src/messaging/converters/merge-forward.js +226 -0
- package/src/messaging/converters/merge-forward.js.map +1 -0
- package/src/messaging/converters/post.d.ts +12 -0
- package/src/messaging/converters/post.d.ts.map +1 -0
- package/src/messaging/converters/post.js +136 -0
- package/src/messaging/converters/post.js.map +1 -0
- package/src/messaging/converters/share.d.ts +10 -0
- package/src/messaging/converters/share.d.ts.map +1 -0
- package/src/messaging/converters/share.js +24 -0
- package/src/messaging/converters/share.js.map +1 -0
- package/src/messaging/converters/sticker.d.ts +9 -0
- package/src/messaging/converters/sticker.d.ts.map +1 -0
- package/src/messaging/converters/sticker.js +19 -0
- package/src/messaging/converters/sticker.js.map +1 -0
- package/src/messaging/converters/system.d.ts +13 -0
- package/src/messaging/converters/system.d.ts.map +1 -0
- package/src/messaging/converters/system.js +33 -0
- package/src/messaging/converters/system.js.map +1 -0
- package/src/messaging/converters/text.d.ts +9 -0
- package/src/messaging/converters/text.d.ts.map +1 -0
- package/src/messaging/converters/text.js +15 -0
- package/src/messaging/converters/text.js.map +1 -0
- package/src/messaging/converters/todo.d.ts +9 -0
- package/src/messaging/converters/todo.d.ts.map +1 -0
- package/src/messaging/converters/todo.js +42 -0
- package/src/messaging/converters/todo.js.map +1 -0
- package/src/messaging/converters/types.d.ts +108 -0
- package/src/messaging/converters/types.d.ts.map +1 -0
- package/src/messaging/converters/types.js +8 -0
- package/src/messaging/converters/types.js.map +1 -0
- package/src/messaging/converters/unknown.d.ts +9 -0
- package/src/messaging/converters/unknown.d.ts.map +1 -0
- package/src/messaging/converters/unknown.js +17 -0
- package/src/messaging/converters/unknown.js.map +1 -0
- package/src/messaging/converters/utils.d.ts +23 -0
- package/src/messaging/converters/utils.d.ts.map +1 -0
- package/src/messaging/converters/utils.js +52 -0
- package/src/messaging/converters/utils.js.map +1 -0
- package/src/messaging/converters/video-chat.d.ts +9 -0
- package/src/messaging/converters/video-chat.d.ts.map +1 -0
- package/src/messaging/converters/video-chat.js +24 -0
- package/src/messaging/converters/video-chat.js.map +1 -0
- package/src/messaging/converters/video.d.ts +9 -0
- package/src/messaging/converters/video.d.ts.map +1 -0
- package/src/messaging/converters/video.js +33 -0
- package/src/messaging/converters/video.js.map +1 -0
- package/src/messaging/converters/vote.d.ts +9 -0
- package/src/messaging/converters/vote.d.ts.map +1 -0
- package/src/messaging/converters/vote.js +25 -0
- package/src/messaging/converters/vote.js.map +1 -0
- package/src/messaging/inbound/dedup.d.ts +60 -0
- package/src/messaging/inbound/dedup.d.ts.map +1 -0
- package/src/messaging/inbound/dedup.js +117 -0
- package/src/messaging/inbound/dedup.js.map +1 -0
- package/src/messaging/inbound/dispatch-builders.d.ts +84 -0
- package/src/messaging/inbound/dispatch-builders.d.ts.map +1 -0
- package/src/messaging/inbound/dispatch-builders.js +153 -0
- package/src/messaging/inbound/dispatch-builders.js.map +1 -0
- package/src/messaging/inbound/dispatch-commands.d.ts +28 -0
- package/src/messaging/inbound/dispatch-commands.d.ts.map +1 -0
- package/src/messaging/inbound/dispatch-commands.js +113 -0
- package/src/messaging/inbound/dispatch-commands.js.map +1 -0
- package/src/messaging/inbound/dispatch-context.d.ts +68 -0
- package/src/messaging/inbound/dispatch-context.d.ts.map +1 -0
- package/src/messaging/inbound/dispatch-context.js +137 -0
- package/src/messaging/inbound/dispatch-context.js.map +1 -0
- package/src/messaging/inbound/dispatch.d.ts +48 -0
- package/src/messaging/inbound/dispatch.d.ts.map +1 -0
- package/src/messaging/inbound/dispatch.js +193 -0
- package/src/messaging/inbound/dispatch.js.map +1 -0
- package/src/messaging/inbound/enrich.d.ts +103 -0
- package/src/messaging/inbound/enrich.d.ts.map +1 -0
- package/src/messaging/inbound/enrich.js +228 -0
- package/src/messaging/inbound/enrich.js.map +1 -0
- package/src/messaging/inbound/gate-effects.d.ts +24 -0
- package/src/messaging/inbound/gate-effects.d.ts.map +1 -0
- package/src/messaging/inbound/gate-effects.js +44 -0
- package/src/messaging/inbound/gate-effects.js.map +1 -0
- package/src/messaging/inbound/gate.d.ts +61 -0
- package/src/messaging/inbound/gate.d.ts.map +1 -0
- package/src/messaging/inbound/gate.js +234 -0
- package/src/messaging/inbound/gate.js.map +1 -0
- package/src/messaging/inbound/handler.d.ts +36 -0
- package/src/messaging/inbound/handler.d.ts.map +1 -0
- package/src/messaging/inbound/handler.js +174 -0
- package/src/messaging/inbound/handler.js.map +1 -0
- package/src/messaging/inbound/media-resolver.d.ts +33 -0
- package/src/messaging/inbound/media-resolver.d.ts.map +1 -0
- package/src/messaging/inbound/media-resolver.js +88 -0
- package/src/messaging/inbound/media-resolver.js.map +1 -0
- package/src/messaging/inbound/mention.d.ts +40 -0
- package/src/messaging/inbound/mention.d.ts.map +1 -0
- package/src/messaging/inbound/mention.js +82 -0
- package/src/messaging/inbound/mention.js.map +1 -0
- package/src/messaging/inbound/parse-io.d.ts +51 -0
- package/src/messaging/inbound/parse-io.d.ts.map +1 -0
- package/src/messaging/inbound/parse-io.js +82 -0
- package/src/messaging/inbound/parse-io.js.map +1 -0
- package/src/messaging/inbound/parse.d.ts +29 -0
- package/src/messaging/inbound/parse.d.ts.map +1 -0
- package/src/messaging/inbound/parse.js +107 -0
- package/src/messaging/inbound/parse.js.map +1 -0
- package/src/messaging/inbound/permission.d.ts +18 -0
- package/src/messaging/inbound/permission.d.ts.map +1 -0
- package/src/messaging/inbound/permission.js +41 -0
- package/src/messaging/inbound/permission.js.map +1 -0
- package/src/messaging/inbound/policy.d.ts +95 -0
- package/src/messaging/inbound/policy.d.ts.map +1 -0
- package/src/messaging/inbound/policy.js +161 -0
- package/src/messaging/inbound/policy.js.map +1 -0
- package/src/messaging/inbound/reaction-handler.d.ts +62 -0
- package/src/messaging/inbound/reaction-handler.d.ts.map +1 -0
- package/src/messaging/inbound/reaction-handler.js +221 -0
- package/src/messaging/inbound/reaction-handler.js.map +1 -0
- package/src/messaging/inbound/user-name-cache.d.ts +83 -0
- package/src/messaging/inbound/user-name-cache.d.ts.map +1 -0
- package/src/messaging/inbound/user-name-cache.js +242 -0
- package/src/messaging/inbound/user-name-cache.js.map +1 -0
- package/src/messaging/outbound/actions.d.ts +17 -0
- package/src/messaging/outbound/actions.d.ts.map +1 -0
- package/src/messaging/outbound/actions.js +310 -0
- package/src/messaging/outbound/actions.js.map +1 -0
- package/src/messaging/outbound/chat-manage.d.ts +65 -0
- package/src/messaging/outbound/chat-manage.d.ts.map +1 -0
- package/src/messaging/outbound/chat-manage.js +112 -0
- package/src/messaging/outbound/chat-manage.js.map +1 -0
- package/src/messaging/outbound/deliver.d.ts +156 -0
- package/src/messaging/outbound/deliver.d.ts.map +1 -0
- package/src/messaging/outbound/deliver.js +299 -0
- package/src/messaging/outbound/deliver.js.map +1 -0
- package/src/messaging/outbound/fetch.d.ts +13 -0
- package/src/messaging/outbound/fetch.d.ts.map +1 -0
- package/src/messaging/outbound/fetch.js +13 -0
- package/src/messaging/outbound/fetch.js.map +1 -0
- package/src/messaging/outbound/forward.d.ts +27 -0
- package/src/messaging/outbound/forward.d.ts.map +1 -0
- package/src/messaging/outbound/forward.js +49 -0
- package/src/messaging/outbound/forward.js.map +1 -0
- package/src/messaging/outbound/media-url-utils.d.ts +30 -0
- package/src/messaging/outbound/media-url-utils.d.ts.map +1 -0
- package/src/messaging/outbound/media-url-utils.js +131 -0
- package/src/messaging/outbound/media-url-utils.js.map +1 -0
- package/src/messaging/outbound/media.d.ts +256 -0
- package/src/messaging/outbound/media.d.ts.map +1 -0
- package/src/messaging/outbound/media.js +749 -0
- package/src/messaging/outbound/media.js.map +1 -0
- package/src/messaging/outbound/outbound.d.ts +90 -0
- package/src/messaging/outbound/outbound.d.ts.map +1 -0
- package/src/messaging/outbound/outbound.js +112 -0
- package/src/messaging/outbound/outbound.js.map +1 -0
- package/src/messaging/outbound/reactions.d.ts +125 -0
- package/src/messaging/outbound/reactions.d.ts.map +1 -0
- package/src/messaging/outbound/reactions.js +379 -0
- package/src/messaging/outbound/reactions.js.map +1 -0
- package/src/messaging/outbound/send.d.ts +136 -0
- package/src/messaging/outbound/send.d.ts.map +1 -0
- package/src/messaging/outbound/send.js +289 -0
- package/src/messaging/outbound/send.js.map +1 -0
- package/src/messaging/outbound/typing.d.ts +61 -0
- package/src/messaging/outbound/typing.d.ts.map +1 -0
- package/src/messaging/outbound/typing.js +136 -0
- package/src/messaging/outbound/typing.js.map +1 -0
- package/src/messaging/shared/message-lookup.d.ts +55 -0
- package/src/messaging/shared/message-lookup.d.ts.map +1 -0
- package/src/messaging/shared/message-lookup.js +118 -0
- package/src/messaging/shared/message-lookup.js.map +1 -0
- package/src/messaging/types.d.ts +177 -0
- package/src/messaging/types.d.ts.map +1 -0
- package/src/messaging/types.js +11 -0
- package/src/messaging/types.js.map +1 -0
- package/src/tools/auto-auth.d.ts +57 -0
- package/src/tools/auto-auth.d.ts.map +1 -0
- package/src/tools/auto-auth.js +925 -0
- package/src/tools/auto-auth.js.map +1 -0
- package/src/tools/helpers.d.ts +220 -0
- package/src/tools/helpers.d.ts.map +1 -0
- package/src/tools/helpers.js +298 -0
- package/src/tools/helpers.js.map +1 -0
- package/src/tools/mcp/doc/create.d.ts +13 -0
- package/src/tools/mcp/doc/create.d.ts.map +1 -0
- package/src/tools/mcp/doc/create.js +45 -0
- package/src/tools/mcp/doc/create.js.map +1 -0
- package/src/tools/mcp/doc/fetch.d.ts +13 -0
- package/src/tools/mcp/doc/fetch.d.ts.map +1 -0
- package/src/tools/mcp/doc/fetch.js +37 -0
- package/src/tools/mcp/doc/fetch.js.map +1 -0
- package/src/tools/mcp/doc/index.d.ts +13 -0
- package/src/tools/mcp/doc/index.d.ts.map +1 -0
- package/src/tools/mcp/doc/index.js +42 -0
- package/src/tools/mcp/doc/index.js.map +1 -0
- package/src/tools/mcp/doc/update.d.ts +13 -0
- package/src/tools/mcp/doc/update.d.ts.map +1 -0
- package/src/tools/mcp/doc/update.js +62 -0
- package/src/tools/mcp/doc/update.js.map +1 -0
- package/src/tools/mcp/shared.d.ts +58 -0
- package/src/tools/mcp/shared.d.ts.map +1 -0
- package/src/tools/mcp/shared.js +224 -0
- package/src/tools/mcp/shared.js.map +1 -0
- package/src/tools/oapi/bitable/app-table-field.d.ts +17 -0
- package/src/tools/oapi/bitable/app-table-field.d.ts.map +1 -0
- package/src/tools/oapi/bitable/app-table-field.js +224 -0
- package/src/tools/oapi/bitable/app-table-field.js.map +1 -0
- package/src/tools/oapi/bitable/app-table-record.d.ts +21 -0
- package/src/tools/oapi/bitable/app-table-record.d.ts.map +1 -0
- package/src/tools/oapi/bitable/app-table-record.js +449 -0
- package/src/tools/oapi/bitable/app-table-record.js.map +1 -0
- package/src/tools/oapi/bitable/app-table-view.d.ts +18 -0
- package/src/tools/oapi/bitable/app-table-view.d.ts.map +1 -0
- package/src/tools/oapi/bitable/app-table-view.js +197 -0
- package/src/tools/oapi/bitable/app-table-view.js.map +1 -0
- package/src/tools/oapi/bitable/app-table.d.ts +20 -0
- package/src/tools/oapi/bitable/app-table.d.ts.map +1 -0
- package/src/tools/oapi/bitable/app-table.js +249 -0
- package/src/tools/oapi/bitable/app-table.js.map +1 -0
- package/src/tools/oapi/bitable/app.d.ts +19 -0
- package/src/tools/oapi/bitable/app.d.ts.map +1 -0
- package/src/tools/oapi/bitable/app.js +188 -0
- package/src/tools/oapi/bitable/app.js.map +1 -0
- package/src/tools/oapi/bitable/index.d.ts +10 -0
- package/src/tools/oapi/bitable/index.d.ts.map +1 -0
- package/src/tools/oapi/bitable/index.js +10 -0
- package/src/tools/oapi/bitable/index.js.map +1 -0
- package/src/tools/oapi/calendar/calendar.d.ts +16 -0
- package/src/tools/oapi/calendar/calendar.d.ts.map +1 -0
- package/src/tools/oapi/calendar/calendar.js +124 -0
- package/src/tools/oapi/calendar/calendar.js.map +1 -0
- package/src/tools/oapi/calendar/event-attendee.d.ts +17 -0
- package/src/tools/oapi/calendar/event-attendee.d.ts.map +1 -0
- package/src/tools/oapi/calendar/event-attendee.js +275 -0
- package/src/tools/oapi/calendar/event-attendee.js.map +1 -0
- package/src/tools/oapi/calendar/event.d.ts +17 -0
- package/src/tools/oapi/calendar/event.d.ts.map +1 -0
- package/src/tools/oapi/calendar/event.js +721 -0
- package/src/tools/oapi/calendar/event.js.map +1 -0
- package/src/tools/oapi/calendar/freebusy.d.ts +14 -0
- package/src/tools/oapi/calendar/freebusy.d.ts.map +1 -0
- package/src/tools/oapi/calendar/freebusy.js +113 -0
- package/src/tools/oapi/calendar/freebusy.js.map +1 -0
- package/src/tools/oapi/calendar/index.d.ts +9 -0
- package/src/tools/oapi/calendar/index.d.ts.map +1 -0
- package/src/tools/oapi/calendar/index.js +9 -0
- package/src/tools/oapi/calendar/index.js.map +1 -0
- package/src/tools/oapi/chat/chat.d.ts +17 -0
- package/src/tools/oapi/chat/chat.d.ts.map +1 -0
- package/src/tools/oapi/chat/chat.js +126 -0
- package/src/tools/oapi/chat/chat.js.map +1 -0
- package/src/tools/oapi/chat/index.d.ts +11 -0
- package/src/tools/oapi/chat/index.d.ts.map +1 -0
- package/src/tools/oapi/chat/index.js +16 -0
- package/src/tools/oapi/chat/index.js.map +1 -0
- package/src/tools/oapi/chat/members.d.ts +12 -0
- package/src/tools/oapi/chat/members.d.ts.map +1 -0
- package/src/tools/oapi/chat/members.js +83 -0
- package/src/tools/oapi/chat/members.js.map +1 -0
- package/src/tools/oapi/common/get-user.d.ts +13 -0
- package/src/tools/oapi/common/get-user.d.ts.map +1 -0
- package/src/tools/oapi/common/get-user.js +108 -0
- package/src/tools/oapi/common/get-user.js.map +1 -0
- package/src/tools/oapi/common/index.d.ts +7 -0
- package/src/tools/oapi/common/index.d.ts.map +1 -0
- package/src/tools/oapi/common/index.js +7 -0
- package/src/tools/oapi/common/index.js.map +1 -0
- package/src/tools/oapi/common/search-user.d.ts +12 -0
- package/src/tools/oapi/common/search-user.d.ts.map +1 -0
- package/src/tools/oapi/common/search-user.js +75 -0
- package/src/tools/oapi/common/search-user.js.map +1 -0
- package/src/tools/oapi/drive/doc-comments.d.ts +16 -0
- package/src/tools/oapi/drive/doc-comments.d.ts.map +1 -0
- package/src/tools/oapi/drive/doc-comments.js +288 -0
- package/src/tools/oapi/drive/doc-comments.js.map +1 -0
- package/src/tools/oapi/drive/doc-media.d.ts +20 -0
- package/src/tools/oapi/drive/doc-media.d.ts.map +1 -0
- package/src/tools/oapi/drive/doc-media.js +337 -0
- package/src/tools/oapi/drive/doc-media.js.map +1 -0
- package/src/tools/oapi/drive/file.d.ts +20 -0
- package/src/tools/oapi/drive/file.d.ts.map +1 -0
- package/src/tools/oapi/drive/file.js +485 -0
- package/src/tools/oapi/drive/file.js.map +1 -0
- package/src/tools/oapi/drive/index.d.ts +13 -0
- package/src/tools/oapi/drive/index.d.ts.map +1 -0
- package/src/tools/oapi/drive/index.js +37 -0
- package/src/tools/oapi/drive/index.js.map +1 -0
- package/src/tools/oapi/helpers.d.ts +174 -0
- package/src/tools/oapi/helpers.d.ts.map +1 -0
- package/src/tools/oapi/helpers.js +341 -0
- package/src/tools/oapi/helpers.js.map +1 -0
- package/src/tools/oapi/im/format-messages.d.ts +51 -0
- package/src/tools/oapi/im/format-messages.d.ts.map +1 -0
- package/src/tools/oapi/im/format-messages.js +166 -0
- package/src/tools/oapi/im/format-messages.js.map +1 -0
- package/src/tools/oapi/im/index.d.ts +11 -0
- package/src/tools/oapi/im/index.d.ts.map +1 -0
- package/src/tools/oapi/im/index.js +18 -0
- package/src/tools/oapi/im/index.js.map +1 -0
- package/src/tools/oapi/im/message-read.d.ts +14 -0
- package/src/tools/oapi/im/message-read.d.ts.map +1 -0
- package/src/tools/oapi/im/message-read.js +412 -0
- package/src/tools/oapi/im/message-read.js.map +1 -0
- package/src/tools/oapi/im/message.d.ts +17 -0
- package/src/tools/oapi/im/message.d.ts.map +1 -0
- package/src/tools/oapi/im/message.js +171 -0
- package/src/tools/oapi/im/message.js.map +1 -0
- package/src/tools/oapi/im/resource.d.ts +14 -0
- package/src/tools/oapi/im/resource.d.ts.map +1 -0
- package/src/tools/oapi/im/resource.js +152 -0
- package/src/tools/oapi/im/resource.js.map +1 -0
- package/src/tools/oapi/im/time-utils.d.ts +47 -0
- package/src/tools/oapi/im/time-utils.d.ts.map +1 -0
- package/src/tools/oapi/im/time-utils.js +202 -0
- package/src/tools/oapi/im/time-utils.js.map +1 -0
- package/src/tools/oapi/im/user-name-uat.d.ts +24 -0
- package/src/tools/oapi/im/user-name-uat.d.ts.map +1 -0
- package/src/tools/oapi/im/user-name-uat.js +128 -0
- package/src/tools/oapi/im/user-name-uat.js.map +1 -0
- package/src/tools/oapi/index.d.ts +12 -0
- package/src/tools/oapi/index.d.ts.map +1 -0
- package/src/tools/oapi/index.js +59 -0
- package/src/tools/oapi/index.js.map +1 -0
- package/src/tools/oapi/sdk-types.d.ts +97 -0
- package/src/tools/oapi/sdk-types.d.ts.map +1 -0
- package/src/tools/oapi/sdk-types.js +13 -0
- package/src/tools/oapi/sdk-types.js.map +1 -0
- package/src/tools/oapi/search/doc-search.d.ts +14 -0
- package/src/tools/oapi/search/doc-search.d.ts.map +1 -0
- package/src/tools/oapi/search/doc-search.js +203 -0
- package/src/tools/oapi/search/doc-search.js.map +1 -0
- package/src/tools/oapi/search/index.d.ts +13 -0
- package/src/tools/oapi/search/index.d.ts.map +1 -0
- package/src/tools/oapi/search/index.js +34 -0
- package/src/tools/oapi/search/index.js.map +1 -0
- package/src/tools/oapi/sheets/index.d.ts +13 -0
- package/src/tools/oapi/sheets/index.d.ts.map +1 -0
- package/src/tools/oapi/sheets/index.js +32 -0
- package/src/tools/oapi/sheets/index.js.map +1 -0
- package/src/tools/oapi/sheets/sheet.d.ts +17 -0
- package/src/tools/oapi/sheets/sheet.d.ts.map +1 -0
- package/src/tools/oapi/sheets/sheet.js +652 -0
- package/src/tools/oapi/sheets/sheet.js.map +1 -0
- package/src/tools/oapi/task/comment.d.ts +16 -0
- package/src/tools/oapi/task/comment.d.ts.map +1 -0
- package/src/tools/oapi/task/comment.js +142 -0
- package/src/tools/oapi/task/comment.js.map +1 -0
- package/src/tools/oapi/task/index.d.ts +9 -0
- package/src/tools/oapi/task/index.d.ts.map +1 -0
- package/src/tools/oapi/task/index.js +9 -0
- package/src/tools/oapi/task/index.js.map +1 -0
- package/src/tools/oapi/task/subtask.d.ts +15 -0
- package/src/tools/oapi/task/subtask.d.ts.map +1 -0
- package/src/tools/oapi/task/subtask.js +164 -0
- package/src/tools/oapi/task/subtask.js.map +1 -0
- package/src/tools/oapi/task/task.d.ts +17 -0
- package/src/tools/oapi/task/task.d.ts.map +1 -0
- package/src/tools/oapi/task/task.js +346 -0
- package/src/tools/oapi/task/task.js.map +1 -0
- package/src/tools/oapi/task/tasklist.d.ts +22 -0
- package/src/tools/oapi/task/tasklist.d.ts.map +1 -0
- package/src/tools/oapi/task/tasklist.js +323 -0
- package/src/tools/oapi/task/tasklist.js.map +1 -0
- package/src/tools/oapi/wiki/index.d.ts +13 -0
- package/src/tools/oapi/wiki/index.d.ts.map +1 -0
- package/src/tools/oapi/wiki/index.js +35 -0
- package/src/tools/oapi/wiki/index.js.map +1 -0
- package/src/tools/oapi/wiki/space-node.d.ts +18 -0
- package/src/tools/oapi/wiki/space-node.d.ts.map +1 -0
- package/src/tools/oapi/wiki/space-node.js +253 -0
- package/src/tools/oapi/wiki/space-node.js.map +1 -0
- package/src/tools/oapi/wiki/space.d.ts +16 -0
- package/src/tools/oapi/wiki/space.d.ts.map +1 -0
- package/src/tools/oapi/wiki/space.js +132 -0
- package/src/tools/oapi/wiki/space.js.map +1 -0
- package/src/tools/oauth-batch-auth.d.ts +12 -0
- package/src/tools/oauth-batch-auth.d.ts.map +1 -0
- package/src/tools/oauth-batch-auth.js +142 -0
- package/src/tools/oauth-batch-auth.js.map +1 -0
- package/src/tools/oauth-cards.d.ts +27 -0
- package/src/tools/oauth-cards.d.ts.map +1 -0
- package/src/tools/oauth-cards.js +251 -0
- package/src/tools/oauth-cards.js.map +1 -0
- package/src/tools/oauth.d.ts +48 -0
- package/src/tools/oauth.d.ts.map +1 -0
- package/src/tools/oauth.js +619 -0
- package/src/tools/oauth.js.map +1 -0
- package/src/tools/onboarding-auth.d.ts +28 -0
- package/src/tools/onboarding-auth.d.ts.map +1 -0
- package/src/tools/onboarding-auth.js +131 -0
- package/src/tools/onboarding-auth.js.map +1 -0
- package/src/tools/tat/im/index.d.ts +16 -0
- package/src/tools/tat/im/index.d.ts.map +1 -0
- package/src/tools/tat/im/index.js +19 -0
- package/src/tools/tat/im/index.js.map +1 -0
- package/src/tools/tat/im/resource.d.ts +16 -0
- package/src/tools/tat/im/resource.d.ts.map +1 -0
- package/src/tools/tat/im/resource.js +158 -0
- package/src/tools/tat/im/resource.js.map +1 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*
|
|
5
|
+
* Message forwarding for the Feishu/Lark channel plugin.
|
|
6
|
+
*
|
|
7
|
+
* Provides a function to forward an existing message to another chat
|
|
8
|
+
* or user using the IM Message Forward API.
|
|
9
|
+
*/
|
|
10
|
+
import { LarkClient } from '../../core/lark-client';
|
|
11
|
+
import { normalizeFeishuTarget, resolveReceiveIdType } from '../../core/targets';
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// forwardMessageFeishu
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
/**
|
|
16
|
+
* Forward an existing message to another chat or user.
|
|
17
|
+
*
|
|
18
|
+
* @param params.cfg - Plugin configuration with Feishu credentials.
|
|
19
|
+
* @param params.messageId - The message ID to forward.
|
|
20
|
+
* @param params.to - Target identifier (chat_id, open_id, or user_id).
|
|
21
|
+
* @param params.accountId - Optional account identifier for multi-account setups.
|
|
22
|
+
* @returns The send result containing the new forwarded message ID.
|
|
23
|
+
*/
|
|
24
|
+
export async function forwardMessageFeishu(params) {
|
|
25
|
+
const { cfg, messageId, to, accountId } = params;
|
|
26
|
+
const client = LarkClient.fromCfg(cfg, accountId).sdk;
|
|
27
|
+
const target = normalizeFeishuTarget(to);
|
|
28
|
+
if (!target) {
|
|
29
|
+
throw new Error(`[feishu-forward] Invalid target: "${to}"`);
|
|
30
|
+
}
|
|
31
|
+
const receiveIdType = resolveReceiveIdType(target);
|
|
32
|
+
const response = await client.im.message.forward({
|
|
33
|
+
path: {
|
|
34
|
+
message_id: messageId,
|
|
35
|
+
},
|
|
36
|
+
params: {
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38
|
+
receive_id_type: receiveIdType,
|
|
39
|
+
},
|
|
40
|
+
data: {
|
|
41
|
+
receive_id: target,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
return {
|
|
45
|
+
messageId: response?.data?.message_id ?? '',
|
|
46
|
+
chatId: response?.data?.chat_id ?? '',
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=forward.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forward.js","sourceRoot":"","sources":["../../../../src/messaging/outbound/forward.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAEjF,8EAA8E;AAC9E,uBAAuB;AACvB,8EAA8E;AAE9E;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,MAK1C;IACC,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IAEjD,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC;IAEtD,MAAM,MAAM,GAAG,qBAAqB,CAAC,EAAE,CAAC,CAAC;IACzC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,qCAAqC,EAAE,GAAG,CAAC,CAAC;IAC9D,CAAC;IAED,MAAM,aAAa,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAEnD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;QAC/C,IAAI,EAAE;YACJ,UAAU,EAAE,SAAS;SACtB;QACD,MAAM,EAAE;YACN,8DAA8D;YAC9D,eAAe,EAAE,aAAoB;SACtC;QACD,IAAI,EAAE;YACJ,UAAU,EAAE,MAAM;SACnB;KACF,CAAC,CAAC;IAEH,OAAO;QACL,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,IAAI,EAAE;QAC3C,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,IAAI,EAAE;KACtC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
export declare function normalizeMediaUrlInput(value: string): string;
|
|
6
|
+
export declare function isWindowsAbsolutePath(value: string): boolean;
|
|
7
|
+
export declare function isLocalMediaPath(value: string): boolean;
|
|
8
|
+
export declare function safeFileUrlToPath(fileUrl: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Validate that a resolved local file path falls under one of the
|
|
11
|
+
* allowed root directories. Prevents path-traversal attacks when
|
|
12
|
+
* the AI or an external payload supplies a local media path.
|
|
13
|
+
*
|
|
14
|
+
* Semantics:
|
|
15
|
+
* - **`undefined`** — caller has not opted in to restriction; the
|
|
16
|
+
* function is a no-op so existing behaviour is preserved. The
|
|
17
|
+
* caller should log a warning independently.
|
|
18
|
+
* - **`[]` (empty array)** — explicitly configured with no allowed
|
|
19
|
+
* roots → all local access is denied.
|
|
20
|
+
* - **Non-empty array** — standard allowlist check.
|
|
21
|
+
*
|
|
22
|
+
* @param filePath - Resolved absolute path to validate.
|
|
23
|
+
* @param localRoots - Allowed root directories.
|
|
24
|
+
* @throws {Error} When the path is not under any allowed root, or
|
|
25
|
+
* when `localRoots` is an empty array.
|
|
26
|
+
*/
|
|
27
|
+
export declare function validateLocalMediaRoots(filePath: string, localRoots: readonly string[] | undefined): void;
|
|
28
|
+
export declare function resolveBaseNameFromPath(value: string): string | undefined;
|
|
29
|
+
export declare function resolveFileNameFromMediaUrl(mediaUrl: string): string | undefined;
|
|
30
|
+
//# sourceMappingURL=media-url-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-url-utils.d.ts","sourceRoot":"","sources":["../../../../src/messaging/outbound/media-url-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAmB5D;AAMD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAGvD;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAOzD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GAAG,IAAI,CAwCzG;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQzE;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAwBhF"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
import * as fs from 'node:fs';
|
|
6
|
+
import * as path from 'node:path';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
export function normalizeMediaUrlInput(value) {
|
|
9
|
+
let raw = value.trim();
|
|
10
|
+
// Common wrappers from markdown/chat payloads.
|
|
11
|
+
if (raw.startsWith('<') && raw.endsWith('>') && raw.length >= 2) {
|
|
12
|
+
raw = raw.slice(1, -1).trim();
|
|
13
|
+
}
|
|
14
|
+
// Strip matching surrounding quotes/backticks.
|
|
15
|
+
const first = raw[0];
|
|
16
|
+
const last = raw[raw.length - 1];
|
|
17
|
+
if (raw.length >= 2 &&
|
|
18
|
+
((first === '"' && last === '"') || (first === "'" && last === "'") || (first === '`' && last === '`'))) {
|
|
19
|
+
raw = raw.slice(1, -1).trim();
|
|
20
|
+
}
|
|
21
|
+
return raw;
|
|
22
|
+
}
|
|
23
|
+
function stripQueryAndHash(value) {
|
|
24
|
+
return value.split(/[?#]/, 1)[0] ?? value;
|
|
25
|
+
}
|
|
26
|
+
export function isWindowsAbsolutePath(value) {
|
|
27
|
+
return /^[A-Za-z]:[\\/]/.test(value) || value.startsWith('\\\\');
|
|
28
|
+
}
|
|
29
|
+
export function isLocalMediaPath(value) {
|
|
30
|
+
const raw = normalizeMediaUrlInput(value);
|
|
31
|
+
return raw.startsWith('file://') || path.isAbsolute(raw) || isWindowsAbsolutePath(raw);
|
|
32
|
+
}
|
|
33
|
+
export function safeFileUrlToPath(fileUrl) {
|
|
34
|
+
const raw = normalizeMediaUrlInput(fileUrl);
|
|
35
|
+
try {
|
|
36
|
+
return fileURLToPath(raw);
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return new URL(raw).pathname;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Validate that a resolved local file path falls under one of the
|
|
44
|
+
* allowed root directories. Prevents path-traversal attacks when
|
|
45
|
+
* the AI or an external payload supplies a local media path.
|
|
46
|
+
*
|
|
47
|
+
* Semantics:
|
|
48
|
+
* - **`undefined`** — caller has not opted in to restriction; the
|
|
49
|
+
* function is a no-op so existing behaviour is preserved. The
|
|
50
|
+
* caller should log a warning independently.
|
|
51
|
+
* - **`[]` (empty array)** — explicitly configured with no allowed
|
|
52
|
+
* roots → all local access is denied.
|
|
53
|
+
* - **Non-empty array** — standard allowlist check.
|
|
54
|
+
*
|
|
55
|
+
* @param filePath - Resolved absolute path to validate.
|
|
56
|
+
* @param localRoots - Allowed root directories.
|
|
57
|
+
* @throws {Error} When the path is not under any allowed root, or
|
|
58
|
+
* when `localRoots` is an empty array.
|
|
59
|
+
*/
|
|
60
|
+
export function validateLocalMediaRoots(filePath, localRoots) {
|
|
61
|
+
// Not configured — skip validation (backwards-compatible).
|
|
62
|
+
if (localRoots === undefined)
|
|
63
|
+
return;
|
|
64
|
+
if (localRoots.length === 0) {
|
|
65
|
+
throw new Error(`[feishu-media] Local file access denied for "${filePath}": ` +
|
|
66
|
+
`mediaLocalRoots is configured as an empty array, which blocks all local access. ` +
|
|
67
|
+
`Add allowed directories to mediaLocalRoots or use a remote URL instead.`);
|
|
68
|
+
}
|
|
69
|
+
// Resolve symlinks to prevent traversal via symlinked paths.
|
|
70
|
+
// Fall back to path.resolve when the file does not exist yet — the
|
|
71
|
+
// subsequent readFileSync will report a clear "file not found" error.
|
|
72
|
+
let resolved;
|
|
73
|
+
try {
|
|
74
|
+
resolved = fs.realpathSync(path.resolve(filePath));
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
resolved = path.resolve(filePath);
|
|
78
|
+
}
|
|
79
|
+
const isAllowed = localRoots.some((root) => {
|
|
80
|
+
let resolvedRoot;
|
|
81
|
+
try {
|
|
82
|
+
resolvedRoot = fs.realpathSync(path.resolve(root));
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
resolvedRoot = path.resolve(root);
|
|
86
|
+
}
|
|
87
|
+
// Must be exactly the root or strictly inside it (with separator).
|
|
88
|
+
return resolved === resolvedRoot || resolved.startsWith(resolvedRoot + path.sep);
|
|
89
|
+
});
|
|
90
|
+
if (!isAllowed) {
|
|
91
|
+
throw new Error(`[feishu-media] Local file access denied for "${filePath}": ` +
|
|
92
|
+
`path is not under any allowed mediaLocalRoots (${localRoots.join(', ')}). ` +
|
|
93
|
+
`Move the file to an allowed directory or use a remote URL instead.`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
export function resolveBaseNameFromPath(value) {
|
|
97
|
+
const raw = normalizeMediaUrlInput(value);
|
|
98
|
+
const cleanPath = stripQueryAndHash(raw);
|
|
99
|
+
const fileName = isWindowsAbsolutePath(cleanPath) ? path.win32.basename(cleanPath) : path.basename(cleanPath);
|
|
100
|
+
if (fileName && fileName !== '/' && fileName !== '.' && fileName !== '\\') {
|
|
101
|
+
return fileName;
|
|
102
|
+
}
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
export function resolveFileNameFromMediaUrl(mediaUrl) {
|
|
106
|
+
const raw = normalizeMediaUrlInput(mediaUrl);
|
|
107
|
+
if (!raw)
|
|
108
|
+
return undefined;
|
|
109
|
+
if (isLocalMediaPath(raw)) {
|
|
110
|
+
if (raw.startsWith('file://')) {
|
|
111
|
+
const fromFileUrlPath = safeFileUrlToPath(raw);
|
|
112
|
+
const fromFileUrlName = resolveBaseNameFromPath(fromFileUrlPath);
|
|
113
|
+
if (fromFileUrlName)
|
|
114
|
+
return fromFileUrlName;
|
|
115
|
+
}
|
|
116
|
+
return resolveBaseNameFromPath(raw);
|
|
117
|
+
}
|
|
118
|
+
try {
|
|
119
|
+
const parsed = new URL(raw);
|
|
120
|
+
if (parsed.protocol === 'http:' || parsed.protocol === 'https:') {
|
|
121
|
+
const fromUrlPath = path.posix.basename(parsed.pathname);
|
|
122
|
+
if (fromUrlPath && fromUrlPath !== '/')
|
|
123
|
+
return fromUrlPath;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
// Not a valid URL. Continue with file path fallback.
|
|
128
|
+
}
|
|
129
|
+
return resolveBaseNameFromPath(raw);
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=media-url-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-url-utils.js","sourceRoot":"","sources":["../../../../src/messaging/outbound/media-url-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,sBAAsB,C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AAG,CAAC,CAAC;YAC/C,MAAM,eAAe,GAAG,uBAAuB,CAAC,eAAe,CAAC,CAAC;YACjE,IAAI,eAAe;gBAAE,OAAO,eAAe,CAAC;QAC9C,CAAC;QACD,OAAO,uBAAuB,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YAChE,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACzD,IAAI,WAAW,IAAI,WAAW,KAAK,GAAG;gBAAE,OAAO,WAAW,CAAC;QAC7D,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,qDAAqD;IACvD,CAAC;IAED,OAAO,uBAAuB,CAAC,GAAG,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*
|
|
5
|
+
* Media handling for the Feishu/Lark channel plugin.
|
|
6
|
+
*
|
|
7
|
+
* Provides functions for downloading images and file resources from
|
|
8
|
+
* Feishu messages, uploading media to the Feishu IM storage, and
|
|
9
|
+
* sending image / file messages to chats.
|
|
10
|
+
*/
|
|
11
|
+
import type { OpenClawConfig } from 'openclaw/plugin-sdk';
|
|
12
|
+
/**
|
|
13
|
+
* Result of downloading an image from Feishu.
|
|
14
|
+
*/
|
|
15
|
+
export interface DownloadImageResult {
|
|
16
|
+
/** The raw image bytes. */
|
|
17
|
+
buffer: Buffer;
|
|
18
|
+
/** The MIME type of the image (e.g. "image/png"), if known. */
|
|
19
|
+
contentType?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Result of downloading a message resource (image or file) from Feishu.
|
|
23
|
+
*/
|
|
24
|
+
export interface DownloadMessageResourceResult {
|
|
25
|
+
/** The raw file bytes. */
|
|
26
|
+
buffer: Buffer;
|
|
27
|
+
/** The MIME type of the resource, if known. */
|
|
28
|
+
contentType?: string;
|
|
29
|
+
/** The original file name, if available. */
|
|
30
|
+
fileName?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Result of uploading an image to Feishu.
|
|
34
|
+
*/
|
|
35
|
+
export interface UploadImageResult {
|
|
36
|
+
/** The image_key assigned by Feishu, used to reference the image. */
|
|
37
|
+
imageKey: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Result of uploading a file to Feishu.
|
|
41
|
+
*/
|
|
42
|
+
export interface UploadFileResult {
|
|
43
|
+
/** The file_key assigned by Feishu, used to reference the file. */
|
|
44
|
+
fileKey: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Result of sending a media (image or file) message.
|
|
48
|
+
*/
|
|
49
|
+
export interface SendMediaResult {
|
|
50
|
+
/** Platform-assigned message ID. */
|
|
51
|
+
messageId: string;
|
|
52
|
+
/** Chat ID where the media was sent. */
|
|
53
|
+
chatId: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Download a resource (image or file) attached to a specific message.
|
|
57
|
+
*
|
|
58
|
+
* @param params.cfg - Plugin configuration.
|
|
59
|
+
* @param params.messageId - The message the resource belongs to.
|
|
60
|
+
* @param params.fileKey - The file_key or image_key of the resource.
|
|
61
|
+
* @param params.type - Whether the resource is an "image" or "file".
|
|
62
|
+
* @param params.accountId - Optional account identifier.
|
|
63
|
+
* @returns The resource buffer, content type, and file name.
|
|
64
|
+
*/
|
|
65
|
+
export declare function downloadMessageResourceFeishu(params: {
|
|
66
|
+
cfg: OpenClawConfig;
|
|
67
|
+
messageId: string;
|
|
68
|
+
fileKey: string;
|
|
69
|
+
type: 'image' | 'file';
|
|
70
|
+
accountId?: string;
|
|
71
|
+
}): Promise<DownloadMessageResourceResult>;
|
|
72
|
+
/**
|
|
73
|
+
* Upload an image to Feishu IM storage.
|
|
74
|
+
*
|
|
75
|
+
* Accepts either a Buffer containing the raw image bytes or a file
|
|
76
|
+
* system path to read from.
|
|
77
|
+
*
|
|
78
|
+
* @param params.cfg - Plugin configuration.
|
|
79
|
+
* @param params.image - A Buffer or local file path for the image.
|
|
80
|
+
* @param params.imageType - The image usage type: "message" (default) or "avatar".
|
|
81
|
+
* @param params.accountId - Optional account identifier.
|
|
82
|
+
* @returns The assigned image_key.
|
|
83
|
+
*/
|
|
84
|
+
export declare function uploadImageLark(params: {
|
|
85
|
+
cfg: OpenClawConfig;
|
|
86
|
+
image: Buffer | string;
|
|
87
|
+
imageType?: 'message' | 'avatar';
|
|
88
|
+
accountId?: string;
|
|
89
|
+
}): Promise<UploadImageResult>;
|
|
90
|
+
/**
|
|
91
|
+
* Upload a file to Feishu IM storage.
|
|
92
|
+
*
|
|
93
|
+
* @param params.cfg - Plugin configuration.
|
|
94
|
+
* @param params.file - A Buffer or local file path.
|
|
95
|
+
* @param params.fileName - The display name of the file.
|
|
96
|
+
* @param params.fileType - Feishu file type: "opus" | "mp4" | "pdf" | "doc" | "xls" | "ppt" | "stream".
|
|
97
|
+
* @param params.duration - Duration in milliseconds (for audio/video files).
|
|
98
|
+
* @param params.accountId - Optional account identifier.
|
|
99
|
+
* @returns The assigned file_key.
|
|
100
|
+
*/
|
|
101
|
+
export declare function uploadFileLark(params: {
|
|
102
|
+
cfg: OpenClawConfig;
|
|
103
|
+
file: Buffer | string;
|
|
104
|
+
fileName: string;
|
|
105
|
+
fileType: 'opus' | 'mp4' | 'pdf' | 'doc' | 'xls' | 'ppt' | 'stream';
|
|
106
|
+
duration?: number;
|
|
107
|
+
accountId?: string;
|
|
108
|
+
}): Promise<UploadFileResult>;
|
|
109
|
+
/**
|
|
110
|
+
* Send an image message to a chat or user.
|
|
111
|
+
*
|
|
112
|
+
* @param params.cfg - Plugin configuration.
|
|
113
|
+
* @param params.to - Target identifier.
|
|
114
|
+
* @param params.imageKey - The image_key from a previous upload.
|
|
115
|
+
* @param params.replyToMessageId - Optional message ID for threaded reply.
|
|
116
|
+
* @param params.replyInThread - When true, reply appears in thread.
|
|
117
|
+
* @param params.accountId - Optional account identifier.
|
|
118
|
+
* @returns The send result.
|
|
119
|
+
*/
|
|
120
|
+
export declare function sendImageLark(params: {
|
|
121
|
+
cfg: OpenClawConfig;
|
|
122
|
+
to: string;
|
|
123
|
+
imageKey: string;
|
|
124
|
+
replyToMessageId?: string;
|
|
125
|
+
replyInThread?: boolean;
|
|
126
|
+
accountId?: string;
|
|
127
|
+
}): Promise<SendMediaResult>;
|
|
128
|
+
/**
|
|
129
|
+
* Send a file message to a chat or user.
|
|
130
|
+
*
|
|
131
|
+
* @param params.cfg - Plugin configuration.
|
|
132
|
+
* @param params.to - Target identifier.
|
|
133
|
+
* @param params.fileKey - The file_key from a previous upload.
|
|
134
|
+
* @param params.replyToMessageId - Optional message ID for threaded reply.
|
|
135
|
+
* @param params.replyInThread - When true, reply appears in thread.
|
|
136
|
+
* @param params.accountId - Optional account identifier.
|
|
137
|
+
* @returns The send result.
|
|
138
|
+
*/
|
|
139
|
+
export declare function sendFileLark(params: {
|
|
140
|
+
cfg: OpenClawConfig;
|
|
141
|
+
to: string;
|
|
142
|
+
fileKey: string;
|
|
143
|
+
replyToMessageId?: string;
|
|
144
|
+
replyInThread?: boolean;
|
|
145
|
+
accountId?: string;
|
|
146
|
+
}): Promise<SendMediaResult>;
|
|
147
|
+
/**
|
|
148
|
+
* Send a video message to a chat or user.
|
|
149
|
+
*
|
|
150
|
+
* Uses `msg_type: "media"` so Feishu renders the message as a playable
|
|
151
|
+
* video instead of a file attachment.
|
|
152
|
+
*
|
|
153
|
+
* @param params.cfg - Plugin configuration.
|
|
154
|
+
* @param params.to - Target identifier.
|
|
155
|
+
* @param params.fileKey - The file_key from a previous upload.
|
|
156
|
+
* @param params.replyToMessageId - Optional message ID for threaded reply.
|
|
157
|
+
* @param params.replyInThread - When true, reply appears in thread.
|
|
158
|
+
* @param params.accountId - Optional account identifier.
|
|
159
|
+
* @returns The send result.
|
|
160
|
+
*/
|
|
161
|
+
export declare function sendVideoLark(params: {
|
|
162
|
+
cfg: OpenClawConfig;
|
|
163
|
+
to: string;
|
|
164
|
+
fileKey: string;
|
|
165
|
+
replyToMessageId?: string;
|
|
166
|
+
replyInThread?: boolean;
|
|
167
|
+
accountId?: string;
|
|
168
|
+
}): Promise<SendMediaResult>;
|
|
169
|
+
/**
|
|
170
|
+
* Send an audio message to a chat or user.
|
|
171
|
+
*
|
|
172
|
+
* Uses `msg_type: "audio"` so Feishu renders the message as a playable
|
|
173
|
+
* voice bubble instead of a file attachment.
|
|
174
|
+
*
|
|
175
|
+
* @param params.cfg - Plugin configuration.
|
|
176
|
+
* @param params.to - Target identifier.
|
|
177
|
+
* @param params.fileKey - The file_key from a previous upload.
|
|
178
|
+
* @param params.replyToMessageId - Optional message ID for threaded reply.
|
|
179
|
+
* @param params.replyInThread - When true, reply appears in thread.
|
|
180
|
+
* @param params.accountId - Optional account identifier.
|
|
181
|
+
* @returns The send result.
|
|
182
|
+
*/
|
|
183
|
+
export declare function sendAudioLark(params: {
|
|
184
|
+
cfg: OpenClawConfig;
|
|
185
|
+
to: string;
|
|
186
|
+
fileKey: string;
|
|
187
|
+
replyToMessageId?: string;
|
|
188
|
+
replyInThread?: boolean;
|
|
189
|
+
accountId?: string;
|
|
190
|
+
}): Promise<SendMediaResult>;
|
|
191
|
+
/**
|
|
192
|
+
* Detect the Feishu file type from a file name extension.
|
|
193
|
+
*
|
|
194
|
+
* Returns one of the Feishu-supported file type strings, or "stream"
|
|
195
|
+
* as a catch-all for unrecognised extensions.
|
|
196
|
+
*
|
|
197
|
+
* @param fileName - The file name (with extension).
|
|
198
|
+
* @returns The detected file type.
|
|
199
|
+
*/
|
|
200
|
+
export declare function detectFileType(fileName: string): 'opus' | 'mp4' | 'pdf' | 'doc' | 'xls' | 'ppt' | 'stream';
|
|
201
|
+
/**
|
|
202
|
+
* Parse the duration (in milliseconds) from an OGG/Opus audio buffer.
|
|
203
|
+
*
|
|
204
|
+
* Scans backward from the end of the buffer to find the last OggS page
|
|
205
|
+
* header, reads the granule position (absolute sample count), and divides
|
|
206
|
+
* by 48 000 (the Opus standard sample rate) then converts to milliseconds.
|
|
207
|
+
*
|
|
208
|
+
* Returns `undefined` when the buffer cannot be parsed (e.g. truncated or
|
|
209
|
+
* not actually OGG). This is intentionally lenient so callers can fall
|
|
210
|
+
* back gracefully.
|
|
211
|
+
*/
|
|
212
|
+
export declare function parseOggOpusDuration(buffer: Buffer): number | undefined;
|
|
213
|
+
/**
|
|
214
|
+
* Parse the duration (in milliseconds) from an MP4 video buffer.
|
|
215
|
+
*
|
|
216
|
+
* Scans top-level boxes to locate the `moov` container, then finds the
|
|
217
|
+
* `mvhd` (Movie Header) box inside it. The `mvhd` box stores:
|
|
218
|
+
* - **timescale**: number of time-units per second
|
|
219
|
+
* - **duration**: total duration in those time-units
|
|
220
|
+
*
|
|
221
|
+
* Supports both version-0 (32-bit fields) and version-1 (64-bit fields)
|
|
222
|
+
* of the `mvhd` box.
|
|
223
|
+
*
|
|
224
|
+
* Returns `undefined` when the buffer cannot be parsed (e.g. truncated,
|
|
225
|
+
* `moov` at end of a huge file not fully buffered, or not actually MP4).
|
|
226
|
+
*/
|
|
227
|
+
export declare function parseMp4Duration(buffer: Buffer): number | undefined;
|
|
228
|
+
/**
|
|
229
|
+
* Upload and send a media file (image or general file) in one step.
|
|
230
|
+
*
|
|
231
|
+
* Accepts either a URL (remote or local `file://`) or a raw Buffer.
|
|
232
|
+
* The function determines whether the media is an image (by extension)
|
|
233
|
+
* and uses the appropriate upload/send path.
|
|
234
|
+
*
|
|
235
|
+
* @param params.cfg - Plugin configuration.
|
|
236
|
+
* @param params.to - Target identifier.
|
|
237
|
+
* @param params.mediaUrl - URL of the media (http/https or local path).
|
|
238
|
+
* @param params.mediaBuffer - Raw bytes of the media (alternative to URL).
|
|
239
|
+
* @param params.fileName - File name (used for type detection and display).
|
|
240
|
+
* @param params.replyToMessageId - Optional message ID for threaded reply.
|
|
241
|
+
* @param params.accountId - Optional account identifier.
|
|
242
|
+
* @returns The send result.
|
|
243
|
+
*/
|
|
244
|
+
export declare function uploadAndSendMediaLark(params: {
|
|
245
|
+
cfg: OpenClawConfig;
|
|
246
|
+
to: string;
|
|
247
|
+
mediaUrl?: string;
|
|
248
|
+
mediaBuffer?: Buffer;
|
|
249
|
+
fileName?: string;
|
|
250
|
+
replyToMessageId?: string;
|
|
251
|
+
replyInThread?: boolean;
|
|
252
|
+
accountId?: string;
|
|
253
|
+
/** Allowed root directories for local file access (SSRF prevention). */
|
|
254
|
+
mediaLocalRoots?: readonly string[];
|
|
255
|
+
}): Promise<SendMediaResult>;
|
|
256
|
+
//# sourceMappingURL=media.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../../src/messaging/outbound/media.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAUH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAkB1D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,2BAA2B;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,gB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