alpiecode 2.0.11__tar.gz → 2.0.13__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. {alpiecode-2.0.11 → alpiecode-2.0.13}/PKG-INFO +1 -1
  2. {alpiecode-2.0.11 → alpiecode-2.0.13}/pyproject.toml +1 -1
  3. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/alpiecode.egg-info/PKG-INFO +1 -1
  4. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/alpiecode.egg-info/SOURCES.txt +1 -0
  5. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/__init__.py +1 -1
  6. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/executor.py +99 -0
  7. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/orchestrator.py +7 -2
  8. alpiecode-2.0.13/test/test_nested_xml_tools.py +41 -0
  9. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_report_convergence.py +11 -0
  10. {alpiecode-2.0.11 → alpiecode-2.0.13}/README.md +0 -0
  11. {alpiecode-2.0.11 → alpiecode-2.0.13}/setup.cfg +0 -0
  12. {alpiecode-2.0.11 → alpiecode-2.0.13}/setup.py +0 -0
  13. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/alpiecode/__init__.py +0 -0
  14. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/alpiecode.egg-info/dependency_links.txt +0 -0
  15. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/alpiecode.egg-info/entry_points.txt +0 -0
  16. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/alpiecode.egg-info/requires.txt +0 -0
  17. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/alpiecode.egg-info/top_level.txt +0 -0
  18. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/__main__.py +0 -0
  19. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/agent.py +0 -0
  20. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/assessment.py +0 -0
  21. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/backends/__init__.py +0 -0
  22. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/backends/base.py +0 -0
  23. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/backends/local_backend.py +0 -0
  24. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/backends/openai_backend.py +0 -0
  25. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/blueprints.py +0 -0
  26. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/cache.py +0 -0
  27. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/capabilities.py +0 -0
  28. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/chat_tags.py +0 -0
  29. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/cli.py +0 -0
  30. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/client.py +0 -0
  31. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/compaction.py +0 -0
  32. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/config.py +0 -0
  33. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/context.py +0 -0
  34. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/convergence.py +0 -0
  35. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/diff_preview.py +0 -0
  36. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/discovery.py +0 -0
  37. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/doctor.py +0 -0
  38. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/dream_rsi.py +0 -0
  39. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/evaluation.py +0 -0
  40. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/execution_safety.py +0 -0
  41. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/git_ops.py +0 -0
  42. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/github.py +0 -0
  43. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/grounding.py +0 -0
  44. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/guardian.py +0 -0
  45. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/guardrails.py +0 -0
  46. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/ipython_ext.py +0 -0
  47. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/lifecycle.py +0 -0
  48. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/local_model.py +0 -0
  49. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/media.py +0 -0
  50. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/memory.py +0 -0
  51. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/metrics.py +0 -0
  52. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/onboarding.py +0 -0
  53. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/paths.py +0 -0
  54. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/progress.py +0 -0
  55. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/project_template.py +0 -0
  56. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/prompt.py +0 -0
  57. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/rephraser.py +0 -0
  58. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/server.py +0 -0
  59. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/session.py +0 -0
  60. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/accessibility-audit/SKILL.md +0 -0
  61. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/accessibility-testing/SKILL.md +0 -0
  62. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/accessibility-ui-components/SKILL.md +0 -0
  63. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/agentic-workflows/SKILL.md +0 -0
  64. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/api-design/SKILL.md +0 -0
  65. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/architecture-design/SKILL.md +0 -0
  66. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/backend-engineering/SKILL.md +0 -0
  67. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/browser-automation/SKILL.md +0 -0
  68. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/cli-development/SKILL.md +0 -0
  69. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/cloud-infrastructure/SKILL.md +0 -0
  70. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/code-generation/SKILL.md +0 -0
  71. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/code-review/SKILL.md +0 -0
  72. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/codebase-onboarding/SKILL.md +0 -0
  73. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/cost-optimization/SKILL.md +0 -0
  74. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/data-analysis/SKILL.md +0 -0
  75. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/data-engineering/SKILL.md +0 -0
  76. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/database-engineering/SKILL.md +0 -0
  77. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/dependency-management/SKILL.md +0 -0
  78. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/dependency-security/SKILL.md +0 -0
  79. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/dependency-upgrades/SKILL.md +0 -0
  80. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/devops-ci-cd/SKILL.md +0 -0
  81. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/docker-containers/SKILL.md +0 -0
  82. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/documentation/SKILL.md +0 -0
  83. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/documentation-site/SKILL.md +0 -0
  84. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/e2e-testing/SKILL.md +0 -0
  85. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/error-handling-resilience/SKILL.md +0 -0
  86. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/feature-development/SKILL.md +0 -0
  87. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/frontend-engineering/SKILL.md +0 -0
  88. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/git-workflow/SKILL.md +0 -0
  89. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/incident-response/SKILL.md +0 -0
  90. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/legacy-code-modernization/SKILL.md +0 -0
  91. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/llm-application-engineering/SKILL.md +0 -0
  92. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/localization-i18n/SKILL.md +0 -0
  93. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/mcp-server-development/SKILL.md +0 -0
  94. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/migration-engineering/SKILL.md +0 -0
  95. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/mobile-development/SKILL.md +0 -0
  96. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/model-evaluation/SKILL.md +0 -0
  97. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/nodejs-services/SKILL.md +0 -0
  98. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/observability/SKILL.md +0 -0
  99. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/performance-optimization/SKILL.md +0 -0
  100. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/privacy-data-protection/SKILL.md +0 -0
  101. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/prompt-engineering/SKILL.md +0 -0
  102. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/python-engineering/SKILL.md +0 -0
  103. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/rag-retrieval/SKILL.md +0 -0
  104. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/react-engineering/SKILL.md +0 -0
  105. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/release-management/SKILL.md +0 -0
  106. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/requirements-analysis/SKILL.md +0 -0
  107. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/responsive-design/SKILL.md +0 -0
  108. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/safe-refactoring/SKILL.md +0 -0
  109. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/secure-coding/SKILL.md +0 -0
  110. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/systematic-debugging/SKILL.md +0 -0
  111. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/technical-planning/SKILL.md +0 -0
  112. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/technical-research/SKILL.md +0 -0
  113. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/technical-writing/SKILL.md +0 -0
  114. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/test-engineering/SKILL.md +0 -0
  115. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/tool-integration/SKILL.md +0 -0
  116. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/typescript-engineering/SKILL.md +0 -0
  117. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/visual-regression-testing/SKILL.md +0 -0
  118. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/web-performance/SKILL.md +0 -0
  119. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/web-security-testing/SKILL.md +0 -0
  120. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills/workflow-automation/SKILL.md +0 -0
  121. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/skills.py +0 -0
  122. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/slash.py +0 -0
  123. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/subagent.py +0 -0
  124. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/system1.py +0 -0
  125. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/tools.py +0 -0
  126. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/updater.py +0 -0
  127. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/verifier.py +0 -0
  128. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/vision.py +0 -0
  129. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/vscode_installer.py +0 -0
  130. {alpiecode-2.0.11 → alpiecode-2.0.13}/src/codeagent/walkthrough.py +0 -0
  131. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_adaptive_resilience.py +0 -0
  132. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_chat_tags_and_offline_multimodal.py +0 -0
  133. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_cli_ui.py +0 -0
  134. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_context_and_trajectory.py +0 -0
  135. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_deloop_and_sessions.py +0 -0
  136. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_dream_rsi.py +0 -0
  137. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_execution_recovery.py +0 -0
  138. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_frontier_architecture.py +0 -0
  139. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_gpu_detection.py +0 -0
  140. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_lifecycle_and_portfolio.py +0 -0
  141. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_local_model_download.py +0 -0
  142. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_memory_optimization.py +0 -0
  143. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_non_thinking_and_local_stream.py +0 -0
  144. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_onboarding.py +0 -0
  145. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_project_templates.py +0 -0
  146. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_release_foundations.py +0 -0
  147. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_repair_evidence.py +0 -0
  148. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_security_config.py +0 -0
  149. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_skills_engine.py +0 -0
  150. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_slash_and_diff.py +0 -0
  151. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_subagents.py +0 -0
  152. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_task_assessment.py +0 -0
  153. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_token_economy_and_256k.py +0 -0
  154. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_truncation_resilience.py +0 -0
  155. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_verifier.py +0 -0
  156. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_visual_grounding.py +0 -0
  157. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_walkthrough.py +0 -0
  158. {alpiecode-2.0.11 → alpiecode-2.0.13}/test/test_web_resilience_and_guardrails.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alpiecode
3
- Version: 2.0.11
3
+ Version: 2.0.13
4
4
  Summary: AlpieCode
5
5
  Requires-Python: >=3.9
6
6
  Requires-Dist: huggingface_hub>=0.20.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "alpiecode"
7
- version = "2.0.11"
7
+ version = "2.0.13"
8
8
  description = "AlpieCode"
9
9
  requires-python = ">=3.9"
10
10
  dependencies = [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alpiecode
3
- Version: 2.0.11
3
+ Version: 2.0.13
4
4
  Summary: AlpieCode
5
5
  Requires-Python: >=3.9
6
6
  Requires-Dist: huggingface_hub>=0.20.0
@@ -136,6 +136,7 @@ test/test_gpu_detection.py
136
136
  test/test_lifecycle_and_portfolio.py
137
137
  test/test_local_model_download.py
138
138
  test/test_memory_optimization.py
139
+ test/test_nested_xml_tools.py
139
140
  test/test_non_thinking_and_local_stream.py
140
141
  test/test_onboarding.py
141
142
  test/test_project_templates.py
@@ -17,7 +17,7 @@ Supports:
17
17
  from pathlib import Path
18
18
  from typing import Optional, Any, Dict
19
19
 
20
- __version__ = "2.0.11"
20
+ __version__ = "2.0.13"
21
21
 
22
22
  def run(task: str, workdir: str = ".", reasoning_level: str = "thinking", **kwargs):
23
23
  """Run an autonomous coding task programmatically."""
@@ -134,6 +134,105 @@ def parse_text_tool_calls(text: str) -> List[dict]:
134
134
  if tool_calls:
135
135
  return tool_calls
136
136
 
137
+ # Native checkpoints may emit nested XML instead of JSON. The inner call
138
+ # must be complete; a missing outer </tool_call> is only a wrapper omission.
139
+ # Parse parameter bodies as raw text so Python comparisons and indentation
140
+ # survive unchanged. Never recover a partially generated edit or command.
141
+ from .tools import TOOLS
142
+ allowed_names = {tool["function"]["name"] for tool in TOOLS}
143
+
144
+ # Format A: <tool_call><TOOL_NAME><KEY>VALUE</KEY>...</TOOL_NAME>
145
+ nested_calls = re.finditer(
146
+ r"<tool_call>\s*<([A-Za-z_][A-Za-z0-9_]*)>(.*?)</\1>", text, re.DOTALL
147
+ )
148
+ for call in nested_calls:
149
+ name, body = call.group(1), call.group(2)
150
+ if name not in allowed_names:
151
+ continue
152
+ args = {}
153
+ cursor = 0
154
+ valid = True
155
+ for param in re.finditer(r"<([A-Za-z_][A-Za-z0-9_]*)>(.*?)</\1>", body, re.DOTALL):
156
+ if body[cursor:param.start()].strip() or param.group(1) in args:
157
+ valid = False
158
+ break
159
+ key, value = param.group(1), param.group(2)
160
+ # Strip wrapper line breaks, not indentation inside code parameters.
161
+ value = value.removeprefix("\r\n").removeprefix("\n")
162
+ value = value.removesuffix("\r\n").removesuffix("\n")
163
+ if key in ("path", "command", "pattern", "name"):
164
+ value = value.strip()
165
+ if key in ("start_line", "end_line", "max_depth"):
166
+ try:
167
+ value = int(value.strip())
168
+ except ValueError:
169
+ valid = False
170
+ break
171
+ args[key] = value
172
+ cursor = param.end()
173
+ if valid and args and not body[cursor:].strip():
174
+ _process_item({"name": name, "arguments": args})
175
+ if tool_calls:
176
+ return tool_calls
177
+
178
+ # Format B: <tool_call><TOOL_NAME><argument KEY="VALUE" />...</TOOL_NAME>
179
+ # Some GGUF checkpoints emit this XML-attribute style instead of nested elements.
180
+ arg_attr_calls = re.finditer(
181
+ r"<tool_call>\s*<([A-Za-z_][A-Za-z0-9_]*)>(.*?)</\1>", text, re.DOTALL
182
+ )
183
+ for call in arg_attr_calls:
184
+ name, body = call.group(1), call.group(2)
185
+ if name not in allowed_names:
186
+ continue
187
+ args = {}
188
+ # Match <argument KEY="VALUE" /> self-closing tags
189
+ for param in re.finditer(r'<argument\s+([A-Za-z_][A-Za-z0-9_]*)="([^"]*?)"\s*/>', body):
190
+ args[param.group(1)] = param.group(2)
191
+ # Also match <argument KEY="VALUE"></argument> open/close tags
192
+ for param in re.finditer(r'<argument\s+([A-Za-z_][A-Za-z0-9_]*)="([^"]*?)"\s*>\s*</argument>', body):
193
+ args[param.group(1)] = param.group(2)
194
+ # Also match <argument KEY="VALUE">BODY</argument> with body content
195
+ for param in re.finditer(r'<argument\s+([A-Za-z_][A-Za-z0-9_]*)(?:="[^"]*?")?\s*>(.*?)</argument>', body, re.DOTALL):
196
+ key = param.group(1)
197
+ value = param.group(2).strip()
198
+ if value and key not in args:
199
+ args[key] = value
200
+ if args:
201
+ # Clean up path/command values
202
+ for key in ("path", "command", "pattern", "name"):
203
+ if key in args:
204
+ args[key] = args[key].strip()
205
+ for key in ("start_line", "end_line", "max_depth"):
206
+ if key in args:
207
+ try:
208
+ args[key] = int(str(args[key]).strip())
209
+ except ValueError:
210
+ pass
211
+ _process_item({"name": name, "arguments": args})
212
+ if tool_calls:
213
+ return tool_calls
214
+
215
+ # Format C: Bare <TOOL_NAME><argument .../></TOOL_NAME> without <tool_call> wrapper
216
+ # Some checkpoints omit the outer <tool_call> wrapper entirely.
217
+ bare_arg_calls = re.finditer(
218
+ r"<([A-Za-z_][A-Za-z0-9_]*)>\s*(?:<argument\b[^>]*/>\s*)+</\1>", text, re.DOTALL
219
+ )
220
+ for call in bare_arg_calls:
221
+ name = call.group(0)
222
+ tag_name = call.group(1)
223
+ if tag_name not in allowed_names:
224
+ continue
225
+ args = {}
226
+ for param in re.finditer(r'<argument\s+([A-Za-z_][A-Za-z0-9_]*)="([^"]*?)"\s*/>', call.group(0)):
227
+ args[param.group(1)] = param.group(2)
228
+ if args:
229
+ for key in ("path", "command", "pattern", "name"):
230
+ if key in args:
231
+ args[key] = args[key].strip()
232
+ _process_item({"name": tag_name, "arguments": args})
233
+ if tool_calls:
234
+ return tool_calls
235
+
137
236
  # Some local checkpoints emit a complete self-closing XML function inside
138
237
  # the tool wrapper. Accept only a standalone call, never prose/examples or
139
238
  # incomplete XML. Dispatch restrictions and approval gates still apply.
@@ -999,8 +999,13 @@ class AgentOrchestrator:
999
999
 
1000
1000
  # Clean any stray </think> tags from content
1001
1001
  if resp.content and "</think>" in resp.content:
1002
- parts = resp.content.split("</think>", 1)
1003
- resp.content = parts[1].strip()
1002
+ if "<think>" in resp.content:
1003
+ parts = resp.content.split("</think>", 1)
1004
+ resp.content = parts[1].strip()
1005
+ else:
1006
+ # A stray closing tag is not a boundary for hidden reasoning.
1007
+ # Preserve complete tool calls that precede it.
1008
+ resp.content = resp.content.replace("</think>", "").strip()
1004
1009
 
1005
1010
  # Extract tool calls immediately so resp.tool_calls is populated before saving to context
1006
1011
  extracted_tcs = session.executor.extract_tool_calls(resp)
@@ -0,0 +1,41 @@
1
+ """Tool format regressions from the local multimodal repair conversation."""
2
+ from codeagent.executor import ToolExecutor, parse_text_tool_calls
3
+ from codeagent.backends.base import ChatResponse
4
+
5
+
6
+ def test_nested_xml_read_executes_through_shared_executor(tmp_path):
7
+ (tmp_path / "bigram.py").write_text("import torch\n")
8
+ response = ChatResponse("<tool_call>\n<read_file>\n<path>\nbigram.py\n</path>\n</read_file>", None, None)
9
+ executor = ToolExecutor(tmp_path)
10
+ calls = executor.extract_tool_calls(response)
11
+ assert len(calls) == 1
12
+ results = executor.execute_tool_calls(calls)
13
+ assert "import torch" in results[0].content
14
+
15
+
16
+ def test_xml_edit_preserves_python_indentation_and_comparisons():
17
+ text = '''<tool_call><edit_file><path>bigram.py</path><old_str>
18
+ if x < 3:
19
+ print(x)
20
+ </old_str><new_str>
21
+ if x < 4:
22
+ print(x)
23
+ </new_str></edit_file>'''
24
+ call, = parse_text_tool_calls(text)
25
+ assert call["arguments"]["old_str"] == " if x < 3:\n print(x)"
26
+ assert call["arguments"]["new_str"] == " if x < 4:\n print(x)"
27
+
28
+
29
+ def test_xml_duplicate_reads_are_deduplicated():
30
+ call = "<tool_call><read_file><path>bigram.py</path></read_file>"
31
+ assert len(parse_text_tool_calls(call + call)) == 1
32
+
33
+
34
+ def test_incomplete_xml_mutations_and_unknown_calls_are_rejected():
35
+ for text in (
36
+ "<tool_call><edit_file><path>bigram.py</path><new_str>partial",
37
+ "<tool_call><bash><command>python bigram.py</command>",
38
+ "<tool_call><unknown><path>bigram.py</path></unknown>",
39
+ "<tool_call><edit_file><path>x</path><new_str>partial</edit_file>",
40
+ ):
41
+ assert parse_text_tool_calls(text) == []
@@ -41,6 +41,17 @@ def write_response(content, path="RESEARCH_REPORT.md"):
41
41
  return ChatResponse(None, None, [ToolCall("w", "write_file", {"path": path, "content": content})])
42
42
 
43
43
 
44
+ @pytest.mark.parametrize("offline", [True, False])
45
+ def test_xml_call_before_stray_think_tag_executes(run_agent, offline):
46
+ xml = "<tool_call><write_file><path>output.txt</path><content>Observed evidence.</content></write_file></think>"
47
+ events, backend, session = run_agent([
48
+ ChatResponse(xml, None, None),
49
+ ChatResponse("DONE: output.txt contains the requested observed evidence.", None, None),
50
+ ], task="Create output.txt", offline=offline)
51
+ assert (session.workdir / "output.txt").read_text() == "Observed evidence."
52
+ assert events[-1].data["success"]
53
+
54
+
44
55
  @pytest.mark.parametrize("offline", [True, False])
45
56
  def test_report_draft_expansion_then_summary_finishes(run_agent, offline):
46
57
  summary = "The comparison report is ready. Current prices remain unverified and only sampled video frames were available."
File without changes
File without changes
File without changes