mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-08-05 02:45:28 +00:00
_emit_scalar quotes a frontmatter scalar with json.dumps when it holds punctuation that would change how the line reads back. _parse_scalar undid that with a bare raw[1:-1]: it stripped the quotes but never decoded the escapes. So a description containing ü was written as the escape sequence \u00fc, read back with that escape still sitting literally in the value, and re-escaped on the next save. The backslash run doubles every save, so a non-English skill description degrades into backslash noise after a few edits, and the escapes are shown verbatim in the skills list and the /skills catalog. This is not limited to non-ASCII. Any description containing a quote takes the same path, since the quote is itself what forces the quoted form. Make the two halves symmetric: emit with ensure_ascii=False, since SKILL.md is UTF-8 at both ends (skills.py reads it, atomic_write_text writes it) and the ASCII-escaped form bought nothing; and parse double-quoted scalars with json.loads, falling back to the previous literal reading when the value is not valid JSON. Files already corrupted heal one level per load. ensure_ascii=False on its own would open a smaller hole. json.dumps escapes every C0 control character but passes NEL, LINE SEPARATOR and PARAGRAPH SEPARATOR through literally, and parse_frontmatter reads one scalar per line via str.splitlines(), which breaks on all three. Re-escape those three, and add them plus the remaining splitlines characters to the set that forces a quoted scalar, so none of them can reach the file bare. |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| memory.py | ||
| memory_extractor.py | ||
| memory_vector.py | ||
| service.py | ||
| skill_extractor.py | ||
| skill_format.py | ||
| skill_importer.py | ||
| skills.py | ||