// PiCometixLine 配置类型定义 // 结构对齐 CCometixLine 的 TOML 配置,使用 JSON 持久化 /** ANSI 颜色:16 色 / 256 色 / RGB 真彩色 */ export type AnsiColor = | { c16: number } // 16 色 (0-15) | { c256: number } // 256 色 (0-255) | { r: number; g: number; b: number }; // RGB 真彩色 /** 图标风格模式 */ export type StyleMode = "plain" | "nerdFont" | "powerline"; /** 状态栏段类型 */ export type SegmentId = | "model" | "directory" | "git" | "session" | "contextWindow" | "tokens" | "cache" | "cost" | "thinking"; export interface IconConfig { plain: string; nerdFont: string; } export interface ColorConfig { icon?: AnsiColor; text?: AnsiColor; background?: AnsiColor; } export interface TextStyleConfig { textBold: boolean; } /** 单个段配置 */ export interface SegmentConfig { id: SegmentId; enabled: boolean; icon: IconConfig; colors: ColorConfig; styles: TextStyleConfig; options: Record; } /** 整体风格(分隔符等) */ export interface StyleConfig { mode: StyleMode; separator: string; } /** 完整主题/配置 */ export interface Config { /** 配置版本:用于默认值迁移(省略视为 v1,当前为 2) */ version?: number; style: StyleConfig; segments: SegmentConfig[]; theme: string; } /** 段渲染数据(对齐 CCometixLine SegmentData) */ export interface SegmentData { primary: string; secondary: string; metadata: Record; } /** 用户可配置的模型映射(对齐 CCometixLine models.toml) */ export interface ModelEntry { pattern: string; // 模型 ID 子串匹配 displayName: string; contextLimit: number; } /** 上下文修饰符:覆盖 contextLimit 并追加显示后缀 */ export interface ContextModifier { pattern: string; displaySuffix: string; contextLimit: number; } export interface ModelConfig { models: ModelEntry[]; contextModifiers: ContextModifier[]; }