From c19bfbed5eed67758e735fb477c8c6c2afff9e7a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 24 Jul 2026 17:49:43 +0000 Subject: [PATCH 1/2] feat: Add browser telemetry to managed auth connections --- .stats.yml | 4 +- src/kernel/resources/auth/connections.py | 38 ++++++++- .../types/auth/connection_create_params.py | 44 +++++++++- .../types/auth/connection_login_params.py | 47 ++++++++++- .../types/auth/connection_update_params.py | 44 +++++++++- src/kernel/types/auth/managed_auth.py | 42 ++++++++++ tests/api_resources/auth/test_connections.py | 84 +++++++++++++++++++ 7 files changed, 297 insertions(+), 6 deletions(-) diff --git a/.stats.yml b/.stats.yml index c9122258..d1ed25e5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 127 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-477bd1ff6f7053f2bd4687d7c5fc9a6a1d56a584be42f927abc6fc858ff35718.yml -openapi_spec_hash: 3bf4cc824f6497c4ad109abd3187eede +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-a4b8f40deaf572d0dab92ebe0cafa865e1357a18f8720c3f003810da89aa4203.yml +openapi_spec_hash: d06e9bf804151f7d9f7fab77f2e1669c config_hash: 77ee715aa17061166f9a02b264a21b8d diff --git a/src/kernel/resources/auth/connections.py b/src/kernel/resources/auth/connections.py index 05de4f04..f5f4529a 100644 --- a/src/kernel/resources/auth/connections.py +++ b/src/kernel/resources/auth/connections.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Dict, cast +from typing import Any, Dict, Optional, cast from typing_extensions import Literal import httpx @@ -66,6 +66,7 @@ def create( profile_name: str, allowed_domains: SequenceNotStr[str] | Omit = omit, auto_reauth: bool | Omit = omit, + browser_telemetry: Optional[connection_create_params.BrowserTelemetry] | Omit = omit, credential: connection_create_params.Credential | Omit = omit, health_check_interval: int | Omit = omit, health_checks: bool | Omit = omit, @@ -119,6 +120,10 @@ def create( false, expired sessions are marked as `NEEDS_AUTH` instead of attempting re-auth. Defaults to true. + browser_telemetry: Browser telemetry configuration used by this connection's browser sessions by + default. Uses the exact create-browser configuration. Can be overridden + per-login. + credential: Reference to credentials for the auth connection. Use one of: @@ -166,6 +171,7 @@ def create( "profile_name": profile_name, "allowed_domains": allowed_domains, "auto_reauth": auto_reauth, + "browser_telemetry": browser_telemetry, "credential": credential, "health_check_interval": health_check_interval, "health_checks": health_checks, @@ -223,6 +229,7 @@ def update( *, allowed_domains: SequenceNotStr[str] | Omit = omit, auto_reauth: bool | Omit = omit, + browser_telemetry: Optional[connection_update_params.BrowserTelemetry] | Omit = omit, credential: connection_update_params.Credential | Omit = omit, health_check_interval: int | Omit = omit, health_checks: bool | Omit = omit, @@ -253,6 +260,10 @@ def update( when `health_checks` is false. When false, expired sessions detected by a health check are marked as `NEEDS_AUTH` instead of attempting re-auth. + browser_telemetry: Browser telemetry configuration used by future browser sessions for this + connection. Uses the exact create-browser configuration. Set enabled to false to + disable telemetry. + credential: Reference to credentials for the auth connection. Use one of: @@ -294,6 +305,7 @@ def update( { "allowed_domains": allowed_domains, "auto_reauth": auto_reauth, + "browser_telemetry": browser_telemetry, "credential": credential, "health_check_interval": health_check_interval, "health_checks": health_checks, @@ -452,6 +464,7 @@ def login( self, id: str, *, + browser_telemetry: Optional[connection_login_params.BrowserTelemetry] | Omit = omit, proxy: connection_login_params.Proxy | Omit = omit, record_session: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -468,6 +481,10 @@ def login( credentials are stored. Args: + browser_telemetry: Override the connection's default browser telemetry configuration for this + login. When omitted, the connection's browser_telemetry default is used. Uses + the exact create-browser configuration. + proxy: Proxy selection. Provide either id or name. The proxy must be in the same project as the resource referencing it. When selecting by name, the name must match exactly one active proxy in the project. Ambiguous names return a 400; use @@ -490,6 +507,7 @@ def login( path_template("/auth/connections/{id}/login", id=id), body=maybe_transform( { + "browser_telemetry": browser_telemetry, "proxy": proxy, "record_session": record_session, }, @@ -657,6 +675,7 @@ async def create( profile_name: str, allowed_domains: SequenceNotStr[str] | Omit = omit, auto_reauth: bool | Omit = omit, + browser_telemetry: Optional[connection_create_params.BrowserTelemetry] | Omit = omit, credential: connection_create_params.Credential | Omit = omit, health_check_interval: int | Omit = omit, health_checks: bool | Omit = omit, @@ -710,6 +729,10 @@ async def create( false, expired sessions are marked as `NEEDS_AUTH` instead of attempting re-auth. Defaults to true. + browser_telemetry: Browser telemetry configuration used by this connection's browser sessions by + default. Uses the exact create-browser configuration. Can be overridden + per-login. + credential: Reference to credentials for the auth connection. Use one of: @@ -757,6 +780,7 @@ async def create( "profile_name": profile_name, "allowed_domains": allowed_domains, "auto_reauth": auto_reauth, + "browser_telemetry": browser_telemetry, "credential": credential, "health_check_interval": health_check_interval, "health_checks": health_checks, @@ -814,6 +838,7 @@ async def update( *, allowed_domains: SequenceNotStr[str] | Omit = omit, auto_reauth: bool | Omit = omit, + browser_telemetry: Optional[connection_update_params.BrowserTelemetry] | Omit = omit, credential: connection_update_params.Credential | Omit = omit, health_check_interval: int | Omit = omit, health_checks: bool | Omit = omit, @@ -844,6 +869,10 @@ async def update( when `health_checks` is false. When false, expired sessions detected by a health check are marked as `NEEDS_AUTH` instead of attempting re-auth. + browser_telemetry: Browser telemetry configuration used by future browser sessions for this + connection. Uses the exact create-browser configuration. Set enabled to false to + disable telemetry. + credential: Reference to credentials for the auth connection. Use one of: @@ -885,6 +914,7 @@ async def update( { "allowed_domains": allowed_domains, "auto_reauth": auto_reauth, + "browser_telemetry": browser_telemetry, "credential": credential, "health_check_interval": health_check_interval, "health_checks": health_checks, @@ -1043,6 +1073,7 @@ async def login( self, id: str, *, + browser_telemetry: Optional[connection_login_params.BrowserTelemetry] | Omit = omit, proxy: connection_login_params.Proxy | Omit = omit, record_session: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1059,6 +1090,10 @@ async def login( credentials are stored. Args: + browser_telemetry: Override the connection's default browser telemetry configuration for this + login. When omitted, the connection's browser_telemetry default is used. Uses + the exact create-browser configuration. + proxy: Proxy selection. Provide either id or name. The proxy must be in the same project as the resource referencing it. When selecting by name, the name must match exactly one active proxy in the project. Ambiguous names return a 400; use @@ -1081,6 +1116,7 @@ async def login( path_template("/auth/connections/{id}/login", id=id), body=await async_maybe_transform( { + "browser_telemetry": browser_telemetry, "proxy": proxy, "record_session": record_session, }, diff --git a/src/kernel/types/auth/connection_create_params.py b/src/kernel/types/auth/connection_create_params.py index 0113d062..ed94bf37 100644 --- a/src/kernel/types/auth/connection_create_params.py +++ b/src/kernel/types/auth/connection_create_params.py @@ -2,11 +2,13 @@ from __future__ import annotations +from typing import Optional from typing_extensions import Required, TypedDict from ..._types import SequenceNotStr +from ..browsers.browser_telemetry_categories_config_param import BrowserTelemetryCategoriesConfigParam -__all__ = ["ConnectionCreateParams", "Credential", "Proxy"] +__all__ = ["ConnectionCreateParams", "BrowserTelemetry", "Credential", "Proxy"] class ConnectionCreateParams(TypedDict, total=False): @@ -52,6 +54,13 @@ class ConnectionCreateParams(TypedDict, total=False): re-auth. Defaults to true. """ + browser_telemetry: Optional[BrowserTelemetry] + """ + Browser telemetry configuration used by this connection's browser sessions by + default. Uses the exact create-browser configuration. Can be overridden + per-login. + """ + credential: Credential """Reference to credentials for the auth connection. Use one of: @@ -102,6 +111,39 @@ class ConnectionCreateParams(TypedDict, total=False): """ +class BrowserTelemetry(TypedDict, total=False): + """ + Browser telemetry configuration used by this connection's browser sessions by default. Uses the exact create-browser configuration. Can be overridden per-login. + """ + + browser: BrowserTelemetryCategoriesConfigParam + """Per-category capture flags. + + The operational categories (control, connection, system, captcha) are captured + whenever telemetry is enabled; set one to enabled=false to opt out. The CDP + categories (console, network, page, interaction) and screenshot are off by + default; set enabled=true to opt in. On create, provided categories layer onto + the default set. On update, provided categories merge onto the session's current + config; when no telemetry is active this falls back to the default set (matching + create). If browser is omitted or empty, the default set is used. A browser + config that disables every category stops capture on update and starts no + capture on create. + """ + + enabled: bool + """Request shortcut for browser telemetry capture. + + True enables capture; with no browser category settings it captures the default + set (control, connection, system, captcha), and any browser category settings + are layered onto that default set. On update, enabled=true resolves the config + fresh from the default set plus any provided categories, replacing the session's + current selection rather than merging onto it; omit enabled to merge categories + onto the current selection instead. False stops capture on update and starts no + capture on create. enabled=false cannot be combined with browser category + settings. + """ + + class Credential(TypedDict, total=False): """Reference to credentials for the auth connection. diff --git a/src/kernel/types/auth/connection_login_params.py b/src/kernel/types/auth/connection_login_params.py index 6cfa737a..719ea678 100644 --- a/src/kernel/types/auth/connection_login_params.py +++ b/src/kernel/types/auth/connection_login_params.py @@ -2,12 +2,23 @@ from __future__ import annotations +from typing import Optional from typing_extensions import TypedDict -__all__ = ["ConnectionLoginParams", "Proxy"] +from ..browsers.browser_telemetry_categories_config_param import BrowserTelemetryCategoriesConfigParam + +__all__ = ["ConnectionLoginParams", "BrowserTelemetry", "Proxy"] class ConnectionLoginParams(TypedDict, total=False): + browser_telemetry: Optional[BrowserTelemetry] + """Override the connection's default browser telemetry configuration for this + login. + + When omitted, the connection's browser_telemetry default is used. Uses the exact + create-browser configuration. + """ + proxy: Proxy """Proxy selection. @@ -24,6 +35,40 @@ class ConnectionLoginParams(TypedDict, total=False): """ +class BrowserTelemetry(TypedDict, total=False): + """Override the connection's default browser telemetry configuration for this login. + + When omitted, the connection's browser_telemetry default is used. Uses the exact create-browser configuration. + """ + + browser: BrowserTelemetryCategoriesConfigParam + """Per-category capture flags. + + The operational categories (control, connection, system, captcha) are captured + whenever telemetry is enabled; set one to enabled=false to opt out. The CDP + categories (console, network, page, interaction) and screenshot are off by + default; set enabled=true to opt in. On create, provided categories layer onto + the default set. On update, provided categories merge onto the session's current + config; when no telemetry is active this falls back to the default set (matching + create). If browser is omitted or empty, the default set is used. A browser + config that disables every category stops capture on update and starts no + capture on create. + """ + + enabled: bool + """Request shortcut for browser telemetry capture. + + True enables capture; with no browser category settings it captures the default + set (control, connection, system, captcha), and any browser category settings + are layered onto that default set. On update, enabled=true resolves the config + fresh from the default set plus any provided categories, replacing the session's + current selection rather than merging onto it; omit enabled to merge categories + onto the current selection instead. False stops capture on update and starts no + capture on create. enabled=false cannot be combined with browser category + settings. + """ + + class Proxy(TypedDict, total=False): """Proxy selection. diff --git a/src/kernel/types/auth/connection_update_params.py b/src/kernel/types/auth/connection_update_params.py index 20bc98ab..a14d486a 100644 --- a/src/kernel/types/auth/connection_update_params.py +++ b/src/kernel/types/auth/connection_update_params.py @@ -2,11 +2,13 @@ from __future__ import annotations +from typing import Optional from typing_extensions import TypedDict from ..._types import SequenceNotStr +from ..browsers.browser_telemetry_categories_config_param import BrowserTelemetryCategoriesConfigParam -__all__ = ["ConnectionUpdateParams", "Credential", "Proxy"] +__all__ = ["ConnectionUpdateParams", "BrowserTelemetry", "Credential", "Proxy"] class ConnectionUpdateParams(TypedDict, total=False): @@ -25,6 +27,13 @@ class ConnectionUpdateParams(TypedDict, total=False): re-auth. """ + browser_telemetry: Optional[BrowserTelemetry] + """ + Browser telemetry configuration used by future browser sessions for this + connection. Uses the exact create-browser configuration. Set enabled to false to + disable telemetry. + """ + credential: Credential """Reference to credentials for the auth connection. Use one of: @@ -63,6 +72,39 @@ class ConnectionUpdateParams(TypedDict, total=False): """Whether to save credentials after every successful login""" +class BrowserTelemetry(TypedDict, total=False): + """ + Browser telemetry configuration used by future browser sessions for this connection. Uses the exact create-browser configuration. Set enabled to false to disable telemetry. + """ + + browser: BrowserTelemetryCategoriesConfigParam + """Per-category capture flags. + + The operational categories (control, connection, system, captcha) are captured + whenever telemetry is enabled; set one to enabled=false to opt out. The CDP + categories (console, network, page, interaction) and screenshot are off by + default; set enabled=true to opt in. On create, provided categories layer onto + the default set. On update, provided categories merge onto the session's current + config; when no telemetry is active this falls back to the default set (matching + create). If browser is omitted or empty, the default set is used. A browser + config that disables every category stops capture on update and starts no + capture on create. + """ + + enabled: bool + """Request shortcut for browser telemetry capture. + + True enables capture; with no browser category settings it captures the default + set (control, connection, system, captcha), and any browser category settings + are layered onto that default set. On update, enabled=true resolves the config + fresh from the default set plus any provided categories, replacing the session's + current selection rather than merging onto it; omit enabled to merge categories + onto the current selection instead. False stops capture on update and starts no + capture on create. enabled=false cannot be combined with browser category + settings. + """ + + class Credential(TypedDict, total=False): """Reference to credentials for the auth connection. diff --git a/src/kernel/types/auth/managed_auth.py b/src/kernel/types/auth/managed_auth.py index 6dfb8401..73a4d48a 100644 --- a/src/kernel/types/auth/managed_auth.py +++ b/src/kernel/types/auth/managed_auth.py @@ -5,9 +5,11 @@ from typing_extensions import Literal from ..._models import BaseModel +from ..browsers.browser_telemetry_categories_config import BrowserTelemetryCategoriesConfig __all__ = [ "ManagedAuth", + "BrowserTelemetry", "Choice", "Credential", "DiscoveredField", @@ -18,6 +20,39 @@ ] +class BrowserTelemetry(BaseModel): + """ + Browser telemetry configuration used by this connection's browser sessions by default. The exact create-browser configuration is preserved and can be overridden per-login. + """ + + browser: Optional[BrowserTelemetryCategoriesConfig] = None + """Per-category capture flags. + + The operational categories (control, connection, system, captcha) are captured + whenever telemetry is enabled; set one to enabled=false to opt out. The CDP + categories (console, network, page, interaction) and screenshot are off by + default; set enabled=true to opt in. On create, provided categories layer onto + the default set. On update, provided categories merge onto the session's current + config; when no telemetry is active this falls back to the default set (matching + create). If browser is omitted or empty, the default set is used. A browser + config that disables every category stops capture on update and starts no + capture on create. + """ + + enabled: Optional[bool] = None + """Request shortcut for browser telemetry capture. + + True enables capture; with no browser category settings it captures the default + set (control, connection, system, captcha), and any browser category settings + are layered onto that default set. On update, enabled=true resolves the config + fresh from the default set plus any provided categories, replacing the session's + current selection rather than merging onto it; omit enabled to merge categories + onto the current selection instead. False stops capture on update and starts no + capture on create. enabled=false cannot be combined with browser category + settings. + """ + + class Choice(BaseModel): """Canonical auth-flow choice awaiting user selection.""" @@ -237,6 +272,13 @@ class ManagedAuth(BaseModel): `/browsers` API. """ + browser_telemetry: Optional[BrowserTelemetry] = None + """ + Browser telemetry configuration used by this connection's browser sessions by + default. The exact create-browser configuration is preserved and can be + overridden per-login. + """ + can_reauth: Optional[bool] = None """ Whether Kernel can automatically re-authenticate this connection when the diff --git a/tests/api_resources/auth/test_connections.py b/tests/api_resources/auth/test_connections.py index 8bdbc9ad..6c7423e6 100644 --- a/tests/api_resources/auth/test_connections.py +++ b/tests/api_resources/auth/test_connections.py @@ -40,6 +40,20 @@ def test_method_create_with_all_params(self, client: Kernel) -> None: profile_name="user-123", allowed_domains=["login.netflix.com", "auth.netflix.com"], auto_reauth=True, + browser_telemetry={ + "browser": { + "captcha": {"enabled": True}, + "connection": {"enabled": True}, + "console": {"enabled": True}, + "control": {"enabled": True}, + "interaction": {"enabled": True}, + "network": {"enabled": True}, + "page": {"enabled": True}, + "screenshot": {"enabled": True}, + "system": {"enabled": True}, + }, + "enabled": True, + }, credential={ "auto": True, "name": "my-netflix-creds", @@ -143,6 +157,20 @@ def test_method_update_with_all_params(self, client: Kernel) -> None: id="id", allowed_domains=["login.netflix.com", "auth.netflix.com"], auto_reauth=True, + browser_telemetry={ + "browser": { + "captcha": {"enabled": True}, + "connection": {"enabled": True}, + "console": {"enabled": True}, + "control": {"enabled": True}, + "interaction": {"enabled": True}, + "network": {"enabled": True}, + "page": {"enabled": True}, + "screenshot": {"enabled": True}, + "system": {"enabled": True}, + }, + "enabled": True, + }, credential={ "auto": True, "name": "my-netflix-creds", @@ -331,6 +359,20 @@ def test_method_login(self, client: Kernel) -> None: def test_method_login_with_all_params(self, client: Kernel) -> None: connection = client.auth.connections.login( id="id", + browser_telemetry={ + "browser": { + "captcha": {"enabled": True}, + "connection": {"enabled": True}, + "console": {"enabled": True}, + "control": {"enabled": True}, + "interaction": {"enabled": True}, + "network": {"enabled": True}, + "page": {"enabled": True}, + "screenshot": {"enabled": True}, + "system": {"enabled": True}, + }, + "enabled": True, + }, proxy={ "id": "id", "name": "name", @@ -512,6 +554,20 @@ async def test_method_create_with_all_params(self, async_client: AsyncKernel) -> profile_name="user-123", allowed_domains=["login.netflix.com", "auth.netflix.com"], auto_reauth=True, + browser_telemetry={ + "browser": { + "captcha": {"enabled": True}, + "connection": {"enabled": True}, + "console": {"enabled": True}, + "control": {"enabled": True}, + "interaction": {"enabled": True}, + "network": {"enabled": True}, + "page": {"enabled": True}, + "screenshot": {"enabled": True}, + "system": {"enabled": True}, + }, + "enabled": True, + }, credential={ "auto": True, "name": "my-netflix-creds", @@ -615,6 +671,20 @@ async def test_method_update_with_all_params(self, async_client: AsyncKernel) -> id="id", allowed_domains=["login.netflix.com", "auth.netflix.com"], auto_reauth=True, + browser_telemetry={ + "browser": { + "captcha": {"enabled": True}, + "connection": {"enabled": True}, + "console": {"enabled": True}, + "control": {"enabled": True}, + "interaction": {"enabled": True}, + "network": {"enabled": True}, + "page": {"enabled": True}, + "screenshot": {"enabled": True}, + "system": {"enabled": True}, + }, + "enabled": True, + }, credential={ "auto": True, "name": "my-netflix-creds", @@ -803,6 +873,20 @@ async def test_method_login(self, async_client: AsyncKernel) -> None: async def test_method_login_with_all_params(self, async_client: AsyncKernel) -> None: connection = await async_client.auth.connections.login( id="id", + browser_telemetry={ + "browser": { + "captcha": {"enabled": True}, + "connection": {"enabled": True}, + "console": {"enabled": True}, + "control": {"enabled": True}, + "interaction": {"enabled": True}, + "network": {"enabled": True}, + "page": {"enabled": True}, + "screenshot": {"enabled": True}, + "system": {"enabled": True}, + }, + "enabled": True, + }, proxy={ "id": "id", "name": "name", From bad204d65648d211ae7063ee62fd3c4189077a46 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 24 Jul 2026 17:50:09 +0000 Subject: [PATCH 2/2] release: 0.83.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/kernel/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f24634e6..d34cd697 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.82.0" + ".": "0.83.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b2692c28..1d2172a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.83.0 (2026-07-24) + +Full Changelog: [v0.82.0...v0.83.0](https://github.com/kernel/kernel-python-sdk/compare/v0.82.0...v0.83.0) + +### Features + +* Add browser telemetry to managed auth connections ([c19bfbe](https://github.com/kernel/kernel-python-sdk/commit/c19bfbed5eed67758e735fb477c8c6c2afff9e7a)) + ## 0.82.0 (2026-07-23) Full Changelog: [v0.81.0...v0.82.0](https://github.com/kernel/kernel-python-sdk/compare/v0.81.0...v0.82.0) diff --git a/pyproject.toml b/pyproject.toml index f24b2fbe..adb008f1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "kernel" -version = "0.82.0" +version = "0.83.0" description = "The official Python library for the kernel API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/kernel/_version.py b/src/kernel/_version.py index c0377ac4..8457ee35 100644 --- a/src/kernel/_version.py +++ b/src/kernel/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "kernel" -__version__ = "0.82.0" # x-release-please-version +__version__ = "0.83.0" # x-release-please-version