/** * A2A API Client * Node.js 내장 fetch 사용 (외부 의존성 없음) */ /** * #68 (ADR-050): HTTP status를 에러 객체에 실어 caller가 **문자열이 아니라 코드**로 분기하게 한다. * * 이전에는 429가 `new Error('요청 제한: 잠시 후 다시 시도하세요')`로만 던져져 메시지에 * '429'도 'rate limit'도 없었다. 그래서 substring 매칭으로 429를 감지하려던 코드는 * **절대 발화하지 않는 죽은 코드**였고, mock이 영문 '429 Too Many Requests'를 던지는 * 테스트가 그 허구를 통과시켰다(mock 자기일치 — code-generation 룰 21). */ export interface HttpStatusError extends Error { status?: number; } /** 에러에서 HTTP status를 꺼낸다 (없으면 undefined). 문자열 매칭 금지. */ export declare function getErrorStatus(err: unknown): number | undefined; export interface A2AClientConfig { baseUrl: string; apiKey: string; timeout?: number; } export interface RemoteMemory { id: string; content: string; category: string; tier?: string; tags?: string[]; metadata?: Record; created_at: string; updated_at: string; access_count?: number; agent_id?: string; last_accessed_at?: string; embedding?: number[]; vector_clock?: Record; parent_id?: string; chunk_index?: number; chunk_total?: number; quality_score?: number; } export declare class A2AClient { private config; private timeout; private encryptionKey; private enabledFeatures; constructor(config: A2AClientConfig); /** * 활성화된 Feature 목록 설정 (헤더 전송용) */ setEnabledFeatures(features: string[]): void; /** * 암호화 키 설정 */ setEncryptionKey(key: Buffer): void; /** * 암호화 키 해제 */ clearEncryptionKey(): void; /** * 암호화 활성화 여부 */ isEncryptionEnabled(): boolean; /** * 메모리 생성 */ createMemory(input: { content: string; category: string; tier?: string; tags?: string[]; }): Promise; /** * 메모리 검색 */ searchMemories(query: string, options?: { limit?: number; category?: string; }): Promise; /** * 메모리 목록 */ listMemories(options?: { limit?: number; offset?: number; includeEmbedding?: boolean; }): Promise; /** * 메모리 복호화 헬퍼 */ private decryptMemory; /** * 메모리 업데이트 */ updateMemory(id: string, updates: Partial<{ content: string; category: string; tags: string[]; }>): Promise; /** * 메모리 삭제 */ deleteMemory(id: string): Promise; /** * 팀 목록 조회 */ listTeams(): Promise; /** * 팀 메모리 목록 */ listTeamMemories(teamPath: string, options?: { limit?: number; offset?: number; }): Promise; /** * 팀 메모리 추가 */ addTeamMemory(teamPath: string, input: { content: string; category: string; tier?: string; tags?: string[]; }): Promise; /** * 팀 메모리 검색 */ searchTeamMemories(teamPath: string, query: string, options?: { limit?: number; category?: string; }): Promise; /** * Delta 생성 */ generateDelta(teamPath: string, memoryId: string, vectorClock: Record): Promise; /** * Delta 적용 */ applyDelta(teamPath: string, memoryId: string, delta: unknown): Promise; /** * 배치 메모리 생성 (최대 100개/요청) */ createMemoriesBatch(items: Array<{ content: string; category: string; tier?: string; tags?: string[]; created_at?: string; parent_id?: string; chunk_index?: number; chunk_total?: number; quality_score?: number; }>): Promise<{ created: number; failed: number; ids: string[]; errors: string[]; }>; /** * 연결 테스트 */ testConnection(): Promise; /** * 컨텍스트 조합 (서버 고급 검색) */ assembleContext(query: string, options?: { maxMemories?: number; maxTokens?: number; categories?: string[]; tier?: string; }): Promise<{ memories: RemoteMemory[]; totalTokens: number; context: string; }>; /** * 메모리 강화 (access_count 증가) */ reinforceMemory(id: string): Promise; /** * 메모리 피드백 강화 — fire-and-forget용 * injection effectiveness > 0.3인 메모리에 대해 성공/실패 피드백 전송 * 에러 시 로그만 남기고 throw하지 않음 */ reinforceMemoryFeedback(remoteId: string, success: boolean): Promise; /** * 메모리 승격 (semantic tier로 고정) * NOTE: 서버는 target_tier 파라미터를 무시하고 항상 semantic으로 승격합니다. */ promoteMemory(id: string, _targetTier?: string): Promise; /** * 통계 조회 */ getStats(): Promise<{ totalMemories: number; categoryCounts: Record; tierCounts: Record; averageAccessCount: number; }>; /** * 인기 태그 조회 */ getPopularTags(limit?: number): Promise>; /** * 팀 통계 조회 */ getTeamStats(teamPath: string): Promise<{ totalMemories: number; totalNodes: number; lastSyncedAt: string | null; }>; /** * 숙련도 이벤트 전송 */ postProficiencyEvent(event: { skill_memory_id: string; outcome: string; difficulty: number; context_tags: string[]; session_id?: string; }): Promise<{ previous_level: number; new_level: number; activation: number; experience_count: number; level_changed: boolean; }>; /** * 배치 이벤트 전송 (오프라인 큐 flush용) */ postProficiencyEventBatch(events: Array<{ skill_memory_id: string; outcome: string; difficulty: number; context_tags: string[]; session_id?: string; }>): Promise; /** * 숙련도 목록 조회 (캐시용) */ listProficiencies(projectPath?: string): Promise>; analyzeEmotion(message: string): Promise; /** * 숙련도 내보내기 */ exportProficiencies(sourceProvider: string, skillIds?: string[]): Promise<{ package: Record; skills_count: number; }>; /** * 숙련도 가져오기 */ importProficiencies(pkg: Record, targetProvider: string): Promise<{ imported: number; skipped: number; failed: number; compatibility_score: number; transfer_record_id: string; }>; /** * 호환성 매트릭스 조회 */ getCompatibilityMatrix(): Promise>; /** * 이식 이력 조회 */ getTransferHistory(page?: number): Promise<{ items: Array<{ id: string; source_agent_id: string; target_agent_id: string; source_provider: string; target_provider: string; skills_count: number; compatibility_score: number; status: string; created_at: string; }>; total: number; page: number; total_pages: number; }>; /** * 파일 업로드 (multipart/form-data) * POST /api/v1/files/upload */ /** * 파일 업로드 (multipart/form-data) * POST /api/v1/files/upload * 서버 응답: { file_id, filename, storage_path, content_hash, size } */ uploadFile(filePath: string, options: { category?: string; tags?: string[]; }): Promise<{ id: string; filename: string; }>; /** * 파일 중복 확인 * POST /api/v1/files/check-duplicate { content_hash } * 서버 응답: { is_duplicate: bool, existing_file?: { id, ... } } */ checkFileDuplicate(contentHash: string): Promise<{ exists: boolean; file_id?: string; }>; /** * 메모리-파일 연결 생성 * POST /api/v1/memory-files */ createMemoryFileLink(memoryId: string, fileId: string, options: { reference_type?: string; reference_path?: string; }): Promise<{ id: string; }>; /** * MCG Context 생성 * POST /api/v1/mcg/contexts */ createContext(data: { topic: string; summary?: string; source_type?: string; source_id?: string; memory_count?: number; }): Promise<{ id: string; }>; /** * MCG Context Member 추가 * POST /api/v1/mcg/contexts/{contextId}/members */ addContextMember(contextId: string, data: { memory_id: string; role: string; }): Promise<{ id: string; }>; /** * MCG Relation 생성 * POST /api/v1/mcg/relations */ createRelation(data: { source_id: string; target_id: string; relation_type: string; score?: number; context_id?: string; }): Promise<{ id: string; }>; /** * 콘텐츠를 Taxonomy로 분류 * 서버가 없거나 실패 시 null 반환 (graceful degradation) */ classifyContent(input: { content: string; tags?: string[]; category?: string; }): Promise<{ domain: string; domain_name: string; skill_id: string | null; skill_name: string | null; nature: string | null; stability: string | null; demand: string | null; confidence: number; classified_by: string; matched_keywords: string[]; } | null>; /** 재시도 가능한 상태 코드 (5xx, 429) */ private static readonly RETRYABLE_STATUS; private static readonly MAX_RETRIES; private static readonly BASE_DELAY_MS; /** * HTTP 요청 실행 (5xx/429/네트워크 오류 시 최대 3회 재시도, exponential backoff) */ private request; /** * multipart/form-data 요청 실행 (파일 업로드 전용) * Content-Type 헤더를 직접 설정하지 않아야 브라우저/Node가 boundary를 자동 설정합니다. */ private requestMultipart; /** * 에러 응답 처리 */ private handleErrorResponse; } //# sourceMappingURL=client.d.ts.map