Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Only write entries that are worth mentioning to users.

## Unreleased

- Shell: Simplify input prompt by removing username prefix for a cleaner appearance
- Shell: Add horizontal separator line and expanded keyboard shortcut hints to the toolbar
- Shell: Add number key shortcuts (1–5) for quick option selection in question and approval panels, with redesigned bordered panel UI and keyboard hints
- Shell: Add tab-style navigation for multi-question panels — use Left/Right arrows or Tab to switch between questions, with visual indicators for answered, current, and pending states, and automatic state restoration when revisiting a question
- Shell: Allow Space key to submit single-select questions in the question panel
Expand Down
2 changes: 2 additions & 0 deletions docs/en/release-notes/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ This page documents the changes in each Kimi Code CLI release.

## Unreleased

- Shell: Simplify input prompt by removing username prefix for a cleaner appearance
- Shell: Add horizontal separator line and expanded keyboard shortcut hints to the toolbar
- Shell: Add number key shortcuts (1–5) for quick option selection in question and approval panels, with redesigned bordered panel UI and keyboard hints
- Shell: Add tab-style navigation for multi-question panels — use Left/Right arrows or Tab to switch between questions, with visual indicators for answered, current, and pending states, and automatic state restoration when revisiting a question
- Shell: Allow Space key to submit single-select questions in the question panel
Expand Down
2 changes: 2 additions & 0 deletions docs/zh/release-notes/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

## 未发布

- Shell:精简输入提示符,移除用户名前缀以获得更简洁的外观
- Shell:在工具栏中添加水平分隔线和更完整的键盘快捷键提示
- Shell:为问题面板和审批面板添加数字键(1–5)快速选择选项,并以带边框的面板和键盘提示重新设计交互界面
- Shell:为多问题面板添加标签式导航——使用左右方向键或 Tab 键在问题间切换,并以可视化指示器区分已答、当前和待答状态,重新访问已答问题时自动恢复选择状态
- Shell:在问题面板中支持使用空格键提交单选问题
Expand Down
1 change: 1 addition & 0 deletions src/kimi_cli/ui/shell/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ async def run(self, command: str | None = None) -> bool:
continue

await self.run_soul_command(user_input.content)
console.print()
finally:
ensure_tty_sane()

Expand Down
25 changes: 16 additions & 9 deletions src/kimi_cli/ui/shell/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import asyncio
import base64
import getpass
import json
import mimetypes
import os
Expand Down Expand Up @@ -742,10 +741,10 @@ def _(buffer: Buffer) -> None:
self._status_refresh_task: asyncio.Task[None] | None = None

def _render_message(self) -> FormattedText:
symbol = PROMPT_SYMBOL if self._mode == PromptMode.AGENT else PROMPT_SYMBOL_SHELL
if self._mode == PromptMode.AGENT and self._thinking:
symbol = PROMPT_SYMBOL_THINKING
return FormattedText([("bold", f"{getpass.getuser()}@{KaosPath.cwd().name}{symbol} ")])
if self._mode == PromptMode.SHELL:
return FormattedText([("bold", f"{PROMPT_SYMBOL_SHELL} ")])
symbol = PROMPT_SYMBOL_THINKING if self._thinking else PROMPT_SYMBOL
return FormattedText([("", f"{symbol} ")])

def _apply_mode(self, event: KeyPressEvent | None = None) -> None:
# Apply mode to the active buffer (not the PromptSession itself)
Expand Down Expand Up @@ -883,6 +882,9 @@ def _render_bottom_toolbar(self) -> FormattedText:

fragments: list[tuple[str, str]] = []

fragments.append(("fg:#4d4d4d", "─" * columns))
fragments.append(("", "\n"))

now_text = datetime.now().strftime("%H:%M")
fragments.extend([("", now_text), ("", " " * 2)])
columns -= len(now_text) + 2
Expand Down Expand Up @@ -912,10 +914,15 @@ def _render_bottom_toolbar(self) -> FormattedText:
if current_toast_left.duration <= 0.0:
_toast_queues["left"].popleft()
else:
shortcuts = "ctrl-x: toggle mode"
if columns - len(right_text) > len(shortcuts) + 2:
fragments.extend([("", shortcuts), ("", " " * 2)])
columns -= len(shortcuts) + 2
shortcut_candidates = [
"ctrl-x: toggle mode | ctrl-j / alt-enter: newline",
"ctrl-j / alt-enter: newline",
]
for shortcuts in shortcut_candidates:
if columns - len(right_text) > len(shortcuts) + 2:
fragments.extend([("", shortcuts), ("", " " * 2)])
columns -= len(shortcuts) + 2
break

padding = max(1, columns - len(right_text))
fragments.append(("", " " * padding))
Expand Down
3 changes: 1 addition & 2 deletions src/kimi_cli/ui/shell/replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import asyncio
import contextlib
import getpass
from collections import deque
from collections.abc import Sequence
from dataclasses import dataclass
Expand Down Expand Up @@ -63,7 +62,7 @@ async def replay_recent_history(

for turn in turns:
wire = Wire()
console.print(f"{getpass.getuser()}{PROMPT_SYMBOL} {message_stringify(turn.user_message)}")
console.print(f"{PROMPT_SYMBOL} {message_stringify(turn.user_message)}")
ui_task = asyncio.create_task(
visualize(wire.ui_side(merge=False), initial_status=StatusUpdate())
)
Expand Down
9 changes: 1 addition & 8 deletions src/kimi_cli/ui/shell/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from typing import Any, NamedTuple, cast

import streamingjson # type: ignore[reportMissingTypeStubs]
from kosong.message import Message
from kosong.tooling import ToolError, ToolOk
from rich.console import Group, RenderableType
from rich.live import Live
Expand All @@ -25,7 +24,6 @@
from kimi_cli.utils.aioqueue import QueueShutDown
from kimi_cli.utils.diff import format_unified_diff
from kimi_cli.utils.logging import logger
from kimi_cli.utils.message import message_stringify
from kimi_cli.utils.rich.columns import BulletColumns
from kimi_cli.utils.rich.markdown import Markdown
from kimi_cli.utils.rich.syntax import KimiSyntax
Expand Down Expand Up @@ -867,6 +865,7 @@ def compose(self) -> RenderableType:
blocks.append(self._current_approval_request_panel.render())
if self._current_question_panel:
blocks.append(self._current_question_panel.render())

blocks.append(self._status_block.render())
return Group(*blocks)

Expand All @@ -888,12 +887,6 @@ def dispatch_wire_message(self, msg: WireMessage) -> None:
match msg:
case TurnBegin():
self.flush_content()
console.print(
Panel(
Text(message_stringify(Message(role="user", content=msg.user_input))),
padding=(0, 1),
)
)
case TurnEnd():
pass
case CompactionBegin():
Expand Down
Loading