Repository navigation
Conversation
Lite mode is not a browser preference. What it changes — which model catalogue
gets loaded, how long an idle session is kept warm, how much memory the service
aims to stay under — are resources the server shares, so a per-device switch
meant two browsers on one Pi-Web disagreed about the same process.
Lite mode now lives in one Pi-Web-owned file, ~/.pi/agent/pi-web-settings.json
({version, lite: {enabled, idleMinutes, memoryTargetMiB}}), read and written by
the server and shared by every client. GET /api/lite reports the configuration
with the bounds each value is validated against; PUT changes it as a partial
update through the same request-security check every other mutating route uses.
General settings gains the Session lifetime section that edits it, and a client
that reads the shared value no longer keeps a copy of its own in localStorage.
The stored values are policy, so a missing, damaged or hand-edited file falls
back to the defaults instead of failing a read, and a file that cannot be parsed
is never overwritten. Nothing changes how the service behaves yet: the switch
and the numbers are stored and reported, and the session-lifetime, model and
memory work that acts on them arrives in the follow-ups.
Listing models or providers built a full AgentSessionServices, which imports and runs every configured extension; an extension such as AFT spawns a helper process per load, and the model settings panel triggered several of those. Lite mode never shows extension-registered models, so those loads are pure cost. A Lite read now builds its runtime directly — ModelRuntime.create with auth.json and models.json, the same credential and models.json surface that createAgentSessionServices() assembles, minus the resource loader that imports the extension set. Normal mode is unchanged. Two things keep that from changing what anyone sees: - the models cache is keyed by catalog, not only by directory, so a Lite and a normal load of the same cwd never share an entry (switching the mode cannot keep serving the other catalog for a TTL); - anything that decides a *write* still resolves against the full runtime (`PUT /api/models/enabled`), because a Lite catalog cannot tell a genuinely stale entry from one whose provider an extension registers — pruning against it would drop a plugin-registered model out of the model scope. Which catalog a read gets follows the instance's Lite setting, never a request header, so no client can ask for the extension-loading one and one device's choice never reaches another. The two places the difference shows say so: a session whose model is missing from the list keeps using it (the model is never switched silently) and gets a banner explaining why, and the model settings panel states that it is showing the built-in plus models.json catalog.
Lite mode answers the model and provider reads from the built-in catalogue plus
models.json, which is what keeps those reads from loading any extension. The
trade: a provider an extension registers is not in that list, so a session
pinned to one of its models cannot be changed from the selector.
`lite.extensionModels` (off by default) puts those reads back on the full
catalogue — extension-registered providers show up exactly as they do in normal
mode. What it does *not* change is the rest of the mode: session lifetime, the
idle window and the memory target stay Lite's. Only the catalogue the reads
answer from moves.
- `lib/lite-config.ts`: the field, its default, and its coercion; `PUT
/api/lite` accepts it like the other fields.
- `lib/lite-config-settings.ts`: `readsUseLiteCatalog()` is the single predicate
the reads ask ("Lite, and extensions excluded"), so no route spells the
combination out on its own.
- Settings → Session lifetime: the switch, rendered only while Lite mode is on,
with its cost written next to it.
- The cache key keeps separating the two catalogues, so flipping the switch
cannot serve the other list for a TTL.
The switch's copy promised that a read closes the session it created, which is what the full-catalogue read does *after* the release fix lands — not what this change does on its own. Say what the switch actually costs instead: the reads answer from the full extension-backed catalogue, at a resource cost comparable to a normal-mode model read. The composer banner gains the same precision: a model can be missing from the list while the switch is on (an extension that did not register it), so the suggestion names the switch as well as turning Lite mode off.
This was referenced Sep 30, 2026
Owner
|
Thanks @HoloNova. Splitting #984 into reviewable pieces and writing down what was deliberately left out made this much easier to evaluate. After reading the series, though, I'm closing the Lite mode feature PRs (#999, #1000, #1002, #1004):
Focused fixes like #997 and #1003 are very welcome. Thanks again for the depth of the work here. Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Listing models or providers built a full
AgentSessionServices, which importsand runs every configured extension. An extension such as AFT spawns a helper
process per load, and the model settings panel triggered several of those. Lite
mode never shows extension-registered models, so for a Lite instance that work
is pure cost — it was the whole cost of the read.
How
A Lite read builds its runtime directly:
ModelRuntime.create()withauth.jsonandmodels.json— the same credential store andmodels.jsonsurface
createAgentSessionServices()assembles — minus the resource loaderthat imports the extension set. It also skips the project-trust gate, which
exists to keep a repository's extensions from running (
lib/model-runtime.ts,app/api/models/route.ts).Which catalog a read gets follows the instance's Lite setting, never a
request. There is no mode header: no client can ask for the
extension-loading catalog, and one device's choice never reaches another.
Provider listing and API-key login follow the same rule
(
/api/auth/providers,/api/auth/api-key/[provider]): Lite offers exactlythe providers it can sign in to, so no extension has to load to answer.
The models cache is keyed by catalog, not only by directory
(
modelsCacheKey()). Without that split, switching the mode could keep servingthe other catalog for a full TTL.
Writes never resolve against the Lite catalog.
PUT /api/models/enabledalways loads the full runtime: a Lite catalog cannot tell a genuinely stale
entry from one whose provider an extension registers, so a first toggle would
materialize a scope that leaves plugin-registered models out, and
prunewould delete their entries. Only the view it returns follows the mode.
What a user sees
switched silently — and the composer shows a banner explaining that Lite lists
built-in and
models.jsonmodels only(
isModelMissingFromLiteCatalog()).extension-registered provider not appearing in the list is not mistaken for a
setting having been removed.
Stacking
Stacked on #999 (server-wide Lite configuration), which this reads through
readLiteConfig(); until that lands the diff below contains its files too, afterwhich this is rebased onto
mainand the diff becomes this PR only. Opened as adraft for that reason — it will be force-pushed.
Verified
Whole suite: 1351 tests, 0 failures;
tsc --noEmitandeslint .clean.New coverage: the Lite runtime is
ModelRuntime.createand never callscreateAgentSessionServices()(an aliased SDK stub records the factory), thecache keeps Lite and normal entries apart, provider listing and API-key login
pick the Lite catalog from the instance setting (and reach the credential store),
the enabledModels write path always loads the full runtime, and a first toggle on
a Lite-sized catalog would drop a plugin provider's models — which is the reason
writes do not use it.
And a switch:
lite.extensionModelsLite mode answers those reads from the built-in catalogue plus
models.json,which is what keeps them from loading any extension. The trade is that a
provider an extension registers is not in the list, so a session pinned to one
of its models cannot be changed from the selector — it keeps working, and the
composer says why it is not selectable.
lite.extensionModels(off by default, Settings → Session lifetime, shownonly while Lite mode is on) puts the reads back on the full catalogue:
extension-registered providers appear exactly as they do in normal mode, at a
resource cost comparable to a normal-mode model read. It changes nothing else
about the mode — session lifetime, the idle window and the memory target stay
Lite's.
Implemented as one predicate,
readsUseLiteCatalog(), so a route never spellsthe combination out itself, and the models cache keeps separating the two
catalogues (
modelsCacheKey(cwd, lite)), so flipping the switch cannot servethe other list for a TTL.