@qvac/fabric
v0.7.0
Published
Shared bare addon hosting the qvac-fabric (forked llama.cpp + ggml) runtime for QVAC inference addons
Readme
@qvac/fabric
Shared bare addon that hosts the qvac-fabric runtime (Tether's fork of
llama.cpp + ggml) as a single prebuilt shared library. Consumer addons
(@qvac/llm-llamacpp, @qvac/embed-llamacpp, …) declare @qvac/fabric as an
npm dependency and dynamically link against it, so the multi-hundred-megabyte
llama/ggml runtime is built once and loaded once per process instead of
being statically embedded into every addon.
It is modeled on @qvac/onnx and follows the same
npm + prebuilds/ + include_bare_module(... PREBUILD) + companion-.bare
pattern. See INTEGRATION.md for the consumer guide.
What it ships
- Prebuilt
.bareshared library (prebuilds/<platform>/qvac__fabric.bare) — containslibllama,libcommon,libmtmd, andlibggml-base. It exports the fullllama_* / LLAMA_* / ggml_* / gguf_* / mtmd_*C API plus thecommon_*andjson_schema_to_grammarC++ symbols. - C++ headers (
prebuilds/include/) —ggml*.h,gguf.hat the root andllama.h,llama-cpp.h,common/*.h,mtmd/*.hunderinclude/llama/. - CMake config (
prebuilds/share/qvac-fabric/) —find_package(qvac-fabric)exposesqvac-fabric::headersfor compile-time includes - ggml compute backends — on Linux and Android, separate shared libraries
ship under
prebuilds/<platform>/qvac__fabric/and are loaded at runtime viaggml_backend_load_all_from_path(). On macOS, Windows, and iOS the backends are linked statically insideqvac__fabric.bareand self-register on load.
Architecture
┌──────────────────────────────────────────────────────────┐
│ Consumer addons (.bare) │
│ @qvac/llm-llamacpp @qvac/embed-llamacpp … │
│ link qvac-fabric::headers + DT_NEEDED [email protected] │
└───────────────────────────┬────────────────────────────────┘
│ (ELF SONAME dedup → one load)
┌───────────────────────────▼────────────────────────────────┐
│ [email protected] (this package) │
│ libllama · libcommon · libmtmd · libggml-base │
│ + ggml backends (.so on Linux/Android; static elsewhere) │
│ exports llama_* / LLAMA_* / ggml_* / gguf_* / mtmd_* / │
│ common_* / json_schema_to_grammar │
└───────────────────────────┬────────────────────────────────┘
│
┌───────────────────────────▼────────────────────────────────┐
│ qvac-fabric vcpkg port (forked llama.cpp + ggml) │
└──────────────────────────────────────────────────────────┘Key design points:
- Single runtime load — Every consumer addon's
.barehasDT_NEEDED: [email protected]. The dynamic linker deduplicates by SONAME, so the llama/ggml runtime is loaded exactly once per process, no matter how many fabric-based addons are present. - No JS API —
@qvac/fabricis a carrier module. Consumersrequire()it only to register the.barewith the bare runtime before resolving their own addon (see INTEGRATION.md Step 5). All inference happens through the consumer's own C++ code against the shipped headers. - Backends — ggml compute backends resolve their
ggml_*references against the single loaded[email protected].
Build
npm install
npm run build # bare-make generate && bare-make build && bare-make installSupported platforms
| Platform | Triplet | Backends |
|----------|---------|----------|
| Linux | x64-linux, arm64-linux | shared .so under prebuilds/<platform>/qvac__fabric/ |
| macOS | arm64-osx | static (CPU, Metal) inside .bare |
| Windows | (default MSVC) | static inside .bare |
| Android | arm64-android | shared .so under prebuilds/<platform>/qvac__fabric/ |
| iOS | arm64-ios | static inside .bare |
