8000 llama.cpp: ship third-party notices for the embedded web UI (#994) by bryan-minimal · Pull Request #1561 · gominimal/pkgs · GitHub
[go: up one dir, main page]

Skip to content

llama.cpp: ship third-party notices for the embedded web UI (#994) - #1561

Draft
bryan-minimal wants to merge 1 commit into
mainfrom
llama-ui 8000 -notices-994
Draft

bryan-minimal wants to merge 1 commit into
mainfrom
llama-ui-notices-994

Conversation

@bryan-minimal
Copy link
Copy Markdown
Member

Resolves #994 with option 1: a pinned, generated notices file for the llama-ui dist bundle that llama-server embeds.

What changes

  • packages/llama.cpp/ui-THIRD-PARTY-NOTICES (649,529 bytes, 13,072 lines). A header records the llama-ui version (b12359), the dist sha256, the tools/ui/package-lock.json sha256 (240e37ff…1553), the source sha256, the license counts and the packages that have no license file. After the header comes one section per package, sorted by name: name@version, its SPDX id, its source with the integrity check used, the verbatim LICENSE/LICENCE/COPYING text, and any NOTICE (or NOTICE: none in the package).
  • packages/llama.cpp/gen-ui-notices.py. Generates the file, with usage at the top. Run it as python3 -I on each bump; the build doesn't run it. It checks both tarballs against the build.ncl pins and the dist's build.json version. Each npm tarball is checked against the lock's sha512 integrity. It reads only top-level license files and package.json, and executes or installs nothing. Output is byte-identical across runs.
  • build.ncl: the notices file is a new Local input, with a new licenses output (usr/share/licenses/llama.cpp/*, OutputData). A Standalone ui-notices test checks four things: the file names this version, it has the svelte and dompurify sections, pdfjs-dist is Apache-2.0 with its missing NOTICE recorded, and both the Apache and MPL texts are present. The attrs license comment is updated.
  • build.sh: installs the file. It fails closed unless the header's llama-ui version equals $MINIMAL_ARG_VERSION, and unless the header's dist and lock sha256s match ${version}-dist.tar.gz and tools/ui/package-lock.json. A bump that doesn't regenerate the file therefore fails the build. I checked the guard locally against the real lock and dist. A wrong version, a tampered lock and a missing header field each fail it, and the real inputs pass.

Which packages are bundled (and why not "non-dev")

llama-ui lists every dependency under devDependencies, as SvelteKit apps do: all 1,239 lock entries are dev: true. So the lock's non-dev closure is empty and can't be the answer. The generator instead derives the roots from tools/ui/src. A root is a bare specifier imported for its value; import type, *.d.ts, tests and stories don't count, and CSS @import/@plugin/@use do. The workbox modules that the dist's sw.js reports (workbox:<module>:) are added as roots too. From the roots it follows dependencies, optionalDependencies and installed peerDependencies, resolved the way node resolves the lock. It does not enter:

  • @types/* (declarations only);
  • the build tools reached only as peers (vite, typescript, @sveltejs/vite-plugin-svelte, sass, @typescript-eslint/types);
  • native Node addons (pdfjs-dist's optional @napi-rs/canvas and its per-platform binaries).

The closure errs toward including too much. For example, it keeps the MCP SDK's server-side dependencies (express, qs, …) and kit's server helpers (sirv, cookie, …). Tree-shaking may drop those from the bundle, but an extra notice does no harm and a missing one does.

Reconciling with the issue's 402. I reproduced roughly that number (407–411 unique name@version) by walking the same closure without the exclusions above. The difference from 362 is the 42 @types/* packages, @napi-rs/canvas plus 11 platform binaries, and @typescript-eslint/types. None of them puts code into a browser bundle. Six packages pulled in by the Tailwind CSS plugins (@tailwindcss/forms, @tailwindcss/typography and their dependencies) are added the other way, because they emit CSS into the bundle. The issue's per-license table matches this result for Apache-2.0 (7), ISC (44), BSD-2-Clause (2), 0BSD, Unlicense and DOMPurify.

Counts

362 npm packages (unique name@version), plus 3 libraries vendored in tools/ui/src/lib/vendors (nerdamer-prime, decimal.js, big-integer). The vendored libraries are bundled through the nerdamer vite plugin and aren't in the lock.

License Count
MIT 298 (296 npm + vendored nerdamer-prime, decimal.js)
ISC 44
BSD-3-Clause 9
Apache-2.0 7 (pdfjs-dist, dexie, @internationalized/date, @swc/helpers, @chevrotain/types, aria-query, axobject-query)
BSD-2-Clause 2
Unlicense 2 (robust-predicates, vendored big-integer)
0BSD 1 (tslib)
MPL-2.0 OR Apache-2.0 1 (dompurify; its LICENSE carries both texts)
CC-BY-NC-4.0 1 (llama-brand, see below)

Packages with no license file in their npm tarball (8). For these the file gives the standard text of the SPDX id from package.json, with the package.json author as the copyright holder: @polka/url@1.0.0-next.29, fastdom@1.0.12, is-reference@3.0.3, locate-character@3.0.0, rehype-katex@7.0.1, remark-math@6.0.0, sirv@3.0.2, strictdom@1.0.1 (all MIT).

No license in package.json (khroma, runed ×3, svelte-toolbelt ×3). All of them ship a license file. Their SPDX id (MIT) is taken from their repository's LICENSE, which I checked.

Every package's license was determined. Of the Apache-2.0 packages, only dexie ships a NOTICE file, and it's included verbatim. The other six, pdfjs-dist among them, ship none, and the file records that for each.

For review

  • llama-brand is CC-BY-NC-4.0, and the issue's table doesn't list it. It holds the llama.cpp logo used in Logo.svelte, the favicons, and the PWA/splash icons in the dist. Its BRAND-USAGE.md grants everyone permission to redistribute the marks, commercially too, "as part of software distributions, packages, and operating systems". It also says attribution is satisfied by naming the repo in a credits file. Both texts are in the notices. I left CC-BY-NC-4.0 out of license_spdx because the grant has no SPDX expression. Say if you'd rather declare it, e.g. as a LicenseRef-.
  • llama-brand is a GitHub commit archive in the lock, not an npm tarball. GitHub's archive doesn't reproduce the lock's sha512, so its files are read with git at the pinned commit f055406…, which pins them by hash.

Follow-up 8000

Doing this automatically at bump time is a pkgmgr follow-up (pm#1181): a generic "npm-lock notices" step in the updater, so a llama.cpp bump regenerates this file instead of failing the guard. Until then, a bump PR needs one gen-ui-notices.py run; the usage is at the top of the script.

Not built locally; build-bot will build it.

🤖 Generated with Claude Code

The llama-ui dist bundle that llama-server embeds is minified and carries
none of the license texts or NOTICE files of the code compiled into it.

ui-THIRD-PARTY-NOTICES holds them: one section per bundled npm package
(name@version, SPDX id, verbatim LICENSE/COPYING/NOTICE text from the npm
tarball, checked against the lock's sha512 integrity), the three
libraries vendored in tools/ui/src/lib/vendors, and llama-brand's logo
licence and redistribution grant. gen-ui-notices.py generates it from
the b12359 source's tools/ui/package-lock.json; the build does not run it.

build.sh installs it to usr/share/licenses/llama.cpp (new `licenses`
output) and fails closed unless its header's UI version, dist sha256
and lock sha256 match what is being built, so a bump without
regenerating cannot ship stale notices. A Standalone test checks the
installed file names this version and carries the svelte, dompurify and
pdfjs-dist sections.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai
coderabbitai Bot commented Nov 18, 2026
Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

llama.cpp: ship third-party license notices for the embedded web UI (Apache-2.0/BSD/ISC/MIT)

1 participant

0