@@ -200,7 +200,10 @@ impl NativeSkill for SkillInstallerSkill {
200200 let file_path = invocation. args . get ( "file_path" ) . and_then ( |v| v. as_str ( ) ) ;
201201
202202 if wasm_url. is_none ( ) && wasm_base64. is_none ( ) && file_path. is_none ( ) {
203- return Err ( SkillExecutionError :: new ( SkillFailureKind :: InvalidArguments , "missing wasm_url, wasm_base64, or file_path" ) ) ;
203+ return Err ( SkillExecutionError :: new (
204+ SkillFailureKind :: InvalidArguments ,
205+ "missing wasm_url, wasm_base64, or file_path" ,
206+ ) ) ;
204207 }
205208
206209 let input_schema = invocation
@@ -252,14 +255,23 @@ impl NativeSkill for SkillInstallerSkill {
252255 } else if let Some ( b64) = wasm_base64 {
253256 use base64:: { Engine as _, engine:: general_purpose} ;
254257 general_purpose:: STANDARD . decode ( b64) . map_err ( |err| {
255- SkillExecutionError :: new ( SkillFailureKind :: InvalidArguments , format ! ( "Base64 decode failed: {}" , err) )
258+ SkillExecutionError :: new (
259+ SkillFailureKind :: InvalidArguments ,
260+ format ! ( "Base64 decode failed: {}" , err) ,
261+ )
256262 } ) ?
257263 } else if let Some ( path) = file_path {
258264 tokio:: fs:: read ( path) . await . map_err ( |err| {
259- SkillExecutionError :: new ( SkillFailureKind :: InvalidArguments , format ! ( "File read failed: {}" , err) )
265+ SkillExecutionError :: new (
266+ SkillFailureKind :: InvalidArguments ,
267+ format ! ( "File read failed: {}" , err) ,
268+ )
260269 } ) ?
261270 } else {
262- return Err ( SkillExecutionError :: new ( SkillFailureKind :: InvalidArguments , "missing wasm_url, wasm_base64, or file_path" ) ) ;
271+ return Err ( SkillExecutionError :: new (
272+ SkillFailureKind :: InvalidArguments ,
273+ "missing wasm_url, wasm_base64, or file_path" ,
274+ ) ) ;
263275 } ;
264276
265277 let config = rain_engine_wasm:: WasmSkillConfig {
@@ -736,11 +748,13 @@ pub async fn build_runtime_state(
736748 } ;
737749
738750 let mut engine = AgentEngine :: new ( llm. clone ( ) , memory. clone ( ) ) ;
739-
751+
740752 if let Some ( cache_config) = & config. cache {
741753 if let Some ( valkey_url) = & cache_config. valkey_url {
742754 let valkey_cache = rain_engine_core:: ValkeyStateCache :: new ( valkey_url, "rain" )
743- . map_err ( |err| RuntimeConfigError :: Invalid ( format ! ( "Valkey cache error: {}" , err) ) ) ?;
755+ . map_err ( |err| {
756+ RuntimeConfigError :: Invalid ( format ! ( "Valkey cache error: {}" , err) )
757+ } ) ?;
744758 engine = engine. with_state_cache ( Arc :: new ( valkey_cache) ) ;
745759 tracing:: info!( "Configured Valkey state projection cache" ) ;
746760 }
@@ -1331,47 +1345,50 @@ async fn handle_get_session(
13311345 State ( state) : State < RuntimeState > ,
13321346 Path ( session_id) : Path < String > ,
13331347) -> Result < Json < Value > , ( StatusCode , String ) > {
1334- let snapshot = if let Ok ( Some ( cached) ) = state. engine . state_cache ( ) . get_projection ( & session_id) . await {
1335- cached
1336- } else {
1337- state
1338- . memory
1339- . load_session ( & session_id)
1340- . await
1341- . map_err ( |err| ( StatusCode :: INTERNAL_SERVER_ERROR , err. message ) ) ?
1342- } ;
1348+ let snapshot =
1349+ if let Ok ( Some ( cached) ) = state. engine . state_cache ( ) . get_projection ( & session_id) . await {
1350+ cached
1351+ } else {
1352+ state
1353+ . memory
1354+ . load_session ( & session_id)
1355+ . await
1356+ . map_err ( |err| ( StatusCode :: INTERNAL_SERVER_ERROR , err. message ) ) ?
1357+ } ;
13431358 Ok ( Json ( serde_json:: to_value ( snapshot) . unwrap_or_default ( ) ) )
13441359}
13451360
13461361async fn handle_get_session_view (
13471362 State ( state) : State < RuntimeState > ,
13481363 Path ( session_id) : Path < String > ,
13491364) -> Result < Json < SessionView > , ( StatusCode , String ) > {
1350- let snapshot = if let Ok ( Some ( cached) ) = state. engine . state_cache ( ) . get_projection ( & session_id) . await {
1351- cached
1352- } else {
1353- state
1354- . memory
1355- . load_session ( & session_id)
1356- . await
1357- . map_err ( |err| ( StatusCode :: INTERNAL_SERVER_ERROR , err. message ) ) ?
1358- } ;
1365+ let snapshot =
1366+ if let Ok ( Some ( cached) ) = state. engine . state_cache ( ) . get_projection ( & session_id) . await {
1367+ cached
1368+ } else {
1369+ state
1370+ . memory
1371+ . load_session ( & session_id)
1372+ . await
1373+ . map_err ( |err| ( StatusCode :: INTERNAL_SERVER_ERROR , err. message ) ) ?
1374+ } ;
13591375 Ok ( Json ( build_session_view ( snapshot) ) )
13601376}
13611377
13621378async fn handle_get_execution_graph (
13631379 State ( state) : State < RuntimeState > ,
13641380 Path ( session_id) : Path < String > ,
13651381) -> Result < Json < ExecutionGraphView > , ( StatusCode , String ) > {
1366- let snapshot = if let Ok ( Some ( cached) ) = state. engine . state_cache ( ) . get_projection ( & session_id) . await {
1367- cached
1368- } else {
1369- state
1370- . memory
1371- . load_session ( & session_id)
1372- . await
1373- . map_err ( |err| ( StatusCode :: INTERNAL_SERVER_ERROR , err. message ) ) ?
1374- } ;
1382+ let snapshot =
1383+ if let Ok ( Some ( cached) ) = state. engine . state_cache ( ) . get_projection ( & session_id) . await {
1384+ cached
1385+ } else {
1386+ state
1387+ . memory
1388+ . load_session ( & session_id)
1389+ . await
1390+ . map_err ( |err| ( StatusCode :: INTERNAL_SERVER_ERROR , err. message ) ) ?
1391+ } ;
13751392 Ok ( Json ( build_execution_graph_view ( & snapshot) ) )
13761393}
13771394
@@ -1408,14 +1425,23 @@ async fn handle_install_skill(
14081425 } else if let Some ( b64) = & request. wasm_base64 {
14091426 use base64:: { Engine as _, engine:: general_purpose} ;
14101427 general_purpose:: STANDARD . decode ( b64) . map_err ( |err| {
1411- ( StatusCode :: BAD_REQUEST , format ! ( "Base64 decode failed: {}" , err) )
1428+ (
1429+ StatusCode :: BAD_REQUEST ,
1430+ format ! ( "Base64 decode failed: {}" , err) ,
1431+ )
14121432 } ) ?
14131433 } else if let Some ( path) = & request. file_path {
14141434 tokio:: fs:: read ( path) . await . map_err ( |err| {
1415- ( StatusCode :: BAD_REQUEST , format ! ( "File read failed: {}" , err) )
1435+ (
1436+ StatusCode :: BAD_REQUEST ,
1437+ format ! ( "File read failed: {}" , err) ,
1438+ )
14161439 } ) ?
14171440 } else {
1418- return Err ( ( StatusCode :: BAD_REQUEST , "Must provide wasm_url, wasm_base64, or file_path" . to_string ( ) ) ) ;
1441+ return Err ( (
1442+ StatusCode :: BAD_REQUEST ,
1443+ "Must provide wasm_url, wasm_base64, or file_path" . to_string ( ) ,
1444+ ) ) ;
14191445 } ;
14201446
14211447 let config = rain_engine_wasm:: WasmSkillConfig {
0 commit comments