UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

43 lines • 1.81 kB
/** * Reads one source between refreshes into complete, clean lines. * Ported from oh-my-pi 9df0457b31 (MIT, Copyright Can Boluk et al.). */ import type { JobTextSource } from "./source-types.ts"; /** Longest line kept; longer lines are cut. */ export declare const MAX_LINE_CHARS = 4096; /** * One source's redaction, fed its complete lines in order (`JobWidgetSourceRedactor`): `cut` marks * text the source dropped unread, `finish` the end of the source. A key spans lines, so a fresh * redactor per line would miss it. */ export interface SourceLineRedactor { push(line: string): string[]; cut(): string[]; finish(): string[]; } export interface SourceLines { lines: string[]; open: boolean; /** Offset just past the read text (the source's size so far). */ end: number; } /** * Keeps a cursor, carries the trailing partial line to the next read, turns CR and CRLF into line * breaks, strips ANSI and control characters, and cuts lines at {@link MAX_LINE_CHARS}. When the * source dropped text the reader never saw, the torn line at the gap is skipped so no rule reads * half a line. With a redactor, lines are redacted before they are cut, so a cut never splits a * secret's marker. */ export declare class SourceLineReader { #private; readonly source: JobTextSource; constructor(source: JobTextSource, redactor?: SourceLineRedactor); /** New complete lines; `flush` also ends the line in progress. */ read(flush: boolean): SourceLines; /** * The newest CR segment of the line in progress, sanitized: a progress bar redraws with CR and only * completes on the next one, so without it the view shows the previous step. Never matched by rules. */ get progress(): string | undefined; } //# sourceMappingURL=line-reader.d.ts.map