fix: v2.13.0 - stability fixes (model persistence & agent abort logic)
This commit is contained in:
+14
-3
@@ -534,6 +534,10 @@ export class AgentExecutor {
|
||||
options: any
|
||||
) {
|
||||
if (!this.webview) return;
|
||||
this.stop(); // Abort any previous run
|
||||
this.abortController = new AbortController();
|
||||
const signal = this.abortController.signal;
|
||||
|
||||
this.statusBarManager.updateStatus(AgentStatus.Thinking, 'Multi-Agent Workflow Started');
|
||||
this.webview.postMessage({ type: 'streamStart' });
|
||||
|
||||
@@ -549,19 +553,23 @@ export class AgentExecutor {
|
||||
const brainContext = `Brain: ${activeBrain.name}, Files: ${brainFiles.length}`;
|
||||
|
||||
// --- Phase 1: Planner ---
|
||||
if (signal.aborted) return;
|
||||
this.webview.postMessage({ type: 'autoContinue', value: 'Planner: 전략 수립 중...' });
|
||||
const plan = await planner.execute(prompt, brainContext);
|
||||
const plan = await planner.execute(prompt, brainContext, signal);
|
||||
this.webview.postMessage({ type: 'streamChunk', value: `\n\n### 📝 작업 계획 (Execution Plan)\n${plan}\n\n` });
|
||||
|
||||
// --- Phase 2: Researcher ---
|
||||
if (signal.aborted) return;
|
||||
this.webview.postMessage({ type: 'autoContinue', value: 'Researcher: 지식 검색 중...' });
|
||||
const research = await researcher.execute(plan, brainContext);
|
||||
const research = await researcher.execute(plan, brainContext, signal);
|
||||
this.webview.postMessage({ type: 'streamChunk', value: `\n\n### 🔍 분석 결과 (Research Findings)\n*(정보 수집 및 정제 완료)*\n\n` });
|
||||
|
||||
// --- Phase 3: Writer ---
|
||||
if (signal.aborted) return;
|
||||
this.webview.postMessage({ type: 'autoContinue', value: 'Writer: 보고서 작성 중...' });
|
||||
const finalReport = await writer.execute(research, prompt);
|
||||
const finalReport = await writer.execute(research, prompt, signal);
|
||||
|
||||
if (signal.aborted) return;
|
||||
this.webview.postMessage({ type: 'streamChunk', value: `\n\n--- \n\n${finalReport}` });
|
||||
this.webview.postMessage({ type: 'streamEnd' });
|
||||
|
||||
@@ -575,6 +583,9 @@ export class AgentExecutor {
|
||||
const friendly = ErrorTranslator.translate(error);
|
||||
logError('Workflow failed', error);
|
||||
|
||||
// Clear autoContinue state by sending empty value or specific type
|
||||
this.webview.postMessage({ type: 'autoContinue', value: '' });
|
||||
|
||||
// Format error using guideline-compliant UI (Red color scheme)
|
||||
this.webview.postMessage({
|
||||
type: 'error',
|
||||
|
||||
Reference in New Issue
Block a user