feat(engine): complete stability overhaul - added state resume, deduplication, and P-Reinforce formatting
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
export class WikiFormatter {
|
||||
/**
|
||||
* 최종 에이전트 출력물을 P-Reinforce v3.0 표준 포맷으로 변환합니다.
|
||||
*/
|
||||
public static format(content: string, missionId: string): string {
|
||||
const now = new Date().toISOString();
|
||||
|
||||
// 1. Frontmatter가 없는 경우 주입
|
||||
let formatted = content;
|
||||
if (!content.trim().startsWith('---')) {
|
||||
const frontmatter = [
|
||||
'---',
|
||||
`id: ${missionId}`,
|
||||
`date: ${now}`,
|
||||
'type: knowledge_artifact',
|
||||
'standard: P-Reinforce v3.0',
|
||||
'tags: [automated, connect_ai, brain_sync]',
|
||||
'---',
|
||||
'',
|
||||
''
|
||||
].join('\n');
|
||||
formatted = frontmatter + content;
|
||||
}
|
||||
|
||||
// 2. 필수 헤더 보정 (예: Brief Summary가 없는 경우 상단에 자동 생성 시도)
|
||||
if (!formatted.includes('## 📌 Brief Summary')) {
|
||||
// 간단한 요약 추출 시도 (첫 문장 등)
|
||||
const summary = content.split('\n').find(l => l.trim().length > 10) || '요약이 생성되지 않았습니다.';
|
||||
const summarySection = `## 📌 Brief Summary\n${summary.substring(0, 200)}...\n\n`;
|
||||
formatted = formatted.replace(/---\n\n/, `---\n\n${summarySection}`);
|
||||
}
|
||||
|
||||
return formatted;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user