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.
Files changed (58) hide show
  1. {alpiecode-10.6.9 → alpiecode-10.7.0}/PKG-INFO +1 -1
  2. {alpiecode-10.6.9 → alpiecode-10.7.0}/pyproject.toml +1 -1
  3. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/alpiecode.egg-info/PKG-INFO +1 -1
  4. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/backends/local_backend.py +68 -35
  5. {alpiecode-10.6.9 → alpiecode-10.7.0}/README.md +0 -0
  6. {alpiecode-10.6.9 → alpiecode-10.7.0}/setup.cfg +0 -0
  7. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/alpiecode/__init__.py +0 -0
  8. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/alpiecode.egg-info/SOURCES.txt +0 -0
  9. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/alpiecode.egg-info/dependency_links.txt +0 -0
  10. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/alpiecode.egg-info/entry_points.txt +0 -0
  11. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/alpiecode.egg-info/requires.txt +0 -0
  12. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/alpiecode.egg-info/top_level.txt +0 -0
  13. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/__init__.py +0 -0
  14. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/agent.py +0 -0
  15. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/assessment.py +0 -0
  16. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/backends/__init__.py +0 -0
  17. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/backends/base.py +0 -0
  18. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/backends/openai_backend.py +0 -0
  19. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/cache.py +0 -0
  20. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/cli.py +0 -0
  21. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/client.py +0 -0
  22. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/compaction.py +0 -0
  23. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/config.py +0 -0
  24. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/context.py +0 -0
  25. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/discovery.py +0 -0
  26. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/doctor.py +0 -0
  27. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/dream_rsi.py +0 -0
  28. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/executor.py +0 -0
  29. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/extension/alpiecode.vsix +0 -0
  30. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/git_ops.py +0 -0
  31. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/github.py +0 -0
  32. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/guardian.py +0 -0
  33. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/guardrails.py +0 -0
  34. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/ipython_ext.py +0 -0
  35. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/local_model.py +0 -0
  36. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/media.py +0 -0
  37. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/memory.py +0 -0
  38. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/metrics.py +0 -0
  39. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/orchestrator.py +0 -0
  40. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/paths.py +0 -0
  41. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/progress.py +0 -0
  42. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/prompt.py +0 -0
  43. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/rephraser.py +0 -0
  44. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/server.py +0 -0
  45. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/session.py +0 -0
  46. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/system1.py +0 -0
  47. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/tools.py +0 -0
  48. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/updater.py +0 -0
  49. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/verifier.py +0 -0
  50. {alpiecode-10.6.9 → alpiecode-10.7.0}/src/codeagent/vscode_installer.py +0 -0
  51. {alpiecode-10.6.9 → alpiecode-10.7.0}/test/test_adaptive_resilience.py +0 -0
  52. {alpiecode-10.6.9 → alpiecode-10.7.0}/test/test_cli_ui.py +0 -0
  53. {alpiecode-10.6.9 → alpiecode-10.7.0}/test/test_context_and_trajectory.py +0 -0
  54. {alpiecode-10.6.9 → alpiecode-10.7.0}/test/test_dream_rsi.py +0 -0
  55. {alpiecode-10.6.9 → alpiecode-10.7.0}/test/test_local_model_download.py +0 -0
  56. {alpiecode-10.6.9 → alpiecode-10.7.0}/test/test_non_thinking_and_local_stream.py +0 -0
  57. {alpiecode-10.6.9 → alpiecode-10.7.0}/test/test_task_assessment.py +0 -0
  58. {alpiecode-10.6.9 → alpiecode-10.7.0}/test/test_verifier.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alpiecode
3
- Version: 10.6.9
3
+ Version: 10.7.0
4
4
  Summary: AlpieCode
5
5
  Requires-Python: >=3.9
6
6
  Requires-Dist: huggingface_hub>=0.20.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "alpiecode"
7
- version = "10.6.9"
7
+ version = "10.7.0"
8
8
  description = "AlpieCode"
9
9
  requires-python = ">=3.9"
10
10
  dependencies = [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alpiecode
3
- Version: 10.6.9
3
+ Version: 10.7.0
4
4
  Summary: AlpieCode
5
5
  Requires-Python: >=3.9
6
6
  Requires-Dist: huggingface_hub>=0.20.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 = shutil.which("llama-server")
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
- from ..local_model import get_model_cache_dir
1018
- cache_dir = get_model_cache_dir()
1019
- if not cache_dir.exists():
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
- ggufs = list(cache_dir.glob("*.gguf"))
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", "4096",
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(25):
1083
+ for _ in range(35):
1050
1084
  if self._is_bridge_online():
1051
1085
  return True
1052
- time.sleep(0.4)
1053
- except Exception:
1054
- pass
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(shutil.which("llama-server") or shutil.which("llama-cli"))
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
- raise RuntimeError(
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
- raise RuntimeError(
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