/** * Filesystem autocomplete for project path creation. * * When a user types a partial path in the New Project form, the browser * sends `GET /api/paths/autocomplete?prefix=`. This handler * expands the prefix (tilde → $HOME, relative → absolute), lists the * containing directory, and returns up to 10 directory suggestions whose * basenames start with the typed partial segment. * * Two strategies: * 1. If the expanded prefix exists on disk as a directory — show its * immediate children (trailing separator is implicit). This is the * natural behaviour when the user has already typed a real directory * and wants to drill deeper. * 2. Otherwise — split into parent + basename prefix and do a * starts-with match so the user can filter siblings while typing. * * Dotfiles are excluded — they are rarely intentional project roots. * Symlinks to directories ARE included (readdirSync with withFileTypes * returns true for both real dirs and symlink dirs). * * Thread-safety: called from the relay-dispatcher hot path, so filesystem * enumeration uses `node:fs/promises` and yields to the event loop rather * than blocking every queued relay request behind a synchronous burst. */ export interface PathAutocompleteResult { suggestions: string[]; expandedPrefix: string; } /** * List directory suggestions for the given path prefix. * * Examples (assume $HOME=/Users/alice, dirs are `projects`, `proj-old`, * `Documents`, `.config`): * prefix="~" → expanded="/Users/alice" (exists as dir) * → children of /Users/alice/ ["projects","proj-old","Documents"] * prefix="~/pro" → expanded="/Users/alice/pro" (does NOT exist) * → starts-with "pro" in /Users/alice/ ["projects","proj-old"] * prefix="~/projects/" → expanded="/Users/alice/projects/" (exists as dir) * → children of /Users/alice/projects/ * prefix="~/projects/sr" → expanded="/Users/alice/projects/sr" (does NOT exist) * → starts-with "sr" in /Users/alice/projects/ */ export declare function handlePathAutocomplete(prefix: string): Promise; //# sourceMappingURL=paths-autocomplete.d.ts.map