Feat/cross bot mention#358
Open
Maschera96 wants to merge 3 commits into
Open
Conversation
- reply-dispatcher 中提取文本内联 <at> 标签为 MentionInfo 传给 sendMessageFeishu - sendMessageFeishu 跳过已在文本中的 mentions 避免重复追加 - cross-bot trigger 使用真实飞书消息 ID 替代合成 ID,修复 API 400 错误 - 修复合成事件 mentions 指向目标 bot(非发送者 bot) - 修复 create_time 时间戳单位(秒→毫秒),避免消息被判定为过期 - 添加 dev watch 模式脚本 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Naois seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
实现跨 Bot @提及功能,允许同一插件实例中的 Bot A 在消息中 @提及 Bot B,从而触发 Bot B 的消息处理流程。
飞书平台存在限制:Bot 无法看到其他 Bot 发送的消息。本 PR 通过合成消息事件(synthetic message event)的方式绕过此限制——当 Bot A 发送包含 @bot B 的消息时,在本地直接调用 Bot B 的
im.message.receive_v1 处理器。
核心变更:
新增/修改文件(11 个,+479/-21):
┌────────────────────────────────────┬───────────────────────────────────────────────────┐
│ 文件 │ 说明 │
├────────────────────────────────────┼───────────────────────────────────────────────────┤
│ src/messaging/cross-bot/trigger.ts │ 跨 Bot 触发核心逻辑 │
├────────────────────────────────────┼───────────────────────────────────────────────────┤
│ src/messaging/cross-bot/index.ts │ 模块导出 │
├────────────────────────────────────┼───────────────────────────────────────────────────┤
│ src/messaging/inbound/mention.ts │ 新增 extractAtMentionsFromText 解析内联 标签 │
├────────────────────────────────────┼───────────────────────────────────────────────────┤
│ src/messaging/outbound/send.ts │ 发送后检测并触发跨 Bot 消息 │
├────────────────────────────────────┼───────────────────────────────────────────────────┤
│ src/core/lark-client.ts │ Bot 注册表(open_id / name / handlers) │
├────────────────────────────────────┼───────────────────────────────────────────────────┤
│ src/card/reply-dispatcher.ts │ 提取 mentions 并传递给发送函数 │
├────────────────────────────────────┼───────────────────────────────────────────────────┤
│ src/channel/monitor.ts │ 注册 handlers 到 LarkClient │
├────────────────────────────────────┼───────────────────────────────────────────────────┤
│ src/channel/event-handlers.ts │ 合成消息跳过 app_id 校验 │
├────────────────────────────────────┼───────────────────────────────────────────────────┤
│ src/tools/list-bots.ts │ 新工具:列出所有已注册 Bot │
├────────────────────────────────────┼───────────────────────────────────────────────────┤
│ index.ts │ 注册 feishu_list_bots 工具 │
├────────────────────────────────────┼───────────────────────────────────────────────────┤
│ package.json │ 新增 dev script(tsdown --watch) │
└────────────────────────────────────┴───────────────────────────────────────────────────┘
Test plan