Native and Web Sync Flows
Follow the correct workflow when syncing native bindings, companion package pins, or published web bridge assets.
On this page
Native sync flow#
When native behavior or bindings need updates:
- Make and release changes in
llamadart-nativeorlitert-lm-nativefirst. - Sync native version and bindings in this repo.
-
Sync matching Apple SPM pins in the Flutter runtime companion packages under
packages/when Apple XCFramework releases changed.
The invariant is that core native-assets builds and Flutter Apple companion
Swift Package Manager builds should resolve compatible bridge runtime releases.
Do not point the core hook at leehack/*-native artifacts while companion
Package.swift files point at unrelated Apple binaries; that creates different
bridge behavior between pure Dart/macOS fallback and Flutter Apple builds.
| Runtime | Core native-assets pin | Apple SPM companion pin |
|---|---|---|
| llama.cpp / GGUF |
hook/build.dart
_llamaCppTag
, default repository
leehack/llamadart-native
|
packages/llamadart_llama_cpp_flutter/.../Package.swift binary target URL/checksum |
LiteRT-LM / .litertlm |
hook/build.dart
_litertLmVersion
, repository
leehack/litert-lm-native
|
packages/llamadart_litert_lm_flutter/.../Package.swift binary target URLs/checksums |
Preferred in-repo workflow:
.github/workflows/sync_native_bindings.yml
That workflow syncs llama.cpp headers, regenerates ffigen bindings, updates the
native hook pins, updates companion package SPM pins, bumps the changed
companion package patch versions, updates README/CHANGELOG pin notes, and opens
a PR. The native_tag input controls the llamadart-native release. The
litert_lm_tag input defaults to keep; set it to a
litert-lm-native tag or latest only when the LiteRT-LM native release should
move in the same PR.
Local fallback:
tool/native/sync_native_headers_and_bindings.sh --tag latest
python3 tool/native/sync_native_release_pins.py \
--llama-cpp-tag latest \
--litert-lm-tag keep
After sync, run analyze/tests/docs checks before merge. For Apple SPM pin
changes, verify the companion package changes under packages/, then run at
least one Flutter iOS build and one macOS build with those packages enabled.
Inspect the packaged frameworks to confirm the expected native release artifacts
are present.
Native version update checklist#
Use this checklist in native sync PRs:
-
Confirm
llamadart-nativeorlitert-lm-nativehas published the target release and the required per-platform native-assets archives. - Confirm the same release provides Apple SPM-compatible XCFramework zip artifacts when companion package pins should move.
-
Update
hook/build.dartnative pins with.github/workflows/sync_native_bindings.ymlortool/native/sync_native_release_pins.py. -
Update companion package
Package.swiftURL/checksum pins underpackages/when Apple XCFramework releases changed. - Bump each changed companion package patch version.
- Ensure each changed companion package README and versioned CHANGELOG section names the new native repo tag.
-
Regenerate
lib/src/backends/llama_cpp/bindings.dartwhenever thellamadart-nativeheader bundle changed. - Update public docs that mention the pinned native versions or source table.
Companion package release handoff#
Native sync PRs can leave the repository in a state where the companion package
source under packages/ is ready, but the corresponding pub.dev package version
does not exist yet. That is expected before merge, but it must be resolved before
tagging the next core llamadart release.
For every companion package whose pubspec.yaml version changed, or whose
version is newly referenced by current install docs:
-
Confirm the
Package.swiftbinary targets point at published native GitHub release assets and that the pinned checksums match those assets. - Merge the sync/release-prep PR first. The PR itself must not publish the companion or core package.
-
After merge, get explicit maintainer approval before pushing each
package-specific companion tag:
llamadart_llama_cpp_flutter-v{{version}}orllamadart_litert_lm_flutter-v{{version}}. - Wait for
publish_companion_pubdev.ymlto pass. -
Verify the version URL on pub.dev, for example
https://pub.dev/api/packages/llamadart_llama_cpp_flutter/versions/{{version}}. -
Only after the companion version is live, get explicit maintainer approval
before pushing the core
vX.Y.Zrelease tag that documents or depends on that companion version.
Web bridge asset sync flow#
When web bridge runtime behavior changes:
- Update and release in
llama-web-bridge. - Publish assets in
llama-web-bridge-assets. - Update pinned assets in this repo.
Fetch pinned assets for local app web files:
WEBGPU_BRIDGE_ASSETS_TAG=<tag> ./scripts/fetch_webgpu_bridge_assets.sh
Validation after sync#
Use the contributor matrix to choose exact rows and record PR evidence:
dart run tool/testing/test_matrix.dart --list
- Native: model load/generation smoke checks on relevant platforms.
- Web: bridge load/fallback checks in
example/chat_app. - Docs: ensure version/platform notes match newly pinned runtime behavior.