@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
39 lines • 1.66 kB
TypeScript
/**
* Per-source line statistics: what the fallback view shows and the samples the author reads.
* Ported from oh-my-pi 9df0457b31 (MIT, Copyright Can Boluk et al.).
*/
import { type TimedCount } from "./field-state.ts";
import type { JobWidgetSampleLines } from "./source-types.ts";
export declare const MAX_STAGE_CHARS = 200;
export interface SourceStats {
id: string;
label: string;
size: number;
lines: number;
head: string[];
tail: string[];
lastLine?: string;
lastActiveAt: number;
recent: TimedCount[];
}
/** What the author reads about one source. */
export interface JobWidgetSourceSample {
id: string;
label: string;
/** Text read so far, in the source's own unit. */
size: number;
/** Non-empty lines read so far. */
lines: number;
/** First and last non-empty lines (no overlap), oldest first. */
head: string[];
tail: string[];
}
export declare function newSourceStats(id: string, label: string): SourceStats;
/** Folds a refresh's lines into `stats`; returns whether any was non-empty. */
export declare function recordLines(stats: SourceStats, lines: readonly string[], t: number): boolean;
/** Last non-empty line of the most recently active source, a pipe preferred over the job's own output. */
export declare function latestLine(all: Iterable<SourceStats>): string | undefined;
export declare function sourceSample(stats: SourceStats): JobWidgetSourceSample;
/** Samples as plain line lists for the validation dry run. */
export declare function sampleLines(samples: readonly JobWidgetSourceSample[]): JobWidgetSampleLines[];
//# sourceMappingURL=source-stats.d.ts.map