From ce550a127b7dc972651bd15b9f09979a2c38688f Mon Sep 17 00:00:00 2001 From: tanaka takashi Date: Wed, 12 Aug 2026 00:02:23 +0900 Subject: feat: harden Python workflow and structured planning Replace the uv-specific skill with a portable Python skill and rewrite the default user system prompt as a concise, structured Markdown execution policy. Normalize a single fenced structured-JSON response, retry invalid skill selection with think disabled, validate selected skill output, and make coding plans keep editing and verification in one task. Document the file_edit patch payload, expose that contract in the tool catalog, and convert malformed patch input into a retryable tool failure instead of terminating the agent task. Update configuration and runtime tests for the Python skill, exact tool catalog, structured-output retry, and implementation-and-verification planning guidance. Verified with 82 Agent.Core tests and an agent-mcp Python scheduling scenario with 49 passing unittest cases. --- src/Agent.Core/Runtime/StructuredJson.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/Agent.Core/Runtime/StructuredJson.cs (limited to 'src/Agent.Core/Runtime/StructuredJson.cs') diff --git a/src/Agent.Core/Runtime/StructuredJson.cs b/src/Agent.Core/Runtime/StructuredJson.cs new file mode 100644 index 0000000..e0c1650 --- /dev/null +++ b/src/Agent.Core/Runtime/StructuredJson.cs @@ -0,0 +1,22 @@ +namespace Agent.Core.Runtime; + +internal static class StructuredJson +{ + public static string Unwrap(string content) + { + string value = content.Trim(); + int fenceStart = value.IndexOf("```", StringComparison.Ordinal); + if (fenceStart < 0) return value; + int firstLineEnd = value.IndexOf('\n', fenceStart); + if (firstLineEnd < 0) return value; + string opening = value[fenceStart..firstLineEnd].TrimEnd('\r'); + if (!string.Equals(opening, "```", StringComparison.Ordinal) && + !string.Equals(opening, "```json", StringComparison.OrdinalIgnoreCase)) + return value; + + int fenceEnd = value.IndexOf("```", firstLineEnd + 1, StringComparison.Ordinal); + if (fenceEnd < 0 || value.IndexOf("```", fenceEnd + 3, StringComparison.Ordinal) >= 0) + return value; + return value[(firstLineEnd + 1)..fenceEnd].Trim(); + } +} -- cgit v1.2.3