Commit Graph
3 Commits
Author SHA1 Message Date
Tanishq 7b6d995e4e Decode escaped surrogate pairs in DirtyJson
DirtyJson decoded each \uXXXX escape on its own, so an escaped emoji such
as \ud83c\udf78 became two lone surrogates instead of U+1F378. The first
UTF-8 encode of the parsed text then failed with "surrogates not allowed",
for example in tty_session.send() when running code_execution_tool.

Join a high surrogate escape with a directly following low surrogate
escape, as json.loads does. The low half must be four ASCII hex digits,
since int() alone also accepts underscores and non-ASCII digits. Any other
lone surrogate escape becomes U+FFFD (json.loads keeps it), because tools
and logs encode parsed strings as UTF-8. BMP escapes and the invalid-hex
fallback are unchanged.
2026-10-31 04:21:23 +05:30
frdel e138e33ca9 Add file-level DOX docs & update AGENTS indexes
Add comprehensive file-level DOX documentation across the repo and update directory AGENTS.md indexes. Many new `*.py.dox.md` files were added under api, helpers, tools, plugins, extensions, webui, and other dirs to document endpoint purpose, ownership, runtime contracts, work guidance, and verification. Several AGENTS.md files were created or updated (agents profiles, api, docker, extensions, helpers, plugins, skills, webui components, etc.) to list child DOX files and clarify documentation/work guidance. Also add example and bundled profile DOX files (agent0, default, developer, hacker, researcher) and minor updates to helpers/dirty_json.py and its tests. These changes improve on-disk documentation coverage and establish the convention that each direct runtime file should have a matching `*.dox.md` describing its contracts and verification steps.
2026-06-08 12:41:53 +02:00
Alessandro 5a2223596a stop tool dispatch at first completed json object
Tool execution no longer waits for the full streamed assistant text. We now detect the first explicitly closed top-level JSON object, freeze that snapshot as the canonical tool request, and stop the model stream there for dispatch.

To make that safe, DirtyJson completion semantics are tightened so completed=true only means the root object was explicitly closed, not that parsing hit end of file. I also restricted the new extraction path to object roots only, since tool calls are always brace-delimited objects, and added tests for parser completion and early stream stop.
2026-04-03 16:56:21 +02:00