@@ -161,15 +161,21 @@ struct SessionMeta {
161161 turn_count : usize ,
162162}
163163
164- pub fn scan_all ( workspace : & Path , provider_filter : Option < crate :: types:: ProviderId > ) -> Vec < ChatSession > {
164+ pub fn scan_all (
165+ workspace : & Path ,
166+ provider_filter : Option < crate :: types:: ProviderId > ,
167+ ) -> Vec < ChatSession > {
165168 let mut sessions = Vec :: new ( ) ;
166169 let include = |p : ChatProvider | -> bool {
167170 provider_filter. is_none_or ( |prov| {
168171 matches ! (
169172 ( prov, p) ,
170173 ( crate :: types:: ProviderId :: Claude , ChatProvider :: Claude )
171174 | ( crate :: types:: ProviderId :: Codex , ChatProvider :: Codex )
172- | ( crate :: types:: ProviderId :: Antigravity , ChatProvider :: Antigravity )
175+ | (
176+ crate :: types:: ProviderId :: Antigravity ,
177+ ChatProvider :: Antigravity
178+ )
173179 | ( crate :: types:: ProviderId :: Kiro , ChatProvider :: Kiro )
174180 | ( crate :: types:: ProviderId :: OpenCode , ChatProvider :: OpenCode )
175181 )
@@ -639,7 +645,8 @@ fn scan_opencode() -> Vec<ChatSession> {
639645 let Some ( db_path) = opencode_db_path ( ) else {
640646 return vec ! [ ] ;
641647 } ;
642- let Ok ( conn) = Connection :: open_with_flags ( & db_path, rusqlite:: OpenFlags :: SQLITE_OPEN_READ_ONLY )
648+ let Ok ( conn) =
649+ Connection :: open_with_flags ( & db_path, rusqlite:: OpenFlags :: SQLITE_OPEN_READ_ONLY )
643650 else {
644651 return vec ! [ ] ;
645652 } ;
@@ -667,8 +674,8 @@ fn scan_opencode() -> Vec<ChatSession> {
667674 . map ( |r| r. filter_map ( |r| r. ok ( ) ) . collect ( ) )
668675 . unwrap_or_default ( ) ;
669676 rows. into_iter ( )
670- . map ( | ( id , title , directory , created , updated , msg_count ) | {
671- ChatSession {
677+ . map (
678+ | ( id , title , directory , created , updated , msg_count ) | ChatSession {
672679 id : id. clone ( ) ,
673680 title,
674681 provider : ChatProvider :: OpenCode ,
@@ -681,8 +688,8 @@ fn scan_opencode() -> Vec<ChatSession> {
681688 size_bytes : 0 ,
682689 imported : false ,
683690 trash_manifest : None ,
684- }
685- } )
691+ } ,
692+ )
686693 . collect ( )
687694}
688695
@@ -715,8 +722,7 @@ fn load_opencode_archive(session: &ChatSession) -> Result<ChatArchive> {
715722 } ) ;
716723 }
717724 }
718- if let Some ( tool_name) = str_field ( & val, & [ "name" ] ) . or_else ( || str_field ( & val, & [ "tool" ] ) )
719- {
725+ if let Some ( tool_name) = str_field ( & val, & [ "name" ] ) . or_else ( || str_field ( & val, & [ "tool" ] ) ) {
720726 tools. push ( ChatToolCall {
721727 name : tool_name. to_string ( ) ,
722728 timestamp : None ,
@@ -742,28 +748,27 @@ fn extract_text_field(val: &Value) -> String {
742748 str_field ( val, & [ "content" , "text" , "message" ] )
743749 . map ( ToOwned :: to_owned)
744750 . or_else ( || {
745- val. get ( "content" )
746- . and_then ( |c| {
747- if let Some ( s) = c. as_str ( ) {
748- Some ( s. to_string ( ) )
749- } else if let Some ( arr) = c. as_array ( ) {
750- let parts: Vec < String > = arr
751- . iter ( )
752- . filter_map ( |item| {
753- str_field ( item, & [ "text" ] )
754- . or_else ( || str_field ( item, & [ "content" ] ) )
755- . map ( ToOwned :: to_owned)
756- } )
757- . collect ( ) ;
758- if parts. is_empty ( ) {
759- None
760- } else {
761- Some ( parts. join ( "\n " ) )
762- }
763- } else {
751+ val. get ( "content" ) . and_then ( |c| {
752+ if let Some ( s) = c. as_str ( ) {
753+ Some ( s. to_string ( ) )
754+ } else if let Some ( arr) = c. as_array ( ) {
755+ let parts: Vec < String > = arr
756+ . iter ( )
757+ . filter_map ( |item| {
758+ str_field ( item, & [ "text" ] )
759+ . or_else ( || str_field ( item, & [ "content" ] ) )
760+ . map ( ToOwned :: to_owned)
761+ } )
762+ . collect ( ) ;
763+ if parts. is_empty ( ) {
764764 None
765+ } else {
766+ Some ( parts. join ( "\n " ) )
765767 }
766- } )
768+ } else {
769+ None
770+ }
771+ } )
767772 } )
768773 . unwrap_or_default ( )
769774}
0 commit comments