Repository navigation
Conversation
The kimi.newConversation command reveals and focuses the sidebar view before it broadcasts, so it is the sidebar's action, yet it delivered the event to every registered webview. With a Kimi view open as an editor tab, pressing + in the sidebar also cleared that tab's conversation and aborted its in-flight turn. Track the sidebar's webview id and deliver the event only there. broadcastInternal already takes a target and insertEditorMention already uses it, and the in-webview Cmd/Ctrl+N shortcut already scopes itself to the focused view, so the command now matches both.
🦋 Changeset detectedLatest commit: 119b40d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Related Issue
Resolves #3036
Problem
kimi.newConversation这个命令自己前后两行是矛盾的(apps/vscode/src/extension.ts:116-119):第 ① 行无条件 reveal 并聚焦
kimi.webview(侧边栏视图专属、由 VS Code 自动生成的命令),第 ② 行却发给每一个已注册的 webview。结果:只要有 Kimi 对话窗口开在编辑器标签页里,点一下侧边栏标题栏的
+,那些标签页的对话也会被清空,正在流式输出的回合被停掉。而每个视图持有各自独立的 session 和工作目录(BridgeHandler按webviewId分别管理),不应该"一次点击重置全部"。同一功能的另外两个入口——webview 内部 Header 的
+、以及 Cmd/Ctrl+N 快捷键(webview-ui/src/App.tsx:53-65)——都只影响自己所在的对话窗口。命令这条路径与它们不一致。复现步骤和动图见关联 issue。
What changed
KimiWebviewProvider:新增sidebarWebviewId字段。resolveWebviewView是唯一创建侧边栏视图的入口,在那里记录 id;视图销毁时清除。清除加了=== webviewId判断——侧边栏关闭后重开时,VS Code 可能先创建新视图再销毁旧视图,无条件清空会把刚记录的新 id 一起抹掉。新增
broadcastToSidebar()。定向投递能力本来就有:broadcastInternal的第三个参数(KimiWebviewProvider.ts:112)就是干这个的,insertEditorMention一直在逐webviewId使用它。这里只是把它接到命令上。extension.ts:kimi.newConversation改用broadcastToSidebar。第 ① 行的 focus 一个字没动——它本来就是这个命令归属侧边栏的自证。测试:
KimiWebviewProvider此前没有测试文件,因此新建test/webview-provider.test.ts(无既有文件可归并)。4 个用例:定向事件只到侧边栏、不定向广播仍到所有视图、无侧边栏时丢弃而非群发、侧边栏销毁后不再定向。以
origin/main为基线时其中 3 个用例失败;把新方法临时改回不定向的群发也是同样 3 个失败——用例抓的是这个缺陷本身,不只是新方法的存在。Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.