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

@@ -93,8 +93,8 @@ fn card_icon<'a>(
// The tool running and the model writing the call are both work in progress, and
// the card says so the same way for each — a spinner over a card that is visibly
// filling in, and a queued mark only over one that genuinely is not moving. A
// model writes a message's calls in order and the engine runs them in order, so
// exactly one card spins at a time.
// model writes a message's calls in order and the engine runs them in order, and a
// call written while another runs arrives queued, so exactly one card spins at a time.
// Except the call that is waiting on the reader. A spinner says the agent is busy, and
// over a question it is waiting on you to answer it only adds pressure; the call's
// own glyph, in the same running color, says it is open without hurrying anyone
@@ -238,15 +238,10 @@ pub(in crate::view) const BODY_INDENT: &str = " ";
/// the corner of the eye — which is what a spinner is for, and this is not the spinner. Nobody
/// acts on the tenth of a second a call took; they act on whether it was one second or forty.
pub(super) fn format_tool_duration(elapsed_ms: u64) -> String {
const SECOND: u64 = 1_000;
const MINUTE: u64 = 60 * SECOND;
const HOUR: u64 = 60 * MINUTE;
match elapsed_ms {
0 => "<1ms".to_string(),
ms if ms < SECOND => format!("{ms}ms"),
ms if ms < MINUTE => format!("{}s", ms / SECOND),
ms if ms < HOUR => format!("{}m {:02}s", ms / MINUTE, (ms % MINUTE) / SECOND),
ms => format!("{}h {:02}m", ms / HOUR, (ms % HOUR) / MINUTE),
ms if ms < 1_000 => format!("{ms}ms"),
ms => crate::statusline::format_elapsed_compact(std::time::Duration::from_millis(ms)),
}
}

View File

@@ -9,25 +9,13 @@ use ratatui::{
text::{Line, Span},
};
/// The color-independent lifecycle marker.
const fn change_status_marker(status: luxe_core::workspace::FileChangeStatus) -> &'static str {
use luxe_core::workspace::FileChangeStatus as Status;
match status {
Status::Added => "A",
Status::Modified => "M",
Status::Deleted => "D",
Status::Renamed => "R",
Status::Untracked => "?",
}
}
/// The dock's marker and color for `status`, for another surface that shows a file's Git status
/// and must show it the same way.
pub(crate) fn status_mark(
status: luxe_core::workspace::FileChangeStatus,
theme: &crate::theme::styles::ThemeStyles,
) -> (&'static str, ratatui::style::Style) {
(change_status_marker(status), status_style(status, theme))
(crate::marks::change(status), status_style(status, theme))
}
fn status_style(

View File

@@ -169,13 +169,12 @@ pub(super) fn todo_lines(
app: &App,
) -> Vec<Line<'static>> {
let styles = &app.theme_styles;
let (glyph, style) = match item.status {
TodoSummaryStatus::Completed => (crate::glyphs::Mark::Yes.glyph(), styles.success),
TodoSummaryStatus::InProgress => {
(crate::glyphs::Mark::Underway.glyph(), styles.text.add_modifier(Modifier::BOLD))
}
TodoSummaryStatus::Blocked => (crate::glyphs::Mark::Halted.glyph(), styles.warning),
TodoSummaryStatus::Pending => ("○", styles.muted),
let glyph = crate::marks::todo(item.status, crate::glyphs::tier());
let style = match item.status {
TodoSummaryStatus::Completed => styles.success,
TodoSummaryStatus::InProgress => styles.text.add_modifier(Modifier::BOLD),
TodoSummaryStatus::Blocked => styles.warning,
TodoSummaryStatus::Pending => styles.muted,
};
let subject_style = match item.status {
TodoSummaryStatus::Completed => style.add_modifier(Modifier::CROSSED_OUT),

View File

@@ -261,8 +261,8 @@ fn model_telemetry(app: &App, served_by: &str, row: usize, column: usize) -> Vec
lines
}
/// The SESSION block, once a turn has something to measure: the window, tokens, cost, and what
/// the review and compaction spent of it.
/// The SESSION block, once a turn has something to measure or someone has joined: the window,
/// tokens, cost, what the review and compaction spent of it, and who's joined.
fn session_telemetry(app: &App, row: usize, column: usize) -> Vec<Line<'static>> {
let styles = &app.theme_styles;
let status = &app.status;
@@ -270,7 +270,8 @@ fn session_telemetry(app: &App, row: usize, column: usize) -> Vec<Line<'static>>
let totals = &status.session.total;
let cost = status.session_cost_label();
let has_tokens = totals.prompt_tokens > 0 || totals.completion_tokens > 0;
if !(status.context_window > 0 || has_tokens || cost.is_some()) {
let joined = guests_row(app, row, column);
if !(status.context_window > 0 || has_tokens || cost.is_some() || joined.is_some()) {
return lines;
}
lines.push(Line::default());
@@ -304,9 +305,21 @@ fn session_telemetry(app: &App, row: usize, column: usize) -> Vec<Line<'static>>
lines.push(telemetry_row("cost", cost, styles.text, column, app));
}
lines.extend(source_cost_rows(app, column));
lines.extend(joined);
lines
}
/// Who's joined from elsewhere, while anyone has: here rather than in the transcript, where a
/// phone's every reconnect would add a line.
fn guests_row(app: &App, row: usize, column: usize) -> Option<Line<'static>> {
let guests = &app.status.guests;
if guests.is_empty() {
return None;
}
let names = truncate_cells(&guests.join(", "), telemetry_value_width(row, column));
Some(telemetry_row("joined", names, app.theme_styles.text, column, app))
}
/// What the review and compaction cost, each a dimmed share of the session's total.
fn source_cost_rows(app: &App, column: usize) -> Vec<Line<'static>> {
let styles = &app.theme_styles;

View File

@@ -5,6 +5,7 @@ use luxe_core::{config::Config, keymap::KeyMap};
use ratatui::style::Color;
use unicode_width::UnicodeWidthStr;
mod guests;
mod lists;
mod plan;
mod rail;

View File

@@ -0,0 +1,27 @@
//! Guests — who's joined the session from elsewhere, as the rail's SESSION block shows them.
use super::rail::{app, text};
use super::*;
/// The rail's lines as text.
fn rendered(app: &App) -> Vec<String> {
telemetry_lines(app).iter().map(text).collect()
}
/// Who's joined shows in SESSION while anyone has, even before a turn has anything to measure,
/// and leaves no row once they've gone.
///
/// The break this catches: a phone joined to an idle session shown nowhere (SESSION waits for a
/// turn), or the row left behind after everyone left.
#[test]
fn the_rail_shows_who_has_joined_while_they_are_here() {
let mut app = app();
assert!(!rendered(&app).iter().any(|line| line.contains("joined")));
app.status.guests = vec!["iPhone".into(), "iPad".into()];
let lines = rendered(&app);
let row = lines.iter().find(|line| line.contains("joined")).expect("a joined row");
assert!(row.ends_with("iPhone, iPad"), "{row:?}");
assert!(lines.iter().any(|line| line.contains("SESSION")), "{lines:?}");
app.status.guests.clear();
assert!(!rendered(&app).iter().any(|line| line.contains("joined")));
}

View File

@@ -407,23 +407,8 @@ fn chapter_accounted_label(
review: &luxe_core::guided_review::GuidedReview,
chapter: &luxe_core::guided_review::ReviewChapter,
) -> String {
use luxe_core::guided_review::{ItemVerdict, ReviewItemRef};
let mut reason: Option<luxe_core::guided_review::Accounted> = None;
for item in &chapter.items {
let verdict = match item {
ReviewItemRef::Hunk(hunk_id) => app.review.budget.hunk_verdict(hunk_id),
ReviewItemRef::File(_) => app.review.budget.verdict(item),
};
let ItemVerdict::Accounted(accounted) = verdict else {
return "nothing here needs you".into();
};
match &reason {
Some(seen) if *seen != accounted => return "nothing here needs you".into(),
_ => reason = Some(accounted),
}
}
let _ = review;
reason.map_or_else(
luxe_core::guided_review::shared_reason(&app.review.budget, chapter).map_or_else(
|| "nothing here needs you".into(),
|accounted| format!("{} \u{2014} nothing here needs you", accounted.label()),
)

View File

@@ -93,6 +93,9 @@ pub(crate) struct UnitSignature {
pub(crate) selected: bool,
pub(crate) never_sent: bool,
pub(crate) expanded: bool,
/// The image store's [`layout_revision`](crate::graphics::ImageStore::layout_revision) for a
/// unit that draws an image, `None` for one that doesn't
pub(crate) images: Option<u64>,
}
/// One unit's rows, and what they were drawn against.

View File

@@ -3,7 +3,7 @@
use super::reveal::{rendered_chars, revealed_lines};
use super::rows::{append_banded_rows, folded_run_rows, Banded};
use super::{LayoutContext, TranscriptLayout, UnitSignature};
use crate::app::{App, ToolRunFold};
use crate::app::{App, ConversationItem, ConvoBlock, ToolRunFold};
use crate::view::{blocks, wrapping, ConversationCanvasWidths};
use ratatui::text::Line;
use std::rc::Rc;
@@ -154,6 +154,7 @@ fn layout_folded_run(
selected: app.selected_block.is_some_and(|index| range.contains(&index)),
never_sent: false,
expanded: false,
images: None,
};
// A run that is still working spins, so its line is different every tick and
// there is nothing about it a later frame could reuse.
@@ -189,10 +190,10 @@ fn layout_item(
selected: app.selected_block == Some(block_index),
never_sent: app.was_never_sent(item_id),
expanded: app.message_is_expanded(item_id),
images: image_revision(app, item),
};
// Anything that redraws on a clock of its own — a spinner, an image the store is still
// sizing — has nothing worth keeping between frames.
let volatile = draws_by_itself(app, item);
// A spinner redraws on a clock of its own, so there is nothing worth keeping between frames
let volatile = draws_by_itself(item);
let cached_chars = (!volatile).then(|| layout.reusable(&signature)).flatten();
// The reveal decides how much of an item to draw from its *rendered* character count, and
@@ -328,30 +329,37 @@ fn newest_revision(app: &App, range: std::ops::Range<usize>) -> crate::app::Bloc
.unwrap_or(crate::app::BlockRevision::ZERO)
}
/// Whether a block's own drawing moves without the transcript changing.
///
/// A working card spins, and an image is laid out against a store that may still be loading or
/// resizing it. Those units are rebuilt every frame, because there is nothing about them a later
/// frame could honestly reuse.
/// Whether a block's own drawing moves without the transcript changing: a working card spins.
/// Such a unit is rebuilt every frame, because there is nothing about it a later frame could reuse.
///
/// **Working**, not running: a call the model is still writing spins too, and the memo is keyed on
/// the card's revision — so a provider that delivers a tool call's arguments in one lump at the end
/// left the spinner frozen for the whole time it took to arrive, which reads worse than no spinner
/// at all.
fn draws_by_itself(app: &App, item: &crate::app::ConversationItem) -> bool {
fn draws_by_itself(item: &ConversationItem) -> bool {
match item.block() {
crate::app::ConvoBlock::Image { .. } => true,
crate::app::ConvoBlock::Tool(tool) => {
tool.activity.state.is_working()
|| app.tool_images.contains_key(&(
tool.activity.session_id.clone(),
tool.activity.call_id.clone(),
))
}
ConvoBlock::Tool(tool) => tool.activity.state.is_working(),
_ => false,
}
}
/// The image store's layout revision for an item that draws an image, `None` for one that
/// doesn't.
///
/// An image's rows depend on the store (its size, the tier, the cell geometry) as well as on the
/// item, so they are keyed on both. Rebuilding them every frame would cost a session with a
/// hundred screenshots a hundred card layouts a frame, wherever they sit.
fn image_revision(app: &App, item: &ConversationItem) -> Option<u64> {
let draws_image = match item.block() {
ConvoBlock::Image { .. } => true,
ConvoBlock::Tool(tool) => app
.tool_images
.contains_key(&(tool.activity.session_id.clone(), tool.activity.call_id.clone())),
_ => false,
};
draws_image.then(|| app.images.layout_revision())
}
/// True when a rendered line carries no visible content.
fn line_is_blank(line: &Line<'static>) -> bool {
line.spans.iter().all(|span| span.content.trim().is_empty())

View File

@@ -1,5 +1,6 @@
use super::*;
use crate::app::{ConversationItem, ConvoBlock};
use crate::app::{App, ConversationItem, ConvoBlock, ToolItem};
use crate::graphics::{CellSize, ImageKey, ImageOrigin};
fn signature(first: usize, revision: BlockRevision) -> UnitSignature {
UnitSignature {
@@ -12,6 +13,7 @@ fn signature(first: usize, revision: BlockRevision) -> UnitSignature {
selected: false,
never_sent: false,
expanded: false,
images: None,
}
}
@@ -121,7 +123,7 @@ fn a_changed_item_invalidates_only_itself() {
assert_eq!(text, ["a", "b", "b2"]);
}
/// A unit that redraws by itself — a spinner, an image, a row the reveal is still typing —
/// A unit that redraws by itself — a spinner, a row the reveal is still typing —
/// must never be served from the cache, however unchanged its signature looks.
#[test]
fn a_self_animating_unit_is_never_reused() {
@@ -175,6 +177,79 @@ fn a_shortened_transcript_drops_the_rows_it_lost() {
assert_eq!(layout.rows().len(), 1, "the popped item's row is gone");
}
/// An app with nothing in its transcript, and `key` in its image store.
fn app_holding(key: &ImageKey) -> App {
let (tx, _rx) = tokio::sync::mpsc::channel(4);
let config = luxe_core::config::Config::default();
let mut app = App::new(tx, luxe_core::keymap::KeyMap::defaults(), config);
let mut png = std::io::Cursor::new(Vec::new());
image::DynamicImage::new_rgba8(32, 16).write_to(&mut png, image::ImageFormat::Png).unwrap();
let origin = ImageOrigin { label: "screenshot".into(), path: None };
assert!(app.images.insert(key.clone(), png.into_inner(), origin));
app
}
/// An app whose transcript is one finished screenshot call, its image in the store.
fn app_with_screenshot() -> App {
let key = ImageKey::tool_result("s", "call-shot", 1);
let mut app = app_holding(&key);
let mut shot = luxe_core::ToolActivity::running("s", "call-shot", "screenshot", "url", 1);
shot.state = luxe_core::ToolActivityState::Succeeded;
let card =
ToolItem { activity: shot, expanded: false, details_toggled: false, waited_on_user_ms: 0 };
app.push_convo(ConvoBlock::Tool(Box::new(card)));
app.tool_images.insert(("s".into(), "call-shot".into()), vec![key]);
app
}
/// An app whose transcript is one attached image.
fn app_with_attached_image() -> App {
let key = ImageKey::new("attached");
let mut app = app_holding(&key);
app.push_convo(ConvoBlock::Image { key, width: 32, height: 16 });
app
}
/// One frame's layout of `app`'s transcript, as the rows' shared lines.
fn lay_out_frame(layout: &mut TranscriptLayout, app: &mut App) -> Vec<Rc<Line<'static>>> {
super::layout::lay_out_transcript(
layout,
app,
super::super::conversation_canvas_widths(120),
40,
);
layout.rows().iter().map(|row| Rc::clone(&row.line)).collect()
}
/// The break this catches: a card carrying an image rebuilt every frame, which in a session with a
/// hundred screenshots lays out a hundred cards a frame wherever they sit; or kept after the store
/// changes under it, drawing rows sized for the old geometry.
#[test]
fn an_image_card_is_reused_until_the_image_store_changes() {
assert_reused_until_the_store_changes(app_with_screenshot());
}
/// The break this catches: an attached image left out of the store's revision, so its rows
/// outlive a change of cell size or a cleared store.
#[test]
fn an_attached_image_is_reused_until_the_image_store_changes() {
assert_reused_until_the_store_changes(app_with_attached_image());
}
/// `app`'s only item is laid out once across unchanged frames, and again once the store moves.
fn assert_reused_until_the_store_changes(mut app: App) {
let mut layout = TranscriptLayout::default();
let first = lay_out_frame(&mut layout, &mut app);
let second = lay_out_frame(&mut layout, &mut app);
assert!(!first.is_empty(), "the card draws");
let reused = first.iter().zip(&second).all(|(a, b)| Rc::ptr_eq(a, b));
assert!(reused && first.len() == second.len(), "an unchanged frame reuses the card");
app.images.set_cell_size(CellSize { width: 7, height: 15 });
let third = lay_out_frame(&mut layout, &mut app);
assert!(!Rc::ptr_eq(&second[0], &third[0]), "a store change lays it out again");
}
/// Every field of the signature has to be part of the comparison, or the cache serves a stale
/// row the moment that one thing changes on its own. Flipping each in turn is the cheap way to
/// keep a future field from being added to the struct and forgotten in the equality.
@@ -182,7 +257,7 @@ fn a_shortened_transcript_drops_the_rows_it_lost() {
fn every_field_of_the_signature_is_part_of_the_comparison() {
let base = signature(3, BlockRevision::for_test(1));
type Mutation = (&'static str, fn(&mut UnitSignature));
let mutations: [Mutation; 9] = [
let mutations: [Mutation; 10] = [
("first", |s| s.first += 1),
("len", |s| s.len += 1),
("revision", |s| s.revision = BlockRevision::for_test(2)),
@@ -192,6 +267,7 @@ fn every_field_of_the_signature_is_part_of_the_comparison() {
("selected", |s| s.selected = !s.selected),
("never_sent", |s| s.never_sent = !s.never_sent),
("expanded", |s| s.expanded = !s.expanded),
("images", |s| s.images = Some(1)),
];
for (field, mutate) in mutations {
let mut changed = base;