import { type CloudTelemetryClient, type TelemetryClaims } from "../telemetry-events.js"; export interface ReindexOptions { /** HQ root to operate on. Defaults to process.cwd(). */ repoRoot?: string; /** * Skip reindex's own per-root "reindex"-scope lock. Internal callers * (`sync()` / `rescue()`) run reindex inline at the tail of a pass they * already serialize, and pass `true` so a standalone `hq reindex` holding the * reindex lock never blocks the sync/rescue tail (reindex is idempotent and * re-run every pass, so a benign overlap self-heals). Standalone callers * (`hq reindex`, the reindex hook) leave it falsy so concurrent reindexes are * mutually exclusive. */ skipLock?: boolean; /** * Bounded wait (seconds) for the per-root "reindex"-scope lock when another * reindex is already running. `0` → refuse immediately; omitted → inherit * `HQ_OP_LOCK_TIMEOUT` / infinite wait. Ignored when `skipLock` is set. * * NB: reindex uses a lock scope SEPARATE from sync/rescue's "operation" lock, * so a long-lived watch-mode sync-runner (which holds the operation lock for * its whole lifetime) can never starve a standalone `hq reindex` * (feedback_ed98d810). Standalone `hq reindex` waits by default, which is what * a human running it wants; the hq-core reindex HOOK (Stop / PostToolUse) * should set a small `HQ_OP_LOCK_TIMEOUT` (or `0`) so a hook fired while * another reindex runs never blocks the interactive agent indefinitely. */ lockTimeoutSec?: number; /** Optional hq-pro ACTION telemetry sink. Omitted in tests/standalone hooks. */ telemetryClient?: CloudTelemetryClient | null; telemetryClaims?: TelemetryClaims | null; telemetrySessionId?: string; telemetryCompanyUid?: string; changedCount?: number; } export interface ReindexResult { /** 0 = success; 1 = invalid repo root (mirrors the old script's exit codes). */ status: number; } /** * Run reindex against an HQ root. Synchronous — the work is cheap and * idempotent, and callers (the hook shim, sync/rescue, tests) want the exit * status. Diagnostics are written to stderr so the caller's stdout stays clean * (hooks must not emit stdout that the agent interprets). */ export declare function reindex(opts?: ReindexOptions): ReindexResult; //# sourceMappingURL=reindex.d.ts.map