release: v2.0.1 - Advanced Knowledge Mix & Architectural Intelligence

This commit is contained in:
g1nation
2026-05-13 22:05:39 +09:00
parent c32b17377b
commit e85e11aac6
23 changed files with 1758 additions and 78 deletions
+36 -8
View File
@@ -42,6 +42,12 @@ export interface AgentKnowledgeEntry {
skillFolders?: string[];
/** Optional: pinned model override for this agent (e.g. `qwen3:8b`). */
model?: string;
/**
* Optional: per-agent Knowledge Mix override (0100). Higher = lean harder on
* Second Brain notes. When undefined the resolver falls back to the global
* `g1nation.knowledgeMix.secondBrainWeight` setting. Stored as integer.
*/
secondBrainWeight?: number;
/** Optional: human-friendly note shown in UI hints. */
description?: string;
}
@@ -93,11 +99,19 @@ function _coerceMap(raw: unknown): AgentKnowledgeMap {
const skillFolders = skillsRaw
.map((f) => (typeof f === 'string' ? f.trim() : ''))
.filter((f) => f.length > 0);
// Per-agent Knowledge Mix weight: only accept integers within [0, 100].
// `null` and out-of-range numbers fall back to undefined (use global).
let secondBrainWeight: number | undefined;
if (typeof a.secondBrainWeight === 'number' && Number.isFinite(a.secondBrainWeight)) {
const w = Math.round(a.secondBrainWeight);
if (w >= 0 && w <= 100) secondBrainWeight = w;
}
agents.push({
name,
knowledgeFolders: folders,
skillFolders: skillFolders.length > 0 ? skillFolders : undefined,
model: typeof a.model === 'string' && a.model.trim() ? a.model.trim() : undefined,
secondBrainWeight,
description: typeof a.description === 'string' && a.description.trim() ? a.description.trim() : undefined,
});
}
@@ -235,13 +249,21 @@ export function saveKnowledgeMap(map: AgentKnowledgeMap): { ok: boolean; path: s
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
const normalized: AgentKnowledgeMap = {
defaultAgent: map.defaultAgent?.trim() || undefined,
agents: (map.agents || []).map((a) => ({
name: a.name.trim(),
knowledgeFolders: (a.knowledgeFolders || []).map((f) => f.trim()).filter(Boolean),
skillFolders: (a.skillFolders || []).map((f) => f.trim()).filter(Boolean),
model: a.model?.trim() || undefined,
description: a.description?.trim() || undefined,
})).filter((a) => a.name.length > 0),
agents: (map.agents || []).map((a) => {
let secondBrainWeight: number | undefined;
if (typeof a.secondBrainWeight === 'number' && Number.isFinite(a.secondBrainWeight)) {
const w = Math.round(a.secondBrainWeight);
if (w >= 0 && w <= 100) secondBrainWeight = w;
}
return {
name: a.name.trim(),
knowledgeFolders: (a.knowledgeFolders || []).map((f) => f.trim()).filter(Boolean),
skillFolders: (a.skillFolders || []).map((f) => f.trim()).filter(Boolean),
model: a.model?.trim() || undefined,
secondBrainWeight,
description: a.description?.trim() || undefined,
};
}).filter((a) => a.name.length > 0),
};
// Drop empty skillFolders arrays so the JSON stays clean for entries
// that never used the new feature.
@@ -272,6 +294,7 @@ export function getOrCreateAgentEntry(agentName: string): AgentKnowledgeEntry {
knowledgeFolders: [...(existing.knowledgeFolders || [])],
skillFolders: [...(existing.skillFolders || [])],
model: existing.model,
secondBrainWeight: existing.secondBrainWeight,
description: existing.description,
};
}
@@ -302,6 +325,7 @@ export function upsertAgentEntry(entry: AgentKnowledgeEntry): { ok: boolean; pat
knowledgeFolders: entry.knowledgeFolders || [],
skillFolders: entry.skillFolders || [],
model: entry.model,
secondBrainWeight: entry.secondBrainWeight,
description: entry.description,
};
if (idx >= 0) next.agents[idx] = merged;
@@ -338,7 +362,11 @@ export async function openKnowledgeMapEditor(): Promise<void> {
logInfo('agent-knowledge-map: starter created.', { jsonPath });
}
const doc = await vscode.workspace.openTextDocument(jsonPath);
await vscode.window.showTextDocument(doc);
// Keep the ConnectAI sidebar (column 3) untouched — open the JSON in the editor group.
await vscode.window.showTextDocument(doc, {
viewColumn: vscode.ViewColumn.Two,
preview: false,
});
} catch (e: any) {
logError('agent-knowledge-map: open failed.', { jsonPath, error: e?.message ?? String(e) });
vscode.window.showErrorMessage(`매핑 파일 열기 실패: ${e?.message ?? e}`);