import type { PersistedGoal, GoalStore } from "../agent/goal-store.js";
import type { PersistedSession, SessionStore } from "../agent/session-store.js";
import type { PersistedStaff } from "../agent/staff-store.js";
import type { StaffStore } from "../agent/staff-store.js";
export interface SearchResult {
    type: "goal" | "session" | "message" | "staff";
    /** goalId for goals, sessionId for sessions, FTS5 rowid string for messages */
    id: string;
    title: string;
    /** FTS5 snippet() with <b> match highlighting */
    snippet: string;
    timestamp: number;
    archived: boolean;
    goalId?: string;
    sessionId?: string;
    sessionTitle?: string;
    projectId?: string;
    projectName?: string;
}
export interface SearchResults {
    results: SearchResult[];
    total: number;
}
export declare class SearchIndex {
    private db;
    private readonly dbPath;
    private _needsRebuild;
    /** Optional staff store — set before open()/rebuild to include staff in the index. */
    staffStore?: StaffStore;
    private stmts;
    constructor(dbPath: string);
    open(): void;
    close(): void;
    /**
     * Returns true if the index needs a full rebuild.
     * The flag is set during open() BEFORE ensureSchema() creates the tables.
     */
    needsRebuild(): boolean;
    /** Pre-ensureSchema check: is the DB fresh or version mismatched? */
    private checkNeedsRebuild;
    indexGoal(goal: PersistedGoal, projectId?: string): void;
    removeGoal(goalId: string): void;
    indexSession(session: PersistedSession, goalTitle?: string, projectId?: string): void;
    removeSession(sessionId: string): void;
    indexMessage(sessionId: string, sessionTitle: string, text: string, toolNames: string[], timestamp: number, projectId?: string): void;
    removeMessagesForSession(sessionId: string): void;
    indexStaff(staff: PersistedStaff, projectId?: string): void;
    removeStaff(staffId: string): void;
    rebuildFromStores(goalStore: GoalStore, sessionStore: SessionStore, _sessionsDir?: string, staffStore?: StaffStore): void;
    search(query: string, opts?: {
        type?: "all" | "goals" | "sessions" | "messages" | "staff";
        limit?: number;
        offset?: number;
        projectId?: string;
        projectNames?: Map<string, string>;
    }): SearchResults;
    private ensureSchema;
    private prepareStatements;
    private searchGoals;
    private searchSessions;
    private searchMessages;
    private searchStaffEntries;
}
//# sourceMappingURL=search-index.d.ts.map