import type { Theme, ThemeColor } from "@selesai/code"; // Theme color - either a pi theme color name or a custom hex color export type ColorValue = ThemeColor | `#${string}`; export type ThemeLike = Pick; // Semantic color names for segments export type SemanticColor = | "model" | "shellMode" | "path" | "gitDirty" | "gitClean" | "thinking" | "thinkingMinimal" | "thinkingLow" | "thinkingMedium" | "context" | "contextWarn" | "contextError" | "cost" | "tokens" | "separator" | "border"; // Color scheme mapping semantic names to actual colors export type ColorScheme = Partial>; // Built-in segment identifiers export type BuiltinStatusLineSegmentId = | "model" | "identity_group" | "shell_mode" | "path" | "git" | "subagents" | "token_in" | "token_out" | "token_total" | "usage_group" | "cost" | "context_pct" | "context_total" | "time_spent" | "time" | "session" | "session_name" | "hostname" | "cache_read" | "cache_write" | "thinking" | "extension_statuses"; // Segment identifiers (built-in + dynamically registered custom items) export type StatusLineSegmentId = BuiltinStatusLineSegmentId | `custom:${string}`; // Separator styles export type StatusLineSeparatorStyle = | "powerline" | "powerline-thin" | "slash" | "pipe" | "block" | "none" | "ascii" | "dot" | "chevron" | "star"; // Preset names export type StatusLinePreset = | "default" | "minimal" | "compact" | "full" | "nerd" | "ascii" | "custom"; // Per-segment options export interface StatusLineSegmentOptions { model?: { showThinkingLevel?: boolean }; path?: { mode?: "basename" | "abbreviated" | "full"; maxLength?: number; }; git?: { showBranch?: boolean; showStaged?: boolean; showUnstaged?: boolean; showUntracked?: boolean }; time?: { format?: "12h" | "24h"; showSeconds?: boolean }; } export type CustomItemPosition = "left" | "right" | "secondary"; export interface CustomStatusItem { id: string; statusKey: string; position: CustomItemPosition; color?: ColorValue; prefix?: string; hideWhenMissing: boolean; excludeFromExtensionStatuses: boolean; } // Preset definition export interface PresetDef { leftSegments: BuiltinStatusLineSegmentId[]; rightSegments: BuiltinStatusLineSegmentId[]; /** Secondary row segments (shown in footer, above sub bar) */ secondarySegments?: BuiltinStatusLineSegmentId[]; separator: StatusLineSeparatorStyle; segmentOptions?: StatusLineSegmentOptions; /** Color scheme for this preset */ colors?: ColorScheme; } // Separator definition export interface SeparatorDef { left: string; right: string; endCaps?: { left: string; right: string; useBgAsFg: boolean; }; } // Git status data export interface GitStatus { branch: string | null; staged: number; unstaged: number; untracked: number; } // Usage statistics export interface UsageStats { input: number; output: number; cacheRead: number; cacheWrite: number; cost: number; } // Context passed to segment render functions export interface SegmentContext { // From pi-mono model: { id: string; name?: string; reasoning?: boolean; contextWindow?: number } | undefined; thinkingLevel: string; sessionId: string | undefined; sessionName: string | undefined; cwd?: string; // Computed usageStats: UsageStats; contextPercent: number; contextWindow: number; autoCompactEnabled: boolean; customCompactionEnabled: boolean; usingSubscription: boolean; sessionStartTime: number; shellModeActive: boolean; shellRunning: boolean; shellName: string | null; shellCwd: string | null; // Git git: GitStatus; // Extension statuses extensionStatuses: ReadonlyMap; hiddenExtensionStatusKeys: ReadonlySet; customItemsById: ReadonlyMap; // Options options: StatusLineSegmentOptions; // Theming theme: ThemeLike; colors: ColorScheme; } // Rendered segment output export interface RenderedSegment { content: string; visible: boolean; } // Segment definition export interface StatusLineSegment { id: BuiltinStatusLineSegmentId; render(ctx: SegmentContext): RenderedSegment; }