aegra-cli 0.10.1__tar.gz → 0.10.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 (35) hide show
  1. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/PKG-INFO +1 -1
  2. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/pyproject.toml +1 -1
  3. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/cli.py +15 -0
  4. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/tests/test_cli.py +91 -0
  5. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/.gitignore +0 -0
  6. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/README.md +0 -0
  7. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/__init__.py +0 -0
  8. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/commands/__init__.py +0 -0
  9. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/commands/db.py +0 -0
  10. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/commands/init.py +0 -0
  11. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/env.py +0 -0
  12. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/templates/__init__.py +0 -0
  13. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/templates/env.example.template +0 -0
  14. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/templates/react-agent/README.md.template +0 -0
  15. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/templates/react-agent/__init__.py.template +0 -0
  16. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/templates/react-agent/graph.py.template +0 -0
  17. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/templates/react-agent/manifest.json +0 -0
  18. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/templates/react-agent/pyproject.toml.template +0 -0
  19. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/templates/react-agent/tools.py.template +0 -0
  20. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/templates/shared/context.py.template +0 -0
  21. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/templates/shared/gitignore +0 -0
  22. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/templates/shared/prompts.py.template +0 -0
  23. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/templates/shared/state.py.template +0 -0
  24. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/templates/shared/utils.py.template +0 -0
  25. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/templates/simple-chatbot/README.md.template +0 -0
  26. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/templates/simple-chatbot/__init__.py.template +0 -0
  27. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/templates/simple-chatbot/graph.py.template +0 -0
  28. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/templates/simple-chatbot/manifest.json +0 -0
  29. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/templates/simple-chatbot/pyproject.toml.template +0 -0
  30. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/utils/__init__.py +0 -0
  31. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/src/aegra_cli/utils/docker.py +0 -0
  32. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/tests/__init__.py +0 -0
  33. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/tests/conftest.py +0 -0
  34. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/tests/test_docker_utils.py +0 -0
  35. {aegra_cli-0.10.1 → aegra_cli-0.10.2}/tests/test_init.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: aegra-cli
3
- Version: 0.10.1
3
+ Version: 0.10.2
4
4
  Summary: Aegra CLI - Manage your self-hosted agent deployments
5
5
  Author-email: Muhammad Ibrahim <mibrahim37612@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "aegra-cli"
3
- version = "0.10.1"
3
+ version = "0.10.2"
4
4
  description = "Aegra CLI - Manage your self-hosted agent deployments"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -34,6 +34,19 @@ _DEFAULT_SERVE_HOST = "0.0.0.0" # noqa: S104 # nosec B104 - intentional for Do
34
34
  _DEFAULT_PORT = 2026
35
35
 
36
36
 
37
+ def _windows_loop_args() -> list[str]:
38
+ """Extra uvicorn args forcing a psycopg-compatible event loop on Windows.
39
+
40
+ The default Proactor loop breaks the LangGraph psycopg pool (#513).
41
+ Skipped when the installed aegra-api predates the factory module.
42
+ """
43
+ if sys.platform != "win32":
44
+ return []
45
+ if importlib.util.find_spec("aegra_api.utils.event_loop") is None:
46
+ return []
47
+ return ["--loop", "aegra_api.utils.event_loop:selector_loop_factory"]
48
+
49
+
37
50
  def _resolve_server_option(
38
51
  ctx: click.Context,
39
52
  param_name: str,
@@ -399,6 +412,7 @@ def dev(
399
412
  cmd_uvicorn = ["-m", "uvicorn", app, "--host", host, "--port", str(port)]
400
413
  if not no_reload:
401
414
  cmd_uvicorn.append("--reload")
415
+ cmd_uvicorn.extend(_windows_loop_args())
402
416
 
403
417
  if debug_port is not None:
404
418
  if importlib.util.find_spec("debugpy") is None:
@@ -590,6 +604,7 @@ def serve(ctx: click.Context, host: str, port: int, app: str, config_file: Path
590
604
  host,
591
605
  "--port",
592
606
  str(port),
607
+ *_windows_loop_args(),
593
608
  ]
594
609
 
595
610
  try:
@@ -96,6 +96,43 @@ class TestDevCommand:
96
96
  call_args = mock_popen.call_args[0][0]
97
97
  assert "--reload" not in call_args
98
98
 
99
+ def test_dev_no_reload_forces_selector_loop_on_windows(
100
+ self, cli_runner: CliRunner, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
101
+ ) -> None:
102
+ """dev --no-reload hits the same Proactor default as serve (#513)."""
103
+ monkeypatch.setattr("aegra_cli.cli.sys.platform", "win32")
104
+ with cli_runner.isolated_filesystem(temp_dir=tmp_path):
105
+ Path("aegra.json").write_text('{"graphs": {}}')
106
+
107
+ with patch("aegra_cli.cli.subprocess.Popen") as mock_popen:
108
+ mock_popen.return_value = create_mock_popen(0)
109
+ result = cli_runner.invoke(cli, ["dev", "--no-db-check", "--no-reload"])
110
+
111
+ assert result.exit_code == 0
112
+ cmd = mock_popen.call_args[0][0]
113
+ assert "--loop" in cmd
114
+ loop_idx = cmd.index("--loop")
115
+ assert cmd[loop_idx + 1] == "aegra_api.utils.event_loop:selector_loop_factory"
116
+
117
+ def test_dev_reload_also_forces_selector_loop_on_windows(
118
+ self, cli_runner: CliRunner, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
119
+ ) -> None:
120
+ """Reload mode gets the same explicit loop: it is the loop the reload
121
+ subprocess would pick anyway, and uniform args are easier to reason about."""
122
+ monkeypatch.setattr("aegra_cli.cli.sys.platform", "win32")
123
+ with cli_runner.isolated_filesystem(temp_dir=tmp_path):
124
+ Path("aegra.json").write_text('{"graphs": {}}')
125
+
126
+ with patch("aegra_cli.cli.subprocess.Popen") as mock_popen:
127
+ mock_popen.return_value = create_mock_popen(0)
128
+ result = cli_runner.invoke(cli, ["dev", "--no-db-check"])
129
+
130
+ assert result.exit_code == 0
131
+ cmd = mock_popen.call_args[0][0]
132
+ assert "--loop" in cmd
133
+ loop_idx = cmd.index("--loop")
134
+ assert cmd[loop_idx + 1] == "aegra_api.utils.event_loop:selector_loop_factory"
135
+
99
136
  def test_dev_default_host_and_port(self, cli_runner: CliRunner, tmp_path: Path) -> None:
100
137
  """Test that dev command uses default host and port."""
101
138
  with cli_runner.isolated_filesystem(temp_dir=tmp_path):
@@ -1153,6 +1190,60 @@ class TestServeCommand:
1153
1190
  # No --reload flag (production mode)
1154
1191
  assert "--reload" not in cmd
1155
1192
 
1193
+ def test_serve_forces_selector_loop_on_windows(
1194
+ self, cli_runner: CliRunner, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
1195
+ ) -> None:
1196
+ """Windows serve must pass a psycopg-compatible loop factory (#513).
1197
+
1198
+ uvicorn picks the Proactor loop on win32 without --reload; the
1199
+ LangGraph psycopg pool cannot connect on it.
1200
+ """
1201
+ monkeypatch.setattr("aegra_cli.cli.sys.platform", "win32")
1202
+ with cli_runner.isolated_filesystem(temp_dir=tmp_path):
1203
+ Path("aegra.json").write_text('{"graphs": {}}')
1204
+
1205
+ with patch("aegra_cli.cli.subprocess.run") as mock_run:
1206
+ mock_run.return_value.returncode = 0
1207
+ result = cli_runner.invoke(cli, ["serve"])
1208
+
1209
+ assert result.exit_code == 0
1210
+ cmd = mock_run.call_args[0][0]
1211
+ assert "--loop" in cmd
1212
+ assert "aegra_api.utils.event_loop:selector_loop_factory" in cmd
1213
+
1214
+ def test_serve_keeps_default_loop_off_windows(
1215
+ self, cli_runner: CliRunner, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
1216
+ ) -> None:
1217
+ """Linux/macOS keep uvicorn's auto loop (uvloop stays available)."""
1218
+ monkeypatch.setattr("aegra_cli.cli.sys.platform", "linux")
1219
+ with cli_runner.isolated_filesystem(temp_dir=tmp_path):
1220
+ Path("aegra.json").write_text('{"graphs": {}}')
1221
+
1222
+ with patch("aegra_cli.cli.subprocess.run") as mock_run:
1223
+ mock_run.return_value.returncode = 0
1224
+ result = cli_runner.invoke(cli, ["serve"])
1225
+
1226
+ assert result.exit_code == 0
1227
+ assert "--loop" not in mock_run.call_args[0][0]
1228
+
1229
+ def test_serve_skips_loop_when_api_lacks_factory(
1230
+ self, cli_runner: CliRunner, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
1231
+ ) -> None:
1232
+ """An older aegra-api without the factory module must not break startup."""
1233
+ monkeypatch.setattr("aegra_cli.cli.sys.platform", "win32")
1234
+ with cli_runner.isolated_filesystem(temp_dir=tmp_path):
1235
+ Path("aegra.json").write_text('{"graphs": {}}')
1236
+
1237
+ with (
1238
+ patch("aegra_cli.cli.importlib.util.find_spec", return_value=None),
1239
+ patch("aegra_cli.cli.subprocess.run") as mock_run,
1240
+ ):
1241
+ mock_run.return_value.returncode = 0
1242
+ result = cli_runner.invoke(cli, ["serve"])
1243
+
1244
+ assert result.exit_code == 0
1245
+ assert "--loop" not in mock_run.call_args[0][0]
1246
+
1156
1247
  def test_serve_port_from_env_var(self, cli_runner: CliRunner, tmp_path: Path) -> None:
1157
1248
  """Test that serve command picks up PORT from env var when no CLI flag is passed."""
1158
1249
  with cli_runner.isolated_filesystem(temp_dir=tmp_path):
File without changes
File without changes
File without changes
File without changes