import type { PoolQueryClient, TypedQueryClient } from "../../generated/storage-kit/index.js"; import type { Machine, Message, Session, SessionContentBackup, SessionContentImport, SessionLookupOptions, ToolCall } from "../../types/index.js"; export interface ListOptions { source?: string; project_path?: string; machine?: string; limit?: number; } export declare function listSessions(opts?: ListOptions, client?: TypedQueryClient): Promise; export declare function getRecentSessions(limit?: number, client?: TypedQueryClient): Promise; export declare function getSession(id: string, client?: TypedQueryClient): Promise; export declare function getSessionByPrefix(idOrPrefix: string, optionsOrClient?: SessionLookupOptions | TypedQueryClient, maybeClient?: TypedQueryClient): Promise; export interface SessionSearchHit { session: Session; match: "title" | "project"; } export declare function searchSessions(query: string, opts?: ListOptions, client?: TypedQueryClient): Promise; export declare function listMachines(client?: TypedQueryClient): Promise; /** * Rebuild the `machines` table's session counts from the sessions table. * Mirrors the local `recomputeMachineCounts`; the per-machine read path * (`listMachines`) derives counts from sessions either way, so this keeps the * optional metadata table current after bulk imports/merges. */ export declare function recomputeMachines(client?: TypedQueryClient): Promise; export interface CloudStats { session_count: number; message_count: number; tool_call_count: number; by_source: { source: string; sessions: number; }[]; projects: { project_name: string | null; project_path: string | null; session_count: number; }[]; } export declare function getStats(client?: TypedQueryClient): Promise; export interface UpsertSessionInput { id?: string; source: string; 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; machine?: 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; source_modified_at?: string | null; metadata?: Record; } /** * Insert or update a session row. The (source, source_id) natural key is the * idempotency key; a provided id is used only for new natural-key rows. * Cloud is authoritative - no local mirror. */ export declare function upsertSession(input: UpsertSessionInput, client?: TypedQueryClient): Promise; export interface SessionContentImportResult { session: Session; imported: { messages: number; toolCalls: number; }; backup: SessionContentBackup | null; } export declare function importSessionContent(input: SessionContentImport, client?: PoolQueryClient): Promise; export declare function getMessages(sessionId: string, client?: TypedQueryClient): Promise; export declare function getToolCalls(sessionId: string, client?: TypedQueryClient): Promise; export interface RelocateResult { /** Number of `sessions` rows whose project_path was rewritten. */ rowsUpdated: number; } /** * Rewrite session paths in the shared RDS after a project directory move * (old -> new). Mirrors the local relocate: updates `sessions.project_path`, * `sessions.source_path`, and the path-encoded `ingestion_state.file_path`. * This is the cloud (self_hosted) half of the Store's `relocatePaths`, so a * relocate against a machine in self_hosted mode mutates the ONE shared * registry instead of a non-authoritative on-box index. */ export declare function relocatePaths(oldPath: string, newPath: string, client?: PoolQueryClient): Promise; /** Delete a session by id. Returns true if a row was removed. */ export declare function deleteSession(id: string, client?: TypedQueryClient): Promise; /** * Set a session's title (the "rename" operation), resolving by full id or a * unique id prefix. Title is searched via ILIKE directly on the sessions table, * so there is no separate FTS index to keep in sync. Returns the updated * Session, or null when no match exists. */ export declare function updateSessionTitle(idOrPrefix: string, title: string, optionsOrClient?: SessionLookupOptions | TypedQueryClient, maybeClient?: TypedQueryClient): Promise; /** One content-search hit per session (mirrors lib/search `SearchHit`). */ export interface ContentSearchHit { 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 declare function sessionFilterClauses(opts: ListOptions, params: unknown[], alias?: string): string; /** * Full-text-ish content search over the shared cloud: matches on message content * and session metadata (title/project), deduped to one best hit per session. */ export declare function searchContent(query: string, opts?: ListOptions, client?: TypedQueryClient): Promise; /** One tool-call hit (mirrors lib/search `ToolCallHit`). */ export interface CloudToolCallHit { session_id: string; source: string; title: string | null; project_name: string | null; project_path: string | null; started_at: string | null; tool_name: string; snippet: string; rank: number; } /** Substring search over tool calls (name / input / output) in the shared cloud. */ export declare function searchToolCalls(query: string, opts?: ListOptions, client?: TypedQueryClient): Promise; export type CloudEntityType = "project" | "tool" | "model" | "provider" | "repo"; export interface CloudEntity { type: CloudEntityType; name: string; session_count: number; } /** Knowledge-graph entities (projects/tools/models/providers/repos) from the shared cloud. */ export declare function graphEntities(type: CloudEntityType | undefined, client?: TypedQueryClient): Promise; export interface CloudRelatedSession { session_id: string; source: string; title: string | null; project_name: string | null; started_at: string | null; } /** Sessions linked to a specific graph entity in the shared cloud. */ export declare function graphRelated(type: CloudEntityType, name: string, limit?: number, client?: TypedQueryClient): Promise; export interface CloudSessionGraph { session_id: string; project: string | null; model: string | null; provider: string | null; repo: string | null; tools: string[]; } /** The entity neighborhood of one session (resolved by id or prefix) in the shared cloud. */ export declare function graphSession(idOrPrefix: string, optionsOrClient?: SessionLookupOptions | TypedQueryClient, maybeClient?: TypedQueryClient): Promise; //# sourceMappingURL=store.d.ts.map