Update project files
This commit is contained in:
+15
-1
@@ -36,7 +36,7 @@ import { AIService } from './core/services';
|
||||
import type { CompanyState } from './features/company';
|
||||
import { SettingsPanelProvider } from './features/settings/settingsPanelProvider';
|
||||
import { resolveScopeForAgent, openKnowledgeMapEditor } from './skills/agentKnowledgeMap';
|
||||
import { getBrainTokenIndex } from './retrieval';
|
||||
import { getBrainTokenIndex, clearBrainTokenIndex } from './retrieval';
|
||||
import { lessonTemplate, lessonSlug, parseLessonFrontmatter, normalizeLessonTitle, bumpLessonOccurrences } from './retrieval/lessonHelpers';
|
||||
import { retrieveScoped, buildContextBlock } from './skills/scopedBrainRetriever';
|
||||
|
||||
@@ -835,6 +835,16 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
vscode.workspace.onDidChangeConfiguration((e) => {
|
||||
if (e.affectsConfiguration('g1nation')) void settingsPanel.refresh();
|
||||
}),
|
||||
// Drop the in-memory brain token index whenever the brain profiles or the
|
||||
// active brain change — a profile edit can repoint `localBrainPath`, so a
|
||||
// stale index keyed by the old path must not linger. The persisted on-disk
|
||||
// index is untouched and reloads lazily on the next query.
|
||||
vscode.workspace.onDidChangeConfiguration((e) => {
|
||||
if (e.affectsConfiguration('g1nation.brainProfiles')
|
||||
|| e.affectsConfiguration('g1nation.activeBrainId')) {
|
||||
clearBrainTokenIndex();
|
||||
}
|
||||
}),
|
||||
// Same for SecretStorage updates (token saved/cleared from elsewhere).
|
||||
context.secrets.onDidChange((e) => {
|
||||
if (e.key === TELEGRAM_TOKEN_SECRET_KEY) void settingsPanel.refresh();
|
||||
@@ -915,6 +925,10 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
|
||||
export async function deactivate() {
|
||||
HealthCheckMonitor.dispose();
|
||||
// Release the in-memory brain token index (and any pending debounced disk
|
||||
// write timer) — the `_states` Map is otherwise never cleared for the
|
||||
// process lifetime.
|
||||
clearBrainTokenIndex();
|
||||
if (_telegramBot) {
|
||||
try { await _telegramBot.stop(); } catch (e) { logError('Telegram bot stop during deactivate failed.', e); }
|
||||
_telegramBot = undefined;
|
||||
|
||||
Reference in New Issue
Block a user