import type { AddAttachmentInput, AttachmentRef, AttachmentStore } from '../types/attachment.js'; import type { ContentBlock } from '../types/blocks.js'; export interface InputBuilderOptions { store: AttachmentStore; /** * Pastes ≥ this many lines collapse to a `[pasted #N]` placeholder. * Default: 8 lines. */ pasteLineThreshold?: number | undefined; /** * Pastes ≥ this many characters collapse to a placeholder regardless of * line count. Default: 2000 chars. */ pasteCharThreshold?: number | undefined; } export interface InputBuilderEvent { /** Current display string (with placeholders, before submit). */ display: string; refs: AttachmentRef[]; } /** * UI-agnostic accumulator for user input. The frontend (CLI/TUI) feeds in: * - typed text via `appendText()` * - large pastes via `appendPaste()` → returns placeholder string * - image paste via `appendImage()` → returns placeholder string * - file refs (`@path`) via `appendFile()` → returns placeholder string * * On `submit()` the builder runs the display string through AttachmentStore.expand() * and returns the final ContentBlock[] ready for `agent.run()`. * * The builder does not know what a "line" or "key" is — that is the * frontend's job. It only operates on strings and byte payloads. */ export declare class InputBuilder { private readonly store; private readonly pasteLineThreshold; private readonly pasteCharThreshold; private display; private readonly refs; constructor(opts: InputBuilderOptions); get text(): string; get attachments(): AttachmentRef[]; get isEmpty(): boolean; appendText(text: string): void; /** * Decide whether a chunk of pasted text is "big" enough to collapse. * If yes, store it and append a placeholder. If no, inline it. * Returns the placeholder string actually appended (or `null` if inlined). */ appendPaste(text: string): Promise; /** * Always collapses to `[image #N]` — images are never inlined. * `dataBase64` is the raw base64 payload (no data: prefix). */ appendImage(dataBase64: string, mediaType: string): Promise; appendFile(input: AddAttachmentInput): Promise; /** * Register-only variant of `appendPaste`. Always stores the paste and * returns the inline `[pasted #N, L lines]` token WITHOUT mutating * `display` — the caller (TUI) owns its own editable buffer as the single * source of truth, inserts the token there, and expands the buffer at * submit. The collapse decision is the caller's (it gates this call); use * `wouldCollapse()` for that. */ registerPaste(text: string): Promise; /** * Register-only variant of `appendImage` — see `registerPaste`. Returns a * seq-keyed `[image #N, LABEL]` token; does not touch `display`. */ registerImage(dataBase64: string, mediaType: string): Promise; /** * Register-only variant of `appendFile` — see `registerPaste`. Returns a * path-keyed `[file:]` token (resolved by path at expand time); does * not touch `display`. The path is read from `meta.filename` (falling back * to `meta.label`). */ registerFile(input: AddAttachmentInput): Promise; /** * Whether `appendPaste(text)` would collapse the text to a placeholder * (rather than inlining it). Lets a frontend decide where to route a paste * — e.g. collapsed pastes become a pill, while inlined ones can be shown * in the editable input row — without calling `appendPaste` first (which * mutates the display buffer). */ wouldCollapse(text: string): boolean; /** Reset display and ref list. Does NOT clear the store itself. */ reset(): void; /** * Resolve the current display string into ContentBlock[]. Empty * input returns an empty array — caller decides what to do. */ submit(): Promise; private shouldCollapse; } //# sourceMappingURL=input-builder.d.ts.map