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:
59
crates/luxe-remote/app-tests/connection.test.mjs
Normal file
59
crates/luxe-remote/app-tests/connection.test.mjs
Normal file
@@ -0,0 +1,59 @@
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
/** A WebSocket that only records: the test plays the browser's part. */
|
||||
class FakeSocket {
|
||||
static OPEN = 1;
|
||||
static made = [];
|
||||
constructor(url) {
|
||||
this.url = url;
|
||||
this.closedWith = null;
|
||||
FakeSocket.made.push(this);
|
||||
}
|
||||
close(code) {
|
||||
this.closedWith = code;
|
||||
}
|
||||
}
|
||||
|
||||
const page = /** @type {EventTarget & { visibilityState: string }} */ (Object.assign(new EventTarget(), { visibilityState: "visible" }));
|
||||
Object.assign(globalThis, { document: page, WebSocket: FakeSocket, location: { protocol: "http:", host: "bridge" } });
|
||||
const { connect } = await import("../app/connection.js");
|
||||
|
||||
function show(state) {
|
||||
page.visibilityState = state;
|
||||
page.dispatchEvent(new Event("visibilitychange"));
|
||||
}
|
||||
|
||||
function joined() {
|
||||
FakeSocket.made = [];
|
||||
const statuses = [];
|
||||
const link = connect("s-1", { onFrame: () => {}, onStatus: (status) => statuses.push(status) });
|
||||
return { link, statuses };
|
||||
}
|
||||
|
||||
// The break this catches: a socket held open while the app is hidden, so the bridge thinks you're
|
||||
// looking and never notifies you, or a hidden app's close taken for the session ending.
|
||||
test("the socket closes while the app is hidden and opens again on return", () => {
|
||||
const { link, statuses } = joined();
|
||||
const first = FakeSocket.made[0];
|
||||
first.onopen();
|
||||
show("hidden");
|
||||
assert.equal(first.closedWith, 1000);
|
||||
first.onclose?.({ code: 1000 });
|
||||
assert.ok(!statuses.includes("ended"), `${statuses}`);
|
||||
show("visible");
|
||||
assert.equal(FakeSocket.made.length, 2, "a new socket on return");
|
||||
assert.deepEqual(statuses, ["connecting", "live", "connecting"]);
|
||||
link.close();
|
||||
});
|
||||
|
||||
// The break this catches: a session opened while the app is out of sight (a retry coming due, or
|
||||
// a load in the background), holding a socket open with nobody looking.
|
||||
test("nothing opens while the app is hidden", () => {
|
||||
show("hidden");
|
||||
const { link } = joined();
|
||||
assert.equal(FakeSocket.made.length, 0);
|
||||
show("visible");
|
||||
assert.equal(FakeSocket.made.length, 1);
|
||||
link.close();
|
||||
});
|
||||
Reference in New Issue
Block a user