@@ -1185,6 +1185,59 @@ fn verisimdb_get_drift(entity_id: String) -> Result<String, String> {
11851185 }
11861186}
11871187
1188+ /// POST /normalizer/trigger/{id} — trigger normalisation (self-repair) for a drifted entity.
1189+ ///
1190+ /// VeriSimDB normalisation re-aligns an entity's modality vectors after drift is detected.
1191+ /// The normaliser recalculates consistency scores, re-validates proofs, and updates the
1192+ /// entity's hexad representation. Returns the normalisation result as JSON.
1193+ #[ tauri:: command]
1194+ fn verisimdb_normalise ( entity_id : String ) -> Result < String , String > {
1195+ let url = format ! ( "{}/normalizer/trigger/{}" , verisimdb_url( ) , entity_id) ;
1196+ let client = reqwest:: blocking:: Client :: builder ( )
1197+ . timeout ( std:: time:: Duration :: from_secs ( 30 ) )
1198+ . build ( )
1199+ . map_err ( |e| format ! ( "HTTP client error: {}" , e) ) ?;
1200+
1201+ match client. post ( & url) . send ( ) {
1202+ Ok ( resp) => {
1203+ let status = resp. status ( ) ;
1204+ let body = resp. text ( ) . unwrap_or_default ( ) ;
1205+ if status. is_success ( ) {
1206+ Ok ( body)
1207+ } else {
1208+ Err ( format ! ( "Normalisation failed ({}): {}" , status, body) )
1209+ }
1210+ }
1211+ Err ( e) => Err ( format ! ( "Normalisation request failed: {}" , e) ) ,
1212+ }
1213+ }
1214+
1215+ /// GET /hexads/{id} — retrieve full entity detail (all modality data) for a specific hexad.
1216+ ///
1217+ /// Returns the complete hexad representation including all six modality vectors,
1218+ /// consistency scores, proof attachments, and drift history for the given entity.
1219+ #[ tauri:: command]
1220+ fn verisimdb_get_entity ( entity_id : String ) -> Result < String , String > {
1221+ let url = format ! ( "{}/hexads/{}" , verisimdb_url( ) , entity_id) ;
1222+ let client = reqwest:: blocking:: Client :: builder ( )
1223+ . timeout ( std:: time:: Duration :: from_secs ( 10 ) )
1224+ . build ( )
1225+ . map_err ( |e| format ! ( "HTTP client error: {}" , e) ) ?;
1226+
1227+ match client. get ( & url) . send ( ) {
1228+ Ok ( resp) => {
1229+ let status = resp. status ( ) ;
1230+ let body = resp. text ( ) . unwrap_or_default ( ) ;
1231+ if status. is_success ( ) {
1232+ Ok ( body)
1233+ } else {
1234+ Err ( format ! ( "Get entity failed ({}): {}" , status, body) )
1235+ }
1236+ }
1237+ Err ( e) => Err ( format ! ( "Get entity request failed: {}" , e) ) ,
1238+ }
1239+ }
1240+
11881241fn main ( ) {
11891242 tauri:: Builder :: default ( )
11901243 . plugin ( tauri_plugin_shell:: init ( ) )
@@ -1203,6 +1256,8 @@ fn main() {
12031256 verisimdb_query,
12041257 verisimdb_list_hexads,
12051258 verisimdb_get_drift,
1259+ verisimdb_normalise,
1260+ verisimdb_get_entity,
12061261 verisimdb_telemetry,
12071262 verisimdb_orch_status,
12081263 ] )
0 commit comments