pub fn cost_unit_for_dispatch(
verb: &str,
params: &Value,
result: &Value,
registered_model_count: impl FnOnce() -> i64,
) -> i64Expand description
Compute resource.cost_unit for one successful dispatch.
params is the original request’s top-level arguments (GateRequest::args,
already in scope, read-only, at the audit-row emission seam in
crates/khive-runtime/src/pack.rs); result is the dispatch’s own
successful Value; registered_model_count reads
PackRuntime::registered_embedding_model_names().len() for the pack that
owns verb, lazily.
Callers MUST only invoke this for a successful (Ok) dispatch result.
Error-outcome dispatches omit resource.cost_unit entirely (ADR-103
Amendment 1’s “absence has exactly two meanings” rule: a pre-amendment
event, or a dispatch that errored) and must never call into this
function: there is no successful handler Value to read item_count
from for an errored dispatch.