@@ -650,14 +650,13 @@ def productionize_routine(self, routine: Routine) -> ProductionRoutine:
650650 f"CRITICAL: PLACEHOLDERS ARE REPLACED AT RUNTIME AND MUST RESULT IN VALID JSON! "
651651 f"EXPLANATION: Placeholders like {{{{key}}}} are replaced at runtime with actual values. The format you choose determines the resulting JSON type. "
652652 f"For STRING values: Use \\ \" {{{{key}}}}\\ \" format (escaped quote + placeholder + escaped quote). "
653- f"This means in the JSON file you write: \\ \" \\ \" {{{{user_name}}}}\\ \" \\ \" . At runtime, the \\ \" {{{{user_name}}}}\\ \" part gets replaced, "
654- f"so \\ \" \\ \" {{{{user_name}}}}\\ \" \\ \" becomes \\ \" \\ \" John\\ \" \\ \" which becomes \\ \" John\\ \" (valid JSON string). "
655- f"For NUMERIC/NULL values: Use \\ \" {{{{key}}}}\\ \" format (regular quote + placeholder + quote). "
656- f"This means in the JSON file you write: \\ \" {{{{item_id}}}}\\ \" . At runtime, the {{{{item_id}}}} part gets replaced with the number, "
657- f"and the surrounding quotes are removed, so \\ \" {{{{item_id}}}}\\ \" with value 42 becomes just 42 (valid JSON number, not string). "
658- f"Example: \\ \" {{{{total_price}}}}\\ \" with value 29.99 → becomes 29.99 (quotes removed, valid JSON number). "
659- f"Example: \\ \" {{{{optional_data}}}}\\ \" with null → becomes null (quotes removed, valid JSON null). "
660- """Placeholders will be resolved using this: param_pattern = r'(?:"|\\ \\ ")\\ {\\ {([^}"]*)\\ }\\ }(?:"|\\ \\ ")'"""
653+ f"This means in the JSON file you write: \" \\ \" {{{{user_name}}}}\\ \" \" . At runtime, the \\ \" {{{{user_name}}}}\\ \" part gets replaced, "
654+ f"so \" \\ \" {{{{user_name}}}}\\ \" \" becomes \" John\" (valid JSON string). "
655+ f"For NUMERIC/NULL values: Use \" {{{{key}}}}\" format (regular quote + placeholder + quote). "
656+ f"This means in the JSON file you write: \" {{{{item_id}}}}\" . At runtime, the {{{{item_id}}}} part gets replaced with the number, "
657+ f"and the surrounding quotes are removed, so \" {{{{item_id}}}}\" with value 42 becomes just 42 (valid JSON number, not string). "
658+ f"Example: \" {{{{total_price}}}}\" with value 29.99 → becomes 29.99 (quotes removed, valid JSON number). "
659+ f"Example: \" {{{{optional_data}}}}\" with null → becomes null (quotes removed, valid JSON null). "
661660 f"The resulting JSON MUST be valid and parseable after all placeholder replacements are done."
662661 )
663662 self ._add_to_message_history ("user" , message )
0 commit comments