@owloops/claude-powerline 1.24.3 → 1.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +5 -43
  2. package/dist/browser.d.ts +676 -0
  3. package/dist/browser.js +3 -0
  4. package/dist/index.mjs +12 -12
  5. package/package.json +9 -1
  6. package/plugin/templates/config-full.json +1 -1
  7. package/plugin/templates/config-tui-compact.json +3 -3
  8. package/plugin/templates/config-tui-full.json +4 -4
  9. package/plugin/templates/config-tui-standard.json +4 -4
  10. package/src/browser.ts +203 -0
  11. package/src/config/defaults.ts +79 -0
  12. package/src/config/loader.ts +462 -0
  13. package/src/index.ts +90 -0
  14. package/src/powerline.ts +904 -0
  15. package/src/segments/block.ts +31 -0
  16. package/src/segments/context.ts +221 -0
  17. package/src/segments/git.ts +492 -0
  18. package/src/segments/index.ts +25 -0
  19. package/src/segments/metrics.ts +175 -0
  20. package/src/segments/pricing.ts +454 -0
  21. package/src/segments/renderer.ts +796 -0
  22. package/src/segments/session.ts +207 -0
  23. package/src/segments/tmux.ts +35 -0
  24. package/src/segments/today.ts +191 -0
  25. package/src/themes/dark.ts +52 -0
  26. package/src/themes/gruvbox.ts +52 -0
  27. package/src/themes/index.ts +131 -0
  28. package/src/themes/light.ts +52 -0
  29. package/src/themes/nord.ts +52 -0
  30. package/src/themes/rose-pine.ts +52 -0
  31. package/src/themes/tokyo-night.ts +52 -0
  32. package/src/tui/grid.ts +712 -0
  33. package/src/tui/index.ts +4 -0
  34. package/src/tui/layouts.ts +285 -0
  35. package/src/tui/primitives.ts +175 -0
  36. package/src/tui/renderer.ts +206 -0
  37. package/src/tui/sections.ts +1080 -0
  38. package/src/tui/types.ts +181 -0
  39. package/src/utils/budget.ts +47 -0
  40. package/src/utils/cache.ts +247 -0
  41. package/src/utils/claude.ts +489 -0
  42. package/src/utils/color-support.ts +118 -0
  43. package/src/utils/colors.ts +120 -0
  44. package/src/utils/constants.ts +176 -0
  45. package/src/utils/formatters.ts +160 -0
  46. package/src/utils/logger.ts +5 -0
  47. package/src/utils/terminal-width.ts +117 -0
  48. package/src/utils/terminal.ts +11 -0
@@ -0,0 +1,676 @@
1
+ //#region src/utils/claude.d.ts
2
+ interface ClaudeHookData {
3
+ hook_event_name: string;
4
+ session_id: string;
5
+ transcript_path: string;
6
+ cwd: string;
7
+ model: {
8
+ id: string;
9
+ display_name: string;
10
+ };
11
+ workspace: {
12
+ current_dir: string;
13
+ project_dir: string;
14
+ };
15
+ version?: string;
16
+ output_style?: {
17
+ name: string;
18
+ };
19
+ cost?: {
20
+ total_cost_usd: number;
21
+ total_duration_ms: number;
22
+ total_api_duration_ms: number;
23
+ total_lines_added: number;
24
+ total_lines_removed: number;
25
+ };
26
+ context_window?: {
27
+ total_input_tokens: number;
28
+ total_output_tokens: number;
29
+ context_window_size: number;
30
+ used_percentage?: number | null;
31
+ remaining_percentage?: number | null;
32
+ current_usage?: {
33
+ input_tokens: number;
34
+ output_tokens: number;
35
+ cache_creation_input_tokens: number;
36
+ cache_read_input_tokens: number;
37
+ };
38
+ };
39
+ exceeds_200k_tokens?: boolean;
40
+ rate_limits?: {
41
+ five_hour?: {
42
+ used_percentage: number;
43
+ resets_at: number;
44
+ };
45
+ seven_day?: {
46
+ used_percentage: number;
47
+ resets_at: number;
48
+ };
49
+ };
50
+ }
51
+ //#endregion
52
+ //#region src/themes/dark.d.ts
53
+ declare const darkTheme: ColorTheme;
54
+ declare const darkAnsi256Theme: ColorTheme;
55
+ declare const darkAnsiTheme: ColorTheme;
56
+ //#endregion
57
+ //#region src/themes/light.d.ts
58
+ declare const lightTheme: ColorTheme;
59
+ declare const lightAnsi256Theme: ColorTheme;
60
+ declare const lightAnsiTheme: ColorTheme;
61
+ //#endregion
62
+ //#region src/themes/nord.d.ts
63
+ declare const nordTheme: ColorTheme;
64
+ declare const nordAnsi256Theme: ColorTheme;
65
+ declare const nordAnsiTheme: ColorTheme;
66
+ //#endregion
67
+ //#region src/themes/tokyo-night.d.ts
68
+ declare const tokyoNightTheme: ColorTheme;
69
+ declare const tokyoNightAnsi256Theme: ColorTheme;
70
+ declare const tokyoNightAnsiTheme: ColorTheme;
71
+ //#endregion
72
+ //#region src/themes/rose-pine.d.ts
73
+ declare const rosePineTheme: ColorTheme;
74
+ declare const rosePineAnsi256Theme: ColorTheme;
75
+ declare const rosePineAnsiTheme: ColorTheme;
76
+ //#endregion
77
+ //#region src/themes/gruvbox.d.ts
78
+ declare const gruvboxTheme: ColorTheme;
79
+ declare const gruvboxAnsi256Theme: ColorTheme;
80
+ declare const gruvboxAnsiTheme: ColorTheme;
81
+ //#endregion
82
+ //#region src/themes/index.d.ts
83
+ interface SegmentColor {
84
+ bg: string;
85
+ fg: string;
86
+ }
87
+ interface ColorTheme {
88
+ directory: SegmentColor;
89
+ git: SegmentColor;
90
+ model: SegmentColor;
91
+ session: SegmentColor;
92
+ block: SegmentColor;
93
+ today: SegmentColor;
94
+ tmux: SegmentColor;
95
+ context: SegmentColor;
96
+ contextWarning: SegmentColor;
97
+ contextCritical: SegmentColor;
98
+ metrics: SegmentColor;
99
+ version: SegmentColor;
100
+ env: SegmentColor;
101
+ weekly: SegmentColor;
102
+ }
103
+ interface PowerlineColors {
104
+ reset: string;
105
+ modeBg: string;
106
+ modeFg: string;
107
+ gitBg: string;
108
+ gitFg: string;
109
+ modelBg: string;
110
+ modelFg: string;
111
+ sessionBg: string;
112
+ sessionFg: string;
113
+ blockBg: string;
114
+ blockFg: string;
115
+ todayBg: string;
116
+ todayFg: string;
117
+ tmuxBg: string;
118
+ tmuxFg: string;
119
+ contextBg: string;
120
+ contextFg: string;
121
+ contextWarningBg: string;
122
+ contextWarningFg: string;
123
+ contextCriticalBg: string;
124
+ contextCriticalFg: string;
125
+ metricsBg: string;
126
+ metricsFg: string;
127
+ versionBg: string;
128
+ versionFg: string;
129
+ envBg: string;
130
+ envFg: string;
131
+ weeklyBg: string;
132
+ weeklyFg: string;
133
+ partFg: Record<string, string>;
134
+ }
135
+ declare const BUILT_IN_THEMES: Record<string, ColorTheme>;
136
+ declare function getTheme(themeName: string, colorSupport?: "none" | "ansi" | "ansi256" | "truecolor"): ColorTheme | null;
137
+ //#endregion
138
+ //#region src/segments/session.d.ts
139
+ interface TokenBreakdown {
140
+ input: number;
141
+ output: number;
142
+ cacheCreation: number;
143
+ cacheRead: number;
144
+ }
145
+ interface SessionInfo {
146
+ cost: number | null;
147
+ calculatedCost: number | null;
148
+ officialCost: number | null;
149
+ tokens: number | null;
150
+ tokenBreakdown: TokenBreakdown | null;
151
+ }
152
+ interface UsageInfo {
153
+ session: SessionInfo;
154
+ }
155
+ //#endregion
156
+ //#region src/segments/block.d.ts
157
+ interface BlockInfo {
158
+ nativeUtilization: number;
159
+ timeRemaining: number;
160
+ }
161
+ //#endregion
162
+ //#region src/segments/today.d.ts
163
+ interface TodayInfo {
164
+ cost: number | null;
165
+ tokens: number | null;
166
+ tokenBreakdown: TokenBreakdown | null;
167
+ date: string;
168
+ }
169
+ //#endregion
170
+ //#region src/segments/context.d.ts
171
+ interface ContextInfo {
172
+ totalTokens: number;
173
+ percentage: number;
174
+ usablePercentage: number;
175
+ contextLeftPercentage: number;
176
+ maxTokens: number;
177
+ usableTokens: number;
178
+ }
179
+ //#endregion
180
+ //#region src/segments/metrics.d.ts
181
+ interface MetricsInfo {
182
+ responseTime: number | null;
183
+ lastResponseTime: number | null;
184
+ sessionDuration: number | null;
185
+ messageCount: number | null;
186
+ linesAdded: number | null;
187
+ linesRemoved: number | null;
188
+ }
189
+ //#endregion
190
+ //#region src/segments/git.d.ts
191
+ interface GitInfo {
192
+ branch: string;
193
+ status: "clean" | "dirty" | "conflicts";
194
+ ahead: number;
195
+ behind: number;
196
+ sha?: string;
197
+ staged?: number;
198
+ unstaged?: number;
199
+ untracked?: number;
200
+ conflicts?: number;
201
+ operation?: string;
202
+ tag?: string;
203
+ timeSinceCommit?: number;
204
+ stashCount?: number;
205
+ upstream?: string;
206
+ repoName?: string;
207
+ isWorktree?: boolean;
208
+ }
209
+ //#endregion
210
+ //#region src/utils/constants.d.ts
211
+ declare const RESET_CODE = "\u001B[0m";
212
+ declare const SYMBOLS: {
213
+ readonly right: "";
214
+ readonly left_rounded: "";
215
+ readonly right_rounded: "";
216
+ readonly branch: "⎇";
217
+ readonly model: "✱";
218
+ readonly git_clean: "✓";
219
+ readonly git_dirty: "●";
220
+ readonly git_conflicts: "⚠";
221
+ readonly git_ahead: "↑";
222
+ readonly git_behind: "↓";
223
+ readonly git_worktree: "⧉";
224
+ readonly git_tag: "⌂";
225
+ readonly git_sha: "♯";
226
+ readonly git_upstream: "→";
227
+ readonly git_stash: "⧇";
228
+ readonly git_time: "◷";
229
+ readonly session_cost: "§";
230
+ readonly block_cost: "◱";
231
+ readonly today_cost: "☉";
232
+ readonly context_time: "◔";
233
+ readonly metrics_response: "⧖";
234
+ readonly metrics_last_response: "Δ";
235
+ readonly metrics_duration: "⧗";
236
+ readonly metrics_messages: "◆";
237
+ readonly metrics_lines_added: "+";
238
+ readonly metrics_lines_removed: "-";
239
+ readonly metrics_burn: "↗";
240
+ readonly version: "◈";
241
+ readonly bar_filled: "▪";
242
+ readonly bar_empty: "▫";
243
+ readonly env: "⚙";
244
+ readonly session_id: "⌗";
245
+ readonly weekly_cost: "◑";
246
+ readonly dir: "📁";
247
+ readonly activity: "⚡";
248
+ };
249
+ declare const BOX_CHARS: {
250
+ readonly topLeft: "╭";
251
+ readonly topRight: "╮";
252
+ readonly bottomLeft: "╰";
253
+ readonly bottomRight: "╯";
254
+ readonly horizontal: "─";
255
+ readonly vertical: "│";
256
+ readonly teeLeft: "├";
257
+ readonly teeRight: "┤";
258
+ };
259
+ declare const BOX_CHARS_TEXT: {
260
+ readonly topLeft: "+";
261
+ readonly topRight: "+";
262
+ readonly bottomLeft: "+";
263
+ readonly bottomRight: "+";
264
+ readonly horizontal: "-";
265
+ readonly vertical: "|";
266
+ readonly teeLeft: "+";
267
+ readonly teeRight: "+";
268
+ };
269
+ declare const BOX_PRESETS: Record<string, BoxChars>;
270
+ declare const TEXT_SYMBOLS: {
271
+ readonly right: "";
272
+ readonly left_rounded: "";
273
+ readonly right_rounded: "";
274
+ readonly branch: "~";
275
+ readonly model: "M";
276
+ readonly git_clean: "=";
277
+ readonly git_dirty: "*";
278
+ readonly git_conflicts: "!";
279
+ readonly git_ahead: "^";
280
+ readonly git_behind: "v";
281
+ readonly git_worktree: "W";
282
+ readonly git_tag: "T";
283
+ readonly git_sha: "#";
284
+ readonly git_upstream: ">>";
285
+ readonly git_stash: "S";
286
+ readonly git_time: "@";
287
+ readonly session_cost: "S";
288
+ readonly block_cost: "B";
289
+ readonly today_cost: "D";
290
+ readonly context_time: "C";
291
+ readonly metrics_response: "R";
292
+ readonly metrics_last_response: "L";
293
+ readonly metrics_duration: "T";
294
+ readonly metrics_messages: "#";
295
+ readonly metrics_lines_added: "+";
296
+ readonly metrics_lines_removed: "-";
297
+ readonly metrics_burn: "~/h";
298
+ readonly version: "V";
299
+ readonly bar_filled: "=";
300
+ readonly bar_empty: "-";
301
+ readonly env: "$";
302
+ readonly session_id: "#";
303
+ readonly weekly_cost: "W";
304
+ readonly dir: "D";
305
+ readonly activity: "A";
306
+ };
307
+ //#endregion
308
+ //#region src/tui/types.d.ts
309
+ interface BoxChars {
310
+ readonly topLeft: string;
311
+ readonly topRight: string;
312
+ readonly bottomLeft: string;
313
+ readonly bottomRight: string;
314
+ readonly horizontal: string;
315
+ readonly vertical: string;
316
+ readonly teeLeft: string;
317
+ readonly teeRight: string;
318
+ }
319
+ interface TuiData {
320
+ hookData: ClaudeHookData;
321
+ usageInfo: UsageInfo | null;
322
+ blockInfo: BlockInfo | null;
323
+ todayInfo: TodayInfo | null;
324
+ contextInfo: ContextInfo | null;
325
+ metricsInfo: MetricsInfo | null;
326
+ gitInfo: GitInfo | null;
327
+ tmuxSessionId: string | null;
328
+ colors: PowerlineColors;
329
+ }
330
+ type SymbolSet = typeof SYMBOLS | typeof TEXT_SYMBOLS;
331
+ type LayoutMode = "wide" | "medium" | "narrow";
332
+ declare const SEGMENT_NAME_LIST: readonly ["context", "block", "session", "today", "weekly", "git", "dir", "model", "version", "tmux", "metrics", "activity", "env"];
333
+ type SegmentName = (typeof SEGMENT_NAME_LIST)[number];
334
+ declare const VALID_SEGMENT_NAMES: ReadonlySet<string>;
335
+ declare const SEGMENT_PARTS: Record<SegmentName, readonly string[]>;
336
+ declare function isValidSegmentRef(name: string): boolean;
337
+ type AlignValue = "left" | "center" | "right";
338
+ interface GridCell {
339
+ segment: string;
340
+ spanStart: boolean;
341
+ spanSize: number;
342
+ }
343
+ interface TuiGridBreakpoint {
344
+ minWidth: number;
345
+ areas: string[];
346
+ columns: string[];
347
+ align?: AlignValue[];
348
+ }
349
+ type JustifyValue = "start" | "between";
350
+ interface SegmentTemplate {
351
+ items: string[];
352
+ gap?: number;
353
+ justify?: JustifyValue;
354
+ }
355
+ interface TuiTitleConfig {
356
+ left?: string;
357
+ right?: string;
358
+ }
359
+ interface TuiFooterConfig {
360
+ left?: string;
361
+ right?: string;
362
+ }
363
+ interface TuiGridConfig {
364
+ terminalWidth?: number;
365
+ widthReserve?: number;
366
+ minWidth?: number;
367
+ maxWidth?: number;
368
+ fitContent?: boolean;
369
+ padding?: {
370
+ horizontal?: number;
371
+ };
372
+ segments?: Record<string, SegmentTemplate>;
373
+ separator?: {
374
+ column?: string;
375
+ divider?: string;
376
+ };
377
+ box?: string | Partial<BoxChars>;
378
+ title?: TuiTitleConfig;
379
+ footer?: TuiFooterConfig;
380
+ breakpoints: TuiGridBreakpoint[];
381
+ }
382
+ interface RenderCtx {
383
+ lines: string[];
384
+ data: TuiData;
385
+ box: BoxChars;
386
+ contentWidth: number;
387
+ innerWidth: number;
388
+ sym: SymbolSet;
389
+ config: PowerlineConfig;
390
+ reset: string;
391
+ colors: PowerlineColors;
392
+ }
393
+ //#endregion
394
+ //#region src/segments/renderer.d.ts
395
+ interface SegmentConfig {
396
+ enabled: boolean;
397
+ }
398
+ interface DirectorySegmentConfig extends SegmentConfig {
399
+ showBasename?: boolean;
400
+ style?: "full" | "fish" | "basename";
401
+ }
402
+ interface GitSegmentConfig extends SegmentConfig {
403
+ showSha?: boolean;
404
+ showAheadBehind?: boolean;
405
+ showWorkingTree?: boolean;
406
+ showOperation?: boolean;
407
+ showTag?: boolean;
408
+ showTimeSinceCommit?: boolean;
409
+ showStashCount?: boolean;
410
+ showUpstream?: boolean;
411
+ showRepoName?: boolean;
412
+ }
413
+ interface UsageSegmentConfig extends SegmentConfig {
414
+ type: "cost" | "tokens" | "both" | "breakdown";
415
+ costSource?: "calculated" | "official";
416
+ }
417
+ interface TmuxSegmentConfig extends SegmentConfig {}
418
+ type BarDisplayStyle = "text" | "ball" | "bar" | "blocks" | "blocks-line" | "capped" | "dots" | "filled" | "geometric" | "line" | "squares";
419
+ interface ContextSegmentConfig extends SegmentConfig {
420
+ showPercentageOnly?: boolean;
421
+ displayStyle?: BarDisplayStyle;
422
+ autocompactBuffer?: number;
423
+ percentageMode?: "remaining" | "used";
424
+ }
425
+ interface MetricsSegmentConfig extends SegmentConfig {
426
+ showResponseTime?: boolean;
427
+ showLastResponseTime?: boolean;
428
+ showDuration?: boolean;
429
+ showMessageCount?: boolean;
430
+ showLinesAdded?: boolean;
431
+ showLinesRemoved?: boolean;
432
+ }
433
+ interface BlockSegmentConfig extends SegmentConfig {
434
+ type: "cost" | "tokens" | "both" | "time" | "weighted";
435
+ burnType?: "cost" | "tokens" | "both" | "none";
436
+ displayStyle?: BarDisplayStyle;
437
+ }
438
+ interface TodaySegmentConfig extends SegmentConfig {
439
+ type: "cost" | "tokens" | "both" | "breakdown";
440
+ }
441
+ interface VersionSegmentConfig extends SegmentConfig {}
442
+ interface SessionIdSegmentConfig extends SegmentConfig {
443
+ showIdLabel?: boolean;
444
+ }
445
+ interface EnvSegmentConfig extends SegmentConfig {
446
+ variable: string;
447
+ prefix?: string;
448
+ }
449
+ interface WeeklySegmentConfig extends SegmentConfig {
450
+ displayStyle?: BarDisplayStyle;
451
+ }
452
+ type AnySegmentConfig = SegmentConfig | DirectorySegmentConfig | GitSegmentConfig | UsageSegmentConfig | TmuxSegmentConfig | ContextSegmentConfig | MetricsSegmentConfig | BlockSegmentConfig | TodaySegmentConfig | VersionSegmentConfig | SessionIdSegmentConfig | EnvSegmentConfig | WeeklySegmentConfig;
453
+ interface PowerlineSymbols {
454
+ right: string;
455
+ left: string;
456
+ branch: string;
457
+ model: string;
458
+ git_clean: string;
459
+ git_dirty: string;
460
+ git_conflicts: string;
461
+ git_ahead: string;
462
+ git_behind: string;
463
+ git_worktree: string;
464
+ git_tag: string;
465
+ git_sha: string;
466
+ git_upstream: string;
467
+ git_stash: string;
468
+ git_time: string;
469
+ session_cost: string;
470
+ block_cost: string;
471
+ today_cost: string;
472
+ context_time: string;
473
+ metrics_response: string;
474
+ metrics_last_response: string;
475
+ metrics_duration: string;
476
+ metrics_messages: string;
477
+ metrics_lines_added: string;
478
+ metrics_lines_removed: string;
479
+ metrics_burn: string;
480
+ version: string;
481
+ bar_filled: string;
482
+ bar_empty: string;
483
+ env: string;
484
+ session_id: string;
485
+ weekly_cost: string;
486
+ }
487
+ interface SegmentData {
488
+ text: string;
489
+ bgColor: string;
490
+ fgColor: string;
491
+ }
492
+ declare class SegmentRenderer {
493
+ private readonly config;
494
+ private readonly symbols;
495
+ constructor(config: PowerlineConfig, symbols: PowerlineSymbols);
496
+ renderDirectory(hookData: ClaudeHookData, colors: PowerlineColors, config?: DirectorySegmentConfig): SegmentData;
497
+ renderGit(gitInfo: GitInfo, colors: PowerlineColors, config?: GitSegmentConfig): SegmentData | null;
498
+ renderModel(hookData: ClaudeHookData, colors: PowerlineColors): SegmentData;
499
+ renderSession(usageInfo: UsageInfo, colors: PowerlineColors, config?: UsageSegmentConfig): SegmentData;
500
+ renderSessionId(sessionId: string, colors: PowerlineColors, config?: SessionIdSegmentConfig): SegmentData;
501
+ renderTmux(sessionId: string | null, colors: PowerlineColors): SegmentData | null;
502
+ renderContext(contextInfo: ContextInfo | null, colors: PowerlineColors, config?: ContextSegmentConfig): SegmentData | null;
503
+ private buildBar;
504
+ private resolveBarStyleDef;
505
+ private formatPercentageWithBar;
506
+ renderMetrics(metricsInfo: MetricsInfo | null, colors: PowerlineColors, config?: MetricsSegmentConfig): SegmentData | null;
507
+ renderBlock(blockInfo: BlockInfo, colors: PowerlineColors, config?: BlockSegmentConfig): SegmentData;
508
+ renderWeekly(hookData: ClaudeHookData, colors: PowerlineColors, config?: WeeklySegmentConfig): SegmentData | null;
509
+ renderToday(todayInfo: TodayInfo, colors: PowerlineColors, type?: string): SegmentData;
510
+ private getDisplayDirectoryName;
511
+ private formatUsageDisplay;
512
+ private formatUsageWithBudget;
513
+ renderVersion(hookData: ClaudeHookData, colors: PowerlineColors, _config?: VersionSegmentConfig): SegmentData | null;
514
+ renderEnv(colors: PowerlineColors, config: EnvSegmentConfig): SegmentData | null;
515
+ }
516
+ //#endregion
517
+ //#region src/config/loader.d.ts
518
+ interface LineConfig {
519
+ segments: {
520
+ directory?: DirectorySegmentConfig;
521
+ git?: GitSegmentConfig;
522
+ model?: SegmentConfig;
523
+ session?: UsageSegmentConfig;
524
+ block?: BlockSegmentConfig;
525
+ today?: TodaySegmentConfig;
526
+ tmux?: TmuxSegmentConfig;
527
+ context?: ContextSegmentConfig;
528
+ metrics?: MetricsSegmentConfig;
529
+ version?: VersionSegmentConfig;
530
+ sessionId?: SessionIdSegmentConfig;
531
+ env?: EnvSegmentConfig;
532
+ weekly?: WeeklySegmentConfig;
533
+ };
534
+ }
535
+ interface DisplayConfig {
536
+ lines: LineConfig[];
537
+ style?: "minimal" | "powerline" | "capsule" | "tui";
538
+ charset?: "unicode" | "text";
539
+ colorCompatibility?: "auto" | "ansi" | "ansi256" | "truecolor";
540
+ autoWrap?: boolean;
541
+ padding?: number;
542
+ tui?: TuiGridConfig;
543
+ }
544
+ interface BudgetItemConfig {
545
+ amount?: number;
546
+ warningThreshold?: number;
547
+ type?: "cost" | "tokens";
548
+ }
549
+ interface BudgetConfig {
550
+ session?: BudgetItemConfig;
551
+ today?: BudgetItemConfig;
552
+ block?: BudgetItemConfig;
553
+ }
554
+ interface PowerlineConfig {
555
+ theme: "light" | "dark" | "nord" | "tokyo-night" | "rose-pine" | "gruvbox" | "custom";
556
+ display: DisplayConfig;
557
+ colors?: {
558
+ custom: ColorTheme;
559
+ };
560
+ budget?: BudgetConfig;
561
+ modelContextLimits?: Record<string, number>;
562
+ }
563
+ //#endregion
564
+ //#region src/tui/renderer.d.ts
565
+ interface TuiPanelOptions {
566
+ rawTerminalWidth?: number | null;
567
+ }
568
+ declare function renderTuiPanel(data: TuiData, box: BoxChars, reset: string, terminalWidth: number | null, config: PowerlineConfig, options?: TuiPanelOptions): Promise<string>;
569
+ //#endregion
570
+ //#region src/utils/colors.d.ts
571
+ declare function hexToAnsi(hex: string, isBackground: boolean): string;
572
+ declare function extractBgToFg(ansiCode: string, useTextOnly?: boolean): string;
573
+ declare function hexTo256Ansi(hex: string, isBackground: boolean): string;
574
+ declare function hexToBasicAnsi(hex: string, isBackground: boolean): string;
575
+ declare function hexColorDistance(hex1: string, hex2: string): number;
576
+ //#endregion
577
+ //#region src/utils/terminal.d.ts
578
+ declare const ESC: string;
579
+ declare function stripAnsi(str: string): string;
580
+ declare function visibleLength(str: string): number;
581
+ //#endregion
582
+ //#region src/utils/formatters.d.ts
583
+ interface TokenBreakdown$1 {
584
+ input: number;
585
+ output: number;
586
+ cacheCreation: number;
587
+ cacheRead: number;
588
+ }
589
+ declare function formatCost(cost: number | null): string;
590
+ declare function formatTokens(tokens: number | null): string;
591
+ declare function formatTokenBreakdown(breakdown: TokenBreakdown$1 | null): string;
592
+ declare function formatTimeSince(seconds: number): string;
593
+ declare function formatDuration(seconds: number): string;
594
+ declare function formatModelName(rawName: string): string;
595
+ declare function abbreviateFishStyle(dirPath: string): string;
596
+ declare function formatResponseTime(seconds: number): string;
597
+ declare function formatTokenCount(tokens: number | null): string;
598
+ declare function formatBurnRate(rate: number | null | undefined): string;
599
+ declare function collapseHome(dirPath: string, homeDir?: string): string;
600
+ declare function formatTimeRemaining(totalMinutes: number): string;
601
+ declare function formatLongTimeRemaining(totalMinutes: number): string;
602
+ declare function minutesUntilReset(epochSeconds: number): number;
603
+ //#endregion
604
+ //#region src/utils/budget.d.ts
605
+ interface BudgetStatus {
606
+ percentage: number | null;
607
+ isWarning: boolean;
608
+ displayText: string;
609
+ }
610
+ declare function getBudgetStatus(cost: number, budget: number | undefined, warningThreshold?: number): BudgetStatus;
611
+ //#endregion
612
+ //#region src/tui/primitives.d.ts
613
+ declare function colorize(text: string, fgColor: string, reset: string): string;
614
+ declare function padRight(text: string, width: number): string;
615
+ declare function padLeft(text: string, width: number): string;
616
+ declare function padCenter(text: string, width: number): string;
617
+ declare function truncateAnsi(text: string, maxWidth: number): string;
618
+ declare function contentRow(box: BoxChars, content: string, innerWidth: number): string;
619
+ declare function divider(box: BoxChars, innerWidth: number): string;
620
+ declare function bottomBorder(box: BoxChars, innerWidth: number, leftText?: string, rightText?: string): string;
621
+ declare function spreadEven(parts: string[], totalWidth: number): string;
622
+ declare function spreadTwo(left: string, right: string, totalWidth: number): string;
623
+ //#endregion
624
+ //#region src/tui/sections.d.ts
625
+ declare function resolveTitleToken(template: string, data: TuiData, resolvedData?: Record<string, string>): string;
626
+ declare function buildTitleBar(data: TuiData, box: BoxChars, innerWidth: number, titleConfig?: TuiTitleConfig, resolvedData?: Record<string, string>): string;
627
+ declare function buildContextBar(data: TuiData, barWidth: number, sym: SymbolSet, reset: string, colors: PowerlineColors, partFg?: Record<string, string>): string;
628
+ declare function buildBlockBar(data: TuiData, barWidth: number, sym: SymbolSet, reset: string, colors: PowerlineColors, config: PowerlineConfig, partFg?: Record<string, string>): string;
629
+ declare function buildWeeklyBar(data: TuiData, barWidth: number, sym: SymbolSet, reset: string, colors: PowerlineColors, partFg?: Record<string, string>): string;
630
+ declare function buildContextLine(data: TuiData, contentWidth: number, sym: SymbolSet, reset: string, colors: PowerlineColors): string | null;
631
+ declare function collectMetricSegments(data: TuiData, sym: SymbolSet, config: PowerlineConfig, reset: string, colors: PowerlineColors): string[];
632
+ declare function collectActivityParts(data: TuiData, sym: SymbolSet): string[];
633
+ declare function collectWorkspaceParts(data: TuiData, sym: SymbolSet, reset: string, colors: PowerlineColors): string[];
634
+ declare function collectFooterParts(data: TuiData, sym: SymbolSet, config: PowerlineConfig, reset: string, colors: PowerlineColors): string[];
635
+ interface ResolvedTemplate {
636
+ items: string[];
637
+ gap: number;
638
+ justify: JustifyValue;
639
+ }
640
+ declare function composeTemplate(items: string[], gap: number, justify: JustifyValue, cellWidth?: number): string;
641
+ interface ResolvedSegments {
642
+ data: Record<string, string>;
643
+ templates: Record<string, ResolvedTemplate>;
644
+ }
645
+ declare function resolveSegments(data: TuiData, ctx: RenderCtx): ResolvedSegments;
646
+ //#endregion
647
+ //#region src/tui/layouts.d.ts
648
+ declare function renderWideMetrics(ctx: RenderCtx): void;
649
+ declare function renderWideBottom(ctx: RenderCtx): void;
650
+ declare function renderMediumMetrics(ctx: RenderCtx): void;
651
+ declare function renderMediumBottom(ctx: RenderCtx): void;
652
+ declare function renderNarrowMetrics(ctx: RenderCtx): void;
653
+ declare function renderNarrowBottom(ctx: RenderCtx): void;
654
+ //#endregion
655
+ //#region src/tui/grid.d.ts
656
+ declare const DIVIDER = "---";
657
+ declare const EMPTY_CELL = ".";
658
+ declare const LATE_RESOLVE_SEGMENTS: Set<string>;
659
+ interface GridResult {
660
+ lines: string[];
661
+ panelWidth: number;
662
+ }
663
+ declare function selectBreakpoint(breakpoints: TuiGridBreakpoint[], panelWidth: number): TuiGridBreakpoint;
664
+ declare function parseAreas(areas: string[]): GridCell[][];
665
+ declare function cullMatrix(matrix: GridCell[][], resolvedData: Record<string, string>): GridCell[][];
666
+ declare function calculateColumnWidths(columns: string[], matrix: GridCell[][], resolvedData: Record<string, string>, contentWidth: number, separatorWidth: number, lateResolveNames?: ReadonlySet<string>): number[];
667
+ declare function solveFitContentLayout(columns: string[], matrix: GridCell[][], resolvedData: Record<string, string>, separatorWidth: number, horizontalPadding: number, lateResolveNames?: ReadonlySet<string>): {
668
+ panelWidth: number;
669
+ colWidths: number[];
670
+ };
671
+ declare function renderGrid(gridConfig: TuiGridConfig, resolvedData: Record<string, string>, box: BoxChars, rawTerminalWidth: number, lateResolve?: (segment: string, cellWidth: number) => string | undefined): GridResult;
672
+ //#endregion
673
+ //#region src/config/defaults.d.ts
674
+ declare const DEFAULT_CONFIG: PowerlineConfig;
675
+ //#endregion
676
+ export { type AlignValue, type AnySegmentConfig, BOX_CHARS, BOX_CHARS_TEXT, BOX_PRESETS, BUILT_IN_THEMES, type BarDisplayStyle, type BlockInfo, type BlockSegmentConfig, type BoxChars, type BudgetConfig, type BudgetItemConfig, type ClaudeHookData, type ColorTheme, type ContextInfo, type ContextSegmentConfig, DEFAULT_CONFIG, DIVIDER, type DirectorySegmentConfig, type DisplayConfig, EMPTY_CELL, ESC, type EnvSegmentConfig, type GitInfo, type GitSegmentConfig, type GridCell, type GridResult, type JustifyValue, LATE_RESOLVE_SEGMENTS, type LayoutMode, type LineConfig, type MetricsInfo, type MetricsSegmentConfig, type PowerlineColors, type PowerlineConfig, type PowerlineSymbols, RESET_CODE, type RenderCtx, SEGMENT_PARTS, SYMBOLS, type SegmentColor, type SegmentConfig, type SegmentData, type SegmentName, SegmentRenderer, type SegmentTemplate, type SessionIdSegmentConfig, type SessionInfo, type SymbolSet, TEXT_SYMBOLS, type TodayInfo, type TodaySegmentConfig, type TokenBreakdown, type TuiData, type TuiFooterConfig, type TuiGridBreakpoint, type TuiGridConfig, type TuiPanelOptions, type TuiTitleConfig, type UsageInfo, type UsageSegmentConfig, VALID_SEGMENT_NAMES, type VersionSegmentConfig, type WeeklySegmentConfig, abbreviateFishStyle, bottomBorder, buildBlockBar, buildContextBar, buildContextLine, buildTitleBar, buildWeeklyBar, calculateColumnWidths, collapseHome, collectActivityParts, collectFooterParts, collectMetricSegments, collectWorkspaceParts, colorize, composeTemplate, contentRow, cullMatrix, darkAnsi256Theme, darkAnsiTheme, darkTheme, divider, extractBgToFg, formatBurnRate, formatCost, formatDuration, formatLongTimeRemaining, formatModelName, formatResponseTime, formatTimeRemaining, formatTimeSince, formatTokenBreakdown, formatTokenCount, formatTokens, getBudgetStatus, getTheme, gruvboxAnsi256Theme, gruvboxAnsiTheme, gruvboxTheme, hexColorDistance, hexTo256Ansi, hexToAnsi, hexToBasicAnsi, isValidSegmentRef, lightAnsi256Theme, lightAnsiTheme, lightTheme, minutesUntilReset, nordAnsi256Theme, nordAnsiTheme, nordTheme, padCenter, padLeft, padRight, parseAreas, renderGrid, renderMediumBottom, renderMediumMetrics, renderNarrowBottom, renderNarrowMetrics, renderTuiPanel, renderWideBottom, renderWideMetrics, resolveSegments, resolveTitleToken, rosePineAnsi256Theme, rosePineAnsiTheme, rosePineTheme, selectBreakpoint, solveFitContentLayout, spreadEven, spreadTwo, stripAnsi, tokyoNightAnsi256Theme, tokyoNightAnsiTheme, tokyoNightTheme, truncateAnsi, visibleLength };