/** * Background index build for one-shot hosts (change: bootstrap-index-from-one-shot-orient). * * The MCP server heals an absent or stale index itself because it outlives the build. A * one-shot `openlore orient` — the command install wires as agent hooks, and the first * thing that runs in a fresh git worktree — exits in milliseconds, so it hands the build * to a detached supervisor process and returns at once. * * Two guards keep that from multiplying. Full-analysis ownership already allows one * analysis per repository across processes; the attempt stamp names the live supervisor * and stops a build that cannot succeed from being restarted on every prompt. */ import { spawn } from 'node:child_process'; import { type ChildProcessBuildOptions, type RepairReason } from './cold-start-bootstrap.js'; /** A finished attempt is not repeated inside this window, whatever its outcome. */ export declare const ONE_SHOT_BUILD_COOLDOWN_MS: number; export type OneShotBuild = { state: 'started' | 'running' | 'recently-attempted' | 'unavailable'; } | { state: 'suppressed'; detail: string; }; export interface OneShotBuildOptions { /** Test seam; production uses the current OpenLore CLI entry point. */ cliPath?: string; /** Test seam for observing the child-process boundary. */ spawnProcess?: typeof spawn; /** Injectable clock (tests). Defaults to Date.now. */ now?: () => number; } /** * Start one detached index build for `directory`, unless one is running, one ran inside * the cooldown, or auto-init is off. Synchronous and fail-soft: it never waits for the * build and never throws, so a hook that calls it cannot hold or break the user's turn. */ export declare function startDetachedIndexBuild(directory: string, reason: RepairReason, opts?: OneShotBuildOptions): OneShotBuild; /** * The supervisor's whole job: run init (when needed) and analyze as child processes and * stay alive until they finish, so the attempt stamp's PID means "a build is running". */ export declare function runBackgroundIndexBuild(directory: string, opts?: { repair?: boolean; build?: (directory: string, opts: ChildProcessBuildOptions) => Promise; }): Promise; /** * Route the read path's staleness signals to the detached build for this one-shot * process. A request counts as accepted only when a build is really in flight, so the * "repair scheduled" and "refresh started" disclosures stay true. */ export declare function registerOneShotRepair(directory: string, opts?: OneShotBuildOptions): void; /** What a one-shot caller is told about the build, or undefined when there is nothing to add. */ export declare function oneShotBuildNote(build: OneShotBuild): string | undefined; //# sourceMappingURL=one-shot-index-build.d.ts.map