@@ -341,13 +341,13 @@ pub fn export_sessions<R: tauri::Runtime>(
341341 }
342342 }
343343 if ids. is_empty ( ) {
344- return Err ( AppError :: validation ( "会话ID为空" )
345- . with_hint ( "请粘贴或输入至少一个 UUID 会话ID。" ) ) ;
344+ return Err (
345+ AppError :: validation ( "会话ID为空" ) . with_hint ( "请粘贴或输入至少一个 UUID 会话ID。" )
346+ ) ;
346347 }
347348
348349 let export_dir = app_paths:: download_dir ( ) . map_err ( AppError :: from) ?;
349- fs:: create_dir_all ( & export_dir)
350- . map_err ( |e| AppError :: io ( format ! ( "create export dir: {e}" ) ) ) ?;
350+ fs:: create_dir_all ( & export_dir) . map_err ( |e| AppError :: io ( format ! ( "create export dir: {e}" ) ) ) ?;
351351
352352 let mut items: Vec < ExportSessionItem > = Vec :: new ( ) ;
353353 let mut errors: Vec < ExportSessionError > = Vec :: new ( ) ;
@@ -356,7 +356,11 @@ pub fn export_sessions<R: tauri::Runtime>(
356356 let name = if ids. len ( ) == 1 {
357357 params. name . clone ( )
358358 } else {
359- format ! ( "{} [{}]" , params. name, & sid. chars( ) . take( 8 ) . collect:: <String >( ) )
359+ format ! (
360+ "{} [{}]" ,
361+ params. name,
362+ & sid. chars( ) . take( 8 ) . collect:: <String >( )
363+ )
360364 } ;
361365 match export_session (
362366 app,
@@ -378,7 +382,11 @@ pub fn export_sessions<R: tauri::Runtime>(
378382 } ) ,
379383 Err ( e) => errors. push ( ExportSessionError {
380384 session_id : sid. clone ( ) ,
381- message : format ! ( "{}{}" , e. message, e. hint. map( |h| format!( "({})" , h) ) . unwrap_or_default( ) ) ,
385+ message : format ! (
386+ "{}{}" ,
387+ e. message,
388+ e. hint. map( |h| format!( "({})" , h) ) . unwrap_or_default( )
389+ ) ,
382390 } ) ,
383391 }
384392 }
@@ -876,7 +884,11 @@ pub fn import_bundles<R: tauri::Runtime>(
876884 // Best-effort: include short id in name when importing multiple sessions.
877885 let sid = read_manifest_session_id ( & src) . unwrap_or_else ( |_| "" . to_string ( ) ) ;
878886 let derived_name = if paths. len ( ) > 1 && !sid. is_empty ( ) {
879- format ! ( "{} [{}]" , params. name, & sid. chars( ) . take( 8 ) . collect:: <String >( ) )
887+ format ! (
888+ "{} [{}]" ,
889+ params. name,
890+ & sid. chars( ) . take( 8 ) . collect:: <String >( )
891+ )
880892 } else {
881893 params. name . clone ( )
882894 } ;
@@ -916,9 +928,8 @@ pub fn import_bundles<R: tauri::Runtime>(
916928 . map_err ( AppError :: from) ?
917929 . join ( "tmp_batch_import" )
918930 . join ( uuid:: Uuid :: now_v7 ( ) . to_string ( ) ) ;
919- fs:: create_dir_all ( & tmp_root) . map_err ( |e| {
920- AppError :: io ( format ! ( "create tmp_batch_import dir: {e}" ) )
921- } ) ?;
931+ fs:: create_dir_all ( & tmp_root)
932+ . map_err ( |e| AppError :: io ( format ! ( "create tmp_batch_import dir: {e}" ) ) ) ?;
922933
923934 for ( idx, entry_name) in entries. iter ( ) . enumerate ( ) {
924935 let tmp_zip = tmp_root. join ( format ! ( "inner-{idx}.zip" ) ) ;
@@ -932,7 +943,11 @@ pub fn import_bundles<R: tauri::Runtime>(
932943
933944 let sid = read_manifest_session_id ( & tmp_zip) . unwrap_or_else ( |_| "" . to_string ( ) ) ;
934945 let derived_name = if !sid. is_empty ( ) {
935- format ! ( "{} [{}]" , params. name, & sid. chars( ) . take( 8 ) . collect:: <String >( ) )
946+ format ! (
947+ "{} [{}]" ,
948+ params. name,
949+ & sid. chars( ) . take( 8 ) . collect:: <String >( )
950+ )
936951 } else {
937952 params. name . clone ( )
938953 } ;
@@ -1450,7 +1465,10 @@ fn build_batch_bundle_filename(op: &str, name: &str) -> String {
14501465 if file. chars ( ) . count ( ) > MAX_CHARS {
14511466 let extra = file. chars ( ) . count ( ) . saturating_sub ( MAX_CHARS ) ;
14521467 let target_len = safe_name. chars ( ) . count ( ) . saturating_sub ( extra + 3 ) ;
1453- let safe_name = safe_name. chars ( ) . take ( target_len. max ( 8 ) ) . collect :: < String > ( ) ;
1468+ let safe_name = safe_name
1469+ . chars ( )
1470+ . take ( target_len. max ( 8 ) )
1471+ . collect :: < String > ( ) ;
14541472 file = format ! ( "CodexRelay-{op}-batch-{ts}-{safe_name}.zip" ) ;
14551473 }
14561474 file
@@ -1524,10 +1542,8 @@ enum ZipBundleKind {
15241542}
15251543
15261544fn classify_zip_bundle ( zip_path : & Path ) -> AppResult < ZipBundleKind > {
1527- let f =
1528- fs:: File :: open ( zip_path) . map_err ( |e| AppError :: io ( format ! ( "open zip: {e}" ) ) ) ?;
1529- let mut z =
1530- zip:: ZipArchive :: new ( f) . map_err ( |e| AppError :: io ( format ! ( "read zip: {e}" ) ) ) ?;
1545+ let f = fs:: File :: open ( zip_path) . map_err ( |e| AppError :: io ( format ! ( "open zip: {e}" ) ) ) ?;
1546+ let mut z = zip:: ZipArchive :: new ( f) . map_err ( |e| AppError :: io ( format ! ( "read zip: {e}" ) ) ) ?;
15311547
15321548 let has_manifest = z. by_name ( "manifest.json" ) . is_ok ( ) ;
15331549 let has_rollout = z. by_name ( "rollout.jsonl" ) . is_ok ( ) ;
@@ -1567,7 +1583,11 @@ fn classify_zip_bundle(zip_path: &Path) -> AppResult<ZipBundleKind> {
15671583 Ok ( ZipBundleKind :: Unknown )
15681584}
15691585
1570- fn extract_zip_entry_to_file ( zip_path : & Path , entry_name : & str , out_path : & Path ) -> Result < ( ) , String > {
1586+ fn extract_zip_entry_to_file (
1587+ zip_path : & Path ,
1588+ entry_name : & str ,
1589+ out_path : & Path ,
1590+ ) -> Result < ( ) , String > {
15711591 const MAX_BYTES : u64 = 4 * 1024 * 1024 * 1024 ; // 4 GiB
15721592 let f = fs:: File :: open ( zip_path) . map_err ( |e| format ! ( "open zip: {e}" ) ) ?;
15731593 let mut z = zip:: ZipArchive :: new ( f) . map_err ( |e| format ! ( "read zip: {e}" ) ) ?;
@@ -1588,7 +1608,9 @@ fn extract_zip_entry_to_file(zip_path: &Path, entry_name: &str, out_path: &Path)
15881608 let mut buf = [ 0u8 ; 1024 * 64 ] ;
15891609 let mut total: u64 = 0 ;
15901610 loop {
1591- let n = entry. read ( & mut buf) . map_err ( |e| format ! ( "read entry: {e}" ) ) ?;
1611+ let n = entry
1612+ . read ( & mut buf)
1613+ . map_err ( |e| format ! ( "read entry: {e}" ) ) ?;
15921614 if n == 0 {
15931615 break ;
15941616 }
0 commit comments