Module context_helpers
Module context_helpers
Generated from cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-ffi.
Context helpers for reading scope metadata on the intercept hot path.
These functions read from the NeMo Relay scope stack (via current_scope_stack) to extract information needed by the LLM request intercept:
extract_scope_path: collects function names from the scope stack for trie lookupread_manual_latency_sensitivity: walks all scopes for manuallatency_sensitiveannotationsresolve_agent_id: returns the first Agent scope name from the scope stack
All functions are safe to call from sync contexts (intercepts are sync closures). They acquire a read lock on the scope stack, which is always fast.
Metadata Convention
Manual latency sensitivity is stored in scope metadata under the JSON path /nemo_relay_adaptive/latency_sensitivity as a positive integer.
Structs
- SharedParentScopeIdentity: Session-local scope identity used to coordinate warm-first cohorts.
Constants
- LATENCY_SENSITIVITY_POINTER: Metadata key path for manual latency sensitivity annotation.
Functions
- extract_scope_path: Extracts the current function call path from the NeMo Relay scope stack.
- read_manual_latency_sensitivity: Reads the maximum manual latency sensitivity from all scopes in the current scope stack.
- resolve_agent_id: Resolves the agent ID from the current scope stack.
- resolve_shared_parent_scope_identity: Resolves the session-local identity used by warm-first cohort coordination.
- set_latency_sensitivity: Sets latency sensitivity on the current (top) scope using max-merge semantics.