/** * File-search hook — @-token detection, file search, and file picker * selection handler. Extracted from app.tsx (Issue #23, PR 4). * * Drives the component: watches buffer/cursor for an * active `@` token, calls searchFiles(), dispatches matches, * and on Enter/click registers the picked file as an attachment. */ import type { InputBuilder } from '@wrongstack/core/agent'; import type { Action, State } from '../app-reducer.js'; import { type TokenPreviewStore } from '../token-previews.js'; /** * Keystroke coalescing window for `@`-file search. Long enough to swallow a * burst of typing, short enough that the results feel attached to the keys. */ export declare const FILE_SEARCH_DEBOUNCE_MS = 150; /** * Find an active `@` token at the cursor. The token starts at the * last `@` not preceded by a non-whitespace char, and runs up to the cursor * (no whitespace allowed inside). Returns null if no active token. */ export declare function detectAtToken(buffer: string, cursor: number): { start: number; end: number; query: string; } | null; export interface UseFileSearchOptions { state: State; dispatch: React.Dispatch; projectRoot: string; builderRef: React.MutableRefObject; draftRef: React.MutableRefObject<{ buffer: string; cursor: number; }>; setDraft: (buffer: string, cursor: number) => void; tokenPreviewsRef: React.MutableRefObject; } export interface FileSearchResult { /** Called from the host's Enter handler when the file picker is open. */ onPickerEnter: () => Promise; } /** * Watches buffer/cursor for `@` tokens, drives file search, and * provides the Enter handler for the component. */ export declare function useFileSearch(options: UseFileSearchOptions): FileSearchResult; //# sourceMappingURL=use-file-search.d.ts.map