sigil-validator-agent · dispatcher
Source declarations, signatures and documentation for dispatcher.
Source: sigil/node/sigil-validator-agent/src/dispatcher.rs. SHA-256: 6f640f2de705b02d8ae52ee447cfb72b4d8f4cafde02efdf6e762467ccf4b1eb.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
dispatcher::L3DispatchKind
What an L3 dispatch is asking a provider to do.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum L3DispatchKind {
/// Investigate a flagged transaction.
AnomalyInvestigation,
/// Reason about a governance proposal.
GovernanceReasoning,
/// Code review for an agent-led pipeline (D13).
CodeReview,
}Source line: 18.
dispatcher::L3Dispatch
One L3 dispatch request.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct L3Dispatch {
pub kind: L3DispatchKind,
/// Capability tag the provider must serve.
pub capability_tag: String,
/// Hash of the input the model will process.
pub input_hash: [u8; 32],
/// Estimated cycle cost reserved up front.
pub estimated_cycles: u64,
/// Identifier the runtime uses to correlate request and response.
pub request_id: [u8; 32]
}Source line: 29.
dispatcher::L3DispatchResult
What an L3 provider returns.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct L3DispatchResult {
pub request_id: [u8; 32],
/// Hash of the model that produced the output. Bound into the
/// TEE attestation for offline verification.
pub model_hash: [u8; 32],
/// Hash of the canonical output bytes.
pub output_hash: [u8; 32],
/// Provider DID that produced the output.
pub provider_did: String,
/// Recommendation surfaced to downstream consumers.
pub recommendation: L3Outcome
}Source line: 43.
dispatcher::L3Outcome
Recommendation kinds. The runtime maps these to concrete actions (governance proposals, model deprecation, etc.) at consumption time.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(tag = "action", rename_all = "PascalCase")]
pub enum L3Outcome {
/// No action recommended.
NoAction,
/// Recommend deprecation of an inference model.
DeprecateInferenceModel { model_hash: [u8; 32] },
/// Recommend a governance parameter change.
ParameterUpdate {
parameter_key: String,
proposed_value: String,
},
/// Free-form findings to log; no automated action.
LogFindings { rationale: String },
}Source line: 60.
dispatcher::L3Outcome::action_kind
Stable identifier for allowlist matching.
pub fn action_kind(&self) -> &'static str;Source line: 76.
dispatcher::L3Dispatcher
Dispatcher abstraction. Production uses a real dispatch_compute
client; tests use [MockL3Dispatcher].
#[async_trait]
pub trait L3Dispatcher: Send + Sync {
async fn dispatch(&self, request: L3Dispatch) -> Result<L3DispatchResult>;
}Source line: 89.
dispatcher::MockL3Dispatcher
In-memory dispatcher for tests. Pre-populate responses keyed by
request_id; calls to dispatch return the matching response or
the default if no match is found.
pub struct MockL3Dispatcher {
}Source line: 96.
dispatcher::MockL3Dispatcher::new
pub fn new(default: L3DispatchResult) -> Self;Source line: 103.
dispatcher::MockL3Dispatcher::set_response
pub fn set_response(&self, request_id: [u8; 32], result: L3DispatchResult);Source line: 111.
dispatcher::MockL3Dispatcher::call_count
pub fn call_count(&self) -> u32;Source line: 115.