@@ -51,6 +51,7 @@ pub async fn add_env_message<'a>(
5151 memory_index : Arc <
5252 tokio:: sync:: RwLock < InMemoryVectorIndex < rig_fastembed:: EmbeddingModel , memory:: Entity > > ,
5353 > ,
54+ data_dir : & ' a Path ,
5455 workspace : & ' a Path ,
5556 process_registry : Arc < RwLock < ProcessRegistry > > ,
5657) {
@@ -116,19 +117,19 @@ pub async fn add_env_message<'a>(
116117 )
117118 } )
118119 . join ( "\n " ) ;
119- content . push ( UserContent :: text (
120- subst :: substitute (
121- ENV_DETAILS ,
122- & HashMap :: from ( [
123- ( "TIME ", chrono :: Local :: now ( ) . to_rfc2822 ( ) . as_str ( ) ) ,
124- ( "WORKING_DIR ", & workspace ) ,
125- ( "MEMORY_ENTRIES ", & memory_entries ) ,
126- ( "COMMANDS ", & commands ) ,
127- ( "FILES" , files ) ,
128- ] ) ,
129- )
130- . unwrap ( ) ,
131- ) ) ;
120+ let env_content = subst :: substitute (
121+ ENV_DETAILS ,
122+ & HashMap :: from ( [
123+ ( "TIME" , chrono :: Local :: now ( ) . to_rfc2822 ( ) . as_str ( ) ) ,
124+ ( "WORKING_DIR ", & workspace ) ,
125+ ( "MEMORY_ENTRIES ", & memory_entries ) ,
126+ ( "COMMANDS ", & commands ) ,
127+ ( "FILES ", files ) ,
128+ ] ) ,
129+ )
130+ . unwrap ( ) ;
131+ fs :: write ( data_dir . join ( "env.txt" ) , & env_content ) . unwrap ( ) ;
132+ content . push ( UserContent :: text ( env_content ) ) ;
132133 }
133134}
134135
0 commit comments