fix: render AskUserQuestion as interactive card in Feishu bridge#282
Open
xuanxuan321 wants to merge 3 commits intoop7418:mainfrom
Open
fix: render AskUserQuestion as interactive card in Feishu bridge#282xuanxuan321 wants to merge 3 commits intoop7418:mainfrom
xuanxuan321 wants to merge 3 commits intoop7418:mainfrom
Conversation
Fixes op7418#278. Previously AskUserQuestion was rendered as a generic "Permission Required" card showing raw JSON with Allow/Deny buttons. Now it renders as an interactive question form matching the PC client UX. **permission-broker.ts:** - Detect AskUserQuestion in forwardPermissionRequest and build a dedicated card with question text and option buttons - Extract validateAndClaimLink() shared helper to deduplicate validation logic between perm: and ask: callback handlers - Add handleAskUserQuestionCallback to resolve with updatedInput matching the PC UI format ({ questions, answers }) - Use existing getPermissionRequest() helper instead of raw SQL **outbound.ts (Feishu):** - Detect ask: card type with indigo "Question" header - Use flex_mode:"flow" layout for horizontal option buttons - Keep option buttons as default style (no color tinting) **bridge-manager.ts:** - Skip "Permission response recorded." confirmation message for AskUserQuestion callbacks (selections are self-explanatory) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@renoschubert is attempting to deploy a commit to the op7418's projects Team on Vercel. A member of the Team first needs to authorize 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.
摘要
修复了 #278
• 之前 Feishu 中的 AskUserQuestion 会被渲染成通用的“Permission Required”卡片,并显示原始 JSON。现在会渲染为交互式问题表单,包含标题、问题文本和选项按钮,与 PC 客户端 UX 保持一致。
• 抽取共享的 validateAndClaimLink() 辅助函数,用于去重 perm: 和 ask: 回调处理器之间的校验逻辑。
• 对 AskUserQuestion 回调,跳过显示“Permission response recorded.”确认消息。
变更内容
permission-broker.ts
• 在 forwardPermissionRequest 中检测 AskUserQuestion,并构建带选项按钮的专用卡片
• 新增 buildAskUserQuestionMessage(),用于渲染问题卡片
• 新增 handleAskUserQuestionCallback(),以与 PC UI 格式一致的 updatedInput 进行响应
• 抽取共享的 validateAndClaimLink() 辅助函数(此前两个处理器中存在重复逻辑)
• 使用现有的 getPermissionRequest() 辅助函数,替代原始 SQL
outbound.ts(Feishu)
• 检测 ask: 卡片类型,并使用靛蓝色的“Question”标题
• 使用 flex_mode: "flow" 布局,使选项按钮水平排列
bridge-manager.ts
• 对 ask: 回调跳过确认消息发送
备注
Feishu 应用需要在开发者控制台中订阅 card.action.trigger 回调(路径:Events & Callbacks → Callback Configuration),这样卡片按钮点击才能正常工作。这个要求适用于所有交互式卡片,不仅仅是此次改动。
测试计划
• 通过 Feishu bridge 触发 AskUserQuestion → 验证卡片能正确渲染问题文本和选项按钮
• 点击某个选项按钮 → 验证答案会被成功提交,Claude 会根据所选选项继续执行
• 验证选择后不会出现“Permission response recorded.”消息
• 验证现有的 Permission 卡片(Allow/Deny)仍能正常工作