diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b34659af..2ad9e208 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.93.0" + ".": "0.94.0" } diff --git a/.stats.yml b/.stats.yml index f9d1086b..2aae27b8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 140 +configured_endpoints: 145 diff --git a/CHANGELOG.md b/CHANGELOG.md index 36f3c12f..7e49193c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [0.94.0](https://github.com/kernel/kernel-node-sdk/compare/v0.93.0...v0.94.0) (2026-08-24) + + +### Features + +* Mirror the control/platform telemetry split into the public API ([3e6a496](https://github.com/kernel/kernel-node-sdk/commit/3e6a49697a76085176a2cc3f9a4cd8967e577813)) +* site configs: report proxy-restricted analyses ([d6ad02a](https://github.com/kernel/kernel-node-sdk/commit/d6ad02ad064cda5296b9ef7bf7364be83c92adbc)) + ## [0.93.0](https://github.com/kernel/kernel-node-sdk/compare/v0.92.0...v0.93.0) (2026-08-19) diff --git a/api.md b/api.md index fcf19cc0..79fefcce 100644 --- a/api.md +++ b/api.md @@ -62,6 +62,33 @@ Methods: - client.invocations.follow(id, { ...params }) -> InvocationFollowResponse - client.invocations.listBrowsers(id) -> InvocationListBrowsersResponse +# SiteConfigs + +Types: + +- Analysis +- AnalysisSummary +- Browser +- Evidence +- LookupRequest +- LookupResponse +- NoRecommendation +- Proxy +- Recommendation +- RecommendationResult +- RecommendationSummary +- ResolveRequest +- SiteConfigResponse +- Target + +Methods: + +- client.siteConfigs.retrieve(id) -> SiteConfigResponse +- client.siteConfigs.list({ ...params }) -> AnalysisSummariesOffsetPagination +- client.siteConfigs.listRecommendations({ ...params }) -> RecommendationSummariesOffsetPagination +- client.siteConfigs.lookup({ ...params }) -> LookupResponse +- client.siteConfigs.resolve({ ...params }) -> SiteConfigResponse + # Browsers Types: @@ -99,6 +126,8 @@ Types: - BrowserAPICallEvent - BrowserCallStack - BrowserCaptchaSolveResultEvent +- BrowserCdpCommandEvent +- BrowserCdpCommandMethod - BrowserCdpConnectEvent - BrowserCdpDisconnectEvent - BrowserConsoleErrorEvent @@ -120,6 +149,7 @@ Types: - BrowserNetworkLoadingFailedEvent - BrowserNetworkRequestEvent - BrowserNetworkResponseEvent +- BrowserPageCrashedEvent - BrowserPageDomContentLoadedEvent - BrowserPageLayoutSettledEvent - BrowserPageLayoutShiftEvent @@ -128,12 +158,15 @@ Types: - BrowserPageNavigationEvent - BrowserPageNavigationSettledEvent - BrowserPageTabOpenedEvent +- BrowserPlatformAPICallEvent - BrowserProxyErrorEvent - BrowserServiceCrashedEvent - BrowserSystemOomKillEvent - BrowserTelemetryCategoriesConfig - BrowserTelemetryCategoryConfig +- BrowserTelemetryCdpControlConfig - BrowserTelemetryConfig +- BrowserTelemetryControlConfig - BrowserTelemetryEvent - BrowserTelemetryExportConfig - BrowserTelemetryOtlpExportConfig diff --git a/package.json b/package.json index e315a4fa..9c16133c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@onkernel/sdk", - "version": "0.93.0", + "version": "0.94.0", "description": "The official TypeScript library for the Kernel API", "author": "Kernel <>", "types": "dist/index.d.ts", diff --git a/src/client.ts b/src/client.ts index 15204c68..f2e7e003 100644 --- a/src/client.ts +++ b/src/client.ts @@ -136,6 +136,29 @@ import { ProxyUpdateParams, ProxyUpdateResponse, } from './resources/proxies'; +import { + Analysis, + AnalysisSummariesOffsetPagination, + AnalysisSummary, + Browser, + Evidence, + LookupRequest, + LookupResponse, + NoRecommendation, + Proxy, + Recommendation, + RecommendationResult, + RecommendationSummariesOffsetPagination, + RecommendationSummary, + ResolveRequest, + SiteConfigListParams, + SiteConfigListRecommendationsParams, + SiteConfigLookupParams, + SiteConfigResolveParams, + SiteConfigResponse, + SiteConfigs, + Target, +} from './resources/site-configs'; import { AuditLogEntriesPageTokenPagination, AuditLogEntry, @@ -1012,6 +1035,10 @@ export class Kernel { * Invoke actions and stream or query invocation status and events. */ invocations: API.Invocations = new API.Invocations(this); + /** + * Resolve browser and proxy recommendations for bot-protected sites. + */ + siteConfigs: API.SiteConfigs = new API.SiteConfigs(this); /** * Create and manage browser sessions. */ @@ -1063,6 +1090,7 @@ export class Kernel { Kernel.Deployments = Deployments; Kernel.Apps = Apps; Kernel.Invocations = Invocations; +Kernel.SiteConfigs = SiteConfigs; Kernel.Browsers = Browsers; Kernel.Profiles = Profiles; Kernel.Auth = Auth; @@ -1128,6 +1156,30 @@ export declare namespace Kernel { type InvocationFollowParams as InvocationFollowParams, }; + export { + SiteConfigs as SiteConfigs, + type Analysis as Analysis, + type AnalysisSummary as AnalysisSummary, + type Browser as Browser, + type Evidence as Evidence, + type LookupRequest as LookupRequest, + type LookupResponse as LookupResponse, + type NoRecommendation as NoRecommendation, + type Proxy as Proxy, + type Recommendation as Recommendation, + type RecommendationResult as RecommendationResult, + type RecommendationSummary as RecommendationSummary, + type ResolveRequest as ResolveRequest, + type SiteConfigResponse as SiteConfigResponse, + type Target as Target, + type AnalysisSummariesOffsetPagination as AnalysisSummariesOffsetPagination, + type RecommendationSummariesOffsetPagination as RecommendationSummariesOffsetPagination, + type SiteConfigListParams as SiteConfigListParams, + type SiteConfigListRecommendationsParams as SiteConfigListRecommendationsParams, + type SiteConfigLookupParams as SiteConfigLookupParams, + type SiteConfigResolveParams as SiteConfigResolveParams, + }; + export { Browsers as Browsers, type BrowserMemory as BrowserMemory, diff --git a/src/resources/auth/connections.ts b/src/resources/auth/connections.ts index 04111399..c82652b6 100644 --- a/src/resources/auth/connections.ts +++ b/src/resources/auth/connections.ts @@ -549,12 +549,12 @@ export namespace ManagedAuth { * 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. + * interaction), screenshot and platform 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. */ browser?: TelemetryAPI.BrowserTelemetryCategoriesConfig; @@ -920,12 +920,12 @@ export namespace ManagedAuthBrowserConfig { * 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. + * interaction), screenshot and platform 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. */ browser?: TelemetryAPI.BrowserTelemetryCategoriesConfig; @@ -1121,12 +1121,12 @@ export namespace ManagedAuthCreateRequest { * 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. + * interaction), screenshot and platform 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. */ browser?: TelemetryAPI.BrowserTelemetryCategoriesConfig; @@ -1417,12 +1417,12 @@ export namespace ManagedAuthUpdateRequest { * 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. + * interaction), screenshot and platform 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. */ browser?: TelemetryAPI.BrowserTelemetryCategoriesConfig; @@ -2072,12 +2072,12 @@ export namespace ConnectionCreateParams { * 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. + * interaction), screenshot and platform 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. */ browser?: TelemetryAPI.BrowserTelemetryCategoriesConfig; @@ -2280,12 +2280,12 @@ export namespace ConnectionUpdateParams { * 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. + * interaction), screenshot and platform 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. */ browser?: TelemetryAPI.BrowserTelemetryCategoriesConfig; @@ -2458,12 +2458,12 @@ export namespace ConnectionLoginParams { * 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. + * interaction), screenshot and platform 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. */ browser?: TelemetryAPI.BrowserTelemetryCategoriesConfig; diff --git a/src/resources/browser-pools.ts b/src/resources/browser-pools.ts index 6726c7a9..b789b8dd 100644 --- a/src/resources/browser-pools.ts +++ b/src/resources/browser-pools.ts @@ -679,12 +679,12 @@ export namespace BrowserPoolCreateParams { * 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. + * interaction), screenshot and platform 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. */ browser?: TelemetryAPI.BrowserTelemetryCategoriesConfig; @@ -930,12 +930,12 @@ export namespace BrowserPoolUpdateParams { * 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. + * interaction), screenshot and platform 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. */ browser?: TelemetryAPI.BrowserTelemetryCategoriesConfig; @@ -1098,12 +1098,12 @@ export namespace BrowserPoolAcquireParams { * 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. + * interaction), screenshot and platform 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. */ browser?: TelemetryAPI.BrowserTelemetryCategoriesConfig; diff --git a/src/resources/browsers/browsers.ts b/src/resources/browsers/browsers.ts index fece76f4..70c7aecf 100644 --- a/src/resources/browsers/browsers.ts +++ b/src/resources/browsers/browsers.ts @@ -56,6 +56,8 @@ import { BrowserAPICallEvent, BrowserCallStack, BrowserCaptchaSolveResultEvent, + BrowserCdpCommandEvent, + BrowserCdpCommandMethod, BrowserCdpConnectEvent, BrowserCdpDisconnectEvent, BrowserConsoleErrorEvent, @@ -77,6 +79,7 @@ import { BrowserNetworkLoadingFailedEvent, BrowserNetworkRequestEvent, BrowserNetworkResponseEvent, + BrowserPageCrashedEvent, BrowserPageDomContentLoadedEvent, BrowserPageLayoutSettledEvent, BrowserPageLayoutShiftEvent, @@ -85,12 +88,15 @@ import { BrowserPageNavigationEvent, BrowserPageNavigationSettledEvent, BrowserPageTabOpenedEvent, + BrowserPlatformAPICallEvent, BrowserProxyErrorEvent, BrowserServiceCrashedEvent, BrowserSystemOomKillEvent, BrowserTelemetryCategoriesConfig, BrowserTelemetryCategoryConfig, + BrowserTelemetryCdpControlConfig, BrowserTelemetryConfig, + BrowserTelemetryControlConfig, BrowserTelemetryEvent, BrowserTelemetryExportConfig, BrowserTelemetryOtlpExportConfig, @@ -1130,7 +1136,7 @@ export interface BrowserCreateParams { /** * If true, enables GPU acceleration for the browser session. Requires Start-Up or - * Enterprise plan and headless=false. + * Enterprise plan, headless=false, and region=us-east. */ gpu?: boolean; @@ -1270,12 +1276,12 @@ export namespace BrowserCreateParams { * 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. + * interaction), screenshot and platform 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. */ browser?: TelemetryAPI.BrowserTelemetryCategoriesConfig; @@ -1428,12 +1434,12 @@ export namespace BrowserUpdateParams { * 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. + * interaction), screenshot and platform 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. */ browser?: TelemetryAPI.BrowserTelemetryCategoriesConfig; @@ -1645,6 +1651,8 @@ export declare namespace Browsers { type BrowserAPICallEvent as BrowserAPICallEvent, type BrowserCallStack as BrowserCallStack, type BrowserCaptchaSolveResultEvent as BrowserCaptchaSolveResultEvent, + type BrowserCdpCommandEvent as BrowserCdpCommandEvent, + type BrowserCdpCommandMethod as BrowserCdpCommandMethod, type BrowserCdpConnectEvent as BrowserCdpConnectEvent, type BrowserCdpDisconnectEvent as BrowserCdpDisconnectEvent, type BrowserConsoleErrorEvent as BrowserConsoleErrorEvent, @@ -1666,6 +1674,7 @@ export declare namespace Browsers { type BrowserNetworkLoadingFailedEvent as BrowserNetworkLoadingFailedEvent, type BrowserNetworkRequestEvent as BrowserNetworkRequestEvent, type BrowserNetworkResponseEvent as BrowserNetworkResponseEvent, + type BrowserPageCrashedEvent as BrowserPageCrashedEvent, type BrowserPageDomContentLoadedEvent as BrowserPageDomContentLoadedEvent, type BrowserPageLayoutSettledEvent as BrowserPageLayoutSettledEvent, type BrowserPageLayoutShiftEvent as BrowserPageLayoutShiftEvent, @@ -1674,12 +1683,15 @@ export declare namespace Browsers { type BrowserPageNavigationEvent as BrowserPageNavigationEvent, type BrowserPageNavigationSettledEvent as BrowserPageNavigationSettledEvent, type BrowserPageTabOpenedEvent as BrowserPageTabOpenedEvent, + type BrowserPlatformAPICallEvent as BrowserPlatformAPICallEvent, type BrowserProxyErrorEvent as BrowserProxyErrorEvent, type BrowserServiceCrashedEvent as BrowserServiceCrashedEvent, type BrowserSystemOomKillEvent as BrowserSystemOomKillEvent, type BrowserTelemetryCategoriesConfig as BrowserTelemetryCategoriesConfig, type BrowserTelemetryCategoryConfig as BrowserTelemetryCategoryConfig, + type BrowserTelemetryCdpControlConfig as BrowserTelemetryCdpControlConfig, type BrowserTelemetryConfig as BrowserTelemetryConfig, + type BrowserTelemetryControlConfig as BrowserTelemetryControlConfig, type BrowserTelemetryEvent as BrowserTelemetryEvent, type BrowserTelemetryExportConfig as BrowserTelemetryExportConfig, type BrowserTelemetryOtlpExportConfig as BrowserTelemetryOtlpExportConfig, diff --git a/src/resources/browsers/index.ts b/src/resources/browsers/index.ts index 70e772f4..7bd92100 100644 --- a/src/resources/browsers/index.ts +++ b/src/resources/browsers/index.ts @@ -91,6 +91,8 @@ export { type BrowserAPICallEvent, type BrowserCallStack, type BrowserCaptchaSolveResultEvent, + type BrowserCdpCommandEvent, + type BrowserCdpCommandMethod, type BrowserCdpConnectEvent, type BrowserCdpDisconnectEvent, type BrowserConsoleErrorEvent, @@ -112,6 +114,7 @@ export { type BrowserNetworkLoadingFailedEvent, type BrowserNetworkRequestEvent, type BrowserNetworkResponseEvent, + type BrowserPageCrashedEvent, type BrowserPageDomContentLoadedEvent, type BrowserPageLayoutSettledEvent, type BrowserPageLayoutShiftEvent, @@ -120,12 +123,15 @@ export { type BrowserPageNavigationEvent, type BrowserPageNavigationSettledEvent, type BrowserPageTabOpenedEvent, + type BrowserPlatformAPICallEvent, type BrowserProxyErrorEvent, type BrowserServiceCrashedEvent, type BrowserSystemOomKillEvent, type BrowserTelemetryCategoriesConfig, type BrowserTelemetryCategoryConfig, + type BrowserTelemetryCdpControlConfig, type BrowserTelemetryConfig, + type BrowserTelemetryControlConfig, type BrowserTelemetryEvent, type BrowserTelemetryExportConfig, type BrowserTelemetryOtlpExportConfig, diff --git a/src/resources/browsers/telemetry.ts b/src/resources/browsers/telemetry.ts index 42517e42..609a11dd 100644 --- a/src/resources/browsers/telemetry.ts +++ b/src/resources/browsers/telemetry.ts @@ -83,7 +83,8 @@ export class Telemetry extends APIResource { export type TelemetryEventsResponsesOffsetPagination = OffsetPagination; /** - * An agent-driven HTTP call handled by the in-VM API server. + * An agent-driven HTTP call that drives the browser, handled by the in-VM API + * server. Calls that manage the VM instead emit platform_api_call. */ export interface BrowserAPICallEvent { category: 'control'; @@ -116,7 +117,8 @@ export namespace BrowserAPICallEvent { duration_ms: number; /** - * OpenAPI operationId of the matched route (e.g. processExec, takeScreenshot). + * Matched route's operation, named as the in-VM API names its handler (e.g. + * ProcessExec, TakeScreenshot). */ operation_id: string; @@ -129,130 +131,2363 @@ export namespace BrowserAPICallEvent { * HTTP response status code. */ status: number; + + /** + * Source submitted to the Playwright code-execution endpoint, capped at 8192 bytes + * like every other captured string. A capped value is cut on a character boundary + * and ends in `...[truncated]`. Absent for every other operation. + */ + code?: string; + } +} + +/** + * CDP Runtime.StackTrace representing the JavaScript call stack at the time of an + * event. Fields use CDP naming conventions rather than snake_case to match the + * Chrome DevTools Protocol wire format. + */ +export interface BrowserCallStack { + /** + * Ordered list of call frames, outermost first. + */ + callFrames: Array; + + /** + * Optional label for the stack trace (e.g. async cause). + */ + description?: string; + + /** + * Parent stack trace for async stacks. + */ + parent?: BrowserCallStack; +} + +export namespace BrowserCallStack { + export interface CallFrame { + /** + * Zero-based column number within the line. + */ + columnNumber: number; + + /** + * JavaScript function name, or empty string for anonymous functions. + */ + functionName: string; + + /** + * Zero-based line number within the script. + */ + lineNumber: number; + + /** + * CDP script identifier. + */ + scriptId: string; + + /** + * URL or name of the script file. + */ + url: string; + } +} + +/** + * A captcha solve attempt reached a terminal outcome. + */ +export interface BrowserCaptchaSolveResultEvent { + category: 'captcha'; + + /** + * Provenance metadata identifying which producer emitted the event. + */ + source: BrowserEventSource; + + /** + * Event timestamp in Unix microseconds. + */ + ts: number; + + type: 'captcha_solve_result'; + + data?: BrowserCaptchaSolveResultEvent.Data; + + /** + * True if the data field was truncated due to size limits. + */ + truncated?: boolean; +} + +export namespace BrowserCaptchaSolveResultEvent { + export interface Data { + /** + * Captcha vendor family. Provider-specific task names are normalized into this + * set; anything not covered is reported as other. + */ + captcha_type: 'hcaptcha' | 'recaptcha_v2' | 'recaptcha_v3' | 'turnstile' | 'geetest' | 'other'; + + /** + * Wall-clock duration from solve start to terminal outcome. + */ + duration_ms: number; + + /** + * Terminal outcome. success: solver returned a usable solution. failure: solver + * returned an error (see error_code). timeout: solver did not return within the + * caller's wait budget. abandoned: caller cancelled or the page navigated away + * mid-solve. + */ + status: 'success' | 'failure' | 'timeout' | 'abandoned'; + + /** + * Solver-specific error code on failure (e.g. ERROR_CAPTCHA_UNSOLVABLE). Absent on + * success. + */ + error_code?: string; + + /** + * Solver-assigned identifier. Opaque, useful for support cross-references. + */ + task_id?: string; + + /** + * Host of the page where the captcha was solved. + */ + website_host?: string; + + /** + * Path of the page where the captcha was solved. Query string excluded. + */ + website_path?: string; + } +} + +/** + * A browser-control command a client sent over the CDP WebSocket proxy: input + * gestures, navigation, dialog handling, file selection and screenshots. + * Configuration commands and the DOM/Runtime traffic a client library issues on + * the caller's behalf are not reported. One event per browser-control command that + * reached the browser. The command stream is not sampled, coalesced or reordered. + * An event is lost only when the method is excluded by telemetry configuration, + * when the command's arguments do not decode, or when classification cannot keep + * up. Exclusions are counted in `cdp_disconnect.telemetry_excluded`; the rest in + * `cdp_disconnect.telemetry_dropped`. + */ +export interface BrowserCdpCommandEvent { + category: 'control'; + + /** + * Per-command payload for `cdp_command` events, discriminated by `method`. Each + * variant carries only the arguments approved for that command: values that could + * hold a secret — typed and composition text, URLs, referrers, scripts, templates, + * file paths, drag contents and autofill values — are replaced by a length, a + * count, a presence flag, an enum or a URL scheme and host. + */ + data: + | BrowserCdpCommandEvent.BrowserCdpInputDispatchMouseEventCommandData + | BrowserCdpCommandEvent.BrowserCdpInputDispatchKeyEventCommandData + | BrowserCdpCommandEvent.BrowserCdpInputInsertTextCommandData + | BrowserCdpCommandEvent.BrowserCdpInputImeSetCompositionCommandData + | BrowserCdpCommandEvent.BrowserCdpInputDispatchTouchEventCommandData + | BrowserCdpCommandEvent.BrowserCdpInputDispatchDragEventCommandData + | BrowserCdpCommandEvent.BrowserCdpInputCancelDraggingCommandData + | BrowserCdpCommandEvent.BrowserCdpInputEmulateTouchFromMouseEventCommandData + | BrowserCdpCommandEvent.BrowserCdpInputSynthesizePinchGestureCommandData + | BrowserCdpCommandEvent.BrowserCdpInputSynthesizeScrollGestureCommandData + | BrowserCdpCommandEvent.BrowserCdpInputSynthesizeTapGestureCommandData + | BrowserCdpCommandEvent.BrowserCdpDomSetFileInputFilesCommandData + | BrowserCdpCommandEvent.BrowserCdpDomFocusCommandData + | BrowserCdpCommandEvent.BrowserCdpDomScrollIntoViewIfNeededCommandData + | BrowserCdpCommandEvent.BrowserCdpPageBringToFrontCommandData + | BrowserCdpCommandEvent.BrowserCdpPageCaptureScreenshotCommandData + | BrowserCdpCommandEvent.BrowserCdpPageCaptureSnapshotCommandData + | BrowserCdpCommandEvent.BrowserCdpPageHandleJavaScriptDialogCommandData + | BrowserCdpCommandEvent.BrowserCdpPageNavigateCommandData + | BrowserCdpCommandEvent.BrowserCdpPageNavigateToHistoryEntryCommandData + | BrowserCdpCommandEvent.BrowserCdpPageReloadCommandData + | BrowserCdpCommandEvent.BrowserCdpPagePrintToPdfCommandData + | BrowserCdpCommandEvent.BrowserCdpPageStartScreencastCommandData + | BrowserCdpCommandEvent.BrowserCdpPageStopScreencastCommandData + | BrowserCdpCommandEvent.BrowserCdpPageStopLoadingCommandData + | BrowserCdpCommandEvent.BrowserCdpPageCloseCommandData + | BrowserCdpCommandEvent.BrowserCdpPageSetWebLifecycleStateCommandData + | BrowserCdpCommandEvent.BrowserCdpTargetActivateTargetCommandData + | BrowserCdpCommandEvent.BrowserCdpTargetCloseTargetCommandData + | BrowserCdpCommandEvent.BrowserCdpTargetCreateTargetCommandData + | BrowserCdpCommandEvent.BrowserCdpTargetCreateBrowserContextCommandData + | BrowserCdpCommandEvent.BrowserCdpTargetDisposeBrowserContextCommandData + | BrowserCdpCommandEvent.BrowserCdpTargetOpenDevToolsCommandData + | BrowserCdpCommandEvent.BrowserCdpBrowserCancelDownloadCommandData + | BrowserCdpCommandEvent.BrowserCdpBrowserCloseCommandData + | BrowserCdpCommandEvent.BrowserCdpBrowserSetWindowBoundsCommandData + | BrowserCdpCommandEvent.BrowserCdpBrowserSetContentsSizeCommandData + | BrowserCdpCommandEvent.BrowserCdpAutofillTriggerCommandData; + + /** + * Provenance metadata identifying which producer emitted the event. + */ + source: BrowserEventSource; + + /** + * Event timestamp in Unix microseconds. + */ + ts: number; + + type: 'cdp_command'; + + /** + * True if the data field was truncated due to size limits. + */ + truncated?: boolean; +} + +export namespace BrowserCdpCommandEvent { + /** + * Sanitized `Input.dispatchMouseEvent` arguments. Canonical input: + * `Input.dispatchMouseEvent` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpInputDispatchMouseEventCommandData { + /** + * Mouse event phase: `mousePressed`, `mouseReleased`, `mouseMoved` or + * `mouseWheel`. A value the protocol does not define is reported as `other`. + */ + event_type: 'mousePressed' | 'mouseReleased' | 'mouseMoved' | 'mouseWheel' | 'other'; + + method: 'Input.dispatchMouseEvent'; + + /** + * Button named by the command (`none`, `left`, `middle`, `right`, `back`, + * `forward`). A value the protocol does not define is reported as `other`. + */ + button?: 'none' | 'left' | 'middle' | 'right' | 'back' | 'forward' | 'other'; + + /** + * Bit field of buttons held down. Non-zero on a `mouseMoved` means the move is a + * drag path. + */ + buttons?: number; + + /** + * Number of times the button was clicked (2 is a double click). + */ + click_count?: number; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * Horizontal scroll delta, for `mouseWheel`. + */ + delta_x?: number; + + /** + * Vertical scroll delta, for `mouseWheel`. + */ + delta_y?: number; + + /** + * Normalized pressure, 0 to 1. + */ + force?: number; + + /** + * Bit field of held modifier keys (1=Alt, 2=Ctrl, 4=Meta, 8=Shift). + */ + modifiers?: number; + + /** + * Pointer that generated the event (`mouse` or `pen`). A value the protocol does + * not define is reported as `other`. + */ + pointer_type?: 'mouse' | 'pen' | 'other'; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + + /** + * Normalized tangential pressure, -1 to 1. + */ + tangential_pressure?: number; + + /** + * Pen tilt from the Y-Z plane, in degrees. + */ + tilt_x?: number; + + /** + * Pen tilt from the X-Z plane, in degrees. + */ + tilt_y?: number; + + /** + * Pen clockwise rotation, in degrees. + */ + twist?: number; + + /** + * Viewport x coordinate in CSS pixels. + */ + x?: number; + + /** + * Viewport y coordinate in CSS pixels. + */ + y?: number; + } + + /** + * Sanitized `Input.dispatchKeyEvent` arguments. Canonical input: + * `Input.dispatchKeyEvent` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpInputDispatchKeyEventCommandData { + /** + * Key event phase: `keyDown`, `keyUp`, `rawKeyDown` or `char`. A value the + * protocol does not define is reported as `other`. + */ + event_type: 'keyDown' | 'keyUp' | 'rawKeyDown' | 'char' | 'other'; + + method: 'Input.dispatchKeyEvent'; + + /** + * Whether the event was generated by key repeat. + */ + auto_repeat?: boolean; + + /** + * Number of editing commands (e.g. `selectAll`) carried by the event. + */ + command_count?: number; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * Whether the key is on the numeric keypad. + */ + is_keypad?: boolean; + + /** + * Whether the event is a system key event. + */ + is_system_key?: boolean; + + /** + * Keyboard location (1=left, 2=right, 3=numpad). + */ + location?: number; + + /** + * Bit field of held modifier keys (1=Alt, 2=Ctrl, 4=Meta, 8=Shift). + */ + modifiers?: number; + + /** + * Key that commands the page rather than typing into it (e.g. `Enter`, `Tab`, + * `ArrowDown`, `F5`). Keys that produce a character are never captured; those are + * counted by `text_length`. + */ + named_key?: string; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + + /** + * Number of characters the command submitted. The text itself is never captured. + */ + text_length?: number; + } + + /** + * Sanitized `Input.insertText` arguments. Canonical input: `Input.insertText` in + * devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpInputInsertTextCommandData { + method: 'Input.insertText'; + + /** + * Number of characters inserted. The text itself is never captured. + */ + text_length: number; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + } + + /** + * Sanitized `Input.imeSetComposition` arguments. Canonical input: + * `Input.imeSetComposition` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpInputImeSetCompositionCommandData { + method: 'Input.imeSetComposition'; + + /** + * Number of characters in the composition. The text itself is never captured. + */ + text_length: number; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * Replacement range end offset. + */ + replacement_end?: number; + + /** + * Replacement range start offset. + */ + replacement_start?: number; + + /** + * Selection end offset within the composition. + */ + selection_end?: number; + + /** + * Selection start offset within the composition. + */ + selection_start?: number; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + } + + /** + * Sanitized `Input.dispatchTouchEvent` arguments. Canonical input: + * `Input.dispatchTouchEvent` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpInputDispatchTouchEventCommandData { + /** + * Touch event phase: `touchStart`, `touchEnd`, `touchMove` or `touchCancel`. A + * value the protocol does not define is reported as `other`. + */ + event_type: 'touchStart' | 'touchEnd' | 'touchMove' | 'touchCancel' | 'other'; + + method: 'Input.dispatchTouchEvent'; + + /** + * Number of active touch points the command carried. + */ + touch_point_count: number; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * Normalized pressure of the first touch point, 0 to 1. + */ + force?: number; + + /** + * Bit field of held modifier keys (1=Alt, 2=Ctrl, 4=Meta, 8=Shift). + */ + modifiers?: number; + + /** + * Horizontal radius of the first touch point. + */ + radius_x?: number; + + /** + * Vertical radius of the first touch point. + */ + radius_y?: number; + + /** + * Rotation of the first touch point, in degrees. + */ + rotation_angle?: number; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + + /** + * Normalized tangential pressure of the first touch point, -1 to 1. + */ + tangential_pressure?: number; + + /** + * Tilt of the first touch point from the Y-Z plane, in degrees. + */ + tilt_x?: number; + + /** + * Tilt of the first touch point from the X-Z plane, in degrees. + */ + tilt_y?: number; + + /** + * Clockwise rotation of the first touch point, in degrees. + */ + twist?: number; + + /** + * Viewport x coordinate of the first touch point. Touch coordinates live inside + * `touchPoints`, so this is the primary point rather than a command-level + * argument. + */ + x?: number; + + /** + * Viewport y coordinate of the first touch point. + */ + y?: number; + } + + /** + * Sanitized `Input.dispatchDragEvent` arguments. Canonical input: + * `Input.dispatchDragEvent` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpInputDispatchDragEventCommandData { + /** + * Drag event phase: `dragEnter`, `dragOver`, `drop` or `dragCancel`. A value the + * protocol does not define is reported as `other`. + */ + event_type: 'dragEnter' | 'dragOver' | 'drop' | 'dragCancel' | 'other'; + + method: 'Input.dispatchDragEvent'; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * Number of files in the drag payload. File paths are never captured. + */ + drag_file_count?: number; + + /** + * Number of items in the drag payload. Item contents are never captured. + */ + drag_item_count?: number; + + /** + * Distinct top-level MIME categories of the drag items (e.g. `text`, `image`, + * `application`). Subtypes and contents are never captured. A value the protocol + * does not define is reported as `other`. + */ + drag_mime_categories?: Array< + | 'text' + | 'image' + | 'audio' + | 'video' + | 'application' + | 'font' + | 'model' + | 'multipart' + | 'message' + | 'other' + >; + + /** + * Bit field of allowed drag operations (1=copy, 2=link, 16=move). + */ + drag_operations_mask?: number; + + /** + * Bit field of held modifier keys (1=Alt, 2=Ctrl, 4=Meta, 8=Shift). + */ + modifiers?: number; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + + /** + * Viewport x coordinate in CSS pixels. + */ + x?: number; + + /** + * Viewport y coordinate in CSS pixels. + */ + y?: number; + } + + /** + * Sanitized `Input.cancelDragging` arguments. Canonical input: + * `Input.cancelDragging` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpInputCancelDraggingCommandData { + method: 'Input.cancelDragging'; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + } + + /** + * Sanitized `Input.emulateTouchFromMouseEvent` arguments. Canonical input: + * `Input.emulateTouchFromMouseEvent` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpInputEmulateTouchFromMouseEventCommandData { + /** + * Mouse event phase being emulated as touch. A value the protocol does not define + * is reported as `other`. + */ + event_type: 'mousePressed' | 'mouseReleased' | 'mouseMoved' | 'mouseWheel' | 'other'; + + method: 'Input.emulateTouchFromMouseEvent'; + + /** + * Button named by the command. A value the protocol does not define is reported as + * `other`. + */ + button?: 'none' | 'left' | 'middle' | 'right' | 'back' | 'forward' | 'other'; + + /** + * Number of times the button was clicked. + */ + click_count?: number; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * Horizontal scroll delta. + */ + delta_x?: number; + + /** + * Vertical scroll delta. + */ + delta_y?: number; + + /** + * Bit field of held modifier keys (1=Alt, 2=Ctrl, 4=Meta, 8=Shift). + */ + modifiers?: number; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + + /** + * Viewport x coordinate in CSS pixels. + */ + x?: number; + + /** + * Viewport y coordinate in CSS pixels. + */ + y?: number; + } + + /** + * Sanitized `Input.synthesizePinchGesture` arguments. Canonical input: + * `Input.synthesizePinchGesture` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpInputSynthesizePinchGestureCommandData { + method: 'Input.synthesizePinchGesture'; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * Input source the synthesized gesture emulates. A value the protocol does not + * define is reported as `other`. + */ + gesture_source_type?: 'default' | 'touch' | 'mouse' | 'other'; + + /** + * Relative pointer speed, in pixels per second. + */ + relative_speed?: number; + + /** + * Relative scale of the pinch (>1 zooms in). + */ + scale_factor?: number; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + + /** + * Viewport x coordinate in CSS pixels. + */ + x?: number; + + /** + * Viewport y coordinate in CSS pixels. + */ + y?: number; + } + + /** + * Sanitized `Input.synthesizeScrollGesture` arguments. Canonical input: + * `Input.synthesizeScrollGesture` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpInputSynthesizeScrollGestureCommandData { + method: 'Input.synthesizeScrollGesture'; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * Input source the synthesized gesture emulates. A value the protocol does not + * define is reported as `other`. + */ + gesture_source_type?: 'default' | 'touch' | 'mouse' | 'other'; + + /** + * Whether fling was suppressed. + */ + prevent_fling?: boolean; + + /** + * Number of additional repeats of the scroll. + */ + repeat_count?: number; + + /** + * Delay between repeats, in milliseconds. + */ + repeat_delay_ms?: number; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + + /** + * Swipe speed in pixels per second. + */ + speed?: number; + + /** + * Viewport x coordinate in CSS pixels. + */ + x?: number; + + /** + * Horizontal scroll distance in CSS pixels; positive scrolls left. + */ + x_distance?: number; + + /** + * Additional horizontal distance scrolled past the end. + */ + x_overscroll?: number; + + /** + * Viewport y coordinate in CSS pixels. + */ + y?: number; + + /** + * Vertical scroll distance in CSS pixels; positive scrolls up. + */ + y_distance?: number; + + /** + * Additional vertical distance scrolled past the end. + */ + y_overscroll?: number; + } + + /** + * Sanitized `Input.synthesizeTapGesture` arguments. Canonical input: + * `Input.synthesizeTapGesture` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpInputSynthesizeTapGestureCommandData { + method: 'Input.synthesizeTapGesture'; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * Duration between touchdown and touchup, in milliseconds. + */ + duration?: number; + + /** + * Input source the synthesized gesture emulates. A value the protocol does not + * define is reported as `other`. + */ + gesture_source_type?: 'default' | 'touch' | 'mouse' | 'other'; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + + /** + * Number of times to tap (2 is a double tap). + */ + tap_count?: number; + + /** + * Viewport x coordinate in CSS pixels. + */ + x?: number; + + /** + * Viewport y coordinate in CSS pixels. + */ + y?: number; + } + + /** + * Sanitized `DOM.setFileInputFiles` arguments. Canonical input: + * `DOM.setFileInputFiles` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpDomSetFileInputFilesCommandData { + /** + * Number of files handed to the input. File paths are never captured. + */ + file_count: number; + + method: 'DOM.setFileInputFiles'; + + /** + * Opaque backend DOM node identifier the command targeted. + */ + backend_node_id?: number; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * Opaque DOM node identifier the command targeted. + */ + node_id?: number; + + /** + * Opaque Runtime remote object identifier the command targeted. Clipped to 128 + * characters; a longer value is not a real identifier. + */ + object_id?: string; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + } + + /** + * Sanitized `DOM.focus` arguments. Canonical input: `DOM.focus` in + * devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpDomFocusCommandData { + method: 'DOM.focus'; + + /** + * Opaque backend DOM node identifier the command targeted. + */ + backend_node_id?: number; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * Opaque DOM node identifier the command targeted. + */ + node_id?: number; + + /** + * Opaque Runtime remote object identifier the command targeted. Clipped to 128 + * characters; a longer value is not a real identifier. + */ + object_id?: string; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + } + + /** + * Sanitized `DOM.scrollIntoViewIfNeeded` arguments. Canonical input: + * `DOM.scrollIntoViewIfNeeded` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpDomScrollIntoViewIfNeededCommandData { + method: 'DOM.scrollIntoViewIfNeeded'; + + /** + * Opaque backend DOM node identifier the command targeted. + */ + backend_node_id?: number; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * Opaque DOM node identifier the command targeted. + */ + node_id?: number; + + /** + * Opaque Runtime remote object identifier the command targeted. Clipped to 128 + * characters; a longer value is not a real identifier. + */ + object_id?: string; + + /** + * Height of the rect the command scrolled to. + */ + rect_height?: number; + + /** + * Width of the rect the command scrolled to. + */ + rect_width?: number; + + /** + * X offset of the rect the command scrolled to, relative to the node. + */ + rect_x?: number; + + /** + * Y offset of the rect the command scrolled to, relative to the node. + */ + rect_y?: number; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + } + + /** + * Sanitized `Page.bringToFront` arguments. Canonical input: `Page.bringToFront` in + * devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpPageBringToFrontCommandData { + method: 'Page.bringToFront'; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + } + + /** + * Sanitized `Page.captureScreenshot` arguments. Canonical input: + * `Page.captureScreenshot` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpPageCaptureScreenshotCommandData { + method: 'Page.captureScreenshot'; + + /** + * Whether the capture extended past the viewport. + */ + capture_beyond_viewport?: boolean; + + /** + * Clip region height in CSS pixels. + */ + clip_height?: number; + + /** + * Clip region page scale factor. + */ + clip_scale?: number; + + /** + * Clip region width in CSS pixels. + */ + clip_width?: number; + + /** + * Clip region x offset in CSS pixels. + */ + clip_x?: number; + + /** + * Clip region y offset in CSS pixels. + */ + clip_y?: number; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * Image format requested (`jpeg`, `png` or `webp`). A value the protocol does not + * define is reported as `other`. + */ + format?: 'jpeg' | 'png' | 'webp' | 'other'; + + /** + * Whether the capture was taken from the surface rather than the view. + */ + from_surface?: boolean; + + /** + * Whether encoding favored speed over size. + */ + optimize_for_speed?: boolean; + + /** + * Compression quality, 0 to 100, for lossy formats. + */ + quality?: number; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + } + + /** + * Sanitized `Page.captureSnapshot` arguments. Canonical input: + * `Page.captureSnapshot` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpPageCaptureSnapshotCommandData { + method: 'Page.captureSnapshot'; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * Snapshot format requested (`mhtml`). A value the protocol does not define is + * reported as `other`. + */ + format?: 'mhtml' | 'other'; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + } + + /** + * Sanitized `Page.handleJavaScriptDialog` arguments. Canonical input: + * `Page.handleJavaScriptDialog` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpPageHandleJavaScriptDialogCommandData { + /** + * Whether the dialog was accepted or dismissed. + */ + accept: boolean; + + method: 'Page.handleJavaScriptDialog'; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * Number of characters entered into a prompt dialog. The text itself is never + * captured. + */ + prompt_text_length?: number; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + } + + /** + * Sanitized `Page.navigate` arguments. Canonical input: `Page.navigate` in + * devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpPageNavigateCommandData { + method: 'Page.navigate'; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * Opaque frame identifier. Clipped to 128 characters; a longer value is not a real + * identifier. + */ + frame_id?: string; + + /** + * Referrer policy named by the command. A value the protocol does not define is + * reported as `other`. + */ + referrer_policy?: + | 'noReferrer' + | 'noReferrerWhenDowngrade' + | 'origin' + | 'originWhenCrossOrigin' + | 'sameOrigin' + | 'strictOrigin' + | 'strictOriginWhenCrossOrigin' + | 'unsafeUrl' + | 'other'; + + /** + * Whether the command carried a referrer. The referrer itself is never captured. + */ + referrer_present?: boolean; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + + /** + * Navigation reason reported by the caller (e.g. `link`, `typed`, `reload`). A + * value the protocol does not define is reported as `other`. + */ + transition_type?: + | 'link' + | 'typed' + | 'address_bar' + | 'auto_bookmark' + | 'auto_subframe' + | 'manual_subframe' + | 'generated' + | 'auto_toplevel' + | 'form_submit' + | 'reload' + | 'keyword' + | 'keyword_generated' + | 'other'; + + /** + * Scheme of the destination URL (e.g. `https`, `about`, `data`). The rest of the + * URL is never captured. + */ + url_scheme?: string; + } + + /** + * Sanitized `Page.navigateToHistoryEntry` arguments. Canonical input: + * `Page.navigateToHistoryEntry` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpPageNavigateToHistoryEntryCommandData { + /** + * History entry the command navigated to. + */ + entry_id: number; + + method: 'Page.navigateToHistoryEntry'; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + } + + /** + * Sanitized `Page.reload` arguments. Canonical input: `Page.reload` in + * devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpPageReloadCommandData { + method: 'Page.reload'; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * Whether the reload bypassed the cache. + */ + ignore_cache?: boolean; + + /** + * Opaque document loader identifier. Clipped to 128 characters; a longer value is + * not a real identifier. + */ + loader_id?: string; + + /** + * Number of characters in the injected script. + */ + script_length?: number; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + } + + /** + * Sanitized `Page.printToPDF` arguments. Canonical input: `Page.printToPDF` in + * devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpPagePrintToPdfCommandData { + method: 'Page.printToPDF'; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * Whether a header and footer were rendered. + */ + display_header_footer?: boolean; + + /** + * Whether a footer template was supplied. The template itself is never captured. + */ + footer_template_present?: boolean; + + /** + * Whether a document outline was embedded. + */ + generate_document_outline?: boolean; + + /** + * Whether a tagged (accessible) PDF was requested. + */ + generate_tagged_pdf?: boolean; + + /** + * Whether a header template was supplied. The template itself is never captured. + */ + header_template_present?: boolean; + + /** + * Whether the page was laid out in landscape. + */ + landscape?: boolean; + + /** + * Bottom margin in inches. + */ + margin_bottom?: number; + + /** + * Left margin in inches. + */ + margin_left?: number; + + /** + * Right margin in inches. + */ + margin_right?: number; + + /** + * Top margin in inches. + */ + margin_top?: number; + + /** + * Whether a page range was supplied. + */ + page_ranges_present?: boolean; + + /** + * Paper height in inches. + */ + paper_height?: number; + + /** + * Paper width in inches. + */ + paper_width?: number; + + /** + * Whether the CSS page size was preferred over the paper size. + */ + prefer_css_page_size?: boolean; + + /** + * Whether background graphics were printed. + */ + print_background?: boolean; + + /** + * Page render scale. + */ + scale?: number; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + + /** + * How the PDF was returned (`ReturnAsBase64` or `ReturnAsStream`). A value the + * protocol does not define is reported as `other`. + */ + transfer_mode?: 'ReturnAsBase64' | 'ReturnAsStream' | 'other'; + } + + /** + * Sanitized `Page.startScreencast` arguments. Canonical input: + * `Page.startScreencast` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpPageStartScreencastCommandData { + method: 'Page.startScreencast'; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * Frame sampling interval. + */ + every_nth_frame?: number; + + /** + * Frame format requested (`jpeg` or `png`). A value the protocol does not define + * is reported as `other`. + */ + format?: 'jpeg' | 'png' | 'other'; + + /** + * Maximum frame height in pixels. + */ + max_height?: number; + + /** + * Maximum frame width in pixels. + */ + max_width?: number; + + /** + * Compression quality, 0 to 100. + */ + quality?: number; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + } + + /** + * Sanitized `Page.stopScreencast` arguments. Canonical input: + * `Page.stopScreencast` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpPageStopScreencastCommandData { + method: 'Page.stopScreencast'; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + } + + /** + * Sanitized `Page.stopLoading` arguments. Canonical input: `Page.stopLoading` in + * devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpPageStopLoadingCommandData { + method: 'Page.stopLoading'; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + } + + /** + * Sanitized `Page.close` arguments. Canonical input: `Page.close` in + * devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpPageCloseCommandData { + method: 'Page.close'; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + } + + /** + * Sanitized `Page.setWebLifecycleState` arguments. Canonical input: + * `Page.setWebLifecycleState` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpPageSetWebLifecycleStateCommandData { + method: 'Page.setWebLifecycleState'; + + /** + * Lifecycle state applied (`frozen` or `active`). A value the protocol does not + * define is reported as `other`. + */ + state: 'frozen' | 'active' | 'other'; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + } + + /** + * Sanitized `Target.activateTarget` arguments. Canonical input: + * `Target.activateTarget` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpTargetActivateTargetCommandData { + method: 'Target.activateTarget'; + + /** + * Opaque target identifier. Clipped to 128 characters; a longer value is not a + * real identifier. + */ + target_id: string; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + } + + /** + * Sanitized `Target.closeTarget` arguments. Canonical input: `Target.closeTarget` + * in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpTargetCloseTargetCommandData { + method: 'Target.closeTarget'; + + /** + * Opaque target identifier. Clipped to 128 characters; a longer value is not a + * real identifier. + */ + target_id: string; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + } + + /** + * Sanitized `Target.createTarget` arguments. Canonical input: + * `Target.createTarget` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpTargetCreateTargetCommandData { + method: 'Target.createTarget'; + + /** + * Whether the target was created in the background. + */ + background?: boolean; + + /** + * Opaque browser context identifier. Clipped to 128 characters; a longer value is + * not a real identifier. + */ + browser_context_id?: string; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * Whether BeginFrame control was enabled (headless only). + */ + enable_begin_frame_control?: boolean; + + /** + * Whether the new target was focused. + */ + focus?: boolean; + + /** + * Whether a tab target rather than a page target was created. + */ + for_tab?: boolean; + + /** + * Window height in DIP. + */ + height?: number; + + /** + * Whether the target was created hidden. + */ + hidden?: boolean; + + /** + * Window x position in screen coordinates. + */ + left?: number; + + /** + * Whether a new window was requested. + */ + new_window?: boolean; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + + /** + * Window y position in screen coordinates. + */ + top?: number; + + /** + * Scheme of the destination URL (e.g. `https`, `about`, `data`). The rest of the + * URL is never captured. + */ + url_scheme?: string; + + /** + * Window width in DIP. + */ + width?: number; + + /** + * Window state requested (`normal`, `minimized`, `maximized`, `fullscreen`). A + * value the protocol does not define is reported as `other`. + */ + window_state?: 'normal' | 'minimized' | 'maximized' | 'fullscreen' | 'other'; + } + + /** + * Sanitized `Target.createBrowserContext` arguments. Canonical input: + * `Target.createBrowserContext` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpTargetCreateBrowserContextCommandData { + method: 'Target.createBrowserContext'; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * Whether the context is disposed when the debugging session detaches. + */ + dispose_on_detach?: boolean; + + /** + * Whether a proxy bypass list was configured. + */ + proxy_bypass_list_present?: boolean; + + /** + * Whether a proxy was configured. The proxy address is never captured. + */ + proxy_server_present?: boolean; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + + /** + * Number of origins granted universal network access. The origins themselves are + * never captured. + */ + universal_network_access_origin_count?: number; + } + + /** + * Sanitized `Target.disposeBrowserContext` arguments. Canonical input: + * `Target.disposeBrowserContext` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpTargetDisposeBrowserContextCommandData { + /** + * Opaque browser context identifier. Clipped to 128 characters; a longer value is + * not a real identifier. + */ + browser_context_id: string; + + method: 'Target.disposeBrowserContext'; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + } + + /** + * Sanitized `Target.openDevTools` arguments. Canonical input: + * `Target.openDevTools` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. + */ + export interface BrowserCdpTargetOpenDevToolsCommandData { + method: 'Target.openDevTools'; + + /** + * Opaque target identifier. Clipped to 128 characters; a longer value is not a + * real identifier. + */ + target_id: string; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * DevTools panel opened. Clipped to 128 characters; a longer value is not a real + * identifier. + */ + panel_id?: string; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; } -} -/** - * CDP Runtime.StackTrace representing the JavaScript call stack at the time of an - * event. Fields use CDP naming conventions rather than snake_case to match the - * Chrome DevTools Protocol wire format. - */ -export interface BrowserCallStack { /** - * Ordered list of call frames, outermost first. + * Sanitized `Browser.cancelDownload` arguments. Canonical input: + * `Browser.cancelDownload` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. */ - callFrames: Array; + export interface BrowserCdpBrowserCancelDownloadCommandData { + /** + * Opaque identifier of the download that was cancelled. Clipped to 128 characters; + * a longer value is not a real identifier. + */ + download_guid: string; + + method: 'Browser.cancelDownload'; + + /** + * Opaque browser context identifier. Clipped to 128 characters; a longer value is + * not a real identifier. + */ + browser_context_id?: string; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + } /** - * Optional label for the stack trace (e.g. async cause). + * Sanitized `Browser.close` arguments. Canonical input: `Browser.close` in + * devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. */ - description?: string; + export interface BrowserCdpBrowserCloseCommandData { + method: 'Browser.close'; + + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + } /** - * Parent stack trace for async stacks. + * Sanitized `Browser.setWindowBounds` arguments. Canonical input: + * `Browser.setWindowBounds` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. */ - parent?: BrowserCallStack; -} + export interface BrowserCdpBrowserSetWindowBoundsCommandData { + method: 'Browser.setWindowBounds'; -export namespace BrowserCallStack { - export interface CallFrame { /** - * Zero-based column number within the line. + * Browser window identifier. */ - columnNumber: number; + window_id: number; /** - * JavaScript function name, or empty string for anonymous functions. + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. */ - functionName: string; + command_id?: number; /** - * Zero-based line number within the script. + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. */ - lineNumber: number; + connection_id?: string; /** - * CDP script identifier. + * Window height in DIP. */ - scriptId: string; + height?: number; /** - * URL or name of the script file. + * Window x position in screen coordinates. */ - url: string; - } -} + left?: number; -/** - * A captcha solve attempt reached a terminal outcome. - */ -export interface BrowserCaptchaSolveResultEvent { - category: 'captcha'; + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; - /** - * Provenance metadata identifying which producer emitted the event. - */ - source: BrowserEventSource; + /** + * Window y position in screen coordinates. + */ + top?: number; + + /** + * Window width in DIP. + */ + width?: number; + + /** + * Window state requested (`normal`, `minimized`, `maximized`, `fullscreen`). A + * value the protocol does not define is reported as `other`. + */ + window_state?: 'normal' | 'minimized' | 'maximized' | 'fullscreen' | 'other'; + } /** - * Event timestamp in Unix microseconds. + * Sanitized `Browser.setContentsSize` arguments. Canonical input: + * `Browser.setContentsSize` in devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. */ - ts: number; + export interface BrowserCdpBrowserSetContentsSizeCommandData { + method: 'Browser.setContentsSize'; - type: 'captcha_solve_result'; + /** + * Browser window identifier. + */ + window_id: number; - data?: BrowserCaptchaSolveResultEvent.Data; + /** + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. + */ + command_id?: number; + + /** + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * Contents height in DIP. + */ + height?: number; + + /** + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. + */ + session_id?: string; + + /** + * Contents width in DIP. + */ + width?: number; + } /** - * True if the data field was truncated due to size limits. + * Sanitized `Autofill.trigger` arguments. Canonical input: `Autofill.trigger` in + * devtools-protocol@2d019e73, pinned at + * https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json. + * Every argument of this command has a retained or redacted decision in + * lib/devtoolsproxy/testdata/cdp_arguments.yaml. */ - truncated?: boolean; -} - -export namespace BrowserCaptchaSolveResultEvent { - export interface Data { + export interface BrowserCdpAutofillTriggerCommandData { /** - * Captcha vendor family. Provider-specific task names are normalized into this - * set; anything not covered is reported as other. + * Opaque backend node identifier of the field that was autofilled. */ - captcha_type: 'hcaptcha' | 'recaptcha_v2' | 'recaptcha_v3' | 'turnstile' | 'geetest' | 'other'; + field_id: number; + + method: 'Autofill.trigger'; /** - * Wall-clock duration from solve start to terminal outcome. + * Number of address fields the command filled. Their names and values are never + * captured. */ - duration_ms: number; + address_field_count?: number; /** - * Terminal outcome. success: solver returned a usable solution. failure: solver - * returned an error (see error_code). timeout: solver did not return within the - * caller's wait budget. abandoned: caller cancelled or the page navigated away - * mid-solve. + * The command's JSON-RPC id, so the command can be joined to the result the + * browser returned for it. Absent when the client sent none. */ - status: 'success' | 'failure' | 'timeout' | 'abandoned'; + command_id?: number; /** - * Solver-specific error code on failure (e.g. ERROR_CAPTCHA_UNSOLVABLE). Absent on - * success. + * Identifies the CDP proxy connection the command arrived on, matching + * `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are + * told apart by this. */ - error_code?: string; + connection_id?: string; /** - * Solver-assigned identifier. Opaque, useful for support cross-references. + * Opaque frame identifier. Clipped to 128 characters; a longer value is not a real + * identifier. */ - task_id?: string; + frame_id?: string; /** - * Host of the page where the captcha was solved. + * What was filled: `card` or `address`. The values themselves are never captured. */ - website_host?: string; + mode?: 'card' | 'address'; /** - * Path of the page where the captcha was solved. Query string excluded. + * CDP session identifier the command was addressed to. Absent for browser-level + * commands. Clipped to 128 characters. */ - website_path?: string; + session_id?: string; } } +/** + * A browser-control CDP method the proxy reports. The set covers the commands an + * agent drives the browser with; configuration, DOM and Runtime bookkeeping, and + * Chrome-specific UI commands are outside it. Canonical definitions: + * devtools-protocol@2d019e73. + */ +export type BrowserCdpCommandMethod = + | 'Input.dispatchMouseEvent' + | 'Input.dispatchKeyEvent' + | 'Input.insertText' + | 'Input.imeSetComposition' + | 'Input.dispatchTouchEvent' + | 'Input.dispatchDragEvent' + | 'Input.cancelDragging' + | 'Input.emulateTouchFromMouseEvent' + | 'Input.synthesizePinchGesture' + | 'Input.synthesizeScrollGesture' + | 'Input.synthesizeTapGesture' + | 'DOM.setFileInputFiles' + | 'DOM.focus' + | 'DOM.scrollIntoViewIfNeeded' + | 'Page.bringToFront' + | 'Page.captureScreenshot' + | 'Page.captureSnapshot' + | 'Page.handleJavaScriptDialog' + | 'Page.navigate' + | 'Page.navigateToHistoryEntry' + | 'Page.reload' + | 'Page.printToPDF' + | 'Page.startScreencast' + | 'Page.stopScreencast' + | 'Page.stopLoading' + | 'Page.close' + | 'Page.setWebLifecycleState' + | 'Target.activateTarget' + | 'Target.closeTarget' + | 'Target.createTarget' + | 'Target.createBrowserContext' + | 'Target.disposeBrowserContext' + | 'Target.openDevTools' + | 'Browser.cancelDownload' + | 'Browser.close' + | 'Browser.setWindowBounds' + | 'Browser.setContentsSize' + | 'Autofill.trigger'; + /** * An external client (e.g. customer SDK, Playwright, Puppeteer) connected to the * CDP WebSocket proxy on this VM. @@ -272,12 +2507,25 @@ export interface BrowserCdpConnectEvent { type: 'cdp_connect'; + data?: BrowserCdpConnectEvent.Data; + /** * True if the data field was truncated due to size limits. */ truncated?: boolean; } +export namespace BrowserCdpConnectEvent { + export interface Data { + /** + * Identifies this CDP proxy connection, matching the connection_id on the + * cdp_command events that arrived on it. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + } +} + /** * An external client disconnected from the CDP WebSocket proxy on this VM. Pair * with the immediately preceding cdp_connect on the same stream. @@ -325,6 +2573,30 @@ export namespace BrowserCdpDisconnectEvent { * (typically server shutdown). */ reason: 'client_close' | 'upstream_changed' | 'upstream_error' | 'context_cancelled'; + + /** + * Identifies this CDP proxy connection, matching the connection_id on the + * cdp_command events that arrived on it. Two clients driving the same browser are + * told apart by this. + */ + connection_id?: string; + + /** + * Number of forwarded client frames the classifier never saw, because it could not + * keep up or because classification failed. An upper bound on lost commands rather + * than a count: a saturated queue turns away whatever arrives next, which may be + * library traffic that would have produced no event. Telemetry loss only; every + * command was still relayed to the browser. Absent on events from a browser image + * predating the field, which is not the same as zero. + */ + telemetry_dropped?: number; + + /** + * Number of forwarded client commands that produced no cdp_command event because + * their method is listed in control.cdp.excluded_methods. Configuration rather + * than loss, so it is counted apart from telemetry_dropped. + */ + telemetry_excluded?: number; } } @@ -1267,6 +3539,54 @@ export namespace BrowserNetworkResponseEvent { } } +/** + * A page's renderer process crashed (an "Aw, Snap!" failure) while the browser + * process itself stayed alive. Reported on the crashed page's session, with the + * session and target ids on `source.metadata`. Captured only while the `page` + * category is enabled. + */ +export interface BrowserPageCrashedEvent { + category: 'page'; + + /** + * Provenance metadata identifying which producer emitted the event. + */ + source: BrowserEventSource; + + /** + * Event timestamp in Unix microseconds. + */ + ts: number; + + type: 'page_crashed'; + + data?: BrowserPageCrashedEvent.Data; + + /** + * True if the data field was truncated due to size limits. + */ + truncated?: boolean; +} + +export namespace BrowserPageCrashedEvent { + export interface Data { + /** + * CDP target identifier of the crashed page. + */ + target_id: string; + + /** + * CDP target type of the page that produced the event. + */ + target_type: 'page' | 'background_page' | 'service_worker' | 'shared_worker' | 'other'; + + /** + * URL the page was on when its renderer process crashed. + */ + url: string; + } +} + /** * A browser DOMContentLoaded event (CDP Page.domContentEventFired). */ @@ -1725,6 +4045,60 @@ export namespace BrowserPageTabOpenedEvent { } } +/** + * An HTTP call that manages the browser VM rather than driving the browser, + * handled by the in-VM API server — recording lifecycle, filesystem and process + * management, telemetry and browser configuration. Mostly platform-induced (e.g. + * profile save, replay capture) rather than agent actions. + */ +export interface BrowserPlatformAPICallEvent { + category: 'platform'; + + /** + * Provenance metadata identifying which producer emitted the event. + */ + source: BrowserEventSource; + + /** + * Event timestamp in Unix microseconds. + */ + ts: number; + + type: 'platform_api_call'; + + data?: BrowserPlatformAPICallEvent.Data; + + /** + * True if the data field was truncated due to size limits. + */ + truncated?: boolean; +} + +export namespace BrowserPlatformAPICallEvent { + export interface Data { + /** + * Wall-clock duration of the handler in milliseconds. + */ + duration_ms: number; + + /** + * Matched route's operation, named as the in-VM API names its handler (e.g. + * ProcessExec, StartRecording). + */ + operation_id: string; + + /** + * Per-request identifier from the in-VM API request middleware. + */ + request_id: string; + + /** + * HTTP response status code. + */ + status: number; + } +} + /** * A branded proxy-layer failure observed by the browser. Emitted when the metro * egress host-proxy serves a branded 5xx error page whose response carries the @@ -1967,8 +4341,8 @@ export namespace BrowserSystemOomKillEvent { * Per-category telemetry capture settings layered onto the default set. The * operational signals (control, connection, system, captcha) are on by default and * are opt-out: set one to enabled=false to stop capturing it. The CDP categories - * (console, network, page, interaction) and screenshot are off by default and are - * opt-in: set enabled=true to capture them. + * (console, network, page, interaction), screenshot and platform are off by + * default and are opt-in: set enabled=true to capture them. */ export interface BrowserTelemetryCategoriesConfig { /** @@ -1988,10 +4362,11 @@ export interface BrowserTelemetryCategoriesConfig { console?: BrowserTelemetryCategoryConfig; /** - * Agent-driven actions against the browser, such as inbound calls to the in-VM - * API. On by default. + * Agent-driven actions against the browser — computer-control calls, Playwright + * code execution, screenshots, clipboard access, and browser-control commands sent + * over the CDP proxy. On by default. */ - control?: BrowserTelemetryCategoryConfig; + control?: BrowserTelemetryControlConfig; /** * User interaction events including clicks, keydowns, and scroll-settled events. @@ -2014,6 +4389,13 @@ export interface BrowserTelemetryCategoriesConfig { */ page?: BrowserTelemetryCategoryConfig; + /** + * In-VM API calls that manage the browser VM rather than drive the browser + * (recording, filesystem, process, telemetry and browser configuration). Mostly + * platform-induced; off by default and must be opted into. + */ + platform?: BrowserTelemetryCategoryConfig; + /** * Periodic base64-encoded viewport screenshots. High volume; off by default and * must be opted into. @@ -2034,11 +4416,29 @@ export interface BrowserTelemetryCategoryConfig { /** * Whether this category is captured. Operational categories (control, connection, * system, captcha) default to true; set false to opt out. CDP categories (console, - * network, page, interaction) and screenshot default to false; set true to opt in. + * network, page, interaction), screenshot and platform default to false; set true + * to opt in. */ enabled?: boolean; } +/** + * Settings for the cdp_command events the CDP proxy reports. + */ +export interface BrowserTelemetryCdpControlConfig { + /** + * Methods to leave out of the cdp_command stream. Omit the list to keep the + * current one; send an empty list to report every supported method again. + * Exclusion is a telemetry setting only: an excluded command is still relayed to + * the browser unchanged, it simply produces no event. Use it to drop the + * highest-volume methods — Input.dispatchMouseEvent during a humanized cursor + * path, or Page.captureScreenshot under a screencast — without turning the whole + * category off. Excluded commands are counted in + * cdp_disconnect.telemetry_excluded. + */ + excluded_methods?: Array; +} + /** * Active telemetry configuration for a browser session. */ @@ -2055,6 +4455,25 @@ export interface BrowserTelemetryConfig { export?: BrowserTelemetryExportConfig; } +/** + * Configuration for the control category. Same enabled semantics as any other + * category, plus settings for the browser-control commands the CDP proxy reports. + */ +export interface BrowserTelemetryControlConfig { + /** + * Settings for the cdp_command events the CDP proxy reports. Merged independently + * of enabled, so a later update that only sets enabled keeps the current exclusion + * list. + */ + cdp?: BrowserTelemetryCdpControlConfig; + + /** + * Whether this category is captured. Control is on by default; set false to opt + * out. + */ + enabled?: boolean; +} + /** * Union type representing any browser telemetry event. Discriminated on `type`. * Each event's `category` determines when it is captured. The CDP collector-health @@ -2077,6 +4496,7 @@ export type BrowserTelemetryEvent = | BrowserPageDomContentLoadedEvent | BrowserPageLoadEvent | BrowserPageTabOpenedEvent + | BrowserPageCrashedEvent | BrowserPageLayoutShiftEvent | BrowserPageLcpEvent | BrowserPageLayoutSettledEvent @@ -2090,6 +4510,8 @@ export type BrowserTelemetryEvent = | BrowserMonitorReconnectFailedEvent | BrowserMonitorInitFailedEvent | BrowserAPICallEvent + | BrowserPlatformAPICallEvent + | BrowserCdpCommandEvent | BrowserCdpConnectEvent | BrowserCdpDisconnectEvent | BrowserLiveViewConnectEvent @@ -2187,6 +4609,7 @@ export interface TelemetryEventsParams extends OffsetPaginationParams { | 'page' | 'interaction' | 'control' + | 'platform' | 'connection' | 'system' | 'screenshot' @@ -2238,6 +4661,8 @@ export declare namespace Telemetry { type BrowserAPICallEvent as BrowserAPICallEvent, type BrowserCallStack as BrowserCallStack, type BrowserCaptchaSolveResultEvent as BrowserCaptchaSolveResultEvent, + type BrowserCdpCommandEvent as BrowserCdpCommandEvent, + type BrowserCdpCommandMethod as BrowserCdpCommandMethod, type BrowserCdpConnectEvent as BrowserCdpConnectEvent, type BrowserCdpDisconnectEvent as BrowserCdpDisconnectEvent, type BrowserConsoleErrorEvent as BrowserConsoleErrorEvent, @@ -2259,6 +4684,7 @@ export declare namespace Telemetry { type BrowserNetworkLoadingFailedEvent as BrowserNetworkLoadingFailedEvent, type BrowserNetworkRequestEvent as BrowserNetworkRequestEvent, type BrowserNetworkResponseEvent as BrowserNetworkResponseEvent, + type BrowserPageCrashedEvent as BrowserPageCrashedEvent, type BrowserPageDomContentLoadedEvent as BrowserPageDomContentLoadedEvent, type BrowserPageLayoutSettledEvent as BrowserPageLayoutSettledEvent, type BrowserPageLayoutShiftEvent as BrowserPageLayoutShiftEvent, @@ -2267,12 +4693,15 @@ export declare namespace Telemetry { type BrowserPageNavigationEvent as BrowserPageNavigationEvent, type BrowserPageNavigationSettledEvent as BrowserPageNavigationSettledEvent, type BrowserPageTabOpenedEvent as BrowserPageTabOpenedEvent, + type BrowserPlatformAPICallEvent as BrowserPlatformAPICallEvent, type BrowserProxyErrorEvent as BrowserProxyErrorEvent, type BrowserServiceCrashedEvent as BrowserServiceCrashedEvent, type BrowserSystemOomKillEvent as BrowserSystemOomKillEvent, type BrowserTelemetryCategoriesConfig as BrowserTelemetryCategoriesConfig, type BrowserTelemetryCategoryConfig as BrowserTelemetryCategoryConfig, + type BrowserTelemetryCdpControlConfig as BrowserTelemetryCdpControlConfig, type BrowserTelemetryConfig as BrowserTelemetryConfig, + type BrowserTelemetryControlConfig as BrowserTelemetryControlConfig, type BrowserTelemetryEvent as BrowserTelemetryEvent, type BrowserTelemetryExportConfig as BrowserTelemetryExportConfig, type BrowserTelemetryOtlpExportConfig as BrowserTelemetryOtlpExportConfig, diff --git a/src/resources/index.ts b/src/resources/index.ts index 1ff11ef0..f397103c 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -156,4 +156,27 @@ export { type ProxyCheckParams, type ProxyListResponsesOffsetPagination, } from './proxies'; +export { + SiteConfigs, + type Analysis, + type AnalysisSummary, + type Browser, + type Evidence, + type LookupRequest, + type LookupResponse, + type NoRecommendation, + type Proxy, + type Recommendation, + type RecommendationResult, + type RecommendationSummary, + type ResolveRequest, + type SiteConfigResponse, + type Target, + type SiteConfigListParams, + type SiteConfigListRecommendationsParams, + type SiteConfigLookupParams, + type SiteConfigResolveParams, + type AnalysisSummariesOffsetPagination, + type RecommendationSummariesOffsetPagination, +} from './site-configs'; export { Telemetry } from './telemetry/telemetry'; diff --git a/src/resources/proxies.ts b/src/resources/proxies.ts index 0ccef512..9b1dfff9 100644 --- a/src/resources/proxies.ts +++ b/src/resources/proxies.ts @@ -73,7 +73,10 @@ export class Proxies extends APIResource { } /** - * Soft delete a proxy. Sessions referencing it are not modified. + * Soft delete a proxy. Session records referencing it are not modified. If egress + * binding polling is enabled, existing tunnels for active sessions using the proxy + * are terminated within one polling interval; subsequent connections through the + * deleted proxy are rejected. * * @example * ```ts diff --git a/src/resources/site-configs.ts b/src/resources/site-configs.ts new file mode 100644 index 00000000..2cbe9231 --- /dev/null +++ b/src/resources/site-configs.ts @@ -0,0 +1,578 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../core/resource'; +import * as Shared from './shared'; +import { APIPromise } from '../core/api-promise'; +import { OffsetPagination, type OffsetPaginationParams, PagePromise } from '../core/pagination'; +import { RequestOptions } from '../internal/request-options'; +import { path } from '../internal/utils/path'; + +/** + * Resolve browser and proxy recommendations for bot-protected sites. + */ +export class SiteConfigs extends APIResource { + /** + * Returns a project-scoped historical analysis and the recommendation outcome + * concluded by that run. Later knowledge does not change this response. + * + * @example + * ```ts + * const siteConfigResponse = + * await client.siteConfigs.retrieve('id'); + * ``` + */ + retrieve(id: string, options?: RequestOptions): APIPromise { + return this._client.get(path`/site-configs/${id}`, options); + } + + /** + * Lists analyses for the selected project, newest first. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const analysisSummary of client.siteConfigs.list()) { + * // ... + * } + * ``` + */ + list( + query: SiteConfigListParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList('/site-configs', OffsetPagination, { query, ...options }); + } + + /** + * Lists unique domains previously analyzed by the selected project with their + * current domain-level recommendations. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const recommendationSummary of client.siteConfigs.listRecommendations()) { + * // ... + * } + * ``` + */ + listRecommendations( + query: SiteConfigListRecommendationsParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList('/site-configs/recommendations', OffsetPagination, { + query, + ...options, + }); + } + + /** + * Returns current global knowledge without resolving DNS, creating an analysis, or + * updating Site Config data. + * + * @example + * ```ts + * const lookupResponse = await client.siteConfigs.lookup({ + * url: 'https://example.com', + * }); + * ``` + */ + lookup(body: SiteConfigLookupParams, options?: RequestOptions): APIPromise { + return this._client.post('/site-configs/lookup', { body, ...options }); + } + + /** + * Explicitly starts or retries a project-scoped background analysis while + * preserving current global knowledge when available. Use `/site-configs/lookup` + * for side-effect-free reads. + * + * @example + * ```ts + * const siteConfigResponse = await client.siteConfigs.resolve( + * { url: 'https://example.com' }, + * ); + * ``` + */ + resolve(body: SiteConfigResolveParams, options?: RequestOptions): APIPromise { + return this._client.post('/site-configs/resolve', { body, ...options }); + } +} + +export type AnalysisSummariesOffsetPagination = OffsetPagination; + +export type RecommendationSummariesOffsetPagination = OffsetPagination; + +export interface Analysis { + /** + * Discovery run ID used to poll analysis status. + */ + id: string; + + /** + * Time the analysis was created. + */ + created_at: string; + + /** + * Present for failed or canceled analyses. Messages contain safe retry guidance + * rather than internal workflow errors. + */ + failure: Shared.ErrorModel | null; + + /** + * Time the analysis reached a terminal status. Null while it is running. + */ + finished_at: string | null; + + /** + * Lifecycle status of the background analysis. + */ + status: 'running' | 'completed' | 'failed' | 'canceled'; +} + +export interface AnalysisSummary { + analysis: Analysis; + + target: Target; +} + +/** + * Browser settings that can be passed directly to `POST /browsers`. + */ +export interface Browser { + gpu: boolean; + + headless: boolean; + + stealth: boolean; + + /** + * Initial browser window size in pixels with optional refresh rate. If omitted, + * image defaults apply (1920x1080@25). For GPU images, the default is + * 1920x1080@60. Arbitrary viewport dimensions and refresh rates are accepted. + * Known-good presets include: 2560x1440@10, 1920x1080@25, 1920x1200@25, + * 1440x900@25, 1280x800@60, 1024x768@60, 1200x800@60, 768x1024@60, 390x844@60. For + * GPU images, recommended presets use one of these resolutions with refresh rates + * 60, 30, 25, or 10: 800x600, 960x720, 1024x576, 1024x768, 1152x648, 1200x800, + * 1280x720, 1368x768, 1440x900, 1600x900, 1920x1080, 1920x1200, 390x844, 360x250, + * 768x1024, 800x1600. Viewports outside this list may exhibit unstable live view + * or recording behavior. If refresh_rate is not provided, it will be automatically + * determined based on the resolution (higher resolutions use lower refresh rates + * to keep bandwidth reasonable). + */ + viewport: Shared.BrowserViewport; +} + +export interface Evidence { + accessed: number; + + blocked: number; + + inconclusive: number; + + /** + * Most recent contributing observation. Recommendations remain eligible regardless + * of age and can be returned while a new analysis refreshes them. + */ + last_observed_at: string; + + run_count: number; + + /** + * Number of judged trials. + */ + sample_size: number; + + /** + * Accessed trials divided by judged trials. Inconclusive trials are excluded. + */ + success_rate: number; + + /** + * Most recent contributing run where this config met the success threshold. + * Omitted for knowledge assembled from runs that did not independently meet the + * threshold. + */ + last_verified_at?: string | null; +} + +export interface LookupRequest { + /** + * Public HTTP(S) URL to look up. + */ + url: string; + + /** + * ISO 3166 country codes Kernel may use when returning a proxy configuration. When + * omitted, Kernel uses its default country selection. + */ + allowed_proxy_countries?: Array; +} + +export interface LookupResponse { + recommendation: Recommendation | null; + + target: Target; +} + +export interface NoRecommendation { + /** + * Machine-readable reason Kernel cannot currently provide a Site Config + * recommendation. + */ + code: 'proxy_restricted' | 'no_working_configuration' | 'inconclusive'; + + /** + * Human-readable explanation suitable for display. + */ + message: string; + + type: 'no_recommendation'; +} + +/** + * Proxy recipe for the recommended browser. + */ +export type Proxy = Proxy.SiteConfigDirectProxy | Proxy.SiteConfigManagedProxy; + +export namespace Proxy { + /** + * Direct egress recipe. Pass `{ "mode": "direct" }` as the browser's `proxy`. + */ + export interface SiteConfigDirectProxy { + mode: 'direct'; + } + + /** + * Managed proxy recipe. `create` is a non-idempotent `POST /proxies` payload: + * create the resource once, retain its ID, and reuse that ID as the browser's + * `proxy.id`. Do not submit this recipe before every browser session. + */ + export interface SiteConfigManagedProxy { + /** + * Configuration for routing traffic through a proxy. + */ + create: SiteConfigManagedProxy.Create; + + mode: 'managed'; + } + + export namespace SiteConfigManagedProxy { + /** + * Configuration for routing traffic through a proxy. + */ + export interface Create { + /** + * Proxy type to use. In terms of quality for avoiding bot-detection, from best to + * worst: `mobile` > `residential` > `isp` > `datacenter`. + */ + type: 'datacenter' | 'isp' | 'residential' | 'mobile' | 'custom'; + + /** + * Hostnames that should bypass the parent proxy and connect directly. + */ + bypass_hosts?: Array; + + /** + * Configuration specific to the selected proxy `type`. + */ + config?: + | Create.DatacenterProxyConfig + | Create.IspProxyConfig + | Create.ResidentialProxyConfig + | Create.MobileProxyConfig + | Create.CreateCustomProxyConfig; + + /** + * Readable name of the proxy. + */ + name?: string; + + /** + * Protocol to use for the proxy connection. + */ + protocol?: 'http' | 'https'; + } + + export namespace Create { + /** + * Configuration for a datacenter proxy. + */ + export interface DatacenterProxyConfig { + /** + * ISO 3166 country code. Defaults to US if not provided. + */ + country?: string; + } + + /** + * Configuration for an ISP proxy. + */ + export interface IspProxyConfig { + /** + * ISO 3166 country code. Defaults to US if not provided. + */ + country?: string; + } + + /** + * Configuration for residential proxies. + */ + export interface ResidentialProxyConfig { + /** + * Autonomous system number. See https://bgp.potaroo.net/cidr/autnums.html + */ + asn?: string; + + /** + * City name (no spaces, e.g. `sanfrancisco`). If provided, `country` must also be + * provided. + */ + city?: string; + + /** + * ISO 3166 country code. + */ + country?: string; + + /** + * @deprecated Operating system of the residential device. + */ + os?: 'windows' | 'macos' | 'android'; + + /** + * Two-letter state code. + */ + state?: string; + + /** + * US ZIP code. + */ + zip?: string; + } + + /** + * Configuration for mobile proxies. + */ + export interface MobileProxyConfig { + /** + * Provider city alias. Mobile carrier routing can make observed geo vary. + */ + city?: string; + + /** + * ISO 3166 country code + */ + country?: string; + + /** + * US-only state code. Mobile carrier routing can make observed geo vary. + */ + state?: string; + } + + /** + * Configuration for a custom proxy (e.g., private proxy server). + */ + export interface CreateCustomProxyConfig { + /** + * Proxy host address or IP. + */ + host: string; + + /** + * Proxy port. + */ + port: number; + + /** + * PEM-encoded CA certificate bundle the proxy re-signs upstream TLS with. Provide + * when the proxy terminates TLS (MITM) so the browser trusts its certificates. May + * contain multiple concatenated certificates. + */ + ca_bundle?: string; + + /** + * Password for proxy authentication. + */ + password?: string; + + /** + * Username for proxy authentication. + */ + username?: string; + } + } + } +} + +export interface Recommendation { + /** + * Browser settings that can be passed directly to `POST /browsers`. + */ + browser: Browser; + + evidence: Evidence; + + /** + * Specificity of knowledge matched for this recommendation. + */ + match_scope: 'exact' | 'host' | 'domain'; + + /** + * Target value that supplied the recommendation. + */ + matched_target: string; + + /** + * Proxy recipe for the recommended browser. + */ + proxy: Proxy; + + type: 'recommendation'; + + /** + * Exact matches meet the evidence threshold; host and domain fallbacks are + * inferred. Check evidence.last_verified_at for successful verification age and + * last_observed_at for the latest evidence. + */ + verification: 'verified' | 'inferred'; +} + +/** + * A recommendation or a structured no-recommendation result. + */ +export type RecommendationResult = Recommendation | NoRecommendation; + +export interface RecommendationSummary { + /** + * Most recent time the selected project requested an analysis for this domain. + */ + last_requested_at: string; + + /** + * Current domain-level recommendation. Null when no eligible knowledge exists. + */ + recommendation: Recommendation | null; + + /** + * Display label for the recommended browser configuration. + */ + recommended_config_label: string | null; + + /** + * Success rate for the recommended configuration. Null when no eligible knowledge + * exists. + */ + success_rate: number | null; + + /** + * Registrable domain previously analyzed by the selected project. + */ + target: string; +} + +export interface ResolveRequest { + /** + * Public HTTP(S) URL to refresh. + */ + url: string; + + /** + * ISO 3166 country codes Kernel may use when searching for or returning a proxy + * configuration. Kernel may test a subset of allowed countries. When omitted, + * Kernel uses its default country selection. + */ + allowed_proxy_countries?: Array; +} + +export interface SiteConfigResponse { + /** + * Pollable analysis after workflow submission is acknowledged. Null when no + * refresh was submitted. + */ + analysis: Analysis | null; + + /** + * A recommendation or a structured no-recommendation result. + */ + recommendation: RecommendationResult | null; + + target: Target; +} + +export interface Target { + /** + * Registrable domain. + */ + domain: string; + + /** + * Full hostname, including subdomain. + */ + host: string; + + /** + * Exact normalized scheme, host, port, and path used for lookup. + */ + normalized: string; +} + +export interface SiteConfigListParams extends OffsetPaginationParams {} + +export interface SiteConfigListRecommendationsParams extends OffsetPaginationParams { + sort_by?: 'target' | 'recommended_config' | 'last_requested_at' | 'success_rate'; + + sort_order?: 'asc' | 'desc'; +} + +export interface SiteConfigLookupParams { + /** + * Public HTTP(S) URL to look up. + */ + url: string; + + /** + * ISO 3166 country codes Kernel may use when returning a proxy configuration. When + * omitted, Kernel uses its default country selection. + */ + allowed_proxy_countries?: Array; +} + +export interface SiteConfigResolveParams { + /** + * Public HTTP(S) URL to refresh. + */ + url: string; + + /** + * ISO 3166 country codes Kernel may use when searching for or returning a proxy + * configuration. Kernel may test a subset of allowed countries. When omitted, + * Kernel uses its default country selection. + */ + allowed_proxy_countries?: Array; +} + +export declare namespace SiteConfigs { + export { + type Analysis as Analysis, + type AnalysisSummary as AnalysisSummary, + type Browser as Browser, + type Evidence as Evidence, + type LookupRequest as LookupRequest, + type LookupResponse as LookupResponse, + type NoRecommendation as NoRecommendation, + type Proxy as Proxy, + type Recommendation as Recommendation, + type RecommendationResult as RecommendationResult, + type RecommendationSummary as RecommendationSummary, + type ResolveRequest as ResolveRequest, + type SiteConfigResponse as SiteConfigResponse, + type Target as Target, + type AnalysisSummariesOffsetPagination as AnalysisSummariesOffsetPagination, + type RecommendationSummariesOffsetPagination as RecommendationSummariesOffsetPagination, + type SiteConfigListParams as SiteConfigListParams, + type SiteConfigListRecommendationsParams as SiteConfigListRecommendationsParams, + type SiteConfigLookupParams as SiteConfigLookupParams, + type SiteConfigResolveParams as SiteConfigResolveParams, + }; +} diff --git a/src/version.ts b/src/version.ts index 37e6f5a8..a914c676 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.93.0'; // x-release-please-version +export const VERSION = '0.94.0'; // x-release-please-version diff --git a/tests/api-resources/auth/connections.test.ts b/tests/api-resources/auth/connections.test.ts index 94cad027..af260de3 100644 --- a/tests/api-resources/auth/connections.test.ts +++ b/tests/api-resources/auth/connections.test.ts @@ -42,10 +42,14 @@ describe('resource connections', () => { captcha: { enabled: true }, connection: { enabled: true }, console: { enabled: true }, - control: { enabled: true }, + control: { + cdp: { excluded_methods: ['Input.dispatchMouseEvent'] }, + enabled: true, + }, interaction: { enabled: true }, network: { enabled: true }, page: { enabled: true }, + platform: { enabled: true }, screenshot: { enabled: true }, system: { enabled: true }, }, @@ -63,10 +67,14 @@ describe('resource connections', () => { captcha: { enabled: true }, connection: { enabled: true }, console: { enabled: true }, - control: { enabled: true }, + control: { + cdp: { excluded_methods: ['Input.dispatchMouseEvent'] }, + enabled: true, + }, interaction: { enabled: true }, network: { enabled: true }, page: { enabled: true }, + platform: { enabled: true }, screenshot: { enabled: true }, system: { enabled: true }, }, @@ -201,10 +209,14 @@ describe('resource connections', () => { captcha: { enabled: true }, connection: { enabled: true }, console: { enabled: true }, - control: { enabled: true }, + control: { + cdp: { excluded_methods: ['Input.dispatchMouseEvent'] }, + enabled: true, + }, interaction: { enabled: true }, network: { enabled: true }, page: { enabled: true }, + platform: { enabled: true }, screenshot: { enabled: true }, system: { enabled: true }, }, @@ -222,10 +234,14 @@ describe('resource connections', () => { captcha: { enabled: true }, connection: { enabled: true }, console: { enabled: true }, - control: { enabled: true }, + control: { + cdp: { excluded_methods: ['Input.dispatchMouseEvent'] }, + enabled: true, + }, interaction: { enabled: true }, network: { enabled: true }, page: { enabled: true }, + platform: { enabled: true }, screenshot: { enabled: true }, system: { enabled: true }, }, diff --git a/tests/api-resources/browser-pools.test.ts b/tests/api-resources/browser-pools.test.ts index 1c0f4e42..1b27e325 100644 --- a/tests/api-resources/browser-pools.test.ts +++ b/tests/api-resources/browser-pools.test.ts @@ -42,10 +42,14 @@ describe('resource browserPools', () => { captcha: { enabled: true }, connection: { enabled: true }, console: { enabled: true }, - control: { enabled: true }, + control: { + cdp: { excluded_methods: ['Input.dispatchMouseEvent'] }, + enabled: true, + }, interaction: { enabled: true }, network: { enabled: true }, page: { enabled: true }, + platform: { enabled: true }, screenshot: { enabled: true }, system: { enabled: true }, }, diff --git a/tests/api-resources/browsers/browsers.test.ts b/tests/api-resources/browsers/browsers.test.ts index 6d64f5e2..b9dfeb5f 100644 --- a/tests/api-resources/browsers/browsers.test.ts +++ b/tests/api-resources/browsers/browsers.test.ts @@ -55,10 +55,14 @@ describe('resource browsers', () => { captcha: { enabled: true }, connection: { enabled: true }, console: { enabled: true }, - control: { enabled: true }, + control: { + cdp: { excluded_methods: ['Input.dispatchMouseEvent'] }, + enabled: true, + }, interaction: { enabled: true }, network: { enabled: true }, page: { enabled: true }, + platform: { enabled: true }, screenshot: { enabled: true }, system: { enabled: true }, }, diff --git a/tests/api-resources/site-configs.test.ts b/tests/api-resources/site-configs.test.ts new file mode 100644 index 00000000..0a71e191 --- /dev/null +++ b/tests/api-resources/site-configs.test.ts @@ -0,0 +1,110 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Kernel from '@onkernel/sdk'; + +const client = new Kernel({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource siteConfigs', () => { + // Mock server tests are disabled + test.skip('retrieve', async () => { + const responsePromise = client.siteConfigs.retrieve('id'); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Mock server tests are disabled + test.skip('list', async () => { + const responsePromise = client.siteConfigs.list(); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Mock server tests are disabled + test.skip('list: request options and params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + client.siteConfigs.list({ limit: 1, offset: 0 }, { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(Kernel.NotFoundError); + }); + + // Mock server tests are disabled + test.skip('listRecommendations', async () => { + const responsePromise = client.siteConfigs.listRecommendations(); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Mock server tests are disabled + test.skip('listRecommendations: request options and params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + client.siteConfigs.listRecommendations( + { + limit: 1, + offset: 0, + sort_by: 'target', + sort_order: 'asc', + }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(Kernel.NotFoundError); + }); + + // Mock server tests are disabled + test.skip('lookup: only required params', async () => { + const responsePromise = client.siteConfigs.lookup({ url: 'https://example.com' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Mock server tests are disabled + test.skip('lookup: required and optional params', async () => { + const response = await client.siteConfigs.lookup({ + url: 'https://example.com', + allowed_proxy_countries: ['US'], + }); + }); + + // Mock server tests are disabled + test.skip('resolve: only required params', async () => { + const responsePromise = client.siteConfigs.resolve({ url: 'https://example.com' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Mock server tests are disabled + test.skip('resolve: required and optional params', async () => { + const response = await client.siteConfigs.resolve({ + url: 'https://example.com', + allowed_proxy_countries: ['US'], + }); + }); +});