@votadev/tooncode 2.3.0 → 2.3.1
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.
- package/package.json +1 -1
- package/tooncode.py +1 -46
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@votadev/tooncode",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "🇹🇭 Thai Coding Agent CLI — Claude Code alternative powered by free models. 20 tools, multi-agent team, browser automation, MCP servers.",
|
|
5
5
|
"author": "VotaLab",
|
|
6
6
|
"license": "MIT",
|
package/tooncode.py
CHANGED
|
@@ -8,7 +8,7 @@ Usage:
|
|
|
8
8
|
python tooncode.py
|
|
9
9
|
"""
|
|
10
10
|
|
|
11
|
-
VERSION = "2.3.
|
|
11
|
+
VERSION = "2.3.1"
|
|
12
12
|
|
|
13
13
|
import httpx
|
|
14
14
|
import json
|
|
@@ -5385,51 +5385,6 @@ def main(_initial_prompt=None):
|
|
|
5385
5385
|
console.print()
|
|
5386
5386
|
tool_results = execute_tools(content)
|
|
5387
5387
|
|
|
5388
|
-
# -- Stuck detection: if same error repeats, auto-call bosshelp --
|
|
5389
|
-
for tr in tool_results:
|
|
5390
|
-
tr_content = tr.get("content", "")
|
|
5391
|
-
if isinstance(tr_content, str) and ("[error" in tr_content or "exit code" in tr_content):
|
|
5392
|
-
_last_errors.append(tr_content[:200])
|
|
5393
|
-
# If 3+ errors in recent tools, we're stuck
|
|
5394
|
-
if len(_last_errors) >= 3:
|
|
5395
|
-
recent = _last_errors[-3:]
|
|
5396
|
-
# Check if errors are similar (stuck in loop)
|
|
5397
|
-
if len(set(recent)) <= 2:
|
|
5398
|
-
console.print("\n[bold magenta][auto-bosshelp] Stuck detected! Asking Claude Code for help...[/bold magenta]")
|
|
5399
|
-
# Gather context
|
|
5400
|
-
recent_text = "\n".join(
|
|
5401
|
-
block.get("text", "")
|
|
5402
|
-
for msg in messages[-4:]
|
|
5403
|
-
if msg.get("role") == "assistant"
|
|
5404
|
-
for block in (msg.get("content") if isinstance(msg.get("content"), list) else [])
|
|
5405
|
-
if block.get("type") == "text"
|
|
5406
|
-
)
|
|
5407
|
-
boss_answer = _boss_help(
|
|
5408
|
-
problem=f"I keep getting the same error and can't fix it",
|
|
5409
|
-
context=recent_text[:1000],
|
|
5410
|
-
error="\n".join(recent),
|
|
5411
|
-
)
|
|
5412
|
-
_last_errors.clear()
|
|
5413
|
-
_post_bosshelp = True
|
|
5414
|
-
# MUST append tool_results first (API requires it after tool_use)
|
|
5415
|
-
messages.append({"role": "user", "content": tool_results})
|
|
5416
|
-
# Then add bosshelp as assistant+user pair
|
|
5417
|
-
fix_instructions = f"[BOSSHELP]\n{boss_answer}\n\n"
|
|
5418
|
-
fix_instructions += "APPLY THIS FIX NOW:\n"
|
|
5419
|
-
fix_instructions += "1. Read each file mentioned\n"
|
|
5420
|
-
fix_instructions += "2. Use edit tool to apply changes\n"
|
|
5421
|
-
fix_instructions += "3. Run commands if needed\n"
|
|
5422
|
-
fix_instructions += "4. Verify the fix works\n"
|
|
5423
|
-
fix_instructions += "USE TOOLS. Do NOT explain."
|
|
5424
|
-
messages.append({"role": "assistant", "content": [{"type": "text", "text": "Let me apply the fix."}]})
|
|
5425
|
-
messages.append({"role": "user", "content": [{"type": "text", "text":
|
|
5426
|
-
fix_instructions,
|
|
5427
|
-
"cache_control": {"type": "ephemeral"}}]})
|
|
5428
|
-
continue
|
|
5429
|
-
else:
|
|
5430
|
-
# Successful tool = reset error tracking
|
|
5431
|
-
_last_errors.clear()
|
|
5432
|
-
|
|
5433
5388
|
messages.append({"role": "user", "content": tool_results})
|
|
5434
5389
|
continue # Always continue after tool use
|
|
5435
5390
|
|