/** * merlin API Client * Handles all HTTP requests to the merlin API with caching and error handling */ import type { Repository, AgentManifest, ConventionsResponse, FilesResponse } from './types.js'; /** API client configuration */ interface ClientConfig { baseUrl: string; apiKey?: string; } /** Merlin API Client */ export declare class MerlinClient { private config; private cache; private static MANIFEST_TTL; private static CONVENTIONS_TTL; private static REPOS_TTL; private static FILES_TTL; private static HOWTO_TTL; constructor(config?: Partial); /** Make an authenticated request to the API */ private fetch; /** Get list of user's repositories */ getRepositories(): Promise; /** Connect a new repository to Merlin Sights */ connectRepo(repoUrl: string, options?: { branch?: string; name?: string; }): Promise<{ success: boolean; repository?: Repository; status?: string; error?: string; }>; /** Find repository by GitHub URL */ findRepoByUrl(githubUrl: string): Promise; /** Get full manifest for a repository */ getManifest(repoId: string): Promise; /** Get quickstart guide (text format) */ getQuickstart(repoId: string): Promise; /** Get main overview (text format) */ getOverview(repoId: string): Promise; /** Get conventions and anti-patterns */ getConventions(repoId: string): Promise; /** Get files, optionally filtered by layer or purpose */ getFiles(repoId: string, options?: { layer?: string; purpose?: string; }): Promise; /** Find files by purpose (text format) */ findFiles(repoId: string, what: string): Promise; /** Search documentation */ search(repoId: string, query: string): Promise; /** Get how-to guide for a task */ getHowTo(repoId: string, task: string): Promise; /** Get impact analysis for a file - what depends on it */ getImpactAnalysis(repoId: string, filePath: string): Promise; /** Find similar code implementations */ getSimilarCode(repoId: string, description: string): Promise; /** Get code examples for common tasks */ getCodeExamples(repoId: string, task?: string): Promise; /** Clear all cached data */ clearCache(): void; /** Write state to a key */ writeState(repoId: string, key: string, value: any, options?: { agentId?: string; version?: number; }): Promise<{ success: boolean; state?: any; error?: string; }>; /** Read state from a key */ readState(repoId: string, key: string): Promise; /** List all state keys */ listStateKeys(repoId: string): Promise<{ keys: any[]; count: number; }>; /** Log an activity event */ logActivity(repoId: string, eventType: string, data: { agentId: string; sessionId?: string; eventData?: any; }): Promise<{ success: boolean; event?: any; }>; /** Get activity log */ getActivityLog(repoId: string, options?: { sessionId?: string; eventType?: string; limit?: number; since?: string; }): Promise<{ events: any[]; count: number; }>; /** Sync a task */ syncTask(repoId: string, task: { externalId?: string; title: string; description?: string; status?: 'pending' | 'in_progress' | 'completed' | 'blocked' | 'skipped'; ownerAgent?: string; phase?: string; phaseName?: string; plan?: string; planName?: string; taskNumber?: number; wave?: number; priority?: number; blockedBy?: string[]; blocks?: string[]; metadata?: any; commitSha?: string; filesChanged?: string[]; }): Promise<{ success: boolean; task?: any; }>; /** Get tasks */ getTasks(repoId: string, options?: { status?: string; phase?: string; plan?: string; ownerAgent?: string; }): Promise<{ tasks: any[]; count: number; byStatus: Record; }>; /** Report a blocker */ reportBlocker(repoId: string, blocker: { agentId: string; taskId?: string; blockerType: 'human_verify' | 'auth_required' | 'clarification' | 'decision_point' | 'external' | 'error' | 'other'; severity?: 'low' | 'medium' | 'high' | 'critical'; title: string; description?: string; context?: any; }): Promise<{ success: boolean; blocker?: any; }>; /** Get blockers */ getBlockers(repoId: string, status?: string): Promise<{ blockers: any[]; count: number; }>; /** Create a checkpoint */ createCheckpoint(repoId: string, checkpoint: { agentId: string; sessionId?: string; taskId?: string; checkpointType: 'human_verify' | 'auth_gate' | 'decision_point' | 'approval' | 'review'; title: string; description?: string; completedTasks?: any[]; whatWasBuilt?: string; filesChanged?: string[]; commits?: string[]; verificationItems?: string[]; options?: any; resumeContext?: any; }): Promise<{ success: boolean; checkpoint?: any; }>; /** Get pending checkpoints */ getCheckpoints(repoId: string, options?: { status?: string; sessionId?: string; }): Promise<{ checkpoints: any[]; count: number; }>; /** Update session */ updateSession(repoId: string, session: { sessionId: string; agentId: string; status?: 'active' | 'paused' | 'completed' | 'abandoned'; currentPhase?: string; currentPlan?: string; currentTask?: string; tasksCompleted?: number; tasksTotal?: number; pauseReason?: string; resumeContext?: any; }): Promise<{ success: boolean; session?: any; }>; /** Get team state - consolidated view of all agent activity */ getTeamState(repoId: string): Promise<{ state: Record; activeSessions: any[]; pendingCheckpoints: any[]; openBlockers: any[]; taskSummary: { total: number; pending?: number; in_progress?: number; completed?: number; }; recentActivity: any[]; }>; /** Ask a question about the codebase using AI */ ask(repoId: string, question: string, options?: { quick?: boolean; }): Promise<{ answer: string; sources?: Array<{ name: string; path: string | null; type: string; relevance: string; }>; searchMethod?: string; confidence?: string; quick?: boolean; }>; /** Save a discovery - teach Sights what Claude learned */ saveDiscovery(repoId: string, discovery: { query: string; summary: string; relevantFiles?: Array<{ path: string; reason: string; }>; patterns?: string[]; relatedTopics?: string[]; agentId?: string; }): Promise<{ success: boolean; discovery?: any; message?: string; }>; /** Find discoveries matching a query */ matchDiscovery(repoId: string, query: string): Promise<{ found: boolean; discoveries: any[]; bestMatch?: any; message?: string; }>; /** Confirm a discovery was helpful */ confirmDiscovery(repoId: string, discoveryId: string): Promise<{ success: boolean; discovery?: any; }>; /** Reject a discovery */ rejectDiscovery(repoId: string, discoveryId: string, reason?: string): Promise<{ success: boolean; discovery?: any; deleted?: boolean; }>; /** List all discoveries for a repo */ listDiscoveries(repoId: string, limit?: number): Promise<{ discoveries: any[]; count: number; }>; } /** Get or create the API client instance */ export declare function getClient(): MerlinClient; export {}; //# sourceMappingURL=client.d.ts.map