kimi-code/packages/agent-core
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
..
src fix(approval): show file content/diff and open full-screen preview on ctrl+e (#139) 2026-05-28 13:22:33 +08:00
test fix(approval): show file content/diff and open full-screen preview on ctrl+e (#139) 2026-05-28 13:22:33 +08:00
CHANGELOG.md ci: release packages (#93) 2026-05-27 22:50:19 +08:00
package.json ci: release packages (#93) 2026-05-27 22:50:19 +08:00
README.md Kimi For Coding 2026-05-22 15:54:50 +08:00
tsconfig.json Kimi For Coding 2026-05-22 15:54:50 +08:00
tsdown.config.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
vitest.config.ts Kimi For Coding 2026-05-22 15:54:50 +08:00

@moonshot-ai/agent-core

The unified agent engine for Kimi Code.

Part of the Kimi Code monorepo.

See the main repository for documentation, issues, and contribution guidelines.

License

MIT