Expand description
C FFI for stateless predicate evaluation (Phase 9c of
CAPABILITY_SYSTEM_SDK_PLAN.md). Pure helpers — no handles,
no state. Mirrors the SDK-layer evaluatePredicate /
evaluate_predicate surface every binding ships, exposed at
the C ABI for raw consumers (C / C++ / Zig / Swift / etc.).
C FFI for stateless predicate evaluation (Phase 9c of
CAPABILITY_SYSTEM_SDK_PLAN.md).
Pure helpers — no handles, no state. The substrate’s
Predicate::evaluate_unplanned(ctx) is mirrored across all
four bindings (Rust SDK, TS, Python, Go) at the SDK layer;
this module brings the same surface to raw C consumers
(C / C++ / Zig / Swift / Java JNI / etc.) so they can
evaluate predicates locally without going through nRPC.
All inputs cross as NUL-terminated UTF-8 JSON strings:
predicate_json— wire-formatPredicateWireJSON. The same shape every binding emits / accepts; cross-binding compat is pinned bytests/cross_lang_capability/predicate_eval.json.tags_json— JSON array of tag strings, e.g.["hardware.gpu", "scope:tenant:foo"]. Reserved-prefix tags are accepted (parsed via the privileged path).metadata_json— JSON object ofstring -> string, e.g.{"intent": "ml-training", "region": "us-east"}.
Cross-binding contract: the same (predicate, tags, metadata)
triple produces identical booleans across every binding. Drift
between the C surface and the substrate’s evaluator surfaces
as a fixture-driven CI failure on the offending side.
§Safety
Every entry point is unsafe extern "C" and inherits the
module-wide FFI safety contract (see ffi/mod.rs and
include/net.h).
Functions§
- net_
predicate_ ⚠evaluate - Evaluate a wire-format
Predicateagainst a(tags, metadata)context. MirrorsPredicate::evaluate_unplanned(ctx)from the substrate. - net_
predicate_ ⚠to_ where_ header - Encode a wire-format
Predicateas the canonicalnet-where:request-header value.