claude-scope 0.8.42 → 0.8.45

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 (2) hide show
  1. package/dist/claude-scope.cjs +261 -289
  2. package/package.json +1 -1
@@ -1553,7 +1553,7 @@ var init_theme = __esm({
1553
1553
  });
1554
1554
 
1555
1555
  // src/constants.ts
1556
- var TIME, DEFAULTS, ANSI_COLORS, DEMO_DATA, DEFAULT_PROGRESS_BAR_WIDTH;
1556
+ var TIME, DEFAULTS, DEMO_DATA;
1557
1557
  var init_constants = __esm({
1558
1558
  "src/constants.ts"() {
1559
1559
  "use strict";
@@ -1567,19 +1567,7 @@ var init_constants = __esm({
1567
1567
  };
1568
1568
  DEFAULTS = {
1569
1569
  /** Default separator between widgets */
1570
- SEPARATOR: " ",
1571
- /** Default width for progress bars in characters */
1572
- PROGRESS_BAR_WIDTH: 20
1573
- };
1574
- ANSI_COLORS = {
1575
- /** Green color */
1576
- GREEN: "\x1B[32m",
1577
- /** Yellow color */
1578
- YELLOW: "\x1B[33m",
1579
- /** Red color */
1580
- RED: "\x1B[31m",
1581
- /** Reset color */
1582
- RESET: "\x1B[0m"
1570
+ SEPARATOR: " "
1583
1571
  };
1584
1572
  DEMO_DATA = {
1585
1573
  /** Demo session cost in USD */
@@ -1607,7 +1595,6 @@ var init_constants = __esm({
1607
1595
  /** Demo cache read tokens */
1608
1596
  CACHE_READ_TOKENS: 15e3
1609
1597
  };
1610
- DEFAULT_PROGRESS_BAR_WIDTH = DEFAULTS.PROGRESS_BAR_WIDTH;
1611
1598
  }
1612
1599
  });
1613
1600
 
@@ -1902,6 +1889,22 @@ var init_mock_transcript_provider = __esm({
1902
1889
  }
1903
1890
  });
1904
1891
 
1892
+ // src/core/widget-types.ts
1893
+ function createWidgetMetadata(name, description, version = "1.0.0", author = "claude-scope", line = 0) {
1894
+ return {
1895
+ name,
1896
+ description,
1897
+ version,
1898
+ author,
1899
+ line
1900
+ };
1901
+ }
1902
+ var init_widget_types = __esm({
1903
+ "src/core/widget-types.ts"() {
1904
+ "use strict";
1905
+ }
1906
+ });
1907
+
1905
1908
  // src/widgets/core/stdin-data-widget.ts
1906
1909
  var StdinDataWidget;
1907
1910
  var init_stdin_data_widget = __esm({
@@ -1916,6 +1919,10 @@ var init_stdin_data_widget = __esm({
1916
1919
  * Widget enabled state
1917
1920
  */
1918
1921
  enabled = true;
1922
+ /**
1923
+ * Line override for dynamic positioning
1924
+ */
1925
+ _lineOverride;
1919
1926
  /**
1920
1927
  * Initialize widget with context
1921
1928
  * @param context - Widget initialization context
@@ -1962,6 +1969,20 @@ var init_stdin_data_widget = __esm({
1962
1969
  }
1963
1970
  return this.renderWithData(this.data, context);
1964
1971
  }
1972
+ /**
1973
+ * Set line override for dynamic positioning
1974
+ * @param line - Line number to position widget on
1975
+ */
1976
+ setLine(line) {
1977
+ this._lineOverride = line;
1978
+ }
1979
+ /**
1980
+ * Get effective line number (override or metadata default)
1981
+ * @returns Line number for widget positioning
1982
+ */
1983
+ getLine() {
1984
+ return this._lineOverride ?? this.metadata.line ?? 0;
1985
+ }
1965
1986
  };
1966
1987
  }
1967
1988
  });
@@ -2276,25 +2297,25 @@ var ActiveToolsWidget;
2276
2297
  var init_active_tools_widget = __esm({
2277
2298
  "src/widgets/active-tools/active-tools-widget.ts"() {
2278
2299
  "use strict";
2300
+ init_widget_types();
2279
2301
  init_stdin_data_widget();
2280
2302
  init_styles();
2281
2303
  ActiveToolsWidget = class extends StdinDataWidget {
2282
- constructor(theme, transcriptProvider) {
2304
+ constructor(colors2, transcriptProvider) {
2283
2305
  super();
2284
- this.theme = theme;
2306
+ this.colors = colors2;
2285
2307
  this.transcriptProvider = transcriptProvider;
2286
2308
  }
2287
2309
  id = "active-tools";
2288
- metadata = {
2289
- name: "Active Tools",
2290
- description: "Active tools display from transcript",
2291
- version: "1.0.0",
2292
- author: "claude-scope",
2293
- line: 2
2310
+ metadata = createWidgetMetadata(
2311
+ "Active Tools",
2312
+ "Active tools display from transcript",
2313
+ "1.0.0",
2314
+ "claude-scope",
2315
+ 2
2294
2316
  // Display on third line (0-indexed)
2295
- };
2296
- style = "balanced";
2297
- _lineOverride;
2317
+ );
2318
+ styleFn = activeToolsStyles.balanced;
2298
2319
  tools = [];
2299
2320
  renderData;
2300
2321
  /**
@@ -2302,13 +2323,10 @@ var init_active_tools_widget = __esm({
2302
2323
  * @param style - Style to use for rendering
2303
2324
  */
2304
2325
  setStyle(style) {
2305
- this.style = style;
2306
- }
2307
- setLine(line) {
2308
- this._lineOverride = line;
2309
- }
2310
- getLine() {
2311
- return this._lineOverride ?? this.metadata.line ?? 0;
2326
+ const fn = activeToolsStyles[style];
2327
+ if (fn) {
2328
+ this.styleFn = fn;
2329
+ }
2312
2330
  }
2313
2331
  /**
2314
2332
  * Aggregate completed tools by name and sort by count (descending)
@@ -2363,11 +2381,7 @@ var init_active_tools_widget = __esm({
2363
2381
  if (!this.renderData || this.tools.length === 0) {
2364
2382
  return null;
2365
2383
  }
2366
- const styleFn = activeToolsStyles[this.style] ?? activeToolsStyles.balanced;
2367
- if (!styleFn) {
2368
- return null;
2369
- }
2370
- return styleFn(this.renderData, this.theme);
2384
+ return this.styleFn(this.renderData, this.colors);
2371
2385
  }
2372
2386
  /**
2373
2387
  * Check if widget should render
@@ -2397,29 +2411,53 @@ var init_active_tools = __esm({
2397
2411
  }
2398
2412
  });
2399
2413
 
2400
- // src/core/widget-types.ts
2401
- function createWidgetMetadata(name, description, version = "1.0.0", author = "claude-scope", line = 0) {
2402
- return {
2403
- name,
2404
- description,
2405
- version,
2406
- author,
2407
- line
2408
- };
2414
+ // src/providers/jsonl-reader.ts
2415
+ async function readJsonlLines(filePath, options = {}) {
2416
+ if (!(0, import_node_fs.existsSync)(filePath)) {
2417
+ return [];
2418
+ }
2419
+ const lines = [];
2420
+ const fileStream = (0, import_node_fs.createReadStream)(filePath, {
2421
+ encoding: options.encoding ?? "utf-8"
2422
+ });
2423
+ const rl = (0, import_node_readline.createInterface)({
2424
+ input: fileStream,
2425
+ crlfDelay: Infinity
2426
+ });
2427
+ try {
2428
+ for await (const line of rl) {
2429
+ const trimmed = line.trim();
2430
+ if (trimmed) {
2431
+ lines.push(trimmed);
2432
+ }
2433
+ }
2434
+ return lines;
2435
+ } catch {
2436
+ return [];
2437
+ } finally {
2438
+ rl.close();
2439
+ fileStream.destroy();
2440
+ }
2409
2441
  }
2410
- var init_widget_types = __esm({
2411
- "src/core/widget-types.ts"() {
2442
+ var import_node_fs, import_node_readline;
2443
+ var init_jsonl_reader = __esm({
2444
+ "src/providers/jsonl-reader.ts"() {
2412
2445
  "use strict";
2446
+ import_node_fs = require("node:fs");
2447
+ import_node_readline = require("node:readline");
2413
2448
  }
2414
2449
  });
2415
2450
 
2416
2451
  // src/providers/usage-parser.ts
2417
- var import_fs, import_readline, UsageParser;
2452
+ function hasRealUsage(usage) {
2453
+ if (!usage) return false;
2454
+ return (usage.input_tokens ?? 0) > 0 || (usage.output_tokens ?? 0) > 0 || (usage.cache_read_input_tokens ?? 0) > 0 || (usage.cache_creation_input_tokens ?? 0) > 0;
2455
+ }
2456
+ var UsageParser;
2418
2457
  var init_usage_parser = __esm({
2419
2458
  "src/providers/usage-parser.ts"() {
2420
2459
  "use strict";
2421
- import_fs = require("fs");
2422
- import_readline = require("readline");
2460
+ init_jsonl_reader();
2423
2461
  UsageParser = class {
2424
2462
  /**
2425
2463
  * Parse the last assistant message with usage data from transcript
@@ -2429,11 +2467,11 @@ var init_usage_parser = __esm({
2429
2467
  * @returns ContextUsage or null if not found
2430
2468
  */
2431
2469
  async parseLastUsage(transcriptPath) {
2432
- if (!(0, import_fs.existsSync)(transcriptPath)) {
2433
- return null;
2434
- }
2435
2470
  try {
2436
- const lines = await this.readAllLines(transcriptPath);
2471
+ const lines = await readJsonlLines(transcriptPath);
2472
+ if (lines.length === 0) {
2473
+ return null;
2474
+ }
2437
2475
  let mostRecentUsage = null;
2438
2476
  let mostRecentTimestamp = null;
2439
2477
  let hasAnyTimestamp = false;
@@ -2470,27 +2508,6 @@ var init_usage_parser = __esm({
2470
2508
  }
2471
2509
  return null;
2472
2510
  }
2473
- /**
2474
- * Read all lines from transcript file
2475
- */
2476
- async readAllLines(transcriptPath) {
2477
- const lines = [];
2478
- try {
2479
- const fileStream = (0, import_fs.createReadStream)(transcriptPath, { encoding: "utf-8" });
2480
- const rl = (0, import_readline.createInterface)({
2481
- input: fileStream,
2482
- crlfDelay: Infinity
2483
- });
2484
- for await (const line of rl) {
2485
- if (line.trim()) {
2486
- lines.push(line);
2487
- }
2488
- }
2489
- } catch {
2490
- return [];
2491
- }
2492
- return lines;
2493
- }
2494
2511
  /**
2495
2512
  * Parse cumulative cache tokens from all assistant messages in transcript
2496
2513
  *
@@ -2502,11 +2519,11 @@ var init_usage_parser = __esm({
2502
2519
  * @returns Object with cumulative cacheRead and cacheCreation, or null if not found
2503
2520
  */
2504
2521
  async parseCumulativeCache(transcriptPath) {
2505
- if (!(0, import_fs.existsSync)(transcriptPath)) {
2506
- return null;
2507
- }
2508
2522
  try {
2509
- const lines = await this.readAllLines(transcriptPath);
2523
+ const lines = await readJsonlLines(transcriptPath);
2524
+ if (lines.length === 0) {
2525
+ return null;
2526
+ }
2510
2527
  const cacheEntries = [];
2511
2528
  for (const line of lines) {
2512
2529
  const entry = this.parseLineForCache(line);
@@ -2621,11 +2638,11 @@ var init_usage_parser = __esm({
2621
2638
  });
2622
2639
 
2623
2640
  // src/storage/cache-manager.ts
2624
- var import_node_fs, import_node_os2, import_node_path2, DEFAULT_CACHE_PATH, DEFAULT_EXPIRY_MS, CacheManager;
2641
+ var import_node_fs2, import_node_os2, import_node_path2, DEFAULT_CACHE_PATH, DEFAULT_EXPIRY_MS, CacheManager;
2625
2642
  var init_cache_manager = __esm({
2626
2643
  "src/storage/cache-manager.ts"() {
2627
2644
  "use strict";
2628
- import_node_fs = require("node:fs");
2645
+ import_node_fs2 = require("node:fs");
2629
2646
  import_node_os2 = require("node:os");
2630
2647
  import_node_path2 = require("node:path");
2631
2648
  DEFAULT_CACHE_PATH = `${(0, import_node_os2.homedir)()}/.config/claude-scope/cache.json`;
@@ -2698,11 +2715,11 @@ var init_cache_manager = __esm({
2698
2715
  * Load cache from file
2699
2716
  */
2700
2717
  loadCache() {
2701
- if (!(0, import_node_fs.existsSync)(this.cachePath)) {
2718
+ if (!(0, import_node_fs2.existsSync)(this.cachePath)) {
2702
2719
  return { sessions: {}, version: 1 };
2703
2720
  }
2704
2721
  try {
2705
- const content = (0, import_node_fs.readFileSync)(this.cachePath, "utf-8");
2722
+ const content = (0, import_node_fs2.readFileSync)(this.cachePath, "utf-8");
2706
2723
  return JSON.parse(content);
2707
2724
  } catch {
2708
2725
  return { sessions: {}, version: 1 };
@@ -2713,7 +2730,7 @@ var init_cache_manager = __esm({
2713
2730
  */
2714
2731
  saveCache(cache) {
2715
2732
  try {
2716
- (0, import_node_fs.writeFileSync)(this.cachePath, JSON.stringify(cache, null, 2), "utf-8");
2733
+ (0, import_node_fs2.writeFileSync)(this.cachePath, JSON.stringify(cache, null, 2), "utf-8");
2717
2734
  } catch {
2718
2735
  }
2719
2736
  }
@@ -2723,8 +2740,8 @@ var init_cache_manager = __esm({
2723
2740
  ensureCacheDir() {
2724
2741
  try {
2725
2742
  const dir = (0, import_node_path2.dirname)(this.cachePath);
2726
- if (!(0, import_node_fs.existsSync)(dir)) {
2727
- (0, import_node_fs.mkdirSync)(dir, { recursive: true });
2743
+ if (!(0, import_node_fs2.existsSync)(dir)) {
2744
+ (0, import_node_fs2.mkdirSync)(dir, { recursive: true });
2728
2745
  }
2729
2746
  } catch {
2730
2747
  }
@@ -2756,9 +2773,6 @@ function formatDuration(ms) {
2756
2773
  function formatCostUSD(usd) {
2757
2774
  return `$${usd.toFixed(2)}`;
2758
2775
  }
2759
- function colorize2(text, color) {
2760
- return `${color}${text}${ANSI_COLORS.RESET}`;
2761
- }
2762
2776
  function formatK(n) {
2763
2777
  const absN = Math.abs(n);
2764
2778
  if (absN < 1e3) {
@@ -2887,9 +2901,8 @@ var init_cache_metrics_widget = __esm({
2887
2901
  2
2888
2902
  // Third line
2889
2903
  );
2890
- theme;
2891
- _lineOverride;
2892
- style = "balanced";
2904
+ colors;
2905
+ styleFn = cacheMetricsStyles.balanced;
2893
2906
  renderData;
2894
2907
  cacheManager;
2895
2908
  usageParser;
@@ -2898,9 +2911,9 @@ var init_cache_metrics_widget = __esm({
2898
2911
  // Cache parsed usage within render cycle
2899
2912
  cachedCumulativeCache;
2900
2913
  // Cumulative cache for session
2901
- constructor(theme) {
2914
+ constructor(colors2) {
2902
2915
  super();
2903
- this.theme = theme ?? DEFAULT_THEME;
2916
+ this.colors = colors2 ?? DEFAULT_THEME;
2904
2917
  this.cacheManager = new CacheManager();
2905
2918
  this.usageParser = new UsageParser();
2906
2919
  }
@@ -2908,13 +2921,10 @@ var init_cache_metrics_widget = __esm({
2908
2921
  * Set display style
2909
2922
  */
2910
2923
  setStyle(style) {
2911
- this.style = style;
2912
- }
2913
- setLine(line) {
2914
- this._lineOverride = line;
2915
- }
2916
- getLine() {
2917
- return this._lineOverride ?? this.metadata.line ?? 0;
2924
+ const fn = cacheMetricsStyles[style];
2925
+ if (fn) {
2926
+ this.styleFn = fn;
2927
+ }
2918
2928
  }
2919
2929
  /**
2920
2930
  * Calculate cache metrics from context usage data
@@ -2964,8 +2974,7 @@ var init_cache_metrics_widget = __esm({
2964
2974
  this.lastSessionId = sessionId;
2965
2975
  const usage = data.context_window?.current_usage;
2966
2976
  if (usage && !sessionChanged && sessionId) {
2967
- const hasAnyTokens = (usage.input_tokens ?? 0) > 0 || (usage.output_tokens ?? 0) > 0 || (usage.cache_creation_input_tokens ?? 0) > 0 || (usage.cache_read_input_tokens ?? 0) > 0;
2968
- if (hasAnyTokens) {
2977
+ if (hasRealUsage(usage)) {
2969
2978
  this.cacheManager.setCachedUsage(sessionId, {
2970
2979
  input_tokens: usage.input_tokens,
2971
2980
  output_tokens: usage.output_tokens,
@@ -2974,9 +2983,8 @@ var init_cache_metrics_widget = __esm({
2974
2983
  });
2975
2984
  }
2976
2985
  }
2977
- const hasRealUsage = usage && ((usage.input_tokens ?? 0) > 0 || (usage.output_tokens ?? 0) > 0 || (usage.cache_read_input_tokens ?? 0) > 0 || (usage.cache_creation_input_tokens ?? 0) > 0);
2978
2986
  const transcriptPath = data.transcript_path;
2979
- if (!usage || !hasRealUsage) {
2987
+ if (!hasRealUsage(usage)) {
2980
2988
  if (transcriptPath) {
2981
2989
  this.cachedUsage = await this.usageParser.parseLastUsage(transcriptPath);
2982
2990
  }
@@ -2992,8 +3000,7 @@ var init_cache_metrics_widget = __esm({
2992
3000
  */
2993
3001
  renderWithData(data, _context) {
2994
3002
  let usage = data.context_window?.current_usage;
2995
- const hasRealUsage = usage && ((usage.input_tokens ?? 0) > 0 || (usage.output_tokens ?? 0) > 0 || (usage.cache_read_input_tokens ?? 0) > 0 || (usage.cache_creation_input_tokens ?? 0) > 0);
2996
- if ((!usage || !hasRealUsage) && this.cachedUsage) {
3003
+ if (!hasRealUsage(usage) && this.cachedUsage) {
2997
3004
  usage = this.cachedUsage;
2998
3005
  }
2999
3006
  if (!usage && data.session_id) {
@@ -3008,11 +3015,7 @@ var init_cache_metrics_widget = __esm({
3008
3015
  return null;
3009
3016
  }
3010
3017
  this.renderData = metrics;
3011
- const styleFn = cacheMetricsStyles[this.style] ?? cacheMetricsStyles.balanced;
3012
- if (!styleFn) {
3013
- return null;
3014
- }
3015
- return styleFn(this.renderData, this.theme);
3018
+ return this.styleFn(this.renderData, this.colors);
3016
3019
  }
3017
3020
  /**
3018
3021
  * Widget is always enabled (shows zeros when no data)
@@ -3350,13 +3353,13 @@ var init_config_count_widget = __esm({
3350
3353
  );
3351
3354
  configProvider;
3352
3355
  configs;
3353
- cwd;
3354
- themeColors;
3355
- _lineOverride;
3356
+ colors;
3357
+ enabled = true;
3356
3358
  styleFn = configCountStyles.balanced;
3357
- constructor(configProvider, themeColors) {
3359
+ _lineOverride;
3360
+ constructor(configProvider, colors2) {
3358
3361
  this.configProvider = configProvider ?? new ConfigProvider();
3359
- this.themeColors = themeColors ?? DEFAULT_THEME;
3362
+ this.colors = colors2 ?? DEFAULT_THEME;
3360
3363
  }
3361
3364
  setStyle(style = DEFAULT_WIDGET_STYLE) {
3362
3365
  const fn = configCountStyles[style];
@@ -3364,20 +3367,14 @@ var init_config_count_widget = __esm({
3364
3367
  this.styleFn = fn;
3365
3368
  }
3366
3369
  }
3367
- setLine(line) {
3368
- this._lineOverride = line;
3369
- }
3370
- getLine() {
3371
- return this._lineOverride ?? this.metadata.line ?? 0;
3372
- }
3373
- async initialize() {
3370
+ async initialize(context) {
3371
+ this.enabled = context.config?.enabled !== false;
3374
3372
  }
3375
3373
  async update(data) {
3376
- this.cwd = data.cwd;
3377
3374
  this.configs = await this.configProvider.getConfigs({ cwd: data.cwd });
3378
3375
  }
3379
3376
  isEnabled() {
3380
- if (!this.configs) {
3377
+ if (!this.enabled || !this.configs) {
3381
3378
  return false;
3382
3379
  }
3383
3380
  const { claudeMdCount, rulesCount, mcpCount, hooksCount } = this.configs;
@@ -3392,12 +3389,15 @@ var init_config_count_widget = __esm({
3392
3389
  claudeMdCount,
3393
3390
  rulesCount,
3394
3391
  mcpCount,
3395
- hooksCount,
3396
- colors: this.themeColors
3392
+ hooksCount
3397
3393
  };
3398
- return this.styleFn(renderData, this.themeColors);
3394
+ return this.styleFn(renderData, this.colors);
3395
+ }
3396
+ setLine(line) {
3397
+ this._lineOverride = line;
3399
3398
  }
3400
- async cleanup() {
3399
+ getLine() {
3400
+ return this._lineOverride ?? this.metadata.line ?? 0;
3401
3401
  }
3402
3402
  };
3403
3403
  }
@@ -3493,6 +3493,7 @@ var ContextWidget;
3493
3493
  var init_context_widget = __esm({
3494
3494
  "src/widgets/context-widget.ts"() {
3495
3495
  "use strict";
3496
+ init_style_types();
3496
3497
  init_widget_types();
3497
3498
  init_usage_parser();
3498
3499
  init_cache_manager();
@@ -3510,7 +3511,6 @@ var init_context_widget = __esm({
3510
3511
  // First line
3511
3512
  );
3512
3513
  colors;
3513
- _lineOverride;
3514
3514
  styleFn = contextStyles.balanced;
3515
3515
  cacheManager;
3516
3516
  usageParser;
@@ -3523,18 +3523,12 @@ var init_context_widget = __esm({
3523
3523
  this.cacheManager = new CacheManager();
3524
3524
  this.usageParser = new UsageParser();
3525
3525
  }
3526
- setStyle(style = "balanced") {
3526
+ setStyle(style = DEFAULT_WIDGET_STYLE) {
3527
3527
  const fn = contextStyles[style];
3528
3528
  if (fn) {
3529
3529
  this.styleFn = fn;
3530
3530
  }
3531
3531
  }
3532
- setLine(line) {
3533
- this._lineOverride = line;
3534
- }
3535
- getLine() {
3536
- return this._lineOverride ?? this.metadata.line ?? 0;
3537
- }
3538
3532
  /**
3539
3533
  * Update widget with new data, storing valid values in cache
3540
3534
  */
@@ -3549,8 +3543,7 @@ var init_context_widget = __esm({
3549
3543
  this.lastSessionId = sessionId;
3550
3544
  const { current_usage } = contextWindow;
3551
3545
  if (current_usage && !sessionChanged && sessionId) {
3552
- const hasAnyTokens = (current_usage.input_tokens ?? 0) > 0 || (current_usage.output_tokens ?? 0) > 0 || (current_usage.cache_creation_input_tokens ?? 0) > 0 || (current_usage.cache_read_input_tokens ?? 0) > 0;
3553
- if (hasAnyTokens) {
3546
+ if (hasRealUsage(current_usage)) {
3554
3547
  this.cacheManager.setCachedUsage(sessionId, {
3555
3548
  input_tokens: current_usage.input_tokens,
3556
3549
  output_tokens: current_usage.output_tokens,
@@ -3559,8 +3552,7 @@ var init_context_widget = __esm({
3559
3552
  });
3560
3553
  }
3561
3554
  }
3562
- const hasRealUsage = current_usage && ((current_usage.input_tokens ?? 0) > 0 || (current_usage.output_tokens ?? 0) > 0 || (current_usage.cache_read_input_tokens ?? 0) > 0 || (current_usage.cache_creation_input_tokens ?? 0) > 0);
3563
- if (!current_usage || !hasRealUsage) {
3555
+ if (!hasRealUsage(current_usage)) {
3564
3556
  const transcriptPath = data.transcript_path;
3565
3557
  if (transcriptPath) {
3566
3558
  this.cachedUsage = await this.usageParser.parseLastUsage(transcriptPath);
@@ -3584,8 +3576,7 @@ var init_context_widget = __esm({
3584
3576
  return this.styleFn(renderData2, this.colors.context);
3585
3577
  }
3586
3578
  let usage = current_usage;
3587
- const hasRealUsage = usage && ((usage.input_tokens ?? 0) > 0 || (usage.output_tokens ?? 0) > 0 || (usage.cache_read_input_tokens ?? 0) > 0 || (usage.cache_creation_input_tokens ?? 0) > 0);
3588
- if ((!usage || !hasRealUsage) && this.cachedUsage) {
3579
+ if (!hasRealUsage(usage) && this.cachedUsage) {
3589
3580
  usage = this.cachedUsage;
3590
3581
  }
3591
3582
  if (!usage && data.session_id) {
@@ -3666,6 +3657,7 @@ var CostWidget;
3666
3657
  var init_cost_widget = __esm({
3667
3658
  "src/widgets/cost-widget.ts"() {
3668
3659
  "use strict";
3660
+ init_style_types();
3669
3661
  init_widget_types();
3670
3662
  init_theme();
3671
3663
  init_stdin_data_widget();
@@ -3681,24 +3673,17 @@ var init_cost_widget = __esm({
3681
3673
  // First line
3682
3674
  );
3683
3675
  colors;
3684
- _lineOverride;
3685
3676
  styleFn = costStyles.balanced;
3686
3677
  constructor(colors2) {
3687
3678
  super();
3688
3679
  this.colors = colors2 ?? DEFAULT_THEME;
3689
3680
  }
3690
- setStyle(style = "balanced") {
3681
+ setStyle(style = DEFAULT_WIDGET_STYLE) {
3691
3682
  const fn = costStyles[style];
3692
3683
  if (fn) {
3693
3684
  this.styleFn = fn;
3694
3685
  }
3695
3686
  }
3696
- setLine(line) {
3697
- this._lineOverride = line;
3698
- }
3699
- getLine() {
3700
- return this._lineOverride ?? this.metadata.line ?? 0;
3701
- }
3702
3687
  renderWithData(data, _context) {
3703
3688
  if (!data.cost || data.cost.total_cost_usd === void 0) return null;
3704
3689
  if (data.cost.total_cost_usd === 0) return null;
@@ -3905,6 +3890,7 @@ var DevServerWidget;
3905
3890
  var init_dev_server_widget = __esm({
3906
3891
  "src/widgets/dev-server/dev-server-widget.ts"() {
3907
3892
  "use strict";
3893
+ init_style_types();
3908
3894
  init_widget_types();
3909
3895
  init_theme();
3910
3896
  init_port_detector();
@@ -3935,7 +3921,7 @@ var init_dev_server_widget = __esm({
3935
3921
  * Set display style
3936
3922
  * @param style - Style to use for rendering
3937
3923
  */
3938
- setStyle(style = "balanced") {
3924
+ setStyle(style = DEFAULT_WIDGET_STYLE) {
3939
3925
  const fn = devServerStyles[style];
3940
3926
  if (fn) {
3941
3927
  this.styleFn = fn;
@@ -3976,11 +3962,6 @@ var init_dev_server_widget = __esm({
3976
3962
  isEnabled() {
3977
3963
  return this.enabled;
3978
3964
  }
3979
- /**
3980
- * Cleanup resources
3981
- */
3982
- async cleanup() {
3983
- }
3984
3965
  /**
3985
3966
  * Render widget output
3986
3967
  * @param context - Render context
@@ -4096,6 +4077,7 @@ var init_docker_widget = __esm({
4096
4077
  "use strict";
4097
4078
  import_node_child_process3 = require("node:child_process");
4098
4079
  import_node_util3 = require("node:util");
4080
+ init_style_types();
4099
4081
  init_widget_types();
4100
4082
  init_theme();
4101
4083
  init_styles7();
@@ -4119,7 +4101,7 @@ var init_docker_widget = __esm({
4119
4101
  constructor(colors2) {
4120
4102
  this.colors = colors2 ?? DEFAULT_THEME;
4121
4103
  }
4122
- setStyle(style = "balanced") {
4104
+ setStyle(style = DEFAULT_WIDGET_STYLE) {
4123
4105
  const fn = dockerStyles[style];
4124
4106
  if (fn) {
4125
4107
  this.styleFn = fn;
@@ -4139,8 +4121,6 @@ var init_docker_widget = __esm({
4139
4121
  isEnabled() {
4140
4122
  return this.enabled;
4141
4123
  }
4142
- async cleanup() {
4143
- }
4144
4124
  async render(_context) {
4145
4125
  if (!this.enabled) {
4146
4126
  return null;
@@ -4279,6 +4259,7 @@ var DurationWidget;
4279
4259
  var init_duration_widget = __esm({
4280
4260
  "src/widgets/duration-widget.ts"() {
4281
4261
  "use strict";
4262
+ init_style_types();
4282
4263
  init_widget_types();
4283
4264
  init_theme();
4284
4265
  init_stdin_data_widget();
@@ -4294,24 +4275,17 @@ var init_duration_widget = __esm({
4294
4275
  // First line
4295
4276
  );
4296
4277
  colors;
4297
- _lineOverride;
4298
4278
  styleFn = durationStyles.balanced;
4299
4279
  constructor(colors2) {
4300
4280
  super();
4301
4281
  this.colors = colors2 ?? DEFAULT_THEME;
4302
4282
  }
4303
- setStyle(style = "balanced") {
4283
+ setStyle(style = DEFAULT_WIDGET_STYLE) {
4304
4284
  const fn = durationStyles[style];
4305
4285
  if (fn) {
4306
4286
  this.styleFn = fn;
4307
4287
  }
4308
4288
  }
4309
- setLine(line) {
4310
- this._lineOverride = line;
4311
- }
4312
- getLine() {
4313
- return this._lineOverride ?? this.metadata.line ?? 0;
4314
- }
4315
4289
  renderWithData(data, _context) {
4316
4290
  if (!data.cost || data.cost.total_duration_ms === void 0) return null;
4317
4291
  if (data.cost.total_duration_ms === 0) return null;
@@ -4436,6 +4410,7 @@ var GitTagWidget;
4436
4410
  var init_git_tag_widget = __esm({
4437
4411
  "src/widgets/git/git-tag-widget.ts"() {
4438
4412
  "use strict";
4413
+ init_style_types();
4439
4414
  init_widget_types();
4440
4415
  init_git_provider();
4441
4416
  init_theme();
@@ -4467,7 +4442,7 @@ var init_git_tag_widget = __esm({
4467
4442
  this.gitFactory = gitFactory || createGit;
4468
4443
  this.colors = colors2 ?? DEFAULT_THEME;
4469
4444
  }
4470
- setStyle(style = "balanced") {
4445
+ setStyle(style = DEFAULT_WIDGET_STYLE) {
4471
4446
  const fn = gitTagStyles[style];
4472
4447
  if (fn) {
4473
4448
  this.styleFn = fn;
@@ -4503,8 +4478,6 @@ var init_git_tag_widget = __esm({
4503
4478
  isEnabled() {
4504
4479
  return this.enabled;
4505
4480
  }
4506
- async cleanup() {
4507
- }
4508
4481
  };
4509
4482
  }
4510
4483
  });
@@ -4610,6 +4583,7 @@ var GitWidget;
4610
4583
  var init_git_widget = __esm({
4611
4584
  "src/widgets/git/git-widget.ts"() {
4612
4585
  "use strict";
4586
+ init_style_types();
4613
4587
  init_widget_types();
4614
4588
  init_git_provider();
4615
4589
  init_theme();
@@ -4641,7 +4615,7 @@ var init_git_widget = __esm({
4641
4615
  this.gitFactory = gitFactory || createGit;
4642
4616
  this.colors = colors2 ?? DEFAULT_THEME;
4643
4617
  }
4644
- setStyle(style = "balanced") {
4618
+ setStyle(style = DEFAULT_WIDGET_STYLE) {
4645
4619
  const fn = gitStyles[style];
4646
4620
  if (fn) {
4647
4621
  this.styleFn = fn;
@@ -4697,8 +4671,6 @@ var init_git_widget = __esm({
4697
4671
  isEnabled() {
4698
4672
  return this.enabled;
4699
4673
  }
4700
- async cleanup() {
4701
- }
4702
4674
  };
4703
4675
  }
4704
4676
  });
@@ -4762,6 +4734,7 @@ var LinesWidget;
4762
4734
  var init_lines_widget = __esm({
4763
4735
  "src/widgets/lines-widget.ts"() {
4764
4736
  "use strict";
4737
+ init_style_types();
4765
4738
  init_widget_types();
4766
4739
  init_theme();
4767
4740
  init_stdin_data_widget();
@@ -4777,24 +4750,17 @@ var init_lines_widget = __esm({
4777
4750
  // First line
4778
4751
  );
4779
4752
  colors;
4780
- _lineOverride;
4781
4753
  styleFn = linesStyles.balanced;
4782
4754
  constructor(colors2) {
4783
4755
  super();
4784
4756
  this.colors = colors2 ?? DEFAULT_THEME;
4785
4757
  }
4786
- setStyle(style = "balanced") {
4758
+ setStyle(style = DEFAULT_WIDGET_STYLE) {
4787
4759
  const fn = linesStyles[style];
4788
4760
  if (fn) {
4789
4761
  this.styleFn = fn;
4790
4762
  }
4791
4763
  }
4792
- setLine(line) {
4793
- this._lineOverride = line;
4794
- }
4795
- getLine() {
4796
- return this._lineOverride ?? this.metadata.line ?? 0;
4797
- }
4798
4764
  renderWithData(data, _context) {
4799
4765
  const added = data.cost?.total_lines_added ?? 0;
4800
4766
  const removed = data.cost?.total_lines_removed ?? 0;
@@ -4863,6 +4829,7 @@ var ModelWidget;
4863
4829
  var init_model_widget = __esm({
4864
4830
  "src/widgets/model-widget.ts"() {
4865
4831
  "use strict";
4832
+ init_style_types();
4866
4833
  init_widget_types();
4867
4834
  init_theme();
4868
4835
  init_stdin_data_widget();
@@ -4878,24 +4845,17 @@ var init_model_widget = __esm({
4878
4845
  // First line
4879
4846
  );
4880
4847
  colors;
4881
- _lineOverride;
4882
4848
  styleFn = modelStyles.balanced;
4883
4849
  constructor(colors2) {
4884
4850
  super();
4885
4851
  this.colors = colors2 ?? DEFAULT_THEME;
4886
4852
  }
4887
- setStyle(style = "balanced") {
4853
+ setStyle(style = DEFAULT_WIDGET_STYLE) {
4888
4854
  const fn = modelStyles[style];
4889
4855
  if (fn) {
4890
4856
  this.styleFn = fn;
4891
4857
  }
4892
4858
  }
4893
- setLine(line) {
4894
- this._lineOverride = line;
4895
- }
4896
- getLine() {
4897
- return this._lineOverride ?? this.metadata.line ?? 0;
4898
- }
4899
4859
  renderWithData(data, _context) {
4900
4860
  if (!data.model) {
4901
4861
  return null;
@@ -26221,6 +26181,24 @@ function generateRichLayout(style, themeName) {
26221
26181
  count: theme.tools.count
26222
26182
  }
26223
26183
  }
26184
+ ],
26185
+ "3": [
26186
+ {
26187
+ id: "sysmon",
26188
+ style,
26189
+ colors: {
26190
+ cpu: theme.sysmon.cpu,
26191
+ ram: theme.sysmon.ram,
26192
+ disk: theme.sysmon.disk,
26193
+ network: theme.sysmon.network,
26194
+ separator: theme.sysmon.separator
26195
+ }
26196
+ }
26197
+ ],
26198
+ "4": [
26199
+ {
26200
+ id: "empty-line"
26201
+ }
26224
26202
  ]
26225
26203
  }
26226
26204
  };
@@ -26425,8 +26403,7 @@ init_renderer();
26425
26403
  init_widget_registry();
26426
26404
 
26427
26405
  // src/providers/transcript-provider.ts
26428
- var import_node_fs2 = require("node:fs");
26429
- var import_node_readline = require("node:readline");
26406
+ init_jsonl_reader();
26430
26407
  var TranscriptProvider = class {
26431
26408
  MAX_TOOLS = 20;
26432
26409
  /**
@@ -26435,29 +26412,17 @@ var TranscriptProvider = class {
26435
26412
  * @returns Array of tool entries, limited to last 20
26436
26413
  */
26437
26414
  async parseTools(transcriptPath) {
26438
- if (!(0, import_node_fs2.existsSync)(transcriptPath)) {
26439
- return [];
26440
- }
26415
+ const lines = await readJsonlLines(transcriptPath);
26441
26416
  const toolMap = /* @__PURE__ */ new Map();
26442
- try {
26443
- const fileStream = (0, import_node_fs2.createReadStream)(transcriptPath, { encoding: "utf-8" });
26444
- const rl = (0, import_node_readline.createInterface)({
26445
- input: fileStream,
26446
- crlfDelay: Infinity
26447
- });
26448
- for await (const line of rl) {
26449
- if (!line.trim()) continue;
26450
- try {
26451
- const entry = JSON.parse(line);
26452
- this.processLine(entry, toolMap);
26453
- } catch {
26454
- }
26417
+ for (const line of lines) {
26418
+ try {
26419
+ const entry = JSON.parse(line);
26420
+ this.processLine(entry, toolMap);
26421
+ } catch {
26455
26422
  }
26456
- const tools = Array.from(toolMap.values());
26457
- return tools.slice(-this.MAX_TOOLS);
26458
- } catch {
26459
- return [];
26460
26423
  }
26424
+ const tools = Array.from(toolMap.values());
26425
+ return tools.slice(-this.MAX_TOOLS);
26461
26426
  }
26462
26427
  /**
26463
26428
  * Process a single transcript line and update tool map
@@ -26538,41 +26503,8 @@ init_lines_widget();
26538
26503
  init_model_widget();
26539
26504
 
26540
26505
  // src/widgets/sysmon-widget.ts
26506
+ init_style_types();
26541
26507
  init_widget_types();
26542
-
26543
- // src/providers/metrics-cache.ts
26544
- var MetricsCache = class {
26545
- cached = null;
26546
- cacheTime = 0;
26547
- ttlMs;
26548
- constructor(ttlMs = 1e3) {
26549
- this.ttlMs = ttlMs;
26550
- }
26551
- /**
26552
- * Get cached metrics or fetch fresh if cache expired
26553
- * @param fetcher - Function to fetch fresh metrics
26554
- * @returns Cached or fresh metrics, or null if fetcher returns null
26555
- */
26556
- async get(fetcher) {
26557
- const now = Date.now();
26558
- if (this.cached && now - this.cacheTime < this.ttlMs) {
26559
- return this.cached;
26560
- }
26561
- const fresh = await fetcher();
26562
- this.cached = fresh;
26563
- this.cacheTime = now;
26564
- return fresh;
26565
- }
26566
- /**
26567
- * Clear the cache
26568
- */
26569
- clear() {
26570
- this.cached = null;
26571
- this.cacheTime = 0;
26572
- }
26573
- };
26574
-
26575
- // src/widgets/sysmon-widget.ts
26576
26508
  init_theme();
26577
26509
 
26578
26510
  // src/widgets/sysmon/styles.ts
@@ -26642,16 +26574,12 @@ var SysmonWidget = class {
26642
26574
  );
26643
26575
  colors;
26644
26576
  provider;
26645
- _lineOverride;
26646
26577
  styleFn = sysmonStyles.balanced;
26647
- cache;
26648
- cacheTtlMs = 1e3;
26649
- // 1 second cache
26650
26578
  enabled = true;
26579
+ _lineOverride;
26651
26580
  constructor(colors2, provider) {
26652
26581
  this.colors = colors2 ?? DEFAULT_THEME;
26653
26582
  this.provider = provider ?? null;
26654
- this.cache = new MetricsCache(this.cacheTtlMs);
26655
26583
  }
26656
26584
  async initialize(context) {
26657
26585
  this.enabled = context.config?.enabled !== false;
@@ -26660,7 +26588,7 @@ var SysmonWidget = class {
26660
26588
  if (!this.provider || !this.isEnabled()) {
26661
26589
  return null;
26662
26590
  }
26663
- const metrics = await this.cache.get(() => this.provider.getMetrics());
26591
+ const metrics = await this.provider.getMetrics();
26664
26592
  if (!metrics) {
26665
26593
  return null;
26666
26594
  }
@@ -26671,10 +26599,7 @@ var SysmonWidget = class {
26671
26599
  isEnabled() {
26672
26600
  return this.enabled && this.provider !== null;
26673
26601
  }
26674
- async cleanup() {
26675
- this.cache.clear();
26676
- }
26677
- setStyle(style = "balanced") {
26602
+ setStyle(style = DEFAULT_WIDGET_STYLE) {
26678
26603
  const fn = sysmonStyles[style];
26679
26604
  if (fn) {
26680
26605
  this.styleFn = fn;
@@ -26684,7 +26609,7 @@ var SysmonWidget = class {
26684
26609
  this._lineOverride = line;
26685
26610
  }
26686
26611
  getLine() {
26687
- return this._lineOverride ?? this.metadata.line ?? 2;
26612
+ return this._lineOverride ?? this.metadata.line ?? 0;
26688
26613
  }
26689
26614
  };
26690
26615
 
@@ -26798,6 +26723,52 @@ async function loadSystemInformation() {
26798
26723
  }
26799
26724
  }
26800
26725
  }
26726
+ var NETWORK_STATS_FILE = "/tmp/claude-scope-network-stats.json";
26727
+ async function loadNetworkStats() {
26728
+ try {
26729
+ const fs2 = await import("node:fs/promises");
26730
+ const text = await fs2.readFile(NETWORK_STATS_FILE, "utf-8");
26731
+ const data = JSON.parse(text);
26732
+ if (Date.now() - data.lastUpdate > 5 * 60 * 1e3) {
26733
+ return /* @__PURE__ */ new Map();
26734
+ }
26735
+ return new Map(
26736
+ Object.entries(data.stats).map(([key, value]) => [
26737
+ key,
26738
+ { rx: value.rx, tx: value.tx, time: value.time }
26739
+ ])
26740
+ );
26741
+ } catch {
26742
+ return /* @__PURE__ */ new Map();
26743
+ }
26744
+ }
26745
+ var pendingSave = null;
26746
+ var pendingSaveData = null;
26747
+ async function saveNetworkStats(stats) {
26748
+ pendingSaveData = stats;
26749
+ if (pendingSave) {
26750
+ return;
26751
+ }
26752
+ pendingSave = (async () => {
26753
+ await new Promise((resolve) => setImmediate(resolve));
26754
+ if (!pendingSaveData) {
26755
+ pendingSave = null;
26756
+ return;
26757
+ }
26758
+ try {
26759
+ const fs2 = await import("node:fs/promises");
26760
+ const data = {
26761
+ stats: Object.fromEntries(pendingSaveData),
26762
+ lastUpdate: Date.now()
26763
+ };
26764
+ await fs2.writeFile(NETWORK_STATS_FILE, JSON.stringify(data), "utf-8");
26765
+ } catch {
26766
+ } finally {
26767
+ pendingSave = null;
26768
+ pendingSaveData = null;
26769
+ }
26770
+ })();
26771
+ }
26801
26772
  var SystemProvider = class {
26802
26773
  intervalId;
26803
26774
  lastNetworkStats = /* @__PURE__ */ new Map();
@@ -26805,11 +26776,16 @@ var SystemProvider = class {
26805
26776
  ERROR_LOG_INTERVAL = 6e4;
26806
26777
  // 1 minute
26807
26778
  initialized = false;
26779
+ networkStatsLoaded = false;
26808
26780
  async ensureInitialized() {
26809
26781
  if (!this.initialized) {
26810
26782
  await loadSystemInformation();
26811
26783
  this.initialized = true;
26812
26784
  }
26785
+ if (!this.networkStatsLoaded) {
26786
+ this.lastNetworkStats = await loadNetworkStats();
26787
+ this.networkStatsLoaded = true;
26788
+ }
26813
26789
  }
26814
26790
  async getMetrics() {
26815
26791
  await this.ensureInitialized();
@@ -26823,7 +26799,9 @@ var SystemProvider = class {
26823
26799
  si.fsSize(),
26824
26800
  si.networkStats()
26825
26801
  ]);
26826
- const cpuPercent = Math.round(cpuLoad.currentLoad ?? 0);
26802
+ const cpuPercent = Math.round(
26803
+ cpuLoad.cpus && cpuLoad.cpus.length > 0 ? Math.max(...cpuLoad.cpus.map((cpu) => cpu.load)) : cpuLoad.currentLoad ?? 0
26804
+ );
26827
26805
  const memUsedGB = mem.active / 1024 / 1024 / 1024;
26828
26806
  const memTotalGB = mem.total / 1024 / 1024 / 1024;
26829
26807
  const memPercent = Math.round(mem.active / mem.total * 100);
@@ -26832,7 +26810,7 @@ var SystemProvider = class {
26832
26810
  const diskTotalGB = mainFs.size / 1024 / 1024 / 1024;
26833
26811
  const diskPercent = Math.round(mainFs.use);
26834
26812
  const iface = Array.isArray(net) && net.length > 0 ? net[0] : net;
26835
- const networkSpeed = this.calculateNetworkSpeed(iface);
26813
+ const networkSpeed = await this.calculateNetworkSpeed(iface);
26836
26814
  return {
26837
26815
  cpu: { percent: cpuPercent },
26838
26816
  memory: {
@@ -26872,22 +26850,33 @@ var SystemProvider = class {
26872
26850
  this.intervalId = void 0;
26873
26851
  }
26874
26852
  }
26875
- calculateNetworkSpeed(iface) {
26853
+ async calculateNetworkSpeed(iface) {
26876
26854
  if (!iface || iface.iface === void 0) {
26877
26855
  return { rxSec: 0, txSec: 0 };
26878
26856
  }
26879
26857
  const ifaceKey = iface.iface;
26880
26858
  const last = this.lastNetworkStats.get(ifaceKey);
26859
+ const now = Date.now();
26881
26860
  if (!last) {
26882
- this.lastNetworkStats.set(ifaceKey, { rx: iface.rx_bytes, tx: iface.tx_bytes });
26861
+ this.lastNetworkStats.set(ifaceKey, {
26862
+ rx: iface.rx_bytes,
26863
+ tx: iface.tx_bytes,
26864
+ time: now
26865
+ });
26866
+ saveNetworkStats(this.lastNetworkStats);
26883
26867
  return { rxSec: 0, txSec: 0 };
26884
26868
  }
26885
- const timeDiff = 2;
26869
+ const timeDiff = Math.max(0.1, (now - last.time) / 1e3);
26886
26870
  const rxDiff = iface.rx_bytes - last.rx;
26887
26871
  const txDiff = iface.tx_bytes - last.tx;
26888
26872
  const rx_sec = rxDiff / timeDiff / 1024 / 1024;
26889
26873
  const tx_sec = txDiff / timeDiff / 1024 / 1024;
26890
- this.lastNetworkStats.set(ifaceKey, { rx: iface.rx_bytes, tx: iface.tx_bytes });
26874
+ this.lastNetworkStats.set(ifaceKey, {
26875
+ rx: iface.rx_bytes,
26876
+ tx: iface.tx_bytes,
26877
+ time: now
26878
+ });
26879
+ saveNetworkStats(this.lastNetworkStats);
26891
26880
  return {
26892
26881
  rxSec: Math.max(0, Number(rx_sec.toFixed(2))),
26893
26882
  txSec: Math.max(0, Number(tx_sec.toFixed(2)))
@@ -26934,19 +26923,12 @@ var EmptyLineWidget = class extends StdinDataWidget {
26934
26923
  5
26935
26924
  // Sixth line (0-indexed)
26936
26925
  );
26937
- _lineOverride;
26938
26926
  /**
26939
26927
  * All styles return the same value (Braille Pattern Blank).
26940
26928
  * This method exists for API consistency with other widgets.
26941
26929
  */
26942
26930
  setStyle(_style) {
26943
26931
  }
26944
- setLine(line) {
26945
- this._lineOverride = line;
26946
- }
26947
- getLine() {
26948
- return this._lineOverride ?? this.metadata.line ?? 0;
26949
- }
26950
26932
  /**
26951
26933
  * Return Braille Pattern Blank to create a visible empty separator line.
26952
26934
  * U+2800 occupies cell width but appears blank, ensuring the line renders.
@@ -27192,7 +27174,6 @@ function getStraightFlushHighCard(cards, suit) {
27192
27174
  return getStraightHighCard(suitCards);
27193
27175
  }
27194
27176
  function getStraightFlushIndices(cards, highCard, suit) {
27195
- const _suitCards = cards.filter((c) => c.suit === suit);
27196
27177
  const suitCardIndices = [];
27197
27178
  const indexMap = /* @__PURE__ */ new Map();
27198
27179
  for (let i = 0; i < cards.length; i++) {
@@ -27404,7 +27385,6 @@ function evaluateHand(hole, board) {
27404
27385
 
27405
27386
  // src/widgets/poker/styles.ts
27406
27387
  init_colors();
27407
- init_formatters();
27408
27388
  var HAND_ABBREVIATIONS = {
27409
27389
  "Royal Flush": "RF",
27410
27390
  "Straight Flush": "SF",
@@ -27463,7 +27443,7 @@ function formatHandResult(handResult, colors2) {
27463
27443
  const playerParticipates = handResult.participatingIndices.some((idx) => idx < 2);
27464
27444
  const resultText = !playerParticipates ? `Nothing \u{1F0CF}` : `${handResult.name}! ${handResult.emoji}`;
27465
27445
  if (!colors2) return resultText;
27466
- return colorize2(resultText, colors2.result);
27446
+ return colorize(resultText, colors2.result);
27467
27447
  }
27468
27448
  function getHandAbbreviation(handResult) {
27469
27449
  if (!handResult) {
@@ -27478,8 +27458,8 @@ function balancedStyle2(data, colors2) {
27478
27458
  const handStr = holeCards.map((hc, idx) => formatCardByParticipation(hc, participatingSet.has(idx))).join("");
27479
27459
  const boardStr = boardCards.map((bc, idx) => formatCardByParticipation(bc, participatingSet.has(idx + 2))).join("");
27480
27460
  const labelColor = colors2?.participating ?? lightGray;
27481
- const handLabel = colorize2("Hand:", labelColor);
27482
- const boardLabel = colorize2("Board:", labelColor);
27461
+ const handLabel = colorize("Hand:", labelColor);
27462
+ const boardLabel = colorize("Board:", labelColor);
27483
27463
  return `${handLabel} ${handStr}| ${boardLabel} ${boardStr}\u2192 ${formatHandResult(handResult, colors2)}`;
27484
27464
  }
27485
27465
  var pokerStyles = {
@@ -27494,7 +27474,7 @@ var pokerStyles = {
27494
27474
  const abbreviation = getHandAbbreviation(handResult);
27495
27475
  const result2 = `${handStr}| ${boardStr}\u2192 ${abbreviation}`;
27496
27476
  if (!colors2) return result2;
27497
- return colorize2(result2, colors2.result);
27477
+ return colorize(result2, colors2.result);
27498
27478
  },
27499
27479
  emoji: (data, colors2) => {
27500
27480
  const { holeCards, boardCards, handResult } = data;
@@ -27502,8 +27482,8 @@ var pokerStyles = {
27502
27482
  const handStr = holeCards.map((hc, idx) => formatCardEmojiByParticipation(hc, participatingSet.has(idx))).join("");
27503
27483
  const boardStr = boardCards.map((bc, idx) => formatCardEmojiByParticipation(bc, participatingSet.has(idx + 2))).join("");
27504
27484
  const labelColor = colors2?.participating ?? lightGray;
27505
- const handLabel = colorize2("Hand:", labelColor);
27506
- const boardLabel = colorize2("Board:", labelColor);
27485
+ const handLabel = colorize("Hand:", labelColor);
27486
+ const boardLabel = colorize("Board:", labelColor);
27507
27487
  return `${handLabel} ${handStr}| ${boardLabel} ${boardStr}\u2192 ${formatHandResult(handResult, colors2)}`;
27508
27488
  }
27509
27489
  };
@@ -27526,7 +27506,6 @@ var PokerWidget = class extends StdinDataWidget {
27526
27506
  THROTTLE_MS = 5e3;
27527
27507
  // 5 seconds
27528
27508
  colors;
27529
- _lineOverride;
27530
27509
  styleFn = pokerStyles.balanced;
27531
27510
  setStyle(style = DEFAULT_WIDGET_STYLE) {
27532
27511
  const fn = pokerStyles[style];
@@ -27534,12 +27513,6 @@ var PokerWidget = class extends StdinDataWidget {
27534
27513
  this.styleFn = fn;
27535
27514
  }
27536
27515
  }
27537
- setLine(line) {
27538
- this._lineOverride = line;
27539
- }
27540
- getLine() {
27541
- return this._lineOverride ?? this.metadata.line ?? 0;
27542
- }
27543
27516
  constructor(colors2) {
27544
27517
  super();
27545
27518
  this.colors = colors2 ?? DEFAULT_THEME;
@@ -27583,7 +27556,6 @@ var PokerWidget = class extends StdinDataWidget {
27583
27556
  * Format card with appropriate color (red for ♥♦, gray for ♠♣)
27584
27557
  */
27585
27558
  formatCardColor(card) {
27586
- const _color = isRedSuit(card.suit) ? "red" : "gray";
27587
27559
  return formatCard(card);
27588
27560
  }
27589
27561
  renderWithData(_data, _context) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-scope",
3
- "version": "0.8.42",
3
+ "version": "0.8.45",
4
4
  "description": "Claude Code plugin for session status and analytics",
5
5
  "license": "MIT",
6
6
  "type": "module",