Skip to content

libmoss v0.32.0

Choose a tag to compare

@moss-release-bot moss-release-bot released this 17 Nov 03:06
· 3 commits to main since this release
764f5ac

Precompiled C SDK binaries for the Moss SDK.

Added

  • Each archive carries LICENSE.txt, the PolyForm Shield License 1.0.0 terms of the library. The release notes name them too.

Changed

  • A new client loads an index from cache_path in about one round trip to the Moss cloud when another client or session in the same process has the index's model loaded. Clients in one process share the project's token and each loaded embedding model, and on macOS, Linux and Windows also their connections to the cloud; every load still checks the cloud version of the index. Freeing the last client or session that uses a model still frees the model at once, on every platform, so a client created after that opens the model again. iOS and Android builds open connections per client. A cached moss_client_load_index also asks for the index metadata and its model provenance at once. From Europe, about 130 ms from the Moss cloud, a cached 960-document index loaded in the first client in a process in 1.9 to 2.2 s instead of 2.5 to 2.8 s, and in 200 to 290 ms instead of 2.5 to 2.8 s in a new client that found its model loaded; a cached 50,400-document index loaded in such a client in 0.8 to 1.4 s instead of 3.0 to 3.1 s. A client opened several idle minutes after the last one was freed reconnects and opens the model again, which took 1.6 to 1.7 s.
  • moss_client_load_index and moss_client_load_indexes need less memory. The index file, downloaded or read from cache_path, is freed once it is parsed, and its vectors and documents move into the loaded index instead of being copied. A load that writes the download to cache_path frees the file once it is written and copies the documents into the index. On an Apple M2, loading 250,000 documents with 384-dimension vectors peaked at 943 MB instead of 1,550 MB, and at about 1,210 MB when the load writes the download to cache_path. Auto-refresh of an index loaded without cache_path installs a newer version the same way. Search results and cache files are unchanged.
  • Queries with a metadata filter test it while they score the vectors, in parallel on large indexes, and skip the vectors of documents it rejects. The filter values of $gt, $gte, $lt, $lte and $near are parsed once per query instead of once per document. On an Apple M2, an embedding or hybrid query over 100,000 documents with 1,536-dimension vectors and a filter that keeps 5% of them ran about six times faster. Results are unchanged.
  • Creating an index whose name is taken returns ERR_INVALID_ARG and the message "An index with this name already exists. Delete it or choose another name.", and a call the service refuses because a build for the index is still running, such as adding documents during a build, fails the same way with "A build is already running for this index. Wait for it to finish, then try again.", instead of the generic "The Moss service rejected the request as invalid.". The code is unchanged, and moss_last_error_detail() still names the service's code.

Deprecated

  • libmoss versions below 0.24.0 reach end of support on 2026-12-17 and will stop working then. Upgrade to this release or a later one.

Fixed

  • moss_client_query, moss_client_query_multi_index and moss_session_query fail with ERR_INVALID_ARG when filter_json is not valid UTF-8. They used to drop the filter and return unfiltered results.
  • moss_client_get_docs, moss_client_delete_docs, moss_session_get_docs and moss_session_delete_docs fail with ERR_NULL_POINTER for a NULL id and with ERR_INVALID_ARG for one that is not valid UTF-8. They used to drop such ids, so moss_client_get_docs returned every document of the index when no id was left. moss_client_delete_docs and moss_session_delete_docs also fail with ERR_NULL_POINTER for a NULL doc_ids with a nonzero count, where they used to go ahead with an empty id list.
  • moss_client_create_index, moss_client_add_docs and moss_session_add_docs fail with ERR_INVALID_ARG for a metadata key or value that is NULL or not valid UTF-8, and for a payload that is not valid UTF-8. They used to drop the entry or the payload.
  • moss_client_create_index, moss_client_create_index_from_files, moss_client_add_docs and moss_client_delete_docs calls on one index run one at a time across every MossClient that uses the same loaded copy of the core. Each call keeps the index until it returns, the wait for its build included, so parallel writes to one index take as long as the same writes one after another. moss_session_push_index waits its turn with them, but keeps the index only until the service accepts the push, not through its build. Calls on different indexes still run in parallel. moss_client_delete_index does not wait for them, since the service cancels a running build of the index it deletes. Calls on one index through separate clients used to reach the service together, which refused some of them and reported others as done without storing them: of three parallel moss_client_add_docs calls with one new document each, only one document was stored. A call the service refuses because a build of the index is running, such as one started from another process, is sent again, with waits that grow from about one second to eight and add up to at most 60 seconds. If the service still refuses it after those waits, it returns ERR_INVALID_ARG and the message "A build is already running for this index. Wait for it to finish, then try again.", as it used to on the first refusal. Writes to one index from separate copies of the core, processes or hosts do not wait for each other. Such a write is sent again, with the same waits, only when the service refuses it with BUILD_IN_PROGRESS. The Moss cloud service refuses a write that overlaps a running build, but an index service without that refusal can accept the write and drop it.

Platforms

Archive OS Arch
libmoss-v0.32.0-aarch64-apple-darwin.tar.gz macOS ARM64 (Apple Silicon)
libmoss-v0.32.0-x86_64-unknown-linux-gnu.tar.gz Linux x86_64
libmoss-v0.32.0-aarch64-unknown-linux-gnu.tar.gz Linux ARM64
libmoss-v0.32.0-x86_64-pc-windows-msvc.tar.gz Windows x86_64

Contents

Each archive contains:

  • include/libmoss.h - C header
  • lib/libmoss.dylib, lib/libmoss.so or lib/moss.dll - shared library
  • LICENSE.txt - the license of the library
  • LICENSE-THIRD-PARTY.txt - licenses of the third-party code the library links

Windows archives also contain the DLL import library lib/moss.dll.lib.

License

The library is licensed under the PolyForm Shield License 1.0.0, not under this repository's BSD 2-Clause License.

Required Notice: Copyright InferEdge Inc. (https://inferedge.dev)

Usage

Extract, then compile and link. The macOS dylib ships with an
@rpath/libmoss.dylib install name, so pass an -rpath that
resolves to lib/ or the binary aborts at launch with
"Library not loaded: @rpath/libmoss.dylib ... no LC_RPATH's found":

# macOS
clang your_app.c -o your_app -Iinclude -Llib -lmoss \
  -Wl,-rpath,@loader_path/lib \
  -framework Security -framework SystemConfiguration

# Linux
gcc your_app.c -o your_app -Iinclude -Llib -lmoss -lpthread -lm -ldl