nimcode 0.1.20__tar.gz → 0.1.22__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 (47) hide show
  1. {nimcode-0.1.20 → nimcode-0.1.22}/PKG-INFO +1 -1
  2. {nimcode-0.1.20 → nimcode-0.1.22}/setup.py +1 -1
  3. {nimcode-0.1.20 → nimcode-0.1.22}/src/nimcode/agent.py +28 -8
  4. {nimcode-0.1.20 → nimcode-0.1.22}/src/nimcode/repl.py +12 -1
  5. {nimcode-0.1.20 → nimcode-0.1.22}/src/nimcode.egg-info/PKG-INFO +1 -1
  6. {nimcode-0.1.20 → nimcode-0.1.22}/README.md +0 -0
  7. {nimcode-0.1.20 → nimcode-0.1.22}/setup.cfg +0 -0
  8. {nimcode-0.1.20 → nimcode-0.1.22}/src/nimcode/__init__.py +0 -0
  9. {nimcode-0.1.20 → nimcode-0.1.22}/src/nimcode/analytics.py +0 -0
  10. {nimcode-0.1.20 → nimcode-0.1.22}/src/nimcode/cli.py +0 -0
  11. {nimcode-0.1.20 → nimcode-0.1.22}/src/nimcode/config.py +0 -0
  12. {nimcode-0.1.20 → nimcode-0.1.22}/src/nimcode/lenient_parser.py +0 -0
  13. {nimcode-0.1.20 → nimcode-0.1.22}/src/nimcode/mcp_client.py +0 -0
  14. {nimcode-0.1.20 → nimcode-0.1.22}/src/nimcode/memory.py +0 -0
  15. {nimcode-0.1.20 → nimcode-0.1.22}/src/nimcode/nim_client.py +0 -0
  16. {nimcode-0.1.20 → nimcode-0.1.22}/src/nimcode/permissions.py +0 -0
  17. {nimcode-0.1.20 → nimcode-0.1.22}/src/nimcode/plugin_manager.py +0 -0
  18. {nimcode-0.1.20 → nimcode-0.1.22}/src/nimcode/repo_map.py +0 -0
  19. {nimcode-0.1.20 → nimcode-0.1.22}/src/nimcode/secret_scanner.py +0 -0
  20. {nimcode-0.1.20 → nimcode-0.1.22}/src/nimcode/stdio_server.py +0 -0
  21. {nimcode-0.1.20 → nimcode-0.1.22}/src/nimcode/swarm.py +0 -0
  22. {nimcode-0.1.20 → nimcode-0.1.22}/src/nimcode/tools.py +0 -0
  23. {nimcode-0.1.20 → nimcode-0.1.22}/src/nimcode/updater.py +0 -0
  24. {nimcode-0.1.20 → nimcode-0.1.22}/src/nimcode/watcher.py +0 -0
  25. {nimcode-0.1.20 → nimcode-0.1.22}/src/nimcode.egg-info/SOURCES.txt +0 -0
  26. {nimcode-0.1.20 → nimcode-0.1.22}/src/nimcode.egg-info/dependency_links.txt +0 -0
  27. {nimcode-0.1.20 → nimcode-0.1.22}/src/nimcode.egg-info/entry_points.txt +0 -0
  28. {nimcode-0.1.20 → nimcode-0.1.22}/src/nimcode.egg-info/requires.txt +0 -0
  29. {nimcode-0.1.20 → nimcode-0.1.22}/src/nimcode.egg-info/top_level.txt +0 -0
  30. {nimcode-0.1.20 → nimcode-0.1.22}/tests/test_agent.py +0 -0
  31. {nimcode-0.1.20 → nimcode-0.1.22}/tests/test_analytics.py +0 -0
  32. {nimcode-0.1.20 → nimcode-0.1.22}/tests/test_cli.py +0 -0
  33. {nimcode-0.1.20 → nimcode-0.1.22}/tests/test_config.py +0 -0
  34. {nimcode-0.1.20 → nimcode-0.1.22}/tests/test_lenient_parser.py +0 -0
  35. {nimcode-0.1.20 → nimcode-0.1.22}/tests/test_mcp_client.py +0 -0
  36. {nimcode-0.1.20 → nimcode-0.1.22}/tests/test_memory.py +0 -0
  37. {nimcode-0.1.20 → nimcode-0.1.22}/tests/test_nim_client.py +0 -0
  38. {nimcode-0.1.20 → nimcode-0.1.22}/tests/test_nimcoderules.py +0 -0
  39. {nimcode-0.1.20 → nimcode-0.1.22}/tests/test_permissions.py +0 -0
  40. {nimcode-0.1.20 → nimcode-0.1.22}/tests/test_plugin_manager.py +0 -0
  41. {nimcode-0.1.20 → nimcode-0.1.22}/tests/test_repl.py +0 -0
  42. {nimcode-0.1.20 → nimcode-0.1.22}/tests/test_repl_extra.py +0 -0
  43. {nimcode-0.1.20 → nimcode-0.1.22}/tests/test_repl_trust.py +0 -0
  44. {nimcode-0.1.20 → nimcode-0.1.22}/tests/test_repo_map.py +0 -0
  45. {nimcode-0.1.20 → nimcode-0.1.22}/tests/test_secret_scanner.py +0 -0
  46. {nimcode-0.1.20 → nimcode-0.1.22}/tests/test_tools.py +0 -0
  47. {nimcode-0.1.20 → nimcode-0.1.22}/tests/test_updater.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nimcode
3
- Version: 0.1.20
3
+ Version: 0.1.22
4
4
  Summary: A standalone, robust coding agent for NVIDIA NIM models.
5
5
  Author: Autonomous Agent
6
6
  Requires-Dist: httpx>=0.27.0
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="nimcode",
5
- version="0.1.20",
5
+ version="0.1.22",
6
6
  packages=find_packages(where="src"),
7
7
  package_dir={"": "src"},
8
8
  install_requires=[
@@ -65,14 +65,7 @@ class Agent:
65
65
  # Base system prompt
66
66
  final_prompt = SYSTEM_PROMPT + self.mcp.get_system_prompt_additions()
67
67
 
68
- # Inject Repo Map
69
- try:
70
- from .repo_map import RepoMapper
71
- mapper = RepoMapper(os.getcwd())
72
- repo_map = mapper.generate_map()
73
- final_prompt += f"\n\n--- REPOSITORY MAP ---\n{repo_map}\n----------------------\n"
74
- except Exception as e:
75
- logger.error(f"Failed to generate repo map: {e}")
68
+ # We inject the Repo Map dynamically during the first run to avoid blocking startup.
76
69
 
77
70
  # Load .nimcoderules if present
78
71
  rules_path = os.path.join(os.getcwd(), ".nimcoderules")
@@ -237,6 +230,16 @@ class Agent:
237
230
 
238
231
  async def run_headless(self, query: str, max_turns: int = 5) -> str:
239
232
  """Runs the agent without terminal streaming, useful for background tasks."""
233
+ if len(self.messages) == 1:
234
+ try:
235
+ from .repo_map import RepoMapper
236
+ import asyncio
237
+ mapper = RepoMapper(os.getcwd())
238
+ repo_map = await asyncio.to_thread(mapper.generate_map)
239
+ self.messages[0]["content"] += f"\n\n--- REPOSITORY MAP ---\n{repo_map}\n----------------------\n"
240
+ except Exception as e:
241
+ logger.error(f"Failed to generate repo map: {e}")
242
+
240
243
  self.messages.append({"role": "user", "content": query})
241
244
  turn = 0
242
245
  from .tools import ToolRegistry
@@ -282,9 +285,14 @@ class Agent:
282
285
 
283
286
  messages = [{"role": "system", "content": "You are a summarization AI."}, {"role": "user", "content": summary_prompt}]
284
287
  try:
288
+ # Use a robust default model for distillation to prevent 404 errors with unsupported endpoints
289
+ original_model = self.client.model
290
+ self.client.model = "meta/llama-3.1-8b-instruct"
285
291
  summary = await self.client.chat_one_shot(messages)
292
+ self.client.model = original_model
286
293
  system_msg["content"] += f"\n\n[PREVIOUS MEMORY SUMMARY]\n{summary}"
287
294
  except Exception as e:
295
+ self.client.model = original_model
288
296
  logger.error(f"Distillation failed: {e}")
289
297
 
290
298
  return [system_msg] + recent_msgs
@@ -294,6 +302,18 @@ class Agent:
294
302
  if hasattr(self.mcp, "connect_all"):
295
303
  await self.mcp.connect_all()
296
304
 
305
+ if len(self.messages) == 1:
306
+ try:
307
+ from rich.console import Console
308
+ Console().print("[dim italic]Indexing repository...[/dim italic]")
309
+ from .repo_map import RepoMapper
310
+ import asyncio
311
+ mapper = RepoMapper(os.getcwd())
312
+ repo_map = await asyncio.to_thread(mapper.generate_map)
313
+ self.messages[0]["content"] += f"\n\n--- REPOSITORY MAP ---\n{repo_map}\n----------------------\n"
314
+ except Exception as e:
315
+ logger.error(f"Failed to generate repo map: {e}")
316
+
297
317
  if initial_prompt:
298
318
  self.messages.append({"role": "user", "content": initial_prompt})
299
319
 
@@ -347,6 +347,7 @@ class NimcodeREPL:
347
347
  table.add_column("Description", style="white")
348
348
 
349
349
  table.add_row("/help", "Show this help menu")
350
+ table.add_row("/login", "Login with your NVIDIA NIM API Key")
350
351
  table.add_row("/plan", "Enter planning mode (safe mode)")
351
352
  table.add_row("/code", "Enter coding mode (all tools enabled)")
352
353
  table.add_row("/trust", "Enter trust mode (runs all tools without permission)")
@@ -430,6 +431,16 @@ class NimcodeREPL:
430
431
  self.permission_engine.mode = PermissionMode.DEFAULT
431
432
  self.messages.append({"role": "system", "content": "You are now in planning mode. Use Read tools to explore. Then use the Write tool to write a markdown plan file inside the '.nimcode/plans/' directory (e.g., '.nimcode/plans/feature_x_plan.md'). Do NOT use Bash or Edit tools."})
432
433
  continue
434
+ elif user_input.strip() == "/login":
435
+ from .cli import run_login
436
+ run_login()
437
+ # Re-initialize client if api key changed
438
+ from .config import load_settings
439
+ settings = load_settings()
440
+ if settings.get("api_key"):
441
+ self.agent.client.api_key = settings.get("api_key")
442
+ self.agent.client.headers["Authorization"] = f"Bearer {settings.get('api_key')}"
443
+ continue
433
444
  elif user_input.strip().startswith("/teleport"):
434
445
  parts = user_input.strip().split(" ", 1)
435
446
  if len(parts) > 1:
@@ -1132,7 +1143,7 @@ class NimcodeREPL:
1132
1143
  continue
1133
1144
  elif user_input.strip().startswith("/"):
1134
1145
  import difflib
1135
- valid_commands = ["/help", "/plan", "/code", "/trust", "/untrust", "/models", "/theme", "/clear", "/compact", "/commit", "/fix", "/exit", "/quit", "/config", "/alias", "/add", "/rewind", "/fork", "/testgen", "/vision", "/voice", "/index", "/research", "/mcp install", "/swarm", "/tdd", "/learn", "/cost", "/effort", "/thinking", "/grill-me", "/update", "/undo", "/teleport", "/buddy", "/ultraplan", "/bughunter", "/security-review", "/doctor", "/permissions", "/graph", "/guardian", "/thinkback", "/autofix-pr", "/terraform-god", "/sql-tune", "/decompile", "/sandbox"]
1146
+ valid_commands = ["/help", "/login", "/plan", "/code", "/trust", "/untrust", "/models", "/theme", "/clear", "/compact", "/commit", "/fix", "/exit", "/quit", "/config", "/alias", "/add", "/rewind", "/fork", "/testgen", "/vision", "/voice", "/index", "/research", "/mcp install", "/swarm", "/tdd", "/learn", "/cost", "/effort", "/thinking", "/grill-me", "/update", "/undo", "/teleport", "/buddy", "/ultraplan", "/bughunter", "/security-review", "/doctor", "/permissions", "/graph", "/guardian", "/thinkback", "/autofix-pr", "/terraform-god", "/sql-tune", "/decompile", "/sandbox"]
1136
1147
  valid_commands.extend([f"/{cmd}" for cmd in self.plugin_manager.get_command_names()])
1137
1148
 
1138
1149
  cmd_parts = user_input.strip().split(" ", 1)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nimcode
3
- Version: 0.1.20
3
+ Version: 0.1.22
4
4
  Summary: A standalone, robust coding agent for NVIDIA NIM models.
5
5
  Author: Autonomous Agent
6
6
  Requires-Dist: httpx>=0.27.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