Files
codewhale/crates
Hu Qiantao ea7dffa59d feat: show intent summary before file approval prompt (#2381)
When the model invokes write/modify/delete tools, extract its preceding
text content as an 'intent summary' and pass it to the approval view.
This gives users context about why a change is being made before they
review what will change.

Changes:
- Add intent_summary field to ApprovalRequired event (events.rs)
- Extract model text from current_text_visible when write tools
  are detected in the turn loop (turn_loop.rs)
- Add ApprovalRequest::new_with_intent constructor with
  intent_summary parameter (approval.rs)
- Pass intent_summary through TUI event handler to approval view
  (ui.rs)
- Render intent summary in approval widget: up to 3 lines of the
  model explanation, truncated to available card width, with
  i18n labels for zh-Hans locale (widgets/mod.rs)
- Adapt existing tests to new event field (runtime_threads.rs,
  ui/tests.rs)

Design decisions:
- Non-blocking: if the model provides no explanation, the approval
  still proceeds normally (no extra round-trip or token cost)
- Backward compatible: YOLO mode and approval cache unaffected
- The new() constructor is gated behind #[cfg(test)] since
  production code now uses new_with_intent()
2026-05-31 14:56:52 +08:00
..
2026-05-30 22:16:01 -07:00
2026-05-30 22:16:01 -07:00
2026-05-30 22:16:01 -07:00
2026-05-26 11:52:48 -05:00
2026-05-30 22:16:01 -07:00