alpiecode 10.10.8__tar.gz → 10.10.9__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.
- {alpiecode-10.10.8 → alpiecode-10.10.9}/PKG-INFO +1 -1
- {alpiecode-10.10.8 → alpiecode-10.10.9}/pyproject.toml +1 -1
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/alpiecode.egg-info/PKG-INFO +1 -1
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/alpiecode.egg-info/SOURCES.txt +2 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/__init__.py +1 -1
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/assessment.py +1 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/backends/local_backend.py +1 -1
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/blueprints.py +2 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/convergence.py +4 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/discovery.py +1 -6
- alpiecode-10.10.9/src/codeagent/execution_safety.py +52 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/executor.py +12 -3
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/local_model.py +23 -3
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/orchestrator.py +19 -5
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/prompt.py +26 -12
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/system1.py +4 -4
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/tools.py +40 -69
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_context_and_trajectory.py +4 -4
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_deloop_and_sessions.py +6 -6
- alpiecode-10.10.9/test/test_execution_recovery.py +206 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_frontier_architecture.py +1 -1
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_report_convergence.py +23 -5
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_truncation_resilience.py +7 -14
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_web_resilience_and_guardrails.py +3 -3
- {alpiecode-10.10.8 → alpiecode-10.10.9}/README.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/setup.cfg +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/setup.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/alpiecode/__init__.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/alpiecode.egg-info/dependency_links.txt +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/alpiecode.egg-info/entry_points.txt +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/alpiecode.egg-info/requires.txt +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/alpiecode.egg-info/top_level.txt +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/__main__.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/agent.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/backends/__init__.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/backends/base.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/backends/openai_backend.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/cache.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/capabilities.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/chat_tags.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/cli.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/client.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/compaction.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/config.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/context.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/diff_preview.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/doctor.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/dream_rsi.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/evaluation.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/git_ops.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/github.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/grounding.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/guardian.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/guardrails.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/ipython_ext.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/lifecycle.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/media.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/memory.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/metrics.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/onboarding.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/paths.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/progress.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/project_template.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/rephraser.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/server.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/session.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/accessibility-audit/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/accessibility-testing/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/accessibility-ui-components/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/agentic-workflows/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/api-design/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/architecture-design/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/backend-engineering/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/browser-automation/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/cli-development/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/cloud-infrastructure/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/code-generation/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/code-review/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/codebase-onboarding/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/cost-optimization/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/data-analysis/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/data-engineering/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/database-engineering/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/dependency-management/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/dependency-security/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/dependency-upgrades/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/devops-ci-cd/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/docker-containers/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/documentation/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/documentation-site/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/e2e-testing/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/error-handling-resilience/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/feature-development/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/frontend-engineering/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/git-workflow/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/incident-response/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/legacy-code-modernization/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/llm-application-engineering/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/localization-i18n/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/mcp-server-development/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/migration-engineering/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/mobile-development/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/model-evaluation/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/nodejs-services/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/observability/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/performance-optimization/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/privacy-data-protection/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/prompt-engineering/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/python-engineering/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/rag-retrieval/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/react-engineering/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/release-management/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/requirements-analysis/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/responsive-design/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/safe-refactoring/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/secure-coding/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/systematic-debugging/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/technical-planning/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/technical-research/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/technical-writing/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/test-engineering/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/tool-integration/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/typescript-engineering/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/visual-regression-testing/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/web-performance/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/web-security-testing/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills/workflow-automation/SKILL.md +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/skills.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/slash.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/subagent.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/updater.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/verifier.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/vision.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/vscode_installer.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/src/codeagent/walkthrough.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_adaptive_resilience.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_chat_tags_and_offline_multimodal.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_cli_ui.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_dream_rsi.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_gpu_detection.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_lifecycle_and_portfolio.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_local_model_download.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_memory_optimization.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_non_thinking_and_local_stream.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_onboarding.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_project_templates.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_release_foundations.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_security_config.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_skills_engine.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_slash_and_diff.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_subagents.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_task_assessment.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_token_economy_and_256k.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_verifier.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_visual_grounding.py +0 -0
- {alpiecode-10.10.8 → alpiecode-10.10.9}/test/test_walkthrough.py +0 -0
|
@@ -27,6 +27,7 @@ src/codeagent/discovery.py
|
|
|
27
27
|
src/codeagent/doctor.py
|
|
28
28
|
src/codeagent/dream_rsi.py
|
|
29
29
|
src/codeagent/evaluation.py
|
|
30
|
+
src/codeagent/execution_safety.py
|
|
30
31
|
src/codeagent/executor.py
|
|
31
32
|
src/codeagent/git_ops.py
|
|
32
33
|
src/codeagent/github.py
|
|
@@ -129,6 +130,7 @@ test/test_cli_ui.py
|
|
|
129
130
|
test/test_context_and_trajectory.py
|
|
130
131
|
test/test_deloop_and_sessions.py
|
|
131
132
|
test/test_dream_rsi.py
|
|
133
|
+
test/test_execution_recovery.py
|
|
132
134
|
test/test_frontier_architecture.py
|
|
133
135
|
test/test_gpu_detection.py
|
|
134
136
|
test/test_lifecycle_and_portfolio.py
|
|
@@ -17,7 +17,7 @@ Supports:
|
|
|
17
17
|
from pathlib import Path
|
|
18
18
|
from typing import Optional, Any, Dict
|
|
19
19
|
|
|
20
|
-
__version__ = "10.10.
|
|
20
|
+
__version__ = "10.10.9"
|
|
21
21
|
|
|
22
22
|
def run(task: str, workdir: str = ".", reasoning_level: str = "thinking", **kwargs):
|
|
23
23
|
"""Run an autonomous coding task programmatically."""
|
|
@@ -142,6 +142,7 @@ _EXPLAIN_INDICATORS = [
|
|
|
142
142
|
]
|
|
143
143
|
|
|
144
144
|
_DEBUG_INDICATORS = [
|
|
145
|
+
r"\b(fix|repair)\b",
|
|
145
146
|
r"\b(debug|diagnose|troubleshoot|trace|fix\s+bug|fix\s+the\s+bug)\b",
|
|
146
147
|
r"\b(find\s+the\s+bug|find\s+the\s+issue|why\s+is\s+this\s+failing)\b",
|
|
147
148
|
r"\b(traceback|stacktrace|exception|segfault|segmentation\s+fault)\b",
|
|
@@ -491,6 +491,8 @@ def resolve_domain_blueprint(task: str, repo: Optional[Dict] = None, intent: str
|
|
|
491
491
|
Route task intent to the optimal Domain Blueprint.
|
|
492
492
|
Runs deterministically in < 1ms.
|
|
493
493
|
"""
|
|
494
|
+
if intent in ("debug", "modify", "refactor"):
|
|
495
|
+
return None # Existing-project repairs must not invent scaffold deliverables.
|
|
494
496
|
task_lower = task.lower().strip()
|
|
495
497
|
|
|
496
498
|
# 0. Developer Portfolio Websites
|
|
@@ -16,6 +16,10 @@ class ConvergenceGuard:
|
|
|
16
16
|
or args.get("filename") or args.get("command") or "")
|
|
17
17
|
key = json.dumps([name, target])
|
|
18
18
|
if failed:
|
|
19
|
+
from .execution_safety import infrastructure_failure
|
|
20
|
+
infrastructure = infrastructure_failure(output)
|
|
21
|
+
if infrastructure or '"error_kind": "shell_unavailable"' in output:
|
|
22
|
+
return "Stopped: shell infrastructure is unavailable; no application command ran. Repair the shell configuration before retrying."
|
|
19
23
|
# Ignore changing generated content: the same rejection is no progress.
|
|
20
24
|
previous, count = self._failures.get(key, (None, 0))
|
|
21
25
|
count = count + 1 if previous == output else 1
|
|
@@ -215,12 +215,7 @@ def _detect_shell(os_name: str) -> str:
|
|
|
215
215
|
"""Detect available shell, aligned with tools.py execution path."""
|
|
216
216
|
|
|
217
217
|
if os_name == "windows":
|
|
218
|
-
#
|
|
219
|
-
if shutil.which("bash"):
|
|
220
|
-
return "bash"
|
|
221
|
-
if _is_wsl_available():
|
|
222
|
-
return "wsl"
|
|
223
|
-
# Fallback to PowerShell
|
|
218
|
+
# Native Windows execution must not accidentally select the WSL launcher.
|
|
224
219
|
if shutil.which("powershell") or shutil.which("pwsh"):
|
|
225
220
|
return "powershell"
|
|
226
221
|
return "cmd"
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""Shell selection and detection of unusable model generations."""
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
import shutil
|
|
5
|
+
import json
|
|
6
|
+
from typing import List, Optional
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def shell_command(command: str, windows: bool) -> List[str]:
|
|
10
|
+
if windows:
|
|
11
|
+
# Windows' bash.exe can be a WSL launcher with no installed Linux shell.
|
|
12
|
+
# Keep commands in the native workspace and its active virtual environment.
|
|
13
|
+
powershell = shutil.which("pwsh") or shutil.which("powershell")
|
|
14
|
+
if powershell:
|
|
15
|
+
script = "$ErrorActionPreference = 'Stop'; " + command + "; if ($LASTEXITCODE) { exit $LASTEXITCODE }"
|
|
16
|
+
return [powershell, "-NoProfile", "-NonInteractive", "-Command", script]
|
|
17
|
+
return ["cmd.exe", "/d", "/s", "/c", command]
|
|
18
|
+
return [shutil.which("bash") or "/bin/sh", "-c", command]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def infrastructure_failure(output: str) -> Optional[str]:
|
|
22
|
+
try:
|
|
23
|
+
result, _ = json.JSONDecoder().raw_decode(output.lstrip())
|
|
24
|
+
if isinstance(result, dict) and result.get("error_kind") == "shell_unavailable":
|
|
25
|
+
return "shell_unavailable: command execution could not start"
|
|
26
|
+
except (ValueError, TypeError):
|
|
27
|
+
pass
|
|
28
|
+
lower = output.lower()
|
|
29
|
+
if "execvpe(/bin/bash) failed" in lower or ("wsl" in lower and "createprocesscommon" in lower):
|
|
30
|
+
return "shell_unavailable: WSL could not start /bin/bash; no project command ran"
|
|
31
|
+
return None
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class GenerationGuard:
|
|
35
|
+
"""Reject degenerate repeated text before any partial tool call is parsed."""
|
|
36
|
+
def __init__(self) -> None:
|
|
37
|
+
self.tail = ""
|
|
38
|
+
self.pending = 0
|
|
39
|
+
|
|
40
|
+
def feed(self, text: str) -> None:
|
|
41
|
+
# Non-streaming tool arguments must be checked throughout, not just at the end.
|
|
42
|
+
if len(text) > 512:
|
|
43
|
+
for offset in range(0, len(text), 512):
|
|
44
|
+
self.feed(text[offset:offset + 512])
|
|
45
|
+
return
|
|
46
|
+
self.tail = (self.tail + text)[-8192:]
|
|
47
|
+
self.pending += len(text)
|
|
48
|
+
if self.pending < 128:
|
|
49
|
+
return
|
|
50
|
+
self.pending = 0
|
|
51
|
+
if re.search(r"(.{24,400}?)\1{5,}", self.tail, re.S):
|
|
52
|
+
raise RuntimeError("Generation stopped: repeated output detected. No partial tool call was executed; task remains unverified.")
|
|
@@ -183,6 +183,9 @@ def parse_text_tool_calls(text: str) -> List[dict]:
|
|
|
183
183
|
def _parse_error_hint(stderr: str, stdout: str) -> str:
|
|
184
184
|
"""Parse common error patterns from bash output and return a targeted hint."""
|
|
185
185
|
combined = (stderr + " " + stdout).strip()
|
|
186
|
+
from .execution_safety import infrastructure_failure
|
|
187
|
+
if infrastructure_failure(combined):
|
|
188
|
+
return "Shell startup failed before the application ran. Repair the shell configuration; do not modify application code to address this error."
|
|
186
189
|
if not combined:
|
|
187
190
|
return ""
|
|
188
191
|
|
|
@@ -450,13 +453,16 @@ class ToolExecutor:
|
|
|
450
453
|
)
|
|
451
454
|
else:
|
|
452
455
|
# Stage 2: Sequential mutating tools (write_file, edit_file, bash)
|
|
456
|
+
infrastructure_blocked = False
|
|
453
457
|
for tc in mut_calls:
|
|
454
458
|
if on_tool_start:
|
|
455
459
|
on_tool_start(tc.name, tc.arguments)
|
|
456
460
|
t0 = time.monotonic()
|
|
457
461
|
safe_args = _normalize_tool_arguments(tc.arguments)
|
|
458
462
|
fn = self.dispatch.get(tc.name)
|
|
459
|
-
if
|
|
463
|
+
if infrastructure_blocked:
|
|
464
|
+
res_str = "error: Skipped because shell startup failed earlier in this batch. No action was executed."
|
|
465
|
+
elif fn:
|
|
460
466
|
try:
|
|
461
467
|
res_str = str(fn(safe_args))
|
|
462
468
|
except Exception as e:
|
|
@@ -464,6 +470,9 @@ class ToolExecutor:
|
|
|
464
470
|
else:
|
|
465
471
|
res_str = f"error: Unknown tool '{tc.name}'"
|
|
466
472
|
elapsed = (time.monotonic() - t0) * 1000
|
|
473
|
+
from .execution_safety import infrastructure_failure
|
|
474
|
+
if tc.name == "bash" and infrastructure_failure(res_str):
|
|
475
|
+
infrastructure_blocked = True
|
|
467
476
|
|
|
468
477
|
# Clear passed verification set whenever code files are written or edited
|
|
469
478
|
if tc.name in ("write_file", "edit_file", "apply_patch"):
|
|
@@ -478,7 +487,7 @@ class ToolExecutor:
|
|
|
478
487
|
res_str += (
|
|
479
488
|
f"\n\n🛑 REPEATED TOOL CALL LOOP DETECTED (attempt #{repeat_count}). "
|
|
480
489
|
f"You have already executed '{tc.name}' with these exact parameters {repeat_count} times in a row. "
|
|
481
|
-
"
|
|
490
|
+
"Do NOT repeat this tool call. Inspect the actual results; do not claim checks passed without successful verification."
|
|
482
491
|
)
|
|
483
492
|
|
|
484
493
|
# Repetitive verification sequence guard
|
|
@@ -486,7 +495,7 @@ class ToolExecutor:
|
|
|
486
495
|
cmd_str = safe_args.get("command", "").strip()
|
|
487
496
|
norm_cmd = re.sub(r"\s*\|\s*(?:head|tail|grep|sed|less|cat)\b.*", "", cmd_str)
|
|
488
497
|
norm_cmd = re.sub(r"\s*2>&1\s*", " ", norm_cmd).strip()
|
|
489
|
-
if norm_cmd and norm_cmd in self.successful_bash_commands:
|
|
498
|
+
if norm_cmd and norm_cmd in self.successful_bash_commands and '"exit_code": 0' in res_str:
|
|
490
499
|
res_str = (
|
|
491
500
|
"{\"stdout\": \"Check already verified with exit code 0. Deliverables ready.\", \"stderr\": \"\", \"exit_code\": 0}"
|
|
492
501
|
"\n\n🛑 CIRCUIT BREAKER TRIGGERED: This verification check has already passed with exit code 0, "
|
|
@@ -559,6 +559,13 @@ class LocalModel:
|
|
|
559
559
|
self.model_path = download_model(self.repo_id, token=self.token)
|
|
560
560
|
return self.model_path
|
|
561
561
|
|
|
562
|
+
def close(self) -> None:
|
|
563
|
+
import atexit
|
|
564
|
+
atexit.unregister(self.close)
|
|
565
|
+
llm, self._llm = self._llm, None
|
|
566
|
+
if llm is not None:
|
|
567
|
+
llm.close()
|
|
568
|
+
|
|
562
569
|
def load(self):
|
|
563
570
|
"""Load the model into memory via llama-cpp-python."""
|
|
564
571
|
if self._llm is not None:
|
|
@@ -681,6 +688,8 @@ class LocalModel:
|
|
|
681
688
|
|
|
682
689
|
try:
|
|
683
690
|
self._llm = Llama(**llama_kwargs)
|
|
691
|
+
import atexit
|
|
692
|
+
atexit.register(self.close)
|
|
684
693
|
# In-Memory KV Prompt Prefix Caching for instant Turn 2+ speedup
|
|
685
694
|
try:
|
|
686
695
|
import llama_cpp
|
|
@@ -826,14 +835,25 @@ class LocalModel:
|
|
|
826
835
|
params["tool_choice"] = kwargs.get("tool_choice", "auto")
|
|
827
836
|
|
|
828
837
|
def _safe_stream_generator():
|
|
838
|
+
from .execution_safety import GenerationGuard
|
|
839
|
+
guard = GenerationGuard()
|
|
829
840
|
cur_max = params["max_tokens"]
|
|
830
841
|
while True:
|
|
831
842
|
params["max_tokens"] = cur_max
|
|
832
843
|
try:
|
|
833
844
|
gen = llm.create_chat_completion(**params)
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
845
|
+
try:
|
|
846
|
+
for chunk in gen:
|
|
847
|
+
for choice in chunk.get("choices", []):
|
|
848
|
+
delta = choice.get("delta") or {}
|
|
849
|
+
guard.feed(delta.get("content") or "")
|
|
850
|
+
for call in delta.get("tool_calls") or []:
|
|
851
|
+
guard.feed((call.get("function") or {}).get("arguments") or "")
|
|
852
|
+
yield chunk
|
|
853
|
+
finally:
|
|
854
|
+
close = getattr(gen, "close", None)
|
|
855
|
+
if close:
|
|
856
|
+
close()
|
|
837
857
|
return
|
|
838
858
|
except ValueError as ve:
|
|
839
859
|
err_msg = str(ve)
|
|
@@ -113,7 +113,7 @@ def _check_tool_results_had_error(results) -> bool:
|
|
|
113
113
|
if name == "bash":
|
|
114
114
|
try:
|
|
115
115
|
clean_json = content.split("\n", 1)[-1] if content.startswith("⚠️") else content
|
|
116
|
-
data = json.
|
|
116
|
+
data, _ = json.JSONDecoder().raw_decode(clean_json.lstrip())
|
|
117
117
|
if isinstance(data, dict):
|
|
118
118
|
if data.get("exit_code", 0) != 0:
|
|
119
119
|
return True
|
|
@@ -420,6 +420,13 @@ class AgentOrchestrator:
|
|
|
420
420
|
|
|
421
421
|
# Prepend explicit positional blueprint directive so Turn 1 adheres to the target architecture
|
|
422
422
|
bp = getattr(task_context, "blueprint", None)
|
|
423
|
+
if task_context.intent in ("modify", "debug", "refactor"):
|
|
424
|
+
effective_task = (
|
|
425
|
+
"[PROJECT ENHANCEMENT DIRECTIVE: EXISTING CODEBASE]\n"
|
|
426
|
+
"NON-DESTRUCTIVE WORKFLOW: Locate and read the relevant implementation, reproduce the issue, "
|
|
427
|
+
"and use targeted edits. Preserve existing behavior. Do not invent replacement application "
|
|
428
|
+
"files or treat shell startup failures as source-code bugs.\n\n" + effective_task
|
|
429
|
+
)
|
|
423
430
|
if bp:
|
|
424
431
|
bp_type = getattr(bp, "blueprint_type", None)
|
|
425
432
|
is_existing_project = (
|
|
@@ -697,8 +704,15 @@ class AgentOrchestrator:
|
|
|
697
704
|
# ── Stall Detection & Corrective Intervention ──
|
|
698
705
|
if progress_monitor.is_stalled(threshold=3):
|
|
699
706
|
advice = progress_monitor.get_stall_advice()
|
|
707
|
+
if task_context.intent in ("debug", "modify", "refactor"):
|
|
708
|
+
advice = (
|
|
709
|
+
"[SYSTEM - PROGRESS MONITOR] Inspection is repeating without progress. "
|
|
710
|
+
"Identify the missing evidence and inspect a different relevant source or reproduce the defect. "
|
|
711
|
+
"Make a targeted edit only when supported by the evidence. If blocked, explain why; "
|
|
712
|
+
"do not create a replacement application or claim verification succeeded."
|
|
713
|
+
)
|
|
700
714
|
uncreated = [f for f in named_deliverables if f not in session_touched_files]
|
|
701
|
-
if uncreated:
|
|
715
|
+
if uncreated and task_context.intent == "create":
|
|
702
716
|
advice += f"\nNote: The following files requested in the task have not been created yet: {', '.join(uncreated)}. Create them now using write_file."
|
|
703
717
|
session.context.add_user_message(advice)
|
|
704
718
|
yield AgentEvent("stall_intervention", {
|
|
@@ -710,9 +724,9 @@ class AgentOrchestrator:
|
|
|
710
724
|
if progress_monitor.stall_interventions >= 3:
|
|
711
725
|
session.context.add_user_message(
|
|
712
726
|
"[SYSTEM DIRECTIVE] Multiple stall interventions have detected repetitive inspection without code modifications. "
|
|
713
|
-
"
|
|
714
|
-
"use edit_file
|
|
715
|
-
"
|
|
727
|
+
"Find the missing evidence or report the blocking condition. For repairs, inspect the existing source "
|
|
728
|
+
"and use edit_file only after identifying the root cause. Do not invent replacement applications "
|
|
729
|
+
"or change source code to work around shell startup failures. Report verification honestly."
|
|
716
730
|
)
|
|
717
731
|
|
|
718
732
|
# ── Turn-Level Adaptive Reasoning Dynamics ──
|
|
@@ -181,7 +181,7 @@ You write complete, working code in a single pass and verify it by running it.
|
|
|
181
181
|
## Technical Focus Scope
|
|
182
182
|
This session is strictly focused on software engineering and technical implementation. For purely technical tasks, bypass all non-applicable geopolitical, territorial, and sovereign policy deliberation in internal reasoning traces. Focus internal reasoning exclusively on software architecture, code correctness, execution efficiency, and explicit format constraints.
|
|
183
183
|
|
|
184
|
-
# CRITICAL RULE:
|
|
184
|
+
# CRITICAL RULE: UNDERSTAND THE TASK BEFORE EDITING
|
|
185
185
|
|
|
186
186
|
# CRITICAL: FAST TESTING & EXECUTION (NO REAL SLEEP)
|
|
187
187
|
- NEVER use real `time.sleep()` in unit tests for timers, rate limiters, token buckets, or delays.
|
|
@@ -189,12 +189,12 @@ This session is strictly focused on software engineering and technical implement
|
|
|
189
189
|
- ALWAYS use virtual clocks or mock time: `unittest.mock.patch('time.monotonic')`, `unittest.mock.patch('time.time')`, or pass a custom `time_func` to advance time instantaneously.
|
|
190
190
|
- All unit tests MUST finish in under 0.05 seconds.
|
|
191
191
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
192
|
+
For existing projects, inspect the relevant source and reproduce the issue before editing.
|
|
193
|
+
Apply minimal edits and preserve existing behavior. Shell startup failures are environment
|
|
194
|
+
failures, not evidence of application bugs. Never invent replacement applications to bypass them.
|
|
195
195
|
|
|
196
196
|
## Workflow
|
|
197
|
-
1. **
|
|
197
|
+
1. **INSPECT**: Read relevant existing source; use edit_file for repairs and write_file for new files
|
|
198
198
|
2. **RUN**: Use bash to test immediately after writing (for interactive scripts, test functions non-interactively, e.g. `python3 -c "from module import ...; ..."` or write unit tests)
|
|
199
199
|
3. **FIX**: If execution fails, read the error, use edit_file to fix, re-run
|
|
200
200
|
4. **DONE**: When everything works, output: DONE: <summary>
|
|
@@ -492,14 +492,15 @@ When the analysis/report is complete, provide the final answer and stop using to
|
|
|
492
492
|
## Technical Focus Scope
|
|
493
493
|
Strictly software engineering. For technical tasks, bypass all non-applicable geopolitical policy deliberation in internal reasoning traces. Focus purely on technical implementation, correctness, and execution.
|
|
494
494
|
|
|
495
|
-
# CRITICAL RULE:
|
|
495
|
+
# CRITICAL RULE: FOLLOW THE TASK SCOPE
|
|
496
496
|
|
|
497
497
|
# CRITICAL: FAST TESTING & EXECUTION (NO REAL SLEEP)
|
|
498
498
|
- NEVER use real `time.sleep()` in unit tests for timers, rate limiters, or delays.
|
|
499
499
|
- ALWAYS use virtual clocks or mock time: `unittest.mock.patch('time.monotonic')`, `unittest.mock.patch('time.time')`.
|
|
500
500
|
- All unit tests MUST finish in under 0.05 seconds.
|
|
501
501
|
|
|
502
|
-
- For
|
|
502
|
+
- For repairs, inspect the existing code and use edit_file for minimal changes. Preserve unrelated behavior.
|
|
503
|
+
- For new single-file programs, write complete code and verify by running it.
|
|
503
504
|
- For multi-file frontend web projects (when explicitly asked to build an HTML/CSS/JS website):
|
|
504
505
|
* Write EXACTLY ONE complete file per turn (Turn 1: index.html, Turn 2: styles.css, Turn 3: app.js).
|
|
505
506
|
* index.html: Semantic HTML5, navbar with #theme-toggle button, modals with #close-btn, forms (#rsvp-form), explicit IDs.
|
|
@@ -510,7 +511,7 @@ Strictly software engineering. For technical tasks, bypass all non-applicable ge
|
|
|
510
511
|
Rules:
|
|
511
512
|
1. Write clean code using standard library or vanilla frontend (HTML/CSS/JS).
|
|
512
513
|
2. NEVER run pip, uv pip, or package install commands — they will fail offline.
|
|
513
|
-
3.
|
|
514
|
+
3. Use the project's existing test runner if installed, including pytest offline. Report unavailable dependencies honestly.
|
|
514
515
|
4. Output tool calls:
|
|
515
516
|
<tool_call>
|
|
516
517
|
{"name": "write_file", "arguments": {"path": "<file>", "content": "<full_code>"}}
|
|
@@ -518,7 +519,7 @@ Rules:
|
|
|
518
519
|
<tool_call>
|
|
519
520
|
{"name": "bash", "arguments": {"command": "<command>"}}
|
|
520
521
|
</tool_call>
|
|
521
|
-
5.
|
|
522
|
+
5. Verify changes with relevant tests; do not create replacement applications for repair tasks.
|
|
522
523
|
6. C/C++: Never collision between member vars and methods. Mutex in const methods must be mutable. Include <algorithm>. Serve interactive HTML5 UI from HTTP server, never console app.
|
|
523
524
|
7. When done and verified, output: DONE: <summary>.
|
|
524
525
|
"""
|
|
@@ -534,7 +535,7 @@ You write complete, working code and verify it through direct execution.
|
|
|
534
535
|
This session is strictly focused on software engineering and technical architecture. For purely technical tasks, bypass all non-applicable geopolitical, territorial, and sovereign policy deliberation in internal reasoning traces. Focus internal reasoning exclusively on software architecture, code correctness, execution efficiency, and explicit format constraints.
|
|
535
536
|
|
|
536
537
|
# CRITICAL OPERATING PRINCIPLES
|
|
537
|
-
1.
|
|
538
|
+
1. INSPECT BEFORE REPAIRING: For existing projects, read the relevant source, reproduce the issue, and make minimal edits. Create new implementations only when requested. Never output placeholders, stubs, or TODOs.
|
|
538
539
|
2. SEQUENTIAL MULTI-FILE CONTRACT: For multi-file projects, create files in logical dependency order, emitting EXACTLY ONE complete file per turn to prevent output truncation and guarantee 100% valid syntax.
|
|
539
540
|
3. VERIFY VIA EXECUTION: Verify your changes by running tests, compiling, or checking syntax (e.g. node --check for JS, python3 -m unittest for Python).
|
|
540
541
|
4. COMPLETION: Once all deliverables are implemented and verified, call the `complete_task` tool or output `DONE: <summary>`.
|
|
@@ -610,6 +611,13 @@ SKILL_TECHNICAL_RESEARCH = """\
|
|
|
610
611
|
|
|
611
612
|
def select_jit_skills(task: str, task_context=None, complexity: str = "low") -> List[str]:
|
|
612
613
|
"""Select targeted domain skills dynamically to eliminate attention dilution."""
|
|
614
|
+
if getattr(task_context, "intent", "") in ("debug", "modify", "refactor"):
|
|
615
|
+
return [
|
|
616
|
+
"## Existing Project Repair\n"
|
|
617
|
+
"Use the existing framework, files, dependencies and test runner. Inspect the relevant code "
|
|
618
|
+
"and failure evidence before editing. Preserve CRUD behavior, interfaces and unrelated UI. "
|
|
619
|
+
"Add focused regression tests for the reproduced defect; do not scaffold a replacement application."
|
|
620
|
+
]
|
|
613
621
|
skills = []
|
|
614
622
|
task_lower = (task or "").lower()
|
|
615
623
|
bp = getattr(task_context, "blueprint", None)
|
|
@@ -790,7 +798,7 @@ WSL_RULES = """\
|
|
|
790
798
|
|
|
791
799
|
POWERSHELL_RULES = """\
|
|
792
800
|
## Shell Environment: PowerShell (Windows)
|
|
793
|
-
-
|
|
801
|
+
- Run verification commands separately. Windows PowerShell 5.1 does not support `&&`; replacing it with `;` loses failure short-circuiting.
|
|
794
802
|
- Use `$env:VAR = "value"` for environment variables, NOT `export VAR=value`
|
|
795
803
|
- Use `python` (not `python3`)
|
|
796
804
|
- Do NOT use `echo -e` or ANSI escapes -- use `Write-Output`
|
|
@@ -917,7 +925,13 @@ class PromptBuilder:
|
|
|
917
925
|
"If identity is uncertain, ask for clarification before recommending a purchase.\n"
|
|
918
926
|
)
|
|
919
927
|
if is_offline:
|
|
920
|
-
|
|
928
|
+
repair_policy = ("Repair task: read the relevant source before editing. Use edit_file for minimal fixes; "
|
|
929
|
+
"do not replace existing files or invent a new application. If execution is unavailable, "
|
|
930
|
+
"report the environment failure and leave verification unconfirmed.\n"
|
|
931
|
+
if task_context is not None and getattr(task_context, "intent", "") in ("debug", "modify", "refactor") else "")
|
|
932
|
+
shell = getattr(task_context, "shell", "bash")
|
|
933
|
+
shell_policy = SHELL_RULES_MAP.get(shell, "") if shell in ("powershell", "cmd") else ""
|
|
934
|
+
prompt = shell_policy + "\n" + evidence_policy + repair_policy + OFFLINE_SYSTEM_PROMPT
|
|
921
935
|
if task_context is not None:
|
|
922
936
|
shell = getattr(task_context, "shell", "bash")
|
|
923
937
|
if shell in SHELL_RULES_MAP:
|
|
@@ -513,14 +513,14 @@ class System1Controller:
|
|
|
513
513
|
directive=directive,
|
|
514
514
|
)
|
|
515
515
|
|
|
516
|
-
# 2.
|
|
516
|
+
# 2. Truncated mutations are rejected, so never assume partial content exists.
|
|
517
517
|
if err_type == ErrorType.TRUNCATION and tool_name in ("write_file", "edit_file", "append_file"):
|
|
518
518
|
target_name = target_file or str(tool_args.get("path") or tool_args.get("file") or "file")
|
|
519
519
|
self.total_interventions += 1
|
|
520
520
|
directive = (
|
|
521
|
-
f"[SYSTEM 1 DIRECTIVE] Truncation checkpoint: '{target_name}' was
|
|
522
|
-
|
|
523
|
-
|
|
521
|
+
f"[SYSTEM 1 DIRECTIVE] Truncation checkpoint: the incomplete change to '{target_name}' was rejected. "
|
|
522
|
+
"Read the current file if it exists, then submit a smaller complete targeted edit. "
|
|
523
|
+
"Do not assume partial generated content was saved or append to an imagined checkpoint."
|
|
524
524
|
)
|
|
525
525
|
return JevDecision(
|
|
526
526
|
action=ActionCategory.RETRY_WITH_DIRECTIVE,
|