deliberaide-cli 0.3.0__tar.gz → 0.3.1__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.
- {deliberaide_cli-0.3.0 → deliberaide_cli-0.3.1}/PKG-INFO +1 -1
- {deliberaide_cli-0.3.0 → deliberaide_cli-0.3.1}/deliberaide_cli/__init__.py +1 -1
- {deliberaide_cli-0.3.0 → deliberaide_cli-0.3.1}/deliberaide_cli/deliberaide_cli.py +2 -12
- {deliberaide_cli-0.3.0 → deliberaide_cli-0.3.1}/deliberaide_cli/utils/api_backend.py +36 -1
- {deliberaide_cli-0.3.0 → deliberaide_cli-0.3.1}/deliberaide_cli.egg-info/PKG-INFO +1 -1
- {deliberaide_cli-0.3.0 → deliberaide_cli-0.3.1}/setup.py +1 -1
- {deliberaide_cli-0.3.0 → deliberaide_cli-0.3.1}/deliberaide_cli/README.md +0 -0
- {deliberaide_cli-0.3.0 → deliberaide_cli-0.3.1}/deliberaide_cli/__main__.py +0 -0
- {deliberaide_cli-0.3.0 → deliberaide_cli-0.3.1}/deliberaide_cli/copilot_chat.py +0 -0
- {deliberaide_cli-0.3.0 → deliberaide_cli-0.3.1}/deliberaide_cli/core/__init__.py +0 -0
- {deliberaide_cli-0.3.0 → deliberaide_cli-0.3.1}/deliberaide_cli/core/manifest.py +0 -0
- {deliberaide_cli-0.3.0 → deliberaide_cli-0.3.1}/deliberaide_cli/core/session.py +0 -0
- {deliberaide_cli-0.3.0 → deliberaide_cli-0.3.1}/deliberaide_cli/route_manifest.json +0 -0
- {deliberaide_cli-0.3.0 → deliberaide_cli-0.3.1}/deliberaide_cli/utils/__init__.py +0 -0
- {deliberaide_cli-0.3.0 → deliberaide_cli-0.3.1}/deliberaide_cli/utils/formatting.py +0 -0
- {deliberaide_cli-0.3.0 → deliberaide_cli-0.3.1}/deliberaide_cli/utils/repl_skin.py +0 -0
- {deliberaide_cli-0.3.0 → deliberaide_cli-0.3.1}/deliberaide_cli.egg-info/SOURCES.txt +0 -0
- {deliberaide_cli-0.3.0 → deliberaide_cli-0.3.1}/deliberaide_cli.egg-info/dependency_links.txt +0 -0
- {deliberaide_cli-0.3.0 → deliberaide_cli-0.3.1}/deliberaide_cli.egg-info/entry_points.txt +0 -0
- {deliberaide_cli-0.3.0 → deliberaide_cli-0.3.1}/deliberaide_cli.egg-info/requires.txt +0 -0
- {deliberaide_cli-0.3.0 → deliberaide_cli-0.3.1}/deliberaide_cli.egg-info/top_level.txt +0 -0
- {deliberaide_cli-0.3.0 → deliberaide_cli-0.3.1}/setup.cfg +0 -0
|
@@ -711,18 +711,8 @@ def _store_cli_auth_tokens(
|
|
|
711
711
|
refresh_token: str,
|
|
712
712
|
) -> None:
|
|
713
713
|
hostname = urlparse(runtime.profile.base_url).hostname or ""
|
|
714
|
-
runtime.backend.
|
|
715
|
-
|
|
716
|
-
access_token,
|
|
717
|
-
domain=hostname,
|
|
718
|
-
path="/",
|
|
719
|
-
)
|
|
720
|
-
runtime.backend.client.cookies.set(
|
|
721
|
-
refresh_cookie_name,
|
|
722
|
-
refresh_token,
|
|
723
|
-
domain=hostname,
|
|
724
|
-
path="/",
|
|
725
|
-
)
|
|
714
|
+
runtime.backend.set_cookie(access_cookie_name, access_token, domain=hostname)
|
|
715
|
+
runtime.backend.set_cookie(refresh_cookie_name, refresh_token, domain=hostname)
|
|
726
716
|
runtime.save()
|
|
727
717
|
|
|
728
718
|
|
|
@@ -30,7 +30,10 @@ class ApiBackend:
|
|
|
30
30
|
timeout=timeout_seconds,
|
|
31
31
|
follow_redirects=True,
|
|
32
32
|
)
|
|
33
|
-
|
|
33
|
+
# One cookie per name, the last one saved (the newest): a profile written
|
|
34
|
+
# by 0.3.0 or older can hold the sign-in twice, see set_cookie.
|
|
35
|
+
latest = {cookie.name: cookie for cookie in cookies or []}
|
|
36
|
+
for cookie in latest.values():
|
|
34
37
|
self.client.cookies.set(
|
|
35
38
|
cookie.name,
|
|
36
39
|
cookie.value,
|
|
@@ -38,6 +41,35 @@ class ApiBackend:
|
|
|
38
41
|
path=cookie.path,
|
|
39
42
|
)
|
|
40
43
|
|
|
44
|
+
def set_cookie(self, name: str, value: str, *, domain: str, path: str = "/") -> None:
|
|
45
|
+
"""Store a cookie as the only one of that name."""
|
|
46
|
+
self._drop_cookies(name)
|
|
47
|
+
self.client.cookies.set(name, value, domain=domain, path=path)
|
|
48
|
+
|
|
49
|
+
def _drop_cookies(self, name: str, *, keep: Any = None) -> None:
|
|
50
|
+
jar = self.client.cookies.jar
|
|
51
|
+
for cookie in [item for item in jar if item.name == name and item is not keep]:
|
|
52
|
+
jar.clear(cookie.domain, cookie.path, cookie.name)
|
|
53
|
+
|
|
54
|
+
def _keep_newest_cookies(self, response: httpx.Response) -> None:
|
|
55
|
+
"""A cookie the server just set replaces every older one of that name.
|
|
56
|
+
|
|
57
|
+
Login stored the sign-in for the host ("platform.example.com"); the server
|
|
58
|
+
renews it for the cookie domain (".platform.example.com"). The jar kept
|
|
59
|
+
both, the old pair went out first, and the server ended every session of
|
|
60
|
+
the user for replaying a used refresh token (production 2026-11-20).
|
|
61
|
+
"""
|
|
62
|
+
fresh = {cookie.name: cookie for cookie in response.cookies.jar}
|
|
63
|
+
for name, cookie in fresh.items():
|
|
64
|
+
newest = next(
|
|
65
|
+
(item for item in self.client.cookies.jar
|
|
66
|
+
if item.name == name and item.domain == cookie.domain
|
|
67
|
+
and item.path == cookie.path),
|
|
68
|
+
None,
|
|
69
|
+
)
|
|
70
|
+
if newest is not None:
|
|
71
|
+
self._drop_cookies(name, keep=newest)
|
|
72
|
+
|
|
41
73
|
def export_cookies(self) -> list[CookieRecord]:
|
|
42
74
|
records: list[CookieRecord] = []
|
|
43
75
|
for cookie in self.client.cookies.jar:
|
|
@@ -81,9 +113,11 @@ class ApiBackend:
|
|
|
81
113
|
data=data,
|
|
82
114
|
files=files or None,
|
|
83
115
|
)
|
|
116
|
+
self._keep_newest_cookies(response)
|
|
84
117
|
if response.status_code == 401 and allow_refresh and path != "/api/v1/auth/refresh":
|
|
85
118
|
if any(cookie.name.endswith("refresh") or "refresh" in cookie.name for cookie in self.export_cookies()):
|
|
86
119
|
refresh_response = self.client.post("/api/v1/auth/refresh")
|
|
120
|
+
self._keep_newest_cookies(refresh_response)
|
|
87
121
|
if refresh_response.is_success:
|
|
88
122
|
response = self.client.request(
|
|
89
123
|
method,
|
|
@@ -94,6 +128,7 @@ class ApiBackend:
|
|
|
94
128
|
data=data,
|
|
95
129
|
files=files or None,
|
|
96
130
|
)
|
|
131
|
+
self._keep_newest_cookies(response)
|
|
97
132
|
return response
|
|
98
133
|
finally:
|
|
99
134
|
for handle in file_handles:
|
|
@@ -7,7 +7,7 @@ LONG_DESCRIPTION = (Path(__file__).parent / "deliberaide_cli" / "README.md").rea
|
|
|
7
7
|
|
|
8
8
|
setup(
|
|
9
9
|
name="deliberaide-cli",
|
|
10
|
-
version="0.3.
|
|
10
|
+
version="0.3.1",
|
|
11
11
|
description="Stateful, agent-native CLI for the deliberAIde v2 API",
|
|
12
12
|
long_description=LONG_DESCRIPTION,
|
|
13
13
|
long_description_content_type="text/markdown",
|
|
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
|
{deliberaide_cli-0.3.0 → deliberaide_cli-0.3.1}/deliberaide_cli.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|