alpiecode 10.9.9__tar.gz → 10.10.1__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.9.9 → alpiecode-10.10.1}/PKG-INFO +1 -1
- {alpiecode-10.9.9 → alpiecode-10.10.1}/pyproject.toml +1 -1
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/alpiecode.egg-info/PKG-INFO +1 -1
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/alpiecode.egg-info/SOURCES.txt +4 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/__init__.py +1 -1
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/agent.py +68 -14
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/backends/local_backend.py +26 -5
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/backends/openai_backend.py +6 -3
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/blueprints.py +5 -4
- alpiecode-10.10.1/src/codeagent/chat_tags.py +219 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/cli.py +29 -9
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/config.py +101 -16
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/discovery.py +4 -4
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/doctor.py +4 -3
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/local_model.py +14 -1
- alpiecode-10.10.1/src/codeagent/media.py +515 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/orchestrator.py +7 -5
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/prompt.py +1 -1
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/session.py +10 -1
- alpiecode-10.10.1/src/codeagent/slash.py +550 -0
- alpiecode-10.10.1/test/test_chat_tags_and_offline_multimodal.py +262 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/test/test_deloop_and_sessions.py +133 -0
- alpiecode-10.10.1/test/test_security_config.py +78 -0
- alpiecode-10.10.1/test/test_token_economy_and_256k.py +42 -0
- alpiecode-10.9.9/src/codeagent/media.py +0 -286
- alpiecode-10.9.9/src/codeagent/slash.py +0 -278
- {alpiecode-10.9.9 → alpiecode-10.10.1}/README.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/setup.cfg +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/setup.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/alpiecode/__init__.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/alpiecode.egg-info/dependency_links.txt +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/alpiecode.egg-info/entry_points.txt +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/alpiecode.egg-info/requires.txt +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/alpiecode.egg-info/top_level.txt +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/__main__.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/assessment.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/backends/__init__.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/backends/base.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/cache.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/client.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/compaction.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/context.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/diff_preview.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/dream_rsi.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/executor.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/git_ops.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/github.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/guardian.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/guardrails.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/ipython_ext.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/memory.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/metrics.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/onboarding.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/paths.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/progress.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/project_template.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/rephraser.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/server.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/accessibility-audit/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/accessibility-testing/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/accessibility-ui-components/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/agentic-workflows/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/api-design/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/architecture-design/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/backend-engineering/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/browser-automation/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/cli-development/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/cloud-infrastructure/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/code-generation/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/code-review/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/codebase-onboarding/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/cost-optimization/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/data-analysis/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/data-engineering/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/database-engineering/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/dependency-management/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/dependency-security/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/dependency-upgrades/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/devops-ci-cd/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/docker-containers/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/documentation/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/documentation-site/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/e2e-testing/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/error-handling-resilience/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/feature-development/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/frontend-engineering/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/git-workflow/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/incident-response/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/legacy-code-modernization/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/llm-application-engineering/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/localization-i18n/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/mcp-server-development/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/migration-engineering/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/mobile-development/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/model-evaluation/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/nodejs-services/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/observability/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/performance-optimization/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/privacy-data-protection/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/prompt-engineering/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/python-engineering/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/rag-retrieval/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/react-engineering/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/release-management/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/requirements-analysis/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/responsive-design/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/safe-refactoring/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/secure-coding/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/systematic-debugging/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/technical-planning/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/technical-research/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/technical-writing/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/test-engineering/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/tool-integration/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/typescript-engineering/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/visual-regression-testing/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/web-performance/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/web-security-testing/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills/workflow-automation/SKILL.md +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/skills.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/subagent.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/system1.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/tools.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/updater.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/verifier.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/vscode_installer.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/src/codeagent/walkthrough.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/test/test_adaptive_resilience.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/test/test_cli_ui.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/test/test_context_and_trajectory.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/test/test_dream_rsi.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/test/test_frontier_architecture.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/test/test_gpu_detection.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/test/test_lifecycle_and_portfolio.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/test/test_local_model_download.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/test/test_memory_optimization.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/test/test_non_thinking_and_local_stream.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/test/test_onboarding.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/test/test_project_templates.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/test/test_skills_engine.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/test/test_slash_and_diff.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/test/test_subagents.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/test/test_task_assessment.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/test/test_truncation_resilience.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/test/test_verifier.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/test/test_walkthrough.py +0 -0
- {alpiecode-10.9.9 → alpiecode-10.10.1}/test/test_web_resilience_and_guardrails.py +0 -0
|
@@ -14,6 +14,7 @@ src/codeagent/agent.py
|
|
|
14
14
|
src/codeagent/assessment.py
|
|
15
15
|
src/codeagent/blueprints.py
|
|
16
16
|
src/codeagent/cache.py
|
|
17
|
+
src/codeagent/chat_tags.py
|
|
17
18
|
src/codeagent/cli.py
|
|
18
19
|
src/codeagent/client.py
|
|
19
20
|
src/codeagent/compaction.py
|
|
@@ -117,6 +118,7 @@ src/codeagent/skills/web-performance/SKILL.md
|
|
|
117
118
|
src/codeagent/skills/web-security-testing/SKILL.md
|
|
118
119
|
src/codeagent/skills/workflow-automation/SKILL.md
|
|
119
120
|
test/test_adaptive_resilience.py
|
|
121
|
+
test/test_chat_tags_and_offline_multimodal.py
|
|
120
122
|
test/test_cli_ui.py
|
|
121
123
|
test/test_context_and_trajectory.py
|
|
122
124
|
test/test_deloop_and_sessions.py
|
|
@@ -129,10 +131,12 @@ test/test_memory_optimization.py
|
|
|
129
131
|
test/test_non_thinking_and_local_stream.py
|
|
130
132
|
test/test_onboarding.py
|
|
131
133
|
test/test_project_templates.py
|
|
134
|
+
test/test_security_config.py
|
|
132
135
|
test/test_skills_engine.py
|
|
133
136
|
test/test_slash_and_diff.py
|
|
134
137
|
test/test_subagents.py
|
|
135
138
|
test/test_task_assessment.py
|
|
139
|
+
test/test_token_economy_and_256k.py
|
|
136
140
|
test/test_truncation_resilience.py
|
|
137
141
|
test/test_verifier.py
|
|
138
142
|
test/test_walkthrough.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.
|
|
20
|
+
__version__ = "10.10.1"
|
|
21
21
|
|
|
22
22
|
def run(task: str, workdir: str = ".", reasoning_level: str = "thinking", **kwargs):
|
|
23
23
|
"""Run an autonomous coding task programmatically."""
|
|
@@ -502,9 +502,15 @@ def run_agent(
|
|
|
502
502
|
if github_repo:
|
|
503
503
|
console.print(f"🐙 GitHub Repo: {github_repo}", style="cyan")
|
|
504
504
|
if image_path:
|
|
505
|
-
|
|
505
|
+
if isinstance(image_path, list):
|
|
506
|
+
console.print(f"🖼️ Images ({len(image_path)}): {', '.join(Path(p).name for p in image_path)}", style="cyan")
|
|
507
|
+
else:
|
|
508
|
+
console.print(f"🖼️ Image: {image_path}", style="cyan")
|
|
506
509
|
if video_path:
|
|
507
|
-
|
|
510
|
+
if isinstance(video_path, list):
|
|
511
|
+
console.print(f"🎬 Videos ({len(video_path)}): {', '.join(Path(p).name for p in video_path)}", style="cyan")
|
|
512
|
+
else:
|
|
513
|
+
console.print(f"🎬 Video: {video_path}", style="cyan")
|
|
508
514
|
if url:
|
|
509
515
|
console.print(f"📺 URL: {url}", style="cyan")
|
|
510
516
|
status_spinner.resume("Analyzing requirements & planning execution...")
|
|
@@ -770,7 +776,7 @@ def run_agent(
|
|
|
770
776
|
else:
|
|
771
777
|
print(f"\n🛑 Safety ceiling ({event.data['ceiling']}) reached.")
|
|
772
778
|
|
|
773
|
-
elif event.type == "web_preview"
|
|
779
|
+
elif event.type == "web_preview":
|
|
774
780
|
status_spinner.stop()
|
|
775
781
|
wp_data = event.data
|
|
776
782
|
if HAS_RICH:
|
|
@@ -801,8 +807,9 @@ def run_agent(
|
|
|
801
807
|
sys.stdout.write("\n\n")
|
|
802
808
|
sys.stdout.flush()
|
|
803
809
|
has_streamed_tokens = False
|
|
804
|
-
|
|
805
|
-
|
|
810
|
+
summary = event.data.get("summary", "")
|
|
811
|
+
if summary:
|
|
812
|
+
_print_assistant_message(summary)
|
|
806
813
|
has_printed_anything = True
|
|
807
814
|
_checkpoint(workdir, "checkpoint: done")
|
|
808
815
|
if debug and HAS_RICH:
|
|
@@ -937,10 +944,10 @@ def run_chat(
|
|
|
937
944
|
except (EOFError, KeyboardInterrupt):
|
|
938
945
|
session_mgr.save_session(session)
|
|
939
946
|
if HAS_RICH:
|
|
940
|
-
console.print(f"\nSession saved (id: [bold cyan]{session.id}[/bold cyan]). Resume with: [bold]alpiecode --
|
|
947
|
+
console.print(f"\nSession saved (id: [bold cyan]{session.id}[/bold cyan]). Resume with: [bold]alpiecode --session {session.id}[/bold] (or [dim]alpiecode --continue[/dim])")
|
|
941
948
|
console.print("Goodbye! 👋")
|
|
942
949
|
else:
|
|
943
|
-
print(f"\nSession saved (id: {session.id}). Resume with: alpiecode --continue")
|
|
950
|
+
print(f"\nSession saved (id: {session.id}). Resume with: alpiecode --session {session.id} (or alpiecode --continue)")
|
|
944
951
|
print("Goodbye! 👋")
|
|
945
952
|
break
|
|
946
953
|
|
|
@@ -952,22 +959,47 @@ def run_chat(
|
|
|
952
959
|
if slash_res is False:
|
|
953
960
|
session_mgr.save_session(session)
|
|
954
961
|
if HAS_RICH:
|
|
955
|
-
console.print(f"Session saved (id: [bold cyan]{session.id}[/bold cyan]). Resume with: [bold]alpiecode --
|
|
962
|
+
console.print(f"Session saved (id: [bold cyan]{session.id}[/bold cyan]). Resume with: [bold]alpiecode --session {session.id}[/bold] (or [dim]alpiecode --continue[/dim])")
|
|
956
963
|
console.print("Goodbye! 👋")
|
|
957
964
|
else:
|
|
958
|
-
print(f"Session saved (id: {session.id}). Resume with: alpiecode --continue")
|
|
965
|
+
print(f"Session saved (id: {session.id}). Resume with: alpiecode --session {session.id} (or alpiecode --continue)")
|
|
959
966
|
print("Goodbye! 👋")
|
|
960
967
|
break
|
|
961
968
|
elif slash_res is True:
|
|
962
969
|
session_mgr.save_session(session)
|
|
963
970
|
continue
|
|
964
971
|
|
|
972
|
+
# Parse inline tags, CLI wrappers (e.g. alpiecode run "..." --no-thinking), and prompt flags
|
|
973
|
+
from .chat_tags import parse_chat_tags_and_flags, render_tag_badges
|
|
974
|
+
clean_task, parsed_tags = parse_chat_tags_and_flags(user_input, cfg, current_workdir=session.workdir, session=session)
|
|
975
|
+
if not clean_task and not parsed_tags.get("badges"):
|
|
976
|
+
continue
|
|
977
|
+
|
|
978
|
+
tag_badges = render_tag_badges(parsed_tags, has_rich=HAS_RICH)
|
|
979
|
+
if tag_badges:
|
|
980
|
+
console.print(tag_badges)
|
|
981
|
+
|
|
982
|
+
effective_task = clean_task or user_input
|
|
983
|
+
req_image = parsed_tags.get("image_path") or getattr(session, "active_images", None) or getattr(session, "active_image", None)
|
|
984
|
+
req_video = parsed_tags.get("video_path") or getattr(session, "active_videos", None) or getattr(session, "active_video", None)
|
|
985
|
+
req_url = parsed_tags.get("url") or getattr(session, "active_url", None)
|
|
986
|
+
req_github = parsed_tags.get("github_repo") or getattr(session, "active_github", None)
|
|
987
|
+
turn_debug = parsed_tags.get("debug") if parsed_tags.get("debug") is not None else (debug or getattr(session, "debug", False))
|
|
988
|
+
|
|
965
989
|
has_streamed_chat = False
|
|
966
990
|
has_printed_chat = False
|
|
967
991
|
chat_status = CLIStatus(console, enabled=verbose)
|
|
968
992
|
chat_status.start("Thinking...")
|
|
969
993
|
try:
|
|
970
|
-
for event in orchestrator.run_task(
|
|
994
|
+
for event in orchestrator.run_task(
|
|
995
|
+
session=session,
|
|
996
|
+
task=effective_task,
|
|
997
|
+
cfg=cfg,
|
|
998
|
+
image_path=req_image,
|
|
999
|
+
video_path=req_video,
|
|
1000
|
+
url=req_url,
|
|
1001
|
+
github_repo=req_github,
|
|
1002
|
+
):
|
|
971
1003
|
if event.type == "token":
|
|
972
1004
|
chat_status.stop()
|
|
973
1005
|
delta = event.data.get("delta", "")
|
|
@@ -994,7 +1026,7 @@ def run_chat(
|
|
|
994
1026
|
else:
|
|
995
1027
|
chat_status.update(f"Generating tool call: {tc_name}...", style="bold cyan")
|
|
996
1028
|
|
|
997
|
-
elif event.type == "turn_start" and debug:
|
|
1029
|
+
elif event.type == "turn_start" and (debug or turn_debug):
|
|
998
1030
|
chat_status.pause()
|
|
999
1031
|
if HAS_RICH:
|
|
1000
1032
|
console.print(f"[dim]── Step {event.data['turn']} ──[/dim]")
|
|
@@ -1040,11 +1072,32 @@ def run_chat(
|
|
|
1040
1072
|
if has_streamed_chat:
|
|
1041
1073
|
sys.stdout.write("\n")
|
|
1042
1074
|
has_streamed_chat = False
|
|
1043
|
-
|
|
1075
|
+
else:
|
|
1044
1076
|
_print_assistant_message(event.data["content"])
|
|
1045
1077
|
has_printed_chat = True
|
|
1046
1078
|
_checkpoint(workdir, "checkpoint: done")
|
|
1047
1079
|
|
|
1080
|
+
elif event.type == "web_preview":
|
|
1081
|
+
chat_status.stop()
|
|
1082
|
+
wp_data = event.data
|
|
1083
|
+
if HAS_RICH:
|
|
1084
|
+
console.print(Panel(
|
|
1085
|
+
f"[bold green]🌐 Web Application Ready to View[/bold green]\n\n"
|
|
1086
|
+
f"• [bold cyan]Direct Browser Link:[/bold cyan] [underline]{wp_data.get('file_url')}[/underline]\n"
|
|
1087
|
+
f"• [bold cyan]Local Dev Server:[/bold cyan] [yellow]{wp_data.get('server_cmd', 'python3 -m http.server 8000')}[/yellow]\n"
|
|
1088
|
+
f"• [bold cyan]Localhost URL:[/bold cyan] [underline]{wp_data.get('localhost_url', 'http://localhost:8000')}[/underline]",
|
|
1089
|
+
title="🚀 Localhost Launch Panel",
|
|
1090
|
+
border_style="green",
|
|
1091
|
+
padding=(0, 1),
|
|
1092
|
+
))
|
|
1093
|
+
else:
|
|
1094
|
+
print(
|
|
1095
|
+
f"\n🌐 Web Application Ready to View:\n"
|
|
1096
|
+
f" Direct Link: {wp_data.get('file_url')}\n"
|
|
1097
|
+
f" Dev Server: {wp_data.get('server_cmd', 'python3 -m http.server 8000')}\n"
|
|
1098
|
+
f" Localhost: {wp_data.get('localhost_url', 'http://localhost:8000')}\n"
|
|
1099
|
+
)
|
|
1100
|
+
|
|
1048
1101
|
elif event.type == "error":
|
|
1049
1102
|
chat_status.stop()
|
|
1050
1103
|
if HAS_RICH:
|
|
@@ -1057,8 +1110,9 @@ def run_chat(
|
|
|
1057
1110
|
if has_streamed_chat:
|
|
1058
1111
|
sys.stdout.write("\n")
|
|
1059
1112
|
has_streamed_chat = False
|
|
1060
|
-
|
|
1061
|
-
|
|
1113
|
+
summary = event.data.get("summary", "")
|
|
1114
|
+
if summary:
|
|
1115
|
+
_print_assistant_message(summary)
|
|
1062
1116
|
has_printed_chat = True
|
|
1063
1117
|
break
|
|
1064
1118
|
finally:
|
|
@@ -99,14 +99,32 @@ class LocalBackend:
|
|
|
99
99
|
if content is None:
|
|
100
100
|
content = ""
|
|
101
101
|
elif isinstance(content, list):
|
|
102
|
-
# Multimodal content (image_url + text blocks) — extract text parts
|
|
102
|
+
# Multimodal content (image_url + text blocks) — extract text parts & run offline visual analysis
|
|
103
103
|
text_parts = []
|
|
104
|
+
img_idx = 1
|
|
104
105
|
for part in content:
|
|
105
106
|
if isinstance(part, dict):
|
|
106
107
|
if part.get("type") == "text":
|
|
107
108
|
text_parts.append(part.get("text", ""))
|
|
108
109
|
elif part.get("type") == "image_url":
|
|
109
|
-
|
|
110
|
+
img_obj = part.get("image_url", {})
|
|
111
|
+
url_val = img_obj.get("url", "") if isinstance(img_obj, dict) else str(img_obj)
|
|
112
|
+
analyzed = False
|
|
113
|
+
if "base64," in url_val:
|
|
114
|
+
try:
|
|
115
|
+
import base64
|
|
116
|
+
raw_b64 = url_val.split("base64,", 1)[1]
|
|
117
|
+
img_bytes = base64.b64decode(raw_b64)
|
|
118
|
+
from ..media import analyze_image_offline
|
|
119
|
+
desc = analyze_image_offline(img_bytes, label=f"Attached Image {img_idx}")
|
|
120
|
+
text_parts.append(desc)
|
|
121
|
+
analyzed = True
|
|
122
|
+
img_idx += 1
|
|
123
|
+
except Exception:
|
|
124
|
+
pass
|
|
125
|
+
if not analyzed:
|
|
126
|
+
text_parts.append(f"[Attached Image {img_idx}]")
|
|
127
|
+
img_idx += 1
|
|
110
128
|
elif isinstance(part, str):
|
|
111
129
|
text_parts.append(part)
|
|
112
130
|
content = "\n".join(text_parts) if text_parts else ""
|
|
@@ -318,7 +336,8 @@ class LocalBackend:
|
|
|
318
336
|
import time
|
|
319
337
|
start_time = time.time()
|
|
320
338
|
temp = temperature if temperature is not None else getattr(self._cfg, "temperature", 0.2)
|
|
321
|
-
|
|
339
|
+
raw_m = max_tokens if max_tokens is not None else getattr(self._cfg, "max_tokens", 2048)
|
|
340
|
+
m_tokens = min(raw_m, 4096)
|
|
322
341
|
|
|
323
342
|
model = self._ensure_model()
|
|
324
343
|
sanitized_msgs = self._sanitize_messages_for_gguf(messages)
|
|
@@ -638,7 +657,8 @@ class LocalBackend:
|
|
|
638
657
|
sanitized[-1]["content"] = u_text + "\n\n[Direct Mode: Output code and tool calls directly without <think> tags. Do not deliberate.]"
|
|
639
658
|
|
|
640
659
|
n_ctx = getattr(self._cfg, "n_ctx", 8192) or 8192
|
|
641
|
-
|
|
660
|
+
raw_m = max_tokens if max_tokens is not None else getattr(self._cfg, "max_tokens", 2048)
|
|
661
|
+
m_tokens = min(raw_m, 4096)
|
|
642
662
|
sanitized, safe_max_tokens = self._enforce_context_headroom(sanitized, max_context=n_ctx, max_tokens=m_tokens)
|
|
643
663
|
payload = {
|
|
644
664
|
"model": "local",
|
|
@@ -1100,7 +1120,8 @@ class iOSBackend(BasePlatformBackend):
|
|
|
1100
1120
|
bridge_url = self._get_bridge_url()
|
|
1101
1121
|
sanitized = self._sanitize_messages_for_gguf(messages)
|
|
1102
1122
|
n_ctx = getattr(self._cfg, "n_ctx", 4096) or 4096
|
|
1103
|
-
|
|
1123
|
+
raw_m = max_tokens if max_tokens is not None else getattr(self._cfg, "max_tokens", 2048)
|
|
1124
|
+
m_tokens = min(raw_m, 4096)
|
|
1104
1125
|
sanitized, safe_max_tokens = self._enforce_context_headroom(sanitized, max_context=n_ctx, max_tokens=m_tokens)
|
|
1105
1126
|
payload = {
|
|
1106
1127
|
"model": "local",
|
|
@@ -63,7 +63,7 @@ class _HTTPXChatCompletions:
|
|
|
63
63
|
"model": kwargs.get("model"),
|
|
64
64
|
"messages": kwargs.get("messages", []),
|
|
65
65
|
"temperature": kwargs.get("temperature", 0.1),
|
|
66
|
-
"max_tokens": kwargs.get("max_tokens",
|
|
66
|
+
"max_tokens": kwargs.get("max_tokens", 65537),
|
|
67
67
|
"stream": stream,
|
|
68
68
|
}
|
|
69
69
|
if "tools" in kwargs and kwargs["tools"]:
|
|
@@ -324,6 +324,9 @@ class OpenAIBackend:
|
|
|
324
324
|
|
|
325
325
|
@property
|
|
326
326
|
def name(self) -> str:
|
|
327
|
+
from ..config import is_internal_endpoint
|
|
328
|
+
if is_internal_endpoint(self.base_url):
|
|
329
|
+
return f"Alpie Cloud ({self._cfg.model})"
|
|
327
330
|
return f"Online API ({self._cfg.base_url})"
|
|
328
331
|
|
|
329
332
|
@property
|
|
@@ -397,7 +400,7 @@ class OpenAIBackend:
|
|
|
397
400
|
import json
|
|
398
401
|
start_time = time.time()
|
|
399
402
|
temp = temperature if temperature is not None else getattr(self._cfg, "temperature", 0.1)
|
|
400
|
-
m_tokens = max_tokens if max_tokens is not None else getattr(self._cfg, "max_tokens",
|
|
403
|
+
m_tokens = max_tokens if max_tokens is not None else getattr(self._cfg, "max_tokens", 65537)
|
|
401
404
|
|
|
402
405
|
client = self._ensure_client()
|
|
403
406
|
model_name = self._get_available_model(client)
|
|
@@ -631,7 +634,7 @@ class OpenAIBackend:
|
|
|
631
634
|
enable_thinking: bool = True,
|
|
632
635
|
) -> ChatResponse:
|
|
633
636
|
temp = temperature if temperature is not None else getattr(self._cfg, "temperature", 0.1)
|
|
634
|
-
m_tokens = max_tokens if max_tokens is not None else getattr(self._cfg, "max_tokens",
|
|
637
|
+
m_tokens = max_tokens if max_tokens is not None else getattr(self._cfg, "max_tokens", 65537)
|
|
635
638
|
|
|
636
639
|
client = self._ensure_client()
|
|
637
640
|
model_name = self._get_available_model(client)
|
|
@@ -12,6 +12,7 @@ Binds concrete, unambiguous engineering blueprints to user tasks:
|
|
|
12
12
|
from dataclasses import dataclass, field
|
|
13
13
|
from enum import Enum
|
|
14
14
|
from pathlib import Path
|
|
15
|
+
import re
|
|
15
16
|
from typing import Dict, List, Optional, Union
|
|
16
17
|
|
|
17
18
|
|
|
@@ -509,21 +510,21 @@ def resolve_domain_blueprint(task: str, repo: Optional[Dict] = None, intent: str
|
|
|
509
510
|
return get_ai_ml_blueprint(task)
|
|
510
511
|
|
|
511
512
|
# 3. C / C++ Tasks
|
|
512
|
-
if any(kw in task_lower for kw in ("c++", "cpp", "g++", "gcc", "clang", "in c"
|
|
513
|
+
if any(kw in task_lower for kw in ("c++", "cpp", "g++", "gcc", "clang", "in c++")) or re.search(r"\bin c\b", task_lower):
|
|
513
514
|
return get_native_cpp_blueprint(task)
|
|
514
515
|
|
|
515
516
|
# 3b. Rust Tasks
|
|
516
|
-
if any(kw in task_lower for kw in ("
|
|
517
|
+
if any(kw in task_lower for kw in ("cargo",)) or re.search(r"\b(rust|in rust)\b", task_lower):
|
|
517
518
|
return get_rust_blueprint(task)
|
|
518
519
|
|
|
519
520
|
# 3c. Go Tasks
|
|
520
|
-
if any(kw in task_lower for kw in ("golang", "
|
|
521
|
+
if any(kw in task_lower for kw in ("golang", "go language")) or re.search(r"\b(in go|in golang)\b", task_lower):
|
|
521
522
|
if any(w in task_lower for w in ("website", "web app", "webapp", "web", "frontend", "html", "site", "page")):
|
|
522
523
|
return get_golang_web_blueprint(task)
|
|
523
524
|
return get_golang_blueprint(task)
|
|
524
525
|
|
|
525
526
|
# 3d. Java Tasks
|
|
526
|
-
if any(kw in task_lower for kw in ("
|
|
527
|
+
if any(kw in task_lower for kw in ("javac", "maven", "gradle")) or re.search(r"\b(in java|java)\b(?!script)", task_lower):
|
|
527
528
|
return get_java_blueprint(task)
|
|
528
529
|
|
|
529
530
|
# 3e. Autonomous Technical Research & Synthesis
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Chat Tag and Flag Parser for AlpieCode.
|
|
3
|
+
|
|
4
|
+
Enables seamless CLI flags, inline media tags, and directives inside interactive chat mode:
|
|
5
|
+
• Command wrappers: alpiecode run "..." -> unwraps task cleanly
|
|
6
|
+
• Thinking toggles: --thinking, --reasoning, --no-thinking, --non-thinking, --force-thinking
|
|
7
|
+
• Diagnostics: --debug
|
|
8
|
+
• Media analysis: --image <path>, @image:<path>, @image <path>
|
|
9
|
+
--video <path>, @video:<path>, @video <path>
|
|
10
|
+
--url <url>, @url:<url>, @url <url>
|
|
11
|
+
• Open source: --github <repo>, @github:<repo>, @github <repo>
|
|
12
|
+
• Mode & Models: --offline, --local, --online, --model <name>
|
|
13
|
+
• Target directory: --workdir <dir>, --cd <dir>
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
import os
|
|
17
|
+
import re
|
|
18
|
+
import shlex
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
from typing import Any, Dict, Optional, Tuple
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def parse_chat_tags_and_flags(
|
|
24
|
+
user_input: str,
|
|
25
|
+
cfg: Any,
|
|
26
|
+
current_workdir: Path,
|
|
27
|
+
session: Optional[Any] = None,
|
|
28
|
+
) -> Tuple[str, Dict[str, Any]]:
|
|
29
|
+
"""
|
|
30
|
+
Parse inline flags, tags, and command wrappers from an in-chat user prompt.
|
|
31
|
+
|
|
32
|
+
Updates `cfg` and session attributes in-place where appropriate.
|
|
33
|
+
|
|
34
|
+
Returns:
|
|
35
|
+
(clean_task, parsed_info)
|
|
36
|
+
"""
|
|
37
|
+
raw = user_input.strip()
|
|
38
|
+
if not raw:
|
|
39
|
+
return "", {}
|
|
40
|
+
|
|
41
|
+
parsed: Dict[str, Any] = {
|
|
42
|
+
"image_path": None,
|
|
43
|
+
"video_path": None,
|
|
44
|
+
"url": None,
|
|
45
|
+
"github_repo": None,
|
|
46
|
+
"workdir": None,
|
|
47
|
+
"debug": None,
|
|
48
|
+
"mode_switch": None,
|
|
49
|
+
"model_switch": None,
|
|
50
|
+
"thinking_switch": None,
|
|
51
|
+
"badges": [],
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
# 1. Detect and unwrap CLI command syntax:
|
|
55
|
+
# e.g.: alpiecode run "Create a FastAPI app" --no-thinking
|
|
56
|
+
# or: alpiecode "Create a FastAPI app" --debug
|
|
57
|
+
cli_prefix_match = re.match(
|
|
58
|
+
r"^(?:alpiecode|alpie)\s+(?:run\s+)?([\"'].*?[\"']|\S+)(.*)$",
|
|
59
|
+
raw,
|
|
60
|
+
flags=re.IGNORECASE | re.DOTALL,
|
|
61
|
+
)
|
|
62
|
+
if cli_prefix_match:
|
|
63
|
+
core_candidate = cli_prefix_match.group(1).strip()
|
|
64
|
+
trailing = cli_prefix_match.group(2).strip()
|
|
65
|
+
# If quoted, unwrap quotes
|
|
66
|
+
if (core_candidate.startswith('"') and core_candidate.endswith('"')) or (
|
|
67
|
+
core_candidate.startswith("'") and core_candidate.endswith("'")
|
|
68
|
+
):
|
|
69
|
+
core_candidate = core_candidate[1:-1]
|
|
70
|
+
raw = f"{core_candidate} {trailing}".strip()
|
|
71
|
+
|
|
72
|
+
# 2. Extract media tags: @image:path, @image path, --image path
|
|
73
|
+
from .media import split_media_paths
|
|
74
|
+
|
|
75
|
+
# Image
|
|
76
|
+
img_pattern = r"(?:--image\s+|@image:?\s*)(.+?)(?=(?:\s+--[a-zA-Z]|\s+@[a-zA-Z]|$))"
|
|
77
|
+
img_vals = []
|
|
78
|
+
while True:
|
|
79
|
+
img_match = re.search(img_pattern, raw)
|
|
80
|
+
if not img_match:
|
|
81
|
+
break
|
|
82
|
+
img_vals.append(img_match.group(1).strip())
|
|
83
|
+
raw = raw[: img_match.start()] + " " + raw[img_match.end() :]
|
|
84
|
+
if img_vals:
|
|
85
|
+
img_paths = split_media_paths(img_vals)
|
|
86
|
+
if img_paths:
|
|
87
|
+
parsed["image_path"] = img_paths[0] if len(img_paths) == 1 else ", ".join(img_paths)
|
|
88
|
+
parsed["image_paths"] = img_paths
|
|
89
|
+
if len(img_paths) == 1:
|
|
90
|
+
parsed["badges"].append(f"🖼️ image: {img_paths[0]}")
|
|
91
|
+
else:
|
|
92
|
+
parsed["badges"].append(f"🖼️ images ({len(img_paths)}): {', '.join(Path(p).name for p in img_paths)}")
|
|
93
|
+
|
|
94
|
+
# Video
|
|
95
|
+
vid_pattern = r"(?:--video\s+|@video:?\s*)(.+?)(?=(?:\s+--[a-zA-Z]|\s+@[a-zA-Z]|$))"
|
|
96
|
+
vid_vals = []
|
|
97
|
+
while True:
|
|
98
|
+
vid_match = re.search(vid_pattern, raw)
|
|
99
|
+
if not vid_match:
|
|
100
|
+
break
|
|
101
|
+
vid_vals.append(vid_match.group(1).strip())
|
|
102
|
+
raw = raw[: vid_match.start()] + " " + raw[vid_match.end() :]
|
|
103
|
+
if vid_vals:
|
|
104
|
+
vid_paths = split_media_paths(vid_vals)
|
|
105
|
+
if vid_paths:
|
|
106
|
+
parsed["video_path"] = vid_paths[0] if len(vid_paths) == 1 else ", ".join(vid_paths)
|
|
107
|
+
parsed["video_paths"] = vid_paths
|
|
108
|
+
if len(vid_paths) == 1:
|
|
109
|
+
parsed["badges"].append(f"🎬 video: {vid_paths[0]}")
|
|
110
|
+
else:
|
|
111
|
+
parsed["badges"].append(f"🎬 videos ({len(vid_paths)}): {', '.join(Path(p).name for p in vid_paths)}")
|
|
112
|
+
|
|
113
|
+
# URL (YouTube / Web)
|
|
114
|
+
url_match = re.search(r"(?:--url\s+|@url:?\s*)([\"'][^\"']+[\"']|\S+)", raw)
|
|
115
|
+
if url_match:
|
|
116
|
+
val = url_match.group(1).strip("\"'")
|
|
117
|
+
parsed["url"] = val
|
|
118
|
+
parsed["badges"].append(f"📺 url: {val}")
|
|
119
|
+
raw = raw[: url_match.start()] + " " + raw[url_match.end() :]
|
|
120
|
+
|
|
121
|
+
# GitHub
|
|
122
|
+
gh_match = re.search(r"(?:--github\s+|@github:?\s*)([\"'][^\"']+[\"']|\S+)", raw)
|
|
123
|
+
if gh_match:
|
|
124
|
+
val = gh_match.group(1).strip("\"'")
|
|
125
|
+
parsed["github_repo"] = val
|
|
126
|
+
parsed["badges"].append(f"🐙 github: {val}")
|
|
127
|
+
raw = raw[: gh_match.start()] + " " + raw[gh_match.end() :]
|
|
128
|
+
|
|
129
|
+
# Workdir / cd
|
|
130
|
+
wd_match = re.search(r"(?:--(?:workdir|cd)\s+|@(?:workdir|cd):?\s*)([\"'][^\"']+[\"']|\S+)", raw)
|
|
131
|
+
if wd_match:
|
|
132
|
+
val = wd_match.group(1).strip("\"'")
|
|
133
|
+
parsed["workdir"] = val
|
|
134
|
+
parsed["badges"].append(f"📂 dir: {val}")
|
|
135
|
+
raw = raw[: wd_match.start()] + " " + raw[wd_match.end() :]
|
|
136
|
+
|
|
137
|
+
# Model
|
|
138
|
+
model_match = re.search(r"(?:--model\s+|@model:?\s*)([\"'][^\"']+[\"']|\S+)", raw)
|
|
139
|
+
if model_match:
|
|
140
|
+
val = model_match.group(1).strip("\"'")
|
|
141
|
+
cfg.model = val
|
|
142
|
+
parsed["model_switch"] = val
|
|
143
|
+
parsed["badges"].append(f"🤖 model: {val}")
|
|
144
|
+
raw = raw[: model_match.start()] + " " + raw[model_match.end() :]
|
|
145
|
+
|
|
146
|
+
# Thinking switches
|
|
147
|
+
if re.search(r"(?:^|\s)--(?:no-thinking|non-thinking)(?=\s|$)", raw):
|
|
148
|
+
cfg.enable_thinking = False
|
|
149
|
+
cfg.force_no_thinking = True
|
|
150
|
+
cfg.force_thinking = False
|
|
151
|
+
parsed["thinking_switch"] = False
|
|
152
|
+
parsed["badges"].append("⚡ --no-thinking")
|
|
153
|
+
raw = re.sub(r"(?:^|\s)--(?:no-thinking|non-thinking)(?=\s|$)", " ", raw)
|
|
154
|
+
elif re.search(r"(?:^|\s)--force-thinking(?=\s|$)", raw):
|
|
155
|
+
cfg.enable_thinking = True
|
|
156
|
+
cfg.force_thinking = True
|
|
157
|
+
cfg.force_no_thinking = False
|
|
158
|
+
parsed["thinking_switch"] = True
|
|
159
|
+
parsed["badges"].append("🧠 --force-thinking")
|
|
160
|
+
raw = re.sub(r"(?:^|\s)--force-thinking(?=\s|$)", " ", raw)
|
|
161
|
+
elif re.search(r"(?:^|\s)--(?:thinking|reasoning)(?=\s|$)", raw):
|
|
162
|
+
cfg.enable_thinking = True
|
|
163
|
+
cfg.force_no_thinking = False
|
|
164
|
+
parsed["thinking_switch"] = True
|
|
165
|
+
parsed["badges"].append("🧠 --thinking")
|
|
166
|
+
raw = re.sub(r"(?:^|\s)--(?:thinking|reasoning)(?=\s|$)", " ", raw)
|
|
167
|
+
|
|
168
|
+
# Debug switch
|
|
169
|
+
if re.search(r"(?:^|\s)--debug(?=\s|$)", raw):
|
|
170
|
+
parsed["debug"] = True
|
|
171
|
+
parsed["badges"].append("🔍 --debug")
|
|
172
|
+
raw = re.sub(r"(?:^|\s)--debug(?=\s|$)", " ", raw)
|
|
173
|
+
|
|
174
|
+
# Offline / Online mode switch
|
|
175
|
+
if re.search(r"(?:^|\s)--(?:offline|local)(?=\s|$)", raw):
|
|
176
|
+
cfg.base_url = "offline"
|
|
177
|
+
os.environ["ALPIECODE_BASE_URL"] = "offline"
|
|
178
|
+
parsed["mode_switch"] = "offline"
|
|
179
|
+
parsed["badges"].append("🧠 --offline")
|
|
180
|
+
raw = re.sub(r"(?:^|\s)--(?:offline|local)(?=\s|$)", " ", raw)
|
|
181
|
+
elif re.search(r"(?:^|\s)--online(?=\s|$)", raw):
|
|
182
|
+
from .config import KNOWN_PRESETS
|
|
183
|
+
cfg.base_url = KNOWN_PRESETS.get("alpie_seed", {}).get("base_url", "https://api.169pi.com/v1")
|
|
184
|
+
if "ALPIECODE_BASE_URL" in os.environ:
|
|
185
|
+
del os.environ["ALPIECODE_BASE_URL"]
|
|
186
|
+
parsed["mode_switch"] = "online"
|
|
187
|
+
parsed["badges"].append("🌐 --online")
|
|
188
|
+
raw = re.sub(r"(?:^|\s)--online(?=\s|$)", " ", raw)
|
|
189
|
+
|
|
190
|
+
clean_task = re.sub(r"\s+", " ", raw).strip()
|
|
191
|
+
|
|
192
|
+
# Apply workdir change if valid
|
|
193
|
+
if parsed["workdir"]:
|
|
194
|
+
try:
|
|
195
|
+
target_p = Path(parsed["workdir"])
|
|
196
|
+
if not target_p.is_absolute():
|
|
197
|
+
target_p = (current_workdir / target_p).resolve()
|
|
198
|
+
if target_p.is_dir():
|
|
199
|
+
if session:
|
|
200
|
+
session.workdir = target_p
|
|
201
|
+
else:
|
|
202
|
+
parsed["badges"].append(f"⚠️ dir not found: {parsed['workdir']}")
|
|
203
|
+
except Exception:
|
|
204
|
+
pass
|
|
205
|
+
|
|
206
|
+
return clean_task, parsed
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def render_tag_badges(parsed: Dict[str, Any], has_rich: bool = True) -> Optional[str]:
|
|
210
|
+
"""Format parsed badges into a sleek terminal status strip."""
|
|
211
|
+
badges = parsed.get("badges", [])
|
|
212
|
+
if not badges:
|
|
213
|
+
return None
|
|
214
|
+
|
|
215
|
+
if has_rich:
|
|
216
|
+
badge_strs = [f"[bold cyan]{b}[/bold cyan]" for b in badges]
|
|
217
|
+
return f"[dim]🏷️ Tags active:[/dim] {' '.join(badge_strs)}"
|
|
218
|
+
else:
|
|
219
|
+
return f"Tags active: {' | '.join(badges)}"
|