export interface Session { "id": string; "source": "claude" | "codex" | "codewith" | "gemini"; "source_id": string; "source_path"?: string | null; "title"?: string | null; "project_path"?: string | null; "project_name"?: string | null; "model"?: string | null; "model_provider"?: string | null; "git_branch"?: string | null; "git_sha"?: string | null; "git_origin_url"?: string | null; "cli_version"?: string | null; "is_subagent": boolean; "parent_session_id"?: string | null; "total_input_tokens"?: number; "total_output_tokens"?: number; "total_cache_read_tokens"?: number; "total_cache_write_tokens"?: number; "total_thinking_tokens"?: number; "message_count"?: number; "tool_call_count"?: number; "started_at"?: string | null; "ended_at"?: string | null; "duration_seconds"?: number | null; "ingested_at"?: string; "updated_at"?: string; "source_modified_at"?: string | null; "machine"?: string | null; "metadata"?: Record; } export interface Machine { "name": string; "hostname"?: string | null; "platform"?: string | null; "first_seen_at"?: string; "last_seen_at"?: string; "session_count"?: number; } export interface SessionCreate { "id"?: string; "source": "claude" | "codex" | "codewith" | "gemini"; "source_id": string; "source_path"?: string | null; "title"?: string | null; "project_path"?: string | null; "project_name"?: string | null; "model"?: string | null; "model_provider"?: string | null; "git_branch"?: string | null; "git_sha"?: string | null; "git_origin_url"?: string | null; "cli_version"?: string | null; "is_subagent"?: boolean; "parent_session_id"?: string | null; "total_input_tokens"?: number; "total_output_tokens"?: number; "total_cache_read_tokens"?: number; "total_cache_write_tokens"?: number; "total_thinking_tokens"?: number; "message_count"?: number; "tool_call_count"?: number; "machine"?: string | null; "started_at"?: string | null; "ended_at"?: string | null; "duration_seconds"?: number | null; "source_modified_at"?: string | null; "metadata"?: Record; } export interface Message { "id": string; "session_id": string; "source_id"?: string | null; "parent_message_id"?: string | null; "role": "user" | "assistant" | "system" | "tool" | "info" | "thinking"; "content"?: string | null; "content_preview"?: string | null; "model"?: string | null; "is_sidechain"?: boolean; "sequence_num"?: number | null; "input_tokens"?: number; "output_tokens"?: number; "cache_read_tokens"?: number; "cache_write_tokens"?: number; "thinking_tokens"?: number; "timestamp"?: string | null; "metadata"?: Record; } export interface MessageCreate { "id"?: string; "session_id"?: string; "source_id"?: string | null; "parent_message_id"?: string | null; "role": "user" | "assistant" | "system" | "tool" | "info" | "thinking"; "content"?: string | null; "content_preview"?: string | null; "model"?: string | null; "is_sidechain"?: boolean; "sequence_num"?: number | null; "input_tokens"?: number; "output_tokens"?: number; "cache_read_tokens"?: number; "cache_write_tokens"?: number; "thinking_tokens"?: number; "timestamp"?: string | null; "metadata"?: Record; } export interface ToolCall { "id": string; "message_id"?: string | null; "session_id": string; "tool_name": string; "tool_input"?: string | null; "tool_output"?: string | null; "duration_ms"?: number | null; "status"?: "success" | "error" | "timeout"; "timestamp"?: string | null; "metadata"?: Record; } export interface ToolCallCreate { "id"?: string; "message_id"?: string | null; "session_id"?: string; "tool_name": string; "tool_input"?: string | null; "tool_output"?: string | null; "duration_ms"?: number | null; "status"?: "success" | "error" | "timeout"; "timestamp"?: string | null; "metadata"?: Record; } export interface SessionContentImport { "session": SessionCreate; "messages": Array; "toolCalls": Array; "backup"?: { "artifact"?: string | null; "created_at"?: string | null; "note"?: string | null; }; "destructive"?: { "allowContentShrink": boolean; "reason": string; }; } export interface HealthResponse { "status": string; "version": string; "mode": string; } export interface SessionResponse { "ok": boolean; "session": Session; } export interface SessionContentImportResponse { "ok": boolean; "session": Session; "imported": { "messages": number; "toolCalls": number; }; "backup"?: Record | null; } export interface MessageListResponse { "ok": boolean; "count"?: number; "messages": Array; } export interface ToolCallListResponse { "ok": boolean; "count"?: number; "toolCalls": Array; } export interface SessionListResponse { "ok": boolean; "count"?: number; "sessions": Array; } export interface SearchResponse { "ok": boolean; "query"?: string; "count"?: number; "results": Array<{ "session": Session; "match": string; "snippet"?: string; }>; } export interface SearchHitListResponse { "ok": boolean; "query"?: string; "count"?: number; "results": Array<{ "session_id": string; "source": string; "title"?: string | null; "project_name"?: string | null; "project_path"?: string | null; "started_at"?: string | null; "snippet": string; "rank": number; }>; } export interface RecallEvidenceResponse { "kind": "message" | "session" | "tool_call" | "semantic" | "graph"; "signal": string; "snippet": string; "score"?: number; } export interface RecallResultResponse { "session_id": string; "source": string; "source_id": string; "source_path"?: string | null; "title"?: string | null; "project_name"?: string | null; "project_path"?: string | null; "started_at"?: string | null; "updated_at"?: string | null; "rank": number; "score"?: number; "reason": string; "evidence"?: Array; "touched_file_paths"?: Array; "coding_entities"?: { "file_paths"?: Array; "tool_names"?: Array; "commands"?: Array; "repos"?: Array; "branches"?: Array; "commits"?: Array; }; "resume"?: { "available": boolean; "command"?: Array | null; "shell_command"?: string | null; "reason"?: string | null; }; } export interface RecallResponse { "ok": boolean; "query": string; "count": number; "results": Array; "metadata"?: { "query"?: string; "query_variants"?: Array; "significant_terms"?: Array; "semantic"?: { "attempted"?: boolean; "status"?: "used" | "skipped" | "failed"; "stored_embeddings"?: number; "openai_api_key_present"?: boolean; "reason"?: string | null; }; "signals"?: Record; }; } export interface EmbedResponse { "ok": boolean; "messagesProcessed"?: number; "chunksEmbedded"?: number; } export interface MachinesRecomputeResponse { "ok": boolean; } export interface MachinesResponse { "ok": boolean; "machines": Array; } export interface StatsResponse { "ok": boolean; "session_count": number; "message_count"?: number; "tool_call_count"?: number; "by_source"?: Array<{ "source": string; "sessions": number; }>; "projects"?: Array<{ "project_name"?: string | null; "project_path"?: string | null; "session_count": number; }>; } export interface DeleteResponse { "ok": boolean; "deleted": boolean; "id"?: string; } export interface ErrorResponse { "ok": boolean; "error": string; } export interface SessionAmbiguousResponse { "ok": false; "error": string; "code": "session_ambiguous"; "candidates": Array<{ "id": string; "source": string; "source_id": string; }>; } export interface SessionsApiOptions { /** Base URL, e.g. process.env.APP_API_URL. */ baseUrl: string; /** API key, e.g. process.env.APP_API_KEY. Sent as the 'x-api-key' header. */ apiKey?: string; /** Custom fetch (defaults to global fetch). */ fetch?: typeof fetch; /** Extra headers merged into every request. */ headers?: Record; } export declare class ApiError extends Error { readonly status: number; readonly body: unknown; constructor(status: number, message: string, body: unknown); } type SourceLookupQuery = { "source"?: string; }; export declare class SessionsApi { private readonly baseUrl; private readonly apiKey; private readonly fetchImpl; private readonly baseHeaders; constructor(options: SessionsApiOptions); private request; /** Liveness probe */ getHealth(init?: RequestInit): Promise; /** Readiness probe (DB reachable + migrated) */ getReady(init?: RequestInit): Promise; /** Generate embeddings for messages that have none yet */ embedMessages(body?: { "limit"?: number; }, init?: RequestInit): Promise; /** List known machines */ listMachines(init?: RequestInit): Promise; /** Rebuild per-machine session counts */ recomputeMachines(init?: RequestInit): Promise; /** Natural-language recall with evidence, touched files, graph context, and resume metadata */ recallSessions(query?: { "q": string; "source"?: string; "project"?: string; "machine"?: string; "limit"?: number; "semantic"?: string; }, init?: RequestInit): Promise; /** Most recent sessions */ recentSessions(query?: { "limit"?: number; }, init?: RequestInit): Promise; /** Search sessions by title/project */ searchSessions(query?: { "q": string; "source"?: string; "project"?: string; "machine"?: string; "limit"?: number; }, init?: RequestInit): Promise; /** Hybrid full-text + semantic search (RRF) */ hybridSearch(query?: { "q": string; "source"?: string; "project"?: string; "machine"?: string; "limit"?: number; }, init?: RequestInit): Promise; /** Semantic (embedding) search */ semanticSearch(query?: { "q": string; "source"?: string; "project"?: string; "machine"?: string; "limit"?: number; }, init?: RequestInit): Promise; /** List sessions */ listSessions(query?: { "source"?: string; "project"?: string; "machine"?: string; "limit"?: number; }, init?: RequestInit): Promise; /** Create or upsert a session */ createSession(body: SessionCreate, init?: RequestInit): Promise; /** Idempotently import/upsert a session with messages and tool calls */ importSessionContent(body: SessionContentImport, init?: RequestInit): Promise; /** Get a session by internal id, source-qualified id, or unique prefix */ getSession(id: string, init?: RequestInit): Promise; getSession(id: string, query?: SourceLookupQuery, init?: RequestInit): Promise; /** Delete a session */ deleteSession(id: string, init?: RequestInit): Promise; /** Set a session title */ renameSession(id: string, body: { "title": string; }, init?: RequestInit): Promise; renameSession(id: string, body: { "title": string; }, query?: SourceLookupQuery, init?: RequestInit): Promise; /** List messages for a session */ listSessionMessages(id: string, init?: RequestInit): Promise; listSessionMessages(id: string, query?: SourceLookupQuery, init?: RequestInit): Promise; /** List tool calls for a session */ listSessionToolCalls(id: string, init?: RequestInit): Promise; listSessionToolCalls(id: string, query?: SourceLookupQuery, init?: RequestInit): Promise; /** Aggregate counts */ getStats(init?: RequestInit): Promise; /** Version + mode */ getVersion(init?: RequestInit): Promise; } export {}; //# sourceMappingURL=client.d.ts.map