alpiecode 5.0.0__tar.gz → 6.0.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-5.0.0 → alpiecode-6.0.0}/PKG-INFO +1 -1
- {alpiecode-5.0.0 → alpiecode-6.0.0}/pyproject.toml +1 -1
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/alpiecode.egg-info/PKG-INFO +1 -1
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/alpiecode.egg-info/SOURCES.txt +1 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/agent.py +40 -8
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/cli.py +6 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/compaction.py +1 -1
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/config.py +1 -1
- alpiecode-6.0.0/src/codeagent/discovery.py +575 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/guardian.py +9 -4
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/orchestrator.py +43 -14
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/prompt.py +153 -4
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/tools.py +39 -9
- {alpiecode-5.0.0 → alpiecode-6.0.0}/README.md +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/setup.cfg +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/alpiecode/__init__.py +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/alpiecode.egg-info/dependency_links.txt +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/alpiecode.egg-info/entry_points.txt +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/alpiecode.egg-info/requires.txt +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/alpiecode.egg-info/top_level.txt +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/__init__.py +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/backends/__init__.py +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/backends/base.py +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/backends/local_backend.py +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/backends/openai_backend.py +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/cache.py +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/client.py +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/context.py +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/doctor.py +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/executor.py +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/extension/alpiecode.vsix +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/github.py +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/ipython_ext.py +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/local_model.py +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/media.py +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/memory.py +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/server.py +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/session.py +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/updater.py +0 -0
- {alpiecode-5.0.0 → alpiecode-6.0.0}/src/codeagent/vscode_installer.py +0 -0
|
@@ -37,6 +37,7 @@ _build_system_prompt = lambda workdir, is_offline=False: PromptBuilder().build_s
|
|
|
37
37
|
try:
|
|
38
38
|
from rich.console import Console
|
|
39
39
|
from rich.markdown import Markdown
|
|
40
|
+
from rich.markup import escape
|
|
40
41
|
from rich.panel import Panel
|
|
41
42
|
from rich.rule import Rule
|
|
42
43
|
from rich.text import Text
|
|
@@ -46,6 +47,9 @@ try:
|
|
|
46
47
|
except ImportError:
|
|
47
48
|
HAS_RICH = False
|
|
48
49
|
|
|
50
|
+
def escape(text: str) -> str:
|
|
51
|
+
return text
|
|
52
|
+
|
|
49
53
|
class _FallbackConsole:
|
|
50
54
|
def print(self, *args, **kwargs):
|
|
51
55
|
kwargs.pop("style", None)
|
|
@@ -78,7 +82,7 @@ def _print_tool_call(turn: int, name: str, args: dict):
|
|
|
78
82
|
if HAS_RICH:
|
|
79
83
|
args_str = json.dumps(display_args, indent=2)
|
|
80
84
|
console.print(f"\n🔧 [bold cyan]Tool:[/bold cyan] [bold]{name}[/bold]", highlight=False)
|
|
81
|
-
console.print(f" {args_str}", style="cyan"
|
|
85
|
+
console.print(Text(f" {args_str}", style="cyan"))
|
|
82
86
|
else:
|
|
83
87
|
console.print(f"\n🔧 Tool: {name}({display_args})")
|
|
84
88
|
|
|
@@ -86,7 +90,7 @@ def _print_tool_call(turn: int, name: str, args: dict):
|
|
|
86
90
|
def _print_tool_result(result: str):
|
|
87
91
|
truncated = result[:1500] + ("..." if len(result) > 1500 else "")
|
|
88
92
|
if HAS_RICH:
|
|
89
|
-
console.print(f" → {truncated}", style="green"
|
|
93
|
+
console.print(Text(f" → {truncated}", style="green"))
|
|
90
94
|
else:
|
|
91
95
|
console.print(f" → {truncated}")
|
|
92
96
|
|
|
@@ -97,7 +101,7 @@ def _print_assistant_message(content: str):
|
|
|
97
101
|
md = Markdown(content)
|
|
98
102
|
console.print(Panel(md, title="🤖 Assistant", border_style="green", padding=(0, 1)))
|
|
99
103
|
except Exception:
|
|
100
|
-
console.print(Panel(content, title="🤖 Assistant", border_style="green", padding=(0, 1)))
|
|
104
|
+
console.print(Panel(Text(content), title="🤖 Assistant", border_style="green", padding=(0, 1)))
|
|
101
105
|
else:
|
|
102
106
|
console.print(f"\n🤖 Assistant: {content}")
|
|
103
107
|
|
|
@@ -156,6 +160,7 @@ def run_agent(
|
|
|
156
160
|
github_repo: str = None,
|
|
157
161
|
server_url: str = None,
|
|
158
162
|
complexity: str = None,
|
|
163
|
+
debug: bool = False,
|
|
159
164
|
) -> list:
|
|
160
165
|
"""Run non-interactive agent task with Rich presentation."""
|
|
161
166
|
workdir = workdir.resolve()
|
|
@@ -200,12 +205,31 @@ def run_agent(
|
|
|
200
205
|
_checkpoint(workdir, "checkpoint: start")
|
|
201
206
|
|
|
202
207
|
current_turn = 0
|
|
208
|
+
last_discovery = {}
|
|
209
|
+
|
|
203
210
|
for event in event_stream:
|
|
204
|
-
if event.type == "
|
|
211
|
+
if event.type == "discovery" and verbose:
|
|
212
|
+
last_discovery = event.data
|
|
213
|
+
if debug and HAS_RICH:
|
|
214
|
+
console.print(Panel(
|
|
215
|
+
f"[bold cyan]🔍 Autonomous Discovery Engine[/bold cyan]\n"
|
|
216
|
+
f"• Intent: [bold]{event.data.get('intent')}[/bold]\n"
|
|
217
|
+
f"• Complexity: [bold]{event.data.get('complexity')}[/bold]\n"
|
|
218
|
+
f"• OS: {event.data.get('os')} | Shell: {event.data.get('shell')}\n"
|
|
219
|
+
f"• Project: {event.data.get('project_type')} ({event.data.get('file_count', 0)} files)\n"
|
|
220
|
+
f"• Frameworks: {', '.join(event.data.get('frameworks', [])) or 'None'}",
|
|
221
|
+
title="Pre-Execution Intelligence",
|
|
222
|
+
border_style="dim cyan",
|
|
223
|
+
padding=(0, 1)
|
|
224
|
+
))
|
|
225
|
+
elif debug:
|
|
226
|
+
print(f"[Discovery] intent={event.data.get('intent')}, complexity={event.data.get('complexity')}, shell={event.data.get('shell')}, project={event.data.get('project_type')}")
|
|
227
|
+
|
|
228
|
+
elif event.type == "start" and verbose:
|
|
205
229
|
data = event.data
|
|
206
230
|
if HAS_RICH:
|
|
207
231
|
console.rule("[bold blue]Agent Started[/bold blue]")
|
|
208
|
-
console.print(f"📋 Task: {task.splitlines()[0]}", style="bold")
|
|
232
|
+
console.print(Text(f"📋 Task: {task.splitlines()[0]}", style="bold"))
|
|
209
233
|
if github_repo:
|
|
210
234
|
console.print(f"🐙 GitHub Repo: {github_repo}", style="cyan")
|
|
211
235
|
if image_path:
|
|
@@ -223,6 +247,10 @@ def run_agent(
|
|
|
223
247
|
comp_label = {"qa": "Q&A (instant)", "low": "Low (fast)", "medium": "Medium (balanced)", "high": "High (thorough)"}.get(comp, comp)
|
|
224
248
|
comp_color = {"qa": "cyan", "low": "green", "medium": "yellow", "high": "red"}.get(comp, "white")
|
|
225
249
|
console.print(f"⚡ Complexity: [bold {comp_color}]{comp_label}[/bold {comp_color}]", style="dim")
|
|
250
|
+
if last_discovery:
|
|
251
|
+
intent_str = last_discovery.get('intent', 'create').title()
|
|
252
|
+
proj_str = last_discovery.get('project_type', 'empty')
|
|
253
|
+
console.print(f"🔍 Discovery: {intent_str} on {proj_str} project ({last_discovery.get('shell', 'bash')})", style="dim")
|
|
226
254
|
if cfg.enable_thinking:
|
|
227
255
|
console.print(f"🧠 Reasoning: [bold green]ON[/bold green]", style="dim")
|
|
228
256
|
else:
|
|
@@ -264,8 +292,9 @@ def run_agent(
|
|
|
264
292
|
_checkpoint(workdir, "checkpoint: response")
|
|
265
293
|
|
|
266
294
|
elif event.type == "fallback" and verbose:
|
|
295
|
+
err_str = escape(str(event.data.get('error', '')))
|
|
267
296
|
if HAS_RICH:
|
|
268
|
-
console.print(f"\n⚠️ [bold yellow]Online Server Error / Timeout[/bold yellow] ({
|
|
297
|
+
console.print(f"\n⚠️ [bold yellow]Online Server Error / Timeout[/bold yellow] ({err_str})", style="yellow")
|
|
269
298
|
console.print("🔄 [bold cyan]Auto-falling back to local GGUF engine...[/bold cyan]", style="cyan")
|
|
270
299
|
else:
|
|
271
300
|
print(f"\n⚠️ Online Server Error: {event.data['error']}")
|
|
@@ -273,7 +302,7 @@ def run_agent(
|
|
|
273
302
|
|
|
274
303
|
elif event.type == "error" and verbose:
|
|
275
304
|
if HAS_RICH:
|
|
276
|
-
console.print(f"\n❌
|
|
305
|
+
console.print(Text(f"\n❌ Model Error\n Error: {event.data['error']}\n", style="bold red"))
|
|
277
306
|
else:
|
|
278
307
|
print(f"\n❌ Model Error: {event.data['error']}")
|
|
279
308
|
|
|
@@ -361,7 +390,10 @@ def run_chat(workdir: Path, cfg: Config, verbose: bool = True) -> None:
|
|
|
361
390
|
_checkpoint(workdir, "checkpoint: done")
|
|
362
391
|
|
|
363
392
|
elif event.type == "error":
|
|
364
|
-
|
|
393
|
+
if HAS_RICH:
|
|
394
|
+
console.print(Text(f"❌ Model error: {event.data['error']}", style="bold red"))
|
|
395
|
+
else:
|
|
396
|
+
print(f"❌ Model error: {event.data['error']}")
|
|
365
397
|
|
|
366
398
|
elif event.type == "done":
|
|
367
399
|
break
|
|
@@ -81,6 +81,7 @@ def main():
|
|
|
81
81
|
common.add_argument("--no-thinking", "--non-thinking", dest="no_thinking", action="store_true", help="Disable VLM reasoning mode")
|
|
82
82
|
common.add_argument("--no-update", action="store_true", help="Skip automatic update check")
|
|
83
83
|
common.add_argument("--quiet", action="store_true", help="Suppress per-turn logging")
|
|
84
|
+
common.add_argument("--debug", action="store_true", help="Show autonomous discovery and debug diagnostics")
|
|
84
85
|
|
|
85
86
|
parser = argparse.ArgumentParser(
|
|
86
87
|
prog="alpiecode",
|
|
@@ -161,6 +162,7 @@ def main():
|
|
|
161
162
|
if args.command == "run":
|
|
162
163
|
if args.max_turns:
|
|
163
164
|
cfg.max_turns = args.max_turns
|
|
165
|
+
cfg._explicit_max_turns = True
|
|
164
166
|
_show_banner()
|
|
165
167
|
from .agent import run_agent
|
|
166
168
|
run_agent(
|
|
@@ -170,11 +172,13 @@ def main():
|
|
|
170
172
|
video_path=getattr(args, "video", None),
|
|
171
173
|
url=getattr(args, "url", None),
|
|
172
174
|
github_repo=getattr(args, "github", None),
|
|
175
|
+
debug=getattr(args, "debug", False),
|
|
173
176
|
)
|
|
174
177
|
|
|
175
178
|
elif args.command == "chat":
|
|
176
179
|
if args.max_turns:
|
|
177
180
|
cfg.max_turns = args.max_turns
|
|
181
|
+
cfg._explicit_max_turns = True
|
|
178
182
|
_show_banner()
|
|
179
183
|
from .agent import run_chat
|
|
180
184
|
run_chat(Path(args.workdir), cfg, verbose=not args.quiet)
|
|
@@ -196,6 +200,7 @@ def main():
|
|
|
196
200
|
video_path=getattr(args, "video", None),
|
|
197
201
|
url=getattr(args, "url", None),
|
|
198
202
|
github_repo=getattr(args, "github", None),
|
|
203
|
+
debug=getattr(args, "debug", False),
|
|
199
204
|
)
|
|
200
205
|
|
|
201
206
|
elif args.command == "doctor":
|
|
@@ -231,6 +236,7 @@ def main():
|
|
|
231
236
|
video_path=getattr(args, "video", None),
|
|
232
237
|
url=getattr(args, "url", None),
|
|
233
238
|
github_repo=getattr(args, "github", None),
|
|
239
|
+
debug=getattr(args, "debug", False),
|
|
234
240
|
)
|
|
235
241
|
|
|
236
242
|
elif args.command == "diff":
|
|
@@ -20,7 +20,7 @@ MAX_CONTEXT_TOKENS = 262_144
|
|
|
20
20
|
# Start compacting when we hit this percentage of the context window
|
|
21
21
|
COMPACT_THRESHOLD = 0.70
|
|
22
22
|
# Number of recent turns to always keep intact
|
|
23
|
-
KEEP_RECENT_TURNS =
|
|
23
|
+
KEEP_RECENT_TURNS = 12
|
|
24
24
|
# Approximate chars per token (rough heuristic)
|
|
25
25
|
CHARS_PER_TOKEN = 4
|
|
26
26
|
|
|
@@ -18,7 +18,7 @@ CONFIG_DIR = Path.home() / ".alpiecode"
|
|
|
18
18
|
CONFIG_PATH = CONFIG_DIR / "config.json"
|
|
19
19
|
|
|
20
20
|
# Config version — bump this when defaults change to trigger auto-migration
|
|
21
|
-
CONFIG_VERSION =
|
|
21
|
+
CONFIG_VERSION = 7 # v7: autonomous discovery engine (zero-flag flow)
|
|
22
22
|
|
|
23
23
|
DEFAULTS = {
|
|
24
24
|
"base_url": "http://20.245.200.125:8000/v1", # Primary endpoint
|