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): hide the Subscription model source tab
Dongdong Chencf4ba2a40fea
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.mdindex f126140c..123017bd 100644--- a/apps/web/AGENTS.md+++ b/apps/web/AGENTS.md@@ -24,9 +24,10 @@ build:assets` to check the initial JS budget.- `src/features/teamhub`: Human API, Session, error, and realtime adapters.- `src/features/rooms`: Room routes, Chat, Timeline, the right sidebar (Agent Info, Activity, Thread, Document) and membership UI.- `src/features/local-models`: Settings › Models (`settings/models?computer=<id>`).- Its tabs read and switch the Computer's model source (Local model,- Subscription, BYOK) through TeamHub's `model-source` API, which asks the- Computer live; the page never holds a saved API key, and a switch refused+ Its tabs read and switch the Computer's model source (Local model, BYOK)+ through TeamHub's `model-source` API, which asks the Computer live; the page+ offers no switch to Subscription, and a Computer already on one opens on+ Local model; the page never holds a saved API key, and a switch refusedwith `AGENT_HAS_ACTIVE_RUNS` retries with `force_terminate` only after theowner confirms. The Local model tab is one Computer's model library asTeamHub last stored it. The Computer decidesdiff --git a/apps/web/src/features/local-models/local-models-page.test.tsx b/apps/web/src/features/local-models/local-models-page.test.tsxindex bc7403e9..b09da5a7 100644--- a/apps/web/src/features/local-models/local-models-page.test.tsx+++ b/apps/web/src/features/local-models/local-models-page.test.tsx@@ -2005,7 +2005,7 @@ describe("Model source", () => {return Response.json({computer_id: "computer-lab",online: true,- status: { ...byokStatus, mode: "subscription", runtime: "claude" },+ status: { ...byokStatus, mode: "local", runtime: "pi" },terminated_run_count: 1,updated_agent_count: 2,viewer_is_owner: true,@@ -2013,9 +2013,9 @@ describe("Model source", () => {});await renderPage(fixture);- fireEvent.click(await screen.findByRole("tab", { name: "Subscription" }));+ fireEvent.click(await screen.findByRole("tab", { name: "Local model" }));fireEvent.click(- screen.getByRole("button", { name: "Switch to Claude Code" }),+ await screen.findByRole("button", { name: "Switch to Local model" }),);const dialog = await screen.findByRole("dialog", {name: "End running tasks?",@@ -2027,13 +2027,15 @@ describe("Model source", () => {expect(await screen.findByText(- "Agents now use Subscription · Claude Code. 2 Agents were moved. 1 task was ended.",+ "Agents now use Local model. 2 Agents were moved. 1 task was ended.",),).toBeInTheDocument();- expect(switches).toEqual([- { mode: "subscription", runtime: "claude" },- { force_terminate: true, mode: "subscription", runtime: "claude" },- ]);+ expect(switches).toHaveLength(2);+ expect(switches[0]).toMatchObject({ mode: "local" });+ expect(switches[1]).toEqual({+ ...(switches[0] as object),+ force_terminate: true,+ });});it("shows what the Computer serves after a switch fails", async () => {@@ -2049,7 +2051,7 @@ describe("Model source", () => {status:reads === 1? byokStatus- : { ...byokStatus, mode: "subscription", runtime: "claude" },+ : { ...byokStatus, mode: "local", runtime: "pi" },viewer_is_owner: true,});})@@ -2067,15 +2069,13 @@ describe("Model source", () => {);await renderPage(fixture);- fireEvent.click(await screen.findByRole("tab", { name: "Subscription" }));+ fireEvent.click(await screen.findByRole("tab", { name: "Local model" }));fireEvent.click(- screen.getByRole("button", { name: "Switch to Claude Code" }),+ await screen.findByRole("button", { name: "Switch to Local model" }),);expect(- await screen.findByText(- "Agents on lab-118 use Subscription · Claude Code",- ),+ await screen.findByText("Agents on lab-118 use Local model"),).toBeInTheDocument();expect(reads).toBe(2);});@@ -2124,7 +2124,7 @@ describe("Model source", () => {);await waitFor(() => expect(switches).toHaveLength(1));- fireEvent.click(await screen.findByRole("tab", { name: "Subscription" }));+ fireEvent.click(await screen.findByRole("tab", { name: "Local model" }));fireEvent.click(screen.getByRole("tab", { name: /BYOK/u }));expect(await screen.findByRole("combobox", { name: "Model" }),@@ -2351,13 +2351,16 @@ describe("Model source", () => {});await renderPage(fixture);- const tip = await screen.findByRole("complementary", {- name: "Local model tip",- });- expect(tip).toHaveTextContent("16 GB");- fireEvent.click(- within(tip).getByRole("button", { name: "Open Local model" }),- );+ const tabs = await screen.findByRole("tablist", { name: "Model source" });+ expect(+ within(tabs).getByRole("tab", { name: "Local model", selected: true }),+ ).toBeInTheDocument();+ expect(+ within(tabs).queryByRole("tab", { name: "Subscription" }),+ ).not.toBeInTheDocument();+ expect(+ screen.getByText("Agents on lab-118 use Subscription · Claude Code"),+ ).toBeInTheDocument();const guidance = await screen.findByRole("complementary", {name: "Memory guidance",diff --git a/apps/web/src/features/local-models/local-models-page.tsx b/apps/web/src/features/local-models/local-models-page.tsxindex 8e0e8731..a4b00ac9 100644--- a/apps/web/src/features/local-models/local-models-page.tsx+++ b/apps/web/src/features/local-models/local-models-page.tsx@@ -80,7 +80,6 @@ import {activeSourceLabel,ByokPanel,ModelSourceTabs,- SubscriptionPanel,SwitchToLocalNotice,useModelSourceSwitch,} from "./model-source-panel";@@ -110,7 +109,6 @@ function computersPath(tenantId: string) {return `/t/${tenantId}/settings/computers`;}-type LocalComputerRuntime = InventoryComputer["runtimes"][number];type InventoryComputer = TeamHubLocalComputerPage["items"][number];/**@@ -251,7 +249,6 @@ function ComputerModels({displayName?: string;tenantId: string;}) {- const runtimes: readonly LocalComputerRuntime[] = computer?.runtimes ?? [];const { client } = useTeamHubRuntime();const queryClient = useQueryClient();const query = useQuery(localModelsQueryOptions(client, tenantId, computerId));@@ -266,7 +263,9 @@ function ComputerModels({});const status = source.data?.status;const [tab, setTab] = useState<ModelSourceMode | null>(null);- const shownTab = tab ?? status?.mode ?? "local";+ // A Computer on a subscription opens on Local model, which offers the way+ // off it; the Subscription tab is not offered.+ const shownTab = tab ?? (status?.mode === "byok" ? "byok" : "local");const computerName = displayName ?? "this computer";const { feedback, switcher } = useModelSourceSwitch({computerId,@@ -295,9 +294,6 @@ function ComputerModels({view.computer.status === "online",);const guidance = view?.available ? memoryGuidance(view) : null;- const subscriptionGuidanceCopy = guidance- ? memoryGuidanceCopy(guidance)- : undefined;return (<>@@ -385,34 +381,7 @@ function ComputerModels({</p>) : null}{feedback}- {status && shownTab === "subscription" ? (- <>- <SubscriptionPanel- disabled={switching}- runtimes={runtimes}- status={status}- switcher={switcher}- />- {subscriptionGuidanceCopy ? (- <aside- aria-label="Local model tip"- className="mt-6 flex flex-wrap items-start justify-between gap-3 rounded-xl bg-muted px-4 py-3"- >- <div className="min-w-0 flex-1">- <p className="text-sm font-medium text-foreground">- {subscriptionGuidanceCopy.title}- </p>- <p className="mt-1 text-sm text-muted-foreground">- {subscriptionGuidanceCopy.body}- </p>- </div>- <Button onClick={() => setTab("local")} size="compact">- Open Local model- </Button>- </aside>- ) : null}- </>- ) : status && shownTab === "byok" ? (+ {status && shownTab === "byok" ? (<ByokPanelcomputerId={computerId}disabled={switching}diff --git a/apps/web/src/features/local-models/model-source-panel.tsx b/apps/web/src/features/local-models/model-source-panel.tsxindex 6bcc08df..c3263ebe 100644--- a/apps/web/src/features/local-models/model-source-panel.tsx+++ b/apps/web/src/features/local-models/model-source-panel.tsx@@ -5,7 +5,7 @@ import {useQuery,useQueryClient,} from "@tanstack/react-query";-import { type FormEvent, type ReactNode, useId, useState } from "react";+import { type FormEvent, useId, useState } from "react";import { Button } from "@/components/ui/button";import { Field, fieldControlClassName } from "@/components/ui/field";@@ -17,7 +17,6 @@ import { Hint } from "@/features/local-computer/computer-hint";import { localComputersQueryKey } from "@/features/local-computer/local-computer-queries";import { TeamHubError } from "@/features/teamhub/teamhub-error";import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";-import type { TeamHubLocalComputerPage } from "@/features/teamhub/teamhub-types";import { cn } from "@/lib/cn";import {@@ -46,11 +45,10 @@ import {testByokEndpoint,} from "./model-source-queries";-type LocalComputerRuntime =- TeamHubLocalComputerPage["items"][number]["runtimes"][number];--const modes: readonly ModelSourceMode[] = ["local", "subscription", "byok"];-const subscriptionRuntimes = ["claude", "codex"] as const;+// Subscription is not offered: switching to it moves every Agent on the+// Computer to one Runtime without checking that Runtime is signed in, and+// unloads local models.+const modes: readonly ModelSourceMode[] = ["local", "byok"];const byokRuntimes: readonly ModelSourceRuntime[] = ["claude", "codex", "pi"];const byokExplanation =@@ -204,7 +202,7 @@ function TerminateTasksDialog({);}-/** The three model sources as tabs; a dot marks the one in use. */+/** The offered model sources as tabs; a dot marks the one in use. */export function ModelSourceTabs({active,onChange,@@ -257,17 +255,6 @@ export function ModelSourceTabs({);}-function Panel({ children, title }: { children: ReactNode; title: string }) {- return (- <section- aria-label={title}- className="mt-6 rounded-xl border border-border px-4 py-4"- >- {children}- </section>- );-}-/** Offered above the library while the Agents use another source. */export function SwitchToLocalNotice({disabled,@@ -332,89 +319,6 @@ export function SwitchToLocalNotice({);}-const runtimeStateCopy: Partial<- Record<LocalComputerRuntime["status"], string>-> = {- authentication_required: "Signed out",- not_installed: "Not installed",- ready: "Signed in",-};--/** Claude Code and Codex on the person's own subscription accounts. */-export function SubscriptionPanel({- disabled,- runtimes,- status,- switcher,-}: {- disabled: boolean;- runtimes: readonly LocalComputerRuntime[];- status: ModelSourceStatus;- switcher: ModelSourceSwitcher;-}) {- return (- <Panel title="Subscription">- <ul className="grid gap-3">- {subscriptionRuntimes.map((runtime) => {- const active =- status.mode === "subscription" && status.runtime === runtime;- // Off subscription, the Computer checks Runtimes against the- // gateway, so their sign-in state is only known while active.- const state =- status.mode === "subscription"- ? runtimeStateCopy[- runtimes.find((item) => item.type === runtime)?.status ??- "not_installed"- ]- : undefined;- return (- <li- className="flex items-center justify-between gap-4"- key={runtime}- >- <div className="min-w-0">- <p className="text-sm text-foreground">- {modelSourceRuntimeLabels[runtime]}- {active ? (- <span className="ml-2 text-xs text-app-success">- In use- </span>- ) : null}- </p>- <p className="text-xs text-muted-foreground">- {state ? `${state} · ` : ""}- {runtime === "claude"- ? "Anthropic account on this computer"- : "ChatGPT account on this computer"}- </p>- </div>- {active ? null : (- <Button- disabled={disabled}- loading={- switcher.pending?.mode === "subscription" &&- switcher.pending.runtime === runtime- }- onClick={() =>- switcher.request({ mode: "subscription", runtime })- }- size="compact"- >- Switch to {modelSourceRuntimeLabels[runtime]}- </Button>- )}- </li>- );- })}- </ul>- <p className="mt-4 text-xs text-muted-foreground">- Switching to a subscription unloads local models to free memory; their- files stay on disk.- </p>- </Panel>- );-}-/** A listed model: its ID, then its name and context window when known. */function ByokModelOption({ model }: { model: ByokModel }) {const details = [diff --git a/docs/local-inference.md b/docs/local-inference.mdindex e20e2166..f740f872 100644--- a/docs/local-inference.md+++ b/docs/local-inference.md@@ -16,7 +16,8 @@ How agents, approvals and background work share a model is in## Model sourceEach computer serves all of its agents from one source at a time. Setup asks-for it, and **Settings › Models** switches it later.+for it, and **Settings › Models** switches it later to Local model or BYOK; it+does not offer a switch to Subscription.| Source | Runtime | Where the model runs || ------------ | ------------------------ | ------------------------------------------------------------------------------------------ |