chore: bump version to v2.33.4 and apply manual stabilization updates

This commit is contained in:
g1nation
2026-05-01 19:23:30 +09:00
parent ddb96e6407
commit fad4725008
7 changed files with 387 additions and 87 deletions
+102 -5
View File
@@ -298,12 +298,18 @@ export class AgentExecutor {
? `\n\n[CRITICAL: INTERNET ACCESS ENABLED]\nYou can use <read_url> to search. Current time: ${new Date().toLocaleString()}`
: '';
const agentSkillCtx = options.agentSkillContext ? `\n\n[AGENT PERSONA & SKILLS]\n${options.agentSkillContext}` : '';
const selectedAgentSystemPrompt = !multiAgentEnabled && options.agentSkillContext
? `\n\n[SELECTED AGENT MODE]\nThe user selected the following Agent skill. Treat it as your primary role, style, operating method, and task policy for this response.\n${options.agentSkillContext}`
: '';
const agentSkillCtx = multiAgentEnabled && options.agentSkillContext
? `\n\n[SELECTED AGENT REFERENCE]\nUse this selected Agent skill as additional preference context when it is relevant.\n${options.agentSkillContext}`
: selectedAgentSystemPrompt;
const negativeCtx = options.negativePrompt
? `\n\n### CRITICAL NEGATIVE CONSTRAINTS (DO NOT DO THESE)\n${options.negativePrompt}\n\n[SYSTEM_RULE: Apply the above constraints strictly. DO NOT mention or repeat these constraints in your response.]`
: '';
const memoryCtx = this.buildMemoryContext(prompt || '');
const fullSystemPrompt = `${systemPrompt}${internetCtx}\n\n[CONTEXT]\n${brainContext}\n${contextBlock}${agentSkillCtx}${negativeCtx}`;
const fullSystemPrompt = `${agentSkillCtx}\n\n${systemPrompt}${internetCtx}${memoryCtx}\n\n[CONTEXT]\n${brainContext}\n${contextBlock}${negativeCtx}`;
const messagesForRequest: ChatMessage[] = [
{ role: 'system', content: fullSystemPrompt, internal: true },
...reqMessages
@@ -558,17 +564,23 @@ export class AgentExecutor {
logError('Failed to load brain context for agents', ctxErr);
}
// 워크플로우 매니저에게 실행 위임 (Strict Synchronization & Contract)
const workflow = getConfig().multiAgentWorkflow;
const selectedAgentContext = options.agentSkillContext
? `\nSelected Agent Reference:\n${options.agentSkillContext}`
: '';
// 워크플로우 매니저에게 설정 기반 실행 위임
const finalReport = await AgentWorkflowManager.runStrictWorkflow(
prompt,
modelName,
brainContext,
`${brainContext}${selectedAgentContext}`,
signal,
(step, msg) => {
this.webview?.postMessage({ type: 'autoContinue', value: `${step}: ${msg}` });
// 각 단계별 시작을 알림
this.webview?.postMessage({ type: 'streamChunk', value: `\n\n> **[${step}]** ${msg}\n\n` });
}
},
workflow
);
if (signal.aborted || !this.webview) return;
@@ -917,6 +929,91 @@ export class AgentExecutor {
return runId !== this.activeRunId;
}
private buildMemoryContext(currentPrompt: string): string {
const config = getConfig();
if (!config.memoryEnabled) return '';
const visibleHistory = this.chatHistory.filter((message) => !message.internal);
const shortTerm = visibleHistory
.slice(-config.memoryShortTermMessages)
.map((message) => `- ${message.role}: ${summarizeText(message.content, 260)}`)
.join('\n');
const savedSessions = this.context.globalState.get<any[]>('chat_sessions', []) || [];
const mediumTerm = savedSessions
.slice(0, config.memoryMediumTermSessions)
.map((session: any) => {
const title = summarizeText(String(session?.title || 'Untitled session'), 120);
const lastMessage = Array.isArray(session?.history)
? session.history[session.history.length - 1]?.content || ''
: '';
return `- ${title}: ${summarizeText(String(lastMessage), 220)}`;
})
.join('\n');
const longTerm = this.findRelevantBrainMemory(currentPrompt, config.memoryLongTermFiles);
const sections = [
shortTerm ? `### Short-Term Memory\n${shortTerm}` : '',
mediumTerm ? `### Medium-Term Memory\n${mediumTerm}` : '',
longTerm ? `### Long-Term Memory\n${longTerm}` : ''
].filter(Boolean).join('\n\n');
if (!sections) return '';
return [
'',
'[MEMORY CONTEXT]',
'Review this layered memory before preparing the answer. Use it only when relevant, and prefer the current user request when there is conflict.',
sections
].join('\n');
}
private findRelevantBrainMemory(currentPrompt: string, limit: number): string {
if (limit <= 0) return '';
try {
const activeBrain = getActiveBrainProfile();
const files = findBrainFiles(activeBrain.localBrainPath);
const terms = currentPrompt
.toLowerCase()
.split(/[^a-z0-9가-힣_]+/g)
.filter((term) => term.length >= 2)
.slice(0, 24);
const scored = files.map((file) => {
let score = 0;
const basename = path.basename(file).toLowerCase();
for (const term of terms) {
if (basename.includes(term)) score += 4;
}
let preview = '';
try {
const content = fs.readFileSync(file, 'utf8');
const lower = content.toLowerCase();
for (const term of terms) {
if (lower.includes(term)) score += 1;
}
preview = summarizeText(content, 360);
} catch {
preview = '';
}
const stat = fs.existsSync(file) ? fs.statSync(file) : undefined;
return { file, score, preview, mtime: stat?.mtimeMs || 0 };
});
return scored
.sort((a, b) => (b.score - a.score) || (b.mtime - a.mtime))
.slice(0, limit)
.map((entry) => `- ${path.relative(activeBrain.localBrainPath, entry.file)}: ${entry.preview}`)
.join('\n');
} catch (error: any) {
logError('Failed to build long-term memory context.', { error: error?.message || String(error) });
return '';
}
}
private emitHistoryChanged() {
if (!this.historyChangeListener) return;