Skip to main content
Core SDK entrypoint for Bctrl client, errors, shared types, and service clients. Entrypoint source: sdk/src/index.ts
import { ... } from '@bctrl/sdk';

Export Index

ExportKindSourceNotes
_RpcMessagetypepackages/schemas/src/messages/rpc.tsRe-exported from non-SDK source
AuthenticationErrorclasssdk/src/errors.tsAuthentication/authorization errors — check API key
AutomationErrorclasssdk/src/errors.tsAutomation/driver/script errors — your code or selectors need fixing
Bctrlclasssdk/src/bctrl.ts-
BctrlEnvironmenttypesdk/src/config.ts-
BctrlErrorclasssdk/src/errors.tsBase error class for all bctrl SDK errors. Carries a fine-grained .code and optional .context metadata.
BctrlOptionsinterfacesdk/src/bctrl.tsOptions for Bctrl client.
BrowserConfigInfointerfacesdk/src/bctrl.tsResult of updating a named browser’s default settings.
BrowserConnectApiinterfacesdk/src/bctrl.tsCallable profile connect API scoped to a specific browser name. Strict attach only: the browser must already be running. Usage: - await bctrl.browser('my-bot').connect() (defaults to Playwright) - await bctrl.browser('my-bot').connect.playwright() - await bctrl.browser('my-bot').connect.puppeteer() - await bctrl.browser('my-bot').connect.stagehand() - await bctrl.browser('my-bot').connect.selenium()
BrowserCreateResultinterfacesdk/src/bctrl.tsResult returned when a named browser is created.
BrowserHandleinterfacesdk/src/bctrl.tsBrowser-scoped helper API for named profiles.
BrowserInfointerfacesdk/src/bctrl.tsBrowser status information.
BrowserUpgradeInfointerfacesdk/src/bctrl.tsResult of upgrading a provisioned profile’s fingerprint/kernel. Returns null when the profile is already up to date.
ConnectOptionsinterfacesdk/src/base/types.tsConnection options for connecting to bctrl
connectSessionDriverfunctionsdk/src/client/rpc.tsConnect a driver to an existing started session on the control-plane.
CreateOptionsinterfacesdk/src/bctrl.tsOptions for creating a named browser.
CreateSessionOptionsinterfacesdk/src/bctrl.tsOptions for creating a one-time ephemeral browser session (no driver attached yet).
defineScriptfunctionsdk/src/scripts/definition.ts-
DriverTypetypepackages/schemas/src/messages/base.tsRe-exported from non-SDK source
EvaluateOptionsinterfacesdk/src/base/types.tsEvaluate options
ExecuteOptionsinterfacesdk/src/bctrl.tsOptions for one-shot script execution via bctrl.execute().
ExtensionsClientclasssdk/src/extensions/client.ts-
fromErrorResponsefunctionsdk/src/errors.tsReconstruct a typed error from the wire format (errorCode + errorContext)
getAutomationDiagnosticfunctionsdk/src/errors.tsGet a typed automation diagnostic payload from an SDK error when available.
getAutomationHintfunctionsdk/src/errors.tsGet a typed automation hint from an SDK error when available.
isAuthenticationErrorfunctionsdk/src/errors.ts-
isAutomationErrorfunctionsdk/src/errors.ts-
isBctrlErrorfunctionsdk/src/errors.ts-
isSessionErrorfunctionsdk/src/errors.ts-
isTimeoutErrorfunctionsdk/src/errors.ts-
ListObjectsOptionsinterfacesdk/src/storage/client.ts-
ListObjectsResultinterfacesdk/src/storage/client.ts-
LocatorStepinterfacesdk/src/base/types.tsLocator step for remote locator chains
MouseClickOptionsinterfacesdk/src/base/types.tsMouse click options
PresignedUrlResultinterfacesdk/src/storage/client.ts-
PressOptionsinterfacesdk/src/base/types.tsKeyboard press options
ProfileApiinterfacesdk/src/bctrl.ts-
ProfileConnectResultinterfacesdk/src/bctrl.ts-
ProfileOptionsinterfacesdk/src/base/types.tsProfile selection options
ProfileStartResultinterfacesdk/src/bctrl.ts-
ProxyConfiginterfacesdk/src/bctrl.tsProxy configuration for browser profiles.
rpcfunctionsdk/src/client/rpc.tsRPC call to control-plane
RpcMessageSdkinterfacesdk/src/base/types.tsSDK RPC message for sending commands to control-plane
schemasnamespacepackages/schemas/src/index.tsRe-exported from non-SDK source
SdkAutomationErrorclasssdk/src/errors.tsAutomation/driver/script errors — your code or selectors need fixing
SelectOptioninterfacesdk/src/base/types.tsSelect options
sendCommandfunctionsdk/src/client/rpc.ts-
SessionApiinterfacesdk/src/bctrl.tsCallable session creation API. Usage: - await bctrl.session() (defaults to Playwright) - await bctrl.session.playwright() - await bctrl.session.puppeteer() - await bctrl.session.stagehand() - await bctrl.session.selenium()
SessionErrorclasssdk/src/errors.tsSession/browser lifecycle errors — reconnect or recreate
SessionInfointerfacesdk/src/base/types.tsSession information returned from control-plane
SessionsApiinterfacesdk/src/bctrl.ts-
SessionStoragePolicytypepackages/schemas/src/storage/types.tsRe-exported from non-SDK source
StartedSessionDatainterfacesdk/src/bctrl.tsRaw data returned from ephemeral session start (no driver attached yet).
StartOptionsinterfacesdk/src/bctrl.tsOptions for starting a browser.
startSessionfunctionsdk/src/client/rpc.tsStart an ephemeral browser session on the control-plane (no driver connected).
stopSessionfunctionsdk/src/client/rpc.tsStop a session on the control-plane
StorageBrowseFiletypesdk/src/storage/client.ts-
StorageBrowseOptionsinterfacesdk/src/storage/client.ts-
StorageBrowseResulttypesdk/src/storage/client.ts-
StorageClientclasssdk/src/storage/client.tsClient for interacting with workspace storage.
StorageObjectinterfacesdk/src/storage/client.ts-
StorageReadResulttypesdk/src/storage/client.ts-
TimeoutErrorclasssdk/src/errors.tsTimeout errors — increase timeout or retry
UploadObjectOptionsinterfacesdk/src/storage/client.ts-
UploadObjectResultinterfacesdk/src/storage/client.ts-
UploadResultinterfacesdk/src/storage/client.ts-
VaultClientclasssdk/src/vault/client.ts-
znamespacenode_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/external.d.ctsRe-exported from non-SDK source
ZodTypeinterfacenode_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.d.ctsRe-exported from non-SDK source

Classes

AuthenticationError

Source: sdk/src/errors.ts
class AuthenticationError extends BctrlError
Authentication/authorization errors — check API key

Constructor

new (message: string, context?: Record<string, unknown>)

AutomationError

Source: sdk/src/errors.ts
class AutomationError extends BctrlError
Automation/driver/script errors — your code or selectors need fixing

Constructor

new (message: string, code?: string, context?: Record<string, unknown>)

Properties

NameTypeNotes
diagnosticAutomationDiagnostic | undefinedgetter • Structured diagnostic payload with machine-readable fix metadata.
hintstring | undefinedgetter • Human-readable suggestion from control-plane validation.

Bctrl

Source: sdk/src/bctrl.ts
class Bctrl

Constructor

new (options: BctrlOptions)

Properties

NameTypeNotes
executeExecuteApireadonly • One-shot execution API. Usage: - bctrl.execute({ fn, params }) - bctrl.execute.playwright({ fn, params }) - bctrl.execute.puppeteer({ fn, params }) - bctrl.execute.stagehand({ fn, params }) - bctrl.execute.selenium({ fn, params })
extensionsExtensionsClientgetter • Extensions client for account-scoped extension management.
profilesProfileApireadonly
sessionSessionApireadonly
sessionsSessionsApireadonly
vaultVaultClientgetter • Vault client for managing account-scoped credentials.

Methods

browser
Browser-scoped helper for named profile workflows.
browser(name: string): BrowserHandle
defineScript
Define a reusable typed script for one-shot execution.
defineScript<TParams extends ZodTypeAny, TResult, TScriptPage extends BaseScriptPage = BaseScriptPage>(input: DefineScriptInput<TParams, TResult, TScriptPage>): ScriptDefinition<TParams, TResult, TScriptPage>
getHosts
getHosts(): Promise<string[]>
health
health(): Promise<{ status: string; connectedHosts: number }>
storage
Get a storage client for a named workspace (no browser session required).
storage(workspaceName: string): StorageClient

BctrlError

Source: sdk/src/errors.ts
class BctrlError extends Error
Base error class for all bctrl SDK errors. Carries a fine-grained .code and optional .context metadata.

Constructor

new (message: string, code: string, context?: Record<string, unknown>)

Methods

toJSON
Serialize for structured loggers (pino, winston) and JSON.stringify()
toJSON(): Record<string, unknown>

ExtensionsClient

Source: sdk/src/extensions/client.ts
class ExtensionsClient

Constructor

new (baseUrl: string, apiKey?: string)

Methods

delete
Delete an extension.
delete(id: string): Promise<void>
get
Get extension metadata by ID.
get(id: string): Promise<ExtensionMetadata | null>
install
Install extension(s) on a browser profile.
install(browserName: string, extensionIds: string | string[]): Promise<void>
installed
List extensions installed on a browser profile.
installed(browserName: string): Promise<ExtensionMetadata[]>
list
List all uploaded extensions.
list(): Promise<ExtensionMetadata[]>
uninstall
Uninstall an extension from a browser profile.
uninstall(browserName: string, extensionId: string): Promise<void>
update
Update an existing extension with a new file.
update(id: string, opts: { file: Buffer; filename: string }): Promise<ExtensionMetadata>
upload
Upload an extension from a file buffer or Chrome Web Store URL.
upload(opts: {
    file?: Buffer;
    filename?: string;
    url?: string;
  }): Promise<ExtensionMetadata>

SdkAutomationError

Alias of AutomationError. Source: sdk/src/errors.ts
class AutomationError extends BctrlError
Automation/driver/script errors — your code or selectors need fixing

Constructor

new (message: string, code?: string, context?: Record<string, unknown>)

Properties

NameTypeNotes
diagnosticAutomationDiagnostic | undefinedgetter • Structured diagnostic payload with machine-readable fix metadata.
hintstring | undefinedgetter • Human-readable suggestion from control-plane validation.

SessionError

Source: sdk/src/errors.ts
class SessionError extends BctrlError
Session/browser lifecycle errors — reconnect or recreate

Constructor

new (message: string, code?: string, context?: Record<string, unknown>)

StorageClient

Source: sdk/src/storage/client.ts
class StorageClient
Client for interacting with workspace storage.

Constructor

new (baseUrl: string, workspace: string, apiKey?: string, sessionId?: string)

Methods

browse
Browse files/folders by logical prefix (hierarchical listing with cursor pagination).
browse(options?: StorageBrowseOptions): Promise<StorageBrowseResult>
delete
Delete a file by logical path.
delete(filePath: string): Promise<void>
deleteAll
Delete all files for this workspace.
deleteAll(): Promise<number>
deleteObject
Delete an object by catalog ID.
deleteObject(id: string): Promise<void>
downloadObject
Download an object by catalog ID.
downloadObject(id: string): Promise<Buffer>
forWorkspace
Clone this client for another workspace while preserving auth/session binding.
forWorkspace(workspace: string): StorageClient
get
Get a file by logical path as raw bytes.
get(filePath: string): Promise<Buffer>
getDownloadsZip
Get all downloads as a ZIP file.
getDownloadsZip(): Promise<Buffer>
getDownloadUrl
Get a presigned URL for direct download by logical path.
getDownloadUrl(filePath: string): Promise<string>
getObjectDownloadUrl
Get a presigned URL for direct download by object ID.
getObjectDownloadUrl(id: string): Promise<string>
listObjects
List object metadata from the storage catalog.
listObjects(options?: ListObjectsOptions): Promise<StorageObject[]>
read
Read a UTF-8 text preview by logical path.
read(filePath: string, maxBytes?: number): Promise<StorageReadResult>
upload
Upload a file to workspace storage.
upload(filePath: string, data: Buffer | Uint8Array | Blob, filename?: string): Promise<UploadResult>
uploadObject
Upload a file and register it in the storage object catalog.
uploadObject(data: Buffer | Uint8Array | Blob, options?: UploadObjectOptions): Promise<UploadObjectResult>

TimeoutError

Source: sdk/src/errors.ts
class TimeoutError extends BctrlError
Timeout errors — increase timeout or retry

Constructor

new (message: string, context?: Record<string, unknown>)

VaultClient

Source: sdk/src/vault/client.ts
class VaultClient

Constructor

new (baseUrl: string, apiKey?: string, sessionId?: string)

Methods

delete
Delete a credential from the vault.
delete(key: string): Promise<void>
get
Get a credential from the vault. Returns null if not found.
get(key: string): Promise<VaultCredential | null>
list
list(input?: string | VaultListKeyOptions | VaultListMetaOptions): Promise<string[] | VaultCredentialMeta[]>
set
Set (create/update) a credential in the vault.
set(key: string, credential: VaultCredentialInput): Promise<void>
totp
Get current TOTP code for a credential.
totp(key: string): Promise<string>

Functions

connectSessionDriver

Source: sdk/src/client/rpc.ts Connect a driver to an existing started session on the control-plane.
connectSessionDriver(baseUrl: string, sessionId: string, driver: BrowserDriver, apiKey?: string): Promise<{
  id: string;
  hostId: string;
  currentDriver: BrowserDriver;
  defaultContextId?: string;
  defaultPageId?: string;
  storageWorkspace?: string;
}>

defineScript

Source: sdk/src/scripts/definition.ts
defineScript<TParams extends ZodTypeAny, TResult, TScriptPage extends BaseScriptPage = BaseScriptPage>(input: DefineScriptInput<TParams, TResult, TScriptPage>): ScriptDefinition<TParams, TResult, TScriptPage>

fromErrorResponse

Source: sdk/src/errors.ts Reconstruct a typed error from the wire format (errorCode + errorContext)
fromErrorResponse(message: string, code?: string, context?: Record<string, unknown>): BctrlError

getAutomationDiagnostic

Source: sdk/src/errors.ts Get a typed automation diagnostic payload from an SDK error when available.
getAutomationDiagnostic(error: unknown): AutomationDiagnostic | undefined

getAutomationHint

Source: sdk/src/errors.ts Get a typed automation hint from an SDK error when available.
getAutomationHint(error: unknown): string | undefined

isAuthenticationError

Source: sdk/src/errors.ts
isAuthenticationError(error: unknown): error is AuthenticationError

isAutomationError

Source: sdk/src/errors.ts
isAutomationError(error: unknown): error is AutomationError

isBctrlError

Source: sdk/src/errors.ts
isBctrlError(error: unknown): error is BctrlError

isSessionError

Source: sdk/src/errors.ts
isSessionError(error: unknown): error is SessionError

isTimeoutError

Source: sdk/src/errors.ts
isTimeoutError(error: unknown): error is TimeoutError

rpc

Source: sdk/src/client/rpc.ts RPC call to control-plane
rpc<T>(endpoint: string, body: Record<string, unknown>, timeout?: number): Promise<T>

sendCommand

Source: sdk/src/client/rpc.ts
sendCommand<T>(baseUrl: string, _hostId: string, sessionId: string, command: SendCommandInput, timeout?: number): Promise<T>

startSession

Source: sdk/src/client/rpc.ts Start an ephemeral browser session on the control-plane (no driver connected).
startSession(baseUrl: string, options?: {
    apiKey?: string;
    humanize?: boolean;
    humanizePersonaId?: number;
    proxy?: {
      type: 'http' | 'socks5';
      host: string;
      port: number;
      username?: string;
      password?: string;
    } | null;
    storage?: SessionStoragePolicy;
    solveCaptchas?: boolean;
    vault?: VaultSessionPolicy;
  }): Promise<{
  id: string;
  hostId: string;
  status: 'active' | 'stopped';
  storageWorkspace?: string;
}>

stopSession

Source: sdk/src/client/rpc.ts Stop a session on the control-plane
stopSession(baseUrl: string, sessionId: string, apiKey?: string): Promise<void>

Interfaces

BctrlOptions

Source: sdk/src/bctrl.ts Options for Bctrl client.
export interface BctrlOptions {
  /** API key for authentication */
  apiKey: string;
  /**
   * Target environment.
   * Defaults to `production` (`https://api.bctrl.ai`).
   * Use `development` for a local control plane on `http://localhost:3000`.
   */
  environment?: BctrlEnvironment;
  /**
   * Control plane origin or API base URL.
   * If you pass an origin, the SDK appends `/v1` automatically.
   */
  baseUrl?: string;
  /** Enable anonymous telemetry (error tracking). Set to false to opt out. @default true */
  telemetry?: boolean;
}

BrowserConfigInfo

Source: sdk/src/bctrl.ts Result of updating a named browser’s default settings.
export interface BrowserConfigInfo {
  name: string;
  humanize: boolean;
  hasProxy: boolean;
  updatedAt: string | null;
}

BrowserConnectApi

Source: sdk/src/bctrl.ts Callable profile connect API scoped to a specific browser name. Strict attach only: the browser must already be running. Usage:
  • await bctrl.browser('my-bot').connect() (defaults to Playwright)
  • await bctrl.browser('my-bot').connect.playwright()
  • await bctrl.browser('my-bot').connect.puppeteer()
  • await bctrl.browser('my-bot').connect.stagehand()
  • await bctrl.browser('my-bot').connect.selenium()
export interface BrowserConnectApi {
  (): Promise<PlaywrightSession>;
  playwright(): Promise<PlaywrightSession>;
  puppeteer(): Promise<PuppeteerSession>;
  stagehand(): Promise<StagehandSession>;
  selenium(): Promise<SeleniumSession>;
}

BrowserCreateResult

Source: sdk/src/bctrl.ts Result returned when a named browser is created.
export interface BrowserCreateResult {
  /** Browser name */
  name: string;
  /** Creation status */
  status: 'created';
  /** Default humanize setting */
  humanize: boolean;
  /** Whether proxy is configured */
  hasProxy: boolean;
}

BrowserHandle

Source: sdk/src/bctrl.ts Browser-scoped helper API for named profiles.
export interface BrowserHandle {
  name: string;
  create(options?: CreateOptions): Promise<BrowserCreateResult>;
  connect: BrowserConnectApi;
  start(
    options?: StartOptions
  ): Promise<{ name: string; status: string; sessionId?: string; waited?: boolean }>;
  stop(): Promise<{ name: string; status: string }>;
  status(): Promise<BrowserInfo>;
  configure(options: ConfigureOptions): Promise<BrowserConfigInfo>;
  upgrade(): Promise<BrowserUpgradeInfo | null>;
  delete(): Promise<{ name: string; status: string }>;
}

BrowserInfo

Source: sdk/src/bctrl.ts Browser status information.
export interface BrowserInfo {
  /** Browser name */
  name: string;
  /** Current status */
  status: 'running' | 'stopped';
  /** Currently connected driver (if running) */
  currentDriver: string | null;
  /** Default humanize setting */
  humanize: boolean;
  /** Whether proxy is configured */
  hasProxy: boolean;
  /** Creation timestamp */
  createdAt: string;
  /** Last used timestamp */
  lastUsedAt: string | null;
}

BrowserUpgradeInfo

Source: sdk/src/bctrl.ts Result of upgrading a provisioned profile’s fingerprint/kernel. Returns null when the profile is already up to date.
export interface BrowserUpgradeInfo {
  fingerprint: {
    browser: {
      product: string;
      major: number;
      version: string;
    };
  } | null;
}

ConnectOptions

Source: sdk/src/base/types.ts Connection options for connecting to bctrl
export interface ConnectOptions {
  /** Profile to use (by ID or name) */
  profile?: ProfileOptions;
  /** API key for authentication */
  apiKey: string;
  /**
   * Target environment.
   * Defaults to `production` (`https://api.bctrl.ai`).
   * Use `development` for a local control plane on `http://localhost:3000`.
   */
  environment?: BctrlEnvironment;
  /**
   * Control plane origin or API base URL.
   * If you pass an origin, the SDK appends `/v1` automatically.
   */
  baseUrl?: string;
  /** Browser options */
  browserOptions?: {
    /** Run browser in headless mode */
    headless?: boolean;
  };
  /** Enable human-like mouse movement via CDP proxy (default: true) */
  humanize?: boolean;
  /** Mouse persona ID for humanization (0-124) */
  humanizePersonaId?: number;
}

CreateOptions

Source: sdk/src/bctrl.ts Options for creating a named browser.
export interface CreateOptions {
  /**
   * Default proxy configuration for this named browser profile.
   *
   * Notes:
   * - Applied when the underlying Kameleo profile is (lazily) provisioned.
   * - Can be temporarily overridden per session via bctrl.browser(name).start({ proxy }).
   * - Can be updated while stopped via the control-plane profile update API.
   */
  proxy?: ProxyConfig;

  /**
   * Default humanize setting for this browser.
   * Can be overridden when calling start().
   * @default true
   */
  humanize?: boolean;
}

CreateSessionOptions

Source: sdk/src/bctrl.ts Options for creating a one-time ephemeral browser session (no driver attached yet).
export interface CreateSessionOptions {
  /**
   * Enable/disable humanization for this session (defaults to backend default).
   */
  humanize?: boolean;

  /**
   * Mouse persona ID for humanization (0-124).
   */
  humanizePersonaId?: number;

  /**
   * Temporary proxy for this ephemeral session. Use null to force direct connection.
   */
  proxy?: ProxyConfig | null;

  /**
   * Session-level storage access policy for this ephemeral session.
   */
  storage?: SessionStoragePolicy;

  /**
   * Enable automatic captcha detection/solving.
   */
  solveCaptchas?: boolean;

  /**
   * Session-scoped vault access policy.
   */
  vault?: VaultSessionPolicy;
}

EvaluateOptions

Source: sdk/src/base/types.ts Evaluate options
export interface EvaluateOptions {
  timeout?: number;
}

ExecuteOptions

Source: sdk/src/bctrl.ts Options for one-shot script execution via bctrl.execute().
export interface ExecuteOptions<TScriptPage extends BaseScriptPage = ScriptPage> {
  /** Function, defineScript(), or serialized function string to execute */
  fn: ScriptFn<any, TScriptPage> | ScriptDefinition<ZodTypeAny, any, TScriptPage> | string;
  /** Named browser to connect to. The browser must already be running; if omitted, an ephemeral session is used. */
  browser?: string;
  /** Driver type (defaults to 'playwright') */
  driver?: DriverType;
  /** Parameters passed as ctx.params (and injected as aliases) inside the script */
  params?: Record<string, unknown>;
  /** Execution timeout in milliseconds (max 10 minutes) */
  timeoutMs?: number;
  /** Target page ID (defaults to active/default page) */
  pageId?: string;
  /** Script log capture mode */
  logs?: ExecuteLogsMode;
  /** Optional callback replayed for each captured log entry after completion */
  onLog?: ScriptExecutionOptions['onLog'];
}

ListObjectsOptions

Source: sdk/src/storage/client.ts
export interface ListObjectsOptions {
  workspace?: string;
  sessionId?: string;
  source?: string;
  driver?: string;
  target?: string;
  pathPrefix?: string;
  limit?: number;
  offset?: number;
}

ListObjectsResult

Source: sdk/src/storage/client.ts
export interface ListObjectsResult {
  objects: StorageObject[];
}

LocatorStep

Source: sdk/src/base/types.ts Locator step for remote locator chains
export interface LocatorStep {
  /** Locator method (e.g., 'locator', 'getByRole', 'getByText') */
  method: string;
  /** Arguments for the locator method */
  args: unknown[];
}

MouseClickOptions

Source: sdk/src/base/types.ts Mouse click options
export interface MouseClickOptions {
  button?: 'left' | 'right' | 'middle';
  clickCount?: number;
}

PresignedUrlResult

Source: sdk/src/storage/client.ts
export interface PresignedUrlResult {
  url: string;
  key?: string;
  expiresIn: number;
}

PressOptions

Source: sdk/src/base/types.ts Keyboard press options
export interface PressOptions {
  delay?: number;
}

ProfileApi

Source: sdk/src/bctrl.ts
export interface ProfileApi {
  create(options?: ProfileCreateOptions): Promise<Profile>;
  list(options?: ProfileListOptions): Promise<ProfileListResult>;
  get(profileId: string): Promise<Profile>;
  start(profileId: string, options?: ProfileStartRequest): Promise<ProfileStartResult>;
  connect(
    profileId: string,
    request?: Partial<ProfileConnectRequest>
  ): Promise<ProfileConnectResult>;
  stop(profileId: string): Promise<ProfileStopResponse>;
  status(profileId: string): Promise<ProfileLifecycleStatus>;
  delete(profileId: string): Promise<void>;
}

ProfileConnectResult

Source: sdk/src/bctrl.ts
export interface ProfileConnectResult {
  profileId: string;
  sessionId: string;
  hostId: string;
  driver: BrowserDriver;
  previousDriver: string | null;
  reused: boolean;
  driverChanged: boolean;
  storageWorkspace?: string;
  defaultContextId?: string;
  defaultPageId?: string;
}

ProfileOptions

Source: sdk/src/base/types.ts Profile selection options
export interface ProfileOptions {
  /** Use existing profile by ID */
  id?: string;
  /** Use existing profile by name */
  name?: string;
  /** Create new profile with this name */
  createName?: string;
}

ProfileStartResult

Source: sdk/src/bctrl.ts
export interface ProfileStartResult {
  profileId: string;
  kind: 'browser';
  status: 'started' | 'already_running';
  sessionId: string;
  waited: boolean;
}

ProxyConfig

Source: sdk/src/bctrl.ts Proxy configuration for browser profiles.
export interface ProxyConfig {
  /** Proxy type */
  type: 'http' | 'socks5';
  /** Proxy host */
  host: string;
  /** Proxy port */
  port: number;
  /** Proxy username (optional) */
  username?: string;
  /** Proxy password (optional) */
  password?: string;
}

RpcMessageSdk

Source: sdk/src/base/types.ts SDK RPC message for sending commands to control-plane
export interface RpcMessageSdk {
  /** Driver type */
  driver: DriverType;
  /** Target object (browser, context, page, locator) */
  target: string;
  /** Method to call on the target */
  method: string;
  /** Arguments for the method */
  args: unknown[];
  /** Page ID for page-specific operations */
  pageId?: string;
  /** Context ID for context-specific operations */
  contextId?: string;
  /** Locator chain for locator operations */
  locatorChain?: LocatorStep[];
}

SelectOption

Source: sdk/src/base/types.ts Select options
export interface SelectOption {
  value?: string;
  label?: string;
  index?: number;
}

SessionApi

Source: sdk/src/bctrl.ts Callable session creation API. Usage:
  • await bctrl.session() (defaults to Playwright)
  • await bctrl.session.playwright()
  • await bctrl.session.puppeteer()
  • await bctrl.session.stagehand()
  • await bctrl.session.selenium()
export interface SessionApi {
  (options?: CreateSessionOptions): Promise<PlaywrightSession>;
  playwright(options?: CreateSessionOptions): Promise<PlaywrightSession>;
  puppeteer(options?: CreateSessionOptions): Promise<PuppeteerSession>;
  stagehand(options?: CreateSessionOptions): Promise<StagehandSession>;
  selenium(options?: CreateSessionOptions): Promise<SeleniumSession>;
}

SessionInfo

Source: sdk/src/base/types.ts Session information returned from control-plane
export interface SessionInfo {
  /** Unique session ID */
  id: string;
  /** Host ID where session is running */
  hostId: string;
  /** Default browser context ID (if applicable) */
  defaultContextId?: string;
  /** Default page ID (if applicable) */
  defaultPageId?: string;
}

SessionsApi

Source: sdk/src/bctrl.ts
export interface SessionsApi {
  start(options?: SessionStartOptions): Promise<StartedSessionData>;
  connect(
    sessionId: string,
    request?: Partial<SessionConnectRequest>
  ): Promise<SessionConnectResponse>;
  stop(sessionId: string): Promise<void>;
  list(): Promise<Array<{ id: string; hostId: string; status: string }>>;
  get(
    sessionId: string
  ): Promise<{ id: string; hostId: string; status: string; storageWorkspace?: string }>;
}

StartedSessionData

Source: sdk/src/bctrl.ts Raw data returned from ephemeral session start (no driver attached yet).
export interface StartedSessionData {
  id: string;
  hostId: string;
  status?: 'active' | 'stopped';
  storageWorkspace?: string;
}

StartOptions

Source: sdk/src/bctrl.ts Options for starting a browser.
export interface StartOptions {
  /**
   * Override the browser's default humanize setting.
   * If not provided, uses the browser's default from create().
   */
  humanize?: boolean;

  /**
   * Temporary proxy override for this start only.
   * Requires the browser to be stopped (will error if already running).
   * Use null to force a direct connection for this one session.
   */
  proxy?: ProxyConfig | null;

  /**
   * Session-level storage access policy for this started browser session.
   * If omitted, the platform default workspace is used and access is unrestricted.
   */
  storage?: SessionStoragePolicy;
}

StorageBrowseOptions

Source: sdk/src/storage/client.ts
export interface StorageBrowseOptions {
  prefix?: string;
  cursor?: string;
  limit?: number;
}

StorageObject

Source: sdk/src/storage/client.ts
export interface StorageObject {
  id: string;
  workspace: string;
  sessionId: string | null;
  source: string;
  driver: string | null;
  target: string | null;
  logicalPath: string;
  filename: string;
  contentType: string;
  sizeBytes: number;
  createdAt: string | null;
  expiresAt: string | null;
  metadata: Record<string, unknown> | null;
}

UploadObjectOptions

Source: sdk/src/storage/client.ts
export interface UploadObjectOptions {
  workspace?: string;
  path?: string;
  source?: string;
  sessionId?: string;
  driver?: string;
  target?: string;
  filename?: string;
}

UploadObjectResult

Source: sdk/src/storage/client.ts
export interface UploadObjectResult {
  id: string;
  workspace: string;
  logicalPath: string;
  objectKey: string;
  filename: string;
  sizeBytes: number;
  contentType: string;
  expiresAt: string | null;
}

UploadResult

Source: sdk/src/storage/client.ts
export interface UploadResult {
  success: boolean;
  key: string;
  filename: string;
}

Type Aliases

BctrlEnvironment

Source: sdk/src/config.ts
export type BctrlEnvironment = 'production' | 'development';

StorageBrowseFile

Source: sdk/src/storage/client.ts
export type StorageBrowseFile = StorageBrowseResult['files'][number];

StorageBrowseResult

Source: sdk/src/storage/client.ts
export type StorageBrowseResult = StorageBrowseResponse;

StorageReadResult

Source: sdk/src/storage/client.ts
export type StorageReadResult = StorageReadResponse;

External Re-exports

ExportKindSourceNotes
_RpcMessagetypepackages/schemas/src/messages/rpc.tsRe-exported from non-SDK source
DriverTypetypepackages/schemas/src/messages/base.tsRe-exported from non-SDK source
schemasnamespacepackages/schemas/src/index.tsRe-exported from non-SDK source
SessionStoragePolicytypepackages/schemas/src/storage/types.tsRe-exported from non-SDK source
znamespacenode_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/external.d.ctsRe-exported from non-SDK source
ZodTypeinterfacenode_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.d.ctsRe-exported from non-SDK source