55use anyhow:: { Context , Result , bail} ;
66use clap:: Parser ;
77use std:: collections:: HashSet ;
8- use std:: path:: PathBuf ;
8+ use std:: path:: { Path , PathBuf } ;
99
1010use crate :: styled_output:: { print_info, print_success, print_warning} ;
1111use cortex_engine:: rollout:: recorder:: { RolloutRecorder , SessionMeta } ;
@@ -238,33 +238,7 @@ impl ImportCommand {
238238
239239/// Fetch content from a URL.
240240async fn fetch_url ( url : & str ) -> Result < String > {
241- // Use reqwest if available, otherwise fall back to curl
242- #[ cfg( feature = "reqwest" ) ]
243- {
244- let response = reqwest:: get ( url) . await ?;
245- if !response. status ( ) . is_success ( ) {
246- bail ! ( "Failed to fetch URL: HTTP {}" , response. status( ) ) ;
247- }
248-
249- // Check content-type header to warn about non-JSON content
250- if let Some ( content_type) = response. headers ( ) . get ( reqwest:: header:: CONTENT_TYPE ) {
251- let content_type_str = content_type. to_str ( ) . unwrap_or ( "" ) ;
252- if !content_type_str. contains ( "application/json" )
253- && !content_type_str. contains ( "text/plain" )
254- && !content_type_str. is_empty ( )
255- {
256- print_warning ( & format ! (
257- "URL returned Content-Type '{}', expected 'application/json'." ,
258- content_type_str
259- ) ) ;
260- print_info ( "The import may fail if the content is not valid JSON." ) ;
261- }
262- }
263-
264- Ok ( response. text ( ) . await ?)
265- }
266-
267- #[ cfg( not( feature = "reqwest" ) ) ]
241+ // Use curl for fetching
268242 {
269243 // Simple curl-based fallback
270244 use std:: process:: Command ;
@@ -452,7 +426,7 @@ fn validate_export_messages(messages: &[ExportMessage]) -> Result<()> {
452426}
453427
454428/// Convert an export message to a protocol event.
455- fn message_to_event ( message : & ExportMessage , turn_id : & mut u64 , cwd : & PathBuf ) -> Result < Event > {
429+ fn message_to_event ( message : & ExportMessage , turn_id : & mut u64 , cwd : & Path ) -> Result < Event > {
456430 let event_msg = match message. role . as_str ( ) {
457431 "user" => {
458432 * turn_id += 1 ;
@@ -475,7 +449,7 @@ fn message_to_event(message: &ExportMessage, turn_id: &mut u64, cwd: &PathBuf) -
475449 call_id : message. tool_call_id . clone ( ) . unwrap_or_default ( ) ,
476450 turn_id : turn_id. to_string ( ) ,
477451 command : vec ! [ "imported_tool" . to_string( ) ] ,
478- cwd : cwd. clone ( ) ,
452+ cwd : cwd. to_path_buf ( ) ,
479453 parsed_cmd : vec ! [ ParsedCommand {
480454 program: "imported_tool" . to_string( ) ,
481455 args: vec![ ] ,
0 commit comments