pub fn emit_error( command: &str, code: &str, message: impl Into<String>, details: Option<Value>, ) -> Result<()>