navcli 0.2.1__tar.gz → 0.2.2__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 (45) hide show
  1. {navcli-0.2.1 → navcli-0.2.2}/PKG-INFO +1 -1
  2. {navcli-0.2.1 → navcli-0.2.2}/navcli/server/__init__.py +16 -3
  3. {navcli-0.2.1 → navcli-0.2.2}/navcli/server/browser.py +4 -1
  4. {navcli-0.2.1 → navcli-0.2.2}/navcli.egg-info/PKG-INFO +1 -1
  5. {navcli-0.2.1 → navcli-0.2.2}/pyproject.toml +1 -1
  6. {navcli-0.2.1 → navcli-0.2.2}/README.md +0 -0
  7. {navcli-0.2.1 → navcli-0.2.2}/docs/README.md +0 -0
  8. {navcli-0.2.1 → navcli-0.2.2}/navcli/cli/__init__.py +0 -0
  9. {navcli-0.2.1 → navcli-0.2.2}/navcli/cli/app.py +0 -0
  10. {navcli-0.2.1 → navcli-0.2.2}/navcli/cli/client.py +0 -0
  11. {navcli-0.2.1 → navcli-0.2.2}/navcli/cli/commands/__init__.py +0 -0
  12. {navcli-0.2.1 → navcli-0.2.2}/navcli/cli/commands/base.py +0 -0
  13. {navcli-0.2.1 → navcli-0.2.2}/navcli/cli/commands/control.py +0 -0
  14. {navcli-0.2.1 → navcli-0.2.2}/navcli/cli/commands/explore.py +0 -0
  15. {navcli-0.2.1 → navcli-0.2.2}/navcli/cli/commands/interaction.py +0 -0
  16. {navcli-0.2.1 → navcli-0.2.2}/navcli/cli/commands/navigation.py +0 -0
  17. {navcli-0.2.1 → navcli-0.2.2}/navcli/cli/commands/query.py +0 -0
  18. {navcli-0.2.1 → navcli-0.2.2}/navcli/core/__init__.py +0 -0
  19. {navcli-0.2.1 → navcli-0.2.2}/navcli/core/models/__init__.py +0 -0
  20. {navcli-0.2.1 → navcli-0.2.2}/navcli/core/models/dom.py +0 -0
  21. {navcli-0.2.1 → navcli-0.2.2}/navcli/core/models/element.py +0 -0
  22. {navcli-0.2.1 → navcli-0.2.2}/navcli/core/models/feedback.py +0 -0
  23. {navcli-0.2.1 → navcli-0.2.2}/navcli/core/models/state.py +0 -0
  24. {navcli-0.2.1 → navcli-0.2.2}/navcli/server/app.py +0 -0
  25. {navcli-0.2.1 → navcli-0.2.2}/navcli/server/middleware/__init__.py +0 -0
  26. {navcli-0.2.1 → navcli-0.2.2}/navcli/server/routes/__init__.py +0 -0
  27. {navcli-0.2.1 → navcli-0.2.2}/navcli/server/routes/control.py +0 -0
  28. {navcli-0.2.1 → navcli-0.2.2}/navcli/server/routes/explore.py +0 -0
  29. {navcli-0.2.1 → navcli-0.2.2}/navcli/server/routes/interaction.py +0 -0
  30. {navcli-0.2.1 → navcli-0.2.2}/navcli/server/routes/navigation.py +0 -0
  31. {navcli-0.2.1 → navcli-0.2.2}/navcli/server/routes/query.py +0 -0
  32. {navcli-0.2.1 → navcli-0.2.2}/navcli/server/routes/session.py +0 -0
  33. {navcli-0.2.1 → navcli-0.2.2}/navcli/utils/__init__.py +0 -0
  34. {navcli-0.2.1 → navcli-0.2.2}/navcli/utils/image.py +0 -0
  35. {navcli-0.2.1 → navcli-0.2.2}/navcli/utils/js.py +0 -0
  36. {navcli-0.2.1 → navcli-0.2.2}/navcli/utils/selector.py +0 -0
  37. {navcli-0.2.1 → navcli-0.2.2}/navcli/utils/text.py +0 -0
  38. {navcli-0.2.1 → navcli-0.2.2}/navcli/utils/time.py +0 -0
  39. {navcli-0.2.1 → navcli-0.2.2}/navcli/utils/url.py +0 -0
  40. {navcli-0.2.1 → navcli-0.2.2}/navcli.egg-info/SOURCES.txt +0 -0
  41. {navcli-0.2.1 → navcli-0.2.2}/navcli.egg-info/dependency_links.txt +0 -0
  42. {navcli-0.2.1 → navcli-0.2.2}/navcli.egg-info/entry_points.txt +0 -0
  43. {navcli-0.2.1 → navcli-0.2.2}/navcli.egg-info/requires.txt +0 -0
  44. {navcli-0.2.1 → navcli-0.2.2}/navcli.egg-info/top_level.txt +0 -0
  45. {navcli-0.2.1 → navcli-0.2.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: navcli
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: 可交互、可探索的浏览器命令行工具,专为 AI Agent 设计
5
5
  Author: NavCLI Team
6
6
  License: MIT
@@ -22,13 +22,15 @@ _NAVCLI_SESSIONS_DIR = os.path.join(_NAVCLI_HOME, "sessions")
22
22
  _server: Optional[uvicorn.Server] = None
23
23
 
24
24
 
25
- async def start_server(host: str = "127.0.0.1", port: int = 8765, headless: bool = True) -> uvicorn.Server:
25
+ async def start_server(host: str = "127.0.0.1", port: int = 8765, headless: bool = True,
26
+ browser_args: Optional[list] = None) -> uvicorn.Server:
26
27
  """Start the browser server.
27
28
 
28
29
  Args:
29
30
  host: Host to bind
30
31
  port: Port to listen
31
32
  headless: Run browser in headless mode (default: True)
33
+ browser_args: Additional browser launch arguments
32
34
 
33
35
  Returns:
34
36
  Uvicorn server instance
@@ -36,7 +38,7 @@ async def start_server(host: str = "127.0.0.1", port: int = 8765, headless: bool
36
38
  global _server
37
39
 
38
40
  # Start browser
39
- await start_browser(headless=headless)
41
+ await start_browser(headless=headless, args=browser_args)
40
42
 
41
43
  # Create app
42
44
  app = create_app()
@@ -80,9 +82,20 @@ def main():
80
82
  help="Run in headless mode (default)")
81
83
  parser.add_argument("--no-headless", dest="headless", action="store_false",
82
84
  help="Run with GUI (non-headless)")
85
+ parser.add_argument("--memory-limit", type=int, default=None,
86
+ help="Browser memory limit in MB (e.g., --memory-limit 512)")
83
87
 
84
88
  args = parser.parse_args()
85
89
 
90
+ # Build browser args for memory limit
91
+ browser_args = None
92
+ if args.memory_limit:
93
+ browser_args = [
94
+ f"--js-flags=--max-old-space-size={args.memory_limit}",
95
+ "--disable-dev-shm-usage",
96
+ ]
97
+ print(f"Memory limit: {args.memory_limit}MB")
98
+
86
99
  print(f"Starting NavCLI Browser Server on {args.host}:{args.port}...")
87
100
  print(f"Headless: {args.headless}")
88
101
  print("-" * 60)
@@ -117,7 +130,7 @@ def main():
117
130
  print("-" * 60)
118
131
 
119
132
  try:
120
- asyncio.run(start_server(args.host, args.port, headless=args.headless))
133
+ asyncio.run(start_server(args.host, args.port, headless=args.headless, browser_args=browser_args))
121
134
  except KeyboardInterrupt:
122
135
  print("\nShutting down...")
123
136
  sys.exit(0)
@@ -25,11 +25,12 @@ _NAVCLI_SESSIONS_DIR = os.path.join(_NAVCLI_HOME, "sessions")
25
25
  _storage_state_path: str = os.path.join(_NAVCLI_SESSIONS_DIR, "session.json") # Default session file
26
26
 
27
27
 
28
- async def start_browser(headless: bool = True):
28
+ async def start_browser(headless: bool = True, args: Optional[list] = None):
29
29
  """Start the browser.
30
30
 
31
31
  Args:
32
32
  headless: Whether to run in headless mode (default: True)
33
+ args: Additional browser launch arguments
33
34
  """
34
35
  global _browser, _context, _page
35
36
 
@@ -43,6 +44,8 @@ async def start_browser(headless: bool = True):
43
44
  user_data_dir = os.environ.get("NAVCLI_USER_DATA_DIR")
44
45
 
45
46
  launch_kwargs = {"headless": headless}
47
+ if args:
48
+ launch_kwargs["args"] = args
46
49
  if executable_path:
47
50
  launch_kwargs["executable_path"] = executable_path
48
51
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: navcli
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: 可交互、可探索的浏览器命令行工具,专为 AI Agent 设计
5
5
  Author: NavCLI Team
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "navcli"
7
- version = "0.2.1"
7
+ version = "0.2.2"
8
8
  description = "可交互、可探索的浏览器命令行工具,专为 AI Agent 设计"
9
9
  readme = "docs/README.md"
10
10
  requires-python = ">=3.9"
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
File without changes
File without changes