alpiecode 0.9.7__tar.gz → 0.9.8__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 (36) hide show
  1. {alpiecode-0.9.7 → alpiecode-0.9.8}/PKG-INFO +1 -1
  2. {alpiecode-0.9.7 → alpiecode-0.9.8}/pyproject.toml +1 -1
  3. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/alpiecode.egg-info/PKG-INFO +1 -1
  4. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/compaction.py +5 -1
  5. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/config.py +4 -4
  6. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/memory.py +39 -13
  7. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/prompt.py +86 -9
  8. {alpiecode-0.9.7 → alpiecode-0.9.8}/README.md +0 -0
  9. {alpiecode-0.9.7 → alpiecode-0.9.8}/setup.cfg +0 -0
  10. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/alpiecode.egg-info/SOURCES.txt +0 -0
  11. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/alpiecode.egg-info/dependency_links.txt +0 -0
  12. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/alpiecode.egg-info/entry_points.txt +0 -0
  13. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/alpiecode.egg-info/requires.txt +0 -0
  14. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/alpiecode.egg-info/top_level.txt +0 -0
  15. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/__init__.py +0 -0
  16. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/agent.py +0 -0
  17. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/backends/__init__.py +0 -0
  18. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/backends/base.py +0 -0
  19. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/backends/local_backend.py +0 -0
  20. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/backends/openai_backend.py +0 -0
  21. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/cache.py +0 -0
  22. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/cli.py +0 -0
  23. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/client.py +0 -0
  24. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/context.py +0 -0
  25. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/executor.py +0 -0
  26. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/extension/alpiecode.vsix +0 -0
  27. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/github.py +0 -0
  28. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/guardian.py +0 -0
  29. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/local_model.py +0 -0
  30. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/media.py +0 -0
  31. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/orchestrator.py +0 -0
  32. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/server.py +0 -0
  33. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/session.py +0 -0
  34. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/tools.py +0 -0
  35. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/updater.py +0 -0
  36. {alpiecode-0.9.7 → alpiecode-0.9.8}/src/codeagent/vscode_installer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alpiecode
3
- Version: 0.9.7
3
+ Version: 0.9.8
4
4
  Summary: AlpieCode — Autonomous AI Coding Agent CLI powered by local 169Pi GGUF VLM
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 = "0.9.7"
7
+ version = "0.9.8"
8
8
  description = "AlpieCode — Autonomous AI Coding Agent CLI powered by local 169Pi GGUF VLM"
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: 0.9.7
3
+ Version: 0.9.8
4
4
  Summary: AlpieCode — Autonomous AI Coding Agent CLI powered by local 169Pi GGUF VLM
5
5
  Requires-Python: >=3.9
6
6
  Requires-Dist: huggingface_hub>=0.20.0
@@ -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 = 10
23
+ KEEP_RECENT_TURNS = 20
24
24
  # Approximate chars per token (rough heuristic)
25
25
  CHARS_PER_TOKEN = 4
26
26
 
@@ -52,6 +52,10 @@ def needs_compaction(messages: List[dict], max_tokens: int = MAX_CONTEXT_TOKENS)
52
52
 
53
53
  def _summarize_tool_result(tool_name: str, content: str) -> str:
54
54
  """Create a compact summary of a tool result."""
55
+ # NEVER truncate the execution plan — it's critical architectural context
56
+ if tool_name == "update_plan":
57
+ return content
58
+
55
59
  if len(content) <= 300:
56
60
  return content
57
61
 
@@ -26,9 +26,9 @@ DEFAULTS = {
26
26
  "model_repo": "169Pi/Alpie_learn_prototype_GGUF_NEW",
27
27
  "api_key": "not-needed",
28
28
  "hf_token": None,
29
- "max_turns": 30,
29
+ "max_turns": 50,
30
30
  "temperature": 0.2,
31
- "max_tokens": 16384,
31
+ "max_tokens": 32768,
32
32
  "enable_thinking": True,
33
33
  "n_ctx": 32768, # 32k context window (model supports up to 131k)
34
34
  "n_gpu_layers": None, # None = auto-detect GPU
@@ -88,9 +88,9 @@ class Config:
88
88
  model_repo: str = "169Pi/Alpie_learn_prototype_GGUF_NEW" # HuggingFace repo for offline GGUF
89
89
  api_key: str = "not-needed"
90
90
  hf_token: Optional[str] = None
91
- max_turns: int = 30
91
+ max_turns: int = 50
92
92
  temperature: float = 0.2
93
- max_tokens: int = 16384
93
+ max_tokens: int = 32768
94
94
  enable_thinking: bool = True
95
95
  n_ctx: int = 32768
96
96
  n_gpu_layers: Optional[int] = None
@@ -104,26 +104,52 @@ def extract_and_save_memories(workdir: Path, messages: list) -> None:
104
104
  After a session ends, extract key learnings from the conversation
105
105
  and save them as memories.
106
106
 
107
- This scans tool results for commonly useful information like:
107
+ Scans tool results for commonly useful information like:
108
+ - Successful build/test commands
108
109
  - Project structure (from list_files results)
109
- - Test commands (from bash results running tests)
110
- - Build commands (from bash results running builds)
110
+ - Completion summaries
111
111
  """
112
- for msg in messages:
112
+ saved_cmds = set() # Avoid duplicate command memories
113
+
114
+ for idx, msg in enumerate(messages):
113
115
  if not isinstance(msg, dict):
114
116
  continue
115
117
 
116
- # Look for tool results
118
+ # ── Save successful build/test commands ──
117
119
  if msg.get("role") == "tool":
118
120
  content = msg.get("content", "")
119
-
120
- # Detect test commands that succeeded
121
- if '"exit_code": 0' in content and any(kw in content.lower() for kw in
122
- ["pytest", "test", "passed", "ok", "success"]):
123
- # Find the corresponding tool call to get the command
124
- pass # Would need more context to extract command
125
-
126
- # Look for assistant messages with DONE
121
+ if '"exit_code": 0' in content:
122
+ # Walk backwards to find the bash tool_call that produced this result
123
+ tool_call_id = msg.get("tool_call_id", "")
124
+ for prev in reversed(messages[:idx]):
125
+ if prev.get("role") == "assistant" and prev.get("tool_calls"):
126
+ for tc in prev["tool_calls"]:
127
+ tc_dict = tc if isinstance(tc, dict) else {}
128
+ if tc_dict.get("id") == tool_call_id:
129
+ fn = tc_dict.get("function", {})
130
+ if fn.get("name") == "bash":
131
+ try:
132
+ args = fn.get("arguments", "{}")
133
+ if isinstance(args, str):
134
+ args = json.loads(args)
135
+ cmd = args.get("command", "")
136
+ except (json.JSONDecodeError, AttributeError):
137
+ cmd = ""
138
+ if cmd and cmd not in saved_cmds:
139
+ if any(kw in cmd for kw in ["pytest", "test", "unittest", "npm run test", "cargo test", "go test"]):
140
+ save_memory(workdir, f"Working test command: {cmd}", "command")
141
+ saved_cmds.add(cmd)
142
+ elif any(kw in cmd for kw in ["build", "compile", "g++", "gcc", "make", "cargo build", "npm run build"]):
143
+ save_memory(workdir, f"Working build command: {cmd}", "command")
144
+ saved_cmds.add(cmd)
145
+ break
146
+
147
+ # ── Save project structure from list_files / tree output ──
148
+ if "├" in content or "└" in content:
149
+ if len(content) < 2000:
150
+ save_memory(workdir, f"Project structure:\n{content[:500]}", "structure")
151
+
152
+ # ── Save completion summaries ──
127
153
  if msg.get("role") == "assistant" and msg.get("content"):
128
154
  content = msg["content"]
129
155
  if content.strip().startswith("DONE"):
@@ -135,6 +135,61 @@ Before the first edit, write down:
135
135
  ("the test suite passes with 0 failures", not "validate the output")
136
136
  Use the update_plan tool to record this.
137
137
 
138
+ ## Complex Project Workflow (Multi-File Projects)
139
+ When building a game, website, full-stack app, or any multi-file project:
140
+
141
+ ### Step 1: Architecture Plan (MANDATORY)
142
+ Before writing ANY code, use update_plan to document:
143
+ - ALL files that need to be created (with their purposes)
144
+ - Dependencies between files (what imports what, what links with what)
145
+ - The exact build/run command
146
+ - Data structures and state management approach
147
+ - How you will verify each component works
148
+
149
+ ### Step 2: Build Foundation First
150
+ - Create the project skeleton (directory structure, config files, Makefile)
151
+ - Write shared utilities / data structures / header files FIRST
152
+ - Then write the main entry point / core module
153
+ - Then write secondary modules and UI components
154
+ - For games: implement game state → physics → rendering → input → game loop (in that order)
155
+ - For websites: implement HTML structure → CSS styling → JS interactivity (in that order)
156
+ - For APIs: implement models → routes → middleware → tests (in that order)
157
+
158
+ ### Step 3: Incremental Verification
159
+ After writing EACH file:
160
+ - For C/C++: compile immediately with `g++ -Wall -Wextra -std=c++17 -c file.cpp` to catch errors early
161
+ - For Python: run `python -c "import module_name"` to verify syntax and imports
162
+ - For web: verify HTML is well-formed, CSS selectors exist, JS has no syntax errors
163
+ - Fix ALL errors in the current file before moving to the next file
164
+
165
+ ### Step 4: Integration Build & Test
166
+ After all files are written:
167
+ - Build/compile the complete project end-to-end
168
+ - Run the primary user flow / test suite
169
+ - Fix any linker errors, import errors, or integration issues
170
+ - For games: verify all game elements render (player, enemies, score, boundaries)
171
+
172
+ ### Step 5: Polish & Deliver
173
+ - Read back key functions to verify logical correctness
174
+ - Ensure ALL features mentioned in the user's request are implemented
175
+ - Tell the user exactly how to build and run the project
176
+
177
+ ## Writing Complete, Working Code — CRITICAL
178
+ When creating a file, you MUST:
179
+ 1. Think through the ENTIRE implementation BEFORE calling write_file
180
+ 2. Include ALL necessary imports / includes / headers at the top
181
+ 3. Implement EVERY function completely — no stubs, no TODOs, no "implement later"
182
+ 4. Handle edge cases and error conditions properly
183
+ 5. For games: implement ALL game mechanics — physics, collision, scoring, rendering, \
184
+ input handling, game over, restart. A game with missing mechanics is broken.
185
+ 6. For websites: include ALL routes, complete HTML pages, CSS styling, JS interactivity, \
186
+ and error pages. A website with missing pages is broken.
187
+ 7. For APIs: implement ALL endpoints with proper request validation, error handling, \
188
+ and response formatting. An API with missing endpoints is broken.
189
+
190
+ NEVER write partial code and say "I'll add the rest later" — write it ALL in one go. \
191
+ The user expects a COMPLETE, WORKING program on the first delivery.
192
+
138
193
  ## Working with files
139
194
  - Always read_file before editing — never edit a file you haven't read
140
195
  - Use edit_file for targeted changes (preferred), write_file only for new files
@@ -328,17 +383,39 @@ Rules:
328
383
 
329
384
 
330
385
  def is_simple_task(task: str) -> bool:
331
- """Detect simple tasks that don't benefit from deep reasoning traces."""
386
+ """Detect simple tasks that don't benefit from deep reasoning traces.
387
+
388
+ IMPORTANT: Complex project requests (games, websites, APIs, full-stack apps)
389
+ must ALWAYS get thinking mode enabled, regardless of prompt length.
390
+ """
332
391
  task_lower = task.lower().strip()
333
- if len(task_lower) < 80:
334
- return True
335
- simple_patterns = [
336
- "fix typo", "add comment", "rename", "format", "add docstring",
337
- "remove unused", "add import", "update version", "change color",
338
- "fix indent", "add logging", "hello world", "fibonacci",
339
- "print ", "add a test", "calculator",
392
+
393
+ # Complex task keywords — ALWAYS need thinking regardless of length
394
+ complex_patterns = [
395
+ "build", "create", "implement", "develop", "design", "make",
396
+ "game", "website", "webapp", "web app", "full stack", "fullstack",
397
+ "api", "server", "database", "authentication", "deploy",
398
+ "refactor", "migrate", "architecture", "system",
399
+ "flappy", "snake", "tetris", "chess", "pong", "sudoku",
400
+ "todo app", "portfolio", "dashboard", "e-commerce", "ecommerce",
401
+ "crud", "rest api", "graphql", "microservice",
402
+ "project", "application", "framework", "library", "package",
403
+ "html", "css", "react", "flask", "django", "fastapi", "express",
404
+ "multi-file", "multifile", "full", "complete",
340
405
  ]
341
- return any(pat in task_lower for pat in simple_patterns)
406
+ if any(pat in task_lower for pat in complex_patterns):
407
+ return False # Complex task — needs deep thinking
408
+
409
+ # Only treat as simple if short AND matches trivial edit patterns
410
+ if len(task_lower) < 50:
411
+ simple_patterns = [
412
+ "fix typo", "add comment", "rename", "format", "add docstring",
413
+ "remove unused", "add import", "update version", "change color",
414
+ "fix indent", "add logging", "hello world",
415
+ ]
416
+ return any(pat in task_lower for pat in simple_patterns)
417
+
418
+ return False
342
419
 
343
420
 
344
421
  class PromptBuilder:
File without changes
File without changes