pipecatcloud 0.4.0__tar.gz → 0.4.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.
Files changed (66) hide show
  1. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/CHANGELOG.md +33 -0
  2. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/PKG-INFO +1 -1
  3. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/api.py +66 -0
  4. pipecatcloud-0.4.1/src/pipecatcloud/cli/commands/auth.py +601 -0
  5. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/cli/config.py +33 -15
  6. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/config.py +2 -0
  7. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud.egg-info/PKG-INFO +1 -1
  8. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud.egg-info/SOURCES.txt +1 -0
  9. pipecatcloud-0.4.1/tests/test_pat_auth.py +160 -0
  10. pipecatcloud-0.4.0/src/pipecatcloud/cli/commands/auth.py +0 -344
  11. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/.github/workflows/format.yml +0 -0
  12. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/.github/workflows/publish-pypi.yml +0 -0
  13. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/.github/workflows/publish-test.yml +0 -0
  14. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/.github/workflows/tests.yml +0 -0
  15. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/.gitignore +0 -0
  16. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/.pre-commit-config.yaml +0 -0
  17. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/LICENSE +0 -0
  18. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/README.md +0 -0
  19. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/pipecat-cloud.png +0 -0
  20. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/pyproject.toml +0 -0
  21. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/pytest.ini +0 -0
  22. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/scripts/fix-ruff.sh +0 -0
  23. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/scripts/pre-commit.sh +0 -0
  24. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/setup.cfg +0 -0
  25. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/__init__.py +0 -0
  26. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/__main__.py +0 -0
  27. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/__version__.py +0 -0
  28. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/_utils/__init__.py +0 -0
  29. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/_utils/async_utils.py +0 -0
  30. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/_utils/auth_utils.py +0 -0
  31. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/_utils/build_utils.py +0 -0
  32. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/_utils/console_utils.py +0 -0
  33. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/_utils/deploy_utils.py +0 -0
  34. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/_utils/regions.py +0 -0
  35. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/agent.py +0 -0
  36. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/cli/__init__.py +0 -0
  37. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/cli/api.py +0 -0
  38. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/cli/commands/__init__.py +0 -0
  39. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/cli/commands/agent.py +0 -0
  40. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/cli/commands/build.py +0 -0
  41. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/cli/commands/deploy.py +0 -0
  42. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/cli/commands/docker.py +0 -0
  43. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/cli/commands/organizations.py +0 -0
  44. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/cli/commands/regions.py +0 -0
  45. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/cli/commands/secrets.py +0 -0
  46. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/cli/entry_point.py +0 -0
  47. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/constants.py +0 -0
  48. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/exception.py +0 -0
  49. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/py.typed +0 -0
  50. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/session.py +0 -0
  51. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud/smallwebrtc/session_manager.py +0 -0
  52. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud.egg-info/dependency_links.txt +0 -0
  53. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud.egg-info/entry_points.txt +0 -0
  54. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud.egg-info/requires.txt +0 -0
  55. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/src/pipecatcloud.egg-info/top_level.txt +0 -0
  56. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/tests/__init__.py +0 -0
  57. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/tests/conftest.py +0 -0
  58. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/tests/test_agent_sessions.py +0 -0
  59. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/tests/test_agent_stop.py +0 -0
  60. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/tests/test_api_client.py +0 -0
  61. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/tests/test_config_file.py +0 -0
  62. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/tests/test_deployment_status.py +0 -0
  63. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/tests/test_docker_commands.py +0 -0
  64. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/tests/test_krisp_viva.py +0 -0
  65. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/tests/test_regions.py +0 -0
  66. {pipecatcloud-0.4.0 → pipecatcloud-0.4.1}/uv.lock +0 -0
@@ -5,6 +5,39 @@ All notable changes to **Pipecat Cloud** will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.4.1] - 2026-03-30
9
+
10
+ ### Added
11
+
12
+ - **Personal Access Token (PAT) support**: Authenticate with the CLI using a
13
+ PAT instead of interactive OAuth login. Set `PIPECAT_TOKEN=pcc_pat_...` as an
14
+ environment variable, or run `pcc auth use-pat <token>` to store it to config.
15
+ PATs work with all CLI commands and inherit the user's org memberships.
16
+
17
+ - `pcc auth use-pat` command: Validates a PAT against the API and stores it for
18
+ persistent use without needing an environment variable.
19
+
20
+ - `pcc auth whoami` now shows the current auth method (PAT or OAuth).
21
+
22
+ ### Changed
23
+
24
+ - **OAuth2 authentication**: `pcc auth login` now uses industry-standard
25
+ OAuth2 Authorization Code + PKCE, replacing the custom device-code flow.
26
+ Tokens auto-refresh transparently — no more "please run `pcc auth login`"
27
+ interruptions.
28
+
29
+ - `pcc auth logout` now revokes tokens server-side. Previously, logout only
30
+ deleted local credentials and the token remained valid until expiry.
31
+
32
+ - `pcc auth whoami` now displays the user's email address instead of the
33
+ internal user ID.
34
+
35
+ ### Fixed
36
+
37
+ - Credentials file with overly permissive permissions is now automatically
38
+ repaired to 600 instead of issuing a suppressible warning. If repair fails,
39
+ the CLI refuses to load the token.
40
+
8
41
  ## [0.4.0] - 2026-03-29
9
42
 
10
43
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pipecatcloud
3
- Version: 0.4.0
3
+ Version: 0.4.1
4
4
  Summary: Cloud hosting for Pipecat AI applications
5
5
  License: BSD 2-Clause License
6
6
  Project-URL: Website, https://docs.pipecat.daily.co/
@@ -5,6 +5,7 @@
5
5
  #
6
6
 
7
7
  import json
8
+ import time
8
9
  from functools import wraps
9
10
  from typing import Callable, List, Optional, Union
10
11
 
@@ -52,6 +53,62 @@ class _API:
52
53
  return {}
53
54
  return {"Authorization": f"Bearer {override_token or self.token}"}
54
55
 
56
+ def _is_pat(self) -> bool:
57
+ """Check if the current token is a Personal Access Token."""
58
+ return bool(self.token and self.token.startswith("pcc_pat_"))
59
+
60
+ def _is_token_expired(self) -> bool:
61
+ """Check if the current OAuth token is near expiry.
62
+
63
+ Returns False for PATs (they don't expire via OAuth) and for
64
+ non-OAuth tokens (no token_expires_at stored).
65
+ """
66
+ if self._is_pat():
67
+ return False
68
+
69
+ from pipecatcloud.cli.config import config as cli_config
70
+
71
+ expires_at = cli_config.get("token_expires_at")
72
+ if expires_at is None:
73
+ return False
74
+ # Refresh 60 seconds before actual expiry to avoid race conditions
75
+ return time.time() > (float(expires_at) - 60)
76
+
77
+ async def _refresh_oauth_token(self) -> Optional[str]:
78
+ """Refresh the OAuth access token using the stored refresh token.
79
+
80
+ Updates both the on-disk config and the in-memory token on this API
81
+ instance. Returns the new access token, or None if refresh failed
82
+ (in which case the request will proceed with the expired token and
83
+ the server will return 401, prompting re-login).
84
+ """
85
+ from pipecatcloud.cli.config import config as cli_config, update_user_config
86
+
87
+ # Inline import: auth.py → cli/api.py → api.py creates a circular
88
+ # dependency at module load time. Importing here (at call time)
89
+ # breaks the cycle.
90
+ from pipecatcloud.cli.commands.auth import refresh_access_token
91
+
92
+ refresh_token = cli_config.get("refresh_token")
93
+ if not refresh_token:
94
+ return None
95
+
96
+ tokens = await refresh_access_token(refresh_token)
97
+ if not tokens:
98
+ return None
99
+
100
+ new_token = tokens["access_token"]
101
+ new_refresh = tokens.get("refresh_token", refresh_token)
102
+ expires_at = time.time() + tokens.get("expires_in", 86400)
103
+
104
+ update_user_config(
105
+ token=new_token,
106
+ refresh_token=new_refresh,
107
+ token_expires_at=expires_at,
108
+ )
109
+ self.token = new_token
110
+ return new_token
111
+
55
112
  async def _base_request(
56
113
  self,
57
114
  method: str,
@@ -61,6 +118,15 @@ class _API:
61
118
  not_found_is_empty: bool = False,
62
119
  override_token: Optional[str] = None,
63
120
  ) -> Optional[dict]:
121
+ # Auto-refresh expired OAuth tokens before making the request.
122
+ # Only runs for CLI usage (self.is_cli) and only when an OAuth
123
+ # refresh_token is stored (token_expires_at is set). Old device-code
124
+ # tokens are unaffected since _is_token_expired() returns False.
125
+ if self.is_cli and not override_token and self._is_token_expired():
126
+ new_token = await self._refresh_oauth_token()
127
+ if new_token is None:
128
+ logger.debug("Token refresh failed, proceeding with expired token")
129
+
64
130
  async with aiohttp.ClientSession() as session:
65
131
  logger.debug(f"Request: {method} {url} {params} {json}")
66
132