Skip to content
Open
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Only write entries that are worth mentioning to users.

## Unreleased

- Core: Add `skip_yolo_prompt_injection` config option to suppress the system reminder normally injected when yolo mode is active — useful when building custom applications on top of `KimiSoul` that do not need the non-interactive mode hint
- Shell: Error hints now include the specific session ID in the `kimi export` command and surface the direct support email address `code@moonshot.ai`
Comment thread
kermanx marked this conversation as resolved.
- Core: Add `skip_yolo_prompt_injection` config option to suppress the system reminder normally injected when yolo mode is active — useful when building custom applications on top of `KimiSoul` that do not need the reminder
- Kimi: Add `KIMI_MODEL_THINKING_KEEP` environment variable that forwards its value verbatim to the Moonshot API as `thinking.keep`, enabling Preserved Thinking (e.g. `export KIMI_MODEL_THINKING_KEEP=all` to retain historical `reasoning_content` across turns); effective only for Moonshot models supporting Preserved Thinking (e.g. `kimi-k2.6` / `kimi-k2-thinking`), unset or empty string preserves the previous behavior and omits the field, and the override only applies when the current model is actually in thinking mode so the API never receives a `thinking.keep` without the companion `thinking.type`. Note that `keep=all` increases input tokens and API cost because history reasoning is resent
- Kosong: Fix `Kimi.with_extra_body` silently dropping previously set `thinking.type` when a later call added another `thinking.*` field — the `thinking` sub-dict is now merged field-by-field instead of shallow-replaced, so composing `with_thinking(...)` with `with_extra_body({"thinking": {...}})` preserves both contributions
- Shell: Fix approval request feedback text cursor rendering — the block cursor now correctly renders at the actual cursor position instead of always being pinned to the end of the line; when the cursor is in the middle of the text, the character under the cursor is drawn with reverse video (mimicking a terminal's native block cursor)
Expand Down
1 change: 1 addition & 0 deletions docs/en/release-notes/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ This page documents the changes in each Kimi Code CLI release.

## Unreleased

- Shell: Error hints now include the specific session ID in the `kimi export` command and surface the direct support email address `code@moonshot.ai`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Manual edit of auto-generated English changelog violates docs/AGENTS.md rule

The docs/AGENTS.md file explicitly states: "The English changelog (docs/en/release-notes/changelog.md) is auto-generated from the root CHANGELOG.md. Do not edit it manually." This PR manually edits docs/en/release-notes/changelog.md (adding the new Shell error-hint entry at line 7), which violates that rule. The root CHANGELOG.md already contains the same entry, so the sync script (npm run sync) would produce the correct output — the manual edit should be removed and the sync script relied upon instead.

Prompt for agents
The file docs/en/release-notes/changelog.md should not be manually edited according to docs/AGENTS.md. Instead, only the root CHANGELOG.md should be edited, and then the sync script (npm run sync from the docs/ directory) should be run to auto-generate this file. Revert the manual changes to docs/en/release-notes/changelog.md and rely on the sync script to propagate the entry from CHANGELOG.md.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

- Core: Add `skip_yolo_prompt_injection` config option to suppress the system reminder normally injected when yolo mode is active — useful when building custom applications on top of `KimiSoul` that do not need the non-interactive mode hint
- Kimi: Add `KIMI_MODEL_THINKING_KEEP` environment variable that forwards its value verbatim to the Moonshot API as `thinking.keep`, enabling Preserved Thinking (e.g. `export KIMI_MODEL_THINKING_KEEP=all` to retain historical `reasoning_content` across turns); effective only for Moonshot models supporting Preserved Thinking (e.g. `kimi-k2.6` / `kimi-k2-thinking`), unset or empty string preserves the previous behavior and omits the field, and the override only applies when the current model is actually in thinking mode so the API never receives a `thinking.keep` without the companion `thinking.type`. Note that `keep=all` increases input tokens and API cost because history reasoning is resent
- Kosong: Fix `Kimi.with_extra_body` silently dropping previously set `thinking.type` when a later call added another `thinking.*` field — the `thinking` sub-dict is now merged field-by-field instead of shallow-replaced, so composing `with_thinking(...)` with `with_extra_body({"thinking": {...}})` preserves both contributions
Expand Down
1 change: 1 addition & 0 deletions docs/zh/release-notes/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

## 未发布

- Shell:错误提示中的 `kimi export` 命令现在会附带具体的会话 ID,并直接展示支持邮箱 `code@moonshot.ai`
- Core:新增 `skip_yolo_prompt_injection` 配置项,用于抑制 yolo 模式下注入的系统提示词——基于 `KimiSoul` 构建自定义应用且不需要该提示时很有用
- Kimi:新增环境变量 `KIMI_MODEL_THINKING_KEEP`,将其值原样作为 `thinking.keep` 字段发送给 Moonshot API,用于启用 Preserved Thinking(例如 `export KIMI_MODEL_THINKING_KEEP=all` 可让模型在多轮之间保留历史 `reasoning_content`);仅对支持 Preserved Thinking 的 Moonshot 模型(如 `kimi-k2.6` / `kimi-k2-thinking`)生效,未设置或空字符串时请求体不携带该字段、等同当前默认行为,且仅在当前模型真正处于 Thinking 模式时才注入,以避免 API 收到只有 `thinking.keep` 而缺少 `thinking.type` 的无效请求体。注意 `keep=all` 会因为重新发送历史推理内容而显著增加输入 token 与 API 费用
- Kosong:修复 `Kimi.with_extra_body` 在后续调用新增其它 `thinking.*` 字段时静默丢掉已有 `thinking.type` 的问题——`thinking` 子对象现在按字段合并,而不是被整体浅覆盖,使得 `with_thinking(...)` 与 `with_extra_body({"thinking": {...}})` 组合使用时两次设置的字段都能保留
Expand Down
17 changes: 13 additions & 4 deletions src/kimi_cli/ui/shell/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,10 +951,16 @@ def _on_view_ready(view: Any) -> None:
else:
console.print(f"[red]LLM provider error: {e}[/red]")
if not isinstance(e, APIStatusError) or e.status_code not in (401, 402, 403):
session_id = (
self.soul.runtime.session.id if isinstance(self.soul, KimiSoul) else None
)
export_cmd = f"kimi export {session_id}" if session_id else "kimi export"
Comment thread
kermanx marked this conversation as resolved.
Comment thread
kermanx marked this conversation as resolved.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Insert -- before session ID in export hint

The hint builds kimi export {session_id} directly, which breaks for valid custom session IDs that start with - (for example created via --session=-debug): when users copy-paste it, Typer parses the ID as an option and the export command fails instead of exporting that session. Since session_id is an unconstrained string in session creation/resume paths, render the hint as kimi export -- <id> (with quoting/escaping as needed) in both error branches.

Useful? React with 👍 / 👎.

console.print(
"[dim]If this persists, run [bold]kimi export[/bold] and send the "
"exported data to support for assistance. "
"Please do not share the exported file publicly.[/dim]"
"[dim]If this persists, run the "
f"[bold]{export_cmd}[/bold] command in your terminal "
"and send the exported data to "
"[link=mailto:code@moonshot.ai]code@moonshot.ai[/link] "
"for assistance. Please do not share the exported file publicly.[/dim]"
)
except MaxStepsReached as e:
logger.warning("Max steps reached: {n_steps}", n_steps=e.n_steps)
Expand All @@ -973,9 +979,12 @@ def _on_view_ready(view: Any) -> None:
console.print("[red]Interrupted by user[/red]")
except Exception as e:
logger.exception("Unexpected error:")
session_id = self.soul.runtime.session.id if isinstance(self.soul, KimiSoul) else None
export_cmd = f"kimi export {session_id}" if session_id else "kimi export"
Comment thread
kermanx marked this conversation as resolved.
console.print(
f"[red]Unexpected error: {e}[/red]\n"
"[dim]Run [bold]kimi export[/bold] and send the exported data to support "
f"[dim]Run [bold]{export_cmd}[/bold] and send the exported data to "
"[link=mailto:code@moonshot.ai]code@moonshot.ai[/link] "
"for assistance. Please do not share the exported file publicly.[/dim]"
Comment thread
kermanx marked this conversation as resolved.
)
raise # re-raise unknown error
Expand Down
Loading