/** * Typed HTTP client for the Botmem REST API. */ export interface Memory { id: string; text: string; sourceType: string; connectorType: string; sourceId: string; eventTime: string; ingestTime: string; importance: number | null; factuality: string | null; entities: string | null; claims: string | null; weights: string | null; metadata: Record | string | null; embeddingStatus: string; createdAt: string; accountIdentifier?: string | null; [key: string]: unknown; } export interface SearchResult { id: string; text: string; sourceType: string; connectorType: string; eventTime: string; factuality: string; entities: string; metadata: Record | string | null; accountIdentifier: string | null; score: number; weights: { semantic: number; recency: number; importance: number; trust: number; final: number; }; } export interface MemoryStats { total: number; bySource: Record; byConnector: Record; byFactuality: Record; } export interface GraphData { nodes: Array<{ id: string; label: string; type: string; [key: string]: unknown; }>; edges: Array<{ source: string; target: string; type: string; [key: string]: unknown; }>; } export interface Contact { id: string; displayName: string; avatars: string; metadata: string; createdAt: string; updatedAt: string; identifiers: Array<{ id: string; identifierType: string; identifierValue: string; connectorType: string | null; confidence: number; }>; [key: string]: unknown; } export interface ConnectorAccount { id: string; type: string; identifier: string; status: string; schedule: string | null; lastSync: string | null; memoriesIngested: number | null; lastError: string | null; } export interface Job { id: string; connector: string; accountId: string; accountIdentifier: string | null; status: string; priority: number; progress: number | null; total: number | null; startedAt: string | null; completedAt: string | null; error: string | null; } export interface QueueStats { [queueName: string]: { waiting: number; active: number; completed: number; failed: number; delayed: number; contradictions?: Array<{ jobId: string; dbStatus?: string; bullState: string; action: string; }>; }; } export interface RawEventDebt { total: number; groups: Array<{ connectorType: string; sourceType: string; processingState: string; count: number; }>; } export interface MemoryRaw { memory: Record; rawEvent: Record | null; connectorRaw: Record | null; asset: { originalUrl: string; thumbnailUrl: string; } | null; } export interface MemoryRawFile { buffer: Buffer; contentType: string; fileName: string | null; } export declare class BotmemApiError extends Error { status: number; body?: unknown | undefined; constructor(message: string, status: number, body?: unknown | undefined); } export declare class BotmemClient { private baseUrl; private token; constructor(baseUrl: string); setToken(token: string): void; private request; private requestFile; searchMemories(query: string, filters?: Record, limit?: number, memoryBankId?: string, debug?: boolean): Promise<{ items: SearchResult[]; fallback: boolean; resolvedEntities?: { contacts: { id: string; displayName: string; }[]; topicWords: string[]; topicMatchCount?: number; }; diagnostics?: unknown; }>; listMemories(params?: { limit?: number; offset?: number; connectorType?: string; sourceType?: string; }): Promise<{ items: Memory[]; total: number; }>; getMemory(id: string): Promise; getMemoryRaw(id: string): Promise; getMemoryRawFile(id: string, variant?: 'original' | 'thumbnail'): Promise; deleteMemory(id: string): Promise<{ ok: boolean; }>; getMemoryStats(): Promise; listContacts(params?: { limit?: number; offset?: number; }): Promise<{ items: Contact[]; total: number; }>; searchContacts(query: string): Promise; getContact(id: string): Promise; getContactMemories(id: string): Promise; listAccounts(): Promise<{ accounts: ConnectorAccount[]; }>; archiveAccount(id: string): Promise; listJobs(accountId?: string): Promise<{ jobs: Job[]; }>; triggerSync(accountId: string): Promise<{ job: Job; } | { skipped: true; reason: string; }>; cancelJob(id: string): Promise<{ ok: boolean; }>; retryFailedJobs(): Promise<{ ok: boolean; retried: number; }>; retryFailedMemories(): Promise<{ enqueued: number; total: number; }>; getQueueStats(): Promise; getRawEventDebt(params?: { connectorType?: string; sourceType?: string; }): Promise; getLogSummary(): Promise>; getVersion(): Promise<{ buildTime: string; uptime: number; version?: string; gitHash?: string; }>; createCliSession(params: { codeChallenge: string; codeChallengeMethod: string; redirectUri: string; state: string; }): Promise<{ sessionId: string; loginUrl: string; }>; exchangeCliCode(params: { code: string; codeVerifier: string; redirectUri: string; }): Promise<{ accessToken: string; refreshToken: string; user: { id: string; email: string; name: string; }; }>; submitRecoveryKey(recoveryKey: string): Promise>; agentAsk(query: string, filters?: Record, limit?: number, conversationId?: string): Promise>; agentSummarize(query: string, maxResults?: number): Promise>; agentContext(contactId: string): Promise>; listMemoryBanks(): Promise[]>; createMemoryBank(name: string): Promise>; renameMemoryBank(id: string, name: string): Promise>; deleteMemoryBank(id: string): Promise; getTimeline(params: { from?: string; to?: string; connectorType?: string; sourceType?: string; query?: string; limit?: number; fromMe?: boolean; }): Promise<{ items: Memory[]; total: number; }>; getActivity(params: { from?: string; to?: string; connectorType?: string; sourceType?: string; query?: string; limit?: number; }): Promise<{ items: Memory[]; total: number; }>; getRelated(memoryId: string, limit?: number): Promise<{ items: Array<{ id: string; text: string; sourceType: string; connectorType: string; eventTime: string; score: number; relationship: string; }>; source: Memory | null; }>; searchEntities(query: string, limit?: number, type?: string): Promise<{ entities: Array<{ value: string; type: string; memoryCount: number; connectors: string[]; }>; total: number; }>; getEntityGraph(value: string, limit?: number): Promise<{ entity: string; memories: Array<{ id: string; eventTime?: string; sourceType: string; connectorType: string; text: string; }>; relatedEntities: Array<{ value: string; type: string; count: number; }>; contacts: Array<{ id: string; displayName: string; }>; memoryCount: number; }>; }