feat: add configurable pi statusbar extension
This commit is contained in:
58
types.ts
Normal file
58
types.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user