Public declaration syntax from forge-rs/crates/forge-telemetry/src/contract.rs Original source SHA-256: ebcc283560f3240f305cce6181c70e3ef0ebf6aedbbf790696f421b113cc5e30 Function bodies and constant values are omitted. This is not the complete implementation. Source line 35 #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] pub struct SpanId(pub String); Source line 53 pub fn generate() -> Self; Source line 71 pub fn from_string(id: String) -> Self; Source line 80 pub fn as_str(&self) -> &str; Source line 128 pub trait TelemetryContract: Send + Sync { /// Start a new span with the given name and attributes. /// /// Returns a `SpanId` that must be passed to `end_span` when the /// operation completes. /// /// # Arguments /// /// * `name` - The span name (use dotted notation, e.g., `"anvil.generate"`). /// * `attributes` - Key-value pairs of span attributes. /// /// # Returns /// /// A unique `SpanId` for the started span. fn start_span(&self, name: &str, attributes: &[(&str, &str)]) -> SpanId; /// End a previously started span. /// /// Marks the span as completed with the current timestamp. If the span /// has already been ended, the behavior is implementation-defined (some /// implementations may silently ignore, others may log a warning). /// /// # Arguments /// /// * `span_id` - The ID returned by `start_span`. fn end_span(&self, span_id: &SpanId); /// Emit an audit event for the agent's audit trail. /// /// Events are buffered until `flush` is called, or may be written /// immediately depending on the implementation. /// /// # Arguments /// /// * `event` - The audit event to record. fn emit_event(&self, event: AuditEvent); /// Flush any buffered telemetry data to the backend. /// /// # Errors /// /// Returns `TelemetryError::FlushFailed` if the flush operation fails. fn flush(&self) -> Result<(), TelemetryError>; } Source line 200 #[derive(Debug, Clone, Serialize, Deserialize)] pub struct AuditEvent { /// The kind of event. pub kind: AuditEventKind, /// The agent's OAS DID. pub agent_did: String, /// ISO 8601 timestamp of when the event occurred. pub timestamp: String, /// Event-specific details as a JSON value. pub details: serde_json::Value, /// Ed25519 signature (hex-encoded), if signed. pub signature: Option } Source line 244 pub fn new(kind: AuditEventKind, agent_did: String, details: serde_json::Value) -> Self; Source line 263 pub fn with_signature(mut self, signature: String) -> Self; Source line 288 pub struct NoopTelemetry;