browse-code 0.2.15__tar.gz → 0.2.16__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.15 → browse_code-0.2.16}/PKG-INFO +1 -1
  2. browse_code-0.2.16/browse_code/__init__.py +1 -0
  3. {browse_code-0.2.15 → browse_code-0.2.16}/browse_code/server.py +30 -7
  4. {browse_code-0.2.15 → browse_code-0.2.16}/browse_code.egg-info/PKG-INFO +1 -1
  5. {browse_code-0.2.15 → browse_code-0.2.16}/setup.py +1 -1
  6. browse_code-0.2.15/browse_code/__init__.py +0 -1
  7. {browse_code-0.2.15 → browse_code-0.2.16}/README.md +0 -0
  8. {browse_code-0.2.15 → browse_code-0.2.16}/browse_code/cli.py +0 -0
  9. {browse_code-0.2.15 → browse_code-0.2.16}/browse_code/extension/content.js +0 -0
  10. {browse_code-0.2.15 → browse_code-0.2.16}/browse_code/extension/icon128.png +0 -0
  11. {browse_code-0.2.15 → browse_code-0.2.16}/browse_code/extension/icon16.png +0 -0
  12. {browse_code-0.2.15 → browse_code-0.2.16}/browse_code/extension/icon48.png +0 -0
  13. {browse_code-0.2.15 → browse_code-0.2.16}/browse_code/extension/manifest.json +0 -0
  14. {browse_code-0.2.15 → browse_code-0.2.16}/browse_code/extension/popup.html +0 -0
  15. {browse_code-0.2.15 → browse_code-0.2.16}/browse_code/extension/popup.js +0 -0
  16. {browse_code-0.2.15 → browse_code-0.2.16}/browse_code/extension/spoof.js +0 -0
  17. {browse_code-0.2.15 → browse_code-0.2.16}/browse_code.egg-info/SOURCES.txt +0 -0
  18. {browse_code-0.2.15 → browse_code-0.2.16}/browse_code.egg-info/dependency_links.txt +0 -0
  19. {browse_code-0.2.15 → browse_code-0.2.16}/browse_code.egg-info/entry_points.txt +0 -0
  20. {browse_code-0.2.15 → browse_code-0.2.16}/browse_code.egg-info/requires.txt +0 -0
  21. {browse_code-0.2.15 → browse_code-0.2.16}/browse_code.egg-info/top_level.txt +0 -0
  22. {browse_code-0.2.15 → browse_code-0.2.16}/pyproject.toml +0 -0
  23. {browse_code-0.2.15 → browse_code-0.2.16}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: browse_code
3
- Version: 0.2.15
3
+ Version: 0.2.16
4
4
  Summary: Turn any AI chatbot into an autonomous coding agent
5
5
  Description-Content-Type: text/markdown
6
6
  Requires-Dist: fastapi
@@ -0,0 +1 @@
1
+ __version__ = "0.2.16"
@@ -570,13 +570,36 @@ async def run_tool(data: ToolModel):
570
570
  cmd = term_run_match.group(1).strip()
571
571
  env = os.environ.copy()
572
572
  env["FORCE_COLOR"] = "true"
573
- try:
574
- res = subprocess.run(cmd, shell=True, cwd=WORKSPACE_DIR, capture_output=True, text=True, timeout=300, env=env)
575
- output = strip_ansi(f"STDOUT:\n{res.stdout}\nSTDERR:\n{res.stderr}")
576
- result = {"output": truncate_output(output if output.strip() else "Executed.")}
577
- except subprocess.TimeoutExpired as e:
578
- partial = e.stdout or ""
579
- result = {"output": truncate_output(strip_ansi(f"Timed out after 300s. Output:\n{partial}"))}
573
+
574
+ pid = str(uuid.uuid4())[:8]
575
+ process = subprocess.Popen(cmd, shell=True, cwd=WORKSPACE_DIR, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, bufsize=1, env=env)
576
+ BACKGROUND_PROCESSES[pid] = {'process': process, 'logs': deque(maxlen=500), 'status': 'running'}
577
+ threading.Thread(target=stream_process_output, args=(pid, process), daemon=True).start()
578
+
579
+ # Wait up to 5 seconds to see if it finishes quickly
580
+ start_time = time.time()
581
+ while time.time() - start_time < 5.0:
582
+ if process.poll() is not None:
583
+ break
584
+ await asyncio.sleep(0.1)
585
+
586
+ # Give the log thread a tiny bit of time to flush if it just exited
587
+ await asyncio.sleep(0.1)
588
+
589
+ logs = "".join(list(BACKGROUND_PROCESSES[pid]['logs']))
590
+
591
+ if process.poll() is not None:
592
+ # Process finished quickly, treat as normal terminal_run
593
+ try:
594
+ del BACKGROUND_PROCESSES[pid]
595
+ except KeyError:
596
+ pass
597
+ output = strip_ansi(logs) if logs.strip() else "Executed."
598
+ result = {"output": truncate_output(output)}
599
+ else:
600
+ # Still running, auto-background it!
601
+ partial = strip_ansi(logs)
602
+ result = {"output": truncate_output(f"Status: ONGOING (Process auto-backgrounded after 5s)\nPID: {pid}\n\nOutput so far:\n{partial}\n\nInstruction: This process is still running. Use terminal_logs <pid='{pid}'> to check on it later, or terminal_kill to stop it.")}
580
603
 
581
604
  elif term_bg_match:
582
605
  cmd = term_bg_match.group(1).strip()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: browse_code
3
- Version: 0.2.15
3
+ Version: 0.2.16
4
4
  Summary: Turn any AI chatbot into an autonomous coding agent
5
5
  Description-Content-Type: text/markdown
6
6
  Requires-Dist: fastapi
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="browse_code",
5
- version="0.2.15",
5
+ version="0.2.16",
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.15"
File without changes
File without changes