Skip to content

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

Open
bryan-minimal wants to merge 2 commits into
mainfrom
llama-ui-notices-994
Open

bryan-minimal wants to merge 2 commits into
mainfrom
llama-ui-notices-994

Conversation

@bryan-minimal

@bryan-minimal bryan-minimal commented Nov 18, 2026 •

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. It is declared in license_spdx as LicenseRef-llama-brand (CC-BY-NC-4.0 plus that grant; no SPDX id covers the pair), so an SBOM or license scan sees the marks' terms; the notices file names the LicenseRef next to both texts. Decided by Bryan, 2026-11-18.
  • 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

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

Warning

Review limit reached

  • Run on-demand review

This review includes 4 billable files and costs up to $1.00.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 33 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 66 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 5dc3947 and e766dc9.

Files selected for processing: 4

  • packages/llama.cpp/build.ncl
  • packages/llama.cpp/build.sh
  • packages/llama.cpp/gen-ui-notices.py
  • packages/llama.cpp/ui-THIRD-PARTY-NOTICES
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

llama-brand is CC-BY-NC-4.0 plus a BRAND-USAGE.md grant that permits
redistribution in software packages, commercially too. Declare it in
license_spdx so an SBOM or license scan sees those terms, instead of an
expression that silently omits them. The notices file (and its generator)
name the LicenseRef next to both texts. Bryan chose this on 2026-11-18.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bryan-minimal
bryan-minimal marked this pull request as ready for review November 19, 2026 00:47
@bryan-minimal
bryan-minimal requested a review from a team as a code owner November 19, 2026 00:47

@norrietaylor norrietaylor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scope matches the title. The four files all trace to the notices for the embedded web UI. gen-ui-notices.py is not a build input, so an edit to it does not rehash the package.

Clobber not checked with git log, because the harness denied shell access. The diff removes only the old license comment and the old license_spdx value, and both replacements are intended.

Correctness The build.sh guard reads the header fields correctly and fails closed on an empty field. The ui-notices test matches the shipped file: the pdfjs-dist section has License: and NOTICE: in the 4 lines after its name. The header counts add up to 365 (362 npm plus 3 vendored). LicenseRef-llama-brand matches the LicenseRef- pattern in .github/scripts/license_lint.py, and seven other packages use that form. The import order on line 1 follows the repo rule. One real defect: the license-file pattern in the generator also matches a JavaScript source file, and that file is in the shipped notices. The other findings are small.

Not checked No build and no test run. gitleaks and git log did not run (shell denied). I did not download the tarballs, so the 362-package closure and the per-package license texts are not verified against the lock. I did not confirm that ggml-org/llama-brand is public.

"""
STANDARD_TEXTS = {"MIT": MIT_TEXT}

LICENSE_FILE = re.compile(r"^(LICEN[CS]E|COPYING|NOTICE)([.\-_].*)?$", re.I)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low · LICENSE_FILE matches any top-level name that starts with license, copying or notice plus ., - or _. It matched cytoscape's license-update.mjs, a script that writes the LICENSE file. The shipped ui-THIRD-PARTY-NOTICES prints that JavaScript at lines 3276-3309 as a license text. This is the only such label among the sections of the file. The same match also counts as a license file in the no license file test at line 378, so a package with only such a source file skips the standard-text fallback. Exclude code extensions (.js, .mjs, .cjs, .ts, .json) or allow only known suffixes, then regenerate the file.

["/bin/bash", "-c", "grep -qx 'svelte@[0-9.]*' /usr/share/licenses/llama.cpp/ui-THIRD-PARTY-NOTICES && grep -qx 'dompurify@[0-9.]*' /usr/share/licenses/llama.cpp/ui-THIRD-PARTY-NOTICES"],
["/bin/bash", "-c", "grep -A4 -x 'pdfjs-dist@[0-9.]*' /usr/share/licenses/llama.cpp/ui-THIRD-PARTY-NOTICES | grep -qx 'License: Apache-2.0'"],
["/bin/bash", "-c", "grep -A4 -x 'pdfjs-dist@[0-9.]*' /usr/share/licenses/llama.cpp/ui-THIRD-PARTY-NOTICES | grep -qx 'NOTICE: none in the package'"],
["/bin/bash", "-c", "grep -q 'Apache License' /usr/share/licenses/llama.cpp/ui-THIRD-PARTY-NOTICES && grep -q 'Mozilla Public License' /usr/share/licenses/llama.cpp/ui-THIRD-PARTY-NOTICES"],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low · The comment at lines 112-114 says the test proves that dompurify ships both texts. This command greps the whole file. Apache License is also in the six Apache-2.0 packages and in dexie, so the Apache half passes when dompurify's section has no Apache text. Scope the grep to the dompurify section, as lines 122-123 do for pdfjs-dist. For example, use sed -n '/^dompurify@/,/^=====/p' and grep both strings in that output.


Both tarballs are checked against the sha256 pins in build.ncl. Needs network
access to registry.npmjs.org and an authenticated `gh` (for llama-brand, which
the lock resolves from GitHub rather than npm). Nothing downloaded is executed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit · The usage text says the script needs an authenticated gh for llama-brand. The script never calls gh. git_files fetches the pinned commit with plain git fetch over https. The person who runs the next bump reads this and sets up a tool the script does not use. Say git and network access to github.com.

(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this Licens

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit · build.ncl declares the marks as LicenseRef-llama-brand, and the PR body says the notices file names that id next to both texts. The llama-brand section and the count table in the header both say CC-BY-NC-4.0. Only the header paragraph names the LicenseRef. A reader who goes to the section sees the non-commercial license alone. The generator can print License: LicenseRef-llama-brand (CC-BY-NC-4.0 plus BRAND-USAGE.md) for this package.

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)

2 participants