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.
HoloNova
force-pushed
the
pr/lite-config
branch
from
September 30, 2026 02:14
0fe6868 to
2d22f97
Compare
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
Lite mode was a per-device preference (a
localStorageflag). What it changesare resources the server shares: which model catalogue gets loaded, how long
an idle session is kept warm, how much memory the service aims to stay under. A
per-device switch meant two browsers talking to one Pi-Web could disagree about
the same process, and the server had no way to know its own mode.
Lite mode is now one server-wide configuration, owned by Pi-Web.
How
One Pi-Web-owned file,
~/.pi/agent/pi-web-settings.json:{ "version": 1, "lite": { "enabled": false, "idleMinutes": 5, "memoryTargetMiB": 1800 } }It is deliberately not pi's
settings.json,models.json,agents/settings.jsonor any plugin config: those belong to other runtimes and are rewritten wholesale
by them. Reads are tolerant — a missing, damaged or hand-edited file falls back
to the defaults per field, because these values are policy — while a write is
minimal-edit (unknown fields preserved), validates its ranges, and refuses to
overwrite a file it could not parse.
GET /api/litereports the configuration plus the bounds each value isvalidated against (
{ idleMinutes: {min, max, default}, memoryTargetMiB: {...} }),so a client does not have to duplicate the ranges. It is observation only: it
never writes, reclaims or closes anything.
PUT /api/litetakes a partial update ({ "enabled": true }changes onlythat field) and goes through the same
lib/request-security.tscheck everyother mutating route uses — there is no Lite-specific authentication.
Settings → General → Session lifetime edits it through a small client store:
one read per page instead of one per component, re-read when the page becomes
visible again, and the server's answer is what the UI shows after a save. The
copy says it is a server-wide setting, since it now affects every device.
What does not change
Nothing acts on the stored values yet — the switch and the numbers are stored and
reported. The three things the configuration drives arrive as follow-ups that read
it: session lifetime (idle window, presence, reclaim), the Lite model catalogue,
and the memory target with its reclaim policy. Normal-mode behaviour, session
reclaim, model loading and the systemd limits are all untouched by this PR, which
is why the memory target is stored here but not yet exposed in the UI.
Verified
node --experimental-strip-types --test lib/lite-config.test.mjs app/api/lite/route.test.mjs15 tests pass: defaults for a missing/damaged/partially-written file, coercion of
anything that is not a stored configuration, whole-number ranges, merge-on-write
preserving fields Pi-Web does not own, a refused out-of-range write leaving the
file untouched, an unreadable file never overwritten, and the route side — read
creates nothing, a partial write keeps the other fields, invalid or empty bodies
and non-JSON content types are refused with the range in the message, and an
untrusted Host or cross-site request cannot change the configuration.
tsc --noEmitandeslintclean.