kimi-code/packages/agent-core/test/tools
liruifengv 50251a1360
fix(approval): show file content/diff and open full-screen preview on ctrl+e (#139)
* fix(approval): include file content and diff in approval display

After #26 the WriteTool/EditTool input display was reduced to
`{kind: 'file_io', operation, path}`, dropping the args carried by the
previous generic fallback. The approval panel then only had a path to
show — no file content for Write, no diff hunk for Edit — and ctrl+e
expanded to the same one-liner.

Extend the file_io display with optional `content` / `before` / `after`
fields so Write can attach its full content and Edit can attach its
old_string/new_string hunk. The adapter promotes file_io+content to a
file_content block and file_io+before/after to a diff block, matching
what the panel renders for the legacy generic-fallback path.

* feat(tui): open full-screen viewer for approval previews

Inline ctrl+e expand-in-place inflated the approval panel past one
viewport for any non-trivial Edit / Write, which collided with pi-tui's
inline differential renderer and the terminal's "snap to bottom on
stdout" reflex: scrolling back glitched and the screen flickered. On
top of that, the diff renderer's O(m·n) LCS DP ran every frame the
panel was visible, so each spinner tick re-paid the cost.

Make ctrl+e hand off to a dedicated full-screen viewer instead. The
viewer renders all body lines once at construction and slices them on
scroll, so per-frame cost is O(viewport) regardless of payload size.
It uses the same nested-takeover pattern as TaskOutputViewer; the
approval panel instance is preserved and refocused on close so the
selection / feedback state survives.

The panel itself drops its local `expanded` toggle and always renders
the compact cluster view; ctrl+e now exclusively forwards to the host
when there is something to preview, and falls through to the existing
plan-expand toggle otherwise.

* chore(changeset): restore approval previews
2026-05-28 13:22:33 +08:00
..
background refactor: unify path normalization with pathe (#84) 2026-05-27 11:53:24 +08:00
fixtures feat: rework permission decision policies (#26) 2026-05-27 20:07:24 +08:00
planning feat: rework permission decision policies (#26) 2026-05-27 20:07:24 +08:00
policies feat: rework permission decision policies (#26) 2026-05-27 20:07:24 +08:00
providers Kimi For Coding 2026-05-22 15:54:50 +08:00
agent.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
ask-user.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
bash-env.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
bash-windows-kill.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
bash.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
builtin-current.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
edit.test.ts fix(approval): show file content/diff and open full-screen preview on ctrl+e (#139) 2026-05-28 13:22:33 +08:00
enter-plan-mode.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
exit-plan-mode-options.test.ts feat: rework permission decision policies (#26) 2026-05-27 20:07:24 +08:00
exit-plan-mode.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
fetch-url.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
file-type.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
glob.test.ts refactor: unify path normalization with pathe (#84) 2026-05-27 11:53:24 +08:00
grep.test.ts refactor: unify path normalization with pathe (#84) 2026-05-27 11:53:24 +08:00
input-schema-io.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
list-directory.test.ts refactor: unify path normalization with pathe (#84) 2026-05-27 11:53:24 +08:00
path-guard.test.ts feat: rework permission decision policies (#26) 2026-05-27 20:07:24 +08:00
plan-mode-hard-block.test.ts feat: rework permission decision policies (#26) 2026-05-27 20:07:24 +08:00
read-file.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
read-media-desc.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
read-media.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
read.test.ts feat: rework permission decision policies (#26) 2026-05-27 20:07:24 +08:00
result-builder.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
rg-locator.test.ts refactor: unify path normalization with pathe (#84) 2026-05-27 11:53:24 +08:00
shell-cancel.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
shell-quoting.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
skill-tool-dispatch.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
skill-tool.test.ts feat: add plugin manager and official plugins (#119) 2026-05-27 22:47:33 +08:00
todo-list.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
web-search.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
write.test.ts fix(approval): show file content/diff and open full-screen preview on ctrl+e (#139) 2026-05-28 13:22:33 +08:00