browse-code 0.2.18__tar.gz → 0.2.20__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 (23) hide show
  1. {browse_code-0.2.18 → browse_code-0.2.20}/PKG-INFO +6 -7
  2. {browse_code-0.2.18 → browse_code-0.2.20}/README.md +5 -6
  3. browse_code-0.2.20/browse_code/__init__.py +1 -0
  4. {browse_code-0.2.18 → browse_code-0.2.20}/browse_code/extension/content.js +38 -4
  5. {browse_code-0.2.18 → browse_code-0.2.20}/browse_code/server.py +30 -0
  6. {browse_code-0.2.18 → browse_code-0.2.20}/browse_code.egg-info/PKG-INFO +6 -7
  7. {browse_code-0.2.18 → browse_code-0.2.20}/setup.py +1 -1
  8. browse_code-0.2.18/browse_code/__init__.py +0 -1
  9. {browse_code-0.2.18 → browse_code-0.2.20}/browse_code/cli.py +0 -0
  10. {browse_code-0.2.18 → browse_code-0.2.20}/browse_code/extension/icon128.png +0 -0
  11. {browse_code-0.2.18 → browse_code-0.2.20}/browse_code/extension/icon16.png +0 -0
  12. {browse_code-0.2.18 → browse_code-0.2.20}/browse_code/extension/icon48.png +0 -0
  13. {browse_code-0.2.18 → browse_code-0.2.20}/browse_code/extension/manifest.json +0 -0
  14. {browse_code-0.2.18 → browse_code-0.2.20}/browse_code/extension/popup.html +0 -0
  15. {browse_code-0.2.18 → browse_code-0.2.20}/browse_code/extension/popup.js +0 -0
  16. {browse_code-0.2.18 → browse_code-0.2.20}/browse_code/extension/spoof.js +0 -0
  17. {browse_code-0.2.18 → browse_code-0.2.20}/browse_code.egg-info/SOURCES.txt +0 -0
  18. {browse_code-0.2.18 → browse_code-0.2.20}/browse_code.egg-info/dependency_links.txt +0 -0
  19. {browse_code-0.2.18 → browse_code-0.2.20}/browse_code.egg-info/entry_points.txt +0 -0
  20. {browse_code-0.2.18 → browse_code-0.2.20}/browse_code.egg-info/requires.txt +0 -0
  21. {browse_code-0.2.18 → browse_code-0.2.20}/browse_code.egg-info/top_level.txt +0 -0
  22. {browse_code-0.2.18 → browse_code-0.2.20}/pyproject.toml +0 -0
  23. {browse_code-0.2.18 → browse_code-0.2.20}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: browse_code
3
- Version: 0.2.18
3
+ Version: 0.2.20
4
4
  Summary: Turn any AI chatbot into an autonomous coding agent
5
5
  Description-Content-Type: text/markdown
6
6
  Requires-Dist: fastapi
@@ -24,6 +24,10 @@ Dynamic: summary
24
24
 
25
25
  **Browse Code** is a CLI tool that turns any AI chatbot (ChatGPT, Gemini, Claude, HuggingFace) into an autonomous coding agent. It bridges your browser and local terminal, letting AI read/write files, run commands, and manage processes on your machine.
26
26
 
27
+ <p align="center">
28
+ <img src="example.svg" alt="Tool Formatting Example" width="800">
29
+ </p>
30
+
27
31
  ## How It Works
28
32
 
29
33
  Browse Code has two parts:
@@ -90,12 +94,7 @@ The server starts immediately. Open your AI chat tab and you're ready to go. The
90
94
 
91
95
  ## Features
92
96
 
93
- - **File Operations:** Read, write, and patch files with beautiful inline terminal diffs:
94
-
95
- <p align="center">
96
- <img src="example.svg" alt="Tool Formatting Example" width="800">
97
- </p>
98
-
97
+ - **File Operations:** Read, write, and patch files with inline terminal diffs
99
98
  - **Code Search:** Search across your entire codebase by keyword
100
99
  - **Terminal Commands:** Run shell commands with full stdout/stderr capture
101
100
  - **Background Processes:** Start, monitor, and kill long-running processes
@@ -10,6 +10,10 @@
10
10
 
11
11
  **Browse Code** is a CLI tool that turns any AI chatbot (ChatGPT, Gemini, Claude, HuggingFace) into an autonomous coding agent. It bridges your browser and local terminal, letting AI read/write files, run commands, and manage processes on your machine.
12
12
 
13
+ <p align="center">
14
+ <img src="example.svg" alt="Tool Formatting Example" width="800">
15
+ </p>
16
+
13
17
  ## How It Works
14
18
 
15
19
  Browse Code has two parts:
@@ -76,12 +80,7 @@ The server starts immediately. Open your AI chat tab and you're ready to go. The
76
80
 
77
81
  ## Features
78
82
 
79
- - **File Operations:** Read, write, and patch files with beautiful inline terminal diffs:
80
-
81
- <p align="center">
82
- <img src="example.svg" alt="Tool Formatting Example" width="800">
83
- </p>
84
-
83
+ - **File Operations:** Read, write, and patch files with inline terminal diffs
85
84
  - **Code Search:** Search across your entire codebase by keyword
86
85
  - **Terminal Commands:** Run shell commands with full stdout/stderr capture
87
86
  - **Background Processes:** Start, monitor, and kill long-running processes
@@ -0,0 +1 @@
1
+ __version__ = "0.2.20"
@@ -251,7 +251,6 @@ async function injectAndSend(promptText) {
251
251
  // Setup an aggressive retry loop that clicks it the moment they focus the tab and React wakes up.
252
252
  const clickInterval = setInterval(() => {
253
253
  const currentText = inputBox.tagName === 'INPUT' || inputBox.tagName === 'TEXTAREA' ? inputBox.value : inputBox.textContent;
254
- // Abort if the user manually cleared or changed the input significantly
255
254
  if (!currentText || currentText.length < promptText.length * 0.5) {
256
255
  clearInterval(clickInterval);
257
256
  return;
@@ -261,7 +260,6 @@ async function injectAndSend(promptText) {
261
260
  }
262
261
  }, 500);
263
262
 
264
- // Clear interval after 15 seconds to avoid infinite loops
265
263
  setTimeout(() => clearInterval(clickInterval), 15000);
266
264
  }
267
265
  }
@@ -350,11 +348,47 @@ function trackResponse(initialText) {
350
348
 
351
349
  // If text has not changed for 2.5 seconds (5 ticks), assume generation is complete!
352
350
  if (unchangedTicks > 4) {
351
+
352
+ // Auto-save generated images
353
+ try {
354
+ const responseBlocks = document.querySelectorAll(PLATFORM.responseContainer);
355
+ if (responseBlocks.length > 0) {
356
+ const latestBlock = responseBlocks[responseBlocks.length - 1];
357
+ const images = latestBlock.querySelectorAll('img');
358
+ for (const img of images) {
359
+ if (img.dataset.agentProcessed) continue;
360
+ img.dataset.agentProcessed = "true";
361
+
362
+ // Filter out icons, avatars, and SVGs
363
+ if (img.src.includes('.svg') || img.src.includes('avatar') || img.src.includes('favicon')) continue;
364
+ if (img.width > 0 && img.width < 100) continue;
365
+
366
+ fetch(img.src)
367
+ .then(res => res.blob())
368
+ .then(blob => {
369
+ const reader = new FileReader();
370
+ reader.onloadend = () => {
371
+ fetch(`${LOCAL_SERVER}/extension/save-image`, {
372
+ method: 'POST',
373
+ headers: { 'Content-Type': 'application/json' },
374
+ body: JSON.stringify({ base64: reader.result })
375
+ }).then(res => res.json()).then(data => {
376
+ if (data.status === 'ok') {
377
+ messageQueue.push(`[System - Image Saved]: An image you generated was automatically downloaded and saved to: ${data.path}\nYou can use this file path in your code if you need to.`);
378
+ }
379
+ }).catch(err => console.error(err));
380
+ };
381
+ reader.readAsDataURL(blob);
382
+ }).catch(err => console.error("Failed to fetch image blob", err));
383
+ }
384
+ }
385
+ } catch (err) {
386
+ console.error("Image processing error", err);
387
+ }
388
+
353
389
  clearInterval(trackInterval);
354
390
  lastContainer.setAttribute('data-agent-processed', 'true');
355
391
  isWaitingForLLM = false; // UNLOCK IMMEDIATELY to prevent deadlocks from long-running tools
356
-
357
-
358
392
  const toolMatches = currentText.match(/<tool=[\s\S]*?<\/tool>/g);
359
393
  if (toolMatches && toolMatches.length > 0) {
360
394
  try {
@@ -184,6 +184,36 @@ async def extension_ping(v: str = None):
184
184
  print(f"\n{C_OK}[+] Extension connected{C_RESET}")
185
185
  return {"status": "ok"}
186
186
 
187
+ class ImageModel(BaseModel):
188
+ base64: str
189
+
190
+ @app.post("/extension/save-image")
191
+ async def save_image(data: ImageModel):
192
+ import base64
193
+ try:
194
+ header, encoded = data.base64.split(",", 1)
195
+ ext = "png"
196
+ if "jpeg" in header or "jpg" in header:
197
+ ext = "jpg"
198
+ elif "webp" in header:
199
+ ext = "webp"
200
+
201
+ image_data = base64.b64decode(encoded)
202
+ creations_dir = os.path.join(WORKSPACE_DIR, "agent-creations")
203
+ os.makedirs(creations_dir, exist_ok=True)
204
+
205
+ filename = f"generated_{uuid.uuid4().hex[:8]}.{ext}"
206
+ filepath = os.path.join(creations_dir, filename)
207
+
208
+ with open(filepath, "wb") as f:
209
+ f.write(image_data)
210
+
211
+ rel_path = f"agent-creations/{filename}"
212
+ print(f"\n{C_OK}[+] Saved AI image to {rel_path}{C_RESET}")
213
+ return {"status": "ok", "path": rel_path}
214
+ except Exception as e:
215
+ return {"status": "error", "message": str(e)}
216
+
187
217
  def cleanup_background_processes():
188
218
  print(f"\n{C_WARN}⏻ Shutting down — cleaning up background processes...{C_RESET}")
189
219
  for pid, data in BACKGROUND_PROCESSES.items():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: browse_code
3
- Version: 0.2.18
3
+ Version: 0.2.20
4
4
  Summary: Turn any AI chatbot into an autonomous coding agent
5
5
  Description-Content-Type: text/markdown
6
6
  Requires-Dist: fastapi
@@ -24,6 +24,10 @@ Dynamic: summary
24
24
 
25
25
  **Browse Code** is a CLI tool that turns any AI chatbot (ChatGPT, Gemini, Claude, HuggingFace) into an autonomous coding agent. It bridges your browser and local terminal, letting AI read/write files, run commands, and manage processes on your machine.
26
26
 
27
+ <p align="center">
28
+ <img src="example.svg" alt="Tool Formatting Example" width="800">
29
+ </p>
30
+
27
31
  ## How It Works
28
32
 
29
33
  Browse Code has two parts:
@@ -90,12 +94,7 @@ The server starts immediately. Open your AI chat tab and you're ready to go. The
90
94
 
91
95
  ## Features
92
96
 
93
- - **File Operations:** Read, write, and patch files with beautiful inline terminal diffs:
94
-
95
- <p align="center">
96
- <img src="example.svg" alt="Tool Formatting Example" width="800">
97
- </p>
98
-
97
+ - **File Operations:** Read, write, and patch files with inline terminal diffs
99
98
  - **Code Search:** Search across your entire codebase by keyword
100
99
  - **Terminal Commands:** Run shell commands with full stdout/stderr capture
101
100
  - **Background Processes:** Start, monitor, and kill long-running processes
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="browse_code",
5
- version="0.2.18",
5
+ version="0.2.20",
6
6
  description="Turn any AI chatbot into an autonomous coding agent",
7
7
  long_description=open("README.md").read(),
8
8
  long_description_content_type="text/markdown",
@@ -1 +0,0 @@
1
- __version__ = "0.2.18"
File without changes