Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

fix(web): keep Settings reachable while waiting for a ready Computer

Dongdong Chend678774cc2ba
diff --git a/apps/web/src/features/local-computer/local-computer-gate.test.tsx b/apps/web/src/features/local-computer/local-computer-gate.test.tsx
index 9f25feb6..711206a8 100644
--- a/apps/web/src/features/local-computer/local-computer-gate.test.tsx
+++ b/apps/web/src/features/local-computer/local-computer-gate.test.tsx
@@ -1,5 +1,12 @@
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
-import { act, render, screen, waitFor, within } from "@testing-library/react";
+import {
+ act,
+ fireEvent,
+ render,
+ screen,
+ waitFor,
+ within,
+} from "@testing-library/react";
import { Suspense } from "react";
import { createMemoryRouter, RouterProvider } from "react-router";
import { describe, expect, it } from "vitest";
@@ -12,33 +19,34 @@ import { createTestTeamHubRuntime } from "@/test/teamhub-test-runtime";
type LocalComputer = TeamHubLocalComputerPage["items"][number];
+const newMac: LocalComputer = {
+ active_operations: 0,
+ available_capacity: 2,
+ capacity: 2,
+ computer_id: "computer-new-mac",
+ display_name: "New Mac",
+ runtimes: [
+ {
+ models: [],
+ status: "authentication_required",
+ type: "claude",
+ version: "2.1.0",
+ },
+ ],
+ status: "online",
+ upgrade_required: false,
+ workspace_grants: [
+ {
+ grant_id: "grant-managed",
+ label: "Linger managed workspace",
+ mode: "workspace-write",
+ },
+ ],
+};
+
describe("Local Computer gate", () => {
it("covers the product until a Computer runs an AI app, then opens the Another Me Chat", async () => {
- const computer: LocalComputer = {
- active_operations: 0,
- available_capacity: 2,
- capacity: 2,
- computer_id: "computer-new-mac",
- display_name: "New Mac",
- runtimes: [
- {
- models: [],
- status: "authentication_required",
- type: "claude",
- version: "2.1.0",
- },
- ],
- status: "online",
- upgrade_required: false,
- workspace_grants: [
- {
- grant_id: "grant-managed",
- label: "Linger managed workspace",
- mode: "workspace-write",
- },
- ],
- };
- const fixture = renderShell(computer);
+ const fixture = renderShell(newMac);
const gate = await screen.findByRole("dialog", {
name: "Connect your computer",
@@ -71,6 +79,63 @@ describe("Local Computer gate", () => {
expect(screen.getByText("Shell content").closest("[inert]")).toBeNull();
});
+ it("lets a Computer with no ready app open Settings to load a local model", async () => {
+ // Pi with no model yet: nothing can run Another Me until one is loaded.
+ const fixture = renderShell({
+ ...newMac,
+ runtimes: [
+ {
+ models: [],
+ status: "authentication_required",
+ type: "pi",
+ version: "1.4.0",
+ },
+ ],
+ });
+
+ const gate = await screen.findByRole("dialog", {
+ name: "Connect your computer",
+ });
+ fireEvent.click(
+ await within(gate).findByRole("link", { name: "Local models" }),
+ );
+
+ await waitFor(() =>
+ expect(fixture.router.state.location.pathname).toBe(
+ "/t/tenant-northstar/settings/local-models",
+ ),
+ );
+ expect(fixture.router.state.location.search).toBe(
+ "?computer=computer-new-mac",
+ );
+ expect(
+ screen.queryByRole("dialog", { name: "Connect your computer" }),
+ ).toBeNull();
+ expect(screen.getByText("Shell content").closest("[inert]")).toBeNull();
+
+ // Loading the model creates Another Me; the owner stays on Settings.
+ fixture.anotherMe = {
+ agent_actor_id: "actor-anotherme",
+ room_id: "room-another-me",
+ };
+ await act(() =>
+ fixture.queryClient.invalidateQueries({
+ queryKey: anotherMeQueryKey("tenant-northstar"),
+ }),
+ );
+ expect(fixture.router.state.location.pathname).toBe(
+ "/t/tenant-northstar/settings/local-models",
+ );
+ });
+
+ it("keeps covering the rest of the product while Another Me is missing", async () => {
+ renderShell(newMac, "/t/tenant-northstar/rooms/room-1/chat");
+ expect(
+ await screen.findByRole("dialog", { name: "Connect your computer" }),
+ ).toBeVisible();
+ expect(screen.getByText("Shell content").closest("[inert]")).not.toBeNull();
+ });
+
it("waits for the CLI login while no Computer is connected", async () => {
renderShell();
@@ -87,7 +152,10 @@ describe("Local Computer gate", () => {
});
});
-function renderShell(computer?: LocalComputer) {
+function renderShell(
+ computer?: LocalComputer,
+ path = "/t/tenant-northstar/rooms",
+) {
const runtime = createTestTeamHubRuntime();
const fixture: {
anotherMe: { agent_actor_id?: string; room_id?: string };
@@ -106,7 +174,7 @@ function renderShell(computer?: LocalComputer) {
children: [{ path: "*", element: <p>Shell content</p> }],
},
],
- { initialEntries: ["/t/tenant-northstar/rooms"] },
+ { initialEntries: [path] },
),
};
runtime.server
diff --git a/apps/web/src/features/local-computer/local-computer-gate.tsx b/apps/web/src/features/local-computer/local-computer-gate.tsx
index 486b9414..65aff397 100644
--- a/apps/web/src/features/local-computer/local-computer-gate.tsx
+++ b/apps/web/src/features/local-computer/local-computer-gate.tsx
@@ -1,6 +1,7 @@
import { Tick02Icon } from "@hugeicons/core-free-icons";
import { useQuery } from "@tanstack/react-query";
import { type ReactNode, useState } from "react";
+import { Link } from "react-router";
import { Button } from "@/components/ui/button";
import { Icon } from "@/components/ui/icon";
@@ -48,7 +49,8 @@ const statusLabels: Record<RuntimeStatus, string> = {
* Every model call, Another Me's included, runs on the Human's own Computer,
* so this build has nothing to offer before one runs an AI app. TeamHub
* creates Another Me the first time such a Computer comes online; until then
- * this gate covers the product. It exists only while no hosted runtime does.
+ * this gate covers the product except Settings, where a Pi-only Computer
+ * loads its first local model. It exists only while no hosted runtime does.
*/
export function LocalComputerGate({
onSignOut,
@@ -143,7 +145,7 @@ export function LocalComputerGate({
title="Set up an AI app"
>
{computer && online ? (
- <AppSetup computer={computer} />
+ <AppSetup computer={computer} tenantId={tenantId} />
) : (
<p className="mt-1 text-xs text-muted-foreground">
Available once your computer is online.
@@ -207,7 +209,13 @@ function ConnectionStatus({
);
}
-function AppSetup({ computer }: { computer: LocalComputer }) {
+function AppSetup({
+ computer,
+ tenantId,
+}: {
+ computer: LocalComputer;
+ tenantId: string;
+}) {
const missing = appOrder.filter(
(app) => appStatus(computer, app) === "not_installed",
);
@@ -237,6 +245,16 @@ function AppSetup({ computer }: { computer: LocalComputer }) {
runtimeTypes={missing}
/>
) : null}
+ <p className="text-xs text-muted-foreground">
+ Or run a model on {computer.display_name} itself: load one in{" "}
+ <Link
+ className="text-foreground underline underline-offset-2"
+ to={`/t/${encodeURIComponent(tenantId)}/settings/local-models?computer=${encodeURIComponent(computer.computer_id)}`}
+ >
+ Local models
+ </Link>
+ .
+ </p>
<p
className="flex items-center gap-1.5 text-xs text-muted-foreground"
role="status"
diff --git a/apps/web/src/features/rooms/room-shell.tsx b/apps/web/src/features/rooms/room-shell.tsx
index d139025a..8ff451fc 100644
--- a/apps/web/src/features/rooms/room-shell.tsx
+++ b/apps/web/src/features/rooms/room-shell.tsx
@@ -11,6 +11,7 @@ import {
import {
Outlet,
useLocation,
+ useMatch,
useNavigate,
useNavigation,
useParams,
@@ -107,19 +108,24 @@ function RoomShellReady({
// settled lets them land together, instead of the card arriving later and
// pushing every row down.
const navigationPending = roomsQuery.isPending || anotherMeQuery.isPending;
- const gated = anotherMeQuery.isSuccess && !anotherMe?.agent_actor_id;
+ // Settings stays open under the gate: a Computer whose only app is Pi gets
+ // its first model from Settings › Local models.
+ const onSettings = useMatch("/t/:tenantId/settings/*") !== null;
+ const gated =
+ anotherMeQuery.isSuccess && !anotherMe?.agent_actor_id && !onSettings;
const navigate = useNavigate();
const wasGated = useRef(false);
const anotherMeRoomId = anotherMe?.room_id;
- // The gate lands the Human in the Another Me Chat it waited for.
+ // The gate lands the Human in the Another Me Chat it waited for, once they
+ // are back from Settings.
useEffect(() => {
if (gated) {
wasGated.current = true;
- } else if (wasGated.current && anotherMeRoomId) {
+ } else if (wasGated.current && anotherMeRoomId && !onSettings) {
wasGated.current = false;
void navigate(`/t/${tenantId}/rooms/${anotherMeRoomId}/chat`);
}
- }, [anotherMeRoomId, gated, navigate, tenantId]);
+ }, [anotherMeRoomId, gated, navigate, onSettings, tenantId]);
const openRoom = useCallback(
(roomId: string) =>
diff --git a/docs/self-hosting.md b/docs/self-hosting.md
index d85a6a89..2507a589 100644
--- a/docs/self-hosting.md
+++ b/docs/self-hosting.md
@@ -22,7 +22,9 @@ printf '%s\n' 'choose-a-password' | docker compose exec -T teamhub \
Open <http://localhost:3000> and sign in. The app then shows the commands that
connect your computer, and it opens once Claude Code, Codex or Pi is installed
-and signed in there.
+and signed in there. With Pi and no model yet, open Settings › Local models
+from that screen and load one; Settings stays reachable while the rest of the
+app waits.
To serve other computers on your network, set these in `.env`, run
`docker compose stop node-services`, then run