tzamuncode 0.1.2__tar.gz → 0.1.4__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 (34) hide show
  1. {tzamuncode-0.1.2/tzamuncode.egg-info → tzamuncode-0.1.4}/PKG-INFO +1 -1
  2. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/pyproject.toml +1 -1
  3. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode/cli/main.py +96 -0
  4. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode/models/ollama.py +5 -1
  5. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode/models/vllm_client.py +5 -1
  6. {tzamuncode-0.1.2 → tzamuncode-0.1.4/tzamuncode.egg-info}/PKG-INFO +1 -1
  7. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/LICENSE +0 -0
  8. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/README.md +0 -0
  9. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/setup.cfg +0 -0
  10. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode/__init__.py +0 -0
  11. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode/agents/__init__.py +0 -0
  12. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode/agents/coder.py +0 -0
  13. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode/agents/tools.py +0 -0
  14. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode/auth/__init__.py +0 -0
  15. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode/auth/auth_manager.py +0 -0
  16. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode/cli/__init__.py +0 -0
  17. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode/cli/agentic_commands.py +0 -0
  18. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode/cli/auth_commands.py +0 -0
  19. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode/cli/commands.py +0 -0
  20. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode/cli/enhanced_chat.py +0 -0
  21. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode/cli/interactive_chat.py +0 -0
  22. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode/cli/realtime_chat.py +0 -0
  23. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode/cli/realtime_chat_methods.py +0 -0
  24. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode/cli/tui_chat.py +0 -0
  25. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode/config/__init__.py +0 -0
  26. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode/models/__init__.py +0 -0
  27. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode/utils/__init__.py +0 -0
  28. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode/utils/file_ops.py +0 -0
  29. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode/utils/project_scanner.py +0 -0
  30. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode.egg-info/SOURCES.txt +0 -0
  31. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode.egg-info/dependency_links.txt +0 -0
  32. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode.egg-info/entry_points.txt +0 -0
  33. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode.egg-info/requires.txt +0 -0
  34. {tzamuncode-0.1.2 → tzamuncode-0.1.4}/tzamuncode.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tzamuncode
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: TzamunCode - AI Coding Assistant powered by local models
5
5
  Author-email: "Tzamun Arabia IT Co." <info@tzamun.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "tzamuncode"
7
- version = "0.1.2"
7
+ version = "0.1.4"
8
8
  description = "TzamunCode - AI Coding Assistant powered by local models"
9
9
  authors = [
10
10
  {name = "Tzamun Arabia IT Co.", email = "info@tzamun.com"}
@@ -78,6 +78,102 @@ def main(
78
78
 
79
79
  chat.run()
80
80
 
81
+ @app.command()
82
+ def agent(
83
+ backend: str = typer.Option(
84
+ "vllm",
85
+ "--backend",
86
+ "-b",
87
+ help="AI backend to use (vllm or ollama)"
88
+ ),
89
+ model: str = typer.Option(
90
+ "qwen2.5-7b-instruct",
91
+ "--model",
92
+ "-m",
93
+ help="Model name to use"
94
+ ),
95
+ apply: bool = typer.Option(
96
+ False,
97
+ "--apply",
98
+ help="Auto-apply changes without confirmation"
99
+ )
100
+ ):
101
+ """
102
+ Agentic execution mode for Paperclip integration.
103
+
104
+ Reads prompt from stdin, calls AI backend, outputs response to stdout.
105
+
106
+ Examples:
107
+ echo "Write a Python function" | tzamuncode agent --backend vllm --model qwen2.5-7b-instruct
108
+ echo "Fix the bug" | tzamuncode agent --apply --backend ollama --model qwen2.5:32b
109
+ """
110
+ import requests
111
+ import os
112
+
113
+ # Read prompt from stdin
114
+ prompt = sys.stdin.read().strip()
115
+
116
+ if not prompt:
117
+ sys.stderr.write("Error: No prompt provided via stdin\n")
118
+ raise typer.Exit(code=1)
119
+
120
+ # Get backend URL from environment or use defaults
121
+ if backend == "vllm":
122
+ base_url = os.getenv('VLLM_BASE_URL', 'http://localhost:8000')
123
+ # Call vLLM (OpenAI-compatible API)
124
+ try:
125
+ response = requests.post(
126
+ f"{base_url}/v1/chat/completions",
127
+ json={
128
+ "model": model,
129
+ "messages": [{"role": "user", "content": prompt}],
130
+ "temperature": 0.7,
131
+ "max_tokens": 2000,
132
+ "stream": False
133
+ },
134
+ timeout=300
135
+ )
136
+ response.raise_for_status()
137
+ result = response.json()
138
+ ai_response = result["choices"][0]["message"]["content"]
139
+ except Exception as e:
140
+ sys.stderr.write(f"Error calling vLLM: {e}\n")
141
+ raise typer.Exit(code=1)
142
+
143
+ elif backend == "ollama":
144
+ base_url = os.getenv('OLLAMA_BASE_URL', 'http://localhost:11434')
145
+ # Call Ollama API
146
+ try:
147
+ response = requests.post(
148
+ f"{base_url}/api/generate",
149
+ json={
150
+ "model": model,
151
+ "prompt": prompt,
152
+ "stream": False,
153
+ "options": {
154
+ "temperature": 0.7,
155
+ "num_predict": 2000
156
+ }
157
+ },
158
+ timeout=300
159
+ )
160
+ response.raise_for_status()
161
+ result = response.json()
162
+ ai_response = result["response"]
163
+ except Exception as e:
164
+ sys.stderr.write(f"Error calling Ollama: {e}\n")
165
+ raise typer.Exit(code=1)
166
+
167
+ else:
168
+ sys.stderr.write(f"Error: Unknown backend '{backend}'. Use 'vllm' or 'ollama'\n")
169
+ raise typer.Exit(code=1)
170
+
171
+ # Output response to stdout (Paperclip captures this)
172
+ print(ai_response, flush=True)
173
+
174
+ # Exit successfully
175
+ raise typer.Exit(code=0)
176
+
81
177
  @app.command()
82
178
  def chat(
83
179
  model: str = typer.Option(
@@ -3,6 +3,7 @@ Ollama client for TzamunCode
3
3
  """
4
4
 
5
5
  import requests
6
+ import os
6
7
  from typing import List, Dict, Generator, Optional
7
8
  import json
8
9
 
@@ -11,10 +12,13 @@ class OllamaClient:
11
12
 
12
13
  def __init__(
13
14
  self,
14
- base_url: str = "http://localhost:11434",
15
+ base_url: str = None,
15
16
  model: str = "qwen2.5:32b",
16
17
  timeout: int = 120
17
18
  ):
19
+ # Use environment variable if available, otherwise default to localhost
20
+ if base_url is None:
21
+ base_url = os.getenv('OLLAMA_BASE_URL', 'http://localhost:11434')
18
22
  self.base_url = base_url.rstrip('/')
19
23
  self.model = model
20
24
  self.timeout = timeout
@@ -4,13 +4,17 @@ Provides faster inference using vLLM OpenAI-compatible API
4
4
  """
5
5
 
6
6
  import requests
7
+ import os
7
8
  from typing import Iterator, List, Dict, Optional
8
9
 
9
10
 
10
11
  class VLLMClient:
11
12
  """Client for vLLM server using OpenAI-compatible API"""
12
13
 
13
- def __init__(self, base_url: str = "http://localhost:8000", model: str = "deepseek-coder-7b"):
14
+ def __init__(self, base_url: str = None, model: str = "deepseek-coder-7b"):
15
+ # Use environment variable if available, otherwise default to localhost
16
+ if base_url is None:
17
+ base_url = os.getenv('VLLM_BASE_URL', 'http://localhost:8000')
14
18
  self.base_url = base_url.rstrip('/')
15
19
  self.model = model
16
20
  self.api_url = f"{self.base_url}/v1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tzamuncode
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: TzamunCode - AI Coding Assistant powered by local models
5
5
  Author-email: "Tzamun Arabia IT Co." <info@tzamun.com>
6
6
  License: MIT
File without changes
File without changes
File without changes