Repository navigation
ui: accept the SvelteKit prebuilt asset layout so a fresh clone builds (#204) - #208
Open
StrikeRougeAgent wants to merge 1 commit into
Open
StrikeRougeAgent wants to merge 1 commit into
StrikeRougeAgent wants to merge 1 commit into
Conversation
The HF bucket ggml-org/llama-ui now serves the SvelteKit 3 UI (upstream 67cf896): the app entry lives at _app/immutable/entry/start[hash].js, the styles at _app/immutable/assets/[name][hash].css, and the service worker is SvelteKit's own (service-worker.js plus sw.js) instead of Workbox's workbox[hash].js. The legacy single-bundle files bundle[hash].js/.css are gone. ui_validate_assets() still required the legacy names, so a CPU build of a fresh clone aborts during the UI provisioning step: CMake Error at scripts/ui-assets.cmake:137 (message): UI: current asset files: ... UI: missing required asset(s): bundle[hash].js bundle[hash].css workbox[hash].js Port upstream's ui_validate_assets() so that both asset layouts validate: the entry is bundle[hash].js or _app/immutable/entry/start[hash].js, the stylesheet is bundle[hash].css or any CSS under _app/immutable/assets/, and the service worker is service-worker.js or workbox[hash].js (sw.js is required in both layouts). Map .mjs to application/javascript as upstream does, since the SvelteKit UI ships pdf.worker.min[hash].mjs, which was previously embedded as application/octet-stream. Refs Anbeeld#204
Anbeeld
added a commit
that referenced
this pull request
Nov 24, 2026
Port the scripts/ui-assets.cmake changes from upstream 8043748 to accept split SvelteKit JS/CSS and serve .mjs as JavaScript. Keep legacy asset layouts valid. Add offline provisioning regressions for legacy and split layouts, MIME types, gzip, incomplete assets, and builds without embedded assets. Fixes #204. Refs #208.
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
A fresh clone of
maincannot be built with the default CMake flags: the UI provisioning step aborts withFATAL_ERRORbefore the first source file is compiled. This PR fixesscripts/ui_validate_assets()so the prebuilt UI downloaded fromggml-org/llama-uivalidates, restoring the documentedcmake -B build && cmake --build buildflow on CPU.Fixes #204.
The change is CMake-only, is a straight port of upstream's current
ui_validate_assets(), and keeps the previous (pre-SvelteKit) asset layout valid so cached build trees keep working.Root cause
llama-ui-assets(tools/ui/CMakeLists.txt) runsscripts/ui-assets.cmakeat build time. The script resolves a version (b${LLAMA_BUILD_NUMBER}, falling back tolatest), downloadsdist.tar.gzfrom the HF bucket, then callsui_validate_assets()before embedding the assets intoui.cpp.Upstream moved the UI to SvelteKit 3 in ggml-org/llama.cpp@67cf8967 and updated that same validator accordingly. The prebuilt archive now looks like this:
BeeLlama still carries the pre-migration validator, which requires the single-bundle names
bundle[hash].js,bundle[hash].cssand a Workbox service workerworkbox[hash].js. None of those exist any more, so the check fails on a fully successful download. This is not fork-specific behaviour — it hits anybody who builds the fork from source, sincelatestis what the version resolution falls back to (in the run belowb1returned an HTTP error andlatestwas used).Note the failure is a validation bug, not a download bug: the archive is verified against
dist.tar.gz.sha256and extracted correctly, andsw.js/build.json/version.json/manifest.webmanifestare all present. Only the bundle/Workbox names are stale.Reproduction (before the fix)
Environment: Debian 13, x86_64, GCC 14.2.0, CMake 3.31.6, CPU backend, no CUDA,
-j2.Deterministic; a clean build directory does not help (the "hint" is misleading, the assets on disk are fine).
-DLLAMA_USE_PREBUILT_UI=OFFis the only workaround, and it builds the server without the web UI.The fix
scripts/ui-assets.cmake,ui_validate_assets()only — the body is ported from upstreammasterverbatim, so the fork stays aligned with the current upstream abstraction instead of growing fork-private flags:bundle[hash].jsor_app/immutable/entry/start[hash].js;bundle[hash].cssor any_app/immutable/assets/*.css;service-worker.jsorworkbox[hash].js(older archives).sw.jsis still required in both layouts;missingmessages now name the layout that is actually expected, so the next asset change produces a readable error instead of a misleading "clean your build directory" hint.One extra line, also taken from upstream:
.mjsnow maps toapplication/javascript. The SvelteKit UI ships_app/immutable/chunks/pdf.worker.min.[hash].mjs; without this it was embedded and served asapplication/octet-stream.Unchanged: version resolution, checksum verification, gzip handling, the embed fingerprint/stamp logic, and the
tools/uisource path (UI_TEMPLATE_DIR) — the fork's layout differences versus upstream'sui/apps/chatare intentionally not touched.Validation (after the fix)
Fresh clone of this branch, same machine, no CUDA:
cmake -B build+ buildllama-cli llama-server, prebuilt UI ON (real HF assets)-- UI: embedded 291 assets;[100%] Built target llama-cli/llama-server;EXIT=0-DLLAMA_USE_PREBUILT_UI=OFF, buildllama-cli-- UI: embedded 0 assets;[100%] Built target llama-cli;EXIT=0dist/(bundle.js + bundle.css + workbox-*.js + sw.js)embedded 8 assetsdist/(entry/start.js + assets/*.css + service-worker.js + sw.js + *.mjs)embedded 9 assetsdist/(index.html only)UI: missing required asset(s)→ exit 1llama-cli --version,llama-server --version→version: 0.5.0 (build 1, commit f594c2f-dirty),built with GNU 14.2.0 for Linux x86_64.mjsMIMEui.cpp:"pdf.worker.min.DbR_HJhJ.mjs", ..., "application/javascript"test-server-loop-guardOK,test-adaptive-dmOK,test-kvarnOK (CPU direct KVarN FlashAttention parity OK; GPU checks self-skip)Case 1 — build with prebuilt UI ON (the failing path, now green)
Case 3/4/5 — validator matrix on synthetic asset trees
Method: clone → apply patch →
cmake -B build→cmake --build build -j2 --target llama-cli llama-server; the matrix cases drivescripts/ui-assets.cmakedirectly with-DUI_SOURCE_DIR=<tmp>/<case>and-DHF_ENABLED=OFF, i.e. the sameSRC_DIST_DIRpath a user with hand-built assets takes.What I could not test (explicit limits)
release*.yml), so the full local CI fromci/README.md— which is CUDA-centric — was not run. The table above is the evidence instead.BUILD_UI=ON(npm build path): untouched by this patch and not exercised; only the prebuilt-asset and no-asset paths were validated.LLAMA_UI_GZIP=OFFin a full build (only in the synthetic matrix).latest:b<build>lookups returned an HTTP error during the run, so the successful download followed thelatestfallback. A bucket that has both a matchingb<build>archive and a different layout inlatestwas not tested.ui.cpp, but I did not startllama-serverwith a model and load the web UI in a browser (no suitable GGUF on the validation machine)..mjsassets plus the asset set actually embedded.Requirements
StrikeRougeAgent) operating the submitting GitHub account. The agent cloned the fork, reproduced the failure, ported upstream'sui_validate_assets(), and ran every validation quoted above; the account owner reviewed the diff and takes responsibility for it. Human review of the CMake logic is still welcome, and I am happy to adjust the approach (for example, to require only one ofservice-worker.js/workbox*.js, or to drop the.mjsMIME line into a separate PR) if you prefer a smaller surface.