Spaces:
Runtime error
Runtime error
zhimin-z commited on
Commit ·
76eead8
1
Parent(s): d3e0755
add
Browse files
README.md
CHANGED
|
@@ -6,6 +6,7 @@ colorTo: purple
|
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.50.0
|
| 8 |
app_file: app.py
|
|
|
|
| 9 |
hf_oauth: true
|
| 10 |
pinned: false
|
| 11 |
short_description: Model arena for software engineering tasks
|
|
|
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.50.0
|
| 8 |
app_file: app.py
|
| 9 |
+
suggested_hardware: cpu-upgrade
|
| 10 |
hf_oauth: true
|
| 11 |
pinned: false
|
| 12 |
short_description: Model arena for software engineering tasks
|
app.py
CHANGED
|
@@ -77,11 +77,12 @@ def _install_opencode():
|
|
| 77 |
|
| 78 |
|
| 79 |
def _ensure_opencode():
|
| 80 |
-
"""
|
| 81 |
opencode_bin = os.path.join(os.path.expanduser("~"), ".opencode", "bin")
|
| 82 |
if opencode_bin not in os.environ.get("PATH", ""):
|
| 83 |
os.environ["PATH"] = opencode_bin + os.pathsep + os.environ.get("PATH", "")
|
| 84 |
-
|
|
|
|
| 85 |
if not shutil.which("opencode"):
|
| 86 |
raise RuntimeError("opencode installation failed")
|
| 87 |
|
|
@@ -1168,13 +1169,20 @@ def _checkout_ref(parsed_info, agent_dir):
|
|
| 1168 |
|
| 1169 |
|
| 1170 |
def capture_diff(agent_dir):
|
| 1171 |
-
"""Capture the cumulative git diff for an agent's working directory.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1172 |
subprocess.run(
|
| 1173 |
["git", "add", "-A"],
|
| 1174 |
cwd=agent_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
| 1175 |
)
|
| 1176 |
result = subprocess.run(
|
| 1177 |
-
[
|
|
|
|
|
|
|
|
|
|
| 1178 |
cwd=agent_dir, capture_output=True, text=True,
|
| 1179 |
)
|
| 1180 |
return result.stdout[:100_000]
|
|
|
|
| 77 |
|
| 78 |
|
| 79 |
def _ensure_opencode():
|
| 80 |
+
"""Install the opencode binary if not already present."""
|
| 81 |
opencode_bin = os.path.join(os.path.expanduser("~"), ".opencode", "bin")
|
| 82 |
if opencode_bin not in os.environ.get("PATH", ""):
|
| 83 |
os.environ["PATH"] = opencode_bin + os.pathsep + os.environ.get("PATH", "")
|
| 84 |
+
if not shutil.which("opencode"):
|
| 85 |
+
_install_opencode()
|
| 86 |
if not shutil.which("opencode"):
|
| 87 |
raise RuntimeError("opencode installation failed")
|
| 88 |
|
|
|
|
| 1169 |
|
| 1170 |
|
| 1171 |
def capture_diff(agent_dir):
|
| 1172 |
+
"""Capture the cumulative git diff for an agent's working directory.
|
| 1173 |
+
|
| 1174 |
+
Excludes opencode infrastructure files (opencode.json config and
|
| 1175 |
+
.opencode/ session database) so only the agent's actual work appears.
|
| 1176 |
+
"""
|
| 1177 |
subprocess.run(
|
| 1178 |
["git", "add", "-A"],
|
| 1179 |
cwd=agent_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
| 1180 |
)
|
| 1181 |
result = subprocess.run(
|
| 1182 |
+
[
|
| 1183 |
+
"git", "diff", "--cached", "--",
|
| 1184 |
+
".", ":(exclude)opencode.json", ":(exclude).opencode",
|
| 1185 |
+
],
|
| 1186 |
cwd=agent_dir, capture_output=True, text=True,
|
| 1187 |
)
|
| 1188 |
return result.stdout[:100_000]
|