@@ -193,37 +193,6 @@ def _find_best_closing_brace_match(matches, text: str):
193193 return best_match
194194
195195
196- def _trigger_sentinel_async () -> None :
197- """Fire the Unity menu flip on a short-lived background thread.
198-
199- This avoids blocking the current request or getting stuck during domain reloads
200- (socket reconnects) when the Editor recompiles.
201- """
202- try :
203- import threading , time
204-
205- def _flip ():
206- try :
207- import json , glob , os
208- # Small delay so write flushes; prefer early flip to avoid editor-focus second reload
209- time .sleep (0.1 )
210- try :
211- files = sorted (glob .glob (os .path .expanduser ("~/.unity-mcp/unity-mcp-status-*.json" )), key = os .path .getmtime , reverse = True )
212- if files :
213- with open (files [0 ], "r" ) as f :
214- st = json .loads (f .read ())
215- if st .get ("reloading" ):
216- return
217- except Exception :
218- pass
219-
220- except Exception :
221- pass
222-
223- threading .Thread (target = _flip , daemon = True ).start ()
224- except Exception :
225- pass
226-
227196def _infer_class_name (script_name : str ) -> str :
228197 # Default to script name as class name (common Unity pattern)
229198 return (script_name or "" ).strip ()
@@ -578,12 +547,7 @@ def error_with_hint(message: str, expected: Dict[str, Any], suggestion: Dict[str
578547 }
579548 resp_struct = send_command_with_retry ("manage_script" , params_struct )
580549 if isinstance (resp_struct , dict ) and resp_struct .get ("success" ):
581- # Optional: flip sentinel only if explicitly requested
582- if (options or {}).get ("force_sentinel_reload" ):
583- try :
584- _trigger_sentinel_async ()
585- except Exception :
586- pass
550+ pass # Optional sentinel reload removed (deprecated)
587551 return _with_norm (resp_struct if isinstance (resp_struct , dict ) else {"success" : False , "message" : str (resp_struct )}, normalized_for_echo , routing = "structured" )
588552
589553 # 1) read from Unity
@@ -704,12 +668,7 @@ def _expand_dollars(rep: str) -> str:
704668 resp_text = send_command_with_retry ("manage_script" , params_text )
705669 if not (isinstance (resp_text , dict ) and resp_text .get ("success" )):
706670 return _with_norm (resp_text if isinstance (resp_text , dict ) else {"success" : False , "message" : str (resp_text )}, normalized_for_echo , routing = "mixed/text-first" )
707- # Successful text write; flip sentinel only if explicitly requested
708- if (options or {}).get ("force_sentinel_reload" ):
709- try :
710- _trigger_sentinel_async ()
711- except Exception :
712- pass
671+ # Optional sentinel reload removed (deprecated)
713672 except Exception as e :
714673 return _with_norm ({"success" : False , "message" : f"Text edit conversion failed: { e } " }, normalized_for_echo , routing = "mixed/text-first" )
715674
@@ -728,11 +687,7 @@ def _expand_dollars(rep: str) -> str:
728687 }
729688 resp_struct = send_command_with_retry ("manage_script" , params_struct )
730689 if isinstance (resp_struct , dict ) and resp_struct .get ("success" ):
731- if (options or {}).get ("force_sentinel_reload" ):
732- try :
733- _trigger_sentinel_async ()
734- except Exception :
735- pass
690+ pass # Optional sentinel reload removed (deprecated)
736691 return _with_norm (resp_struct if isinstance (resp_struct , dict ) else {"success" : False , "message" : str (resp_struct )}, normalized_for_echo , routing = "mixed/text-first" )
737692
738693 return _with_norm ({"success" : True , "message" : "Applied text edits (no structured ops)" }, normalized_for_echo , routing = "mixed/text-first" )
@@ -851,11 +806,7 @@ def _expand_dollars(rep: str) -> str:
851806 }
852807 resp = send_command_with_retry ("manage_script" , params )
853808 if isinstance (resp , dict ) and resp .get ("success" ):
854- if (options or {}).get ("force_sentinel_reload" ):
855- try :
856- _trigger_sentinel_async ()
857- except Exception :
858- pass
809+ pass # Optional sentinel reload removed (deprecated)
859810 return _with_norm (
860811 resp if isinstance (resp , dict ) else {"success" : False , "message" : str (resp )},
861812 normalized_for_echo ,
@@ -937,11 +888,7 @@ def _expand_dollars(rep: str) -> str:
937888
938889 write_resp = send_command_with_retry ("manage_script" , params )
939890 if isinstance (write_resp , dict ) and write_resp .get ("success" ):
940- if (options or {}).get ("force_sentinel_reload" ):
941- try :
942- _trigger_sentinel_async ()
943- except Exception :
944- pass
891+ pass # Optional sentinel reload removed (deprecated)
945892 return _with_norm (
946893 write_resp if isinstance (write_resp , dict )
947894 else {"success" : False , "message" : str (write_resp )},
0 commit comments