fp-cloud-cli 0.0.2__tar.gz → 0.0.3__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.
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/CHANGELOG.md +31 -0
- {fp_cloud_cli-0.0.2/fp_cloud_cli.egg-info → fp_cloud_cli-0.0.3}/PKG-INFO +16 -9
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/README.md +14 -7
- fp_cloud_cli-0.0.3/fp_cli/_version.py +1 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/app.py +2 -8
- fp_cloud_cli-0.0.3/fp_cli/auth.py +507 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/cloud_output.py +3 -3
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/account_cmds.py +1 -11
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/auth_cmds.py +218 -51
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/orgs_cmds.py +1 -1
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/output.py +112 -135
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/permissions.py +10 -1
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/select.py +85 -6
- fp_cloud_cli-0.0.3/fp_cli/theme.py +50 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3/fp_cloud_cli.egg-info}/PKG-INFO +16 -9
- fp_cloud_cli-0.0.3/fp_cloud_cli.egg-info/SOURCES.txt +161 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cloud_cli.egg-info/requires.txt +1 -1
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/pyproject.toml +1 -1
- fp_cloud_cli-0.0.3/tests/__pycache__/__init__.cpython-314.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/conftest.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_alerting.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_analytics.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_audits.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_auth.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_auth_mode.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_browser_login.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_click_compat.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_client.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_cloud_account.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_cloud_agent.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_cloud_human_views.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_cloud_jev.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_cloud_observability.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_cloud_transport.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_commands.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_config.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_dashboards_agent.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_dates.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_enforcement_logic.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_evaluator_authoring.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_facets.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_failproofai_home.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_failproofai_home.cpython-314.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_fp_home_contract.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_hardening.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_help_table_coverage.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_keys_queries.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_list.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_multivalue.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_no_customer_identifiers.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_operator.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_orgs.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_output.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_pagination.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_policy_check.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_readme_matches_reality.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_request_id.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_review_fixes.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_round4_behaviour.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_screen_language.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_session_reevaluate.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_staging_parity.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_telemetry_completeness.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_usage.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_v1_origin_diagnostic.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_v1_routing.cpython-314-pytest-9.2.0.pyc +0 -0
- fp_cloud_cli-0.0.3/tests/__pycache__/test_whoami.cpython-314-pytest-9.2.0.pyc +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/fake_cloud_smoke.py +2 -2
- fp_cloud_cli-0.0.3/tests/test_browser_login.py +943 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_cloud_account.py +0 -2
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_cloud_agent.py +4 -8
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_cloud_human_views.py +0 -4
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_commands.py +3 -3
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_dashboards_agent.py +3 -3
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_facets.py +1 -1
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_keys_queries.py +19 -2
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_operator.py +1 -1
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_orgs.py +1 -1
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_output.py +19 -19
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_round4_behaviour.py +3 -2
- fp_cloud_cli-0.0.3/tests/test_screen_language.py +141 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_whoami.py +1 -1
- fp_cloud_cli-0.0.2/fp_cli/_version.py +0 -1
- fp_cloud_cli-0.0.2/fp_cli/auth.py +0 -185
- fp_cloud_cli-0.0.2/fp_cli/theme.py +0 -50
- fp_cloud_cli-0.0.2/fp_cloud_cli.egg-info/SOURCES.txt +0 -159
- fp_cloud_cli-0.0.2/tests/__pycache__/__init__.cpython-312.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/conftest.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_alerting.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_analytics.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_audits.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_auth.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_auth_mode.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_click_compat.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_client.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_cloud_account.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_cloud_agent.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_cloud_human_views.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_cloud_jev.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_cloud_observability.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_cloud_transport.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_commands.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_config.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_dashboards_agent.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_dates.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_enforcement_logic.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_evaluator_authoring.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_facets.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_failproofai_home.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_failproofai_home.cpython-312.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_fp_home_contract.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_hardening.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_help_table_coverage.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_keys_queries.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_list.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_multivalue.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_no_customer_identifiers.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_operator.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_orgs.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_output.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_pagination.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_policy_check.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_readme_matches_reality.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_request_id.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_review_fixes.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_round4_behaviour.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_screen_language.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_session_reevaluate.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_staging_parity.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_telemetry_completeness.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_usage.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_v1_origin_diagnostic.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_v1_routing.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/__pycache__/test_whoami.cpython-312-pytest-9.1.1.pyc +0 -0
- fp_cloud_cli-0.0.2/tests/test_screen_language.py +0 -80
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/LICENSE +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/MANIFEST.in +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/__init__.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/__main__.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/_click_compat.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/_context.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/analytics.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/analytics_config.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/analytics_registry.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/client.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/__init__.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/_cloud.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/_write.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/agent_cmds.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/alerts_cmds.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/audits_cmds.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/contracts_cmds.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/dashboards_cmds.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/errors_cmds.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/evals_cmds.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/evaluators_cmds.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/events_cmds.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/fleet_cmds.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/guardrails_cmds.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/incidents_cmds.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/keys_cmds.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/list_cmds.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/policies_cmds.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/queries_cmds.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/sentiment_cmds.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/sessions_cmds.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/settings_cmds.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/usage_cmds.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/commands/users_cmds.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/config.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/dates.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/enforcement.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/errors.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/evaluator_spec.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/models.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/orgs.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/policy_check.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cli/py.typed +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cloud_cli.egg-info/dependency_links.txt +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cloud_cli.egg-info/entry_points.txt +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/fp_cloud_cli.egg-info/top_level.txt +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/setup.cfg +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/__init__.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/conftest.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_alerting.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_analytics.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_audits.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_auth.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_auth_mode.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_click_compat.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_client.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_cloud_jev.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_cloud_observability.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_cloud_transport.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_config.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_dates.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_enforcement_logic.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_evaluator_authoring.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_failproofai_home.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_fp_home_contract.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_hardening.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_help_table_coverage.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_list.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_multivalue.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_no_customer_identifiers.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_pagination.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_policy_check.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_readme_matches_reality.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_request_id.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_review_fixes.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_session_reevaluate.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_staging_parity.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_telemetry_completeness.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_usage.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_v1_origin_diagnostic.py +0 -0
- {fp_cloud_cli-0.0.2 → fp_cloud_cli-0.0.3}/tests/test_v1_routing.py +0 -0
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Changelog — `fp` CLI
|
|
2
2
|
|
|
3
|
+
## 0.0.3 — 2026-11-16
|
|
4
|
+
|
|
5
|
+
**Stable release.** The `0.0.3b1` line the `bump` job opened after `0.0.3b0` is cut stable
|
|
6
|
+
here rather than published: nothing landed against it, so `0.0.3` is the code `0.0.3b0`
|
|
7
|
+
shipped, now what `pipx install fp-cloud-cli` resolves without `--pre`.
|
|
8
|
+
|
|
9
|
+
The entries below are the entire diff from `0.0.2`, and the `bump` job opens `0.0.4b0`
|
|
10
|
+
after the upload.
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `fp login` can sign you in from a browser. On a terminal it starts on a link, to use your browser or SSO: it opens where a browser can (over SSH or with no display it only shows it, and it works from any device), and the terminal finishes on its own once you authorize it. Press Tab for a 6-digit code by email instead, and Tab again to go back. `--email`, `--json` and anything without a terminal keep the code as they always did. If there's no link to offer, as on a dashboard without browser login, it uses the code and never creates a key. Either way you get the same session, with the same lifetime. (#981)
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- Back to the earlier look: rounded panels, the purple `◆ fp` mark, lowercase panel titles and red error boxes. Ids stay whole, wrapping instead of being cut, and screens added since keep their plain tables. `--json`, exit codes and messages are unchanged. (#981)
|
|
19
|
+
|
|
20
|
+
### Dependencies
|
|
21
|
+
|
|
22
|
+
- Accept `typer` up to `0.29.x` (`typer>=0.13,<0.30`, was `<0.28`). (#1000)
|
|
23
|
+
|
|
24
|
+
## 0.0.3b0 — 2026-10-25
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- `fp login` can sign you in from a browser. On a terminal it starts on a link, to use your browser or SSO: it opens where a browser can (over SSH or with no display it only shows it, and it works from any device), and the terminal finishes on its own once you authorize it. Press Tab for a 6-digit code by email instead, and Tab again to go back. `--email`, `--json` and anything without a terminal keep the code as they always did. If there's no link to offer, as on a dashboard without browser login, it uses the code and never creates a key. Either way you get the same session, with the same lifetime. (#981)
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
- Back to the earlier look: rounded panels, the purple `◆ fp` mark, lowercase panel titles and red error boxes. Ids stay whole, wrapping instead of being cut, and screens added since keep their plain tables. `--json`, exit codes and messages are unchanged. (#981)
|
|
33
|
+
|
|
3
34
|
## 0.0.2 — 2026-10-25
|
|
4
35
|
|
|
5
36
|
**Stable release.** The `0.0.2b0` line the `bump` job opened after `0.0.1` is cut stable
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fp-cloud-cli
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Summary: Command line client for FailproofAI Cloud — sessions, events, evaluations and audits from your terminal
|
|
5
5
|
Author-email: Failproof AI <failproofai@exosphere.host>
|
|
6
6
|
License: MIT License
|
|
@@ -64,7 +64,7 @@ Requires-Python: >=3.10
|
|
|
64
64
|
Description-Content-Type: text/markdown
|
|
65
65
|
License-File: LICENSE
|
|
66
66
|
Requires-Dist: httpx>=0.27
|
|
67
|
-
Requires-Dist: typer<0.
|
|
67
|
+
Requires-Dist: typer<0.30,>=0.13
|
|
68
68
|
Requires-Dist: click>=8.1
|
|
69
69
|
Requires-Dist: rich>=13
|
|
70
70
|
Requires-Dist: pygments>=2.13
|
|
@@ -110,17 +110,24 @@ uv run fp --help
|
|
|
110
110
|
|
|
111
111
|
## Authentication
|
|
112
112
|
|
|
113
|
-
The CLI talks to your dashboard (set `--base-url` or `FP_DASHBOARD_URL`) and
|
|
114
|
-
an emailed one-time code:
|
|
113
|
+
The CLI talks to your dashboard (set `--base-url` or `FP_DASHBOARD_URL`) and signs you in
|
|
114
|
+
from a browser or with an emailed one-time code:
|
|
115
115
|
|
|
116
116
|
```bash
|
|
117
|
-
fp login
|
|
118
|
-
#
|
|
117
|
+
fp login # opens a link to authorize; press tab for a code by email instead
|
|
118
|
+
fp login --email you@example.com # straight to the code; also what scripts and pipes use
|
|
119
|
+
# either way the session is stored in
|
|
119
120
|
# ~/.failproofai/fpcli/cli-auth.json (mode 0600)
|
|
120
121
|
fp whoami
|
|
121
122
|
fp logout
|
|
122
123
|
```
|
|
123
124
|
|
|
125
|
+
`fp` starts on a link, to sign in with your browser or SSO, and opens it (over SSH or with no
|
|
126
|
+
display it only shows it, and it works from any device). Authorize it and the terminal finishes
|
|
127
|
+
on its own. That terminal gets your access in all your orgs until the session expires, so only
|
|
128
|
+
authorize a link you just asked for. Press **tab** for a code by email instead, and tab again to
|
|
129
|
+
go back. If there's no link to offer, as on a dashboard without browser login, it uses the code.
|
|
130
|
+
|
|
124
131
|
Sessions expire (24h by default); re-run `fp login` when prompted.
|
|
125
132
|
|
|
126
133
|
## Working across orgs (multi-tenant)
|
|
@@ -382,7 +389,7 @@ fp usage windows
|
|
|
382
389
|
fp plan # session
|
|
383
390
|
fp plan claim <offer> # session
|
|
384
391
|
fp settings context-windows list|set <model> <tokens>|delete <model>
|
|
385
|
-
fp otel status
|
|
392
|
+
fp otel status
|
|
386
393
|
fp slack status|disconnect # session
|
|
387
394
|
```
|
|
388
395
|
|
|
@@ -398,8 +405,8 @@ Unknown-route 404s exit 6 with “not available on this FailproofAI Cloud yet”
|
|
|
398
405
|
Missing-record 404s also exit 6 but report that the record was not found.
|
|
399
406
|
`plan` and `plan claim` require a signed-in person and deny API-key mode before
|
|
400
407
|
HTTP with the standard `fp login` message.
|
|
401
|
-
Human screens use
|
|
402
|
-
existing JSON shapes are unchanged.
|
|
408
|
+
Human screens use rounded panels, the purple `◆ fp` mark and full ids, which wrap
|
|
409
|
+
rather than being cut; existing JSON shapes are unchanged.
|
|
403
410
|
|
|
404
411
|
Human commands show summaries, tables and wrapped text rather than response
|
|
405
412
|
objects. Use global `--json` for raw API results. For `sessions export` or
|
|
@@ -34,17 +34,24 @@ uv run fp --help
|
|
|
34
34
|
|
|
35
35
|
## Authentication
|
|
36
36
|
|
|
37
|
-
The CLI talks to your dashboard (set `--base-url` or `FP_DASHBOARD_URL`) and
|
|
38
|
-
an emailed one-time code:
|
|
37
|
+
The CLI talks to your dashboard (set `--base-url` or `FP_DASHBOARD_URL`) and signs you in
|
|
38
|
+
from a browser or with an emailed one-time code:
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
fp login
|
|
42
|
-
#
|
|
41
|
+
fp login # opens a link to authorize; press tab for a code by email instead
|
|
42
|
+
fp login --email you@example.com # straight to the code; also what scripts and pipes use
|
|
43
|
+
# either way the session is stored in
|
|
43
44
|
# ~/.failproofai/fpcli/cli-auth.json (mode 0600)
|
|
44
45
|
fp whoami
|
|
45
46
|
fp logout
|
|
46
47
|
```
|
|
47
48
|
|
|
49
|
+
`fp` starts on a link, to sign in with your browser or SSO, and opens it (over SSH or with no
|
|
50
|
+
display it only shows it, and it works from any device). Authorize it and the terminal finishes
|
|
51
|
+
on its own. That terminal gets your access in all your orgs until the session expires, so only
|
|
52
|
+
authorize a link you just asked for. Press **tab** for a code by email instead, and tab again to
|
|
53
|
+
go back. If there's no link to offer, as on a dashboard without browser login, it uses the code.
|
|
54
|
+
|
|
48
55
|
Sessions expire (24h by default); re-run `fp login` when prompted.
|
|
49
56
|
|
|
50
57
|
## Working across orgs (multi-tenant)
|
|
@@ -306,7 +313,7 @@ fp usage windows
|
|
|
306
313
|
fp plan # session
|
|
307
314
|
fp plan claim <offer> # session
|
|
308
315
|
fp settings context-windows list|set <model> <tokens>|delete <model>
|
|
309
|
-
fp otel status
|
|
316
|
+
fp otel status
|
|
310
317
|
fp slack status|disconnect # session
|
|
311
318
|
```
|
|
312
319
|
|
|
@@ -322,8 +329,8 @@ Unknown-route 404s exit 6 with “not available on this FailproofAI Cloud yet”
|
|
|
322
329
|
Missing-record 404s also exit 6 but report that the record was not found.
|
|
323
330
|
`plan` and `plan claim` require a signed-in person and deny API-key mode before
|
|
324
331
|
HTTP with the standard `fp login` message.
|
|
325
|
-
Human screens use
|
|
326
|
-
existing JSON shapes are unchanged.
|
|
332
|
+
Human screens use rounded panels, the purple `◆ fp` mark and full ids, which wrap
|
|
333
|
+
rather than being cut; existing JSON shapes are unchanged.
|
|
327
334
|
|
|
328
335
|
Human commands show summaries, tables and wrapped text rather than response
|
|
329
336
|
objects. Use global `--json` for raw API results. For `sessions export` or
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.0.3"
|
|
@@ -51,7 +51,7 @@ on failure a `{"error": …, "exit_code": …}` object on **stdout** too; human
|
|
|
51
51
|
|
|
52
52
|
**Getting started**
|
|
53
53
|
|
|
54
|
-
* `fp --base-url https://cloud.example.com login` —
|
|
54
|
+
* `fp --base-url https://cloud.example.com login` — authorize from a browser, or use an emailed code
|
|
55
55
|
* `fp whoami` — confirm who you are and your permissions
|
|
56
56
|
* `fp --json sessions --since 24h` — run a query (results are newest-first)
|
|
57
57
|
|
|
@@ -132,12 +132,6 @@ app = typer.Typer(
|
|
|
132
132
|
# function Typer calls for this; falls back silently if its internals change.
|
|
133
133
|
try: # pragma: no cover - exercised via real command output, not unit assertions
|
|
134
134
|
import typer.rich_utils as _rich_utils
|
|
135
|
-
# Keep generated subcommand help on the same shared screen primitives.
|
|
136
|
-
_rich_utils.Panel = output.Panel
|
|
137
|
-
_rich_utils.Table = output.Table
|
|
138
|
-
_rich_utils.STYLE_OPTION = output.theme.PINK
|
|
139
|
-
_rich_utils.STYLE_COMMANDS_TABLE_FIRST_COLUMN = output.theme.PINK
|
|
140
|
-
_rich_utils.STYLE_OPTION_ENVVAR = output.theme.LABEL
|
|
141
135
|
|
|
142
136
|
import re as _re
|
|
143
137
|
|
|
@@ -337,7 +331,7 @@ def main(
|
|
|
337
331
|
"must be a positive number of seconds.", param_hint="--timeout"
|
|
338
332
|
)
|
|
339
333
|
cfg = cfgmod.load_config()
|
|
340
|
-
output.configure(no_color=no_color, quiet=quiet, json=json_output
|
|
334
|
+
output.configure(no_color=no_color, quiet=quiet, json=json_output)
|
|
341
335
|
# Resolve the credential BEFORE telemetry starts: the distinct-id depends on it.
|
|
342
336
|
# `get_parameter_source` is what separates a flag from its env var — the values
|
|
343
337
|
# alone cannot, and the precedence rules differ between the two (see resolve_auth).
|
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
"""Signing in against the dashboard. Both ways end in the same session.
|
|
2
|
+
|
|
3
|
+
Emailed code: ``/api/auth/otp/request`` (sends a code) then ``/api/auth/otp/verify``.
|
|
4
|
+
The verify response carries the session token in the ``ae_session`` **Set-Cookie**
|
|
5
|
+
header (not the JSON body), so we read it from ``response.cookies``.
|
|
6
|
+
|
|
7
|
+
Browser: ``/api/auth/cli/start`` returns a link and a poll secret, a person approves
|
|
8
|
+
the link while this polls ``/poll`` with the secret, then ``/claim`` creates the
|
|
9
|
+
session and returns it, once. The token is in the JSON body there: nothing is setting a
|
|
10
|
+
browser cookie. The other end is ``server/src/routes/cli_login.rs`` in AgentEye.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
import math
|
|
16
|
+
import os
|
|
17
|
+
import platform as platform_info
|
|
18
|
+
import re
|
|
19
|
+
import socket
|
|
20
|
+
import subprocess
|
|
21
|
+
import sys
|
|
22
|
+
import time
|
|
23
|
+
from dataclasses import dataclass, field
|
|
24
|
+
from datetime import datetime, timedelta, timezone
|
|
25
|
+
from typing import Any, Callable, Dict, Mapping, Optional, Tuple
|
|
26
|
+
from urllib.parse import urlsplit
|
|
27
|
+
|
|
28
|
+
import uuid
|
|
29
|
+
|
|
30
|
+
import httpx
|
|
31
|
+
|
|
32
|
+
from ._version import __version__
|
|
33
|
+
from .config import CliConfig, save_config
|
|
34
|
+
from .client import _request_id_of
|
|
35
|
+
from .errors import ApiError, AuthError, NetworkError
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _request_id_header() -> Dict[str, str]:
|
|
39
|
+
"""A fresh request id for one login-flow call — same shape as the client's."""
|
|
40
|
+
return {"x-request-id": uuid.uuid4().hex}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _iso(dt: datetime) -> str:
|
|
44
|
+
return dt.astimezone(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _network_error(base_url: str, exc: Exception) -> NetworkError:
|
|
48
|
+
return NetworkError(f"Cannot reach FailproofAI Cloud at {base_url}: {exc}")
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def request_otp(
|
|
52
|
+
base_url: str,
|
|
53
|
+
email: str,
|
|
54
|
+
*,
|
|
55
|
+
timeout: float = 30.0,
|
|
56
|
+
transport: Optional[httpx.BaseTransport] = None,
|
|
57
|
+
verify: bool = True,
|
|
58
|
+
) -> None:
|
|
59
|
+
"""Ask the dashboard to email a login code. Always succeeds quietly for a
|
|
60
|
+
valid request (the server returns 200 even for unknown emails)."""
|
|
61
|
+
try:
|
|
62
|
+
with httpx.Client(
|
|
63
|
+
base_url=base_url.rstrip("/"),
|
|
64
|
+
timeout=timeout,
|
|
65
|
+
transport=transport,
|
|
66
|
+
verify=verify,
|
|
67
|
+
headers=_request_id_header(),
|
|
68
|
+
) as client:
|
|
69
|
+
# Mark this as a CLI login so the server emails the paste-into-terminal
|
|
70
|
+
# OTP template (with no "open the dashboard" button) instead of the
|
|
71
|
+
# browser one.
|
|
72
|
+
response = client.post(
|
|
73
|
+
"/api/auth/otp/request",
|
|
74
|
+
json={"email": email},
|
|
75
|
+
headers={"X-AgentEye-Client": "cli"},
|
|
76
|
+
)
|
|
77
|
+
except httpx.RequestError as exc:
|
|
78
|
+
raise _network_error(base_url, exc)
|
|
79
|
+
if response.status_code >= 400:
|
|
80
|
+
raise ApiError(
|
|
81
|
+
f"Failed to request a login code (HTTP {response.status_code}).",
|
|
82
|
+
status=response.status_code,
|
|
83
|
+
request_id=_request_id_of(response),
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def verify_otp(
|
|
88
|
+
base_url: str,
|
|
89
|
+
email: str,
|
|
90
|
+
code: str,
|
|
91
|
+
*,
|
|
92
|
+
timeout: float = 30.0,
|
|
93
|
+
transport: Optional[httpx.BaseTransport] = None,
|
|
94
|
+
verify: bool = True,
|
|
95
|
+
) -> Tuple[str, int, Dict[str, Any]]:
|
|
96
|
+
"""Exchange the code for a session token. Returns ``(token, expires_in_secs, user)``."""
|
|
97
|
+
try:
|
|
98
|
+
with httpx.Client(
|
|
99
|
+
base_url=base_url.rstrip("/"),
|
|
100
|
+
timeout=timeout,
|
|
101
|
+
transport=transport,
|
|
102
|
+
verify=verify,
|
|
103
|
+
headers=_request_id_header(),
|
|
104
|
+
) as client:
|
|
105
|
+
response = client.post(
|
|
106
|
+
"/api/auth/otp/verify", json={"email": email, "code": code}
|
|
107
|
+
)
|
|
108
|
+
except httpx.RequestError as exc:
|
|
109
|
+
raise _network_error(base_url, exc)
|
|
110
|
+
|
|
111
|
+
if response.status_code == 401:
|
|
112
|
+
raise AuthError(
|
|
113
|
+
"That code didn't match or has expired. Sign in again with fp login.",
|
|
114
|
+
request_id=_request_id_of(response),
|
|
115
|
+
)
|
|
116
|
+
if response.status_code == 429:
|
|
117
|
+
raise ApiError(
|
|
118
|
+
"Too many attempts — wait a bit, then run fp login again.",
|
|
119
|
+
status=429,
|
|
120
|
+
request_id=_request_id_of(response),
|
|
121
|
+
)
|
|
122
|
+
if response.status_code >= 400:
|
|
123
|
+
# The dashboard proxy collapses the server's wrong/expired-code 401 into a 500 (its
|
|
124
|
+
# `await res.json()` throws on the server's empty 401 body). So a non-401 4xx/5xx at the
|
|
125
|
+
# verify step is, in practice, a bad/expired code — surface it as a clean auth failure,
|
|
126
|
+
# not a raw "HTTP 500". (Real unreachability is a NetworkError, handled above.)
|
|
127
|
+
raise AuthError(
|
|
128
|
+
"That code didn't match or has expired. Sign in again with fp login.",
|
|
129
|
+
request_id=_request_id_of(response),
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
token = response.cookies.get("ae_session")
|
|
133
|
+
if not token:
|
|
134
|
+
raise AuthError("The dashboard did not return a session token.")
|
|
135
|
+
|
|
136
|
+
try:
|
|
137
|
+
body = response.json()
|
|
138
|
+
except Exception:
|
|
139
|
+
body = {}
|
|
140
|
+
if not isinstance(body, dict):
|
|
141
|
+
body = {}
|
|
142
|
+
|
|
143
|
+
try:
|
|
144
|
+
expires_in = int(body.get("expires_in_secs"))
|
|
145
|
+
except (TypeError, ValueError):
|
|
146
|
+
expires_in = 86400
|
|
147
|
+
|
|
148
|
+
user = body.get("user") or {}
|
|
149
|
+
if not isinstance(user, dict):
|
|
150
|
+
user = {}
|
|
151
|
+
|
|
152
|
+
return token, expires_in, user
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
#: Sent at start and required back. A Cloud from before this feature's server half
|
|
156
|
+
#: drops the field and would end the request in a machine key, so a missing echo
|
|
157
|
+
#: means "no browser login here": nothing gets approved, and nothing gets minted.
|
|
158
|
+
BROWSER_LOGIN_KIND = "session"
|
|
159
|
+
|
|
160
|
+
#: A poll stalled on a bad connection freezes the countdown and the Esc key with it.
|
|
161
|
+
_POLL_TIMEOUT_SECS = 10.0
|
|
162
|
+
|
|
163
|
+
# Controls (a terminal executes them), bidi overrides and isolates, and zero-width
|
|
164
|
+
# formatting. Same set as `displayText` in the npm CLI's `cloud-login.ts`.
|
|
165
|
+
_INVISIBLE = re.compile(
|
|
166
|
+
"[\u0000-\u001f\u007f-\u009f---]"
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
#: What a session token can be and still be sent back on every later request. A real one is
|
|
171
|
+
#: 64 hex characters; a cookie or a header can't carry a control or a non-ASCII character.
|
|
172
|
+
_SESSION_TOKEN = re.compile(r"[A-Za-z0-9._~+/=-]{1,4096}")
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def display_text(value: Any, max_chars: int = 200) -> Optional[str]:
|
|
176
|
+
"""A server-supplied string made safe to print, or ``None`` if nothing is left."""
|
|
177
|
+
if not isinstance(value, str):
|
|
178
|
+
return None
|
|
179
|
+
return _INVISIBLE.sub("", value).strip()[:max_chars] or None
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def _machine_label() -> str:
|
|
183
|
+
"""This machine's name, always sendable. Python hands back a hostname's non-UTF-8 bytes
|
|
184
|
+
as surrogates, which JSON can't carry, and the server refuses a label with nothing in it."""
|
|
185
|
+
name = socket.gethostname().encode("utf-8", "replace").decode("utf-8")
|
|
186
|
+
return display_text(name) or "unknown"
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def _within(value: Any, low: float, high: float, fallback: float) -> float:
|
|
190
|
+
"""A server's number, kept to a range this client can live with."""
|
|
191
|
+
if isinstance(value, bool) or not isinstance(value, (int, float)):
|
|
192
|
+
return fallback
|
|
193
|
+
# `isfinite` only on a float: JSON integers have no size limit, and past a float's
|
|
194
|
+
# range it raises instead of answering.
|
|
195
|
+
if (isinstance(value, float) and not math.isfinite(value)) or value <= 0:
|
|
196
|
+
return fallback
|
|
197
|
+
return min(high, max(low, value))
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def _is_openable(url: Any) -> bool:
|
|
201
|
+
"""Only a plain http(s) link is printed or handed to the opener: it comes from the
|
|
202
|
+
server, and ``xdg-open`` will act on any scheme it knows."""
|
|
203
|
+
if not isinstance(url, str) or not all(33 <= ord(c) < 127 for c in url):
|
|
204
|
+
return False
|
|
205
|
+
try:
|
|
206
|
+
parts = urlsplit(url)
|
|
207
|
+
return parts.scheme in ("http", "https") and bool(parts.hostname) and parts.port != 0
|
|
208
|
+
except ValueError: # malformed, or `.port` past 65535
|
|
209
|
+
return False
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
def can_open_browser(
|
|
213
|
+
env: Mapping[str, str] = os.environ, platform: str = sys.platform
|
|
214
|
+
) -> bool:
|
|
215
|
+
"""False over SSH, where a browser would start on the remote machine, and on a Linux
|
|
216
|
+
box with no display. A guess: being wrong costs a browser that doesn't appear next to
|
|
217
|
+
a link that is printed anyway."""
|
|
218
|
+
if env.get("SSH_CONNECTION") or env.get("SSH_CLIENT") or env.get("SSH_TTY"):
|
|
219
|
+
return False
|
|
220
|
+
if platform.startswith("linux") and not env.get("DISPLAY") and not env.get("WAYLAND_DISPLAY"):
|
|
221
|
+
return False
|
|
222
|
+
return True
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
def open_url(url: str, platform: str = sys.platform) -> None:
|
|
226
|
+
"""Open a link with the platform's handler. Never raises: the link is on screen.
|
|
227
|
+
|
|
228
|
+
Not ``webbrowser``: it falls back to text browsers like lynx, which would take over
|
|
229
|
+
this terminal in the middle of the login box."""
|
|
230
|
+
try:
|
|
231
|
+
if platform == "win32":
|
|
232
|
+
os.startfile(url) # type: ignore[attr-defined]
|
|
233
|
+
return
|
|
234
|
+
subprocess.Popen(
|
|
235
|
+
["open" if platform == "darwin" else "xdg-open", url],
|
|
236
|
+
stdin=subprocess.DEVNULL,
|
|
237
|
+
stdout=subprocess.DEVNULL,
|
|
238
|
+
stderr=subprocess.DEVNULL,
|
|
239
|
+
start_new_session=True,
|
|
240
|
+
)
|
|
241
|
+
except OSError:
|
|
242
|
+
pass
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
def _post_login(
|
|
246
|
+
base_url: str,
|
|
247
|
+
path: str,
|
|
248
|
+
body: Dict[str, Any],
|
|
249
|
+
*,
|
|
250
|
+
timeout: float,
|
|
251
|
+
transport: Optional[httpx.BaseTransport],
|
|
252
|
+
verify: bool,
|
|
253
|
+
) -> httpx.Response:
|
|
254
|
+
try:
|
|
255
|
+
with httpx.Client(
|
|
256
|
+
base_url=base_url.rstrip("/"),
|
|
257
|
+
timeout=timeout,
|
|
258
|
+
transport=transport,
|
|
259
|
+
verify=verify,
|
|
260
|
+
headers=_request_id_header(),
|
|
261
|
+
) as client:
|
|
262
|
+
return client.post(path, json=body)
|
|
263
|
+
except httpx.RequestError as exc:
|
|
264
|
+
raise _network_error(base_url, exc)
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
def _json_object(response: httpx.Response) -> Optional[Dict[str, Any]]:
|
|
268
|
+
try:
|
|
269
|
+
body = response.json()
|
|
270
|
+
except Exception:
|
|
271
|
+
return None
|
|
272
|
+
return body if isinstance(body, dict) else None
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
@dataclass(frozen=True)
|
|
276
|
+
class BrowserLogin:
|
|
277
|
+
verification_url: str
|
|
278
|
+
poll_secret: str
|
|
279
|
+
expires_in: float
|
|
280
|
+
interval: float
|
|
281
|
+
started: float = field(default_factory=time.monotonic, compare=False)
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
def start_browser_login(
|
|
285
|
+
base_url: str,
|
|
286
|
+
*,
|
|
287
|
+
timeout: float = 30.0,
|
|
288
|
+
transport: Optional[httpx.BaseTransport] = None,
|
|
289
|
+
verify: bool = True,
|
|
290
|
+
) -> Optional[BrowserLogin]:
|
|
291
|
+
"""Open a login request. ``None`` means this Cloud can't do browser login, and the
|
|
292
|
+
emailed code still works."""
|
|
293
|
+
response = _post_login(
|
|
294
|
+
base_url,
|
|
295
|
+
"/api/auth/cli/start",
|
|
296
|
+
{
|
|
297
|
+
"machine_label": _machine_label(),
|
|
298
|
+
"machine_os": "macOS" if sys.platform == "darwin" else platform_info.system().lower(),
|
|
299
|
+
"cli_version": f"fp {__version__}",
|
|
300
|
+
"kind": BROWSER_LOGIN_KIND,
|
|
301
|
+
},
|
|
302
|
+
timeout=timeout,
|
|
303
|
+
transport=transport,
|
|
304
|
+
verify=verify,
|
|
305
|
+
)
|
|
306
|
+
status = response.status_code
|
|
307
|
+
body = _json_object(response)
|
|
308
|
+
# No such route, the web app redirecting an unknown path, or serving a page in its
|
|
309
|
+
# place: a Cloud from before browser login. Not an error.
|
|
310
|
+
if status == 404 or 300 <= status < 400 or (status == 200 and body is None):
|
|
311
|
+
return None
|
|
312
|
+
request_id = _request_id_of(response)
|
|
313
|
+
if status == 429:
|
|
314
|
+
raise ApiError(
|
|
315
|
+
"Too many login attempts from here — wait a minute, then run fp login again.",
|
|
316
|
+
status=429,
|
|
317
|
+
request_id=request_id,
|
|
318
|
+
)
|
|
319
|
+
if status >= 500:
|
|
320
|
+
raise NetworkError(
|
|
321
|
+
f"FailproofAI Cloud at {base_url} answered HTTP {status}.", request_id=request_id
|
|
322
|
+
)
|
|
323
|
+
if status != 201 or body is None:
|
|
324
|
+
raise ApiError(
|
|
325
|
+
f"Could not start a browser login (HTTP {status}).", status=status, request_id=request_id
|
|
326
|
+
)
|
|
327
|
+
url = body.get("verification_url")
|
|
328
|
+
secret = body.get("poll_secret")
|
|
329
|
+
if body.get("kind") != BROWSER_LOGIN_KIND or not _is_openable(url):
|
|
330
|
+
return None
|
|
331
|
+
if not isinstance(secret, str) or not secret:
|
|
332
|
+
return None
|
|
333
|
+
return BrowserLogin(
|
|
334
|
+
verification_url=url,
|
|
335
|
+
poll_secret=secret,
|
|
336
|
+
expires_in=_within(body.get("expires_in"), 30, 3600, 600),
|
|
337
|
+
interval=_within(body.get("interval"), 1, 30, 2),
|
|
338
|
+
)
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
def poll_browser_login(
|
|
342
|
+
base_url: str,
|
|
343
|
+
poll_secret: str,
|
|
344
|
+
*,
|
|
345
|
+
timeout: float = _POLL_TIMEOUT_SECS,
|
|
346
|
+
transport: Optional[httpx.BaseTransport] = None,
|
|
347
|
+
verify: bool = True,
|
|
348
|
+
) -> str:
|
|
349
|
+
"""One "approved yet?". Raises ``NetworkError`` for anything worth trying again."""
|
|
350
|
+
response = _post_login(
|
|
351
|
+
base_url,
|
|
352
|
+
"/api/auth/cli/poll",
|
|
353
|
+
{"poll_secret": poll_secret},
|
|
354
|
+
timeout=timeout,
|
|
355
|
+
transport=transport,
|
|
356
|
+
verify=verify,
|
|
357
|
+
)
|
|
358
|
+
if response.status_code == 404:
|
|
359
|
+
return "unknown"
|
|
360
|
+
body = _json_object(response)
|
|
361
|
+
if response.status_code != 200 or body is None:
|
|
362
|
+
raise NetworkError(
|
|
363
|
+
f"FailproofAI Cloud at {base_url} answered HTTP {response.status_code}.",
|
|
364
|
+
request_id=_request_id_of(response),
|
|
365
|
+
)
|
|
366
|
+
status = body.get("status")
|
|
367
|
+
known = ("pending", "slow_down", "approved", "denied", "expired", "claimed")
|
|
368
|
+
return status if status in known else "unknown"
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
def await_browser_approval(
|
|
372
|
+
base_url: str,
|
|
373
|
+
login: BrowserLogin,
|
|
374
|
+
*,
|
|
375
|
+
tick: Callable[[float, bool], None],
|
|
376
|
+
timeout: float = _POLL_TIMEOUT_SECS,
|
|
377
|
+
transport: Optional[httpx.BaseTransport] = None,
|
|
378
|
+
verify: bool = True,
|
|
379
|
+
) -> str:
|
|
380
|
+
"""Poll until the person answers or the link runs out; returns the final status.
|
|
381
|
+
|
|
382
|
+
``tick(seconds_left, offline)`` waits a moment and may draw; it is how the caller
|
|
383
|
+
stays responsive, and how a key press gets to cancel. A dropped connection is not
|
|
384
|
+
an answer, so polling carries on through it.
|
|
385
|
+
"""
|
|
386
|
+
deadline = login.started + login.expires_in # not from now: Tab can come back to a link
|
|
387
|
+
next_poll = time.monotonic() + login.interval
|
|
388
|
+
offline = False
|
|
389
|
+
while True:
|
|
390
|
+
now = time.monotonic()
|
|
391
|
+
if now >= deadline:
|
|
392
|
+
return "expired"
|
|
393
|
+
tick(deadline - now, offline)
|
|
394
|
+
if time.monotonic() < next_poll:
|
|
395
|
+
continue
|
|
396
|
+
try:
|
|
397
|
+
status = poll_browser_login(
|
|
398
|
+
base_url,
|
|
399
|
+
login.poll_secret,
|
|
400
|
+
timeout=min(timeout, _POLL_TIMEOUT_SECS),
|
|
401
|
+
transport=transport,
|
|
402
|
+
verify=verify,
|
|
403
|
+
)
|
|
404
|
+
offline = False
|
|
405
|
+
except NetworkError:
|
|
406
|
+
status, offline = "pending", True
|
|
407
|
+
if status not in ("pending", "slow_down"):
|
|
408
|
+
return status
|
|
409
|
+
next_poll = time.monotonic() + login.interval + (1 if status == "slow_down" else 0)
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
def claim_browser_login(
|
|
413
|
+
base_url: str,
|
|
414
|
+
poll_secret: str,
|
|
415
|
+
*,
|
|
416
|
+
timeout: float = 30.0,
|
|
417
|
+
transport: Optional[httpx.BaseTransport] = None,
|
|
418
|
+
verify: bool = True,
|
|
419
|
+
) -> Tuple[str, int, Dict[str, Any]]:
|
|
420
|
+
"""Collect the session, once. Returns ``(token, expires_in_secs, user)``, the same
|
|
421
|
+
shape as :func:`verify_otp`."""
|
|
422
|
+
response = _post_login(
|
|
423
|
+
base_url,
|
|
424
|
+
"/api/auth/cli/claim",
|
|
425
|
+
{"poll_secret": poll_secret},
|
|
426
|
+
timeout=timeout,
|
|
427
|
+
transport=transport,
|
|
428
|
+
verify=verify,
|
|
429
|
+
)
|
|
430
|
+
request_id = _request_id_of(response)
|
|
431
|
+
if response.status_code >= 500:
|
|
432
|
+
raise NetworkError(
|
|
433
|
+
f"FailproofAI Cloud at {base_url} answered HTTP {response.status_code}.",
|
|
434
|
+
hint="run fp login again",
|
|
435
|
+
request_id=request_id,
|
|
436
|
+
)
|
|
437
|
+
body = _json_object(response) or {}
|
|
438
|
+
token = body.get("session_token")
|
|
439
|
+
user = body.get("user")
|
|
440
|
+
user = user if isinstance(user, dict) else {}
|
|
441
|
+
user_id, email = display_text(user.get("id")), display_text(user.get("email"))
|
|
442
|
+
# No identity is no login: `persist_session` keeps the previous one when a field is
|
|
443
|
+
# missing, which would save this session under whoever was signed in before.
|
|
444
|
+
if (
|
|
445
|
+
response.status_code != 201
|
|
446
|
+
or not isinstance(token, str)
|
|
447
|
+
or not _SESSION_TOKEN.fullmatch(token)
|
|
448
|
+
or not user_id
|
|
449
|
+
or not email
|
|
450
|
+
):
|
|
451
|
+
raise AuthError(
|
|
452
|
+
"That login can't be finished any more.",
|
|
453
|
+
hint="run fp login again",
|
|
454
|
+
request_id=request_id,
|
|
455
|
+
)
|
|
456
|
+
# The server's own range for a session lifetime. Past it `timedelta` raises on saving.
|
|
457
|
+
expires_in = int(_within(body.get("expires_in_secs"), 60, 30 * 86400, 86400))
|
|
458
|
+
return token, expires_in, {"id": user_id, "email": email}
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
def persist_session(
|
|
462
|
+
cfg: CliConfig,
|
|
463
|
+
base_url: str,
|
|
464
|
+
token: str,
|
|
465
|
+
expires_in_secs: int,
|
|
466
|
+
user: Dict[str, Any],
|
|
467
|
+
*,
|
|
468
|
+
insecure: bool = False,
|
|
469
|
+
org: Optional[str] = None,
|
|
470
|
+
now: Optional[datetime] = None,
|
|
471
|
+
) -> CliConfig:
|
|
472
|
+
now = now or datetime.now(timezone.utc)
|
|
473
|
+
cfg.base_url = base_url
|
|
474
|
+
cfg.session_token = token
|
|
475
|
+
cfg.expires_at = _iso(now + timedelta(seconds=expires_in_secs))
|
|
476
|
+
cfg.email = (user or {}).get("email") or cfg.email
|
|
477
|
+
cfg.user_id = (user or {}).get("id") or cfg.user_id
|
|
478
|
+
cfg.insecure = insecure
|
|
479
|
+
if org is not None:
|
|
480
|
+
cfg.org = org # active tenant chosen at login
|
|
481
|
+
save_config(cfg)
|
|
482
|
+
return cfg
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
def logout(
|
|
486
|
+
base_url: str,
|
|
487
|
+
token: Optional[str],
|
|
488
|
+
*,
|
|
489
|
+
timeout: float = 30.0,
|
|
490
|
+
transport: Optional[httpx.BaseTransport] = None,
|
|
491
|
+
verify: bool = True,
|
|
492
|
+
) -> None:
|
|
493
|
+
"""Best-effort server-side session revocation; never raises."""
|
|
494
|
+
if not token:
|
|
495
|
+
return
|
|
496
|
+
try:
|
|
497
|
+
with httpx.Client(
|
|
498
|
+
base_url=base_url.rstrip("/"),
|
|
499
|
+
cookies={"ae_session": token},
|
|
500
|
+
headers=_request_id_header(),
|
|
501
|
+
timeout=timeout,
|
|
502
|
+
transport=transport,
|
|
503
|
+
verify=verify,
|
|
504
|
+
) as client:
|
|
505
|
+
client.post("/api/auth/logout")
|
|
506
|
+
except httpx.RequestError:
|
|
507
|
+
pass
|