-
Notifications
You must be signed in to change notification settings - Fork 732
feat(acp): implement session/fork (unstable) #1104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
YoungY620
wants to merge
7
commits into
main
Choose a base branch
from
acp-fork
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b40d2fb
feat(acp): add protocol version negotiation and V1 consistency tests
YoungY620 1ac88fa
feat(acp): implement session/resume (unstable)
YoungY620 024fd92
docs: update changelog and docs for ACP version negotiation and sessi…
YoungY620 dbe9d07
fix(acp): align Agent/Client protocol signatures with SDK v0.8.0
YoungY620 b4bf31a
Merge remote-tracking branch 'origin/main' into acp-fork
YoungY620 4dc271a
feat(acp): implement session/fork (unstable)
YoungY620 e3c3ef0
docs: update changelog and docs for ACP session/fork
YoungY620 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -140,4 +140,3 @@ export KIMI_CLI_NO_AUTO_UPDATE="1" | |
| ::: tip 提示 | ||
| 如果你通过 Nix 或其他包管理器安装 Kimi Code CLI,通常会自动设置此环境变量,因为更新由包管理器处理。 | ||
| ::: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,4 +96,3 @@ kimi --yolo | |
| ::: warning 注意 | ||
| YOLO 模式会跳过所有确认,请确保你了解可能的风险。建议仅在可控环境中使用。 | ||
| ::: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -110,4 +110,3 @@ Kimi Code CLI 可以执行各种重复性的小任务: | |
| ``` | ||
| 把 images 目录下的所有 PNG 图片转换为 JPEG 格式,保存到 output 目录 | ||
| ``` | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from dataclasses import dataclass | ||
|
|
||
|
|
||
| @dataclass(frozen=True) | ||
| class ACPVersionSpec: | ||
| """Describes one supported ACP protocol version.""" | ||
|
|
||
| protocol_version: int # negotiation integer (currently 1) | ||
| spec_tag: str # ACP spec tag (e.g. "v0.10.8") | ||
| sdk_version: str # corresponding SDK version (e.g. "0.8.0") | ||
|
|
||
|
|
||
| CURRENT_VERSION = ACPVersionSpec( | ||
| protocol_version=1, | ||
| spec_tag="v0.10.8", | ||
| sdk_version="0.8.0", | ||
| ) | ||
|
|
||
| SUPPORTED_VERSIONS: dict[int, ACPVersionSpec] = { | ||
| 1: CURRENT_VERSION, | ||
| } | ||
|
|
||
| MIN_PROTOCOL_VERSION = 1 | ||
|
|
||
|
|
||
| def negotiate_version(client_protocol_version: int) -> ACPVersionSpec: | ||
| """Negotiate the protocol version with the client. | ||
|
|
||
| Returns the highest server-supported version that does not exceed the | ||
| client's requested version. If the client version is lower than | ||
| ``MIN_PROTOCOL_VERSION`` the server still returns its own current | ||
| version so the client can decide whether to disconnect. | ||
| """ | ||
| if client_protocol_version < MIN_PROTOCOL_VERSION: | ||
| return CURRENT_VERSION | ||
|
|
||
| # Find the highest supported version <= client version | ||
| best: ACPVersionSpec | None = None | ||
| for ver, spec in SUPPORTED_VERSIONS.items(): | ||
| if ver <= client_protocol_version and (best is None or ver > best.protocol_version): | ||
| best = spec | ||
|
|
||
| return best if best is not None else CURRENT_VERSION |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Forked session missing AvailableCommandsUpdate notification to ACP client
The
fork_sessionmethod creates a new session (with a newsession_id) but does not send theAvailableCommandsUpdatesession update to the ACP client. In contrast,new_sessionatsrc/kimi_cli/acp/server.py:154-167sends this update immediately after session creation so the client knows which slash commands are available.Root Cause
When
new_sessioncreates a session, it builds the available commands list and fires anAvailableCommandsUpdatenotification:The
fork_sessionmethod at lines 242-285 creates a brand new session with a differentsession_idbut omits this notification entirely. The ACP client (e.g., an IDE integration) will not receive the list of available slash commands for the forked session, so features like command autocomplete won't work.The project's own
src/kimi_cli/acp/AGENTS.mdstates: "Both sendAvailableCommandsUpdatefor slash commands on session creation."Impact: Slash command discovery/autocomplete will be missing in the forked session's client UI.
Was this helpful? React with 👍 or 👎 to provide feedback.