import { type ImageBudget } from "../attachments/image-content.js"; import type { ChatImage } from "../types.js"; export type AttachmentKind = "text" | "image" | "document" | "binary" | "directory" | "missing"; export interface Attachment { /** Raw token as it appeared in the prompt (e.g. "@src/App.tsx"). */ raw: string; /** Absolute resolved path. */ path: string; kind: AttachmentKind; /** Inlined text contents (text kind only). */ content?: string; truncated?: boolean; /** Human-readable note (binary/missing/directory). */ note?: string; /** * Image kind only: the bytes decode to a model-supported image within the * size cap. Callers must not switch models for a rejected image. */ sendable?: boolean; } export interface FileSuggestion { /** The text to insert after the leading "@" (e.g. "src/App.tsx" or "src/"). */ value: string; /** Display label. */ label: string; isDir: boolean; } export interface MentionExpansion { /** The original prompt text, unchanged (mentions stay readable in history). */ text: string; attachments: Attachment[]; /** Context block to append to the model message, or "" if no attachments. */ contextBlock: string; } export interface ExpandMentionsOptions { visionCapable?: boolean | undefined; budget?: ImageBudget | undefined; } export declare function imageMediaType(absPath: string): string | undefined; export declare function normalizeDroppedPath(token: string): string; export declare function formatAttachmentReference(path: string, baseDir?: string): string; /** * Given the current input line and cursor index, return the partial @-mention * the user is typing, or null if the cursor is not inside one. * * A mention token starts with "@" that is at line start or preceded by * whitespace, and runs (without whitespace) up to the cursor. */ export declare function getMentionQuery(line: string, cursor: number): { query: string; start: number; } | null; /** * Synchronously list file/dir suggestions for an in-progress @-mention. * `query` is the text after "@" (may include a directory portion like * "src/comp"). Suggestions are returned relative to `baseDir` unless the * query is absolute or home-anchored. */ export declare function findFileSuggestions(query: string, baseDir?: string, limit?: number): FileSuggestion[]; /** * Extract candidate file tokens from a submitted line: * - explicit "@path" mentions (preceded by start/whitespace), and * - explicit file:// references created for dropped files. * * Returns the raw token strings (including any leading "@") in order. */ export declare function extractMentionTokens(line: string): string[]; export declare function extractExistingPathsFs(line: string, baseDir: string): string[]; export declare function stabilizeDroppedFilesInText(text: string, baseDir?: string): { text: string; files: string[]; images: string[]; }; export declare function stabilizeDroppedImagesInText(text: string, baseDir?: string): { text: string; images: string[]; }; /** * Resolve explicit references in a submitted prompt into attachment metadata. */ export declare function expandMentions(line: string, baseDir?: string, vision?: boolean | ExpandMentionsOptions): MentionExpansion; /** * Return the absolute paths of every image attachment referenced in a prompt * (via @-mention or drag-drop), regardless of whether the active model * supports vision. Used to build an OCR text layer that grounds the model * even when a provider silently ignores attached image bytes. */ export declare function imageAttachmentPaths(line: string, baseDir?: string): string[]; export declare function stabilizeImagePaths(paths: string[], baseDir?: string): string[]; export declare function loadImagePaths(paths: readonly string[], budget?: ImageBudget, baseDir?: string): ChatImage[]; export declare function loadImageAttachments(line: string, baseDir?: string): ChatImage[];