oc-flight-deck 0.23.0 → 0.23.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.
package/CHANGELOG.md CHANGED
@@ -7,7 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ## [0.23.0] - 2026-11-14
10
+ ## [0.23.1] - 2026-11-15
11
+
12
+ ### Fixed
13
+
14
+ - The compact Go row shows reset countdowns with the same two-unit precision as the Go panel instead of rounding hours or days up to a single unit.
11
15
 
12
16
  ### Added
13
17
 
package/dist/tui/index.js CHANGED
@@ -645,10 +645,16 @@ function formatRemaining(ms) {
645
645
  const minutes = Math.ceil(ms / 60000);
646
646
  if (minutes < 60)
647
647
  return `${minutes}m`;
648
- const hours = Math.ceil(ms / 3600000);
649
- if (hours < 24)
650
- return `${hours}h`;
651
- return `${Math.ceil(ms / 86400000)}d`;
648
+ const hours = Math.floor(ms / 3600000);
649
+ if (hours < 24) {
650
+ if (hours === 0)
651
+ return `${minutes}m`;
652
+ const rest = Math.floor((ms - hours * 3600000) / 60000);
653
+ return rest > 0 ? `${hours}h${rest}m` : `${hours}h`;
654
+ }
655
+ const days = Math.floor(ms / 86400000);
656
+ const rest = Math.floor((ms - days * 86400000) / 3600000);
657
+ return rest > 0 ? `${days}d${rest}h` : `${days}d`;
652
658
  }
653
659
  function goResetSuffix(window, nowMs) {
654
660
  if (goTone(window) !== "error")
@@ -2489,7 +2495,6 @@ function railLineSpans(line, style) {
2489
2495
  function footerLine(config) {
2490
2496
  return config.footer.enabled ? config.footer.text : undefined;
2491
2497
  }
2492
-
2493
2498
  // src/tui/go-panel.ts
2494
2499
  var PANEL_WINDOWS = ["5h", "1w", "1m"];
2495
2500
  var PANEL_DEFAULT_LABELS = {
@@ -2628,24 +2633,6 @@ function windowById(usage) {
2628
2633
  }
2629
2634
  return byId;
2630
2635
  }
2631
- function formatCompactRemaining(ms) {
2632
- const totalSeconds = Math.ceil(ms / 1000);
2633
- if (totalSeconds < 60)
2634
- return `${totalSeconds}s`;
2635
- const totalMinutes = Math.ceil(ms / 60000);
2636
- if (totalMinutes < 60)
2637
- return `${totalMinutes}m`;
2638
- const totalHours = Math.floor(ms / 3600000);
2639
- if (totalHours < 24) {
2640
- if (totalHours === 0)
2641
- return `${totalMinutes}m`;
2642
- const minutes = Math.floor((ms - totalHours * 3600000) / 60000);
2643
- return minutes > 0 ? `${totalHours}h${minutes}m` : `${totalHours}h`;
2644
- }
2645
- const totalDays = Math.floor(ms / 86400000);
2646
- const hours = Math.floor((ms - totalDays * 86400000) / 3600000);
2647
- return hours > 0 ? `${totalDays}d${hours}h` : `${totalDays}d`;
2648
- }
2649
2636
  function resetCountdown(window, nowMs) {
2650
2637
  const resetAtMs = window.resetAtMs;
2651
2638
  if (resetAtMs === undefined || !Number.isFinite(resetAtMs) || !Number.isFinite(nowMs))
@@ -2653,7 +2640,7 @@ function resetCountdown(window, nowMs) {
2653
2640
  const remaining = resetAtMs - nowMs;
2654
2641
  if (remaining <= 0)
2655
2642
  return;
2656
- return formatCompactRemaining(remaining);
2643
+ return formatRemaining(remaining);
2657
2644
  }
2658
2645
  function panelTone(window) {
2659
2646
  if (goTone(window) === "error")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oc-flight-deck",
3
- "version": "0.23.0",
3
+ "version": "0.23.1",
4
4
  "description": "Live OpenCode V2 session telemetry — agent, model, branch, cost, tokens, cache hit rate and context usage in your sidebar.",
5
5
  "keywords": [
6
6
  "opencode",
@@ -26,7 +26,8 @@
26
26
  // can never overflow or wrap.
27
27
 
28
28
  import { asCount, asRecord } from "./coerce.js";
29
- import { goTone, type GoUsage, type GoWindow } from "./go-usage.js";
29
+ import { formatRemaining as formatCompactRemaining, goTone, type GoUsage, type GoWindow } from "./go-usage.js";
30
+ export { formatRemaining as formatCompactRemaining } from "./go-usage.js";
30
31
  import type { RailLine } from "./presentation.js";
31
32
  import type { StatSegment } from "./rows.js";
32
33
  import { DEFAULT_PLACEHOLDER } from "./stat-fields.js";
@@ -333,38 +334,6 @@ function windowById(usage: GoUsage | undefined): Map<GoWindow["id"], GoWindow> {
333
334
  return byId;
334
335
  }
335
336
 
336
- /**
337
- * A duration as one or two compact units: `45s`, `12m`, `2h`, `4h44m`, `1d6h`,
338
- * `30d23h`.
339
- *
340
- * Deliberately not ./go-usage.js's `formatRemaining`: that one is the one-line
341
- * `go` row's hint and stays single-unit. The panel has the columns for the
342
- * next unit down, and the next unit is what turns "4h" into something an agent
343
- * can plan against. Seconds are dropped once hours are on the clock - two
344
- * units is the whole budget - and a unit is omitted when it is zero, so an
345
- * exact `2h` reads `2h` rather than `2h0m`.
346
- *
347
- * The sub-hour branches round up (as the row's hint does), so a countdown
348
- * never understates the wait: 90s reads `2m`, not `1m30s`.
349
- */
350
- export function formatCompactRemaining(ms: number): string {
351
- const totalSeconds = Math.ceil(ms / 1_000);
352
- if (totalSeconds < 60) return `${totalSeconds}s`;
353
- const totalMinutes = Math.ceil(ms / 60_000);
354
- if (totalMinutes < 60) return `${totalMinutes}m`;
355
- const totalHours = Math.floor(ms / 3_600_000);
356
- if (totalHours < 24) {
357
- // Just under the hour: `totalMinutes` is 60 and the hours place is empty,
358
- // so name the minutes rather than print a hollow `0h59m`.
359
- if (totalHours === 0) return `${totalMinutes}m`;
360
- const minutes = Math.floor((ms - totalHours * 3_600_000) / 60_000);
361
- return minutes > 0 ? `${totalHours}h${minutes}m` : `${totalHours}h`;
362
- }
363
- const totalDays = Math.floor(ms / 86_400_000);
364
- const hours = Math.floor((ms - totalDays * 86_400_000) / 3_600_000);
365
- return hours > 0 ? `${totalDays}d${hours}h` : `${totalDays}d`;
366
- }
367
-
368
337
  /**
369
338
  * The reset countdown for one window, or `undefined` when the reset is unknown
370
339
  * or already past.
@@ -289,20 +289,27 @@ export function goTone(window: GoWindow): "error" | "normal" {
289
289
  }
290
290
 
291
291
  /**
292
- * A duration as one short unit: `45s`, `12m`, `2h`, `5d`.
292
+ * A duration as one or two compact units: `45s`, `12m`, `4h44m`, `26d20h`.
293
293
  *
294
294
  * Exported because the footer's Go panel (./go-panel.ts) draws a countdown for
295
295
  * every known future reset, while {@link goResetSuffix} draws one only under the
296
- * error tone. Both must read the same way, so both read this.
296
+ * error tone. Sub-hour waits round up; longer waits truncate smaller units,
297
+ * matching the panel's compact display.
297
298
  */
298
299
  export function formatRemaining(ms: number): string {
299
300
  const seconds = Math.ceil(ms / 1000);
300
301
  if (seconds < 60) return `${seconds}s`;
301
302
  const minutes = Math.ceil(ms / 60_000);
302
303
  if (minutes < 60) return `${minutes}m`;
303
- const hours = Math.ceil(ms / 3_600_000);
304
- if (hours < 24) return `${hours}h`;
305
- return `${Math.ceil(ms / 86_400_000)}d`;
304
+ const hours = Math.floor(ms / 3_600_000);
305
+ if (hours < 24) {
306
+ if (hours === 0) return `${minutes}m`;
307
+ const rest = Math.floor((ms - hours * 3_600_000) / 60_000);
308
+ return rest > 0 ? `${hours}h${rest}m` : `${hours}h`;
309
+ }
310
+ const days = Math.floor(ms / 86_400_000);
311
+ const rest = Math.floor((ms - days * 86_400_000) / 3_600_000);
312
+ return rest > 0 ? `${days}d${rest}h` : `${days}d`;
306
313
  }
307
314
 
308
315
  /**