feat(feishu): interactive approval and question cards with buttons

Render Harness approval and single-choice question interactions as
interactive Feishu cards with approve/reject and answer buttons,
matching the already-available interactionCards behaviour. Cards are now
the default; set DSH_IM_INTERACTION_CARDS=0 (or interactionCards=false)
to keep the plain-text reply flow.

- bridge.mjs: approve:/reject:/answer: card actions, interactionCards
  option, gated approval render hook, interactive question presentation,
  and operationArguments/printableText helpers; refactor the inline
  question answer into #submitQuestionAnswer so both text replies and
  card buttons share one path.
- feishu-cards.mjs: approvalCard (approve/reject) and questionCard
  (option buttons) templates.
- feishu-runtime.mjs: default interactionCards from env (on).
- harness-approval.mjs: optional channel render hook + submitByApprovalId.
- i18n-en: add the new card t() keys.
- Tests: pin the plain-text reply flow in state-machine suites that
  drive it, and add dedicated card tests for the default approve/reject,
  answer buttons, and the text fallback. Full suite shows no new
  failures versus upstream.
This commit is contained in:
C3H3-AI 2026-09-01 16:43:36 +08:00
parent c2be2389b0
commit 0b42ea9889
8 changed files with 778 additions and 212 deletions

View file

@ -356,4 +356,15 @@ export default {
'⚠️ Repair verification failed: the dedicated test card could not be sent, so card.action.trigger cannot be confirmed restored. Do not authorize again; check the bot message permission and connection status first.',
'⚠️ 修复验证中断:Runtime 已停止,未完成 card.action.trigger 实测,不能确认修复成功。请不要重复授权;先等待机器人恢复连接。':
'⚠️ Repair verification interrupted: the Runtime stopped before the card.action.trigger test completed, so the repair cannot be confirmed. Do not authorize again; wait for the bot to reconnect.',
// feishu/bridge.mjs — interaction cards (approve/reject / answer buttons)
'该审批已处理或不存在,无需重复操作。':
'This approval has already been processed or does not exist; no need to repeat the action.',
// feishu/feishu-cards.mjs — approval card
'操作参数:\n{operation}': 'Operation parameters:\n{operation}',
'✅ 批准': '✅ Approve',
'❌ 拒绝': '❌ Reject',
'🔐 工具审批': '🔐 Tool approval',
// feishu/feishu-cards.mjs — question card
'❓ 请补充信息{progress}': '❓ Please provide more information{progress}',
};