import { type Thread } from "../schema";
import type { Paginated } from "../../schemas/pagination";
import type { ListConversationsQuery } from "../../schemas/tenant";
export declare function createThread(tenantId: string): Promise<Thread>;
/** Tenant-scoped lookup -- returns null if the thread belongs to a different tenant. */
export declare function getThread(tenantId: string, threadId: string): Promise<Thread | null>;
/** Tenant-scoped -- bumps lastActivityAt after a message is sent on the thread. */
export declare function touchThreadActivity(tenantId: string, threadId: string): Promise<void>;
/** A conversation thread plus the durable stats we can derive for it. */
export interface ConversationSummary {
    id: string;
    createdAt: Date;
    lastActivityAt: Date;
    /** Chat turns on this thread == one token_usage row per agent invocation. */
    turnCount: number;
    totalTokens: number;
}
/**
 * Conversation list for the dashboard, newest activity first, offset-paginated
 * so a tenant with thousands of threads doesn't load them all in one response.
 * Deliberately omits message content (see listMessages in messages.ts for
 * that) -- this is just the thread row plus its token_usage aggregate. A left
 * join means a thread with no turns yet still shows up (turnCount 0), and
 * KB-format usage rows (threadId null) never join in.
 */
export declare function listConversations(tenantId: string, pagination: ListConversationsQuery): Promise<Paginated<ConversationSummary>>;
/** Tenant-wide conversation totals, independent of the paginated page window above. */
export interface ConversationStats {
    total: number;
    activeToday: number;
    turns: number;
    tokens: number;
}
/**
 * Aggregates over *all* of a tenant's threads (not just the current page) so
 * the dashboard's summary tiles stay correct regardless of pagination -- a
 * single-row aggregate query, cheap even as thread count grows.
 */
export declare function getConversationStats(tenantId: string): Promise<ConversationStats>;
