luxe 0.1.5: a provider picker, model ids, and a guided review that says less

The dock's provider row opens a list of providers, and the model picker opens on the provider in use, with tab to widen it; signing in opens it on the provider just signed in to. Models go by their id unless config names them, and the model row wears its maker's mark.

The guided review's guide prompt is shorter, the pull request brief shows the start of the description with the rest behind p, its commits drop the Luxe-review and Luxe-revision lines, and the weakened-gates signal is gone.

luxe update reruns the installer it was installed with, in place of luxe-cli-update. The preview's FILE tab reads files the session changed outside the project, and only those. Smaller fixes: bash headers are highlighted, the preview loses a blank row, the launcher divider sits inside its frame, and the phone app's top bar is clear of iOS's blur.

rustls-webpki 0.103.16 and webpki-roots 1.0.10 fix RUSTSEC-2026-0381 and RUSTSEC-2026-0382, and vite 8.3.4 fixes GHSA-587h-7wmj-h5pm, GHSA-698v-4r3x-3vcv and GHSA-r825-w8mm-5pxw.
This commit is contained in:
Evan Whittaker
2026-10-22 13:25:32 -05:00
parent 4705c2abaa
commit f3ed35beb5
123 changed files with 3788 additions and 1745 deletions

View File

@@ -18,14 +18,14 @@ name = "luxe"
path = "src/main.rs"
[dependencies]
luxe-core = { path = "../luxe-core", version = "0.1.4" }
luxe-providers = { path = "../luxe-providers", version = "0.1.4" }
luxe-tools = { path = "../luxe-tools", version = "0.1.4" }
luxe-lsp = { path = "../luxe-lsp", version = "0.1.4" }
luxe-dap = { path = "../luxe-dap", version = "0.1.4" }
luxe-mcp = { path = "../luxe-mcp", version = "0.1.4" }
luxe-tui = { path = "../luxe-tui", version = "0.1.4" }
luxe-remote = { path = "../luxe-remote", version = "0.1.4", optional = true }
luxe-core = { path = "../luxe-core", version = "0.1.5" }
luxe-providers = { path = "../luxe-providers", version = "0.1.5" }
luxe-tools = { path = "../luxe-tools", version = "0.1.5" }
luxe-lsp = { path = "../luxe-lsp", version = "0.1.5" }
luxe-dap = { path = "../luxe-dap", version = "0.1.5" }
luxe-mcp = { path = "../luxe-mcp", version = "0.1.5" }
luxe-tui = { path = "../luxe-tui", version = "0.1.5" }
luxe-remote = { path = "../luxe-remote", version = "0.1.5", 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 }
@@ -53,9 +53,10 @@ unicode-width = { workspace = true }
# Streaming the update manifest with a size cap, and comparing the version it reports.
futures = { workspace = true }
semver = { workspace = true }
# The scratch folder `luxe update` runs the installer script in, removed when it finishes
tempfile = "3"
[dev-dependencies]
tempfile = "3"
# The guide check: what luxe would silently ignore in a config example
serde_ignored = "0.1"

View File

@@ -2,9 +2,10 @@
//!
//! The policy is [`luxe_core::update`]'s: which owner installed this copy, which commands update
//! it, and a refusal where luxe cannot know them. This runs those commands one program at a time
//! with the terminal attached, so the reader sees the package manager's own output, and luxe never
//! writes a binary itself. `/update` on the dashboard comes here too, once the TUI has handed the
//! terminal back.
//! with the terminal attached, so the reader sees the package manager's own output. A copy luxe's
//! installer script put there is updated by running that script again ([`installer`]). Either way
//! luxe never writes a binary itself. `/update` on the dashboard comes here too, once the TUI has
//! handed the terminal back.
use anyhow::{anyhow, bail, Context};
use luxe_core::update::{self, InstallSource};
@@ -24,31 +25,58 @@ pub(crate) async fn run(check_only: bool) -> anyhow::Result<()> {
}
println!("luxe {latest} is available (you have {current}).");
let source = InstallSource::detect();
match (source.update_steps(), check_only) {
(Some(steps), false) => update_with(steps, &latest).await,
_ => {
match route(source, check_only) {
Some(route) => update_with(route, &latest).await,
None => {
println!("{}", instructions(source, check_only));
Ok(())
}
}
}
/// Runs the owner's steps over this copy, then checks the `luxe` a shell finds now.
/// How `luxe update` updates a copy.
#[derive(Debug, PartialEq, Eq)]
enum Route {
/// The owner's own commands, in order
Steps(&'static [&'static [&'static str]]),
/// The release's installer script, run again over this copy
Installer,
}
/// The route for `source`, or `None` when luxe only says what to do: the reader asked just to
/// check, or no owner's update is known.
fn route(source: InstallSource, check_only: bool) -> Option<Route> {
if check_only {
return None;
}
match source {
InstallSource::Installer => Some(Route::Installer),
_ => source.update_steps().map(Route::Steps),
}
}
/// Updates this copy by `route`, then checks the `luxe` a shell finds now.
///
/// Windows won't let a running program's file be overwritten, and `luxe update` is itself a
/// running luxe. It does allow a rename, so the running copy steps aside first and the owner
/// writes a new file where it was.
async fn update_with(steps: &[&[&str]], latest: &str) -> anyhow::Result<()> {
async fn update_with(route: Route, latest: &str) -> anyhow::Result<()> {
let exe = std::env::current_exe().context("could not find the running luxe")?;
let aside = match cfg!(windows) {
true => Some(aside::MovedAside::move_running(&exe)?),
false => None,
};
let ran = run_steps(steps, exe.parent()).await;
let ran = match &route {
Route::Steps(steps) => run_steps(steps).await,
Route::Installer => installer::run(latest, &exe).await,
};
if let Some(aside) = &aside {
aside.restore_if_missing()?;
}
ran?;
if route == Route::Installer {
installer::remove_legacy_updater(&exe);
}
report(installed_now(latest, &exe).await)
}
@@ -61,14 +89,13 @@ fn instructions(source: InstallSource, check_only: bool) -> String {
}
}
/// Runs each step in turn, the terminal attached, stopping at the first that fails. `beside` is
/// the running binary's directory.
async fn run_steps(steps: &[&[&str]], beside: Option<&Path>) -> anyhow::Result<()> {
/// Runs each step in turn, the terminal attached, stopping at the first that fails.
async fn run_steps(steps: &[&[&str]]) -> anyhow::Result<()> {
for step in steps {
let Some((program, args)) = step.split_first() else { continue };
let line = step.join(" ");
println!("Running: {line}");
let status = tokio::process::Command::new(program_path(program, beside))
let status = tokio::process::Command::new(program)
.args(args)
.status()
.await
@@ -80,16 +107,6 @@ async fn run_steps(steps: &[&[&str]], beside: Option<&Path>) -> anyhow::Result<(
Ok(())
}
/// Where to run `program` from: `beside` this binary when it is there, which is where the
/// installer put its updater, whether or not that directory is on `PATH`; by name otherwise.
fn program_path(program: &str, beside: Option<&Path>) -> PathBuf {
let name = format!("{program}{}", std::env::consts::EXE_SUFFIX);
beside
.map(|dir| dir.join(name))
.filter(|path| path.is_file())
.unwrap_or_else(|| PathBuf::from(program))
}
/// How the update landed, read from the `luxe` a shell would run now.
#[derive(Debug, PartialEq, Eq)]
enum Outcome {
@@ -165,6 +182,7 @@ fn report(outcome: Outcome) -> anyhow::Result<()> {
}
mod aside;
mod installer;
#[cfg(test)]
mod tests;

View File

@@ -1,7 +1,7 @@
//! Moving the running copy aside — how `luxe update` gets out of its own way on Windows.
//!
//! Windows locks a running program's file against being overwritten or deleted, but not against
//! being renamed. The running `luxe.exe` becomes `luxe.exe.old`, the owner's updater writes a new
//! being renamed. The running `luxe.exe` becomes `luxe.exe.old`, the update writes a new
//! `luxe.exe`, and the next launch deletes the leftover once nothing is running from it. Nothing
//! here writes a binary: it only renames the one that is already there.

View File

@@ -0,0 +1,235 @@
//! Installer update — how `luxe update` updates a copy luxe's own installer script put there.
//!
//! It downloads the release's installer script, the one the install instructions pipe into a
//! shell, and runs it over this copy's directory. The script writes the binary, as it did on the
//! first install; luxe only picks the script and the directory ([`luxe_core::update::installer`]).
//!
//! Two things it does that the script alone would not. The script works in a scratch folder luxe
//! makes and removes, because dist's PowerShell installer never deletes its own and would leave a
//! folder holding the downloaded zip in `%TEMP%` on every update. And everything the script prints
//! is copied to a log as well as shown, so a failure can be read after the console scrolls away.
use anyhow::{bail, Context};
use luxe_core::update::{installer, InstallReceipt, InstallTarget, LEGACY_UPDATER};
use std::io::Write;
use std::path::{Path, PathBuf};
use std::process::{ExitStatus, Stdio};
use std::time::Duration;
use tokio::io::{AsyncBufReadExt, AsyncRead, BufReader};
use tokio::sync::mpsc;
/// How long the script's download may take. It is a few dozen kilobytes; a minute covers a slow
/// link without leaving someone staring at a hung `luxe update`.
const DOWNLOAD_TIMEOUT: Duration = Duration::from_secs(60);
/// The most script luxe will accept. The real one is about 25 KB; this is remote content that is
/// about to run, so anything far larger is not it.
const MAX_SCRIPT_BYTES: usize = 1024 * 1024;
/// How often and how far apart removing the scratch folder is tried. Windows can hold a file that
/// was just written (an antivirus scan of the downloaded zip), so one failure is not final.
const SCRATCH_REMOVE_TRIES: u32 = 3;
const SCRATCH_REMOVE_PAUSE: Duration = Duration::from_millis(500);
/// Runs the installer script for `latest` over the copy at `exe`.
pub(super) async fn run(latest: &str, exe: &Path) -> anyhow::Result<()> {
let target = InstallTarget::for_binary(exe, InstallReceipt::load().as_ref())
.with_context(|| format!("could not tell which folder {} is in", exe.display()))?;
let scratch = tempfile::Builder::new()
.prefix("luxe-update-")
.tempdir()
.context("could not make a scratch folder for the installer")?;
let url = installer::installer_script_url(latest);
println!("Downloading the luxe {latest} installer from {url}");
let ran = match download(&url, scratch.path()).await {
Ok(script) => run_script(&script, &target, scratch.path(), &log_path()).await,
Err(error) => Err(error),
};
remove_scratch(scratch.keep()).await;
ran
}
/// Removes the updater older installers put beside the binary, once an update has made it
/// redundant. A failure only costs a stale file, so it is reported and the update still counts.
pub(super) fn remove_legacy_updater(exe: &Path) {
let name = format!("{LEGACY_UPDATER}{}", std::env::consts::EXE_SUFFIX);
let updater = exe.with_file_name(name);
match std::fs::remove_file(&updater) {
Ok(()) => println!("Removed {}, which `luxe update` replaces.", updater.display()),
Err(error) if error.kind() == std::io::ErrorKind::NotFound => {}
Err(error) => {
println!("Couldn't remove {} ({error}); it's no longer used.", updater.display())
}
}
}
/// Where the script's output is kept: one file, replaced each run, beside luxe's other logs.
fn log_path() -> PathBuf {
luxe_core::user_dirs::luxe_state_dir().join("logs").join("update.log")
}
/// Downloads the script at `url` into `folder` and returns where it landed.
async fn download(url: &str, folder: &Path) -> anyhow::Result<PathBuf> {
// The same bare user agent as the release check: the request says nothing about this machine
let client = reqwest::Client::builder().timeout(DOWNLOAD_TIMEOUT).user_agent("luxe").build()?;
let response =
client.get(url).send().await.with_context(|| format!("could not download {url}"))?;
if !response.status().is_success() {
bail!("could not download {url}: it returned {}", response.status());
}
let body = crate::update_check::bounded_bytes(response, MAX_SCRIPT_BYTES)
.await
.map_err(|error| anyhow::anyhow!("could not download {url}: {error}"))?;
let script = folder.join(installer::installer_script_name());
std::fs::write(&script, body)
.with_context(|| format!("could not save the installer to {}", script.display()))?;
Ok(script)
}
/// Runs `script` for `target`, showing and logging what it prints. `scratch` is where it keeps its
/// temporary files.
async fn run_script(
script: &Path,
target: &InstallTarget,
scratch: &Path,
log: &Path,
) -> anyhow::Result<()> {
let mut command = script_command(script);
command
.envs(target.script_variables())
.envs(scratch_variables(scratch))
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.kill_on_drop(true);
let mut child = command.spawn().context("could not start the installer")?;
let mut log_file = open_log(log, script, target);
let status = relay(&mut child, &mut log_file).await?;
append(&mut log_file, &format!("exit: {status}"));
if !status.success() {
bail!(
"the installer failed ({status}), so luxe is unchanged; its output is in {}",
log.display()
);
}
Ok(())
}
/// The command that runs the script: Windows PowerShell for the `.ps1`, `sh` for the rest.
fn script_command(script: &Path) -> tokio::process::Command {
if !cfg!(windows) {
let mut command = tokio::process::Command::new("sh");
command.arg(script);
return command;
}
let shell = luxe_core::program::resolve("powershell").unwrap_or_else(|| "powershell".into());
let mut command = tokio::process::Command::new(shell);
// No profile, so nothing of the reader's own runs inside the install. And no `PSModulePath`:
// inherited from PowerShell 7 it points Windows PowerShell at modules it cannot load
// (PowerShell/PowerShell#18530)
command.args(["-NoProfile", "-ExecutionPolicy", "Bypass", "-File"]).arg(script);
command.env_remove("PSModulePath");
command
}
/// Points every temp-folder variable the scripts consult at `scratch`: `TMP` and `TEMP` for
/// PowerShell's `GetTempPath`, `TMPDIR` for `mktemp`.
fn scratch_variables(scratch: &Path) -> [(&'static str, &Path); 3] {
[("TMP", scratch), ("TEMP", scratch), ("TMPDIR", scratch)]
}
/// Opens the log fresh and heads it with what ran, or `None` when it cannot be written, which
/// costs the record but not the update.
fn open_log(log: &Path, script: &Path, target: &InstallTarget) -> Option<std::fs::File> {
let opened = log.parent().map_or(Ok(()), std::fs::create_dir_all);
let file = match opened.and_then(|()| std::fs::File::create(log)) {
Ok(file) => file,
Err(error) => {
tracing::warn!(%error, path = %log.display(), "could not open the update log");
return None;
}
};
let header = format!(
"luxe {} running {}\ninstall folder: {}\n",
luxe_core::version::VERSION,
script.display(),
target.dir.display()
);
let mut log = Some(file);
append(&mut log, &header);
log
}
/// Adds `line` to the log. A log that stops taking writes is dropped with one warning rather than
/// failing the update it only records.
fn append(log: &mut Option<std::fs::File>, line: &str) {
let Some(file) = log.as_mut() else { return };
if let Err(error) = writeln!(file, "{line}") {
tracing::warn!(%error, "the update log stopped taking writes");
*log = None;
}
}
/// One line the script printed, and whether it came on stderr.
type ScriptLine = (bool, String);
/// Shows each line the child prints, as it prints it, and copies it to `log`, then waits for it.
async fn relay(
child: &mut tokio::process::Child,
log: &mut Option<std::fs::File>,
) -> anyhow::Result<ExitStatus> {
let (sender, mut lines) = mpsc::unbounded_channel::<ScriptLine>();
if let Some(stdout) = child.stdout.take() {
tokio::spawn(forward_lines(stdout, false, sender.clone()));
}
if let Some(stderr) = child.stderr.take() {
tokio::spawn(forward_lines(stderr, true, sender.clone()));
}
drop(sender);
while let Some((is_stderr, line)) = lines.recv().await {
match is_stderr {
true => eprintln!("{line}"),
false => println!("{line}"),
}
append(log, &line);
}
child.wait().await.context("lost track of the installer")
}
/// Sends `stream` line by line. Lossy rather than strict UTF-8: Windows PowerShell writes in the
/// console's code page, and one accented folder name must not end the relay.
async fn forward_lines(
stream: impl AsyncRead + Unpin,
is_stderr: bool,
to: mpsc::UnboundedSender<ScriptLine>,
) {
let mut reader = BufReader::new(stream);
let mut buffer = Vec::new();
while matches!(reader.read_until(b'\n', &mut buffer).await, Ok(read) if read > 0) {
let line = String::from_utf8_lossy(&buffer).trim_end_matches(['\r', '\n']).to_string();
buffer.clear();
if to.send((is_stderr, line)).is_err() {
return;
}
}
}
/// Deletes the scratch folder, trying again briefly before saying it is left over.
async fn remove_scratch(folder: PathBuf) {
for attempt in 1..=SCRATCH_REMOVE_TRIES {
match std::fs::remove_dir_all(&folder) {
Ok(()) => return,
Err(error) if error.kind() == std::io::ErrorKind::NotFound => return,
Err(_) if attempt < SCRATCH_REMOVE_TRIES => {
tokio::time::sleep(SCRATCH_REMOVE_PAUSE).await
}
Err(error) => println!(
"Couldn't remove the installer's scratch folder {} ({error}). Nothing in it is \
needed, so it's safe to delete.",
folder.display()
),
}
}
}
#[cfg(test)]
mod tests;

View File

@@ -0,0 +1,85 @@
use super::*;
/// A folder holding a stand-in installer script with `body`, a scratch folder, and a log path.
#[cfg(unix)]
fn stand_in(body: &str) -> (tempfile::TempDir, PathBuf, PathBuf, PathBuf) {
let dir = tempfile::tempdir().expect("tempdir");
let script = dir.path().join("installer.sh");
std::fs::write(&script, body).expect("the script");
let scratch = dir.path().join("scratch");
std::fs::create_dir(&scratch).expect("scratch");
let log = dir.path().join("logs").join("update.log");
(dir, script, scratch, log)
}
/// The script is told where to install and that `PATH` is left alone, keeps its temporary files in
/// the scratch folder, and everything it prints, stderr too, lands in the log.
#[cfg(unix)]
#[tokio::test]
async fn the_script_is_pointed_at_the_target_and_logged() {
let (_dir, script, scratch, log) = stand_in(
"echo \"dir=$LUXE_CLI_INSTALL_DIR path=$LUXE_CLI_NO_MODIFY_PATH tmp=$TMPDIR\"\n\
echo 'a warning' >&2\n",
);
let target = InstallTarget { dir: "/home/dev/.local/bin".into(), modify_path: false };
run_script(&script, &target, &scratch, &log).await.expect("the script succeeds");
let written = std::fs::read_to_string(&log).expect("the log");
let expected = format!("dir=/home/dev/.local/bin path=1 tmp={}", scratch.display());
assert!(written.contains(&expected), "{written}");
assert!(written.contains("a warning"), "stderr is kept: {written}");
assert!(written.contains("install folder: /home/dev/.local/bin"), "{written}");
assert!(written.trim_end().ends_with("exit: exit status: 0"), "{written}");
}
/// A script that fails is an error that says luxe is unchanged and where its output went.
#[cfg(unix)]
#[tokio::test]
async fn a_failed_script_names_its_log() {
let (_dir, script, scratch, log) = stand_in("echo 'could not download' >&2\nexit 3\n");
let target = InstallTarget { dir: "/tmp/bin".into(), modify_path: true };
let error = run_script(&script, &target, &scratch, &log).await.expect_err("it failed");
let message = error.to_string();
assert!(
message.contains("unchanged") && message.contains(&log.display().to_string()),
"{message}"
);
assert!(std::fs::read_to_string(&log).expect("the log").contains("could not download"));
}
/// Every temp variable either script reads points at the scratch folder. Without `TMP` and
/// `TEMP`, PowerShell's `GetTempPath` would put its folder in `%TEMP%` again.
#[test]
fn every_temp_variable_points_at_the_scratch_folder() {
let scratch = Path::new("/scratch");
let names: Vec<&str> = scratch_variables(scratch).iter().map(|(name, _)| *name).collect();
assert_eq!(names, ["TMP", "TEMP", "TMPDIR"]);
assert!(scratch_variables(scratch).iter().all(|(_, value)| *value == scratch));
}
/// The scratch folder goes, the downloaded archive and what was unpacked from it included.
#[tokio::test]
async fn the_scratch_folder_is_removed_with_everything_in_it() {
let dir = tempfile::tempdir().expect("tempdir");
let scratch = dir.path().join("luxe-update-x");
let unpacked = scratch.join("6f1b2c");
std::fs::create_dir_all(&unpacked).expect("nested");
std::fs::write(unpacked.join("luxe-cli.zip"), b"zip").expect("the archive");
remove_scratch(scratch.clone()).await;
assert!(!scratch.exists());
}
/// After an update the legacy updater beside the binary is removed, and nothing else is.
#[test]
fn the_legacy_updater_is_removed_and_nothing_else() {
let dir = tempfile::tempdir().expect("tempdir");
let exe = dir.path().join(format!("luxe{}", std::env::consts::EXE_SUFFIX));
let updater = dir.path().join(format!("{LEGACY_UPDATER}{}", std::env::consts::EXE_SUFFIX));
for path in [&exe, &updater] {
std::fs::write(path, b"").expect("a stand-in");
}
remove_legacy_updater(&exe);
assert!(!updater.exists());
assert!(exe.exists());
remove_legacy_updater(&exe);
}

View File

@@ -11,16 +11,15 @@ fn copies() -> (tempfile::TempDir, PathBuf, PathBuf) {
(dir, updated, other)
}
/// The installer's updater runs from beside the binary even off `PATH`; anything not there, cargo
/// or brew, is found by name.
/// An installer copy is updated by luxe running the script, a package manager's by its commands,
/// and nothing runs for a check or for a copy with no known owner.
#[test]
fn a_program_beside_the_binary_runs_from_there() {
let dir = tempfile::tempdir().expect("tempdir");
let updater = dir.path().join(format!("luxe-cli-update{}", std::env::consts::EXE_SUFFIX));
std::fs::write(&updater, b"").expect("a stand-in updater");
assert_eq!(program_path("luxe-cli-update", Some(dir.path())), updater);
assert_eq!(program_path("brew", Some(dir.path())), PathBuf::from("brew"));
assert_eq!(program_path("luxe-cli-update", None), PathBuf::from("luxe-cli-update"));
fn each_source_takes_its_own_route() {
assert_eq!(route(InstallSource::Installer, false), Some(Route::Installer));
let cargo = InstallSource::Cargo.update_steps().expect("cargo has steps");
assert_eq!(route(InstallSource::Cargo, false), Some(Route::Steps(cargo)));
assert_eq!(route(InstallSource::Archive, false), None, "no owner to ask");
assert_eq!(route(InstallSource::Installer, true), None, "a check runs nothing");
}
#[test]
@@ -73,4 +72,6 @@ fn the_instructions_name_the_owners_command_or_none() {
assert!(check.contains("luxe update") && check.contains("cargo install"), "{check}");
let download = instructions(InstallSource::Archive, false);
assert!(download.contains("download it from"), "{download}");
// No second command to offer beside it, so it isn't named twice
assert_eq!(instructions(InstallSource::Installer, true), "To update: `luxe update`.");
}

View File

@@ -119,10 +119,10 @@ In order, the first that is set:
4. The model you last chose anywhere
5. `default_model` in `models.json`
luxe never picks a model for you, and signing in doesn't either: the model picker opens at the top
of the list for you to choose. With none of these set, sending a message opens the model picker,
and `--headless` and the loop refuse to start. To always start from your configured default rather
than your last choice:
luxe never picks a model for you, and signing in doesn't either: the model picker opens on the
provider you signed in to, at the top of its models, for you to choose. With none of these set,
sending a message opens the model picker, and `--headless` and the loop refuse to start. To always
start from your configured default rather than your last choice:
```json title="~/.config/luxe/config.json"
{ "agent": { "remember_model": false } }
@@ -882,14 +882,17 @@ it, showing each one before it runs:
| Installed with | `luxe update` runs |
| --- | --- |
| The install script | `luxe-cli-update`, the updater it put beside `luxe` |
| The install script | The install script again, downloaded from the new release |
| Homebrew | `brew update`, then `brew upgrade luxe` |
| Cargo | `cargo install --locked --force luxe-cli` |
luxe never downloads or replaces its own program; whatever installed it does. A copy your system's
package manager owns is left to it, and a downloaded archive points you at the releases page. On
Windows, a running program can't be overwritten, so luxe first renames itself to `luxe.exe.old`,
and the next launch deletes it.
luxe never replaces its own program; whatever installed it does. For the install script, that's
the new release's copy of the same script, run into the folder the first install used. Its
temporary files go in a folder luxe deletes afterwards, and what it prints is saved to
`update.log` in luxe's logs folder (`~/.local/state/luxe/logs`, or `%LOCALAPPDATA%\luxe\logs` on
Windows). A copy your system's package manager owns is left to it, and a downloaded archive
points you at the releases page. On Windows, a running program can't be overwritten, so luxe
first renames itself to `luxe.exe.old`, and the next launch deletes it.
Afterwards it checks that the `luxe` your shell finds is the new version, and says so if another
copy earlier on your `PATH` is in the way. `luxe update --check` only reports.
@@ -1058,7 +1061,7 @@ each replace the catalog's whole: a `cost` you write drops the catalog's long-pr
| --- | --- |
| `context_window` | The model's context window, in tokens |
| `max_tokens` | The most it may write in one reply. Defaults to the model's own limit from the catalog. luxe lowers it per request to what the window has left, so setting the real limit is safe; setting a lower one is how replies get cut off. |
| `name` | The name shown in the picker and statusline |
| `name` | The name shown in the picker and statusline, instead of the model ID |
| `reasoning` | Whether it can think |
| `thinking` | The level a session starts at for this model |
| `thinking_level_map` | What each thinking level sends; see below |
@@ -1214,7 +1217,6 @@ luxe takes a model's details from three places, each overriding the one before,
```console
$ luxe models show anthropic/claude-opus-5
anthropic/claude-opus-5
name Claude Opus 5 [models.dev]
context window 1.0M [models.dev]
max output 128k [models.dev]
reasoning true [models.dev]
@@ -1227,6 +1229,8 @@ anthropic/claude-opus-5
Each value names where it came from: `snapshot` for the catalog built into luxe, `models.dev` for
the refreshed copy, `config` for your `models.json`, and `default` where none of them said.
A model goes by its ID everywhere luxe shows it, unless you give it a `name` in `models.json`.
| Variable | Does |
| --- | --- |
| `LUXE_MODELS_DEV_REFRESH=0` | Never refresh; the built-in catalog still answers |
@@ -1791,11 +1795,10 @@ test that passed says so on its own header and stays in the diff. Lockfiles, gen
moves and formatting-only changes fold away, each run of them in a file into one row; `f` opens
them all.
Three things are flagged and stay on the list, whatever else passed. Each flagged file says so on
Two things are flagged and stay on the list, whatever else passed. Each flagged file says so on
its row and in the walkthrough, and the guide gives the total for any kind with more than two:
- A line that looks like a credential (`sk-…`, `ghp_…`, `AKIA…`, a `password = "…"`)
- A weakened check: a deleted test, an added `#[ignore]`, an edit to CI or `deny.toml`
- A file the agent edited without reading first
If a test fixture needs a value that looks like a credential, mark that line with
@@ -1870,7 +1873,8 @@ agent opened. It needs the GitHub CLI, `gh`, signed in.
- It is pinned to the commit GitHub reported and compared from where it branched, as GitHub's
**Files changed** does. Nothing in your checkout moves.
- The head says who opened it and where it stands: `by dependabot (bot) · 1 failing · changes requested`.
- The author's description follows the guide, under its own heading.
- The opening of the author's description follows the guide, under its own heading. `p` reads
the whole of it.
- Review threads appear under the lines they are about. Anything without a line is under
**Discussion on GitHub**.
- `a` asks the agent about a line, at the pull request's commit.
@@ -2488,7 +2492,7 @@ conversation, or in its place below 80 columns.
| **PLAN** | The agent's todo list, scrolled to what it is working on |
| **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 model to change it, or the mode to switch it. |
| **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. |
| **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:
@@ -3195,7 +3199,7 @@ group: "Using luxe"
## Sign in
Open **Configuration** (on the start screen, or `/config`) and choose how to connect. When a
provider connects, the model picker opens.
provider connects, the model picker opens on its models; `tab` shows every provider's.
| Option | For |
| --- | --- |
@@ -3279,10 +3283,15 @@ A command runs each time a request needs the key.
## Choose a model
`/model` opens the model picker: every model your providers can serve, configured providers first.
Type to search. The session carries on with the new model, even across providers, and luxe
remembers your choice for next time, in this project and as your latest anywhere
([which model a session starts on](agent.md#which-model-a-session-starts-on)).
`/model` opens the model picker on the models of the provider you're using. Type to search, and
press `tab` to see every provider's models. The session carries on with the new model, even across
providers, and luxe remembers your choice for next time, in this project and as your latest
anywhere ([which model a session starts on](agent.md#which-model-a-session-starts-on)).
To change who serves the model, press `←` in the picker, or click the provider in the dock. Choose
a provider that serves the model you're on and luxe switches to it there, keeping the model.
Choose any other and its models open for you to pick from. Clicking the model in the dock opens
the models.
From the command line, `--model` takes a model ID, or `provider/id` to pick the provider too:
@@ -4727,7 +4736,8 @@ There is no telemetry. luxe connects only to:
when `web_fetch` clones a repository (`"tools": { "clone_repositories": false }` stops it)
3. The models.dev catalog, to refresh model details (`LUXE_MODELS_DEV_REFRESH=0` stops it)
4. The update check, once a day (`"update": { "check": false }` stops it), and when you run
`luxe update` or `/update`, which then runs your package manager's own update
`luxe update` or `/update`, which then runs your package manager's own update, or for the
install script, downloads the new release's script from GitHub and runs it
5. GitHub, through your own `gh`, when you, the agent or an [RPC client](rpc.md#github-writes) work
with pull requests and issues. A client can write there only if you start it with
`--github-writes`.

View File

@@ -137,7 +137,10 @@ async fn fetch_latest(url: &str) -> Result<String, String> {
if !response.status().is_success() {
return Err(format!("release manifest returned {}", response.status()));
}
let body = bounded_body(response).await?;
let body = bounded_bytes(response, MAX_BODY_BYTES)
.await
.map_err(|error| format!("release manifest: {error}"))?;
let body = String::from_utf8(body).map_err(|_| "release manifest was not UTF-8".to_string())?;
let parsed: serde_json::Value =
serde_json::from_str(&body).map_err(|error| error.to_string())?;
@@ -156,20 +159,24 @@ async fn fetch_latest(url: &str) -> Result<String, String> {
Ok(normalized.to_string())
}
/// Read a response body, refusing one that outgrows [`MAX_BODY_BYTES`].
async fn bounded_body(response: reqwest::Response) -> Result<String, String> {
/// Reads a response body, refusing one that outgrows `limit` bytes: what comes back is remote and
/// untrusted, so a server that streams forever is cut off rather than exhausting memory.
pub(crate) async fn bounded_bytes(
response: reqwest::Response,
limit: usize,
) -> Result<Vec<u8>, String> {
use futures::StreamExt;
let mut stream = response.bytes_stream();
let mut body = Vec::new();
while let Some(chunk) = stream.next().await {
let chunk = chunk.map_err(|error| error.to_string())?;
if body.len() + chunk.len() > MAX_BODY_BYTES {
return Err("release manifest is implausibly large".to_string());
if body.len() + chunk.len() > limit {
return Err(format!("the response is larger than {limit} bytes"));
}
body.extend_from_slice(&chunk);
}
String::from_utf8(body).map_err(|_| "release manifest was not UTF-8".to_string())
Ok(body)
}
#[cfg(test)]