/**
 * WikiQueueService — file-backed queue of "wiki-worthy" content
 * that agents enqueue from inside their conversations.
 *
 * Design (Steve, 2026-05-22 redesign — replacing the keyword heuristic):
 *
 *   1. The orchestrator-system-prompt rule teaches agents to call the
 *      `wiki-queue-add` skill when a turn produces content with lasting
 *      value (decision, person fact, customer info, pattern, learning).
 *      Agents — not regex — decide.
 *
 *   2. Items sit in the queue with `status: pending` until an agent
 *      claims one via `wiki-process-queue` and chooses (a) where in the
 *      vault to put it OR (b) skip it because it's not actually worth
 *      saving. The agent's LLM is the classifier; we never pre-pick a
 *      taxonomy beyond the frozen folders.
 *
 *   3. Bookkeeping cron / threshold reads the same queue + vault stats
 *      so it can decide when to ask an agent for a consolidation pass.
 *
 * Storage: `~/.crewly/wiki-queue/<id>.json`. Single flat directory;
 * cross-vault filtering happens at list time via the `vaultPath` field
 * inside each record.
 *
 * @module services/wiki/wiki-queue.service
 */
import { WikiSourceType } from './wiki-ingest.service.js';
export type WikiQueueStatus = 'pending' | 'claimed' | 'processed' | 'skipped';
export interface WikiQueueItem {
    id: string;
    vaultPath: string;
    queuedAt: string;
    queuedBy: string;
    sourceType: WikiSourceType;
    sourceRef: string;
    content: string;
    /** Agent's note: WHY this is worth ingesting. Audit + helps the processor. */
    reason: string;
    status: WikiQueueStatus;
    claimedBy?: string;
    claimedAt?: string;
    processedAt?: string;
    result?: {
        ingested: boolean;
        pagesWritten?: string[];
        targetPath?: string;
        summary?: string;
        skipReason?: string;
    };
}
export interface WikiQueueAddInput {
    vaultPath: string;
    queuedBy: string;
    sourceType: WikiSourceType;
    sourceRef: string;
    content: string;
    reason: string;
}
export interface WikiQueueListFilter {
    vaultPath?: string;
    status?: WikiQueueStatus;
    queuedBy?: string;
    /** Cap on returned items. Default 50. */
    limit?: number;
}
export interface WikiQueueStats {
    pending: number;
    claimed: number;
    processed: number;
    skipped: number;
    total: number;
}
/**
 * File-backed queue. Stateless other than the on-disk JSONs and an
 * in-memory cache of the root directory. Singleton because all writes
 * go to the same on-disk pool.
 */
export declare class WikiQueueService {
    private static instance;
    private readonly logger;
    private readonly rootDir;
    private initPromise;
    constructor(rootDir?: string);
    static getInstance(): WikiQueueService;
    /** Test-only reset. */
    static _resetForTesting(): void;
    /** Expose for tests. */
    getRootDir(): string;
    /** Enqueue a new candidate. Returns the persisted item. */
    add(input: WikiQueueAddInput): Promise<WikiQueueItem>;
    /** List items, newest-first, optionally filtered. */
    list(filter?: WikiQueueListFilter): Promise<WikiQueueItem[]>;
    /** Fetch one by id. Returns null when missing. */
    get(id: string): Promise<WikiQueueItem | null>;
    /**
     * Claim an item — only allowed when `status: pending`. Stamps the
     * claimant + timestamp atomically.
     */
    claim(id: string, claimedBy: string): Promise<WikiQueueItem>;
    /**
     * Mark processed. Requires the item to be `claimed` AND requires a
     * `result` with at least one of `pagesWritten` / `targetPath` / `summary`.
     */
    markProcessed(id: string, result: NonNullable<WikiQueueItem['result']>): Promise<WikiQueueItem>;
    /** Mark skipped — agent decided this isn't wiki-worthy after all. */
    markSkipped(id: string, skipReason: string): Promise<WikiQueueItem>;
    /** Status counts, optionally scoped to a vault. */
    getStats(vaultPath?: string): Promise<WikiQueueStats>;
    private validateAddInput;
    private ensureRoot;
    private writeItem;
    private readItemFile;
    private requireItem;
}
//# sourceMappingURL=wiki-queue.service.d.ts.map