alpiecode 2.0.5__tar.gz → 2.0.7__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-2.0.5 → alpiecode-2.0.7}/PKG-INFO +1 -1
- {alpiecode-2.0.5 → alpiecode-2.0.7}/pyproject.toml +1 -1
- alpiecode-2.0.7/src/alpiecode/__init__.py +15 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/alpiecode.egg-info/PKG-INFO +1 -1
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/alpiecode.egg-info/SOURCES.txt +2 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/alpiecode.egg-info/top_level.txt +1 -0
- alpiecode-2.0.7/src/codeagent/__init__.py +106 -0
- alpiecode-2.0.7/src/codeagent/ipython_ext.py +140 -0
- alpiecode-2.0.5/src/codeagent/__init__.py +0 -1
- {alpiecode-2.0.5 → alpiecode-2.0.7}/README.md +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/setup.cfg +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/alpiecode.egg-info/dependency_links.txt +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/alpiecode.egg-info/entry_points.txt +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/alpiecode.egg-info/requires.txt +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/agent.py +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/backends/__init__.py +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/backends/base.py +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/backends/local_backend.py +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/backends/openai_backend.py +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/cache.py +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/cli.py +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/client.py +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/compaction.py +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/config.py +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/context.py +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/doctor.py +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/executor.py +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/extension/alpiecode.vsix +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/github.py +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/guardian.py +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/local_model.py +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/media.py +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/memory.py +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/orchestrator.py +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/prompt.py +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/server.py +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/session.py +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/tools.py +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/updater.py +0 -0
- {alpiecode-2.0.5 → alpiecode-2.0.7}/src/codeagent/vscode_installer.py +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
README.md
|
|
2
2
|
pyproject.toml
|
|
3
|
+
src/alpiecode/__init__.py
|
|
3
4
|
src/alpiecode.egg-info/PKG-INFO
|
|
4
5
|
src/alpiecode.egg-info/SOURCES.txt
|
|
5
6
|
src/alpiecode.egg-info/dependency_links.txt
|
|
@@ -18,6 +19,7 @@ src/codeagent/doctor.py
|
|
|
18
19
|
src/codeagent/executor.py
|
|
19
20
|
src/codeagent/github.py
|
|
20
21
|
src/codeagent/guardian.py
|
|
22
|
+
src/codeagent/ipython_ext.py
|
|
21
23
|
src/codeagent/local_model.py
|
|
22
24
|
src/codeagent/media.py
|
|
23
25
|
src/codeagent/memory.py
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AlpieCode — Autonomous AI Coding Agent powered by local 169Pi GGUF VLM & Online API.
|
|
3
|
+
|
|
4
|
+
Supports:
|
|
5
|
+
- CLI usage (`alpiecode run`, `alpiecode serve`, `alpiecode doctor`)
|
|
6
|
+
- Jupyter Notebooks & Google Colab (`%load_ext alpiecode`, `%alpie <task>`)
|
|
7
|
+
- Python SDK API (`import alpiecode; alpiecode.run("...")`)
|
|
8
|
+
- VS Code Extension
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import Optional, Any, Dict
|
|
13
|
+
|
|
14
|
+
__version__ = "2.0.4"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def run(task: str, workdir: str = ".", reasoning_level: str = "medium", **kwargs):
|
|
18
|
+
"""Run an autonomous coding task programmatically."""
|
|
19
|
+
from .config import load_config
|
|
20
|
+
from .agent import run_agent
|
|
21
|
+
cfg = load_config()
|
|
22
|
+
if reasoning_level == "low":
|
|
23
|
+
cfg.enable_thinking = False
|
|
24
|
+
cfg.temperature = 0.0
|
|
25
|
+
elif reasoning_level == "medium":
|
|
26
|
+
cfg.enable_thinking = True
|
|
27
|
+
cfg.temperature = 0.1
|
|
28
|
+
elif reasoning_level == "high":
|
|
29
|
+
cfg.enable_thinking = True
|
|
30
|
+
cfg.temperature = 0.2
|
|
31
|
+
return run_agent(task, Path(workdir).resolve(), cfg, verbose=kwargs.get("verbose", True))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def plan(task: str, workdir: str = ".", **kwargs):
|
|
35
|
+
"""Generate an implementation plan without making edits."""
|
|
36
|
+
from .config import load_config
|
|
37
|
+
from .agent import run_agent
|
|
38
|
+
cfg = load_config()
|
|
39
|
+
plan_task = (
|
|
40
|
+
f"PLANNING ONLY — Do NOT make any file edits. "
|
|
41
|
+
f"Analyze the codebase and create a detailed implementation plan for the following task. "
|
|
42
|
+
f"Use list_files, read_file, and file_search to understand the project. "
|
|
43
|
+
f"Then use update_plan to write a structured plan with deliverables and checks. "
|
|
44
|
+
f"Finish with DONE: when the plan is complete.\n\n"
|
|
45
|
+
f"Task: {task}"
|
|
46
|
+
)
|
|
47
|
+
return run_agent(plan_task, Path(workdir).resolve(), cfg, verbose=kwargs.get("verbose", True))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def explain(target: str, workdir: str = ".", **kwargs):
|
|
51
|
+
"""Explain a file, function, or concept."""
|
|
52
|
+
from .config import load_config
|
|
53
|
+
from .agent import run_agent
|
|
54
|
+
cfg = load_config()
|
|
55
|
+
target_path = Path(workdir) / target if not Path(target).is_absolute() else Path(target)
|
|
56
|
+
if target_path.exists() and target_path.is_file():
|
|
57
|
+
content = target_path.read_text(encoding="utf-8", errors="replace")
|
|
58
|
+
explain_task = (
|
|
59
|
+
f"EXPLANATION ONLY — Do NOT make any file edits.\n\n"
|
|
60
|
+
f"Please explain the file `{target}` in detail:\n"
|
|
61
|
+
f"1. Overview of its purpose and role\n"
|
|
62
|
+
f"2. Key functions, classes, and internal logic\n"
|
|
63
|
+
f"3. Dependencies and how it connects to the project\n"
|
|
64
|
+
f"4. Step-by-step walkthrough of how it executes\n\n"
|
|
65
|
+
f"File content ({target}):\n```\n{content[:16000]}\n```"
|
|
66
|
+
)
|
|
67
|
+
else:
|
|
68
|
+
explain_task = f"EXPLANATION ONLY — Do NOT make any file edits.\n\nExplain topic: {target}"
|
|
69
|
+
return run_agent(explain_task, Path(workdir).resolve(), cfg, verbose=kwargs.get("verbose", True))
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def chat(workdir: str = ".", **kwargs):
|
|
73
|
+
"""Start an interactive CLI chat session."""
|
|
74
|
+
from .config import load_config
|
|
75
|
+
from .agent import run_chat
|
|
76
|
+
cfg = load_config()
|
|
77
|
+
return run_chat(Path(workdir).resolve(), cfg, verbose=kwargs.get("verbose", True))
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def doctor() -> int:
|
|
81
|
+
"""Run system health diagnostics."""
|
|
82
|
+
from .doctor import run_doctor
|
|
83
|
+
return run_doctor()
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
# Re-export IPython extension loaders so `%load_ext alpiecode` works seamlessly
|
|
87
|
+
def load_ipython_extension(ipython):
|
|
88
|
+
from .ipython_ext import load_ipython_extension as _load
|
|
89
|
+
_load(ipython)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def unload_ipython_extension(ipython):
|
|
93
|
+
from .ipython_ext import unload_ipython_extension as _unload
|
|
94
|
+
_unload(ipython)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
__all__ = [
|
|
98
|
+
"run",
|
|
99
|
+
"plan",
|
|
100
|
+
"explain",
|
|
101
|
+
"chat",
|
|
102
|
+
"doctor",
|
|
103
|
+
"load_ipython_extension",
|
|
104
|
+
"unload_ipython_extension",
|
|
105
|
+
"__version__",
|
|
106
|
+
]
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"""
|
|
2
|
+
IPython & Jupyter / Google Colab extension for AlpieCode.
|
|
3
|
+
|
|
4
|
+
Enables seamless usage of AlpieCode inside Jupyter Notebooks, JupyterLab,
|
|
5
|
+
and Google Colab via cell/line magic commands and rich interactive displays:
|
|
6
|
+
|
|
7
|
+
%load_ext alpiecode
|
|
8
|
+
%alpie write a quick pandas script to inspect data.csv
|
|
9
|
+
%%alpie
|
|
10
|
+
Create a complete PyTorch model training pipeline.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import sys
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
from typing import Optional
|
|
16
|
+
|
|
17
|
+
from .config import load_config
|
|
18
|
+
from .agent import run_agent
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _is_notebook() -> bool:
|
|
22
|
+
"""Check if code is running inside a Jupyter notebook or Google Colab."""
|
|
23
|
+
try:
|
|
24
|
+
from IPython import get_ipython
|
|
25
|
+
shell = get_ipython()
|
|
26
|
+
if shell is None:
|
|
27
|
+
return False
|
|
28
|
+
shell_name = shell.__class__.__name__
|
|
29
|
+
if "ZMQInteractiveShell" in shell_name or "Shell" in shell_name:
|
|
30
|
+
return True
|
|
31
|
+
return False
|
|
32
|
+
except Exception:
|
|
33
|
+
return False
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _display_html(html_str: str):
|
|
37
|
+
"""Render rich HTML in Jupyter or Google Colab."""
|
|
38
|
+
try:
|
|
39
|
+
from IPython.display import HTML, display
|
|
40
|
+
display(HTML(html_str))
|
|
41
|
+
except Exception:
|
|
42
|
+
print(html_str)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def alpie_magic(line: str, cell: Optional[str] = None):
|
|
46
|
+
"""
|
|
47
|
+
%alpie <task> (line magic)
|
|
48
|
+
%%alpie (cell magic)
|
|
49
|
+
<multiline task>
|
|
50
|
+
"""
|
|
51
|
+
task = (cell if cell is not None and cell.strip() else line).strip()
|
|
52
|
+
if not task:
|
|
53
|
+
print("Usage: %alpie <task> OR %%alpie\\n<multiline task>")
|
|
54
|
+
return
|
|
55
|
+
|
|
56
|
+
cfg = load_config()
|
|
57
|
+
workdir = Path(".").resolve()
|
|
58
|
+
|
|
59
|
+
if _is_notebook():
|
|
60
|
+
_display_html(
|
|
61
|
+
f'<div style="border-left: 3px solid #60a5fa; padding: 6px 12px; background: rgba(96,165,250,0.08); border-radius: 4px; font-family: sans-serif; margin-bottom: 8px;">'
|
|
62
|
+
f'<strong style="color: #60a5fa;">⚡ AlpieCode Agent:</strong> {task[:120]}'
|
|
63
|
+
f'</div>'
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
run_agent(task, workdir, cfg, verbose=True)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def alpie_plan_magic(line: str, cell: Optional[str] = None):
|
|
70
|
+
"""%alpie_plan <task> — Generate a structured implementation plan without making edits."""
|
|
71
|
+
task = (cell if cell is not None and cell.strip() else line).strip()
|
|
72
|
+
if not task:
|
|
73
|
+
print("Usage: %alpie_plan <task>")
|
|
74
|
+
return
|
|
75
|
+
|
|
76
|
+
plan_task = (
|
|
77
|
+
f"PLANNING ONLY — Do NOT make any file edits. "
|
|
78
|
+
f"Analyze the codebase and create a detailed implementation plan for the following task. "
|
|
79
|
+
f"Use list_files, read_file, and file_search to understand the project. "
|
|
80
|
+
f"Then use update_plan to write a structured plan with deliverables and checks. "
|
|
81
|
+
f"Finish with DONE: when the plan is complete.\n\n"
|
|
82
|
+
f"Task: {task}"
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
cfg = load_config()
|
|
86
|
+
workdir = Path(".").resolve()
|
|
87
|
+
run_agent(plan_task, workdir, cfg, verbose=True)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def alpie_explain_magic(line: str):
|
|
91
|
+
"""%alpie_explain <file_path_or_concept> — Explain code or architecture."""
|
|
92
|
+
target = line.strip()
|
|
93
|
+
if not target:
|
|
94
|
+
print("Usage: %alpie_explain <file_path_or_concept>")
|
|
95
|
+
return
|
|
96
|
+
|
|
97
|
+
cfg = load_config()
|
|
98
|
+
workdir = Path(".").resolve()
|
|
99
|
+
target_path = workdir / target if not Path(target).is_absolute() else Path(target)
|
|
100
|
+
|
|
101
|
+
if target_path.exists() and target_path.is_file():
|
|
102
|
+
content = target_path.read_text(encoding="utf-8", errors="replace")
|
|
103
|
+
explain_task = (
|
|
104
|
+
f"EXPLANATION ONLY — Do NOT make any file edits.\n\n"
|
|
105
|
+
f"Please explain the file `{target}` in detail:\n"
|
|
106
|
+
f"1. Overview of its purpose and role\n"
|
|
107
|
+
f"2. Key functions, classes, and internal logic\n"
|
|
108
|
+
f"3. Dependencies and how it connects to the project\n"
|
|
109
|
+
f"4. Step-by-step walkthrough of how it executes\n\n"
|
|
110
|
+
f"File content ({target}):\n```\n{content[:16000]}\n```"
|
|
111
|
+
)
|
|
112
|
+
else:
|
|
113
|
+
explain_task = (
|
|
114
|
+
f"EXPLANATION ONLY — Do NOT make any file edits.\n\n"
|
|
115
|
+
f"Explain the following codebase concept or architecture in detail:\n"
|
|
116
|
+
f"Topic: {target}\n\n"
|
|
117
|
+
f"Use read_file or file_search if needed to understand codebase context."
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
run_agent(explain_task, workdir, cfg, verbose=True)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def alpie_doctor_magic(line: str = ""):
|
|
124
|
+
"""%alpie_doctor — Run system health diagnostic checks."""
|
|
125
|
+
from .doctor import run_doctor
|
|
126
|
+
run_doctor()
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def load_ipython_extension(ipython):
|
|
130
|
+
"""Called by IPython when user runs `%load_ext alpiecode`."""
|
|
131
|
+
ipython.register_magic_function(alpie_magic, magic_kind="line_cell", magic_name="alpie")
|
|
132
|
+
ipython.register_magic_function(alpie_plan_magic, magic_kind="line_cell", magic_name="alpie_plan")
|
|
133
|
+
ipython.register_magic_function(alpie_explain_magic, magic_kind="line", magic_name="alpie_explain")
|
|
134
|
+
ipython.register_magic_function(alpie_doctor_magic, magic_kind="line", magic_name="alpie_doctor")
|
|
135
|
+
print("✨ AlpieCode IPython/Jupyter Extension Loaded! Try: %alpie <task> or %%alpie")
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def unload_ipython_extension(ipython):
|
|
139
|
+
"""Called when user runs `%unload_ext alpiecode`."""
|
|
140
|
+
pass
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.0"
|
|
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
|