diff --git a/.agents/skills/sync-changelog/SKILL.md b/.agents/skills/sync-changelog/SKILL.md index f99ca2195..d4af78708 100644 --- a/.agents/skills/sync-changelog/SKILL.md +++ b/.agents/skills/sync-changelog/SKILL.md @@ -231,6 +231,51 @@ Chinese page requirements: - Translate only entry body text. Do not add entries that are not present in English. - Follow `docs/AGENTS.md` for Chinese typography: full-width punctuation, spaces between Chinese and English, and the glossary. +#### Chinese wording style + +Structural fidelity does not mean literal translation. The Chinese entries should read like a concise, idiomatic Chinese changelog. Keep the same facts as the English entry, but rephrase for natural Chinese prose. + +Guidelines: + +- **One entry, one sentence.** Avoid chaining multiple effects with commas or semicolons. If the English entry is long, split it into shorter sentences or keep only the most important effect. +- **Prefer common changelog verbs**: 新增、支持、修复、优化、改进、调整. +- **Avoid indirect "through... make..." structures**. Do not write "通过 X,使 Y"; prefer direct cause-effect or just state the result. + - Bad: `通过缓存已渲染消息行,使终端在长篇对话中保持响应。` + - Better: `缓存已渲染消息行,提升长对话下终端的响应速度。` +- **Be specific, not vague**. Prefer concrete actions over abstract quality words. + - Bad: `加固默认系统提示词和内置工具描述。` + - Better: `优化默认系统提示词与内置工具描述,避免 Agent 阻塞后台任务。` +- **Name concrete files or config keys when it helps clarity**. + - Bad: `插件现在可以在其清单中声明 hooks。` + - Better: `插件现支持在 kimi.plugin.json 中声明生命周期 hooks。` +- **Include required argument placeholders in CLI options**. + - Bad: `--allowed-host` + - Better: `--allowed-host ` +- **Keep usage hints to one short clause**. + - Bad: `传入 --allowed-host 以允许额外的 host。例如 ... (多句展开)` + - Better: `例如 kimi web --allowed-host example.com。` +- **Do not translate technical identifiers**: keep command names, flag names, file names, env vars, and config keys as-is. + +Example — translating a feature entry: + +English source: + +```markdown +- Add a --allowed-host flag to kimi web that lets extra Host header values pass the DNS-rebinding check, and include allow guidance in the 403 error message. Pass --allowed-host to allow an extra host. +``` + +Before (literal, wordy): + +```markdown +- 为 `kimi web` 新增 `--allowed-host` 标志,允许额外的 Host 请求头值通过 DNS 重绑定检查,并在 403 错误消息中包含允许指引。传入 `--allowed-host ` 以允许额外的 host。例如 `kimi web --allowed-host example.com`。 +``` + +After (concise, idiomatic): + +```markdown +- `kimi web` 新增 `--allowed-host ` 选项,可将指定 Host 加入 DNS 重绑定白名单;403 错误会提示如何通过 `--allowed-host` 或 `KIMI_CODE_ALLOWED_HOSTS` 放行,例如 `kimi web --allowed-host example.com`。 +``` + ### 7. Verify Review: diff --git a/docs/en/customization/plugins.md b/docs/en/customization/plugins.md index fb7bde597..5579cc698 100644 --- a/docs/en/customization/plugins.md +++ b/docs/en/customization/plugins.md @@ -2,8 +2,6 @@ Plugins package reusable Kimi Code CLI capabilities into installable units — they can add [Agent Skills](./skills.md), automatically load a specified Skill at session start, and declare MCP servers to provide real tool capabilities. They are ideal for sharing workflows with a team, connecting to external services, or installing extensions from the official marketplace. -Kimi Code CLI applies a conservative loading strategy for plugins: installing a plugin does not execute any Python, Node.js, shell, hook, or command scripts it contains. - ## Installation and Management Run `/plugins` in the TUI to open the plugin manager. It is a single panel with four tabs — **Installed** (manage what you have), **Official** (Kimi-maintained marketplace plugins), **Third-party** (marketplace plugins from other publishers), and **Custom** (install from a URL) — switched with `Tab` / `Shift-Tab`. Common keys: @@ -159,8 +157,9 @@ Supported fields: | `sessionStart.skill` | Loads the specified plugin Skill into the main Agent when a new or resumed session starts | | `skillInstructions` | Additional instructions appended whenever a Skill from this plugin is loaded | | `mcpServers` | MCP server declarations; enabled by default, can be disabled from `/plugins` | +| `hooks` | Hook rules run on lifecycle events while the plugin is enabled; see [Hooks in Plugins](#hooks-in-plugins) | -Unsupported runtime fields such as `tools`, `commands`, `hooks`, `apps`, `inject`, and `configFile` appear as diagnostics and are ignored. +Unsupported runtime fields such as `tools`, `commands`, `apps`, `inject`, and `configFile` appear as diagnostics and are ignored. ## Skills and Session Start @@ -221,11 +220,36 @@ Plugin MCP servers start after `/reload` or in new sessions. To enable or disabl /reload ``` +## Hooks in Plugins + +A plugin can declare hook rules in its manifest that run on lifecycle events while the plugin is enabled. Each entry uses the same fields as a [`[[hooks]]` rule in `config.toml`](./hooks.md#configuration) (`event`, `matcher`, `command`, `timeout`): + +```json +{ + "hooks": [ + { + "event": "PreToolUse", + "matcher": "Bash", + "command": "node ./hooks/check-bash.mjs", + "timeout": 5 + } + ] +} +``` + +Plugin hooks reuse the same mechanism as global hooks — see [Hooks](./hooks.md) for the event list, the stdin JSON payload, and how exit codes and return values affect the main flow. The differences are: + +- A plugin's hooks are active only while the plugin is **enabled**; disabling the plugin stops its hooks. +- Each hook runs with its working directory set to the plugin root, so `command` can use `./` paths inside the plugin. +- The hook process receives two extra environment variables: `KIMI_CODE_HOME` and `KIMI_PLUGIN_ROOT` (the plugin root directory). + +Installing a plugin never runs its hooks by itself — they only fire when their matching event occurs while the plugin is enabled. + ## Security Model Plugins have a limited loading scope. The following operations do not occur during installation or session startup: -- Command-type plugin tools, hooks, and legacy tool runtimes are not executed +- Command-type plugin tools and legacy tool runtimes are not executed - All paths must remain within the plugin root directory after symbolic link resolution - MCP servers of enabled plugins start after `/reload` or in new sessions and can be disabled at any time from `/plugins` - Broken manifests or unsafe paths appear in `/plugins info ` diagnostics and do not affect other sessions diff --git a/docs/en/release-notes/changelog.md b/docs/en/release-notes/changelog.md index eaffebfe2..2ad578ae8 100644 --- a/docs/en/release-notes/changelog.md +++ b/docs/en/release-notes/changelog.md @@ -6,6 +6,29 @@ outline: 2 This page documents the changes in each Kimi Code CLI release. +## 0.20.1 (2026-06-26) + +### Features + +- Plugins now support declaring lifecycle hooks in `kimi.plugin.json` to run scripts at specific stages. See [Hooks in Plugins](../customization/plugins.md#hooks-in-plugins). +- `/feedback` now supports attaching diagnostic logs and codebase context. +- Add the `kimi update` command, equivalent to `kimi upgrade`, for upgrading to the latest version. +- `kimi web` adds the `--allowed-host ` option to add a specified Host to the DNS-rebinding allowlist; 403 errors now explain how to allow it via `--allowed-host` or `KIMI_CODE_ALLOWED_HOSTS`, e.g. `kimi web --allowed-host example.com`. + +### Bug Fixes + +- Fix kimi server failing to start on Windows after the first run. +- Fix the Web UI opened by the `/web` command not signing in automatically; the terminal now prints the access token. +- Cap chat-completions providers' `max_tokens` to the remaining context window, avoiding context overflow and invalid parameter errors. + +### Polish + +- Optimize the default system prompt and built-in tool descriptions to stop the agent from blocking background tasks, unify tool guidance across profiles, and surface previously missing tool-result details (fetched-page mode, Grep match totals). +- Cache rendered message lines to keep the terminal responsive in long conversations. +- Retain only recent turns in the transcript and collapse older steps within each turn to keep long sessions responsive. +- Make the web chat input grow with its content and add an expandable editor for longer messages. +- Show the done / in progress / pending breakdown of hidden todos in the collapsed todo panel. + ## 0.20.0 (2026-06-26) ### Features diff --git a/docs/zh/customization/plugins.md b/docs/zh/customization/plugins.md index 458a09296..41af7f5cc 100644 --- a/docs/zh/customization/plugins.md +++ b/docs/zh/customization/plugins.md @@ -2,8 +2,6 @@ Plugins 把可复用的 Kimi Code CLI 能力打包成可安装单元——可以添加 [Agent Skills](./skills.md)、在会话启动时自动加载指定 Skill,也可以声明 MCP servers 来提供真实工具能力。适合把工作流共享给团队、连接外部服务,或从官方 marketplace 安装扩展。 -Kimi Code CLI 对 plugin 采用保守的加载策略:安装 plugin 时不会执行其中的 Python、Node.js、Shell、hook 或命令脚本。 - ## 安装与管理 在 TUI 中运行 `/plugins` 打开 plugin 管理器。它是一个面板,有四个 tab:**Installed**(管理已装的)、**Official**(Kimi 官方 marketplace plugin)、**Third-party**(第三方 marketplace plugin)、**Custom**(从 URL 安装),用 `Tab` / `Shift-Tab` 切换。常用按键: @@ -159,8 +157,9 @@ Plugin 是一个带 manifest 的目录或 zip 文件。Manifest 可以放在以 | `sessionStart.skill` | 在新会话或恢复会话开始时,把指定 plugin Skill 加载到主 Agent | | `skillInstructions` | 每次加载此 plugin 的 Skill 时一并附带的额外说明 | | `mcpServers` | MCP server 声明,默认启用,可从 `/plugins` 中禁用 | +| `hooks` | 在 plugin 启用期间于生命周期事件上运行的 hook 规则;见[插件中的 Hooks](#插件中的-hooks) | -`tools`、`commands`、`hooks`、`apps`、`inject`、`configFile` 等不支持的运行时字段会显示为 diagnostics 并被忽略。 +`tools`、`commands`、`apps`、`inject`、`configFile` 等不支持的运行时字段会显示为 diagnostics 并被忽略。 ## Skills 与会话启动 @@ -221,11 +220,36 @@ Plugin MCP servers 会在 `/reload` 后或新会话中启动。启用或禁用 /reload ``` +## 插件中的 Hooks + +plugin 可以在其 manifest 中声明 hook 规则,在 plugin 启用期间于生命周期事件上运行。每一项使用与 [`config.toml` 中的 `[[hooks]]` 规则](./hooks.md#配置)相同的字段(`event`、`matcher`、`command`、`timeout`): + +```json +{ + "hooks": [ + { + "event": "PreToolUse", + "matcher": "Bash", + "command": "node ./hooks/check-bash.mjs", + "timeout": 5 + } + ] +} +``` + +plugin hooks 复用与全局 hooks 相同的机制——事件列表、stdin JSON 载荷以及退出码和返回值如何影响主流程,详见 [Hooks](./hooks.md)。区别如下: + +- plugin 的 hooks 仅在 plugin **启用**期间生效;禁用 plugin 后其 hooks 停止运行。 +- 每条 hook 的工作目录为 plugin 根目录,因此 `command` 可以使用 plugin 内的 `./` 路径。 +- hook 进程会额外收到两个环境变量:`KIMI_CODE_HOME` 和 `KIMI_PLUGIN_ROOT`(plugin 根目录)。 + +仅安装 plugin 本身不会运行其 hooks——它们只在 plugin 启用期间、匹配的事件触发时运行。 + ## 安全模型 Plugin 的加载范围有限,以下操作不会在安装或会话启动时发生: -- 不会执行命令型 plugin tools、hooks 或旧式工具运行时 +- 不会执行命令型 plugin tools 或旧式工具运行时 - 所有路径在解析符号链接后仍必须位于 plugin 根目录内 - 已启用 plugin 的 MCP servers 会在 `/reload` 后或新会话中启动,且可随时从 `/plugins` 禁用 - 损坏的 manifest 或不安全路径会显示在 `/plugins info ` 的 diagnostics 中,不影响其他会话 diff --git a/docs/zh/release-notes/changelog.md b/docs/zh/release-notes/changelog.md index 987372909..2240560b6 100644 --- a/docs/zh/release-notes/changelog.md +++ b/docs/zh/release-notes/changelog.md @@ -6,6 +6,29 @@ outline: 2 本页记录 Kimi Code CLI 每个版本的变更内容。 +## 0.20.1(2026-06-26) + +### 新功能 + +- 插件现支持在 `kimi.plugin.json` 中声明生命周期 hooks,在指定阶段运行脚本。详见[插件 Hooks](../customization/plugins.md#插件中的-hooks)。 +- `/feedback` 现支持附加诊断日志与代码库上下文。 +- 新增 `kimi update` 命令,等价于 `kimi upgrade`,可用于升级到最新版本。 +- `kimi web` 新增 `--allowed-host ` 选项,可将指定 Host 加入 DNS 重绑定白名单;403 错误会提示如何通过 `--allowed-host` 或 `KIMI_CODE_ALLOWED_HOSTS` 放行,例如 `kimi web --allowed-host example.com`。 + +### 修复 + +- 修复 Windows 上 kimi server 首次运行后无法启动的问题。 +- 修复 `/web` 命令打开的 Web UI 不会自动登录的问题,现在终端会打印访问 token。 +- chat-completions 供应商的 `max_tokens` 现在不超过剩余上下文窗口,避免上下文溢出与无效参数错误。 + +### 优化 + +- 优化默认系统提示词与内置工具描述,避免 Agent 阻塞后台任务,统一各 profile 的工具指引,并补充展示工具结果详情(fetched-page 模式、Grep 匹配总数)。 +- 缓存已渲染消息行,提升长对话下终端的响应速度。 +- transcript 仅保留最近轮次并折叠早期步骤,保持长会话响应流畅。 +- Web 聊天输入框支持随内容自动增高,长消息可使用可展开编辑器。 +- 折叠待办面板时显示隐藏待办的状态明细(已完成 / 进行中 / 待处理)。 + ## 0.20.0(2026-06-26) ### 新功能