/** * Telling a slash command from a file path, and showing a pasted path compactly. * * Both problems come from the same place: a prompt that begins with `/` is usually a command, but * an absolute path begins with `/` too. Treating them alike meant that pasting an image path and * asking a question about it produced "Unknown command: /home/kona/Pictures/yah.png" and the * request was never run at all. */ /** * Whether the first word of a prompt is a slash command rather than a path. * * A command is one word: a leading slash and then letters, digits, dashes. A path has more slashes * in it, or a dot, or both. That single distinction settles every real case — `/config model x` is * a command, `/home/kona/Pictures/yah.png fix this` is not — without needing a list of commands to * check against, which would misread a typo as a path and send it to the model. */ export declare function isSlashCommand(text: string): boolean; export type MentionKind = 'image' | 'file' | 'dir'; export interface Mention { /** The path exactly as it appeared in the prompt. */ raw: string; kind: MentionKind; } /** * The file and directory paths mentioned in a prompt, in the order they appear. * * `exists` decides what is real, so an invented path in prose is left alone rather than dressed up * as an attachment. Trailing punctuation is stripped, because a path at the end of a sentence * usually has a comma or a full stop stuck to it. */ export declare function findMentions(text: string, exists: (absolutePath: string) => 'file' | 'dir' | null, home?: string): Mention[]; /** * The prompt as it should be shown, with real paths shortened to their name. * * The model still receives the full path — it needs it to open the file — but a transcript reading * "/home/kona/Pictures/yah.png fix this part" buries the question inside the plumbing. The name is * kept rather than a bare counter, because "[Image: yah.png]" says which image and "[Image #3]" * does not. */ export declare function shortenMentions(text: string, mentions: readonly Mention[]): string; //# sourceMappingURL=mentions.d.ts.map