Update project files
This commit is contained in:
+22
-3
@@ -25,6 +25,7 @@ import { handleBrainMessage } from './sidebar/brainHandlers';
|
||||
import { handleChronicleMessage } from './sidebar/chronicleHandlers';
|
||||
import { handleAgentMessage } from './sidebar/agentHandlers';
|
||||
import { getOrCreateAgentEntry, resolveScopeForAgent } from './skills/agentKnowledgeMap';
|
||||
import { clearBrainTokenIndex } from './retrieval/brainIndex';
|
||||
import { estimateModelParamsB } from './lib/contextManager';
|
||||
import { loadExternalSkills, formatSkillsAsPromptBlock } from './skills/externalSkillLoader';
|
||||
import {
|
||||
@@ -836,9 +837,15 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn
|
||||
localResourceRoots: [this._extensionUri]
|
||||
};
|
||||
|
||||
// Webview event listeners must be disposed — otherwise each re-init of the
|
||||
// view leaks a listener (and its captured `this`). We collect every
|
||||
// listener disposable here, dispose them when the view itself is disposed,
|
||||
// and also register them with the extension subscriptions as a backstop.
|
||||
const viewDisposables: vscode.Disposable[] = [];
|
||||
|
||||
// [State Persistence Fix] 사이드바가 다시 보여질 때 세팅값 자동 복원
|
||||
let _lastVisibilityRefresh = 0;
|
||||
webviewView.onDidChangeVisibility(() => {
|
||||
viewDisposables.push(webviewView.onDidChangeVisibility(() => {
|
||||
if (!webviewView.visible) return;
|
||||
const now = Date.now();
|
||||
// 5초 이내에 이미 갱신했으면 건너뜀
|
||||
@@ -850,7 +857,7 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn
|
||||
void this._sendBrainProfiles();
|
||||
void this._sendAgentsList();
|
||||
void this._sendReadyStatus();
|
||||
});
|
||||
}));
|
||||
|
||||
webviewView.webview.html = this._getHtml(webviewView.webview);
|
||||
this._agent.setWebview(webviewView.webview);
|
||||
@@ -858,7 +865,7 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn
|
||||
void this._restoreActiveSessionIntoView();
|
||||
void this._sendReadyStatus();
|
||||
|
||||
webviewView.webview.onDidReceiveMessage(async (data) => {
|
||||
viewDisposables.push(webviewView.webview.onDidReceiveMessage(async (data) => {
|
||||
// dispatch root 진입 trace — "/benchmark 입력했는데 아무 응답 없음" 같은
|
||||
// 보고가 들어왔을 때 webview message가 정말 도착했는지부터 즉시 판별.
|
||||
const valuePreview = typeof data?.value === 'string'
|
||||
@@ -870,7 +877,14 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn
|
||||
if (await handleChronicleMessage(this, data)) return;
|
||||
if (await handleAgentMessage(this, data)) return;
|
||||
logInfo(`Unhandled sidebar message: ${data?.type}`);
|
||||
}));
|
||||
|
||||
webviewView.onDidDispose(() => {
|
||||
for (const d of viewDisposables.splice(0)) {
|
||||
try { d.dispose(); } catch { /* already disposed */ }
|
||||
}
|
||||
});
|
||||
this._context.subscriptions.push(...viewDisposables);
|
||||
}
|
||||
|
||||
_currentSessionId: string | null = null;
|
||||
@@ -1260,6 +1274,11 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn
|
||||
|
||||
await vscode.workspace.getConfiguration('g1nation').update('activeBrainId', nextProfile.id, vscode.ConfigurationTarget.Global);
|
||||
this._currentSessionBrainId = nextProfile.id;
|
||||
// Drop the in-memory brain token index — the active brain (and its path)
|
||||
// may now differ, and the index's `_states` Map is otherwise never cleared.
|
||||
// The persisted on-disk index is left intact and reloads lazily on the
|
||||
// next query for whichever brain is now active.
|
||||
clearBrainTokenIndex();
|
||||
await this._sendBrainProfiles();
|
||||
await this._sendBrainStatus();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user