@bastra-recall/statusline 0.7.0-beta.1

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 (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +26 -0
  3. package/bin/claude-powerline +2 -0
  4. package/dist/browser.d.ts +796 -0
  5. package/dist/browser.js +3 -0
  6. package/dist/index.mjs +48 -0
  7. package/package.json +39 -0
  8. package/src/browser.ts +208 -0
  9. package/src/config/defaults.ts +88 -0
  10. package/src/config/loader.ts +473 -0
  11. package/src/index.ts +90 -0
  12. package/src/powerline.ts +1082 -0
  13. package/src/segments/bastra.ts +123 -0
  14. package/src/segments/block.ts +31 -0
  15. package/src/segments/cacheTimer.ts +108 -0
  16. package/src/segments/context.ts +221 -0
  17. package/src/segments/git.ts +498 -0
  18. package/src/segments/index.ts +33 -0
  19. package/src/segments/metrics.ts +175 -0
  20. package/src/segments/pricing.ts +454 -0
  21. package/src/segments/renderer.ts +1002 -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 +61 -0
  26. package/src/themes/gruvbox.ts +61 -0
  27. package/src/themes/index.ts +161 -0
  28. package/src/themes/light.ts +61 -0
  29. package/src/themes/nord.ts +61 -0
  30. package/src/themes/rose-pine.ts +61 -0
  31. package/src/themes/tokyo-night.ts +61 -0
  32. package/src/tui/grid.ts +712 -0
  33. package/src/tui/index.ts +4 -0
  34. package/src/tui/layouts.ts +321 -0
  35. package/src/tui/primitives.ts +187 -0
  36. package/src/tui/renderer.ts +206 -0
  37. package/src/tui/sections.ts +1511 -0
  38. package/src/tui/types.ts +189 -0
  39. package/src/utils/budget.ts +116 -0
  40. package/src/utils/cache.ts +247 -0
  41. package/src/utils/claude.ts +518 -0
  42. package/src/utils/color-support.ts +118 -0
  43. package/src/utils/colors.ts +120 -0
  44. package/src/utils/constants.ts +184 -0
  45. package/src/utils/formatters.ts +175 -0
  46. package/src/utils/icon-visibility.ts +31 -0
  47. package/src/utils/logger.ts +5 -0
  48. package/src/utils/terminal-width.ts +117 -0
  49. package/src/utils/terminal.ts +54 -0
@@ -0,0 +1,796 @@
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
+ worktree?: {
51
+ name: string;
52
+ path: string;
53
+ branch?: string;
54
+ original_cwd: string;
55
+ original_branch?: string;
56
+ };
57
+ agent?: {
58
+ name: string;
59
+ };
60
+ effort?: {
61
+ level?: string;
62
+ };
63
+ thinking?: {
64
+ enabled?: boolean;
65
+ };
66
+ }
67
+ //#endregion
68
+ //#region src/themes/dark.d.ts
69
+ declare const darkTheme: ColorTheme;
70
+ declare const darkAnsi256Theme: ColorTheme;
71
+ declare const darkAnsiTheme: ColorTheme;
72
+ //#endregion
73
+ //#region src/themes/light.d.ts
74
+ declare const lightTheme: ColorTheme;
75
+ declare const lightAnsi256Theme: ColorTheme;
76
+ declare const lightAnsiTheme: ColorTheme;
77
+ //#endregion
78
+ //#region src/themes/nord.d.ts
79
+ declare const nordTheme: ColorTheme;
80
+ declare const nordAnsi256Theme: ColorTheme;
81
+ declare const nordAnsiTheme: ColorTheme;
82
+ //#endregion
83
+ //#region src/themes/tokyo-night.d.ts
84
+ declare const tokyoNightTheme: ColorTheme;
85
+ declare const tokyoNightAnsi256Theme: ColorTheme;
86
+ declare const tokyoNightAnsiTheme: ColorTheme;
87
+ //#endregion
88
+ //#region src/themes/rose-pine.d.ts
89
+ declare const rosePineTheme: ColorTheme;
90
+ declare const rosePineAnsi256Theme: ColorTheme;
91
+ declare const rosePineAnsiTheme: ColorTheme;
92
+ //#endregion
93
+ //#region src/themes/gruvbox.d.ts
94
+ declare const gruvboxTheme: ColorTheme;
95
+ declare const gruvboxAnsi256Theme: ColorTheme;
96
+ declare const gruvboxAnsiTheme: ColorTheme;
97
+ //#endregion
98
+ //#region src/themes/index.d.ts
99
+ interface SegmentColor {
100
+ bg: string;
101
+ fg: string;
102
+ bold?: boolean;
103
+ }
104
+ interface ColorTheme {
105
+ directory: SegmentColor;
106
+ git: SegmentColor;
107
+ model: SegmentColor;
108
+ session: SegmentColor;
109
+ block: SegmentColor;
110
+ today: SegmentColor;
111
+ tmux: SegmentColor;
112
+ context: SegmentColor;
113
+ contextWarning: SegmentColor;
114
+ contextCritical: SegmentColor;
115
+ metrics: SegmentColor;
116
+ version: SegmentColor;
117
+ env: SegmentColor;
118
+ weekly: SegmentColor;
119
+ agent: SegmentColor;
120
+ thinking: SegmentColor;
121
+ cacheTimer: SegmentColor;
122
+ }
123
+ interface PowerlineColors {
124
+ reset: string;
125
+ modeBg: string;
126
+ modeFg: string;
127
+ modeBold: boolean;
128
+ gitBg: string;
129
+ gitFg: string;
130
+ gitBold: boolean;
131
+ modelBg: string;
132
+ modelFg: string;
133
+ modelBold: boolean;
134
+ sessionBg: string;
135
+ sessionFg: string;
136
+ sessionBold: boolean;
137
+ blockBg: string;
138
+ blockFg: string;
139
+ blockBold: boolean;
140
+ todayBg: string;
141
+ todayFg: string;
142
+ todayBold: boolean;
143
+ tmuxBg: string;
144
+ tmuxFg: string;
145
+ tmuxBold: boolean;
146
+ contextBg: string;
147
+ contextFg: string;
148
+ contextBold: boolean;
149
+ contextWarningBg: string;
150
+ contextWarningFg: string;
151
+ contextWarningBold: boolean;
152
+ contextCriticalBg: string;
153
+ contextCriticalFg: string;
154
+ contextCriticalBold: boolean;
155
+ metricsBg: string;
156
+ metricsFg: string;
157
+ metricsBold: boolean;
158
+ versionBg: string;
159
+ versionFg: string;
160
+ versionBold: boolean;
161
+ envBg: string;
162
+ envFg: string;
163
+ envBold: boolean;
164
+ weeklyBg: string;
165
+ weeklyFg: string;
166
+ weeklyBold: boolean;
167
+ agentBg: string;
168
+ agentFg: string;
169
+ agentBold: boolean;
170
+ thinkingBg: string;
171
+ thinkingFg: string;
172
+ thinkingBold: boolean;
173
+ cacheTimerBg: string;
174
+ cacheTimerFg: string;
175
+ cacheTimerBold: boolean;
176
+ bastraBg: string;
177
+ bastraFg: string;
178
+ bastraBold: boolean;
179
+ partFg: Record<string, string>;
180
+ }
181
+ declare const BUILT_IN_THEMES: Record<string, ColorTheme>;
182
+ declare function getTheme(themeName: string, colorSupport?: "none" | "ansi" | "ansi256" | "truecolor"): ColorTheme | null;
183
+ //#endregion
184
+ //#region src/segments/session.d.ts
185
+ interface TokenBreakdown {
186
+ input: number;
187
+ output: number;
188
+ cacheCreation: number;
189
+ cacheRead: number;
190
+ }
191
+ interface SessionInfo {
192
+ cost: number | null;
193
+ calculatedCost: number | null;
194
+ officialCost: number | null;
195
+ tokens: number | null;
196
+ tokenBreakdown: TokenBreakdown | null;
197
+ }
198
+ interface UsageInfo {
199
+ session: SessionInfo;
200
+ }
201
+ //#endregion
202
+ //#region src/segments/block.d.ts
203
+ interface BlockInfo {
204
+ nativeUtilization: number;
205
+ timeRemaining: number;
206
+ }
207
+ //#endregion
208
+ //#region src/segments/today.d.ts
209
+ interface TodayInfo {
210
+ cost: number | null;
211
+ tokens: number | null;
212
+ tokenBreakdown: TokenBreakdown | null;
213
+ date: string;
214
+ }
215
+ //#endregion
216
+ //#region src/segments/context.d.ts
217
+ interface ContextInfo {
218
+ totalTokens: number;
219
+ percentage: number;
220
+ usablePercentage: number;
221
+ contextLeftPercentage: number;
222
+ maxTokens: number;
223
+ usableTokens: number;
224
+ }
225
+ //#endregion
226
+ //#region src/segments/metrics.d.ts
227
+ interface MetricsInfo {
228
+ responseTime: number | null;
229
+ lastResponseTime: number | null;
230
+ sessionDuration: number | null;
231
+ messageCount: number | null;
232
+ linesAdded: number | null;
233
+ linesRemoved: number | null;
234
+ }
235
+ //#endregion
236
+ //#region src/segments/git.d.ts
237
+ interface GitInfo {
238
+ branch: string;
239
+ status: "clean" | "dirty" | "conflicts";
240
+ ahead: number;
241
+ behind: number;
242
+ sha?: string;
243
+ staged?: number;
244
+ unstaged?: number;
245
+ untracked?: number;
246
+ conflicts?: number;
247
+ operation?: string;
248
+ tag?: string;
249
+ timeSinceCommit?: number;
250
+ stashCount?: number;
251
+ upstream?: string;
252
+ repoName?: string;
253
+ isWorktree?: boolean;
254
+ }
255
+ //#endregion
256
+ //#region src/segments/cacheTimer.d.ts
257
+ interface CacheTimerInfo {
258
+ elapsedSeconds: number;
259
+ detectedTtlSeconds?: number;
260
+ }
261
+ //#endregion
262
+ //#region src/utils/constants.d.ts
263
+ declare const RESET_CODE = "\u001B[0m";
264
+ declare const SYMBOLS: {
265
+ readonly right: "";
266
+ readonly left_rounded: "";
267
+ readonly right_rounded: "";
268
+ readonly branch: "⎇";
269
+ readonly model: "✱";
270
+ readonly git_clean: "✓";
271
+ readonly git_dirty: "●";
272
+ readonly git_conflicts: "⚠";
273
+ readonly git_ahead: "↑";
274
+ readonly git_behind: "↓";
275
+ readonly git_worktree: "⧉";
276
+ readonly git_tag: "⌂";
277
+ readonly git_sha: "♯";
278
+ readonly git_upstream: "→";
279
+ readonly git_stash: "⧇";
280
+ readonly git_time: "◷";
281
+ readonly session_cost: "§";
282
+ readonly block_cost: "◱";
283
+ readonly today_cost: "☉";
284
+ readonly context_time: "◔";
285
+ readonly metrics_response: "⧖";
286
+ readonly metrics_last_response: "Δ";
287
+ readonly metrics_duration: "⧗";
288
+ readonly metrics_messages: "◆";
289
+ readonly metrics_lines_added: "+";
290
+ readonly metrics_lines_removed: "-";
291
+ readonly metrics_burn: "↗";
292
+ readonly version: "◈";
293
+ readonly bar_filled: "▪";
294
+ readonly bar_empty: "▫";
295
+ readonly env: "⚙";
296
+ readonly session_id: "⌗";
297
+ readonly weekly_cost: "◑";
298
+ readonly dir: "📁";
299
+ readonly activity: "⚡";
300
+ readonly agent: "◇";
301
+ readonly thinking: "✦";
302
+ readonly cache_timer: "◴";
303
+ readonly bastra: "❖";
304
+ };
305
+ declare const BOX_CHARS: {
306
+ readonly topLeft: "╭";
307
+ readonly topRight: "╮";
308
+ readonly bottomLeft: "╰";
309
+ readonly bottomRight: "╯";
310
+ readonly horizontal: "─";
311
+ readonly vertical: "│";
312
+ readonly teeLeft: "├";
313
+ readonly teeRight: "┤";
314
+ };
315
+ declare const BOX_CHARS_TEXT: {
316
+ readonly topLeft: "+";
317
+ readonly topRight: "+";
318
+ readonly bottomLeft: "+";
319
+ readonly bottomRight: "+";
320
+ readonly horizontal: "-";
321
+ readonly vertical: "|";
322
+ readonly teeLeft: "+";
323
+ readonly teeRight: "+";
324
+ };
325
+ declare const BOX_PRESETS: Record<string, BoxChars>;
326
+ declare const TEXT_SYMBOLS: {
327
+ readonly right: "";
328
+ readonly left_rounded: "";
329
+ readonly right_rounded: "";
330
+ readonly branch: "~";
331
+ readonly model: "M";
332
+ readonly git_clean: "=";
333
+ readonly git_dirty: "*";
334
+ readonly git_conflicts: "!";
335
+ readonly git_ahead: "^";
336
+ readonly git_behind: "v";
337
+ readonly git_worktree: "W";
338
+ readonly git_tag: "T";
339
+ readonly git_sha: "#";
340
+ readonly git_upstream: ">>";
341
+ readonly git_stash: "S";
342
+ readonly git_time: "@";
343
+ readonly session_cost: "S";
344
+ readonly block_cost: "B";
345
+ readonly today_cost: "D";
346
+ readonly context_time: "C";
347
+ readonly metrics_response: "R";
348
+ readonly metrics_last_response: "L";
349
+ readonly metrics_duration: "T";
350
+ readonly metrics_messages: "#";
351
+ readonly metrics_lines_added: "+";
352
+ readonly metrics_lines_removed: "-";
353
+ readonly metrics_burn: "~/h";
354
+ readonly version: "V";
355
+ readonly bar_filled: "=";
356
+ readonly bar_empty: "-";
357
+ readonly env: "$";
358
+ readonly session_id: "#";
359
+ readonly weekly_cost: "W";
360
+ readonly dir: "D";
361
+ readonly activity: "A";
362
+ readonly agent: "&";
363
+ readonly thinking: "T";
364
+ readonly cache_timer: "C!";
365
+ readonly bastra: "*";
366
+ };
367
+ //#endregion
368
+ //#region src/tui/types.d.ts
369
+ interface BoxChars {
370
+ readonly topLeft: string;
371
+ readonly topRight: string;
372
+ readonly bottomLeft: string;
373
+ readonly bottomRight: string;
374
+ readonly horizontal: string;
375
+ readonly vertical: string;
376
+ readonly teeLeft: string;
377
+ readonly teeRight: string;
378
+ }
379
+ interface TuiData {
380
+ hookData: ClaudeHookData;
381
+ usageInfo: UsageInfo | null;
382
+ blockInfo: BlockInfo | null;
383
+ todayInfo: TodayInfo | null;
384
+ contextInfo: ContextInfo | null;
385
+ metricsInfo: MetricsInfo | null;
386
+ gitInfo: GitInfo | null;
387
+ cacheTimerInfo: CacheTimerInfo | null;
388
+ tmuxSessionId: string | null;
389
+ colors: PowerlineColors;
390
+ }
391
+ type SymbolSet = typeof SYMBOLS | typeof TEXT_SYMBOLS;
392
+ type LayoutMode = "wide" | "medium" | "narrow";
393
+ declare const SEGMENT_NAME_LIST: readonly ["context", "block", "session", "today", "weekly", "git", "dir", "model", "version", "tmux", "metrics", "activity", "env", "agent", "thinking", "cacheTimer"];
394
+ type SegmentName = (typeof SEGMENT_NAME_LIST)[number];
395
+ declare const VALID_SEGMENT_NAMES: ReadonlySet<string>;
396
+ declare const SEGMENT_PARTS: Record<SegmentName, readonly string[]>;
397
+ declare function isValidSegmentRef(name: string): boolean;
398
+ type AlignValue = "left" | "center" | "right";
399
+ interface GridCell {
400
+ segment: string;
401
+ spanStart: boolean;
402
+ spanSize: number;
403
+ }
404
+ interface TuiGridBreakpoint {
405
+ minWidth: number;
406
+ areas: string[];
407
+ columns: string[];
408
+ align?: AlignValue[];
409
+ }
410
+ type JustifyValue = "start" | "between";
411
+ interface SegmentTemplate {
412
+ items: string[];
413
+ gap?: number;
414
+ justify?: JustifyValue;
415
+ }
416
+ interface TuiTitleConfig {
417
+ left?: string;
418
+ right?: string;
419
+ }
420
+ interface TuiFooterConfig {
421
+ left?: string;
422
+ right?: string;
423
+ }
424
+ interface TuiGridConfig {
425
+ terminalWidth?: number;
426
+ widthReserve?: number;
427
+ minWidth?: number;
428
+ maxWidth?: number;
429
+ fitContent?: boolean;
430
+ padding?: {
431
+ horizontal?: number;
432
+ };
433
+ segments?: Record<string, SegmentTemplate>;
434
+ separator?: {
435
+ column?: string;
436
+ divider?: string;
437
+ };
438
+ box?: string | Partial<BoxChars>;
439
+ title?: TuiTitleConfig;
440
+ footer?: TuiFooterConfig;
441
+ breakpoints: TuiGridBreakpoint[];
442
+ }
443
+ interface RenderCtx {
444
+ lines: string[];
445
+ data: TuiData;
446
+ box: BoxChars;
447
+ contentWidth: number;
448
+ innerWidth: number;
449
+ sym: SymbolSet;
450
+ config: PowerlineConfig;
451
+ reset: string;
452
+ colors: PowerlineColors;
453
+ }
454
+ //#endregion
455
+ //#region src/segments/bastra.d.ts
456
+ interface BastraInfo {
457
+ state: "idle" | "running";
458
+ vaultSize: number;
459
+ recallCount: number;
460
+ totalHits: number;
461
+ totalMs: number;
462
+ currentStage: string | null;
463
+ /** Human-readable banter phrase for the running stage; preferred over the
464
+ * raw stage name when present. Null when banter is off or idle. */
465
+ currentMessage: string | null;
466
+ currentStageStartedAt: number | null;
467
+ currentRecallStartedAt: number | null;
468
+ /** Banter phrase shown in the done banner after a recall; hidden once older
469
+ * than the TTL (see renderBastra). */
470
+ lastPhrase: string | null;
471
+ lastPhraseAt: number | null;
472
+ }
473
+ //#endregion
474
+ //#region src/segments/renderer.d.ts
475
+ interface SegmentConfig {
476
+ enabled: boolean;
477
+ showIcon?: boolean;
478
+ }
479
+ interface DirectorySegmentConfig extends SegmentConfig {
480
+ showBasename?: boolean;
481
+ style?: "full" | "fish" | "basename";
482
+ }
483
+ interface GitSegmentConfig extends SegmentConfig {
484
+ showSha?: boolean;
485
+ showAheadBehind?: boolean;
486
+ showWorkingTree?: boolean;
487
+ showOperation?: boolean;
488
+ showTag?: boolean;
489
+ showTimeSinceCommit?: boolean;
490
+ showStashCount?: boolean;
491
+ showUpstream?: boolean;
492
+ showRepoName?: boolean;
493
+ }
494
+ interface UsageSegmentConfig extends SegmentConfig {
495
+ type: "cost" | "tokens" | "both" | "breakdown";
496
+ costSource?: "calculated" | "official";
497
+ /** Show the trailing "tokens" unit on token counts. Only affects `type: "tokens"` and `type: "both"` (default: true). Inert in the `tui` display style, which never renders the suffix. */
498
+ showUnits?: boolean;
499
+ }
500
+ interface TmuxSegmentConfig extends SegmentConfig {}
501
+ type BarDisplayStyle = "text" | "ball" | "bar" | "blocks" | "blocks-line" | "capped" | "dots" | "filled" | "geometric" | "line" | "squares";
502
+ interface ContextSegmentConfig extends SegmentConfig {
503
+ showPercentageOnly?: boolean;
504
+ displayStyle?: BarDisplayStyle;
505
+ autocompactBuffer?: number;
506
+ percentageMode?: "remaining" | "used";
507
+ }
508
+ interface MetricsSegmentConfig extends SegmentConfig {
509
+ showResponseTime?: boolean;
510
+ showLastResponseTime?: boolean;
511
+ showDuration?: boolean;
512
+ showMessageCount?: boolean;
513
+ showLinesAdded?: boolean;
514
+ showLinesRemoved?: boolean;
515
+ }
516
+ interface BlockSegmentConfig extends SegmentConfig {
517
+ type: "cost" | "tokens" | "both" | "time" | "weighted";
518
+ burnType?: "cost" | "tokens" | "both" | "none";
519
+ displayStyle?: BarDisplayStyle;
520
+ }
521
+ interface TodaySegmentConfig extends SegmentConfig {
522
+ type: "cost" | "tokens" | "both" | "breakdown";
523
+ /** Show the trailing "tokens" unit on token counts. Only affects `type: "tokens"` and `type: "both"` (default: true). Inert in the `tui` display style, which never renders the suffix. */
524
+ showUnits?: boolean;
525
+ }
526
+ interface VersionSegmentConfig extends SegmentConfig {}
527
+ interface SessionIdSegmentConfig extends SegmentConfig {
528
+ showIdLabel?: boolean;
529
+ }
530
+ interface EnvSegmentConfig extends SegmentConfig {
531
+ variable: string;
532
+ prefix?: string;
533
+ }
534
+ interface WeeklySegmentConfig extends SegmentConfig {
535
+ displayStyle?: BarDisplayStyle;
536
+ }
537
+ interface AgentSegmentConfig extends SegmentConfig {
538
+ showLabel?: boolean;
539
+ }
540
+ interface ThinkingSegmentConfig extends SegmentConfig {
541
+ showEnabled?: boolean;
542
+ showEffort?: boolean;
543
+ }
544
+ interface CacheTimerSegmentConfig extends SegmentConfig {
545
+ displayMode?: "elapsed" | "remaining";
546
+ ttlSeconds?: number;
547
+ }
548
+ interface BastraSegmentConfig extends SegmentConfig {}
549
+ type AnySegmentConfig = SegmentConfig | DirectorySegmentConfig | GitSegmentConfig | UsageSegmentConfig | TmuxSegmentConfig | ContextSegmentConfig | MetricsSegmentConfig | BlockSegmentConfig | TodaySegmentConfig | VersionSegmentConfig | SessionIdSegmentConfig | EnvSegmentConfig | WeeklySegmentConfig | AgentSegmentConfig | ThinkingSegmentConfig | CacheTimerSegmentConfig | BastraSegmentConfig;
550
+ interface PowerlineSymbols {
551
+ right: string;
552
+ left: string;
553
+ branch: string;
554
+ model: string;
555
+ git_clean: string;
556
+ git_dirty: string;
557
+ git_conflicts: string;
558
+ git_ahead: string;
559
+ git_behind: string;
560
+ git_worktree: string;
561
+ git_tag: string;
562
+ git_sha: string;
563
+ git_upstream: string;
564
+ git_stash: string;
565
+ git_time: string;
566
+ session_cost: string;
567
+ block_cost: string;
568
+ today_cost: string;
569
+ context_time: string;
570
+ metrics_response: string;
571
+ metrics_last_response: string;
572
+ metrics_duration: string;
573
+ metrics_messages: string;
574
+ metrics_lines_added: string;
575
+ metrics_lines_removed: string;
576
+ metrics_burn: string;
577
+ version: string;
578
+ bar_filled: string;
579
+ bar_empty: string;
580
+ env: string;
581
+ session_id: string;
582
+ weekly_cost: string;
583
+ agent: string;
584
+ thinking: string;
585
+ cache_timer: string;
586
+ bastra: string;
587
+ }
588
+ interface SegmentData {
589
+ text: string;
590
+ bgColor: string;
591
+ fgColor: string;
592
+ bold?: boolean;
593
+ }
594
+ declare class SegmentRenderer {
595
+ private readonly config;
596
+ private readonly symbols;
597
+ constructor(config: PowerlineConfig, symbols: PowerlineSymbols);
598
+ private leadingIcon;
599
+ renderDirectory(hookData: ClaudeHookData, colors: PowerlineColors, config?: DirectorySegmentConfig): SegmentData;
600
+ renderGit(gitInfo: GitInfo, colors: PowerlineColors, config?: GitSegmentConfig): SegmentData | null;
601
+ renderModel(hookData: ClaudeHookData, colors: PowerlineColors, config?: SegmentConfig): SegmentData;
602
+ renderSession(usageInfo: UsageInfo, colors: PowerlineColors, config?: UsageSegmentConfig): SegmentData | null;
603
+ renderSessionId(sessionId: string, colors: PowerlineColors, config?: SessionIdSegmentConfig): SegmentData;
604
+ renderTmux(sessionId: string | null, colors: PowerlineColors): SegmentData | null;
605
+ renderContext(contextInfo: ContextInfo | null, colors: PowerlineColors, config?: ContextSegmentConfig): SegmentData | null;
606
+ private buildBar;
607
+ private resolveBarStyleDef;
608
+ private formatPercentageWithBar;
609
+ renderMetrics(metricsInfo: MetricsInfo | null, colors: PowerlineColors, config?: MetricsSegmentConfig): SegmentData | null;
610
+ renderBlock(blockInfo: BlockInfo, colors: PowerlineColors, config?: BlockSegmentConfig): SegmentData;
611
+ renderWeekly(hookData: ClaudeHookData, colors: PowerlineColors, config?: WeeklySegmentConfig): SegmentData | null;
612
+ renderToday(todayInfo: TodayInfo, colors: PowerlineColors, configOrType?: TodaySegmentConfig | string): SegmentData | null;
613
+ private getDisplayDirectoryName;
614
+ private formatUsageDisplay;
615
+ private formatUsageWithBudget;
616
+ renderVersion(hookData: ClaudeHookData, colors: PowerlineColors, config?: VersionSegmentConfig): SegmentData | null;
617
+ renderEnv(colors: PowerlineColors, config: EnvSegmentConfig): SegmentData | null;
618
+ renderAgent(hookData: ClaudeHookData, colors: PowerlineColors, config?: AgentSegmentConfig): SegmentData | null;
619
+ renderThinking(hookData: ClaudeHookData, colors: PowerlineColors, config?: ThinkingSegmentConfig): SegmentData | null;
620
+ renderCacheTimer(info: CacheTimerInfo, colors: PowerlineColors, config?: CacheTimerSegmentConfig): SegmentData;
621
+ renderBastra(info: BastraInfo | null, colors: PowerlineColors, config?: BastraSegmentConfig): SegmentData | null;
622
+ }
623
+ //#endregion
624
+ //#region src/config/loader.d.ts
625
+ interface LineConfig {
626
+ segments: {
627
+ directory?: DirectorySegmentConfig;
628
+ git?: GitSegmentConfig;
629
+ model?: SegmentConfig;
630
+ session?: UsageSegmentConfig;
631
+ block?: BlockSegmentConfig;
632
+ today?: TodaySegmentConfig;
633
+ tmux?: TmuxSegmentConfig;
634
+ context?: ContextSegmentConfig;
635
+ metrics?: MetricsSegmentConfig;
636
+ version?: VersionSegmentConfig;
637
+ sessionId?: SessionIdSegmentConfig;
638
+ env?: EnvSegmentConfig;
639
+ weekly?: WeeklySegmentConfig;
640
+ agent?: AgentSegmentConfig;
641
+ thinking?: ThinkingSegmentConfig;
642
+ cacheTimer?: CacheTimerSegmentConfig;
643
+ bastra?: BastraSegmentConfig;
644
+ };
645
+ }
646
+ interface DisplayConfig {
647
+ lines: LineConfig[];
648
+ style?: "minimal" | "powerline" | "capsule" | "tui";
649
+ charset?: "unicode" | "text";
650
+ colorCompatibility?: "auto" | "ansi" | "ansi256" | "truecolor";
651
+ autoWrap?: boolean;
652
+ padding?: number;
653
+ showIcons?: boolean;
654
+ tui?: TuiGridConfig;
655
+ }
656
+ interface BudgetItemConfig {
657
+ amount?: number;
658
+ warningThreshold?: number;
659
+ type?: "cost" | "tokens";
660
+ showPercentage?: boolean;
661
+ showValue?: boolean;
662
+ }
663
+ interface BudgetConfig {
664
+ session?: BudgetItemConfig;
665
+ today?: BudgetItemConfig;
666
+ block?: BudgetItemConfig;
667
+ }
668
+ interface PowerlineConfig {
669
+ theme: "light" | "dark" | "nord" | "tokyo-night" | "rose-pine" | "gruvbox" | "custom";
670
+ display: DisplayConfig;
671
+ colors?: {
672
+ custom: ColorTheme;
673
+ };
674
+ budget?: BudgetConfig;
675
+ modelContextLimits?: Record<string, number>;
676
+ }
677
+ //#endregion
678
+ //#region src/tui/renderer.d.ts
679
+ interface TuiPanelOptions {
680
+ rawTerminalWidth?: number | null;
681
+ }
682
+ declare function renderTuiPanel(data: TuiData, box: BoxChars, reset: string, terminalWidth: number | null, config: PowerlineConfig, options?: TuiPanelOptions): Promise<string>;
683
+ //#endregion
684
+ //#region src/utils/colors.d.ts
685
+ declare function hexToAnsi(hex: string, isBackground: boolean): string;
686
+ declare function extractBgToFg(ansiCode: string, useTextOnly?: boolean): string;
687
+ declare function hexTo256Ansi(hex: string, isBackground: boolean): string;
688
+ declare function hexToBasicAnsi(hex: string, isBackground: boolean): string;
689
+ declare function hexColorDistance(hex1: string, hex2: string): number;
690
+ //#endregion
691
+ //#region src/utils/terminal.d.ts
692
+ declare const ESC: string;
693
+ declare function stripAnsi(str: string): string;
694
+ /**
695
+ * Sichtbare Terminal-Breite (Spalten), nicht UTF-16-Länge: `.length` zählt
696
+ * CJK als 1 (real 2) und Combining Marks als 1 (real 0) — damit war jede
697
+ * Spalten-/Padding-Rechnung für solche Inhalte um 1–2 Spalten daneben.
698
+ */
699
+ declare function visibleLength(str: string): number;
700
+ //#endregion
701
+ //#region src/utils/formatters.d.ts
702
+ interface TokenBreakdown$1 {
703
+ input: number;
704
+ output: number;
705
+ cacheCreation: number;
706
+ cacheRead: number;
707
+ }
708
+ declare function formatCost(cost: number | null): string;
709
+ declare function formatTokens(tokens: number | null): string;
710
+ declare function formatTokenBreakdown(breakdown: TokenBreakdown$1 | null): string;
711
+ declare function formatTimeSince(seconds: number): string;
712
+ declare function formatDuration(seconds: number): string;
713
+ declare function formatModelName(rawName: string): string;
714
+ declare function abbreviateFishStyle(dirPath: string): string;
715
+ declare function formatResponseTime(seconds: number): string;
716
+ declare function formatTokenCount(tokens: number | null): string;
717
+ declare function formatBurnRate(rate: number | null | undefined): string;
718
+ declare function collapseHome(dirPath: string, homeDir?: string): string;
719
+ declare function formatTimeRemaining(totalMinutes: number): string;
720
+ declare function formatLongTimeRemaining(totalMinutes: number): string;
721
+ declare function minutesUntilReset(epochSeconds: number): number;
722
+ declare function formatCacheTimerElapsed(seconds: number): string;
723
+ //#endregion
724
+ //#region src/utils/budget.d.ts
725
+ interface BudgetStatus {
726
+ percentage: number | null;
727
+ isWarning: boolean;
728
+ displayText: string;
729
+ }
730
+ declare function getBudgetStatus(cost: number, budget: number | undefined, warningThreshold?: number): BudgetStatus;
731
+ //#endregion
732
+ //#region src/tui/primitives.d.ts
733
+ declare function colorize(text: string, fgColor: string, reset: string, bold?: boolean): string;
734
+ declare function padRight(text: string, width: number): string;
735
+ declare function padLeft(text: string, width: number): string;
736
+ declare function padCenter(text: string, width: number): string;
737
+ declare function truncateAnsi(text: string, maxWidth: number): string;
738
+ declare function contentRow(box: BoxChars, content: string, innerWidth: number): string;
739
+ declare function divider(box: BoxChars, innerWidth: number): string;
740
+ declare function bottomBorder(box: BoxChars, innerWidth: number, leftText?: string, rightText?: string): string;
741
+ declare function spreadEven(parts: string[], totalWidth: number): string;
742
+ declare function spreadTwo(left: string, right: string, totalWidth: number): string;
743
+ //#endregion
744
+ //#region src/tui/sections.d.ts
745
+ declare function resolveTitleToken(template: string, data: TuiData, resolvedData?: Record<string, string>): string;
746
+ declare function buildTitleBar(data: TuiData, box: BoxChars, innerWidth: number, titleConfig?: TuiTitleConfig, resolvedData?: Record<string, string>): string;
747
+ declare function buildContextBar(data: TuiData, barWidth: number, sym: SymbolSet, reset: string, colors: PowerlineColors, partFg?: Record<string, string>): string;
748
+ declare function buildBlockBar(data: TuiData, barWidth: number, sym: SymbolSet, reset: string, colors: PowerlineColors, config: PowerlineConfig, partFg?: Record<string, string>): string;
749
+ declare function buildWeeklyBar(data: TuiData, barWidth: number, sym: SymbolSet, reset: string, colors: PowerlineColors, partFg?: Record<string, string>): string;
750
+ declare function buildContextLine(data: TuiData, contentWidth: number, sym: SymbolSet, reset: string, colors: PowerlineColors): string | null;
751
+ declare function collectMetricSegments(data: TuiData, sym: SymbolSet, config: PowerlineConfig, reset: string, colors: PowerlineColors): string[];
752
+ declare function collectActivityParts(data: TuiData, sym: SymbolSet): string[];
753
+ declare function collectWorkspaceParts(data: TuiData, sym: SymbolSet, reset: string, colors: PowerlineColors, config: PowerlineConfig): string[];
754
+ declare function collectFooterParts(data: TuiData, sym: SymbolSet, config: PowerlineConfig, reset: string, colors: PowerlineColors): string[];
755
+ interface ResolvedTemplate {
756
+ items: string[];
757
+ gap: number;
758
+ justify: JustifyValue;
759
+ }
760
+ declare function composeTemplate(items: string[], gap: number, justify: JustifyValue, cellWidth?: number): string;
761
+ interface ResolvedSegments {
762
+ data: Record<string, string>;
763
+ templates: Record<string, ResolvedTemplate>;
764
+ }
765
+ declare function resolveSegments(data: TuiData, ctx: RenderCtx): ResolvedSegments;
766
+ //#endregion
767
+ //#region src/tui/layouts.d.ts
768
+ declare function renderWideMetrics(ctx: RenderCtx): void;
769
+ declare function renderWideBottom(ctx: RenderCtx): void;
770
+ declare function renderMediumMetrics(ctx: RenderCtx): void;
771
+ declare function renderMediumBottom(ctx: RenderCtx): void;
772
+ declare function renderNarrowMetrics(ctx: RenderCtx): void;
773
+ declare function renderNarrowBottom(ctx: RenderCtx): void;
774
+ //#endregion
775
+ //#region src/tui/grid.d.ts
776
+ declare const DIVIDER = "---";
777
+ declare const EMPTY_CELL = ".";
778
+ declare const LATE_RESOLVE_SEGMENTS: Set<string>;
779
+ interface GridResult {
780
+ lines: string[];
781
+ panelWidth: number;
782
+ }
783
+ declare function selectBreakpoint(breakpoints: TuiGridBreakpoint[], panelWidth: number): TuiGridBreakpoint;
784
+ declare function parseAreas(areas: string[]): GridCell[][];
785
+ declare function cullMatrix(matrix: GridCell[][], resolvedData: Record<string, string>): GridCell[][];
786
+ declare function calculateColumnWidths(columns: string[], matrix: GridCell[][], resolvedData: Record<string, string>, contentWidth: number, separatorWidth: number, lateResolveNames?: ReadonlySet<string>): number[];
787
+ declare function solveFitContentLayout(columns: string[], matrix: GridCell[][], resolvedData: Record<string, string>, separatorWidth: number, horizontalPadding: number, lateResolveNames?: ReadonlySet<string>): {
788
+ panelWidth: number;
789
+ colWidths: number[];
790
+ };
791
+ declare function renderGrid(gridConfig: TuiGridConfig, resolvedData: Record<string, string>, box: BoxChars, rawTerminalWidth: number, lateResolve?: (segment: string, cellWidth: number) => string | undefined): GridResult;
792
+ //#endregion
793
+ //#region src/config/defaults.d.ts
794
+ declare const DEFAULT_CONFIG: PowerlineConfig;
795
+ //#endregion
796
+ export { type AgentSegmentConfig, 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 CacheTimerInfo, type CacheTimerSegmentConfig, 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 ThinkingSegmentConfig, 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, formatCacheTimerElapsed, 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 };