/** * The computer's own folder picker, opened by the server. * * A browser cannot do this, and it is worth being precise about why rather than treating it as a * missing feature. `` hands back file entries with names relative * to the chosen folder and no absolute path; `showDirectoryPicker()` hands back a handle and no * path either. Both withhold it deliberately — a page that learned where you keep your files has * learned something about you that it was not given. * * But KONECK's server is on the same machine as the files, and acting through it already requires * loopback and the token. So the *server* opens the dialog: the real one, the one every other * application on the machine uses, and the path comes back because the process asking is entitled * to know it. * * Two honest limits, both reported rather than papered over. The dialog appears on the machine * running KONECK — which is the same machine, because acting is loopback-only, but somebody * tunnelling a port should know that. And a machine with no desktop session has no dialog to show: * over SSH there is nothing to put on screen, so the answer is to say so and let the built-in * browser do the job instead. */ /** What came back, or why nothing did. */ export type FolderChoice = { ok: true; path: string; } /** The person closed the dialog. Not an error, and must not be reported as one. */ | { ok: false; cancelled: true; } | { ok: false; cancelled: false; reason: string; }; /** * Runs a dialog and stops waiting if it stops answering. * * execa's own timeout signals the process it started and then waits for its pipes to close, which * is not the same thing — a dialog that dies in a way execa does not notice left the request open * for the full two minutes. Measured: a dialog killed from outside took 120,027ms to settle, while * one that exited cleanly took 2,588ms. So the wait is raced against a deadline and the process * group is signalled, which is the same shape as the fix the command runner already needed. */ export declare function runDialog(file: string, args: readonly string[], /** Injectable so the giving-up path can be tested without waiting two minutes for it. */ waitMs?: number): Promise<{ code: number | undefined; out: string; err: string; gaveUp: boolean; }>; /** Whether a desktop session exists to show a dialog on. */ export declare function hasDesktop(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): boolean; /** Which dialog tool would be used, or null when none is installed. */ export declare function dialogAvailable(platform?: NodeJS.Platform): Promise; /** * Opens the folder dialog and waits for an answer. * * A generous timeout, because the answer is a person deciding: two minutes is long enough to think * and short enough that a dialog nobody is looking at does not hold a handle for ever. */ export declare function chooseFolder(startIn?: string, title?: string, platform?: NodeJS.Platform): Promise; //# sourceMappingURL=folder-dialog.d.ts.map