Repository navigation
Conversation
allozaur
force-pushed
the
allozaur/chore/ui-sveltekit-3
branch
from
November 16, 2026 16:12
a14fad0 to
1c5a2a1
Compare
This was referenced Nov 16, 2026
llama-server refuses browser requests whose Origin does not match its own host unless --cors-origins allows it, and the Vite proxy forwarded the page's Origin (localhost:5173, or a LAN or Tailscale address). Loading a model, saving tools and /v1 calls failed with 403 under `vite dev`. The proxy now calls the server with its own Host and no Origin, WebSocket upgrades included. Sec-Fetch-Site still passes through, so requests from other sites stay refused. Assisted-by: Claude (Opus 5.5 Medium)
Swap the mdast stub for @types/mdast, move the katex override to 0.19.0, and override glob, source-map and html-encoding-sniffer under workbox-build and http-server so installs no longer pull deprecated packages. Apply the non-breaking npm audit fixes to the lockfile. Assisted-by: Claude (Opus 5.5 Medium)
allozaur
force-pushed
the
allozaur/chore/ui-sveltekit-3
branch
from
November 16, 2026 16:50
1c5a2a1 to
217111c
Compare
allozaur
changed the base branch from
allozaur/refactor/ui-folders
to
master
November 16, 2026 16:50
allozaur
force-pushed
the
allozaur/chore/ui-sveltekit-3
branch
from
November 16, 2026 17:36
217111c to
a6f4a26
Compare
Move to SvelteKit 3, Vite 8, TypeScript 6 and Storybook 10.6. The SvelteKit options move from svelte.config.js into sveltekit() in vite.config.ts, $lib imports become #lib subpath imports from package.json, and $app/environment becomes $app/env. Modules named server.* or living under a server/ folder are server-only in SvelteKit 3, so the llama-server components, store and enums move to llama-server names. @vite-pwa/sveltekit and Workbox give way to SvelteKit's own service worker in src/service-worker, registered by usePwa(), which precaches the app files and leaves API requests to the network. A small plugin emits manifest.webmanifest. static/sw.js removes the worker of older builds, and llama-server serves a self-removing service-worker.js as well as sw.js when the built-in UI is off or replaced. Assisted-by: Claude (Opus 5.5 Medium)
A page the service worker doesn't control now learns of a new build
from SvelteKit itself: `updated` from $app/state checks
_app/version.json on navigation, on focus and every hour. It replaces
the version Llama Chat kept in localStorage and compared by hand.
Reload on the update prompt pulls in the new worker and activates it
before reloading, so one click lands on the new build, whether or not
a worker controlled the page.
Following Svelte's current guidance:
- usePwa keeps its state in $state rather than a store, and no effect
checks `browser`
- nearViewport, autoResizeTextarea and the custom CSS injection are
attachments ({@Attach}) rather than actions (use:)
- class lists use arrays rather than class: directives
- the chat contexts come from createContext, typed, in place of
setContext/getContext with string keys
- ActionIconCopyToClipboard takes $props() rather than `export let`
Assisted-by: Claude (Opus 5.5 Medium)
ESLint 9 is out of support. Every plugin the app uses supports 10: typescript-eslint, eslint-plugin-svelte, perfectionist, simple-import-sort, eslint-plugin-storybook and eslint-config-prettier. @eslint/js and @eslint/compat follow. ESLint 10's recommended rules ask for two things the code now does: errors rethrown from a catch keep the caught error as their `cause`, and no variable starts with a value that every path overwrites. Assisted-by: Claude (Opus 5.5 Medium)
allozaur
force-pushed
the
allozaur/chore/ui-sveltekit-3
branch
from
November 16, 2026 18:58
a6f4a26 to
045fb8e
Compare
allozaur
force-pushed
the
allozaur/chore/ui-sveltekit-3
branch
from
November 17, 2026 05:21
045fb8e to
1be9bfc
Compare
ESLint 10.14, @eslint/config-array 0.23.5 and typescript-eslint 8.72 depend on minimatch 10, which GHSA-g3hv-75wg-m249 (denial of service via globparts amplification) affects below 11.0.1. Their fixed releases move to minimatch 11 but are all younger than the repo's 7-day min-release-age, so an override pins minimatch 11.0.5, the newest the rule allows. The three only call new Minimatch(), match() and minimatch(), which minimatch 11 keeps. npm audit now finds nothing. Assisted-by: Claude (Opus 5.5 Medium)
allozaur
commented
Nov 17, 2026
| | `DialogConversationRename` | Edit conversation title | | ||
|
|
||
| **Server/Model Components** (`app/server/`, `app/models/`): | ||
| **Server/Model Components** (`app/llama-server/`, `app/models/`): |
Owner
Author
There was a problem hiding this comment.
not fully convinced to this rename... probably would be better to have app/servers
Comment on lines
+15
to
+24
| res.setHeader('Content-Type', 'application/manifest+json'); | ||
| res.end(MANIFEST_SOURCE); | ||
| }); | ||
| }, | ||
| generateBundle() { | ||
| if (this.environment.name !== 'client') return; | ||
|
|
||
| this.emitFile({ fileName: MANIFEST_FILE, source: MANIFEST_SOURCE, type: 'asset' }); | ||
| }, | ||
| name: 'llama-ui:pwa-manifest' |
Owner
Author
There was a problem hiding this comment.
let's get rid of magic strings
allozaur
force-pushed
the
allozaur/chore/ui-sveltekit-3
branch
from
November 17, 2026 10:31
354cae6 to
0c13a21
Compare
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.
Overview
Llama Chat moves to SvelteKit 3, and its offline support to SvelteKit's own service worker. Nothing changes for the user: the app looks and works as before, installs as a PWA and keeps working offline.
Additional information
Part 1 of 12 of the work-in-progress stack on the fork, based on
master, which has the move toui/since ggml-org#32032 was merged. Every layer above it, from the design system (#22) up, builds on SvelteKit 3. It also carries the fork-only commit that the move's fork PR (#54) had on top: the dev proxy calls llama-server without the page's Origin, sovite devpasses the server's cross-origin check from a LAN or Tailscale address.Most of the diff is mechanical: SvelteKit 3 drops
$lib, so every import of the app's own code becomes a#lib/...subpath import. The changes that need a review are the configs, the service worker and a handful of base-path and navigation calls, listed below.What changed
Dependencies
@sveltejs/adapter-static4,@sveltejs/vite-plugin-svelte7, Vite 8, TypeScript 6, Svelte 5.57, Tailwind 4.3.5, Storybook 10.6.6 and ESLint 10. Storybook stays on its stable line: 10.6 runs on Vite 8 and SvelteKit 3, so the 11 alpha the first attempt needed is no longer necessary.min-release-age=7holds every version to one released at least a week ago, except SvelteKit 3.2.0: it was locked on 17 November, hours before its seventh day, with a one-off--min-release-age=0that moved only@sveltejs/kit(its new dependency was already in the lockfile).npm ciinstalls the locked version under the rule.@vite-pwa/sveltekit,workbox-windowand the Workbox overrides go.mdaststub with@types/mdast, moves thekatexoverride to 0.19.0, overrides the deprecated packages underworkbox-buildandhttp-server, and takes the non-breakingnpm auditfixes.minimatchto 11.0.5. ESLint 10.14,@eslint/config-array0.23.5 and typescript-eslint 8.72 depend on minimatch 10, which GHSA-g3hv-75wg-m249 (denial of service through glob patterns) affects below 11.0.1; their own fixed releases are all younger than the repo's 7-daymin-release-age. All three only callnew Minimatch(),match()andminimatch(), which minimatch 11 keeps. The SvelteKit, adapter and Workbox findings left by the first commit go with the move to SvelteKit 3, sonpm auditfinds nothing on this branch.Config
svelte.config.jsis gone: its options (the static adapter, the single bundle, relative paths, the hash router, mdsvex) move intosveltekit({ ... })invite.config.ts, as SvelteKit 3 expects. ESLint reads them through@sveltejs/load-config.tsconfig.jsonextends$app/tsconfig, which SvelteKit 3 generates.package.jsonmaps#lib/*to./src/lib/*.npm run lint,storybookandbuild-storybookrunsvelte-kit syncfirst, ascheckalready did:$app/tsconfigonly exists after it, and the repo's.npmrcinstalls without runningprepare.Imports
$lib/Xbecomes#lib/X.ts,#lib/X.svelte.tsfor a rune module or#lib/X/index.tsfor a folder, in the app, the tests and the stories: the specifier names the file on disk, which the migration guide allows and SvelteKit 3's tsconfig (allowImportingTsExtensions) type-checks. The type declarations intypes/*.d.tskeep.js, the module a declaration describes, as TypeScript takes no.d.tsspecifier inimport { type ... }.$app/environmentbecomes$app/env. Import order and line wrapping follow from the longer paths.server.*and folders namedserver/as server-only and refuses to bundle them for the browser. The server status components move tocomponents/app/servers/, where the servers feature (ui: run chat against more llama.cpp servers, added by URL or paired through a tunnel #35) puts its own; the store and enums becomestores/llama-server.svelte.tsandenums/llama-server.enums.ts, as ui: run chat against more llama.cpp servers, added by URL or paired through a tunnel #35 has astores/servers.svelte.ts. Their exports keep their names.Base path and navigation
basefrom$app/pathsis gone in SvelteKit 3. Requests to the server go through a smallwithBase()helper overasset(), and the Hugging Face icon usesasset()directly.replaceStateandgoto(..., { replaceState })are deprecated: the deep-link and?addcleanups usegoto(url, { replace: true, shallow: true }). The models page no longer records those shallow navigations as a page to return to.page.urlis read-only now, so the copies are made frompage.url.href; the error page readspagefrom$app/stateinstead of$app/stores.relas a list.Service worker
src/service-worker/index.ts, built by SvelteKit, precaches the app shell, the immutable bundle,manifest.webmanifest,_app/version.jsonand the static files, fetched withcache: 'reload'so a staleindex.htmlfrom the HTTP cache can't end up next to the new bundle. It serves only those from cache; API requests always go to the network, as they did with Workbox'snavigateFallback: ''.usePwa()registers it atservice-worker.js(SvelteKit's own registration is off) and keeps the update flow: poll for a new worker, show the refresh prompt when one is waiting, activate it onSKIP_WAITINGand reload.updated($app/state), which checks_app/version.jsonon navigation, on focus and every hour. It replaces the version Llama Chat kept inlocalStorage. Reload on the prompt fetches and activates the new worker before reloading, so one click lands on the new build on either path.manifest.webmanifest, which the PWA plugin used to generate. Its media type, Vite environment and name are constants inpwa.constants.ts, and the header name comes fromHEADERS. The manifest gainslangandscope.static/sw.jsreplaces the old Workbox worker for browsers that installed an earlier build: their update check fetches it, it removes itself and its caches, and the reloaded page registersservice-worker.js.service-worker.jswithno-cachelikesw.js, and answers both paths with the self-removing worker when the built-in UI is off or replaced. The CMake asset check takes eitherservice-worker.jsor, from the prebuilt archives of earlier builds that CI downloads,workbox-*.js.index.htmlrun in Vite'sbuildApphook, after the adapter has written the output, instead of asetTimeoutincloseBundle.Svelte 5's current patterns (a commit of its own, following the
svelte-core-bestpracticesguidance on svelte.dev/docs/ai)nearViewport,autoResizeTextareaand the custom CSS injection are attachments ({@attach}) instead of actions (use:)class:directivescreateContext, typed, instead ofsetContext/getContextwith string keysusePwakeeps its state in$stateinstead of a store, and no effect checksbrowserActionIconCopyToClipboard, the last legacy-mode component, takes$props()ESLint 10 (a commit of its own; ESLint 9 now reports itself as unsupported)
eslint10,@eslint/js10 and@eslint/compat2; every other plugin already supports it.catchkeep the original ascause(the MCP service and store, the API fetch helper, PDF processing), and two variables lose an initial value that was always overwritten.Restacking the layers above
The rest of the stack is rebased onto this branch. To keep the rebase from conflicting on every import, each commit above was first rewritten with the same import codemod (a tree rewrite, no patch replay), then rebased; what was left were real conflicts, resolved per commit. Fixes the upgrade needed in the layers above went into the commits that introduced the code:
svelte.config.jsintotsconfig.json'spaths, as SvelteKit 3 deprecates thetypescript.confighook, with a unit test that fails if the library gains a dependency they miss (voice, ui: voice messages and dictation with live waveforms and transcripts #64, adds its own path there); its Vite plugin compiles the library with oxc instead of esbuild, and makes Vite use the app's tsconfig for the library's sources, in the build and in the dependency scan (without it the scan failed, dependencies turned up mid-run and test files failed at random), whose own tsconfig needs an install of the libraryui/lib/ui's own lockfile resolves SvelteKit 3.2.0 tookit.alias, deprecated in SvelteKit 3, becomes a Vite alias plus a TypeScript pathbasebecomeswithBase(),apiUrl()orasset()#libimportsconstants/server.constants.ts,types/server.d.tsandutils/server.tsbecomeservers.*, beside the feature's existingservers.*files; its components sharecomponents/app/servers/and one barrel with the server status componentsgoto(..., { replaceState: true })becomesreplace: truerefreshAll(), asinvalidateAll()is deprecatedlocalStorageversion check is dropped with the check$app/navigationwithoutimportOriginal, which loads SvelteKit 3's client router outside the app and hung the browser; master's per-conversation tool picks in the Settings tools tab (fix:- Misc. bug: Settings/Tools is lying about tool picks inside a ch… ggml-org/llama.cpp#32223) keep theirconversationsStore.preferencescalls under the extension's group keysOn 16 November the move (#54) was merged upstream, so this layer now sits on
master, with master's tools-tab fix and its test converted to#libimports. The npx package (#69) joined the stack in the same restack, between the Storybook (#67) and Llama Harness (#55). Each lockfile that conflicted was regenerated from its commit'spackage.json; this branch's lockfile also drops 124 lines ofextraneousentries the first install left behind.Typed routes (route ids, navigation through
resolve(),svelte/no-navigation-without-resolveback on) are a PR of their own at the top of the stack, #73: every layer adds routes, so doing it here would conflict with each of them.Testing
ui/apps/chaton this branch:npm ci,npm run check(0 errors, 0 warnings),npm run lint, the 785 unit tests, the 270 client tests, the 49 Storybook tests andnpm run buildpass.service-worker.jswith the hashed bundle, CSS,manifest.webmanifestand_app/version.jsonin its precache,sw.js,manifest.webmanifestand anindex.htmlwith./_app/paths; the PWA build spec (tests/unit/pwa.spec.ts) passes against it.vite previewof the build against a local llama-server:service-worker.jsregisters with the app's scope and precaches 67 files; after a reload it controls the page and serves the bundle and CSS from its cache, while/propsand/v1/modelscome from the server.#/modelsrenders the Models page through the hash router. With the preview server stopped, a reload still loads the app from the cache and shows "Server unavailable". No console errors.sw.jsserves the self-removing worker andmanifest.webmanifestcomes asapplication/manifest+json.updatedraised the prompt and one Reload loaded the new bundle; on a controlled page, the waiting worker raised it and one Reload loaded the new bundle, leaving only the new cache. Before thecache: 'reload'fix, the worker-path reload showed a blank page. The Models page renders through the new attachments without console errors.masterand again after ESLint 10, thetsconfig.jsonpaths and the sync scripts: at each branch head from ui: Llama UI design system: tokens, surfaces and fonts #22 to ui: optionally store conversations and settings on disk via storage adapters #39 and ui: navigate through resolve() with typed route ids #73 the lockfile matchespackage.json, andnpm ci,npm run check,npm run lintand the unit tests pass. With theminimatchoverride,npm auditfinds 0 vulnerabilities and lint passes at every head.npm run build-storybookpasses at ui: prompt library, a System message submenu and a Library page #29 without a priorsvelte-kit sync, as CI runs it. Master's new tools-tab client test and the extension-navigation test pass here and at ui: optionally store conversations and settings on disk via storage adapters #39. Before that rebase, the build passed at ui: Llama UI design system: tokens, surfaces and fonts #22, ui: move the agentic loop into @ggml-org/llama-harness, in ui/lib/harness #55 and ui: run chat against more llama.cpp servers, added by URL or paired through a tunnel #35, the Storybook tests at ui: Llama UI design system: tokens, surfaces and fonts #22 and ui: optionally store conversations and settings on disk via storage adapters #39 (114 files), and the client tests at ui: Llama UI design system: tokens, surfaces and fonts #22 and, file by file, at ui: optionally store conversations and settings on disk via storage adapters #39.svelte-autofixerover every component (npx -y @sveltejs/mcp svelte-autofixer <file> --svelte-version 5.57.3), left to a manual run.Known gaps:
Requirements
Claude (Opus 5.5 Medium)