dooers-cli 0.11.1__tar.gz → 0.11.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 (48) hide show
  1. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/PKG-INFO +1 -1
  2. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/pyproject.toml +1 -1
  3. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/src/dooers/cli/run.py +10 -19
  4. dooers_cli-0.11.2/tests/test_local_runtime_slot.py +27 -0
  5. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/uv.lock +1 -1
  6. dooers_cli-0.11.1/tests/test_local_runtime_slot.py +0 -35
  7. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/.gitignore +0 -0
  8. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/README.md +0 -0
  9. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/src/dooers/cli/__init__.py +0 -0
  10. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/src/dooers/cli/agent_store.py +0 -0
  11. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/src/dooers/cli/agents.py +0 -0
  12. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/src/dooers/cli/auth.py +0 -0
  13. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/src/dooers/cli/cli.py +0 -0
  14. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/src/dooers/cli/config.py +0 -0
  15. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/src/dooers/cli/core_client.py +0 -0
  16. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/src/dooers/cli/env_prod.py +0 -0
  17. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/src/dooers/cli/ignore.py +0 -0
  18. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/src/dooers/cli/logs.py +0 -0
  19. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/src/dooers/cli/manifest_sync.py +0 -0
  20. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/src/dooers/cli/org.py +0 -0
  21. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/src/dooers/cli/push.py +0 -0
  22. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/src/dooers/cli/push_client.py +0 -0
  23. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/src/dooers/cli/runtime_client.py +0 -0
  24. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/src/dooers/cli/settings.py +0 -0
  25. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/src/dooers/cli/token_store.py +0 -0
  26. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/src/dooers/cli/user_config.py +0 -0
  27. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/src/dooers/cli/validate.py +0 -0
  28. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/src/dooers/py.typed +0 -0
  29. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/tests/__init__.py +0 -0
  30. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/tests/test_agent_store.py +0 -0
  31. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/tests/test_agents_delete.py +0 -0
  32. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/tests/test_agents_update.py +0 -0
  33. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/tests/test_config.py +0 -0
  34. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/tests/test_core_client.py +0 -0
  35. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/tests/test_encoding.py +0 -0
  36. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/tests/test_env_prod.py +0 -0
  37. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/tests/test_ignore.py +0 -0
  38. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/tests/test_logs.py +0 -0
  39. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/tests/test_manifest_sync.py +0 -0
  40. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/tests/test_org.py +0 -0
  41. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/tests/test_push_client_async.py +0 -0
  42. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/tests/test_push_failure_display.py +0 -0
  43. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/tests/test_push_hosting_guard.py +0 -0
  44. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/tests/test_push_poll.py +0 -0
  45. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/tests/test_push_teardown.py +0 -0
  46. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/tests/test_smoke.py +0 -0
  47. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/tests/test_token_store.py +0 -0
  48. {dooers_cli-0.11.1 → dooers_cli-0.11.2}/tests/test_validate.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: dooers-cli
3
- Version: 0.11.1
3
+ Version: 0.11.2
4
4
  Summary: Dooers CLI — run and deploy agents to Dooers, manage agent records, authenticate from the terminal
5
5
  Project-URL: Repository, https://github.com/Dooers-ai/dooers-cli
6
6
  Author-email: Dooers <dev@dooers.ai>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "dooers-cli"
3
- version = "0.11.1"
3
+ version = "0.11.2"
4
4
  description = "Dooers CLI — run and deploy agents to Dooers, manage agent records, authenticate from the terminal"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -27,23 +27,9 @@ _RECONNECT_INITIAL_SECONDS = 1.0
27
27
  _RECONNECT_MAX_SECONDS = 15.0
28
28
 
29
29
 
30
- class LocalRuntimeBusy(RuntimeError):
31
- """A local runtime for this agent is still heartbeating."""
32
-
33
-
34
30
  def local_runtime_ids_to_replace(runtimes: list[RuntimeRecord]) -> list[str]:
35
- """Stale local rows can be removed. A live one blocks a second `dooers run`."""
36
- replace: list[str] = []
37
- for runtime in runtimes:
38
- if runtime.kind != "local":
39
- continue
40
- if runtime.status in {"online", "starting"}:
41
- raise LocalRuntimeBusy(
42
- "a local runtime is already connected for this agent. "
43
- "Stop that dooers run with Ctrl+C before starting another."
44
- )
45
- replace.append(runtime.runtime_id)
46
- return replace
31
+ """Every previous local row is replaced once the stable tunnel URL is free."""
32
+ return [runtime.runtime_id for runtime in runtimes if runtime.kind == "local"]
47
33
 
48
34
 
49
35
  class TunnelAllocationError(RuntimeError):
@@ -123,6 +109,11 @@ async def _allocate_tunnel(
123
109
  detail = response.json().get("detail", response.text)
124
110
  except ValueError:
125
111
  detail = response.text
112
+ if response.status_code == 409:
113
+ detail = (
114
+ "a dooers run for this agent is already connected. "
115
+ "Stop it with Ctrl+C before starting another."
116
+ )
126
117
  raise TunnelAllocationError(response.status_code, str(detail))
127
118
  return response.json()
128
119
 
@@ -398,14 +389,14 @@ async def _run(settings: Settings, token: str, manifest: Any, *, with_prod_env:
398
389
  runtime = None
399
390
  runtime_client = RuntimeClient(settings.core_url, token)
400
391
  try:
401
- existing = await asyncio.to_thread(runtime_client.list, manifest.agent_id)
402
- for runtime_id in local_runtime_ids_to_replace(existing):
403
- await asyncio.to_thread(runtime_client.delete, manifest.agent_id, runtime_id)
404
392
  allocation = await _allocate_tunnel(
405
393
  settings, token, manifest.agent_id, _forward_paths(manifest)
406
394
  )
407
395
  public_url = allocation["publicUrl"]
408
396
  messages_url = _messages_url(public_url, manifest.message_path)
397
+ existing = await asyncio.to_thread(runtime_client.list, manifest.agent_id)
398
+ for runtime_id in local_runtime_ids_to_replace(existing):
399
+ await asyncio.to_thread(runtime_client.delete, manifest.agent_id, runtime_id)
409
400
  runtime = await asyncio.to_thread(
410
401
  runtime_client.create,
411
402
  manifest.agent_id,
@@ -0,0 +1,27 @@
1
+ """Stable tunnel URL replaces any previous local runtime row."""
2
+
3
+ from dooers.cli.run import local_runtime_ids_to_replace
4
+ from dooers.cli.runtime_client import RuntimeRecord
5
+
6
+
7
+ def _runtime(kind: str, status: str, runtime_id: str = "rt-1") -> RuntimeRecord:
8
+ return RuntimeRecord(
9
+ runtime_id=runtime_id,
10
+ agent_id="agent-1",
11
+ kind=kind,
12
+ environment="development",
13
+ status=status,
14
+ http_url=None,
15
+ messages_url="wss://example/ws",
16
+ is_default=False,
17
+ )
18
+
19
+
20
+ def test_previous_local_runtimes_are_replaced_after_the_tunnel_is_free() -> None:
21
+ assert local_runtime_ids_to_replace(
22
+ [
23
+ _runtime("local", "online", "live"),
24
+ _runtime("local", "offline", "old"),
25
+ _runtime("external", "online", "ext"),
26
+ ]
27
+ ) == ["live", "old"]
@@ -233,7 +233,7 @@ toml = [
233
233
 
234
234
  [[package]]
235
235
  name = "dooers-cli"
236
- version = "0.11.1"
236
+ version = "0.11.2"
237
237
  source = { editable = "." }
238
238
  dependencies = [
239
239
  { name = "dooers-protocol" },
@@ -1,35 +0,0 @@
1
- """Local runtime replacement before a new `dooers run`."""
2
-
3
- import pytest
4
-
5
- from dooers.cli.run import LocalRuntimeBusy, local_runtime_ids_to_replace
6
- from dooers.cli.runtime_client import RuntimeRecord
7
-
8
-
9
- def _runtime(kind: str, status: str, runtime_id: str = "rt-1") -> RuntimeRecord:
10
- return RuntimeRecord(
11
- runtime_id=runtime_id,
12
- agent_id="agent-1",
13
- kind=kind,
14
- environment="development",
15
- status=status,
16
- http_url=None,
17
- messages_url="wss://example/ws",
18
- is_default=False,
19
- )
20
-
21
-
22
- def test_live_local_runtime_blocks_a_second_run() -> None:
23
- with pytest.raises(LocalRuntimeBusy):
24
- local_runtime_ids_to_replace([_runtime("local", "online")])
25
-
26
-
27
- def test_starting_local_runtime_blocks_a_second_run() -> None:
28
- with pytest.raises(LocalRuntimeBusy):
29
- local_runtime_ids_to_replace([_runtime("local", "starting")])
30
-
31
-
32
- def test_stale_local_runtime_is_replaced() -> None:
33
- assert local_runtime_ids_to_replace(
34
- [_runtime("local", "offline", "old"), _runtime("external", "online", "ext")]
35
- ) == ["old"]
File without changes
File without changes