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
+45 -41
View File
@@ -1,6 +1,5 @@
import * as vscode from 'vscode';
import { PlannerAgent, ResearcherAgent, WriterAgent } from './factory';
import { AgentEngine, PipelineStage } from '../lib/engine';
import { ConfigurableWorkflowAgent } from './factory';
import { DEFAULT_MULTI_AGENT_WORKFLOW, MultiAgentStageConfig } from '../config';
export class AgentWorkflowManager {
/**
@@ -11,33 +10,28 @@ export class AgentWorkflowManager {
modelName: string,
brainContext: string,
signal: AbortSignal,
onProgress: (step: string, message: string) => void
onProgress: (step: string, message: string) => void,
workflow: MultiAgentStageConfig[] = DEFAULT_MULTI_AGENT_WORKFLOW
): Promise<string> {
// 1. 에이전트 준비 (DI를 위한 인스턴스화)
const planner = new PlannerAgent(modelName);
const researcher = new ResearcherAgent(modelName);
const writer = new WriterAgent(modelName);
// 2. 엔진 인스턴스 생성 (의존성 주입)
const engine = new AgentEngine(planner, researcher, writer);
// 3. 고유 미션 ID 생성 (현재는 타임스탬프 기반)
const missionId = `mission_${Date.now()}`;
const stages = workflow.length > 0 ? workflow : DEFAULT_MULTI_AGENT_WORKFLOW;
const stageOutputs: string[] = [];
try {
// 4. 엔진을 통한 미션 실행 (Producer-Consumer & Mutex 적용)
return await engine.runMission(
missionId,
prompt,
brainContext,
signal,
(stage: PipelineStage, message: string) => {
// UI 피드백을 위한 프로그레스 업데이트
const uiStepName = this.mapStageToUI(stage);
onProgress(uiStepName, message);
}
);
for (const [index, stage] of stages.entries()) {
if (signal.aborted) throw new Error('AbortError');
const agent = new ConfigurableWorkflowAgent(modelName, stage);
const stepName = stage.name || `Stage ${index + 1}`;
onProgress(stepName, `Running ${index + 1}/${stages.length}`);
const stageInput = this.buildStageInput(stage, prompt, stageOutputs);
const result = await agent.execute(stageInput, brainContext, signal);
this.validateResult(result, stepName);
stageOutputs.push(result);
onProgress(stepName, `Completed ${index + 1}/${stages.length}`);
}
return stageOutputs[stageOutputs.length - 1];
} catch (error: any) {
if (error.name === 'AbortError' || error.message.includes('cancelled')) {
throw error;
@@ -46,18 +40,28 @@ export class AgentWorkflowManager {
}
}
/**
* 엔진 스테이지를 UI 표시용 명칭으로 매핑
*/
private static mapStageToUI(stage: PipelineStage): string {
const maps: Record<PipelineStage, string> = {
idle: '대기',
planner: 'Planner',
researcher: 'Researcher',
writer: 'Writer',
completed: '완료',
error: '오류'
};
return maps[stage] || '진행 중';
private static buildStageInput(stage: MultiAgentStageConfig, originalPrompt: string, stageOutputs: string[]): string {
const previous = stageOutputs[stageOutputs.length - 1] || '';
if (stage.input === 'original') {
return originalPrompt;
}
if (stage.input === 'previous') {
return previous || originalPrompt;
}
return [
'## Original User Request',
originalPrompt,
'',
'## Previous Stage Output',
previous || 'No previous stage output.'
].join('\n');
}
private static validateResult(data: string, step: string) {
if (!data || data.trim().length < 10) {
throw new Error(`${step} agent did not return a usable response.`);
}
}
}
+27 -1
View File
@@ -1,5 +1,5 @@
import * as vscode from 'vscode';
import { getConfig } from '../config';
import { MultiAgentStageConfig, getConfig } from '../config';
export abstract class BaseAgent {
constructor(protected readonly modelName: string) {}
@@ -145,3 +145,29 @@ Your goal is to produce a state-of-the-art final report that wows the user.
return this.callLLM(this.persona, wrappedInput, signal);
}
}
export class ConfigurableWorkflowAgent extends BaseAgent {
constructor(
modelName: string,
private readonly stage: MultiAgentStageConfig
) {
super(modelName);
}
async execute(input: string, context?: string, signal?: AbortSignal): Promise<string> {
const wrappedInput = [
`### Stage: ${this.stage.name}`,
'',
'### Available Context',
context || 'No specific context available.',
'',
'### Stage Input',
input,
'',
'### Mission',
'Complete this stage according to your role instructions. Be concise, concrete, and preserve details needed by later stages.'
].join('\n');
return this.callLLM(this.stage.prompt, wrappedInput, signal);
}
}