@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
24 lines • 1.4 kB
TypeScript
/**
* Display text for job widgets: `186 tok/s`, `5.37 ms`, `12.3k req`, `▲ 15%`, and text cut to fit.
* Ported from oh-my-pi 9df0457b31 (MIT, Copyright Can Boluk et al.).
*/
import type { JobWidgetBetter } from "./spec-types.ts";
import type { JobWidgetTrend } from "./view-types.ts";
/** Text of a value that has not arrived yet. */
export declare const MISSING_VALUE_TEXT = "-";
/** `text` cut to `max` characters, the last one an ellipsis when anything was cut. */
export declare function truncateText(text: string, max: number): string;
/**
* A number with its unit: auto decimals (>= 100 -> 0, >= 10 -> 1, else 2) unless `digits` is
* given, whole numbers without decimals, large values compacted (`12.3k`). A value that rounds up
* to 1000 of a suffix moves to the next one (`999_999` -> `1.0M`, never `1000k`). `%` attaches to
* the number; other units follow a space.
*/
export declare function formatWidgetNumber(value: number, unit?: string, digits?: number): string;
/**
* How `last` moved from `first`, judged against `better`: `▲ 15%` / `▼ 3.2%`, or the absolute move
* with its unit when `first` is 0. `success` toward `better`, `error` away from it; `undefined`
* when nothing moved.
*/
export declare function formatWidgetTrend(first: number, last: number, better: JobWidgetBetter, unit?: string): JobWidgetTrend | undefined;
//# sourceMappingURL=format.d.ts.map