Skip to content

feat: 合并工具调用+文本+结果为单一卡片,简化飞书卡片体验 - #223

Merged
lishuceo merged 8 commits into
mainfrom
feat/combined-progress-card
Apr 9, 2026
Merged

feat: 合并工具调用+文本+结果为单一卡片,简化飞书卡片体验#223
lishuceo merged 8 commits into
mainfrom
feat/combined-progress-card

Conversation

@lishuceo

@lishuceo lishuceo commented Apr 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • 将执行中的工具调用卡片、文本输出卡片、完成结果卡片合并为一张卡片,一张卡片走完整个生命周期(处理中→执行中→完成)
  • 工具调用收入折叠面板,标题栏显示计数+最新 tool call 作为实时状态指示器
  • 移除卡片 header,仅通过底部状态栏展示状态、耗时和花费,更简洁
  • 修复 setup_workspace 提示词:放宽触发条件鼓励积极推断,允许进错仓库后纠正

Test plan

  • npx vitest run 全部通过(63 个 message-builder 测试)
  • 飞书端发送指令,观察执行中卡片文本+折叠面板同时展示
  • 完成后卡片原地更新为成功/失败状态,无额外 result card
  • 测试 setup_workspace 积极推断行为

🤖 Generated with Claude Code

@claude

claude Bot commented Apr 9, 2026

Copy link
Copy Markdown

PR Review: feat: 合并工具调用+文本+结果为单一卡片

  • Check for previous review comments
  • Read changed files and understand context
  • Review src/claude/executor.ts
  • Review src/feishu/event-handler.ts
  • Review src/feishu/message-builder.ts
  • Review src/feishu/__tests__/message-builder.test.ts
  • Post inline comments for issues found
  • Post summary verdict

View job run

lishuceo and others added 6 commits April 9, 2026 21:58
- 新增 buildCombinedProgressCard,文本直接展示,工具调用收入折叠面板
- 执行中:折叠面板标题显示计数+最新 tool call,充当实时状态指示器
- 完成后:工具调用始终折叠,文本条件折叠(长文本时)
- event-handler 删除独立文本卡片逻辑,统一维护单一卡片 ID
- conditionalCollapsible 支持 summaryLines/alwaysFold/showSummaryHeader 选项

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- buildCombinedProgressCard 新增 CombinedCardResult 参数
- 完成时原地更新为成功(绿)/失败(红)/超时(橙)状态
- Header/footer 显示状态、耗时和花费
- thread 模式不再新发 result card,非 thread 模式降级不变

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
状态信息已在底部状态栏展示,header 不再重复显示执行状态,
仅通过颜色区分:蓝(执行中)/绿(成功)/红(失败)/橙(超时)/靛(活动记录)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
去掉卡片顶部 header 和颜色条,卡片更简洁,状态通过底部 note 展示

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
原 prompt 中"不要猜测"过于保守,导致 agent 即使能从上下文明显
推断出唯一仓库也不敢主动 setup_workspace。改为仅在确实存在多个
同等可能候选时才询问用户。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- "绝对不要切换工作区" 改为 "不要对当前仓库重复调用"
- restart 模式下补充 setup_workspace 可用提示,允许跨仓库切换

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@lishuceo
lishuceo force-pushed the feat/combined-progress-card branch from b61a5bc to 283f37f Compare April 9, 2026 13:58
@claude

claude Bot commented Apr 9, 2026

Copy link
Copy Markdown

Claude finished @lishuceo's task in 3m 19s —— View job


PR Review: feat: 合并工具调用+文本+结果为单一卡片

  • Check for previous review comments
  • Read changed files and understand context
  • Review src/claude/executor.ts
  • Review src/feishu/event-handler.ts
  • Review src/feishu/message-builder.ts
  • Review src/feishu/__tests__/message-builder.test.ts
  • Post inline comments for issues found
  • Post summary verdict

Verdict: ⚠️ Issues Found

1 issue found:

  • 🟡 Markdown in plain_text panel title (confidence: 85) — formatToolCall() returns markdown (**Read**, `cmd`), but the collapsible panel header uses plain_text tag, so users see raw ** and backticks in the title during execution. See inline comment.

Overall Assessment

Clean, well-structured PR. The single-card lifecycle approach (buildCombinedProgressCard) is a solid simplification — removing the separate text card and result card reduces both code complexity and the number of Feishu API calls. Key observations:

  • event-handler.ts: The refactor correctly handles all three completion paths (normal, restart, error) with the combined card. The else branches properly fall back to sendResultCard when no progress card exists. The duplicated allToolCalls / appendText(pendingTurn) pattern across 4 call sites is a bit repetitive but acceptable given each site has different result construction.
  • message-builder.ts: buildCombinedProgressCard is well-organized with clear sections (text → tools → error → footer). The conditionalCollapsible options extension (alwaysFold, summaryLines, showSummaryHeader) is a clean generalization.
  • executor.ts: The setup_workspace prompt changes (relaxed matching, allow re-switch after restart) are reasonable and independent from the card changes.
  • Tests: Good coverage of the new combined card function with 10 test cases covering all major states.

Comment thread src/feishu/message-builder.ts
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@claude

claude Bot commented Apr 9, 2026

Copy link
Copy Markdown

Claude finished @lishuceo's task in 1m 59s —— View job


PR Review: feat: 合并工具调用+文本+结果为单一卡片

  • Check and resolve previous review comments
  • Read changed files and review current diff
  • Review src/claude/executor.ts
  • Review src/feishu/message-builder.ts
  • Review src/feishu/event-handler.ts
  • Review src/feishu/__tests__/message-builder.test.ts
  • Post summary verdict

Verdict: ⚠️ Issues Found

1 previous issue still unresolved:

  • 🟡 Markdown in plain_text panel title (confidence: 85) — formatToolCall() returns markdown (**Read**, `cmd`), but the collapsible panel header at message-builder.ts:722 uses { tag: 'plain_text', ... }. Users will see raw ** and backticks in the panel title during execution. See original comment. Fix this →

No new issues found in this push.

Overall Assessment

Clean, well-structured PR. The single-card lifecycle approach (buildCombinedProgressCard) is a solid simplification — removing the separate text card and result card reduces both code complexity and Feishu API calls. Key observations:

  • event-handler.ts: All four completion paths (restart dir-not-exist, restart success, normal, error) correctly handle the combined card with proper else fallbacks to sendResultCard/text error when no progress card exists. The removal of textCardMsgId/flushTextCard is clean.
  • message-builder.ts: buildCombinedProgressCard is well-organized (text → tools → error → footer). The conditionalCollapsible options extension (alwaysFold, summaryLines, showSummaryHeader) is a clean generalization.
  • executor.ts: The setup_workspace prompt changes (relaxed matching, allow re-switch after restart) are reasonable and independent from the card changes.
  • Tests: Good coverage with 11 new test cases covering all major states (in-progress, completed, empty, success/failure/timeout, size limits).

Note: Unable to run npx vitest run due to sandbox permission restrictions on this CI run. The test code looks correct from static review.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@claude

claude Bot commented Apr 9, 2026

Copy link
Copy Markdown

Claude finished @lishuceo's task in 2m 0s —— View job


PR Review: feat: 合并工具调用+文本+结果为单一卡片

  • Check and resolve previous review comments
  • Read changed files and review current diff
  • Review src/claude/executor.ts
  • Review src/feishu/message-builder.ts
  • Review src/feishu/event-handler.ts
  • Review src/feishu/__tests__/message-builder.test.ts
  • Run tests (sandbox permissions blocked npx vitest run)
  • Post summary verdict

Verdict: ✅ Approved

1 previous issue fixed: markdown in plain_text panel title (commit d64e7bb) — ✅ resolved and conversation thread replied.

No new issues found (confidence ≥ 75) in this push.

Overall Assessment

Clean, well-structured PR. The single-card lifecycle (buildCombinedProgressCard) is a solid simplification — removing the separate text card and result card reduces both code complexity and Feishu API calls.

  • executor.ts: The setup_workspace prompt changes (relaxed matching for high-confidence inference, allow re-switch after restart via switchNote) are reasonable and independent from the card changes.
  • message-builder.ts: buildCombinedProgressCard is well-organized with clear sections (text → tools → error → footer). The conditionalCollapsible options extension (alwaysFold, summaryLines, showSummaryHeader) is a clean generalization. The markdown-stripping fix on the panel title is correct.
  • event-handler.ts: All four completion paths (restart dir-not-exist, restart success, normal, error) correctly handle the combined card with proper else fallbacks to sendResultCard/text error when no progress card exists. Clean removal of textCardMsgId/flushTextCard. The duplicated allToolCalls / appendText(pendingTurn) pattern across 4 call sites is repetitive but acceptable — each site has different result construction logic.
  • Tests: Good coverage with 11 new test cases covering all major states (in-progress, completed, empty, success/failure/timeout, size limits, collapsed completion).

Note: Unable to run npx vitest run due to sandbox permission restrictions on this CI run. The test code looks correct from static review.

@lishuceo
lishuceo merged commit 427e903 into main Apr 9, 2026
8 checks passed
@lishuceo
lishuceo deleted the feat/combined-progress-card branch April 9, 2026 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant