dooers-cli 0.7.2__tar.gz → 0.8.0__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 (40) hide show
  1. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/PKG-INFO +2 -2
  2. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/pyproject.toml +2 -2
  3. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/src/dooers/cli/agent_store.py +11 -8
  4. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/src/dooers/cli/agents.py +3 -1
  5. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/src/dooers/cli/cli.py +14 -1
  6. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/src/dooers/cli/core_client.py +4 -1
  7. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/src/dooers/cli/validate.py +24 -19
  8. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/tests/test_agent_store.py +21 -0
  9. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/tests/test_validate.py +27 -0
  10. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/uv.lock +2 -2
  11. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/.gitignore +0 -0
  12. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/README.md +0 -0
  13. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/src/dooers/cli/__init__.py +0 -0
  14. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/src/dooers/cli/auth.py +0 -0
  15. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/src/dooers/cli/config.py +0 -0
  16. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/src/dooers/cli/env_prod.py +0 -0
  17. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/src/dooers/cli/ignore.py +0 -0
  18. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/src/dooers/cli/manifest_sync.py +0 -0
  19. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/src/dooers/cli/org.py +0 -0
  20. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/src/dooers/cli/push.py +0 -0
  21. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/src/dooers/cli/push_client.py +0 -0
  22. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/src/dooers/cli/settings.py +0 -0
  23. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/src/dooers/cli/token_store.py +0 -0
  24. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/src/dooers/cli/user_config.py +0 -0
  25. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/src/dooers/py.typed +0 -0
  26. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/tests/__init__.py +0 -0
  27. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/tests/test_agents_delete.py +0 -0
  28. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/tests/test_config.py +0 -0
  29. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/tests/test_core_client.py +0 -0
  30. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/tests/test_env_prod.py +0 -0
  31. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/tests/test_ignore.py +0 -0
  32. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/tests/test_manifest_sync.py +0 -0
  33. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/tests/test_org.py +0 -0
  34. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/tests/test_push_client_async.py +0 -0
  35. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/tests/test_push_failure_display.py +0 -0
  36. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/tests/test_push_hosting_guard.py +0 -0
  37. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/tests/test_push_poll.py +0 -0
  38. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/tests/test_push_teardown.py +0 -0
  39. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/tests/test_smoke.py +0 -0
  40. {dooers_cli-0.7.2 → dooers_cli-0.8.0}/tests/test_token_store.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dooers-cli
3
- Version: 0.7.2
3
+ Version: 0.8.0
4
4
  Summary: Dooers CLI — push 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>
@@ -15,7 +15,7 @@ Classifier: Programming Language :: Python :: 3.11
15
15
  Classifier: Programming Language :: Python :: 3.12
16
16
  Classifier: Typing :: Typed
17
17
  Requires-Python: >=3.10
18
- Requires-Dist: dooers-protocol>=0.6.1
18
+ Requires-Dist: dooers-protocol>=0.7.0
19
19
  Requires-Dist: httpx>=0.28.1
20
20
  Requires-Dist: pydantic>=2.13.2
21
21
  Requires-Dist: pyyaml>=6.0.2
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "dooers-cli"
3
- version = "0.7.2"
3
+ version = "0.8.0"
4
4
  description = "Dooers CLI — push agents to Dooers, manage agent records, authenticate from the terminal"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -26,7 +26,7 @@ dependencies = [
26
26
  "pydantic>=2.13.2",
27
27
  "pyyaml>=6.0.2",
28
28
  "tqdm>=4.66.4",
29
- "dooers-protocol>=0.6.1",
29
+ "dooers-protocol>=0.7.0",
30
30
  ]
31
31
 
32
32
  [tool.uv.sources]
@@ -54,6 +54,15 @@ class HTTPCoreAgentStore:
54
54
  def _h(self) -> dict[str, str]:
55
55
  return {"Authorization": f"Bearer {self.token}"}
56
56
 
57
+ def _post_json(self, url: str, body: dict | None = None) -> httpx.Response:
58
+ """POST with application/json — required to bypass core CSRF for Bearer-only clients."""
59
+ return httpx.post(
60
+ url,
61
+ headers={**self._h(), "Content-Type": "application/json"},
62
+ json=body if body is not None else {},
63
+ timeout=self._timeout,
64
+ )
65
+
57
66
  def create(self, req: CreateAgentRequest) -> AgentRecord:
58
67
  body = json.dumps({"organizationId": req.organization_id, "name": req.name})
59
68
  r = httpx.post(
@@ -82,9 +91,7 @@ class HTTPCoreAgentStore:
82
91
  return _record(_data(r))
83
92
 
84
93
  def archive(self, agent_id: str) -> None:
85
- r = httpx.post(
86
- f"{self.api}/agents/{agent_id}/archive", headers=self._h(), timeout=self._timeout
87
- )
94
+ r = self._post_json(f"{self.api}/agents/{agent_id}/archive")
88
95
  _data(r) # raises AgentStoreError on {success: false}; no record to parse
89
96
 
90
97
  def delete(self, agent_id: str) -> None:
@@ -94,9 +101,5 @@ class HTTPCoreAgentStore:
94
101
  _data(r) # success body is {success, message} with no data key — do NOT call _record()
95
102
 
96
103
  def regenerate_runtime_api_key(self, agent_id: str) -> AgentRecord:
97
- r = httpx.post(
98
- f"{self.api}/agents/{agent_id}/runtime-api-key/regenerate",
99
- headers=self._h(),
100
- timeout=self._timeout,
101
- )
104
+ r = self._post_json(f"{self.api}/agents/{agent_id}/runtime-api-key/regenerate")
102
105
  return _record(_data(r))
@@ -75,7 +75,9 @@ def create(
75
75
  "Set Agent access key in Studio and AGENT_SEED_SECRET in env.prod before push.",
76
76
  err=True,
77
77
  )
78
- typer.echo("Edit dooers.yaml (message_path, whatsapp, profile) then run dooers push.")
78
+ typer.echo(
79
+ "Edit dooers.yaml (message_path, whatsapp, profile, database) then run dooers push."
80
+ )
79
81
 
80
82
 
81
83
  @app.command("rotate-key")
@@ -1,5 +1,16 @@
1
1
  """Top-level Typer app — login/whoami/logout + agents group + push."""
2
2
 
3
+ import warnings
4
+
5
+ # Global `dooers-agents-server` installs `dooers.protocol.frames` with a legacy
6
+ # `schema` field name that Pydantic warns on at import. The CLI does not use WS
7
+ # frames; suppress so every command stays quiet when both packages share `dooers.*`.
8
+ warnings.filterwarnings(
9
+ "ignore",
10
+ message=r'Field name "schema" in "SettingsPublicSchemaResultPayload" shadows an attribute in parent "BaseModel"',
11
+ category=UserWarning,
12
+ )
13
+
3
14
  import typer
4
15
 
5
16
  from . import agents, auth, org, push, validate
@@ -28,7 +39,9 @@ app.command(name="login", help="Authenticate with Dooers (OTP via email).")(auth
28
39
  app.command(name="whoami", help="Show the currently authenticated user.")(auth.whoami)
29
40
  app.command(name="logout", help="Clear local credentials.")(auth.logout)
30
41
  app.add_typer(
31
- agents.app, name="agents", help="Manage agents — subcommands: list | create | show | delete."
42
+ agents.app,
43
+ name="agents",
44
+ help="Manage agents — subcommands: list | create | rotate-key | show | delete.",
32
45
  )
33
46
  app.add_typer(org.app, name="org", help="Manage organization — subcommands: list | use.")
34
47
  app.command(
@@ -89,7 +89,10 @@ class CoreClient:
89
89
  def revoke(self) -> None:
90
90
  try:
91
91
  httpx.post(
92
- f"{self.api}/identity/revoke", headers=self._headers(), timeout=self._timeout
92
+ f"{self.api}/identity/revoke",
93
+ headers={**self._headers(), "Content-Type": "application/json"},
94
+ json={},
95
+ timeout=self._timeout,
93
96
  )
94
97
  except httpx.HTTPError:
95
98
  pass # best-effort
@@ -93,28 +93,33 @@ def collect_issues(root: Path | None = None) -> list[ValidationIssue]:
93
93
  )
94
94
  )
95
95
 
96
- for env_path in [base / ".env", *base.glob("env.*")]:
97
- if not env_path.is_file():
98
- continue
99
- for raw in env_path.read_text().splitlines():
100
- line = raw.strip()
101
- if not line or line.startswith("#") or "=" not in line:
96
+ manifest = read_manifest(directory=base) if manifest_path.exists() else None
97
+
98
+ # A `dooers`-managed DB is provisioned by the platform and connected via IAM,
99
+ # so a local localhost AGENT_DATABASE_HOST (for `postgres` local dev) is expected.
100
+ managed_db = manifest is not None and manifest.database.type == "dooers"
101
+ if not managed_db:
102
+ for env_path in [base / ".env", *base.glob("env.*")]:
103
+ if not env_path.is_file():
102
104
  continue
103
- key, _, value = line.partition("=")
104
- if key.strip().upper() in {
105
- "AGENT_DATABASE_HOST",
106
- "DATABASE_HOST",
107
- "POSTGRES_HOST",
108
- } and value.strip().lower() in {"127.0.0.1", "localhost", "0.0.0.0"}:
109
- issues.append(
110
- ValidationIssue(
111
- "warning",
112
- f"{env_path.name} sets {key.strip()} to localhost — "
113
- "hosted deploys need a cloud database configured in Dooers Studio",
105
+ for raw in env_path.read_text().splitlines():
106
+ line = raw.strip()
107
+ if not line or line.startswith("#") or "=" not in line:
108
+ continue
109
+ key, _, value = line.partition("=")
110
+ if key.strip().upper() in {
111
+ "AGENT_DATABASE_HOST",
112
+ "DATABASE_HOST",
113
+ "POSTGRES_HOST",
114
+ } and value.strip().lower() in {"127.0.0.1", "localhost", "0.0.0.0"}:
115
+ issues.append(
116
+ ValidationIssue(
117
+ "warning",
118
+ f"{env_path.name} sets {key.strip()} to localhost — "
119
+ "hosted deploys need a cloud database configured in Dooers Studio",
120
+ )
114
121
  )
115
- )
116
122
 
117
- manifest = read_manifest(directory=base) if manifest_path.exists() else None
118
123
  if manifest is not None and manifest.hosting and not (base / "env.prod").is_file():
119
124
  issues.append(
120
125
  ValidationIssue(
@@ -75,6 +75,27 @@ def test_archive_posts_to_archive_route():
75
75
  )
76
76
  HTTPCoreAgentStore(BASE, "tok").archive(A) # should not raise
77
77
  assert route.called
78
+ req = route.calls.last.request
79
+ assert req.headers["content-type"] == "application/json"
80
+ assert req.read() == b"{}"
81
+
82
+
83
+ @respx.mock
84
+ def test_regenerate_runtime_api_key_posts_json_body():
85
+ data = {
86
+ "agentId": A,
87
+ "name": "x",
88
+ "organizationId": "o1",
89
+ "runtimeApiKey": "new-secret-key",
90
+ }
91
+ route = respx.post(f"{BASE}/api/v2/agents/{A}/runtime-api-key/regenerate").mock(
92
+ return_value=httpx.Response(200, json={"success": True, "data": data})
93
+ )
94
+ rec = HTTPCoreAgentStore(BASE, "tok").regenerate_runtime_api_key(A)
95
+ assert rec.runtime_api_key == "new-secret-key"
96
+ req = route.calls.last.request
97
+ assert req.headers["content-type"] == "application/json"
98
+ assert req.read() == b"{}"
78
99
 
79
100
 
80
101
  @respx.mock
@@ -105,6 +105,33 @@ hosting: true
105
105
  assert any("localhost" in i.message.lower() for i in issues)
106
106
 
107
107
 
108
+ def test_validate_skips_localhost_db_warning_when_managed(tmp_path: Path) -> None:
109
+ """With `database.type: dooers` the platform provisions the DB, so a local
110
+ localhost AGENT_DATABASE_HOST (used for `postgres` local dev) must not warn."""
111
+ _write(
112
+ tmp_path / "dooers.yaml",
113
+ """
114
+ protocol_version: "2"
115
+ agent_id: "550e8400-e29b-41d4-a716-446655440000"
116
+ name: test
117
+ organization_id: "org_1"
118
+ hosting: true
119
+ database:
120
+ type: dooers
121
+ """.strip()
122
+ + "\n",
123
+ )
124
+ _write(tmp_path / "Dockerfile", "FROM python:3.12-slim\n")
125
+ _write(
126
+ tmp_path / "pyproject.toml",
127
+ '[project]\ndependencies = ["dooers-agents-server>=0.12.0"]\n',
128
+ )
129
+ _write(tmp_path / ".env", "AGENT_DATABASE_HOST=127.0.0.1\n")
130
+
131
+ issues = collect_issues(tmp_path)
132
+ assert not any("localhost" in i.message.lower() for i in issues)
133
+
134
+
108
135
  def test_validate_warns_when_hosting_without_env_prod(tmp_path: Path) -> None:
109
136
  _write(
110
137
  tmp_path / "dooers.yaml",
@@ -232,7 +232,7 @@ toml = [
232
232
 
233
233
  [[package]]
234
234
  name = "dooers-cli"
235
- version = "0.7.2"
235
+ version = "0.8.0"
236
236
  source = { editable = "." }
237
237
  dependencies = [
238
238
  { name = "dooers-protocol" },
@@ -278,7 +278,7 @@ provides-extras = ["dev"]
278
278
 
279
279
  [[package]]
280
280
  name = "dooers-protocol"
281
- version = "0.6.1"
281
+ version = "0.7.0"
282
282
  source = { editable = "../dooers-protocol" }
283
283
  dependencies = [
284
284
  { name = "pydantic" },
File without changes
File without changes
File without changes
File without changes