mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-19 10:02:04 +08:00
fix(vscode): refresh subagent viewer reasoning cap on panel reuse
This commit is contained in:
@@ -14,6 +14,7 @@ import type { KiloConnectionService } from "./services/cli-backend"
|
||||
export class SubAgentViewerProvider implements vscode.Disposable {
|
||||
private panels = new Map<string, vscode.WebviewPanel>()
|
||||
private providers = new Map<string, KiloProvider>()
|
||||
private backgrounds = new Map<string, boolean>()
|
||||
|
||||
constructor(
|
||||
private readonly extensionUri: vscode.Uri,
|
||||
@@ -25,6 +26,13 @@ export class SubAgentViewerProvider implements vscode.Disposable {
|
||||
const existing = this.panels.get(sessionID)
|
||||
if (existing) {
|
||||
if (directory) this.providers.get(sessionID)?.setSessionDirectory(sessionID, directory)
|
||||
// A reused panel keeps its original flag. Re-post when the caller reports
|
||||
// a different one so a transcript that first opened before the task
|
||||
// metadata landed still gets the reasoning cap.
|
||||
if (background !== undefined && this.backgrounds.get(sessionID) !== background) {
|
||||
this.backgrounds.set(sessionID, background)
|
||||
this.providers.get(sessionID)?.postMessage({ type: "viewSubAgentSession", sessionID, background })
|
||||
}
|
||||
existing.reveal(vscode.ViewColumn.One)
|
||||
return
|
||||
}
|
||||
@@ -86,6 +94,7 @@ export class SubAgentViewerProvider implements vscode.Disposable {
|
||||
|
||||
this.panels.set(sessionID, panel)
|
||||
this.providers.set(sessionID, provider)
|
||||
this.backgrounds.set(sessionID, background === true)
|
||||
|
||||
panel.onDidDispose(() => {
|
||||
console.log("[Kilo New] Sub-agent viewer panel disposed:", sessionID)
|
||||
@@ -93,6 +102,7 @@ export class SubAgentViewerProvider implements vscode.Disposable {
|
||||
provider.dispose()
|
||||
this.panels.delete(sessionID)
|
||||
this.providers.delete(sessionID)
|
||||
this.backgrounds.delete(sessionID)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -102,5 +112,6 @@ export class SubAgentViewerProvider implements vscode.Disposable {
|
||||
}
|
||||
this.panels.clear()
|
||||
this.providers.clear()
|
||||
this.backgrounds.clear()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user