Luxe 0.1.3: your sessions on your phone, joinable sessions, and nested AGENTS.md

- luxe remote puts the sessions on your computer in reach of your own phone or tablet over
  Tailscale: write, steer, answer prompts, send photos, browse files, diffs and GitHub, with a
  paired device and your own Tailscale login.
- luxe join lets another program on the same machine join a running session over the RPC protocol.
- An AGENTS.md in a subfolder reaches the model the first time it works there.
- Long sessions stay fast: no stall before each model call, lighter memory, cheaper drawing.
- A session is open in one Luxe at a time, web_search shares results across its phrasings, and a
  grep glob starting with ! excludes.

The CHANGELOG has the full list.
This commit is contained in:
Evan Whittaker
2026-10-20 02:40:13 -05:00
parent 99e30d6d0f
commit d2129a886f
423 changed files with 31666 additions and 1669 deletions

View File

@@ -0,0 +1,47 @@
//! Glyph codepoints — every character the TUI's glyph table can draw, one `U+XXXX` per line.
//!
//! `scripts/remote-fonts.sh` reads this to subset the phone app's font, so a glyph added to the
//! table reaches the app without a capture having to show it first. Every tier is listed: which
//! one a reader sees depends on their terminal, and the app draws the same glyphs.
//!
//! Run with `cargo run -q -p luxe-tui --example glyph_codepoints`.
use luxe_tui::glyphs::{GlyphTier, Icon, Mark, EVERY_ICON, EVERY_MARK};
use std::collections::BTreeSet;
const TIERS: [GlyphTier; 4] =
[GlyphTier::Nerd, GlyphTier::NerdWide, GlyphTier::Unicode, GlyphTier::Ascii];
fn main() {
for codepoint in codepoints() {
println!("U+{codepoint:04X}");
}
}
/// Every codepoint past ASCII that any icon or mark is drawn with, at any tier, in order.
fn codepoints() -> BTreeSet<u32> {
let icons = EVERY_ICON.iter().flat_map(|icon: &Icon| TIERS.map(|tier| icon.at(tier)));
let marks = EVERY_MARK.iter().flat_map(|mark: &Mark| TIERS.map(|tier| mark.at(tier)));
icons.chain(marks).flat_map(str::chars).map(u32::from).filter(|&c| c > 0x7e).collect()
}
#[cfg(test)]
mod tests {
use super::*;
/// A glyph from each tier is listed, not just the default one.
///
/// The break this catches: listing only the Nerd tier, so a phone whose session draws the
/// Unicode tier gets those shapes from a fallback font, in a different width.
#[test]
fn every_tier_is_listed() {
let listed = codepoints();
for tier in [GlyphTier::Nerd, GlyphTier::Unicode] {
let glyphs = EVERY_ICON.iter().map(|icon| icon.at(tier)).flat_map(str::chars);
let missing: Vec<char> = glyphs
.filter(|&c| u32::from(c) > 0x7e && !listed.contains(&u32::from(c)))
.collect();
assert!(missing.is_empty(), "{tier:?} glyphs missing: {missing:?}");
}
}
}

View File

@@ -19,6 +19,7 @@
//! cargo run -p luxe-tui --example theme_css -- --json > web/src/assets/generated/themes.json
//! ```
use luxe_core::theme::css::{css_name, custom_properties};
use luxe_core::theme::{ColorValue, ThemeRegistry};
use luxe_tui::widgets::Wordmark;
use std::collections::HashMap;
@@ -73,7 +74,7 @@ fn catalog(registry: &ThemeRegistry) -> String {
for token in EXPORTED {
if let Some(hex) = hex(theme.get(*token)) {
let separator = if first { "" } else { "," };
let _ = write!(out, "{separator}\n \"{}\": \"{hex}\"", kebab(token));
let _ = write!(out, "{separator}\n \"{}\": \"{hex}\"", css_name(token));
first = false;
}
}
@@ -109,12 +110,7 @@ fn stylesheet(dark: &HashMap<String, ColorValue>) -> String {
/// One theme's custom properties, wordmark ramp included.
fn block(theme: &HashMap<String, ColorValue>, dark: bool) -> String {
let mut out = String::new();
for token in EXPORTED {
if let Some(hex) = hex(theme.get(*token)) {
let _ = writeln!(out, " --luxe-{}: {hex};", kebab(token));
}
}
let mut out = custom_properties(theme, EXPORTED.iter().copied());
// The wordmark's steps, taken from the renderer rather than a table copied out of it — a second
// copy of a rule is a rule that drifts. A still is the frame at `STILL_TICK`, which is exactly
@@ -157,22 +153,6 @@ fn blend(base: (u8, u8, u8), target: (u8, u8, u8), amount: f32) -> (u8, u8, u8)
(mix(base.0, target.0), mix(base.1, target.1), mix(base.2, target.2))
}
/// `accentSecondary` reads as `--luxe-accent-secondary` on the web side.
fn kebab(token: &str) -> String {
let mut out = String::new();
for (index, character) in token.char_indices() {
if character.is_ascii_uppercase() {
if index > 0 {
out.push('-');
}
out.push(character.to_ascii_lowercase());
} else {
out.push(character);
}
}
out
}
fn rgb(value: Option<&ColorValue>) -> Option<(u8, u8, u8)> {
match value? {
ColorValue::Rgb(red, green, blue) => Some((*red, *green, *blue)),
@@ -181,7 +161,7 @@ fn rgb(value: Option<&ColorValue>) -> Option<(u8, u8, u8)> {
}
fn hex(value: Option<&ColorValue>) -> Option<String> {
rgb(value).map(to_hex)
value.and_then(luxe_core::theme::css::hex)
}
fn to_hex((red, green, blue): (u8, u8, u8)) -> String {
@@ -243,14 +223,6 @@ mod tests {
);
}
/// Token names arrive in the shape a stylesheet expects.
#[test]
fn token_names_become_kebab_case() {
assert_eq!(kebab("accentSecondary"), "accent-secondary");
assert_eq!(kebab("background"), "background");
assert_eq!(kebab("borderMuted"), "border-muted");
}
/// The document has the one theme and says it is generated, so nobody edits it by hand.
#[test]
fn the_stylesheet_carries_its_theme_and_its_own_warning() {

View File

@@ -31,9 +31,10 @@ fn main() {
match target.as_str() {
"wordmark" => print!("{}", svg(rows, 0..Wordmark::Full.group_count())),
"mark" => print!("{}", svg(rows, 0..1)),
"app" => print!("{}", app_svg(rows)),
"tile" => print!("{}", tile(rows, tile_colors())),
other => {
eprintln!("usage: wordmark_svg [wordmark|mark|tile] (got {other:?})");
eprintln!("usage: wordmark_svg [wordmark|mark|app|tile] (got {other:?})");
std::process::exit(2);
}
}
@@ -72,11 +73,14 @@ fn tile(rows: &[&str], (plate_color, ink): (String, String)) -> String {
let side = TILE;
let plate = format!("M0 0H{side}V{side}H0z");
// Fit the L by height, then center it: it is the taller axis, so height sets the scale.
let letter_w = ink_right(rows, 0..1) * CELL_W;
// Fit the L by height, then center its ink: it is the taller axis, so height sets the scale.
// The letter's first column is blank, so the ink, not the column span, is what gets centered.
let ink_left = first_inked_column(rows, 0) * CELL_W;
let letter_w = ink_right(rows, 0..1) * CELL_W - ink_left;
let letter_h = rows.len() as u32 * CELL_H;
let scale = f64::from(side - TILE_PAD * 2) / f64::from(letter_h);
let offset_x = (f64::from(side) - f64::from(letter_w) * scale) / 2.0;
let offset_x =
(f64::from(side) - f64::from(letter_w) * scale) / 2.0 - f64::from(ink_left) * scale;
format!(
"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 {side} {side}\" \
@@ -120,6 +124,15 @@ fn svg(rows: &[&str], letters: std::ops::Range<usize>) -> String {
out
}
/// The phone app's copy: the wordmark, plus how deep the drift swings.
///
/// The app's colors come from core's theme CSS, and the depth is the terminal's, so the file is
/// the one way it reaches the app without a second copy of the number.
fn app_svg(rows: &[&str]) -> String {
let depth = format!(" data-drift-depth=\"{}\" role=", luxe_tui::widgets::DRIFT_DEPTH);
svg(rows, 0..Wordmark::Full.group_count()).replacen(" role=", &depth, 1)
}
/// The first column of ink group `group`.
fn first_column(group: usize) -> u32 {
let groups = Wordmark::Full.groups();
@@ -134,6 +147,20 @@ fn group_span(group: usize) -> std::ops::Range<usize> {
first..last + 1
}
/// The leftmost inked column of ink group `group`.
fn first_inked_column(rows: &[&str], group: usize) -> u32 {
let span = group_span(group);
rows.iter()
.flat_map(|row| {
row.chars()
.enumerate()
.filter(|(column, glyph)| *glyph != ' ' && span.contains(column))
.map(|(column, _)| column as u32)
})
.min()
.unwrap_or(0)
}
/// One column past the rightmost inked cell in `letters`.
fn ink_right(rows: &[&str], letters: std::ops::Range<usize>) -> u32 {
let span = group_span(letters.start).start..group_span(letters.end - 1).end;
@@ -270,6 +297,21 @@ mod tests {
assert!(svg.contains("data-cell=\"10 22\""), "the grid the highlight is drawn in");
}
/// The app's copy is the wordmark with the drift's depth on its root.
///
/// The break this catches: the attribute left off, or put somewhere other than the `<svg>` tag,
/// which leaves the app swinging by a guess.
#[test]
fn the_app_copy_carries_the_drift_depth() {
let rows = Wordmark::Full.rows();
let app = app_svg(rows);
let root = app.lines().next().expect("a root tag");
let depth = luxe_tui::widgets::DRIFT_DEPTH;
assert!(root.contains(&format!("data-drift-depth=\"{depth}\"")), "{root}");
let paths = |doc: &str| doc.lines().skip(1).collect::<Vec<_>>().join("\n");
assert_eq!(paths(&app), paths(&svg(rows, 0..Wordmark::Full.group_count())));
}
/// The tile is a plain square and keeps the letter inside its own padding, which is what decides
/// whether it survives a 16px tab strip.
#[test]
@@ -308,6 +350,24 @@ mod tests {
);
}
/// The break this catches: the blank column the L's group starts with counted as part of the
/// letter, which sets the ink half a column right of center.
#[test]
fn the_tile_centers_the_ink() {
let rows = Wordmark::Full.rows();
let svg = tile(rows, tile_colors());
let offset: f64 = svg
.split("translate(")
.nth(1)
.and_then(|rest| rest.split(' ').next())
.and_then(|raw| raw.parse().ok())
.expect("an offset");
let scale = f64::from(TILE - TILE_PAD * 2) / f64::from(rows.len() as u32 * CELL_H);
let left = offset + f64::from(first_inked_column(rows, 0) * CELL_W) * scale;
let right = f64::from(TILE) - (offset + f64::from(ink_right(rows, 0..1) * CELL_W) * scale);
assert!((left - right).abs() < 0.1, "margins {left} and {right}");
}
/// The single-letter mark crops to its own ink instead of carrying three empty letters of
/// padding.
#[test]