luxe 0.1.4: remembered models, wheel-driven lists, and a steadier phone app
- luxe starts on the model you last chose in this project, then the last one anywhere. Signing in opens the model picker instead of choosing for you. - Every list in a modal takes the mouse wheel and a draggable scrollbar. - The phone app shows reasoning in full, stays put while you read back through a long session, and shows a question's answer on its card. - On Windows, luxe update replaces the running luxe, and a signed-in install no longer sees setup again. - The file tree no longer shows "engine busy" in a large project, loop output is easier to follow, and the name is written lowercase. The CHANGELOG has the full list.
This commit is contained in:
@@ -33,8 +33,8 @@ const HTML_TAG: &str = "<html lang=\"en\">";
|
||||
|
||||
/// The page's title as written, and the home screen name iOS suggests; a named bridge puts the
|
||||
/// computer in both.
|
||||
const PAGE_TITLE: &str = "<title>Luxe</title>";
|
||||
const HOME_SCREEN_TITLE: &str = "name=\"apple-mobile-web-app-title\" content=\"Luxe\"";
|
||||
const PAGE_TITLE: &str = "<title>luxe</title>";
|
||||
const HOME_SCREEN_TITLE: &str = "name=\"apple-mobile-web-app-title\" content=\"luxe\"";
|
||||
|
||||
/// What the page takes from your own config: a project's can't reach here.
|
||||
#[derive(Default)]
|
||||
@@ -80,7 +80,7 @@ fn themed_page(page: &str, look: &PageLook) -> String {
|
||||
|
||||
/// The page named for the computer `machine`: its title, the name iOS suggests when it's added to
|
||||
/// the home screen, and a `luxe-machine` meta the app reads to say which computer it reaches.
|
||||
/// Unnamed, it stays plain Luxe.
|
||||
/// Unnamed, it stays plain luxe.
|
||||
fn named_page(page: &str, machine: Option<&str>) -> String {
|
||||
let Some(machine) = machine else {
|
||||
return page.to_owned();
|
||||
|
||||
@@ -139,13 +139,13 @@ fn the_page_says_how_headings_are_cut() {
|
||||
/// screen, and the meta the app reads; an unnamed one is the page as written.
|
||||
///
|
||||
/// The break this catches: the page's title or home screen meta reworded so the swap finds
|
||||
/// nothing, leaving two computers' apps both "Luxe", or a name put in unescaped.
|
||||
/// nothing, leaving two computers' apps both "luxe", or a name put in unescaped.
|
||||
#[test]
|
||||
fn the_page_is_named_for_its_computer() {
|
||||
let page = AppFiles::get("index.html").expect("the page");
|
||||
let page = String::from_utf8_lossy(&page.data);
|
||||
let named = named_page(&page, Some("desk"));
|
||||
assert!(named.contains("<title>Luxe \u{00b7} desk</title>"), "{named}");
|
||||
assert!(named.contains("<title>luxe \u{00b7} desk</title>"), "{named}");
|
||||
assert!(named.contains(r#"name="apple-mobile-web-app-title" content="desk""#));
|
||||
assert!(named.contains(r#"<meta name="luxe-machine" content="desk">"#));
|
||||
assert!(named_page(&page, Some("a\"b")).contains(r#"content="a"b""#));
|
||||
|
||||
@@ -121,7 +121,7 @@ impl DeviceBook {
|
||||
Self { file: JsonFile::new(path, FileMode::OwnerOnly) }
|
||||
}
|
||||
|
||||
/// Where it lives unless told otherwise: `remote.json` beside Luxe's other settings.
|
||||
/// Where it lives unless told otherwise: `remote.json` beside luxe's other settings.
|
||||
pub fn default_path() -> PathBuf {
|
||||
luxe_core::user_dirs::luxe_config_dir().join("remote.json")
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Folders — where a device can start a session.
|
||||
//!
|
||||
//! The folders Luxe is running in now, the ones herdr's panes are in, and the ones the bridge has
|
||||
//! seen Luxe running in before, remembered in a small file. Never a scan of the home folder: the
|
||||
//! The folders luxe is running in now, the ones herdr's panes are in, and the ones the bridge has
|
||||
//! seen luxe running in before, remembered in a small file. Never a scan of the home folder: the
|
||||
//! list is where you've already worked.
|
||||
|
||||
use std::collections::HashMap;
|
||||
@@ -40,7 +40,7 @@ struct Sighting {
|
||||
last_seen: u64,
|
||||
}
|
||||
|
||||
/// The folders the bridge has seen Luxe running in.
|
||||
/// The folders the bridge has seen luxe running in.
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct FolderBook {
|
||||
file: JsonFile,
|
||||
@@ -52,12 +52,12 @@ impl FolderBook {
|
||||
Self { file: JsonFile::new(path, FileMode::OwnerOnly) }
|
||||
}
|
||||
|
||||
/// Where it lives unless told otherwise: Luxe's state folder, since it's a record of use.
|
||||
/// Where it lives unless told otherwise: luxe's state folder, since it's a record of use.
|
||||
pub(crate) fn default_path() -> PathBuf {
|
||||
luxe_core::user_dirs::luxe_state_dir().join("remote-folders.json")
|
||||
}
|
||||
|
||||
/// Notes that Luxe is running in each of `running` now.
|
||||
/// Notes that luxe is running in each of `running` now.
|
||||
pub(crate) fn saw(&self, running: &[String]) -> Result<(), FileError> {
|
||||
let now = now();
|
||||
let since = now.saturating_sub(RESIGHTING_SECS);
|
||||
|
||||
@@ -55,7 +55,7 @@ fn icon_side(file: &str) -> Option<u32> {
|
||||
}
|
||||
|
||||
/// The manifest for a theme whose background is `background`, for the computer `machine`. The
|
||||
/// icon already says Luxe, so a named one's home screen label is the computer: an app for each of
|
||||
/// icon already says luxe, so a named one's home screen label is the computer: an app for each of
|
||||
/// two computers tells itself apart.
|
||||
fn manifest_json(background: &str, machine: Option<&str>) -> serde_json::Value {
|
||||
let icon = |side: u32| {
|
||||
@@ -65,7 +65,7 @@ fn manifest_json(background: &str, machine: Option<&str>) -> serde_json::Value {
|
||||
serde_json::json!({
|
||||
"id": "/",
|
||||
"name": app_name(machine),
|
||||
"short_name": machine.unwrap_or("Luxe"),
|
||||
"short_name": machine.unwrap_or("luxe"),
|
||||
"start_url": "/",
|
||||
"scope": "/",
|
||||
"display": "standalone",
|
||||
@@ -75,9 +75,9 @@ fn manifest_json(background: &str, machine: Option<&str>) -> serde_json::Value {
|
||||
})
|
||||
}
|
||||
|
||||
/// The app's name: `Luxe · desk` for the computer `desk`, or plain Luxe unnamed.
|
||||
/// The app's name: `luxe · desk` for the computer `desk`, or plain luxe unnamed.
|
||||
pub(crate) fn app_name(machine: Option<&str>) -> String {
|
||||
machine.map_or_else(|| "Luxe".to_owned(), |machine| format!("Luxe \u{00b7} {machine}"))
|
||||
machine.map_or_else(|| "luxe".to_owned(), |machine| format!("luxe \u{00b7} {machine}"))
|
||||
}
|
||||
|
||||
/// The active theme's tile colors, read off the async threads like the stylesheet.
|
||||
|
||||
@@ -10,8 +10,8 @@ fn theme(pairs: &[(&str, ColorValue)]) -> HashMap<String, ColorValue> {
|
||||
fn the_manifest_is_pinned() {
|
||||
let expected = serde_json::json!({
|
||||
"id": "/",
|
||||
"name": "Luxe",
|
||||
"short_name": "Luxe",
|
||||
"name": "luxe",
|
||||
"short_name": "luxe",
|
||||
"start_url": "/",
|
||||
"scope": "/",
|
||||
"display": "standalone",
|
||||
@@ -26,16 +26,16 @@ fn the_manifest_is_pinned() {
|
||||
}
|
||||
|
||||
/// A named bridge's app is named for its computer, and the home screen label is the computer
|
||||
/// alone, since the icon already says Luxe.
|
||||
/// alone, since the icon already says luxe.
|
||||
///
|
||||
/// The break this catches: two computers' apps both suggested as "Luxe", so the phone shows two
|
||||
/// The break this catches: two computers' apps both suggested as "luxe", so the phone shows two
|
||||
/// identical icons, or the full name crowding the home screen's short label.
|
||||
#[test]
|
||||
fn a_named_bridge_names_its_app_for_the_computer() {
|
||||
let named = manifest_json("#12100e", Some("desk"));
|
||||
assert_eq!(
|
||||
(named["name"].as_str(), named["short_name"].as_str()),
|
||||
(Some("Luxe \u{00b7} desk"), Some("desk"))
|
||||
(Some("luxe \u{00b7} desk"), Some("desk"))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Launch — starting a session for a device: in a herdr pane when herdr is running, otherwise as a
|
||||
//! `luxe --rpc` child of the bridge.
|
||||
//!
|
||||
//! Either way the new Luxe shares its session like any other, so a device joins it through the
|
||||
//! Either way the new luxe shares its session like any other, so a device joins it through the
|
||||
//! same route as one started at the desk. The bridge learns which session is the new one by
|
||||
//! watching for its record in the runtime folder.
|
||||
|
||||
@@ -20,7 +20,7 @@ use crate::folders::{self, Folder, FolderBook};
|
||||
|
||||
pub(crate) use herdr::Herdr;
|
||||
|
||||
/// How long a new Luxe gets to share its session. It takes about a second.
|
||||
/// How long a new luxe gets to share its session. It takes about a second.
|
||||
const APPEAR_TIMEOUT: Duration = Duration::from_secs(20);
|
||||
/// How often the runtime folder is reread while waiting.
|
||||
const APPEAR_POLL: Duration = Duration::from_millis(250);
|
||||
@@ -47,7 +47,7 @@ pub(crate) enum LaunchError {
|
||||
/// The child couldn't be started
|
||||
#[error("couldn't start luxe: {0}")]
|
||||
Spawn(#[source] std::io::Error),
|
||||
/// Luxe started but no session showed up in time
|
||||
/// luxe started but no session showed up in time
|
||||
#[error("luxe started in {0} but didn't share a session within 20 seconds")]
|
||||
NeverAppeared(String),
|
||||
}
|
||||
@@ -87,16 +87,16 @@ impl Launcher {
|
||||
(listed.await.unwrap_or_default(), in_herdr)
|
||||
}
|
||||
|
||||
/// Notes the folders Luxe is running in, for the list a device starts sessions from.
|
||||
/// Notes the folders luxe is running in, for the list a device starts sessions from.
|
||||
pub(crate) async fn saw(&self, running: Vec<String>) {
|
||||
let book = self.folders.clone();
|
||||
let noted = tokio::task::spawn_blocking(move || book.saw(&running)).await;
|
||||
if let Ok(Err(error)) = noted {
|
||||
tracing::warn!(%error, "could not note the folders Luxe is running in");
|
||||
tracing::warn!(%error, "could not note the folders luxe is running in");
|
||||
}
|
||||
}
|
||||
|
||||
/// Starts Luxe in `folder` and waits for the session it shares.
|
||||
/// Starts luxe in `folder` and waits for the session it shares.
|
||||
pub(crate) async fn start(
|
||||
&self,
|
||||
folder: &Path,
|
||||
@@ -210,7 +210,7 @@ async fn appeared(
|
||||
|
||||
/// The session in `running` that wasn't there `before` and works on `folder`.
|
||||
///
|
||||
/// "Works on" rather than "is in": a Luxe started in a subfolder of a repository shares the
|
||||
/// "Works on" rather than "is in": a luxe started in a subfolder of a repository shares the
|
||||
/// repository's root as its folder.
|
||||
fn newcomer(running: &[LiveSession], before: &HashSet<u32>, folder: &Path) -> Option<LiveSession> {
|
||||
let folder = folder.canonicalize().ok()?;
|
||||
|
||||
@@ -24,7 +24,7 @@ fn a_tilde_is_the_home_folder() {
|
||||
|
||||
/// A relative path is refused rather than resolved against wherever the bridge happens to run.
|
||||
///
|
||||
/// The break this catches: dropping the full-path check, so `app` starts Luxe in the service's
|
||||
/// The break this catches: dropping the full-path check, so `app` starts luxe in the service's
|
||||
/// working folder, which nobody chose.
|
||||
#[test]
|
||||
fn a_relative_path_is_refused() {
|
||||
@@ -52,7 +52,7 @@ fn only_a_folder_that_exists_is_accepted() {
|
||||
///
|
||||
/// The break this catches, one per session in the list: answering with a session that was already
|
||||
/// running there (1), or one that started elsewhere at the same moment (2). The last one is found
|
||||
/// because a Luxe started in a repository's subfolder shares the repository's root.
|
||||
/// because a luxe started in a repository's subfolder shares the repository's root.
|
||||
#[test]
|
||||
fn the_new_session_is_the_one_that_appeared_where_it_was_asked_for() {
|
||||
let root = tempfile::tempdir().unwrap();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Luxe remote — the bridge between your own devices and the sessions running on this machine.
|
||||
//! luxe remote — the bridge between your own devices and the sessions running on this machine.
|
||||
//!
|
||||
//! Each running Luxe shares its session on a local endpoint only this user can open
|
||||
//! Each running luxe shares its session on a local endpoint only this user can open
|
||||
//! (`luxe_core::local_endpoint`). The bridge is the one thing that puts those sessions on a
|
||||
//! network, and only on the loopback interface: Tailscale Serve carries it to your tailnet and does
|
||||
//! the HTTPS. A phone lists the sessions over HTTP and joins one over a WebSocket, which the bridge
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Pair with Luxe</title>
|
||||
<title>Pair with luxe</title>
|
||||
<style>
|
||||
body { background: #161616; color: #d8d8d8; font: 15px/1.5 ui-monospace, monospace; margin: 2rem; }
|
||||
h1 { font-size: 1rem; color: #e0b46c; }
|
||||
@@ -12,7 +12,7 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Pair this device with Luxe</h1>
|
||||
<h1>Pair this device with luxe</h1>
|
||||
<form id="pair">
|
||||
<label>Device name <input id="name" autocomplete="off"></label>
|
||||
<button>Pair</button>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//! Web Push, as iOS has offered it to home-screen web apps since 16.4: a device that opted in
|
||||
//! gives the bridge a subscription, and the bridge posts each notification, sealed so only that
|
||||
//! device can read it, straight to the push service the subscription names (Apple's, for an
|
||||
//! iPhone). There is no Luxe server in between, and the push service sees when, not what.
|
||||
//! iPhone). There is no luxe server in between, and the push service sees when, not what.
|
||||
//!
|
||||
//! [`watch`] hears what the sessions are waiting for, and [`notify`] takes each notice to every
|
||||
//! subscribed device that doesn't have that session open in front of it.
|
||||
|
||||
@@ -77,7 +77,10 @@ impl Reading {
|
||||
fn prompt(&self, event: &Event) -> Option<Heard> {
|
||||
let (id, body) = match event {
|
||||
Event::PermissionRequested { id, tool, .. } => (id.as_str(), format!("Approve {tool}")),
|
||||
Event::QuestionAsked { id, .. } => (id.as_str(), "Luxe has a question".to_string()),
|
||||
// The agent asks, not the app: luxe is the title the notification already carries
|
||||
Event::QuestionAsked { id, .. } => {
|
||||
(id.as_str(), "The agent has a question for you".to_string())
|
||||
}
|
||||
_ => return None,
|
||||
};
|
||||
Some(Heard::Prompt(id.to_string(), self.notice(body, true)))
|
||||
@@ -102,7 +105,7 @@ impl Reading {
|
||||
|
||||
/// Whether `event` shows a turn running. The engine says so with `TurnStarted`, which comes
|
||||
/// first; the message that opened the turn, or anything it streams, stands in for it from a
|
||||
/// session whose Luxe predates that event.
|
||||
/// session whose luxe predates that event.
|
||||
fn is_turn_sign(event: &Event) -> bool {
|
||||
match event {
|
||||
Event::TurnStarted
|
||||
|
||||
@@ -38,7 +38,7 @@ fn a_prompt_says_what_waits_and_never_the_detail() {
|
||||
let asked = reading().read(&event(PERMISSION), now);
|
||||
assert_eq!(asked, Some(Heard::Prompt("perm:1".into(), notice("Approve bash", true))));
|
||||
let asked = reading().read(&event(QUESTION), now);
|
||||
let expected = Heard::Prompt("ask:1".into(), notice("Luxe has a question", true));
|
||||
let expected = Heard::Prompt("ask:1".into(), notice("The agent has a question for you", true));
|
||||
assert_eq!(asked, Some(expected));
|
||||
assert_eq!(reading().read(&event(CLOSED), now), Some(Heard::Closed("perm:1".into())));
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ async fn a_prompt_answered_in_time_is_never_sent() {
|
||||
let (mut heard, mut joined, _watcher) = watched(&mut session).await;
|
||||
say(&mut joined, &[PERMISSION, QUESTION, CLOSED]).await;
|
||||
let notice = heard.recv().await.expect("a notice");
|
||||
assert_eq!(notice.body, "Luxe has a question");
|
||||
assert_eq!(notice.body, "The agent has a question for you");
|
||||
tokio::time::sleep(PROMPT_GRACE * 2).await;
|
||||
assert!(heard.try_recv().is_err(), "the answered prompt was sent");
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ async fn line_to_device(
|
||||
}
|
||||
|
||||
/// Whether `line` is the session refusing the bridge's `introduce`. Only a session started before
|
||||
/// its Luxe knew the action does, and it carries on without the device's name; the refusal is of a
|
||||
/// its luxe knew the action does, and it carries on without the device's name; the refusal is of a
|
||||
/// frame the device never sent, so showing it there reads as a fault. Decoded only when it could
|
||||
/// be one, so every other line still passes untouched.
|
||||
fn refuses_introduction(line: &str) -> bool {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//!
|
||||
//! Markdown, highlighted code, tool glyphs and the status line's wording are the TUI's, and the
|
||||
//! bridge doesn't depend on the TUI, so `luxe-cli` hands one in as a [`Renderer`]. What a user
|
||||
//! message shows (the reader's own words, and a brief Luxe wrote to the agent as one line saying
|
||||
//! message shows (the reader's own words, and a brief luxe wrote to the agent as one line saying
|
||||
//! so) is core's call (`luxe_core::briefs`), so that is made here. The bridge keeps no session
|
||||
//! state, so the app asks: once for a finished message, and a few times a second for one still
|
||||
//! growing or a status that changed.
|
||||
@@ -283,7 +283,7 @@ pub(crate) struct Rendered {
|
||||
/// `piece` as the app's HTML.
|
||||
pub(crate) fn render(renderer: &dyn Renderer, piece: &Piece) -> String {
|
||||
match piece {
|
||||
// what the agent wrote for Luxe to read (a remediation report, a draft) isn't the reader's
|
||||
// what the agent wrote for luxe to read (a remediation report, a draft) isn't the reader's
|
||||
Piece::Answer { text } => renderer.markdown(&briefs::for_the_reader(text), Voice::Answer),
|
||||
Piece::Reasoning { text } => renderer.markdown(text, Voice::Reasoning),
|
||||
Piece::User { content } => user_message(content) + &images_attached(renderer, content),
|
||||
|
||||
@@ -135,7 +135,7 @@ fn words_alone_say_nothing_is_attached() {
|
||||
assert_eq!(html, "<p class=\"words\">hi</p>");
|
||||
}
|
||||
|
||||
/// The break this catches: a brief Luxe wrote shown whole, as a page of instructions in the
|
||||
/// The break this catches: a brief luxe wrote shown whole, as a page of instructions in the
|
||||
/// reader's colors.
|
||||
#[test]
|
||||
fn a_brief_shows_as_one_line() {
|
||||
|
||||
@@ -46,7 +46,7 @@ pub enum ServiceError {
|
||||
detail: String,
|
||||
},
|
||||
/// Nowhere to put a service: no home folder, or a platform without a per-user service manager
|
||||
#[error("this system has no per-user service manager Luxe knows how to use")]
|
||||
#[error("this system has no per-user service manager luxe knows how to use")]
|
||||
Unsupported,
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
use super::Launch;
|
||||
|
||||
const TEMPLATE: &str = "[Unit]
|
||||
Description=Luxe remote: your sessions on your own devices
|
||||
Description=luxe remote: your sessions on your own devices
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
|
||||
@@ -22,7 +22,7 @@ type DeviceSocket =
|
||||
const SESSION: &str = "5898d57b-0000-4000-8000-000000000001";
|
||||
const OWNER: &str = "alex@github";
|
||||
|
||||
/// A session as a running Luxe shares it: an endpoint, and its record beside it.
|
||||
/// A session as a running luxe shares it: an endpoint, and its record beside it.
|
||||
struct FakeSession {
|
||||
listener: EndpointListener,
|
||||
_record: Publication,
|
||||
@@ -170,7 +170,7 @@ async fn the_bridge_listens_on_loopback_only() {
|
||||
|
||||
/// The list names running sessions and keeps their local address on this machine.
|
||||
///
|
||||
/// The break this catches: listing a record whose Luxe has died, which the app shows as a session
|
||||
/// The break this catches: listing a record whose luxe has died, which the app shows as a session
|
||||
/// that fails to open; or sending the endpoint's path, which means nothing off this machine.
|
||||
#[tokio::test]
|
||||
async fn the_list_shows_running_sessions_without_their_address() {
|
||||
@@ -286,7 +286,7 @@ async fn starting_in_a_folder_that_isnt_there_is_refused() {
|
||||
assert!(refused.text().await.unwrap().contains("isn't a folder"));
|
||||
}
|
||||
|
||||
/// The folders a device can start in include the ones Luxe is running in, counted.
|
||||
/// The folders a device can start in include the ones luxe is running in, counted.
|
||||
///
|
||||
/// The break this catches: listing only remembered folders, so a project open at the desk right
|
||||
/// now is missing from the phone's list until it's been seen once before.
|
||||
|
||||
@@ -30,7 +30,7 @@ impl Renderer for Sketch {
|
||||
/// paired with two computers keeps two apps it can tell apart.
|
||||
///
|
||||
/// The break this catches: the name set on the bridge but never reaching the routes that read it,
|
||||
/// so both computers' apps are added as "Luxe".
|
||||
/// so both computers' apps are added as "luxe".
|
||||
#[tokio::test]
|
||||
async fn a_named_bridge_serves_an_app_named_for_its_computer() {
|
||||
let bridge = harness_with(|bridge| bridge.named("desk")).await;
|
||||
|
||||
Reference in New Issue
Block a user