Skip to main content

resource_payload

Function resource_payload 

Source
pub fn resource_payload(
    verb: &str,
    params: &Value,
    result: &Value,
    registered_model_count: impl FnOnce() -> i64,
    request_id: Option<u64>,
) -> Value
Expand description

Build the resource payload object, {"work_class": "interactive", "cost_unit": N}, for one successful verb dispatch.

Every dispatch through VerbRegistry::dispatch* is work_class: "interactive" (ADR-103 Decision (a): “Request-driven synchronous verb dispatch. Default for all handlers.”). Background phase work (embedder warmup, ANN rebuild, etc.) uses the separate PhaseStarted / PhaseCompleted / PhaseCancelled event family and never this payload.

request_id (khive#948) is the caller-supplied correlation id threaded in from the daemon frame via RequestIdentity, stamped alongside work_class/cost_unit when the caller supplied one. Its absence has exactly one meaning (no id was supplied, e.g. a pre-#948 client or an internal/non-benchmark caller) — unlike cost_unit, it is never conditionally omitted on an otherwise-successful row.