mirror of
https://github.com/logos-co/logos-cpp-sdk.git
synced 2026-08-31 09:41:06 +00:00
The impl-exports wrapper used to fire maybeSetContext (stamp + hook) immediately inside logos_module_set_context — which the glue calls during onInit, BEFORE the auth token is seeded and BEFORE ModuleProxy wires the emit callback. A hook that made outbound calls or emitted events ran half-wired; and the Rust scaffold deferred its hook to first dispatch entirely, so a Rust module couldn't subscribe/emit/act until someone called it — a capability gap vs the universal C++ path. Two changes, applied uniformly: - The glue's onInit now seeds the auth token FIRST and forwards the context LAST (the same context-last convention as the universal onInit ordering fix). - The impl-exports gained a ready-latch (lidlTryFireContext): the context is stored on set_context and the hook fires ONCE as soon as both the context AND the emit callback have been delivered — during module registration, before the module is published for inbound calls. Hosts that never wire an emit callback still get the hook before the first dispatch (requireEmit=false fallback in logos_module_dispatch). The Rust scaffold (logos-rust-sdk lidl-gen) implements the same latch, so on_context_ready now matches C++ onContextReady semantics: subscriptions, authenticated outbound calls and typed emission all work from the hook at load time.