Files
pi-statusline/types.ts

59 lines
1.5 KiB
TypeScript

import type { UsageLimit, UsageReport } from "./usage";
export type ModuleName = "directory" | "context" | "model" | "thinking" | "cost" | "usage";
export type UsageWindow = "current" | "week" | "both";
export type UsageStyle = "line" | "text" | "miniBar";
export type UsageTextPart = "percent" | "time" | "used" | "limit" | "remaining";
export type ModuleSpec = ModuleName | {
type: ModuleName;
window?: UsageWindow;
style?: UsageStyle;
grow?: number;
parts?: UsageTextPart[];
separator?: string;
};
export interface StatusbarRowConfig {
left?: ModuleSpec[];
center?: ModuleSpec[];
right?: ModuleSpec[];
}
export interface StatusbarConfig {
separator: string;
rows: StatusbarRowConfig[];
modules: {
directory?: { showGitBranch?: boolean; showSessionName?: boolean };
context?: { showWindow?: boolean };
model?: { showProvider?: boolean; showThinking?: boolean };
thinking?: { hideWhenOff?: boolean };
cost?: { showSubscription?: boolean };
usage?: { showText?: boolean; parts?: UsageTextPart[]; separator?: string; colorBars?: boolean };
};
}
export interface StatusbarState {
report?: UsageReport;
error?: string;
thinkingLevel?: string;
}
export interface ModuleContext {
ctx: any;
footerData: any;
state: StatusbarState;
config: StatusbarConfig;
}
export interface RenderedModule {
text?: string;
grow?: number;
render?: (width: number, theme?: any) => string;
}
export interface UsageWindows {
current?: UsageLimit;
week?: UsageLimit;
}