Repository navigation
waifu: split into libwaifu and libwaifu_modelmanager; CLI on their C APIs - #124
Merged
Merged
Conversation
waifu is now libwaifu, a cdylib whose C API runs a model given the path of its manifest. The new waifu-modelmanager crate is libwaifu_modelmanager: the catalogue, fetching, config.toml and what a model's boxes start at. The two share no code and no types, and each header stands alone. - waifu-ffi and waifu-modelmanager's C API crate are folded into their crates (cdylib + rlib). hub.rs and config.rs moved to the model manager; yaml.rs is copied, since both read manifests. - libwaifu: load and describe take a manifest path (ABI 2); describe says only what a request may hold; a draw runs the request as given. New waifu_devices_json. - libwaifu_modelmanager: new manifest_path, directory_json and defaults_json, the last being the kind defaults and the manifest's suggested: block, which moved here from the engine. - waifu-cli: the `waifu` binary, statically linked against both crates and calling nothing but their C APIs. - waifu-tools: the old examples, as binaries. - macOS and Windows apps move to waifu-app/swiftui and waifu-app/wpf and adapt to the API; they behave as before. - IndexTTS's own docs merged into docs/indextts.md; the text normalizer moves to waifu::text_normalizer, shared with CosyVoice3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Splits the Rust side into two C libraries that share no code: libwaifu (
waifu/), which runs a model given the path of its manifest, and libwaifu_modelmanager (waifu-modelmanager/), which owns the catalogue, fetching,config.tomland a model's default settings. Thewaifucommand line is now its own crate,waifu-cli, statically linked against both and calling only their C APIs. Removeswaifu-ffiand thecli/hub/enginefeatures.Layout
waifu/include/waifu.h. waifu-ffi is folded in assrc/c_api.rs.waifu-modelmanager/include/waifu_modelmanager.h.hub.rs,config.rsandsuggested.rsmoved here;yaml.rsis copied.waifu-cli/waifubinary, one file, no dylibs at run timewaifu-tools/waifu/examplesandfetch_manifests, as binarieswaifu-app/swiftui,waifu-app/wpfmacos/andwindows/Neither library links the other: if one did, every
extern "C"function of the one it linked would be exported from both, and a linker could bind an app's call to the wrong copy. Each header includes only system headers; the model manager's types carry its own prefix (WaifuModelManagerStatusCode,WAIFU_MODELMANAGER_OK, ...).C API changes
WAIFU_ABI_VERSIONis 2.waifu_engine_load_asyncandwaifu_describe_json(renamed fromwaifu_modelmanager_describe_json) take a manifest path or"tones", not a published name.waifu_describe_jsonsays only what a request may hold: kind,image_keys/why_not, alignment, sampler, rate, styles,on_disk/bytes.waifu_devices_json.waifu_modelmanager_manifest_path,_directory_json,_defaults_json.waifu_set_bundled_manifests. The model manager reads bundled manifests and hands back their paths.Apps
WaifuKit and the C# app adapt to the API and behave as before:
load(name)fetches through the model manager and loads by path, anddescribeJSONmerges describe with defaults. For every model kind, that merge was checked identical to the oldwaifu_describe_json.build-app.shstill bundles every manifest, throughwaifu-tools.Also
waifu::text_normalizer, fromindextts/normalize.rs, since CosyVoice3 uses it too.docs/indextts.md; the shared ones renamedaudio_features.mdandtext_normalize.md.waifu-modelmanagerandwaifu-cliand buildswaifu-tools. CLAUDE.md gains a rule against changing the apps' behavior unasked.Tests
Passing locally on macOS (Metal):
unittest, waifu (391), waifu-modelmanager (61), waifu-cli (174), the waifu-tools build, and WaifuKit (9). The C# app compiles against a WPF SDK project on macOS.Not run: model tests; a real draw or download through the CLI's screens; the Windows app;
build-app.shand the release workflow; the CLI's static link on Linux and Windows, which CI will be the first to build.🤖 Generated with Claude Code