alpiecode 10.6.9__tar.gz → 10.7.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.6.9 → alpiecode-10.7.0}/PKG-INFO +1 -1
- {alpiecode-10.6.9 → alpiecode-10.7.0}/pyproject.toml +1 -1
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/alpiecode.egg-info/PKG-INFO +1 -1
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/backends/local_backend.py +68 -35
- {alpiecode-10.6.9 → alpiecode-10.7.0}/README.md +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/setup.cfg +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/alpiecode/__init__.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/alpiecode.egg-info/SOURCES.txt +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/alpiecode.egg-info/dependency_links.txt +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/alpiecode.egg-info/entry_points.txt +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/alpiecode.egg-info/requires.txt +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/alpiecode.egg-info/top_level.txt +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/__init__.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/agent.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/assessment.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/backends/__init__.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/backends/base.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/backends/openai_backend.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/cache.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/cli.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/client.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/compaction.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/config.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/context.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/discovery.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/doctor.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/dream_rsi.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/executor.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/extension/alpiecode.vsix +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/git_ops.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/github.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/guardian.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/guardrails.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/ipython_ext.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/local_model.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/media.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/memory.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/metrics.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/orchestrator.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/paths.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/progress.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/prompt.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/rephraser.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/server.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/session.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/system1.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/tools.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/updater.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/verifier.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/vscode_installer.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/test/test_adaptive_resilience.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/test/test_cli_ui.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/test/test_context_and_trajectory.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/test/test_dream_rsi.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/test/test_local_model_download.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/test/test_non_thinking_and_local_stream.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/test/test_task_assessment.py +0 -0
- {alpiecode-10.6.9 → alpiecode-10.7.0}/test/test_verifier.py +0 -0
|
@@ -1007,27 +1007,60 @@ class AndroidBackend(BasePlatformBackend):
|
|
|
1007
1007
|
def _get_bridge_url(self) -> str:
|
|
1008
1008
|
return os.environ.get("ANDROID_LLAMA_BRIDGE", "http://127.0.0.1:8080").rstrip("/")
|
|
1009
1009
|
|
|
1010
|
+
def _find_llama_server_bin(self) -> Optional[Path]:
|
|
1011
|
+
custom = os.environ.get("LLAMA_SERVER_PATH") or os.environ.get("LLAMA_BIN")
|
|
1012
|
+
if custom and Path(custom).is_file():
|
|
1013
|
+
return Path(custom)
|
|
1014
|
+
which_bin = shutil.which("llama-server")
|
|
1015
|
+
if which_bin:
|
|
1016
|
+
return Path(which_bin)
|
|
1017
|
+
candidates = [
|
|
1018
|
+
Path("/data/data/com.termux/files/usr/bin/llama-server"),
|
|
1019
|
+
Path.home() / "llama.cpp" / "build" / "bin" / "llama-server",
|
|
1020
|
+
Path.home() / "llama.cpp" / "build" / "bin" / "Release" / "llama-server",
|
|
1021
|
+
Path.home() / ".alpiecode" / "bin" / "llama-server",
|
|
1022
|
+
Path.cwd() / "llama.cpp" / "build" / "bin" / "llama-server",
|
|
1023
|
+
]
|
|
1024
|
+
for c in candidates:
|
|
1025
|
+
if c.is_file() and os.access(c, os.X_OK):
|
|
1026
|
+
return c
|
|
1027
|
+
return None
|
|
1028
|
+
|
|
1029
|
+
def _find_gguf_model(self) -> Optional[Path]:
|
|
1030
|
+
from ..local_model import get_model_cache_dir
|
|
1031
|
+
candidate_dirs = [
|
|
1032
|
+
get_model_cache_dir(),
|
|
1033
|
+
Path.home() / ".alpiecode" / "models",
|
|
1034
|
+
Path.home() / "models",
|
|
1035
|
+
Path.cwd() / "models",
|
|
1036
|
+
Path.cwd() / ".alpiecode" / "models",
|
|
1037
|
+
]
|
|
1038
|
+
for d in candidate_dirs:
|
|
1039
|
+
if d.exists():
|
|
1040
|
+
ggufs = list(d.glob("*.gguf"))
|
|
1041
|
+
mains = [g for g in ggufs if "mmproj" not in g.name.lower()]
|
|
1042
|
+
if mains:
|
|
1043
|
+
mains.sort(key=lambda p: p.stat().st_size)
|
|
1044
|
+
return mains[0]
|
|
1045
|
+
return None
|
|
1046
|
+
|
|
1010
1047
|
def _ensure_local_server(self) -> bool:
|
|
1011
1048
|
"""Auto-detect or auto-start local llama-server in background if needed."""
|
|
1012
1049
|
if self._is_bridge_online():
|
|
1013
1050
|
return True
|
|
1014
|
-
server_bin =
|
|
1051
|
+
server_bin = self._find_llama_server_bin()
|
|
1015
1052
|
if not server_bin:
|
|
1053
|
+
self._last_server_error = "llama-server binary was not found in PATH or ~/llama.cpp/build/bin/llama-server."
|
|
1016
1054
|
return False
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1055
|
+
model_path = self._find_gguf_model()
|
|
1056
|
+
if not model_path:
|
|
1057
|
+
self._last_server_error = "No GGUF model found in ~/.alpiecode/models or ~/models."
|
|
1020
1058
|
return False
|
|
1021
|
-
|
|
1022
|
-
main_models = [g for g in ggufs if "mmproj" not in g.name.lower()]
|
|
1023
|
-
if not main_models:
|
|
1024
|
-
return False
|
|
1025
|
-
model_path = main_models[0]
|
|
1026
|
-
mmprojs = [g for g in ggufs if "mmproj" in g.name.lower()]
|
|
1059
|
+
mmprojs = list(model_path.parent.glob("*mmproj*.gguf"))
|
|
1027
1060
|
cmd = [
|
|
1028
|
-
server_bin,
|
|
1061
|
+
str(server_bin),
|
|
1029
1062
|
"-m", str(model_path),
|
|
1030
|
-
"-c", "
|
|
1063
|
+
"-c", "2048",
|
|
1031
1064
|
"-t", "4",
|
|
1032
1065
|
"-np", "1",
|
|
1033
1066
|
"-b", "512",
|
|
@@ -1039,6 +1072,7 @@ class AndroidBackend(BasePlatformBackend):
|
|
|
1039
1072
|
if mmprojs:
|
|
1040
1073
|
cmd += ["--mmproj", str(mmprojs[0])]
|
|
1041
1074
|
try:
|
|
1075
|
+
print(f"⏳ Starting local llama-server in background ({model_path.name})...")
|
|
1042
1076
|
subprocess.Popen(
|
|
1043
1077
|
cmd,
|
|
1044
1078
|
stdout=subprocess.DEVNULL,
|
|
@@ -1046,12 +1080,13 @@ class AndroidBackend(BasePlatformBackend):
|
|
|
1046
1080
|
start_new_session=True,
|
|
1047
1081
|
)
|
|
1048
1082
|
import time
|
|
1049
|
-
for _ in range(
|
|
1083
|
+
for _ in range(35):
|
|
1050
1084
|
if self._is_bridge_online():
|
|
1051
1085
|
return True
|
|
1052
|
-
time.sleep(0.
|
|
1053
|
-
except Exception:
|
|
1054
|
-
|
|
1086
|
+
time.sleep(0.5)
|
|
1087
|
+
except Exception as e:
|
|
1088
|
+
self._last_server_error = f"Failed to launch llama-server: {e}"
|
|
1089
|
+
return False
|
|
1055
1090
|
return self._is_bridge_online()
|
|
1056
1091
|
|
|
1057
1092
|
@property
|
|
@@ -1060,7 +1095,21 @@ class AndroidBackend(BasePlatformBackend):
|
|
|
1060
1095
|
import llama_cpp
|
|
1061
1096
|
return True
|
|
1062
1097
|
except ImportError:
|
|
1063
|
-
return self._is_bridge_online() or bool(
|
|
1098
|
+
return self._is_bridge_online() or bool(self._find_llama_server_bin() or shutil.which("llama-cli"))
|
|
1099
|
+
|
|
1100
|
+
def _raise_missing_engine_error(self) -> None:
|
|
1101
|
+
err_detail = getattr(self, "_last_server_error", None)
|
|
1102
|
+
detail_msg = f"\n│ Reason: {err_detail}" if err_detail else ""
|
|
1103
|
+
raise RuntimeError(
|
|
1104
|
+
"\n╭────────────────────────────────────────────────────────────╮\n"
|
|
1105
|
+
"│ Android / Termux Local Inference: │\n"
|
|
1106
|
+
"│ Local inference server (http://127.0.0.1:8080) is offline.│"
|
|
1107
|
+
f"{detail_msg}\n"
|
|
1108
|
+
"│ │\n"
|
|
1109
|
+
"│ To start it manually in Termux: │\n"
|
|
1110
|
+
"│ llama-server -m ~/.alpiecode/models/*.gguf -c 2048 -t 4 │\n"
|
|
1111
|
+
"╰────────────────────────────────────────────────────────────╯"
|
|
1112
|
+
)
|
|
1064
1113
|
|
|
1065
1114
|
def chat_completion(
|
|
1066
1115
|
self,
|
|
@@ -1079,15 +1128,7 @@ class AndroidBackend(BasePlatformBackend):
|
|
|
1079
1128
|
if self._ensure_local_server():
|
|
1080
1129
|
return self._bridge_chat_completion(messages, tools, temperature, max_tokens, enable_thinking)
|
|
1081
1130
|
|
|
1082
|
-
|
|
1083
|
-
"\n╭────────────────────────────────────────────────────────────╮\n"
|
|
1084
|
-
"│ Android / Termux Native Inference: │\n"
|
|
1085
|
-
"│ No local engine is available. │\n"
|
|
1086
|
-
"│ To enable local inference on Termux, run: │\n"
|
|
1087
|
-
"│ pkg install llama-cpp │\n"
|
|
1088
|
-
"│ alpiecode init │\n"
|
|
1089
|
-
"╰────────────────────────────────────────────────────────────╯"
|
|
1090
|
-
)
|
|
1131
|
+
self._raise_missing_engine_error()
|
|
1091
1132
|
|
|
1092
1133
|
def chat_completion_stream(
|
|
1093
1134
|
self,
|
|
@@ -1108,15 +1149,7 @@ class AndroidBackend(BasePlatformBackend):
|
|
|
1108
1149
|
yield from self._bridge_chat_completion_stream(messages, tools, temperature, max_tokens, enable_thinking)
|
|
1109
1150
|
return
|
|
1110
1151
|
|
|
1111
|
-
|
|
1112
|
-
"\n╭────────────────────────────────────────────────────────────╮\n"
|
|
1113
|
-
"│ Android / Termux Native Inference: │\n"
|
|
1114
|
-
"│ No local engine is available. │\n"
|
|
1115
|
-
"│ To enable local inference on Termux, run: │\n"
|
|
1116
|
-
"│ pkg install llama-cpp │\n"
|
|
1117
|
-
"│ alpiecode init │\n"
|
|
1118
|
-
"╰────────────────────────────────────────────────────────────╯"
|
|
1119
|
-
)
|
|
1152
|
+
self._raise_missing_engine_error()
|
|
1120
1153
|
|
|
1121
1154
|
|
|
1122
1155
|
class MacOSBackend(BasePlatformBackend):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|