pipecatcloud 1.6.1__tar.gz → 1.7.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.
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/CHANGELOG.md +18 -0
- {pipecatcloud-1.6.1/src/pipecatcloud.egg-info → pipecatcloud-1.7.0}/PKG-INFO +1 -1
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/_utils/console_utils.py +2 -1
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/_utils/deploy_utils.py +79 -1
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/api.py +3 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/cli/commands/deploy.py +76 -12
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/config.py +3 -1
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0/src/pipecatcloud.egg-info}/PKG-INFO +1 -1
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud.egg-info/SOURCES.txt +4 -1
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud.egg-info/scm_file_list.json +3 -0
- pipecatcloud-1.7.0/src/pipecatcloud.egg-info/scm_version.json +8 -0
- pipecatcloud-1.7.0/tests/test_deploy_git_sandbox_hint.py +94 -0
- pipecatcloud-1.7.0/tests/test_deploy_sandbox_hint.py +66 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_deploy_utils.py +22 -1
- pipecatcloud-1.7.0/tests/test_whatsapp_auth.py +379 -0
- pipecatcloud-1.6.1/src/pipecatcloud.egg-info/scm_version.json +0 -8
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/.claude/settings.json +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/.claude/skills/update-docs/SOURCE_DOC_MAPPING.md +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/.github/workflows/format.yml +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/.github/workflows/generate-changelog.yml +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/.github/workflows/publish-pypi.yml +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/.github/workflows/publish-test.yml +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/.github/workflows/python-compatibility.yml +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/.github/workflows/tests.yml +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/.github/workflows/update-docs.yml +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/.gitignore +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/.pre-commit-config.yaml +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/CLAUDE.md +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/LICENSE +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/README.md +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/changelog/_template.md.j2 +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/pipecat-cloud.png +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/pyproject.toml +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/pytest.ini +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/scripts/check-changelog-fragments.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/scripts/fix-ruff.sh +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/scripts/release-changelog.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/setup.cfg +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/__init__.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/__version__.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/_utils/__init__.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/_utils/async_utils.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/_utils/auth_utils.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/_utils/base_image.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/_utils/build_utils.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/_utils/environment_utils.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/_utils/github_utils.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/_utils/log_utils.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/_utils/regions.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/agent.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/cli/__init__.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/cli/api.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/cli/commands/__init__.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/cli/commands/agent.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/cli/commands/agent_profiles.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/cli/commands/auth.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/cli/commands/build.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/cli/commands/docker.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/cli/commands/github.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/cli/commands/organizations.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/cli/commands/project.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/cli/commands/project_group.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/cli/commands/regions.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/cli/commands/registry_keys.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/cli/commands/secrets.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/cli/commands/spend_limit.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/cli/config.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/cli/entry_point.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/constants.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/exception.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/py.typed +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/session.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud/smallwebrtc/session_manager.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud.egg-info/dependency_links.txt +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud.egg-info/entry_points.txt +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud.egg-info/requires.txt +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/src/pipecatcloud.egg-info/top_level.txt +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/__init__.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/conftest.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_agent_args.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_agent_profiles_and_resources.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_agent_sessions.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_agent_status_output.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_agent_stop.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_api_client.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_auth.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_base_image.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_build_id_display.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_build_utils.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_config_file.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_deploy_architecture.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_deploy_image_pull_secret.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_deploy_poll.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_deploy_referenced_secret_set.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_deployment_status.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_docker_commands.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_entry_point.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_exit_codes.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_github_integration.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_json_output.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_krisp_viva.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_log_redaction.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_max_session_duration.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_organizations.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_output_modes.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_pat_auth.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_projects.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_regions.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_regions_lifecycle.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_secrets_bulk_write.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_secrets_keys.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_secrets_reference.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_secrets_retry.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_secrets_set_referenced.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_spend_limit.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/tests/test_unread_answers.py +0 -0
- {pipecatcloud-1.6.1 → pipecatcloud-1.7.0}/uv.lock +0 -0
|
@@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
<!-- towncrier release notes start -->
|
|
9
9
|
|
|
10
|
+
## [1.7.0] - 2026-12-03
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `pcc-deploy.toml` accepts `whatsapp_auth` (`"none"` or `"token"`). With `"token"`, the agent's WhatsApp webhook requires your organization's public API key. The CLI warns when the API doesn't confirm the setting.
|
|
15
|
+
(PR [#232](https://github.com/daily-co/pipecat-cloud/pull/232))
|
|
16
|
+
|
|
17
|
+
- Redeploying an agent that has `whatsapp_auth` or `websocket_auth` set to `"token"` from a `pcc-deploy.toml` without that key resets it to `"none"`, as before. The CLI now warns about this before you confirm the deploy.
|
|
18
|
+
(PR [#232](https://github.com/daily-co/pipecat-cloud/pull/232))
|
|
19
|
+
|
|
20
|
+
- After a successful deploy, `pipecat cloud deploy` prints a link to the agent's Sandbox page in the dashboard, so you can talk to your agent in the browser right away. With `--json`, the result includes a `sandboxUrl` field (`null` if the deployment isn't ready).
|
|
21
|
+
(PR [#233](https://github.com/daily-co/pipecat-cloud/pull/233))
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- The deploy success panel no longer suggests `pipecat cloud project start`, which starts a session with no client attached. It now points to the Sandbox. The public API key note appears only when your organization has no public key (it used to depend on a default key in your local config), and it now appears above the Sandbox link.
|
|
26
|
+
(PR [#233](https://github.com/daily-co/pipecat-cloud/pull/233))
|
|
27
|
+
|
|
10
28
|
## [1.6.1] - 2026-11-17
|
|
11
29
|
|
|
12
30
|
### Changed
|
|
@@ -14,6 +14,7 @@ from rich.console import Console
|
|
|
14
14
|
from rich.panel import Panel
|
|
15
15
|
|
|
16
16
|
from pipecatcloud.cli import PANEL_TITLE_ERROR, PANEL_TITLE_SUCCESS, PIPECAT_CLI_NAME
|
|
17
|
+
from pipecatcloud.config import DEFAULT_DASHBOARD_HOST
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
class OutputMode(str, Enum):
|
|
@@ -332,7 +333,7 @@ class PipecatConsole(Console):
|
|
|
332
333
|
|
|
333
334
|
# Fall back to the documented default if the host is unset or empty,
|
|
334
335
|
# so the rendered link is never `[link=][/link]` or `[link=None]None[/link]`.
|
|
335
|
-
dashboard = base_config.get("dashboard_host") or
|
|
336
|
+
dashboard = base_config.get("dashboard_host") or DEFAULT_DASHBOARD_HOST
|
|
336
337
|
body = (
|
|
337
338
|
f"{usage_line}\n"
|
|
338
339
|
"New sessions are being rejected. In-flight sessions continue to run.\n\n"
|
|
@@ -11,6 +11,7 @@ import time
|
|
|
11
11
|
from collections.abc import Callable
|
|
12
12
|
from datetime import UTC, datetime
|
|
13
13
|
from enum import Enum
|
|
14
|
+
from urllib.parse import quote
|
|
14
15
|
|
|
15
16
|
import toml
|
|
16
17
|
import typer
|
|
@@ -19,9 +20,13 @@ from loguru import logger
|
|
|
19
20
|
|
|
20
21
|
from pipecatcloud._utils.log_utils import describe_exception
|
|
21
22
|
from pipecatcloud.cli import PIPECAT_DEPLOY_CONFIG_PATH
|
|
23
|
+
from pipecatcloud.config import DEFAULT_DASHBOARD_HOST
|
|
22
24
|
from pipecatcloud.constants import KRISP_VIVA_MODELS, KrispVivaAudioFilter
|
|
23
25
|
from pipecatcloud.exception import ConfigFileError
|
|
24
26
|
|
|
27
|
+
# The values the API accepts for an agent's WhatsApp webhook authentication.
|
|
28
|
+
WHATSAPP_AUTH_MODES = ("none", "token")
|
|
29
|
+
|
|
25
30
|
DEPLOY_STATUS_MAP = {
|
|
26
31
|
"Unknown": "[dim]Waiting[/dim]",
|
|
27
32
|
"True": "[green]Ready[/green]",
|
|
@@ -339,6 +344,15 @@ class ResourcesConfig:
|
|
|
339
344
|
return {"cpu": self.cpu, "memory": self.memory}
|
|
340
345
|
|
|
341
346
|
|
|
347
|
+
def sandbox_url(dashboard_host: str | None, org: str, agent_name: str) -> str:
|
|
348
|
+
"""Return the dashboard Sandbox URL for an agent.
|
|
349
|
+
|
|
350
|
+
Falls back to the default dashboard host if the setting is unset or empty.
|
|
351
|
+
"""
|
|
352
|
+
host = (dashboard_host or DEFAULT_DASHBOARD_HOST).rstrip("/")
|
|
353
|
+
return f"{host}/{quote(org, safe='')}/agents/{quote(agent_name, safe='')}/sandbox"
|
|
354
|
+
|
|
355
|
+
|
|
342
356
|
def parse_resources_option(value: str) -> "ResourcesConfig":
|
|
343
357
|
"""Parse the --resources CLI value ("cpu=2,memory=4Gi") into a ResourcesConfig.
|
|
344
358
|
|
|
@@ -451,6 +465,11 @@ class DeployConfigParams:
|
|
|
451
465
|
git: GitSourceConfig = field(factory=GitSourceConfig)
|
|
452
466
|
force_redeploy: bool = False
|
|
453
467
|
websocket_auth: str | None = None
|
|
468
|
+
# How the agent's WhatsApp webhook authenticates callers: "none" or "token"
|
|
469
|
+
# (the org's public API key). None keeps the field out of the request, and
|
|
470
|
+
# the API then applies its default, "none". On a deploy of an existing agent
|
|
471
|
+
# that replaces a stored "token"; see auth_settings_turned_off.
|
|
472
|
+
whatsapp_auth: str | None = None
|
|
454
473
|
max_session_duration: int | None = None
|
|
455
474
|
# CPU architecture the agent image requires (PCC-1105). Exactly the
|
|
456
475
|
# kubernetes.io/arch vocabulary; omitted = the region's default.
|
|
@@ -475,6 +494,11 @@ class DeployConfigParams:
|
|
|
475
494
|
raise ValueError("Cannot specify both 'agent_profile' and 'resources'")
|
|
476
495
|
if self.architecture is not None and self.architecture not in ("amd64", "arm64"):
|
|
477
496
|
raise ValueError("architecture must be 'amd64' or 'arm64'")
|
|
497
|
+
if self.whatsapp_auth is not None and self.whatsapp_auth not in WHATSAPP_AUTH_MODES:
|
|
498
|
+
raise ValueError(
|
|
499
|
+
f"whatsapp_auth must be one of: {', '.join(WHATSAPP_AUTH_MODES)} "
|
|
500
|
+
f"(got {self.whatsapp_auth!r})"
|
|
501
|
+
)
|
|
478
502
|
|
|
479
503
|
def to_dict(self):
|
|
480
504
|
return {
|
|
@@ -492,11 +516,56 @@ class DeployConfigParams:
|
|
|
492
516
|
"krisp_viva": self.krisp_viva.to_dict() if self.krisp_viva else None,
|
|
493
517
|
"git": self.git.to_dict() if self.git.is_set() else None,
|
|
494
518
|
"websocket_auth": self.websocket_auth,
|
|
519
|
+
"whatsapp_auth": self.whatsapp_auth,
|
|
495
520
|
"max_session_duration": self.max_session_duration,
|
|
496
521
|
"architecture": self.architecture,
|
|
497
522
|
}
|
|
498
523
|
|
|
499
524
|
|
|
525
|
+
def whatsapp_auth_unconfirmed(requested: str | None, deploy_response: dict | None) -> bool:
|
|
526
|
+
"""Whether a deploy asked for WhatsApp token auth that the API did not confirm.
|
|
527
|
+
|
|
528
|
+
The API answers a deploy with the saved agent under `service`, and an API
|
|
529
|
+
that has the feature reports `whatsappAuth` there. An API without it
|
|
530
|
+
accepts the field and drops it without complaint, so its response has no
|
|
531
|
+
`whatsappAuth` at all. Only "token" is checked: "none" is what an API
|
|
532
|
+
without the feature behaves like anyway, so a missing echo costs nothing.
|
|
533
|
+
A null value (the API could not read the setting back) is not a
|
|
534
|
+
confirmation either.
|
|
535
|
+
"""
|
|
536
|
+
if requested != "token":
|
|
537
|
+
return False
|
|
538
|
+
service = (deploy_response or {}).get("service")
|
|
539
|
+
confirmed = service.get("whatsappAuth") if isinstance(service, dict) else None
|
|
540
|
+
return confirmed != "token"
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
# The auth settings a deploy replaces: each pcc-deploy.toml key and the field
|
|
544
|
+
# the API reports it as on an agent.
|
|
545
|
+
_AUTH_SETTINGS = (
|
|
546
|
+
("websocket_auth", "websocketAuth"),
|
|
547
|
+
("whatsapp_auth", "whatsappAuth"),
|
|
548
|
+
)
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
def auth_settings_turned_off(params: DeployConfigParams, agent: dict | None) -> list[str]:
|
|
552
|
+
"""The pcc-deploy.toml keys whose "token" auth this deploy turns off.
|
|
553
|
+
|
|
554
|
+
A deploy of an existing agent replaces its settings, and the API gives a
|
|
555
|
+
setting the deploy leaves out its default, "none". So an agent that
|
|
556
|
+
requires a token stops requiring it once it is deployed from a
|
|
557
|
+
pcc-deploy.toml without the key. An agent read that doesn't report a
|
|
558
|
+
setting (an API without it) has nothing to turn off.
|
|
559
|
+
"""
|
|
560
|
+
if not agent:
|
|
561
|
+
return []
|
|
562
|
+
return [
|
|
563
|
+
key
|
|
564
|
+
for key, field in _AUTH_SETTINGS
|
|
565
|
+
if getattr(params, key) is None and agent.get(field) == "token"
|
|
566
|
+
]
|
|
567
|
+
|
|
568
|
+
|
|
500
569
|
def validate_git_source_combination(config: DeployConfigParams) -> str | None:
|
|
501
570
|
"""What a GitHub source cannot be combined with, or None when it is fine.
|
|
502
571
|
|
|
@@ -587,6 +656,7 @@ def load_deploy_config_file() -> DeployConfigParams | None:
|
|
|
587
656
|
"krisp_viva",
|
|
588
657
|
"git",
|
|
589
658
|
"websocket_auth",
|
|
659
|
+
"whatsapp_auth",
|
|
590
660
|
"max_session_duration",
|
|
591
661
|
"resources",
|
|
592
662
|
"architecture",
|
|
@@ -694,6 +764,14 @@ class GitDeployResult:
|
|
|
694
764
|
superseded_by: str | None = None
|
|
695
765
|
|
|
696
766
|
|
|
767
|
+
def git_deploy_succeeded(result: GitDeployResult) -> bool:
|
|
768
|
+
"""Whether the followed deploy attempt finished and succeeded."""
|
|
769
|
+
return (
|
|
770
|
+
result.outcome is GitDeployWait.TERMINAL
|
|
771
|
+
and (result.deploy or {}).get("status") == "succeeded"
|
|
772
|
+
)
|
|
773
|
+
|
|
774
|
+
|
|
697
775
|
async def follow_git_deploy(agent_name: str, org: str | None, commit_sha: str) -> GitDeployResult:
|
|
698
776
|
"""Poll an agent's latest deploy attempt until it resolves.
|
|
699
777
|
|
|
@@ -779,7 +857,7 @@ def report_git_deploy_result(
|
|
|
779
857
|
deploy = result.deploy or {}
|
|
780
858
|
status_value = deploy.get("status")
|
|
781
859
|
commit = deploy.get("commitSha")
|
|
782
|
-
if
|
|
860
|
+
if git_deploy_succeeded(result):
|
|
783
861
|
console.success(
|
|
784
862
|
f"Deployed '{agent_name}'" + (f" from commit {short_sha(commit)}" if commit else "")
|
|
785
863
|
)
|
|
@@ -854,6 +854,9 @@ class _API:
|
|
|
854
854
|
},
|
|
855
855
|
"forceRedeploy": deploy_config.force_redeploy or None,
|
|
856
856
|
"websocketAuth": deploy_config.websocket_auth,
|
|
857
|
+
# Left out unless the user set it. The API then applies "none", which
|
|
858
|
+
# on an existing agent replaces a stored "token"; _deploy warns first.
|
|
859
|
+
"whatsappAuth": deploy_config.whatsapp_auth,
|
|
857
860
|
"maxSessionDuration": deploy_config.max_session_duration,
|
|
858
861
|
# The field name is `architecture` — the API silently drops
|
|
859
862
|
# unknown keys, so a wrong name here schedules on the region
|
|
@@ -34,15 +34,19 @@ from pipecatcloud._utils.deploy_utils import (
|
|
|
34
34
|
KrispVivaConfig,
|
|
35
35
|
ResourcesConfig,
|
|
36
36
|
ScalingParams,
|
|
37
|
+
auth_settings_turned_off,
|
|
37
38
|
follow_git_deploy,
|
|
39
|
+
git_deploy_succeeded,
|
|
38
40
|
interpret_deployment_status,
|
|
39
41
|
parse_resources_option,
|
|
40
42
|
report_git_deploy_result,
|
|
43
|
+
sandbox_url,
|
|
41
44
|
validate_git_source_combination,
|
|
45
|
+
whatsapp_auth_unconfirmed,
|
|
42
46
|
with_deploy_config,
|
|
43
47
|
)
|
|
44
48
|
from pipecatcloud._utils.github_utils import short_sha
|
|
45
|
-
from pipecatcloud._utils.log_utils import describe_api_error, describe_body
|
|
49
|
+
from pipecatcloud._utils.log_utils import describe_api_error, describe_body, describe_exception
|
|
46
50
|
from pipecatcloud._utils.regions import (
|
|
47
51
|
get_regions,
|
|
48
52
|
region_error,
|
|
@@ -294,6 +298,41 @@ async def _cloud_build_flow(
|
|
|
294
298
|
# ----- Command
|
|
295
299
|
|
|
296
300
|
|
|
301
|
+
async def _org_has_public_key(org: str) -> bool | None:
|
|
302
|
+
"""Whether the organization has an active public API key, or None if that can't be told.
|
|
303
|
+
|
|
304
|
+
The API lists revoked keys alongside active ones, so those don't count. The Sandbox needs
|
|
305
|
+
an active public key. This is a hint after a successful deploy, so a failed lookup is not
|
|
306
|
+
an error: bubble_error keeps the client from printing one.
|
|
307
|
+
"""
|
|
308
|
+
try:
|
|
309
|
+
data, error = await API.bubble_error().api_keys(org=org)
|
|
310
|
+
except Exception as e:
|
|
311
|
+
# bubble_error only quiets an error the API answered with. A failure on our side of
|
|
312
|
+
# the request (a token refresh that can't write the config file, say) still raises,
|
|
313
|
+
# and it must not turn a deploy that already landed into a failed command.
|
|
314
|
+
logger.debug(f"Public API key lookup failed: {describe_exception(e)}")
|
|
315
|
+
return None
|
|
316
|
+
if error or not isinstance(data, dict):
|
|
317
|
+
return None
|
|
318
|
+
return any(not key.get("revoked") for key in data.get("public") or [])
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
async def _sandbox_hint(org: str, sandbox_link: str) -> str:
|
|
322
|
+
"""The Sandbox link for a deployed agent, led by a note if the org has no public key."""
|
|
323
|
+
key_note = ""
|
|
324
|
+
if await _org_has_public_key(org) is False:
|
|
325
|
+
key_note = (
|
|
326
|
+
"[yellow]The Sandbox needs a public API key. Create one:[/yellow]\n"
|
|
327
|
+
f"[bold yellow]`{PIPECAT_CLI_NAME} organizations keys create`[/bold yellow]\n\n"
|
|
328
|
+
)
|
|
329
|
+
return (
|
|
330
|
+
f"{key_note}"
|
|
331
|
+
f"[white]Talk to your agent in the Sandbox:\n[/white]"
|
|
332
|
+
f"[link={sandbox_link}]{sandbox_link}[/link]"
|
|
333
|
+
)
|
|
334
|
+
|
|
335
|
+
|
|
297
336
|
async def _report_git_first_deploy(params: DeployConfigParams, org: str) -> None:
|
|
298
337
|
"""Follow the first deploy of a newly created git-sourced agent.
|
|
299
338
|
|
|
@@ -312,6 +351,12 @@ async def _report_git_first_deploy(params: DeployConfigParams, org: str) -> None
|
|
|
312
351
|
result = await follow_git_deploy(agent_name=params.agent_name or "", org=org, commit_sha="")
|
|
313
352
|
report_git_deploy_result(result, params.agent_name or "", first_deploy=True)
|
|
314
353
|
|
|
354
|
+
# Only a first deploy that finished and succeeded: a failed, superseded or still
|
|
355
|
+
# building one exits or reports above, and has nothing to try yet.
|
|
356
|
+
if git_deploy_succeeded(result):
|
|
357
|
+
sandbox_link = sandbox_url(config.get("dashboard_host"), org, params.agent_name or "")
|
|
358
|
+
console.print(f"\n{await _sandbox_hint(org, sandbox_link)}")
|
|
359
|
+
|
|
315
360
|
|
|
316
361
|
async def _deploy(params: DeployConfigParams, org, force: bool = False):
|
|
317
362
|
existing_agent = False
|
|
@@ -351,6 +396,17 @@ async def _deploy(params: DeployConfigParams, org, force: bool = False):
|
|
|
351
396
|
)
|
|
352
397
|
raise typer.Exit(1)
|
|
353
398
|
|
|
399
|
+
# Said before the confirmation, so the deploy can still be called off.
|
|
400
|
+
turned_off = auth_settings_turned_off(params, data)
|
|
401
|
+
if turned_off:
|
|
402
|
+
live.stop()
|
|
403
|
+
for key in turned_off:
|
|
404
|
+
console.print(
|
|
405
|
+
f"[yellow]Warning: agent '{params.agent_name}' has {key} = \"token\", "
|
|
406
|
+
f"and pcc-deploy.toml does not set {key}, so this deploy resets it to "
|
|
407
|
+
f'"none". To keep it, add {key} = "token" to pcc-deploy.toml.[/yellow]'
|
|
408
|
+
)
|
|
409
|
+
|
|
354
410
|
if not force:
|
|
355
411
|
live.stop()
|
|
356
412
|
console.require_interactive("--yes")
|
|
@@ -435,6 +491,16 @@ async def _deploy(params: DeployConfigParams, org, force: bool = False):
|
|
|
435
491
|
if result and result.get("warning"):
|
|
436
492
|
console.print(f"[yellow]Warning: {result['warning']}[/yellow]")
|
|
437
493
|
|
|
494
|
+
# An API that predates WhatsApp auth drops the field without an error,
|
|
495
|
+
# so the deploy succeeds with the webhook left open. Say so; the deploy
|
|
496
|
+
# itself went through, so this is a warning and not a failure.
|
|
497
|
+
if whatsapp_auth_unconfirmed(params.whatsapp_auth, result):
|
|
498
|
+
console.print(
|
|
499
|
+
'[yellow]Warning: the API did not confirm whatsapp_auth = "token" for this '
|
|
500
|
+
"agent. An API without this setting ignores it, and the agent's WhatsApp "
|
|
501
|
+
"webhook then accepts requests without your public API key.[/yellow]"
|
|
502
|
+
)
|
|
503
|
+
|
|
438
504
|
# A git-sourced create has no deployment to wait on yet: the API enqueues
|
|
439
505
|
# the first deploy and the worker builds the repo before anything is
|
|
440
506
|
# scheduled. Follow that attempt instead of the readiness poll below, which
|
|
@@ -557,6 +623,8 @@ async def _deploy(params: DeployConfigParams, org, force: bool = False):
|
|
|
557
623
|
)
|
|
558
624
|
raise typer.Exit(1)
|
|
559
625
|
|
|
626
|
+
sandbox_link = sandbox_url(config.get("dashboard_host"), org, params.agent_name or "")
|
|
627
|
+
|
|
560
628
|
if console.json_output:
|
|
561
629
|
console.output_json(
|
|
562
630
|
{
|
|
@@ -564,23 +632,14 @@ async def _deploy(params: DeployConfigParams, org, force: bool = False):
|
|
|
564
632
|
"deploymentId": active_deployment_id,
|
|
565
633
|
"ready": is_ready,
|
|
566
634
|
"available": bool(last_status and last_status.is_available),
|
|
635
|
+
"sandboxUrl": sandbox_link if is_ready else None,
|
|
567
636
|
}
|
|
568
637
|
)
|
|
569
638
|
|
|
570
639
|
if is_ready:
|
|
571
|
-
public_api_key = config.get("default_public_key")
|
|
572
|
-
extra_message = ""
|
|
573
|
-
if not public_api_key:
|
|
574
|
-
extra_message = "\n\n[yellow]Note: if you have not already created a public API key (required to start a session), you can do so by running:\n[/yellow]"
|
|
575
|
-
extra_message += (
|
|
576
|
-
f"[bold yellow]`{PIPECAT_CLI_NAME} organizations keys create`[/bold yellow]"
|
|
577
|
-
)
|
|
578
|
-
|
|
579
640
|
console.success(
|
|
580
641
|
f"Agent deployment [bold]'{params.agent_name}'[/bold] is ready\n\n"
|
|
581
|
-
f"
|
|
582
|
-
f"[bold]`{PIPECAT_CLI_NAME} project start {params.agent_name}`[/bold]"
|
|
583
|
-
f"{extra_message}",
|
|
642
|
+
f"{await _sandbox_hint(org, sandbox_link)}",
|
|
584
643
|
title_extra=f"{'Update' if existing_agent else 'Deployment'} complete",
|
|
585
644
|
)
|
|
586
645
|
elif last_status and last_status.is_available:
|
|
@@ -1037,6 +1096,11 @@ def create_deploy_command(app: typer.Typer):
|
|
|
1037
1096
|
f"[bold white]WebSocket auth:[/bold white] [green]{partial_config.websocket_auth}[/green]"
|
|
1038
1097
|
)
|
|
1039
1098
|
|
|
1099
|
+
if partial_config.whatsapp_auth:
|
|
1100
|
+
content_items.append(
|
|
1101
|
+
f"[bold white]WhatsApp auth:[/bold white] [green]{partial_config.whatsapp_auth}[/green]"
|
|
1102
|
+
)
|
|
1103
|
+
|
|
1040
1104
|
content_items.extend(
|
|
1041
1105
|
[
|
|
1042
1106
|
f"[bold white]Max session duration:[/bold white] {'[dim]Default[/dim]' if partial_config.max_session_duration is None else '[green]' + str(partial_config.max_session_duration) + 's[/green]'}",
|
|
@@ -9,6 +9,8 @@ import typing
|
|
|
9
9
|
|
|
10
10
|
# ---- Constants
|
|
11
11
|
|
|
12
|
+
DEFAULT_DASHBOARD_HOST = "https://pipecat.daily.co"
|
|
13
|
+
|
|
12
14
|
|
|
13
15
|
class _Setting(typing.NamedTuple):
|
|
14
16
|
default: typing.Any = None
|
|
@@ -17,7 +19,7 @@ class _Setting(typing.NamedTuple):
|
|
|
17
19
|
|
|
18
20
|
_SETTINGS = {
|
|
19
21
|
"api_host": _Setting("https://api.pipecat.daily.co"),
|
|
20
|
-
"dashboard_host": _Setting(
|
|
22
|
+
"dashboard_host": _Setting(DEFAULT_DASHBOARD_HOST),
|
|
21
23
|
"init_zip_url": _Setting(
|
|
22
24
|
"https://github.com/pipecat-ai/pipecat-quickstart/archive/refs/heads/main.zip"
|
|
23
25
|
),
|
|
@@ -83,9 +83,11 @@ tests/test_build_id_display.py
|
|
|
83
83
|
tests/test_build_utils.py
|
|
84
84
|
tests/test_config_file.py
|
|
85
85
|
tests/test_deploy_architecture.py
|
|
86
|
+
tests/test_deploy_git_sandbox_hint.py
|
|
86
87
|
tests/test_deploy_image_pull_secret.py
|
|
87
88
|
tests/test_deploy_poll.py
|
|
88
89
|
tests/test_deploy_referenced_secret_set.py
|
|
90
|
+
tests/test_deploy_sandbox_hint.py
|
|
89
91
|
tests/test_deploy_utils.py
|
|
90
92
|
tests/test_deployment_status.py
|
|
91
93
|
tests/test_docker_commands.py
|
|
@@ -108,4 +110,5 @@ tests/test_secrets_reference.py
|
|
|
108
110
|
tests/test_secrets_retry.py
|
|
109
111
|
tests/test_secrets_set_referenced.py
|
|
110
112
|
tests/test_spend_limit.py
|
|
111
|
-
tests/test_unread_answers.py
|
|
113
|
+
tests/test_unread_answers.py
|
|
114
|
+
tests/test_whatsapp_auth.py
|
|
@@ -76,9 +76,11 @@
|
|
|
76
76
|
"tests/test_build_utils.py",
|
|
77
77
|
"tests/test_config_file.py",
|
|
78
78
|
"tests/test_deploy_architecture.py",
|
|
79
|
+
"tests/test_deploy_git_sandbox_hint.py",
|
|
79
80
|
"tests/test_deploy_image_pull_secret.py",
|
|
80
81
|
"tests/test_deploy_poll.py",
|
|
81
82
|
"tests/test_deploy_referenced_secret_set.py",
|
|
83
|
+
"tests/test_deploy_sandbox_hint.py",
|
|
82
84
|
"tests/test_deploy_utils.py",
|
|
83
85
|
"tests/test_deployment_status.py",
|
|
84
86
|
"tests/test_docker_commands.py",
|
|
@@ -102,6 +104,7 @@
|
|
|
102
104
|
"tests/test_secrets_set_referenced.py",
|
|
103
105
|
"tests/test_spend_limit.py",
|
|
104
106
|
"tests/test_unread_answers.py",
|
|
107
|
+
"tests/test_whatsapp_auth.py",
|
|
105
108
|
"uv.lock"
|
|
106
109
|
]
|
|
107
110
|
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"""A git-sourced first deploy shows the Sandbox link only once it has succeeded."""
|
|
2
|
+
|
|
3
|
+
from unittest.mock import AsyncMock, MagicMock, patch
|
|
4
|
+
|
|
5
|
+
import pytest
|
|
6
|
+
import typer
|
|
7
|
+
|
|
8
|
+
from pipecatcloud._utils.deploy_utils import (
|
|
9
|
+
DeployConfigParams,
|
|
10
|
+
GitDeployResult,
|
|
11
|
+
GitDeployWait,
|
|
12
|
+
GitSourceConfig,
|
|
13
|
+
)
|
|
14
|
+
from pipecatcloud.cli.commands.deploy import _report_git_first_deploy
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def params() -> DeployConfigParams:
|
|
18
|
+
return DeployConfigParams(
|
|
19
|
+
agent_name="my-agent",
|
|
20
|
+
git=GitSourceConfig(repo="acme/bot", branch="main"),
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def printed(console: MagicMock) -> str:
|
|
25
|
+
return "\n".join(str(call.args[0]) for call in console.print.call_args_list if call.args)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
async def run(result: GitDeployResult, has_key: bool | None = True) -> MagicMock:
|
|
29
|
+
console = MagicMock()
|
|
30
|
+
with (
|
|
31
|
+
patch("pipecatcloud.cli.commands.deploy.console", console),
|
|
32
|
+
patch(
|
|
33
|
+
"pipecatcloud.cli.commands.deploy.follow_git_deploy",
|
|
34
|
+
AsyncMock(return_value=result),
|
|
35
|
+
),
|
|
36
|
+
patch("pipecatcloud.cli.commands.deploy.report_git_deploy_result"),
|
|
37
|
+
patch(
|
|
38
|
+
"pipecatcloud.cli.commands.deploy._org_has_public_key",
|
|
39
|
+
AsyncMock(return_value=has_key),
|
|
40
|
+
),
|
|
41
|
+
):
|
|
42
|
+
await _report_git_first_deploy(params(), "my-org")
|
|
43
|
+
return console
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@pytest.mark.asyncio
|
|
47
|
+
async def test_succeeded_first_deploy_prints_the_sandbox_link():
|
|
48
|
+
result = GitDeployResult(GitDeployWait.TERMINAL, deploy={"status": "succeeded"})
|
|
49
|
+
|
|
50
|
+
out = printed(await run(result))
|
|
51
|
+
|
|
52
|
+
assert "/my-org/agents/my-agent/sandbox" in out
|
|
53
|
+
assert "needs a public API key" not in out
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@pytest.mark.asyncio
|
|
57
|
+
async def test_succeeded_first_deploy_without_a_key_leads_with_the_note():
|
|
58
|
+
result = GitDeployResult(GitDeployWait.TERMINAL, deploy={"status": "succeeded"})
|
|
59
|
+
|
|
60
|
+
out = printed(await run(result, has_key=False))
|
|
61
|
+
|
|
62
|
+
assert out.index("needs a public API key") < out.index("/sandbox")
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@pytest.mark.asyncio
|
|
66
|
+
@pytest.mark.parametrize(
|
|
67
|
+
"result",
|
|
68
|
+
[
|
|
69
|
+
GitDeployResult(GitDeployWait.TERMINAL, deploy={"status": "failed"}),
|
|
70
|
+
GitDeployResult(GitDeployWait.IN_FLIGHT, deploy={"status": "building"}),
|
|
71
|
+
GitDeployResult(GitDeployWait.SUPERSEDED, superseded_by="abc1234"),
|
|
72
|
+
GitDeployResult(GitDeployWait.UNOBSERVED),
|
|
73
|
+
],
|
|
74
|
+
)
|
|
75
|
+
async def test_no_link_unless_the_deploy_succeeded(result):
|
|
76
|
+
assert "/sandbox" not in printed(await run(result))
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@pytest.mark.asyncio
|
|
80
|
+
async def test_a_failed_deploy_exits_before_any_link():
|
|
81
|
+
console = MagicMock()
|
|
82
|
+
result = GitDeployResult(GitDeployWait.TERMINAL, deploy={"status": "failed", "reason": "x"})
|
|
83
|
+
with (
|
|
84
|
+
patch("pipecatcloud.cli.commands.deploy.console", console),
|
|
85
|
+
patch(
|
|
86
|
+
"pipecatcloud.cli.commands.deploy.follow_git_deploy",
|
|
87
|
+
AsyncMock(return_value=result),
|
|
88
|
+
),
|
|
89
|
+
patch("pipecatcloud._utils.console_utils.console", MagicMock()),
|
|
90
|
+
):
|
|
91
|
+
with pytest.raises(typer.Exit):
|
|
92
|
+
await _report_git_first_deploy(params(), "my-org")
|
|
93
|
+
|
|
94
|
+
assert "/sandbox" not in printed(console)
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""The public-key hint shown after a deploy: only a confirmed absence of active keys triggers it."""
|
|
2
|
+
|
|
3
|
+
from unittest.mock import AsyncMock, MagicMock, patch
|
|
4
|
+
|
|
5
|
+
import pytest
|
|
6
|
+
|
|
7
|
+
from pipecatcloud.cli.commands.deploy import _org_has_public_key
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def fake_api(result):
|
|
11
|
+
api = MagicMock()
|
|
12
|
+
api.bubble_error.return_value.api_keys = AsyncMock(return_value=result)
|
|
13
|
+
return api
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@pytest.mark.asyncio
|
|
17
|
+
async def test_org_with_public_key():
|
|
18
|
+
api = fake_api(({"public": [{"id": "k1"}], "private": []}, None))
|
|
19
|
+
with patch("pipecatcloud.cli.commands.deploy.API", api):
|
|
20
|
+
assert await _org_has_public_key("org") is True
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@pytest.mark.asyncio
|
|
24
|
+
async def test_revoked_public_keys_do_not_count():
|
|
25
|
+
api = fake_api(({"public": [{"id": "k1", "revoked": True}], "private": []}, None))
|
|
26
|
+
with patch("pipecatcloud.cli.commands.deploy.API", api):
|
|
27
|
+
assert await _org_has_public_key("org") is False
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@pytest.mark.asyncio
|
|
31
|
+
async def test_one_active_key_among_revoked_ones_counts():
|
|
32
|
+
api = fake_api(
|
|
33
|
+
({"public": [{"id": "k1", "revoked": True}, {"id": "k2", "revoked": False}]}, None)
|
|
34
|
+
)
|
|
35
|
+
with patch("pipecatcloud.cli.commands.deploy.API", api):
|
|
36
|
+
assert await _org_has_public_key("org") is True
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@pytest.mark.asyncio
|
|
40
|
+
async def test_org_without_public_key():
|
|
41
|
+
api = fake_api(({"public": [], "private": [{"id": "p1"}]}, None))
|
|
42
|
+
with patch("pipecatcloud.cli.commands.deploy.API", api):
|
|
43
|
+
assert await _org_has_public_key("org") is False
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@pytest.mark.asyncio
|
|
47
|
+
async def test_lookup_error_is_unknown_not_missing():
|
|
48
|
+
api = fake_api((None, {"code": "500"}))
|
|
49
|
+
with patch("pipecatcloud.cli.commands.deploy.API", api):
|
|
50
|
+
assert await _org_has_public_key("org") is None
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@pytest.mark.asyncio
|
|
54
|
+
async def test_lookup_uses_bubble_error_so_failures_print_nothing():
|
|
55
|
+
api = fake_api(({"public": []}, None))
|
|
56
|
+
with patch("pipecatcloud.cli.commands.deploy.API", api):
|
|
57
|
+
await _org_has_public_key("org")
|
|
58
|
+
api.bubble_error.assert_called_once()
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
@pytest.mark.asyncio
|
|
62
|
+
async def test_exception_from_the_lookup_is_unknown_not_a_failed_deploy():
|
|
63
|
+
api = MagicMock()
|
|
64
|
+
api.bubble_error.return_value.api_keys = AsyncMock(side_effect=OSError("config not writable"))
|
|
65
|
+
with patch("pipecatcloud.cli.commands.deploy.API", api):
|
|
66
|
+
assert await _org_has_public_key("org") is None
|
|
@@ -5,7 +5,7 @@ from unittest.mock import patch
|
|
|
5
5
|
|
|
6
6
|
import pytest
|
|
7
7
|
|
|
8
|
-
from pipecatcloud._utils.deploy_utils import load_deploy_config_file
|
|
8
|
+
from pipecatcloud._utils.deploy_utils import load_deploy_config_file, sandbox_url
|
|
9
9
|
from pipecatcloud.exception import ConfigFileError
|
|
10
10
|
|
|
11
11
|
|
|
@@ -43,3 +43,24 @@ def test_malformed_toml_is_an_error(tmp_path: Path):
|
|
|
43
43
|
|
|
44
44
|
with pytest.raises(ConfigFileError, match="not valid TOML"):
|
|
45
45
|
load(path)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class TestSandboxUrl:
|
|
49
|
+
def test_builds_url_from_host_org_and_agent(self):
|
|
50
|
+
assert (
|
|
51
|
+
sandbox_url("https://pipecat.daily.co", "my-org", "my-agent")
|
|
52
|
+
== "https://pipecat.daily.co/my-org/agents/my-agent/sandbox"
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
def test_trailing_slash_on_host_is_dropped(self):
|
|
56
|
+
assert (
|
|
57
|
+
sandbox_url("https://example.com/", "o", "a")
|
|
58
|
+
== "https://example.com/o/agents/a/sandbox"
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
@pytest.mark.parametrize("host", [None, ""])
|
|
62
|
+
def test_unset_host_uses_default(self, host):
|
|
63
|
+
assert sandbox_url(host, "o", "a") == "https://pipecat.daily.co/o/agents/a/sandbox"
|
|
64
|
+
|
|
65
|
+
def test_path_segments_are_encoded(self):
|
|
66
|
+
assert sandbox_url("https://h", "o/x", "a b") == "https://h/o%2Fx/agents/a%20b/sandbox"
|