alpiecode 10.9.8__tar.gz → 10.10.0__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.8 → alpiecode-10.10.0}/PKG-INFO +1 -1
- {alpiecode-10.9.8 → alpiecode-10.10.0}/pyproject.toml +1 -1
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/alpiecode.egg-info/PKG-INFO +1 -1
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/alpiecode.egg-info/SOURCES.txt +6 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/__init__.py +1 -1
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/agent.py +60 -12
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/assessment.py +2 -1
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/backends/local_backend.py +22 -4
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/backends/openai_backend.py +6 -3
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/blueprints.py +21 -3
- alpiecode-10.10.0/src/codeagent/chat_tags.py +195 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/cli.py +27 -7
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/compaction.py +21 -3
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/config.py +101 -16
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/discovery.py +89 -7
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/doctor.py +4 -3
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/local_model.py +14 -1
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/media.py +90 -5
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/memory.py +185 -9
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/orchestrator.py +77 -11
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/prompt.py +189 -4
- alpiecode-10.10.0/src/codeagent/slash.py +482 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/tools.py +34 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/verifier.py +167 -64
- alpiecode-10.10.0/test/test_chat_tags_and_offline_multimodal.py +145 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/test/test_deloop_and_sessions.py +133 -0
- alpiecode-10.10.0/test/test_frontier_architecture.py +209 -0
- alpiecode-10.10.0/test/test_memory_optimization.py +237 -0
- alpiecode-10.10.0/test/test_security_config.py +78 -0
- alpiecode-10.10.0/test/test_token_economy_and_256k.py +42 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/test/test_verifier.py +33 -0
- alpiecode-10.9.8/src/codeagent/slash.py +0 -278
- {alpiecode-10.9.8 → alpiecode-10.10.0}/README.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/setup.cfg +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/setup.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/alpiecode/__init__.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/alpiecode.egg-info/dependency_links.txt +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/alpiecode.egg-info/entry_points.txt +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/alpiecode.egg-info/requires.txt +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/alpiecode.egg-info/top_level.txt +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/__main__.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/backends/__init__.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/backends/base.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/cache.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/client.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/context.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/diff_preview.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/dream_rsi.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/executor.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/git_ops.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/github.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/guardian.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/guardrails.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/ipython_ext.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/metrics.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/onboarding.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/paths.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/progress.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/project_template.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/rephraser.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/server.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/session.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/accessibility-audit/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/accessibility-testing/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/accessibility-ui-components/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/agentic-workflows/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/api-design/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/architecture-design/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/backend-engineering/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/browser-automation/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/cli-development/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/cloud-infrastructure/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/code-generation/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/code-review/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/codebase-onboarding/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/cost-optimization/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/data-analysis/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/data-engineering/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/database-engineering/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/dependency-management/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/dependency-security/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/dependency-upgrades/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/devops-ci-cd/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/docker-containers/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/documentation/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/documentation-site/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/e2e-testing/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/error-handling-resilience/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/feature-development/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/frontend-engineering/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/git-workflow/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/incident-response/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/legacy-code-modernization/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/llm-application-engineering/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/localization-i18n/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/mcp-server-development/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/migration-engineering/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/mobile-development/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/model-evaluation/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/nodejs-services/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/observability/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/performance-optimization/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/privacy-data-protection/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/prompt-engineering/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/python-engineering/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/rag-retrieval/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/react-engineering/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/release-management/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/requirements-analysis/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/responsive-design/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/safe-refactoring/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/secure-coding/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/systematic-debugging/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/technical-planning/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/technical-research/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/technical-writing/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/test-engineering/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/tool-integration/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/typescript-engineering/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/visual-regression-testing/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/web-performance/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/web-security-testing/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills/workflow-automation/SKILL.md +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/skills.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/subagent.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/system1.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/updater.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/vscode_installer.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/src/codeagent/walkthrough.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/test/test_adaptive_resilience.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/test/test_cli_ui.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/test/test_context_and_trajectory.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/test/test_dream_rsi.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/test/test_gpu_detection.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/test/test_lifecycle_and_portfolio.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/test/test_local_model_download.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/test/test_non_thinking_and_local_stream.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/test/test_onboarding.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/test/test_project_templates.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/test/test_skills_engine.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/test/test_slash_and_diff.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/test/test_subagents.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/test/test_task_assessment.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/test/test_truncation_resilience.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/test/test_walkthrough.py +0 -0
- {alpiecode-10.9.8 → alpiecode-10.10.0}/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,20 +118,25 @@ 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
|
|
123
125
|
test/test_dream_rsi.py
|
|
126
|
+
test/test_frontier_architecture.py
|
|
124
127
|
test/test_gpu_detection.py
|
|
125
128
|
test/test_lifecycle_and_portfolio.py
|
|
126
129
|
test/test_local_model_download.py
|
|
130
|
+
test/test_memory_optimization.py
|
|
127
131
|
test/test_non_thinking_and_local_stream.py
|
|
128
132
|
test/test_onboarding.py
|
|
129
133
|
test/test_project_templates.py
|
|
134
|
+
test/test_security_config.py
|
|
130
135
|
test/test_skills_engine.py
|
|
131
136
|
test/test_slash_and_diff.py
|
|
132
137
|
test/test_subagents.py
|
|
133
138
|
test/test_task_assessment.py
|
|
139
|
+
test/test_token_economy_and_256k.py
|
|
134
140
|
test/test_truncation_resilience.py
|
|
135
141
|
test/test_verifier.py
|
|
136
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.0"
|
|
21
21
|
|
|
22
22
|
def run(task: str, workdir: str = ".", reasoning_level: str = "thinking", **kwargs):
|
|
23
23
|
"""Run an autonomous coding task programmatically."""
|
|
@@ -770,7 +770,7 @@ def run_agent(
|
|
|
770
770
|
else:
|
|
771
771
|
print(f"\n🛑 Safety ceiling ({event.data['ceiling']}) reached.")
|
|
772
772
|
|
|
773
|
-
elif event.type == "web_preview"
|
|
773
|
+
elif event.type == "web_preview":
|
|
774
774
|
status_spinner.stop()
|
|
775
775
|
wp_data = event.data
|
|
776
776
|
if HAS_RICH:
|
|
@@ -801,8 +801,9 @@ def run_agent(
|
|
|
801
801
|
sys.stdout.write("\n\n")
|
|
802
802
|
sys.stdout.flush()
|
|
803
803
|
has_streamed_tokens = False
|
|
804
|
-
|
|
805
|
-
|
|
804
|
+
summary = event.data.get("summary", "")
|
|
805
|
+
if summary:
|
|
806
|
+
_print_assistant_message(summary)
|
|
806
807
|
has_printed_anything = True
|
|
807
808
|
_checkpoint(workdir, "checkpoint: done")
|
|
808
809
|
if debug and HAS_RICH:
|
|
@@ -937,10 +938,10 @@ def run_chat(
|
|
|
937
938
|
except (EOFError, KeyboardInterrupt):
|
|
938
939
|
session_mgr.save_session(session)
|
|
939
940
|
if HAS_RICH:
|
|
940
|
-
console.print(f"\nSession saved (id: [bold cyan]{session.id}[/bold cyan]). Resume with: [bold]alpiecode --
|
|
941
|
+
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
942
|
console.print("Goodbye! 👋")
|
|
942
943
|
else:
|
|
943
|
-
print(f"\nSession saved (id: {session.id}). Resume with: alpiecode --continue")
|
|
944
|
+
print(f"\nSession saved (id: {session.id}). Resume with: alpiecode --session {session.id} (or alpiecode --continue)")
|
|
944
945
|
print("Goodbye! 👋")
|
|
945
946
|
break
|
|
946
947
|
|
|
@@ -952,22 +953,47 @@ def run_chat(
|
|
|
952
953
|
if slash_res is False:
|
|
953
954
|
session_mgr.save_session(session)
|
|
954
955
|
if HAS_RICH:
|
|
955
|
-
console.print(f"Session saved (id: [bold cyan]{session.id}[/bold cyan]). Resume with: [bold]alpiecode --
|
|
956
|
+
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
957
|
console.print("Goodbye! 👋")
|
|
957
958
|
else:
|
|
958
|
-
print(f"Session saved (id: {session.id}). Resume with: alpiecode --continue")
|
|
959
|
+
print(f"Session saved (id: {session.id}). Resume with: alpiecode --session {session.id} (or alpiecode --continue)")
|
|
959
960
|
print("Goodbye! 👋")
|
|
960
961
|
break
|
|
961
962
|
elif slash_res is True:
|
|
962
963
|
session_mgr.save_session(session)
|
|
963
964
|
continue
|
|
964
965
|
|
|
966
|
+
# Parse inline tags, CLI wrappers (e.g. alpiecode run "..." --no-thinking), and prompt flags
|
|
967
|
+
from .chat_tags import parse_chat_tags_and_flags, render_tag_badges
|
|
968
|
+
clean_task, parsed_tags = parse_chat_tags_and_flags(user_input, cfg, current_workdir=session.workdir, session=session)
|
|
969
|
+
if not clean_task and not parsed_tags.get("badges"):
|
|
970
|
+
continue
|
|
971
|
+
|
|
972
|
+
tag_badges = render_tag_badges(parsed_tags, has_rich=HAS_RICH)
|
|
973
|
+
if tag_badges:
|
|
974
|
+
console.print(tag_badges)
|
|
975
|
+
|
|
976
|
+
effective_task = clean_task or user_input
|
|
977
|
+
req_image = parsed_tags.get("image_path") or getattr(session, "active_image", None)
|
|
978
|
+
req_video = parsed_tags.get("video_path") or getattr(session, "active_video", None)
|
|
979
|
+
req_url = parsed_tags.get("url") or getattr(session, "active_url", None)
|
|
980
|
+
req_github = parsed_tags.get("github_repo") or getattr(session, "active_github", None)
|
|
981
|
+
turn_debug = parsed_tags.get("debug") if parsed_tags.get("debug") is not None else (debug or getattr(session, "debug", False))
|
|
982
|
+
|
|
965
983
|
has_streamed_chat = False
|
|
966
984
|
has_printed_chat = False
|
|
967
985
|
chat_status = CLIStatus(console, enabled=verbose)
|
|
968
986
|
chat_status.start("Thinking...")
|
|
969
987
|
try:
|
|
970
|
-
for event in orchestrator.run_task(
|
|
988
|
+
for event in orchestrator.run_task(
|
|
989
|
+
session=session,
|
|
990
|
+
task=effective_task,
|
|
991
|
+
cfg=cfg,
|
|
992
|
+
image_path=req_image,
|
|
993
|
+
video_path=req_video,
|
|
994
|
+
url=req_url,
|
|
995
|
+
github_repo=req_github,
|
|
996
|
+
):
|
|
971
997
|
if event.type == "token":
|
|
972
998
|
chat_status.stop()
|
|
973
999
|
delta = event.data.get("delta", "")
|
|
@@ -994,7 +1020,7 @@ def run_chat(
|
|
|
994
1020
|
else:
|
|
995
1021
|
chat_status.update(f"Generating tool call: {tc_name}...", style="bold cyan")
|
|
996
1022
|
|
|
997
|
-
elif event.type == "turn_start" and debug:
|
|
1023
|
+
elif event.type == "turn_start" and (debug or turn_debug):
|
|
998
1024
|
chat_status.pause()
|
|
999
1025
|
if HAS_RICH:
|
|
1000
1026
|
console.print(f"[dim]── Step {event.data['turn']} ──[/dim]")
|
|
@@ -1040,11 +1066,32 @@ def run_chat(
|
|
|
1040
1066
|
if has_streamed_chat:
|
|
1041
1067
|
sys.stdout.write("\n")
|
|
1042
1068
|
has_streamed_chat = False
|
|
1043
|
-
|
|
1069
|
+
else:
|
|
1044
1070
|
_print_assistant_message(event.data["content"])
|
|
1045
1071
|
has_printed_chat = True
|
|
1046
1072
|
_checkpoint(workdir, "checkpoint: done")
|
|
1047
1073
|
|
|
1074
|
+
elif event.type == "web_preview":
|
|
1075
|
+
chat_status.stop()
|
|
1076
|
+
wp_data = event.data
|
|
1077
|
+
if HAS_RICH:
|
|
1078
|
+
console.print(Panel(
|
|
1079
|
+
f"[bold green]🌐 Web Application Ready to View[/bold green]\n\n"
|
|
1080
|
+
f"• [bold cyan]Direct Browser Link:[/bold cyan] [underline]{wp_data.get('file_url')}[/underline]\n"
|
|
1081
|
+
f"• [bold cyan]Local Dev Server:[/bold cyan] [yellow]{wp_data.get('server_cmd', 'python3 -m http.server 8000')}[/yellow]\n"
|
|
1082
|
+
f"• [bold cyan]Localhost URL:[/bold cyan] [underline]{wp_data.get('localhost_url', 'http://localhost:8000')}[/underline]",
|
|
1083
|
+
title="🚀 Localhost Launch Panel",
|
|
1084
|
+
border_style="green",
|
|
1085
|
+
padding=(0, 1),
|
|
1086
|
+
))
|
|
1087
|
+
else:
|
|
1088
|
+
print(
|
|
1089
|
+
f"\n🌐 Web Application Ready to View:\n"
|
|
1090
|
+
f" Direct Link: {wp_data.get('file_url')}\n"
|
|
1091
|
+
f" Dev Server: {wp_data.get('server_cmd', 'python3 -m http.server 8000')}\n"
|
|
1092
|
+
f" Localhost: {wp_data.get('localhost_url', 'http://localhost:8000')}\n"
|
|
1093
|
+
)
|
|
1094
|
+
|
|
1048
1095
|
elif event.type == "error":
|
|
1049
1096
|
chat_status.stop()
|
|
1050
1097
|
if HAS_RICH:
|
|
@@ -1057,8 +1104,9 @@ def run_chat(
|
|
|
1057
1104
|
if has_streamed_chat:
|
|
1058
1105
|
sys.stdout.write("\n")
|
|
1059
1106
|
has_streamed_chat = False
|
|
1060
|
-
|
|
1061
|
-
|
|
1107
|
+
summary = event.data.get("summary", "")
|
|
1108
|
+
if summary:
|
|
1109
|
+
_print_assistant_message(summary)
|
|
1062
1110
|
has_printed_chat = True
|
|
1063
1111
|
break
|
|
1064
1112
|
finally:
|
|
@@ -152,9 +152,10 @@ _DEBUG_INDICATORS = [
|
|
|
152
152
|
|
|
153
153
|
_MODIFY_INDICATORS = [
|
|
154
154
|
r"\b(modify|update|change|refactor|restructure|reorganize)\b",
|
|
155
|
-
r"\b(add\s+feature|extend|integrate|migrate|upgrade|optimize|improve)\b",
|
|
155
|
+
r"\b(add\s+feature|extend|integrate|migrate|upgrade|optimize|improve|redesign|enhance|modernize|revamp)\b",
|
|
156
156
|
r"\b(convert|transform|replace|swap|rename|remove\s+from|delete\s+from)\b",
|
|
157
157
|
r"\b(add\s+endpoint|add\s+route|add\s+method|add\s+support\s+for)\b",
|
|
158
|
+
r"\b(better\s+website|make\s+.*better|made\s+better|make\s+better|of\s+it|to\s+it)\b",
|
|
158
159
|
]
|
|
159
160
|
|
|
160
161
|
_STANDALONE_ALGORITHMS = {
|
|
@@ -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 ""
|
|
@@ -177,8 +195,8 @@ class LocalBackend:
|
|
|
177
195
|
c_text = coalesced[-1].get("content", "")
|
|
178
196
|
if any(k in c_text for k in ("[Tool Result", "[Workspace State", "Files created so far", "[CRITICAL STYLING DIRECTIVE")):
|
|
179
197
|
prompt_hint = (
|
|
180
|
-
"\n\n[Next Action: Output your next <tool_call> (e.g. write_file or bash) immediately. "
|
|
181
|
-
"Do NOT output conversational text. When all files are created and verified, output: DONE: <summary>.]"
|
|
198
|
+
"\n\n[Next Action: Output your next <tool_call> (e.g. write_file, edit_file, or bash) immediately. "
|
|
199
|
+
"Do NOT output conversational text. When all files are created and verified, call complete_task or output: DONE: <summary>.]"
|
|
182
200
|
)
|
|
183
201
|
if "[Next Action:" not in c_text:
|
|
184
202
|
coalesced[-1]["content"] += prompt_hint
|
|
@@ -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)
|
|
@@ -11,7 +11,8 @@ Binds concrete, unambiguous engineering blueprints to user tasks:
|
|
|
11
11
|
|
|
12
12
|
from dataclasses import dataclass, field
|
|
13
13
|
from enum import Enum
|
|
14
|
-
from
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
from typing import Dict, List, Optional, Union
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
class BlueprintType(str, Enum):
|
|
@@ -564,10 +565,27 @@ def resolve_domain_blueprint(task: str, repo: Optional[Dict] = None, intent: str
|
|
|
564
565
|
|
|
565
566
|
# ── Interactive Web Framework Selection ───────────────────────────────
|
|
566
567
|
|
|
567
|
-
def is_ambiguous_web_task(task: str) -> bool:
|
|
568
|
-
"""Return True if user asks to create a website without specifying a tech stack."""
|
|
568
|
+
def is_ambiguous_web_task(task: str, workdir: Optional[Union[Path, str]] = None) -> bool:
|
|
569
|
+
"""Return True if user asks to create a website from scratch without specifying a tech stack."""
|
|
569
570
|
t = task.lower().strip()
|
|
570
571
|
|
|
572
|
+
# If modifying, enhancing, or working on an existing site, do not prompt for stack
|
|
573
|
+
_ENHANCE_WORDS = (
|
|
574
|
+
"better", "improve", "enhance", "redesign", "update", "modify", "change",
|
|
575
|
+
"of it", "to it", "this site", "this website", "existing", "fix", "debug",
|
|
576
|
+
"revamp", "modernize", "polish", "made better",
|
|
577
|
+
)
|
|
578
|
+
if any(w in t for w in _ENHANCE_WORDS):
|
|
579
|
+
return False
|
|
580
|
+
|
|
581
|
+
if workdir is not None:
|
|
582
|
+
try:
|
|
583
|
+
p = Path(workdir).resolve()
|
|
584
|
+
if (p / "index.html").is_file() or (p / "package.json").is_file() or (p / "public" / "index.html").is_file():
|
|
585
|
+
return False
|
|
586
|
+
except Exception:
|
|
587
|
+
pass
|
|
588
|
+
|
|
571
589
|
web_nouns = ("website", "web app", "webapp", "web page", "webpage", "web application", "landing page", "store", "portal")
|
|
572
590
|
action_words = ("create", "build", "make", "develop", "generate", "code", "write", "setup", "start")
|
|
573
591
|
|
|
@@ -0,0 +1,195 @@
|
|
|
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
|
+
# Image
|
|
74
|
+
img_match = re.search(r"(?:--image\s+|@image:?\s*)([\"'][^\"']+[\"']|\S+)", raw)
|
|
75
|
+
if img_match:
|
|
76
|
+
val = img_match.group(1).strip("\"'")
|
|
77
|
+
parsed["image_path"] = val
|
|
78
|
+
parsed["badges"].append(f"🖼️ image: {val}")
|
|
79
|
+
raw = raw[: img_match.start()] + " " + raw[img_match.end() :]
|
|
80
|
+
|
|
81
|
+
# Video
|
|
82
|
+
vid_match = re.search(r"(?:--video\s+|@video:?\s*)([\"'][^\"']+[\"']|\S+)", raw)
|
|
83
|
+
if vid_match:
|
|
84
|
+
val = vid_match.group(1).strip("\"'")
|
|
85
|
+
parsed["video_path"] = val
|
|
86
|
+
parsed["badges"].append(f"🎬 video: {val}")
|
|
87
|
+
raw = raw[: vid_match.start()] + " " + raw[vid_match.end() :]
|
|
88
|
+
|
|
89
|
+
# URL (YouTube / Web)
|
|
90
|
+
url_match = re.search(r"(?:--url\s+|@url:?\s*)([\"'][^\"']+[\"']|\S+)", raw)
|
|
91
|
+
if url_match:
|
|
92
|
+
val = url_match.group(1).strip("\"'")
|
|
93
|
+
parsed["url"] = val
|
|
94
|
+
parsed["badges"].append(f"📺 url: {val}")
|
|
95
|
+
raw = raw[: url_match.start()] + " " + raw[url_match.end() :]
|
|
96
|
+
|
|
97
|
+
# GitHub
|
|
98
|
+
gh_match = re.search(r"(?:--github\s+|@github:?\s*)([\"'][^\"']+[\"']|\S+)", raw)
|
|
99
|
+
if gh_match:
|
|
100
|
+
val = gh_match.group(1).strip("\"'")
|
|
101
|
+
parsed["github_repo"] = val
|
|
102
|
+
parsed["badges"].append(f"🐙 github: {val}")
|
|
103
|
+
raw = raw[: gh_match.start()] + " " + raw[gh_match.end() :]
|
|
104
|
+
|
|
105
|
+
# Workdir / cd
|
|
106
|
+
wd_match = re.search(r"(?:--(?:workdir|cd)\s+|@(?:workdir|cd):?\s*)([\"'][^\"']+[\"']|\S+)", raw)
|
|
107
|
+
if wd_match:
|
|
108
|
+
val = wd_match.group(1).strip("\"'")
|
|
109
|
+
parsed["workdir"] = val
|
|
110
|
+
parsed["badges"].append(f"📂 dir: {val}")
|
|
111
|
+
raw = raw[: wd_match.start()] + " " + raw[wd_match.end() :]
|
|
112
|
+
|
|
113
|
+
# Model
|
|
114
|
+
model_match = re.search(r"(?:--model\s+|@model:?\s*)([\"'][^\"']+[\"']|\S+)", raw)
|
|
115
|
+
if model_match:
|
|
116
|
+
val = model_match.group(1).strip("\"'")
|
|
117
|
+
cfg.model = val
|
|
118
|
+
parsed["model_switch"] = val
|
|
119
|
+
parsed["badges"].append(f"🤖 model: {val}")
|
|
120
|
+
raw = raw[: model_match.start()] + " " + raw[model_match.end() :]
|
|
121
|
+
|
|
122
|
+
# Thinking switches
|
|
123
|
+
if re.search(r"(?:^|\s)--(?:no-thinking|non-thinking)(?=\s|$)", raw):
|
|
124
|
+
cfg.enable_thinking = False
|
|
125
|
+
cfg.force_no_thinking = True
|
|
126
|
+
cfg.force_thinking = False
|
|
127
|
+
parsed["thinking_switch"] = False
|
|
128
|
+
parsed["badges"].append("⚡ --no-thinking")
|
|
129
|
+
raw = re.sub(r"(?:^|\s)--(?:no-thinking|non-thinking)(?=\s|$)", " ", raw)
|
|
130
|
+
elif re.search(r"(?:^|\s)--force-thinking(?=\s|$)", raw):
|
|
131
|
+
cfg.enable_thinking = True
|
|
132
|
+
cfg.force_thinking = True
|
|
133
|
+
cfg.force_no_thinking = False
|
|
134
|
+
parsed["thinking_switch"] = True
|
|
135
|
+
parsed["badges"].append("🧠 --force-thinking")
|
|
136
|
+
raw = re.sub(r"(?:^|\s)--force-thinking(?=\s|$)", " ", raw)
|
|
137
|
+
elif re.search(r"(?:^|\s)--(?:thinking|reasoning)(?=\s|$)", raw):
|
|
138
|
+
cfg.enable_thinking = True
|
|
139
|
+
cfg.force_no_thinking = False
|
|
140
|
+
parsed["thinking_switch"] = True
|
|
141
|
+
parsed["badges"].append("🧠 --thinking")
|
|
142
|
+
raw = re.sub(r"(?:^|\s)--(?:thinking|reasoning)(?=\s|$)", " ", raw)
|
|
143
|
+
|
|
144
|
+
# Debug switch
|
|
145
|
+
if re.search(r"(?:^|\s)--debug(?=\s|$)", raw):
|
|
146
|
+
parsed["debug"] = True
|
|
147
|
+
parsed["badges"].append("🔍 --debug")
|
|
148
|
+
raw = re.sub(r"(?:^|\s)--debug(?=\s|$)", " ", raw)
|
|
149
|
+
|
|
150
|
+
# Offline / Online mode switch
|
|
151
|
+
if re.search(r"(?:^|\s)--(?:offline|local)(?=\s|$)", raw):
|
|
152
|
+
cfg.base_url = "offline"
|
|
153
|
+
os.environ["ALPIECODE_BASE_URL"] = "offline"
|
|
154
|
+
parsed["mode_switch"] = "offline"
|
|
155
|
+
parsed["badges"].append("🧠 --offline")
|
|
156
|
+
raw = re.sub(r"(?:^|\s)--(?:offline|local)(?=\s|$)", " ", raw)
|
|
157
|
+
elif re.search(r"(?:^|\s)--online(?=\s|$)", raw):
|
|
158
|
+
from .config import KNOWN_PRESETS
|
|
159
|
+
cfg.base_url = KNOWN_PRESETS.get("alpie_seed", {}).get("base_url", "https://api.169pi.com/v1")
|
|
160
|
+
if "ALPIECODE_BASE_URL" in os.environ:
|
|
161
|
+
del os.environ["ALPIECODE_BASE_URL"]
|
|
162
|
+
parsed["mode_switch"] = "online"
|
|
163
|
+
parsed["badges"].append("🌐 --online")
|
|
164
|
+
raw = re.sub(r"(?:^|\s)--online(?=\s|$)", " ", raw)
|
|
165
|
+
|
|
166
|
+
clean_task = re.sub(r"\s+", " ", raw).strip()
|
|
167
|
+
|
|
168
|
+
# Apply workdir change if valid
|
|
169
|
+
if parsed["workdir"]:
|
|
170
|
+
try:
|
|
171
|
+
target_p = Path(parsed["workdir"])
|
|
172
|
+
if not target_p.is_absolute():
|
|
173
|
+
target_p = (current_workdir / target_p).resolve()
|
|
174
|
+
if target_p.is_dir():
|
|
175
|
+
if session:
|
|
176
|
+
session.workdir = target_p
|
|
177
|
+
else:
|
|
178
|
+
parsed["badges"].append(f"⚠️ dir not found: {parsed['workdir']}")
|
|
179
|
+
except Exception:
|
|
180
|
+
pass
|
|
181
|
+
|
|
182
|
+
return clean_task, parsed
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def render_tag_badges(parsed: Dict[str, Any], has_rich: bool = True) -> Optional[str]:
|
|
186
|
+
"""Format parsed badges into a sleek terminal status strip."""
|
|
187
|
+
badges = parsed.get("badges", [])
|
|
188
|
+
if not badges:
|
|
189
|
+
return None
|
|
190
|
+
|
|
191
|
+
if has_rich:
|
|
192
|
+
badge_strs = [f"[bold cyan]{b}[/bold cyan]" for b in badges]
|
|
193
|
+
return f"[dim]🏷️ Tags active:[/dim] {' '.join(badge_strs)}"
|
|
194
|
+
else:
|
|
195
|
+
return f"Tags active: {' | '.join(badges)}"
|
|
@@ -29,7 +29,11 @@ def _show_banner():
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
def _normalize_args():
|
|
32
|
-
known_commands = {
|
|
32
|
+
known_commands = {
|
|
33
|
+
"init", "scaffold", "serve", "run", "chat", "plan", "diff", "undo",
|
|
34
|
+
"doctor", "explain", "dream", "version", "resume", "sessions",
|
|
35
|
+
"-h", "--help", "-v", "--version",
|
|
36
|
+
}
|
|
33
37
|
subcommand = None
|
|
34
38
|
|
|
35
39
|
# Normalize common flag typos / aliases before parsing
|
|
@@ -160,7 +164,7 @@ def main():
|
|
|
160
164
|
common.add_argument("--debug", action="store_true", help="Show autonomous discovery and debug diagnostics")
|
|
161
165
|
common.add_argument("--offline", "--local", dest="offline", action="store_true", help="Run using local offline GGUF model on GPU without internet")
|
|
162
166
|
common.add_argument("--ctx-size", type=int, default=None, help="Context size in tokens (default: 8192 offline, 262144 online)")
|
|
163
|
-
common.add_argument("--resume", dest="resume_id", default=None, help="Resume an existing session by ID or transcript path")
|
|
167
|
+
common.add_argument("--resume", "--session", "-s", dest="resume_id", default=None, help="Resume an existing session by unique ID or transcript path")
|
|
164
168
|
common.add_argument("--continue", dest="continue_session", action="store_true", help="Continue the most recent session in this project")
|
|
165
169
|
common.add_argument("--sessions", action="store_true", help="List saved conversation sessions")
|
|
166
170
|
|
|
@@ -174,6 +178,13 @@ def main():
|
|
|
174
178
|
sub = parser.add_subparsers(dest="command")
|
|
175
179
|
sub.add_parser("version", help="Show current version")
|
|
176
180
|
|
|
181
|
+
# ── resume ──
|
|
182
|
+
resume_p = sub.add_parser("resume", help="Resume an existing conversation session by ID (or latest if omitted)", parents=[common])
|
|
183
|
+
resume_p.add_argument("session_id", nargs="?", default=None, help="Session ID to resume (e.g. 86bf01c0)")
|
|
184
|
+
|
|
185
|
+
# ── sessions ──
|
|
186
|
+
sub.add_parser("sessions", help="List all saved conversation sessions", parents=[common])
|
|
187
|
+
|
|
177
188
|
# ── init ──
|
|
178
189
|
init_p = sub.add_parser("init", help="Configure endpoint or initialize project documentation")
|
|
179
190
|
init_p.add_argument("--project", action="store_true", help="Initialize project documentation and persistent memory")
|
|
@@ -220,24 +231,33 @@ def main():
|
|
|
220
231
|
|
|
221
232
|
args = parser.parse_args()
|
|
222
233
|
|
|
223
|
-
if getattr(args, "sessions", False):
|
|
234
|
+
if getattr(args, "sessions", False) or args.command == "sessions":
|
|
224
235
|
import time
|
|
225
236
|
from .session import SessionManager
|
|
226
237
|
sm = SessionManager()
|
|
227
238
|
saved = sm.list_saved_sessions(Path(args.workdir))
|
|
228
239
|
if not saved:
|
|
229
|
-
print("ℹ️ No saved sessions found.")
|
|
240
|
+
print("ℹ️ No saved sessions found in this workspace.")
|
|
230
241
|
else:
|
|
231
|
-
print("\n📋 Saved AlpieCode Sessions:")
|
|
232
|
-
for s in saved[:
|
|
242
|
+
print("\n📋 Saved AlpieCode Sessions (Unique Conversation IDs):")
|
|
243
|
+
for s in saved[:15]:
|
|
233
244
|
sid = s.get("id")
|
|
234
245
|
updated = time.ctime(s.get("updated_at", 0))
|
|
235
246
|
msgs = s.get("message_count", 0)
|
|
236
247
|
task_desc = (s.get("task_description") or "Interactive chat")[:50]
|
|
237
248
|
print(f" • {sid} ({updated}) [{msgs} msgs] {task_desc}")
|
|
238
|
-
print("\nResume a session
|
|
249
|
+
print("\nResume a specific session: alpiecode --session <session_id> (or alpiecode resume <session_id>)")
|
|
250
|
+
print("Resume latest session: alpiecode --continue\n")
|
|
239
251
|
return
|
|
240
252
|
|
|
253
|
+
if args.command == "resume":
|
|
254
|
+
target_id = getattr(args, "session_id", None) or getattr(args, "resume_id", None)
|
|
255
|
+
if target_id:
|
|
256
|
+
args.resume_id = target_id
|
|
257
|
+
else:
|
|
258
|
+
args.continue_session = True
|
|
259
|
+
args.command = "chat"
|
|
260
|
+
|
|
241
261
|
if not args.command:
|
|
242
262
|
# Bare invocation (e.g. typing `alpiecode`): default directly to interactive conversation mode (like `agy` or `claude`)
|
|
243
263
|
args.command = "chat"
|
|
@@ -285,14 +285,32 @@ def compact_tool_calls(tool_calls: List[Any]) -> List[Any]:
|
|
|
285
285
|
continue
|
|
286
286
|
name = fn.get("name", "")
|
|
287
287
|
raw_args = fn.get("arguments", "")
|
|
288
|
-
if name in ("write_file", "edit_file", "apply_patch"):
|
|
288
|
+
if name in ("write_file", "edit_file", "append_file", "apply_patch"):
|
|
289
289
|
try:
|
|
290
290
|
args = json.loads(raw_args) if isinstance(raw_args, str) else dict(raw_args)
|
|
291
|
-
|
|
292
|
-
|
|
291
|
+
path = args.get("path") or args.get("filename") or args.get("file") or "file"
|
|
292
|
+
changed = False
|
|
293
|
+
|
|
294
|
+
content = args.get("content") or args.get("patch")
|
|
293
295
|
if isinstance(content, str) and len(content) > 150:
|
|
294
296
|
lines = content.splitlines()
|
|
295
297
|
args["content"] = f"[Content saved to {path} ({len(lines)} lines, {len(content)} bytes)]"
|
|
298
|
+
changed = True
|
|
299
|
+
|
|
300
|
+
new_str = args.get("new_str") or args.get("new_string") or args.get("replacement") or args.get("code")
|
|
301
|
+
if isinstance(new_str, str) and len(new_str) > 150:
|
|
302
|
+
lines = new_str.splitlines()
|
|
303
|
+
k = "new_str" if "new_str" in args else ("new_string" if "new_string" in args else ("replacement" if "replacement" in args else "code"))
|
|
304
|
+
args[k] = f"[Replacement code applied to {path} ({len(lines)} lines)]"
|
|
305
|
+
changed = True
|
|
306
|
+
|
|
307
|
+
old_str = args.get("old_str") or args.get("old_string") or args.get("target")
|
|
308
|
+
if isinstance(old_str, str) and len(old_str) > 150:
|
|
309
|
+
k = "old_str" if "old_str" in args else ("old_string" if "old_string" in args else "target")
|
|
310
|
+
args[k] = f"[Target lines replaced in {path}]"
|
|
311
|
+
changed = True
|
|
312
|
+
|
|
313
|
+
if changed:
|
|
296
314
|
compact_tc = dict(tc)
|
|
297
315
|
compact_tc["function"] = dict(fn)
|
|
298
316
|
compact_tc["function"]["arguments"] = json.dumps(args) if isinstance(raw_args, str) else args
|