diff --git a/src/MrBeast_Premium_10.md b/assets/MrBeast_Premium_10.md similarity index 100% rename from src/MrBeast_Premium_10.md rename to assets/MrBeast_Premium_10.md diff --git a/src/core/astraPath.ts b/src/core/astraPath.ts index f8a590f..4c3ccc1 100644 --- a/src/core/astraPath.ts +++ b/src/core/astraPath.ts @@ -39,44 +39,6 @@ export function getAstraDataDir(): string { return astraDir; } -/** - * .astra 내부의 특정 파일 경로를 반환합니다. - * - * @param filename - 파일 이름 (예: 'project_memory.json', 'tasks.json') - * @returns 파일의 절대 경로 - */ -export function getAstraFilePath(filename: string): string { - return path.join(getAstraDataDir(), filename); -} - -/** - * .astra 내부의 프로젝트별 서브디렉토리 경로를 반환합니다. - * 프로젝트별 메모리 분리가 필요한 경우 사용합니다. - * - * @param projectId - 프로젝트 식별자 (hash 또는 이름) - * @returns 프로젝트별 .astra 서브디렉토리 경로 - */ -export function getAstraProjectDir(projectId: string): string { - const projDir = path.join(getAstraDataDir(), 'projects', projectId); - if (!fs.existsSync(projDir)) { - fs.mkdirSync(projDir, { recursive: true }); - } - return projDir; -} - -/** - * AAL(Autonomous Loop) 태스크 파일의 경로를 반환합니다. - */ -export function getAstraTaskFilePath(): string { - return getAstraFilePath('tasks.json'); -} - -/** - * AAL 프로토콜 설정 파일 경로를 반환합니다. - */ -export function getAstraProtocolPath(): string { - return getAstraFilePath('protocol.json'); -} /** * extensionUri가 아직 설정되지 않은 경우의 fallback. diff --git a/src/core/dataProcessor.ts b/src/core/dataProcessor.ts index 9717473..174645b 100644 --- a/src/core/dataProcessor.ts +++ b/src/core/dataProcessor.ts @@ -1,10 +1,3 @@ -/** - * IDataSource: 데이터 원천에 대한 추상화 인터페이스 (DIP 준수) - */ -export interface IDataSource { - fetch(): Promise; -} - /** * 집계 결과 타입 정의 */ @@ -15,7 +8,7 @@ export interface AggregateResult { average?: number; } -export interface AggregateOptions { +interface AggregateOptions { collectValues?: boolean; } diff --git a/src/core/errors.ts b/src/core/errors.ts index 4e11c2a..0be9e7f 100644 --- a/src/core/errors.ts +++ b/src/core/errors.ts @@ -2,7 +2,7 @@ * g1nation Custom Error Classes */ -export abstract class G1Error extends Error { +abstract class G1Error extends Error { constructor(public message: string, public details?: any) { super(message); this.name = this.constructor.name; @@ -29,10 +29,6 @@ export class APICommunicationError extends G1Error { getTypeCode() { return 'API_COMMUNICATION_ERROR'; } } -export class SecurityValidationError extends G1Error { - getTypeCode() { return 'SECURITY_VALIDATION_ERROR'; } -} - export class TransactionError extends G1Error { getTypeCode() { return 'TRANSACTION_ERROR'; } } diff --git a/src/lib/api.ts b/src/lib/api.ts deleted file mode 100644 index 0a2de75..0000000 --- a/src/lib/api.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { logInfo, logError } from '../utils'; -import { ErrorType } from '../types/interfaces'; -import { ErrorClassifier } from './engine'; - -export interface ApiResponse { - success: boolean; - data?: T; - error?: { - type: ErrorType; - message: string; - isRecoverable: boolean; - }; -} - -/** - * ExternalApiHandler: 외부 서비스(Ollama, Gemini, Search API 등)와의 - * 모든 통신을 중앙 집중적으로 관리하며, 인증 복구 및 속도 제한 대응을 담당합니다. - */ -export class ExternalApiHandler { - /** - * 인증 오류 발생 시 복구 가능성을 판단하고 재시도 로직을 제어합니다. - */ - public static async handleAuthRecovery(error: any): Promise { - logInfo(`[ApiHandler] 인증 오류 감지. 복구 시도 중...`); - // TODO: 실제 프로젝트의 인증 스키마(API Key, OAuth 등)에 따른 복구 로직 구현 - // 예: 환경 변수 재로드, 만료된 토큰 갱신 요청 등 - return false; // 현재는 기본적으로 수동 개입 필요로 처리 - } - - public static async request( - call: () => Promise, - context: string - ): Promise> { - try { - const data = await call(); - return { success: true, data }; - } catch (error: any) { - logError(`[ApiHandler] [${context}] 호출 실패:`, error); - - // ErrorClassifier를 통해 시스템 통합 분류 적용 - const { type, rule } = ErrorClassifier.classify(error); - - return { - success: false, - error: { - type, - message: error.message, - isRecoverable: type === ErrorType.TRANSIENT || type === ErrorType.AUTH_FAILURE - } - }; - } - } -} diff --git a/src/types/interfaces.ts b/src/types/interfaces.ts index 86b3c7b..85f86ba 100644 --- a/src/types/interfaces.ts +++ b/src/types/interfaces.ts @@ -9,95 +9,6 @@ import * as vscode from 'vscode'; -// ─── 에이전트 서비스 인터페이스 ─── -export interface IAgentService { - /** - * LLM에 프롬프트를 보내고 스트리밍 응답을 가져옴 - */ - chat(prompt: string, context: string, model?: string): Promise>; - - /** - * 터미널 명령어 실행 (보안 정책 적용) - */ - runCommand(command: string): Promise<{ stdout: string; stderr: string }>; -} - -// ─── 파일 시스템 서비스 인터페이스 ─── -export interface IFileSystemService { - /** - * 파일 생성 - */ - createFile(filePath: string, content: string): Promise; - - /** - * 파일 읽기 - */ - readFile(filePath: string): Promise; - - /** - * 파일 수정 - */ - editFile(filePath: string, find: string, replace: string): Promise; - - /** - * 파일 삭제 - */ - deleteFile(filePath: string): Promise; - - /** - * 디렉토리 목록 조회 - */ - listDirectory(dirPath: string): Promise; -} - -// ─── 두뇌 서비스 인터페이스 ─── -export interface IBrainService { - /** - * 두뇌 폴더 경로 가져오기 - */ - getBrainDir(): string; - - /** - * 두뇌 폴더가 명시적으로 설정되었는지 확인 - */ - isBrainDirExplicitlySet(): boolean; - - /** - * 두뇌 폴더 내 파일 목록 조회 - */ - getBrainFiles(): Promise; - - /** - * 두뇌 파일 내용 읽기 - */ - readBrainFile(fileName: string): Promise; -} - -// ─── 웹뷰 서비스 인터페이스 ─── -export interface IWebviewService { - /** - * 웹뷰에 메시지 전송 - */ - postMessage(message: any): void; - - /** - * 웹뷰에서 메시지 수신 핸들러 등록 - */ - onDidReceiveMessage(callback: (message: any) => void): vscode.Disposable; -} - -// ─── HTTP 서비스 인터페이스 ─── -export interface IHttpService { - /** - * HTTP GET 요청 - */ - get(url: string, options?: any): Promise; - - /** - * HTTP POST 요청 - */ - post(url: string, data: any, options?: any): Promise; -} // ─── 공용 오류 처리 타입 (Unified Error Handling) ─── diff --git a/src/utils.ts b/src/utils.ts index 6b3db66..96763fd 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -85,11 +85,6 @@ export function shouldAutoPushBrain(): boolean { const cfg = vscode.workspace.getConfiguration('g1nation'); return cfg.get('autoPushBrain', false); } - -export function getSecondBrainRepo(): string { - return getConfig().secondBrainRepo; -} - export function getBrainProfiles(): BrainProfile[] { return getConfig().brainProfiles; } @@ -107,18 +102,6 @@ export function _isBrainDirExplicitlySet(): boolean { return getBrainProfiles().length > 0; } -export function isTextAttachment(fileName: string, mimeType: string): boolean { - const lower = fileName.toLowerCase(); - const textExtensions = [ - '.txt', '.md', '.csv', '.json', '.js', '.ts', '.jsx', '.tsx', - '.html', '.css', '.py', '.java', '.rs', '.go', '.yaml', '.yml', - '.xml', '.toml', '.sql', '.sh' - ]; - return mimeType.startsWith('text/') - || mimeType === 'application/json' - || textExtensions.some((ext) => lower.endsWith(ext)); -} - export function findBrainFiles(dir: string): string[] { let results: string[] = []; if (!fs.existsSync(dir)) return results;