3 Commits

Author SHA1 Message Date
7f15a1a19f chore: bump to 0.1.7 and document the USAGE dock section
Bump the workspace to 0.1.7 with its path-dependency pins and lockfile,
open the 0.1.7 changelog section, and describe the USAGE section in the
interface and providers guide pages. Rebundle the guide for `luxe docs`.

Assisted-by: luxe:claude-sonnet-5.5
2026-10-25 00:34:51 -04:00
408d48783a feat(tui): add USAGE dock section with plan meter and reset countdown
Show each subscription plan window as a bar, percentage and time until
reset, between the MODEL and SESSION blocks. Hidden when the provider
reports no plan usage (API-key providers).

Adds PlanWindow::bar and Section::Usage.

Assisted-by: luxe:claude-sonnet-5.5
2026-10-25 00:34:51 -04:00
Evan Whittaker
44a62bcdd6 Merge pull request #20 from evanwhittaker/sync-0.1.6-clipboard
clipboard-win 5.4.3, browser tests off Ubuntu's mirror, checks -R, and a mode-colored activity bar
2026-10-24 19:35:01 -05:00
20 changed files with 167 additions and 30 deletions

View File

@@ -9,6 +9,14 @@ The version on `main` is always the next release. The first change to what ships
`Cargo.toml`, `Cargo.lock`) after a release bumps it one step and opens its section here, and later
changes add to that section until it ships; `scripts/version-check.py` holds them to it.
## [0.1.7]
### Added
- The dock has a **USAGE** section between MODEL and SESSION while a ChatGPT or Copilot plan reports
what is left of it. Each window the plan has gets a row with a bar, the share used and, when the
provider says, the time until it resets, such as `weekly ▓▓▓░░░░░░░ 30% · 3d 4h`.
## [0.1.6]
### Added

18
Cargo.lock generated
View File

@@ -1690,7 +1690,7 @@ checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154"
[[package]]
name = "luxe-cli"
version = "0.1.6"
version = "0.1.7"
dependencies = [
"anyhow",
"async-trait",
@@ -1723,7 +1723,7 @@ dependencies = [
[[package]]
name = "luxe-core"
version = "0.1.6"
version = "0.1.7"
dependencies = [
"async-trait",
"base16ct",
@@ -1754,7 +1754,7 @@ dependencies = [
[[package]]
name = "luxe-dap"
version = "0.1.6"
version = "0.1.7"
dependencies = [
"async-trait",
"luxe-core",
@@ -1768,7 +1768,7 @@ dependencies = [
[[package]]
name = "luxe-lsp"
version = "0.1.6"
version = "0.1.7"
dependencies = [
"async-trait",
"base16ct",
@@ -1792,7 +1792,7 @@ dependencies = [
[[package]]
name = "luxe-mcp"
version = "0.1.6"
version = "0.1.7"
dependencies = [
"async-trait",
"futures-util",
@@ -1812,7 +1812,7 @@ dependencies = [
[[package]]
name = "luxe-providers"
version = "0.1.6"
version = "0.1.7"
dependencies = [
"async-trait",
"base64",
@@ -1831,7 +1831,7 @@ dependencies = [
[[package]]
name = "luxe-remote"
version = "0.1.6"
version = "0.1.7"
dependencies = [
"axum",
"base16ct",
@@ -1854,7 +1854,7 @@ dependencies = [
[[package]]
name = "luxe-tools"
version = "0.1.6"
version = "0.1.7"
dependencies = [
"anyhow",
"async-trait",
@@ -1880,7 +1880,7 @@ dependencies = [
[[package]]
name = "luxe-tui"
version = "0.1.6"
version = "0.1.7"
dependencies = [
"anyhow",
"arboard",

View File

@@ -6,7 +6,7 @@ members = ["crates/*"]
# Every crate here releases together from one workspace, so the versions move in lockstep and each
# crate inherits this one. The internal `path` dependencies carry the same number explicitly — cargo
# uses the path locally and the version on crates.io, and refuses to publish a path dep without one.
version = "0.1.6"
version = "0.1.7"
edition = "2021"
license = "MIT OR Apache-2.0"
repository = "https://github.com/evanwhittaker/luxe"

View File

@@ -18,14 +18,14 @@ name = "luxe"
path = "src/main.rs"
[dependencies]
luxe-core = { path = "../luxe-core", version = "0.1.6" }
luxe-providers = { path = "../luxe-providers", version = "0.1.6" }
luxe-tools = { path = "../luxe-tools", version = "0.1.6" }
luxe-lsp = { path = "../luxe-lsp", version = "0.1.6" }
luxe-dap = { path = "../luxe-dap", version = "0.1.6" }
luxe-mcp = { path = "../luxe-mcp", version = "0.1.6" }
luxe-tui = { path = "../luxe-tui", version = "0.1.6" }
luxe-remote = { path = "../luxe-remote", version = "0.1.6", optional = true }
luxe-core = { path = "../luxe-core", version = "0.1.7" }
luxe-providers = { path = "../luxe-providers", version = "0.1.7" }
luxe-tools = { path = "../luxe-tools", version = "0.1.7" }
luxe-lsp = { path = "../luxe-lsp", version = "0.1.7" }
luxe-dap = { path = "../luxe-dap", version = "0.1.7" }
luxe-mcp = { path = "../luxe-mcp", version = "0.1.7" }
luxe-tui = { path = "../luxe-tui", version = "0.1.7" }
luxe-remote = { path = "../luxe-remote", version = "0.1.7", optional = true }
# The pairing QR in the terminal. Without its defaults it is the encoder and text renderer alone,
# with no dependencies.
qrcode = { version = "0.14", default-features = false, optional = true }

View File

@@ -2493,6 +2493,7 @@ conversation, or in its place below 80 columns.
| **FILES** | The project as a tree, with what changed marked in it. Click a file to [preview](#preview) it. |
| **ELSEWHERE** | Files the session changed outside the project, when there are any |
| **MODEL** | The provider, model, thinking level and [mode](agent.md#plan-then-build). Click the provider or the model to change it, or the mode to switch it. |
| **USAGE** | What is left of a ChatGPT or Copilot plan, one row for each window the plan has: a bar, the share used and, when the provider says, the time until it resets. It shows only once the plan has reported, after your first reply, and never on an API key. |
| **SESSION** | Context used, tokens and cost, with what a review and compaction cost on rows of their own. A review's row shows its full cost once its guide or drafted summary is done. While a phone or another client has [joined](remote.md), a **joined** row names it. |
`alt+d` shows or hides the dock, and `/dock left` or `/dock right` moves it. To set it for good:
@@ -3337,7 +3338,8 @@ Usage on a ChatGPT or Copilot subscription is counted in full but never added to
`plan ≈$0.42 of usage over 12 calls, covered by your subscription`. On a
ChatGPT plan, the statusline shows how much of the plan is used, such as `12% weekly`, and `/cost`
shows when it resets. On a Copilot plan it shows the month's allowance the same way, such as `19%
monthly`.
monthly`. The dock's [USAGE section](interface.md#the-dock) shows the same windows as a bar, with the
time until each resets when the provider says.
luxe prices Copilot usage at Copilot's per-token rates, so the figure matches what Copilot reports
for each request. A Copilot plan billed by the token spends its monthly allowance at those rates.

View File

@@ -48,6 +48,16 @@ impl PlanWindow {
};
Some(label)
}
/// A fixed-width meter such as `▓▓▓░░░░░░░`, filled in proportion to the share used.
///
/// Rounds to the nearest cell so a nearly-full window never reads as empty, and clamps so a
/// provider reporting over 100% can't draw past the edge.
pub fn bar(&self, cells: usize) -> String {
let share = (self.used_percent / 100.0).clamp(0.0, 1.0);
let filled = ((share * cells as f32).round() as usize).min(cells);
format!("{}{}", "▓".repeat(filled), "░".repeat(cells - filled))
}
}
/// A subscription's remaining headroom, as reported alongside a response.
@@ -146,6 +156,18 @@ mod plan_tests {
assert!(window(0.0, 60, None).reset_label().is_none());
}
#[test]
fn a_bar_fills_in_proportion_and_never_overflows() {
assert_eq!(window(0.0, 60, None).bar(10), "░░░░░░░░░░");
assert_eq!(window(50.0, 60, None).bar(10), "▓▓▓▓▓░░░░░");
assert_eq!(window(100.0, 60, None).bar(10), "▓▓▓▓▓▓▓▓▓▓");
// over-reported and negative values clamp instead of panicking on the subtraction
assert_eq!(window(250.0, 60, None).bar(4), "▓▓▓▓");
assert_eq!(window(-5.0, 60, None).bar(4), "░░░░");
// a window that is nearly spent must not round down to an empty-looking bar
assert_eq!(window(96.0, 60, None).bar(10), "▓▓▓▓▓▓▓▓▓▓");
}
/// The status line has room for one window, and it should be whichever is about to bite.
#[test]
fn the_tightest_window_wins_the_status_line() {

View File

@@ -11,7 +11,7 @@ homepage.workspace = true
# Provides a native Debug Adapter Protocol client + the `debug` tool.
[dependencies]
luxe-core = { path = "../luxe-core", version = "0.1.6" }
luxe-core = { path = "../luxe-core", version = "0.1.7" }
thiserror = { workspace = true }
tracing = { workspace = true }
serde = { workspace = true }

View File

@@ -11,7 +11,7 @@ homepage.workspace = true
# Provides a generic LSP client (rust-analyzer first).
[dependencies]
luxe-core = { path = "../luxe-core", version = "0.1.6" }
luxe-core = { path = "../luxe-core", version = "0.1.7" }
thiserror = { workspace = true }
tracing = { workspace = true }
serde = { workspace = true }

View File

@@ -13,7 +13,7 @@ homepage.workspace = true
# no-HTTP rule forbids in core itself. The low-level stdio transport stays in luxe-core.
[dependencies]
luxe-core = { path = "../luxe-core", version = "0.1.6" }
luxe-core = { path = "../luxe-core", version = "0.1.7" }
thiserror = { workspace = true }
tracing = { workspace = true }
serde = { workspace = true }

View File

@@ -11,7 +11,7 @@ homepage.workspace = true
# Provides LLM provider adapters (OpenAI-compat, Anthropic, Gemini).
[dependencies]
luxe-core = { path = "../luxe-core", version = "0.1.6" }
luxe-core = { path = "../luxe-core", version = "0.1.7" }
thiserror = { workspace = true }
tracing = { workspace = true }
serde = { workspace = true }

View File

@@ -18,7 +18,7 @@ exclude = ["app-tests/"]
# reqwest and the workspace's rustls.
[dependencies]
luxe-core = { path = "../luxe-core", version = "0.1.6" }
luxe-core = { path = "../luxe-core", version = "0.1.7" }
thiserror = { workspace = true }
tracing = { workspace = true }
serde = { workspace = true }

View File

@@ -11,7 +11,7 @@ homepage.workspace = true
# Provides tool implementations (read, write, edit, bash, grep, glob, etc.).
[dependencies]
luxe-core = { path = "../luxe-core", version = "0.1.6" }
luxe-core = { path = "../luxe-core", version = "0.1.7" }
thiserror = { workspace = true }
tracing = { workspace = true }
serde = { workspace = true }

View File

@@ -8,7 +8,7 @@ repository.workspace = true
homepage.workspace = true
[dependencies]
luxe-core = { path = "../luxe-core", version = "0.1.6" }
luxe-core = { path = "../luxe-core", version = "0.1.7" }
# `unstable-rendered-line-info` enables Paragraph::line_count, used for precise wrapping-aware
# mouse hit-testing over word-wrapped surfaces (guide/dock/conversation clicks). It adds no crate;
# the API is marked unstable upstream but is stable within our pinned minor (re-check on upgrade).

View File

@@ -10,6 +10,7 @@ mod files;
mod plan;
mod telemetry;
mod tree;
mod usage;
use crate::app::App;
use crate::workspace_dock::{DockPresentation, DockSectionModel};

View File

@@ -65,6 +65,7 @@ pub(super) enum Section {
Files,
Elsewhere,
Model,
Usage,
Session,
}
@@ -77,6 +78,7 @@ impl Section {
Self::Files => "FILES",
Self::Elsewhere => "ELSEWHERE",
Self::Model => "MODEL",
Self::Usage => "USAGE",
Self::Session => "SESSION",
}
}
@@ -94,7 +96,7 @@ impl Section {
match self {
Self::Project | Self::Model => Depth::Hero,
Self::Plan | Self::Files => Depth::Raised,
Self::Elsewhere | Self::Session => Depth::Recessed,
Self::Elsewhere | Self::Usage | Self::Session => Depth::Recessed,
}
}
}

View File

@@ -192,6 +192,7 @@ pub(super) fn telemetry_lines(app: &App) -> Vec<Line<'static>> {
let row = row_width(app);
let column = telemetry_label_width(row, WIDEST_TELEMETRY_LABEL);
let mut lines = model_telemetry(app, row, column);
lines.extend(super::usage::usage_telemetry(app, column));
lines.extend(session_telemetry(app, row, column));
lines
}
@@ -386,7 +387,7 @@ fn review_spending(app: &App) -> bool {
///
/// `ink` is body text for a measurement, dim for a share of one above it, and the severity hue for
/// the window, which is the one value that is also a warning.
fn telemetry_row(
pub(super) fn telemetry_row(
label: &str,
value: String,
ink: ratatui::style::Style,

View File

@@ -38,6 +38,42 @@ fn the_rail_reports_a_session_that_is_approving_its_own_asks() {
assert!(row.contains("auto-approve"), "{row}");
}
/// An API-key provider reports no allowance, and a USAGE heading over nothing would be noise.
#[test]
fn the_rail_has_no_usage_block_without_a_plan() {
let mut app = app();
app.status.model = "claude-sonnet-5".into();
let rendered: Vec<String> = telemetry_lines(&app).iter().map(text).collect();
assert!(!rendered.iter().any(|row| row.contains("USAGE")), "{rendered:?}");
}
/// The point of the block: the share spent and the time left, one row per window the plan has.
#[test]
fn the_rail_shows_each_plan_window_with_its_meter_and_reset() {
use luxe_core::provider::{PlanUsage, PlanWindow};
let mut app = app();
app.status.model = "gpt-5".into();
app.status.plan_usage = Some(PlanUsage {
primary: Some(PlanWindow {
used_percent: 30.0,
window_minutes: 10_080,
resets_in_secs: Some(274_000),
}),
secondary: Some(PlanWindow {
used_percent: 80.0,
window_minutes: 300,
resets_in_secs: Some(1_800),
}),
..PlanUsage::default()
});
let rendered: Vec<String> = telemetry_lines(&app).iter().map(text).collect();
assert!(rendered.iter().any(|row| row.contains("USAGE")), "{rendered:?}");
let weekly = rendered.iter().find(|row| row.starts_with("weekly")).expect("weekly row");
assert!(weekly.contains("▓▓▓░░░░░░░ 30% · 3d 4h"), "{weekly}");
let short = rendered.iter().find(|row| row.starts_with("5h")).expect("5h row");
assert!(short.contains("▓▓▓▓▓▓▓▓░░ 80% · 30m"), "{short}");
}
/// The surface behind the span carrying `needle` — the slab the badge is cut from.
pub(super) fn surface_behind(line: &Line<'_>, needle: &str) -> Color {
line.spans
@@ -65,7 +101,7 @@ fn the_rail_is_anchored_at_both_ends_and_recedes_between_them() {
for live in [Section::Plan, Section::Files] {
assert_eq!(surface(live), shades.at(Depth::Raised), "{live:?} is one step back");
}
for ambient in [Section::Elsewhere, Section::Session] {
for ambient in [Section::Elsewhere, Section::Usage, Section::Session] {
assert_eq!(surface(ambient), shades.at(Depth::Recessed), "{ambient:?} is two");
}
// Or every assertion above passes on a theme with no ramp at all.

View File

@@ -0,0 +1,63 @@
//! Dock usage — the USAGE block: how much of a subscription plan is spent, and when it resets.
use super::chrome::{section_heading_line, Section};
use super::telemetry::telemetry_row;
use crate::app::App;
use luxe_core::provider::PlanWindow;
use ratatui::text::Line;
/// Cells in the meter: ten reads in tenths, and leaves the percentage and countdown room beside it
/// on the default rail.
const BAR_CELLS: usize = 10;
/// The USAGE block, drawn only while the provider reports a plan window.
///
/// An API-key provider reports no allowance, so it gets no block at all rather than an empty one.
/// Each window gets its own row: a plan with a 5h and a weekly window is limited by whichever
/// fills first, and the reader can't steer by one they can't see.
pub(super) fn usage_telemetry(app: &App, column: usize) -> Vec<Line<'static>> {
let Some(plan) = app.status.plan_usage.as_ref() else {
return Vec::new();
};
let windows: Vec<&PlanWindow> =
[&plan.primary, &plan.secondary].into_iter().flatten().collect();
if windows.is_empty() {
return Vec::new();
}
let styles = &app.theme_styles;
let mut lines = vec![Line::default(), section_heading_line(Section::Usage, app)];
for window in windows {
let ink = styles.context_fill(window.used_percent.clamp(0.0, 100.0));
lines.push(telemetry_row(&window.window_label(), window_value(window), ink, column, app));
}
lines
}
/// `▓▓▓░░░░░░░ 32% · 3d 4h`: the meter, the share, and the time left when the provider says.
fn window_value(window: &PlanWindow) -> String {
let mut value = format!("{} {:.0}%", window.bar(BAR_CELLS), window.used_percent);
if let Some(reset) = window.reset_label() {
value.push_str(&format!(" · {reset}"));
}
value
}
#[cfg(test)]
mod tests {
use super::*;
fn window(used: f32, resets: Option<u64>) -> PlanWindow {
PlanWindow { used_percent: used, window_minutes: 10_080, resets_in_secs: resets }
}
#[test]
fn a_row_shows_meter_share_and_countdown() {
assert_eq!(window_value(&window(30.0, Some(274_000))), "▓▓▓░░░░░░░ 30% · 3d 4h");
}
/// Copilot reports no reset countdown, and the row must not invent one.
#[test]
fn a_window_without_a_reset_time_omits_the_countdown() {
assert_eq!(window_value(&window(30.0, None)), "▓▓▓░░░░░░░ 30%");
}
}

View File

@@ -145,6 +145,7 @@ conversation, or in its place below 80 columns.
| **FILES** | The project as a tree, with what changed marked in it. Click a file to [preview](#preview) it. |
| **ELSEWHERE** | Files the session changed outside the project, when there are any |
| **MODEL** | The provider, model, thinking level and [mode](agent.md#plan-then-build). Click the provider or the model to change it, or the mode to switch it. |
| **USAGE** | What is left of a ChatGPT or Copilot plan, one row for each window the plan has: a bar, the share used and, when the provider says, the time until it resets. It shows only once the plan has reported, after your first reply, and never on an API key. |
| **SESSION** | Context used, tokens and cost, with what a review and compaction cost on rows of their own. A review's row shows its full cost once its guide or drafted summary is done. While a phone or another client has [joined](remote.md), a **joined** row names it. |
`alt+d` shows or hides the dock, and `/dock left` or `/dock right` moves it. To set it for good:

View File

@@ -146,7 +146,8 @@ Usage on a ChatGPT or Copilot subscription is counted in full but never added to
`plan ≈$0.42 of usage over 12 calls, covered by your subscription`. On a
ChatGPT plan, the statusline shows how much of the plan is used, such as `12% weekly`, and `/cost`
shows when it resets. On a Copilot plan it shows the month's allowance the same way, such as `19%
monthly`.
monthly`. The dock's [USAGE section](interface.md#the-dock) shows the same windows as a bar, with the
time until each resets when the provider says.
luxe prices Copilot usage at Copilot's per-token rates, so the figure matches what Copilot reports
for each request. A Copilot plan billed by the token spends its monthly allowance at those rates.