notte-sdk 1.10.0 → 1.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/version.ts","../src/version-check.ts","../src/lib/client/core/bodySerializer.gen.ts","../src/lib/client/core/params.gen.ts","../src/lib/client/core/serverSentEvents.gen.ts","../src/lib/client/core/pathSerializer.gen.ts","../src/lib/client/core/utils.gen.ts","../src/lib/client/core/auth.gen.ts","../src/lib/client/client/utils.gen.ts","../src/lib/client/client/client.gen.ts","../src/lib/client/client.gen.ts","../src/lib/client/sdk.gen.ts","../src/managed-auth.ts","../src/errors.ts","../src/resources.gen.ts","../src/session.ts","../src/captcha.ts","../src/page-fetch.ts","../src/cookies.ts","../src/utils.ts","../src/scrape.ts","../src/retry.ts","../src/vaults.ts","../src/personas.ts","../src/functions.ts","../src/encryption.ts","../src/run-payloads.ts","../src/files.ts","../src/anything.ts","../src/secrets.ts","../src/usage.ts","../src/client.ts","../src/actions.ts","../src/proxy/types.ts","../src/index.ts"],"sourcesContent":["declare const __SDK_VERSION__: string;\ndeclare const __SDK_PACKAGE_NAME__: string;\n\n// Injected at build time by tsup from package.json \"version\".\n// Falls back to 'dev' when running outside a build (tsx, ts-node, tests).\nexport const SDK_VERSION: string = typeof __SDK_VERSION__ !== 'undefined' ? __SDK_VERSION__ : 'dev';\nexport const SDK_PACKAGE_NAME: string =\n typeof __SDK_PACKAGE_NAME__ !== 'undefined' ? __SDK_PACKAGE_NAME__ : 'notte-sdk';\n","import { SDK_PACKAGE_NAME, SDK_VERSION } from '@/version';\n\nconst DISABLE_ENV = 'NOTTE_SDK_DISABLE_VERSION_CHECK';\nconst VERSION_CHECK_TIMEOUT_MS = 1_500;\n\ntype Env = Record<string, string | undefined>;\n\ntype VersionCheckOptions = {\n currentVersion?: string;\n packageName?: string;\n fetchFn?: typeof fetch;\n warnFn?: (message: string) => void;\n env?: Env;\n};\n\ntype NpmLatestResponse = {\n version?: unknown;\n};\n\n// Mirrors the module globals of `notte_sdk.endpoints.base`: the registry is\n// contacted at most once per process and the answer is cached so later 422\n// validation errors can suggest the upgrade.\nlet versionCheckPerformed = false;\nlet cachedLatestVersion: string | undefined;\n\n/**\n * Check the npm registry once per process and warn when a newer release exists.\n * Called by `NotteClient` on construction, like `check_and_warn_version_mismatch`\n * in the Python client. Never throws and never blocks the caller.\n */\nexport function startVersionCheck(): void {\n if (versionCheckPerformed || !shouldCheckVersion()) {\n return;\n }\n versionCheckPerformed = true;\n\n const timer = setTimeout(() => {\n void checkForLatestVersion().catch(() => undefined);\n }, 0);\n timer.unref?.();\n}\n\n/** Latest version seen on the registry during this process, if the check ran. */\nexport function getLatestKnownVersion(): string | undefined {\n return cachedLatestVersion;\n}\n\n/** True when `current` is strictly older than `latest`. Unparseable versions never suggest an upgrade. */\nexport function isVersionOlder(current: string, latest: string): boolean {\n return isVersionGreater(latest, current);\n}\n\n/**\n * When the registry reported a newer version, return it so error messages can\n * suggest the upgrade. Development builds never suggest one.\n */\nexport function upgradeSuggestion(currentVersion: string = SDK_VERSION): string | undefined {\n if (!cachedLatestVersion || !isPublishedVersion(currentVersion)) {\n return undefined;\n }\n return isVersionOlder(currentVersion, cachedLatestVersion) ? cachedLatestVersion : undefined;\n}\n\nexport function createUpgradeErrorMessage(\n errorContext: string,\n latestVersion: string,\n originalError?: string,\n currentVersion: string = SDK_VERSION,\n packageName: string = SDK_PACKAGE_NAME,\n): string {\n let message =\n `${errorContext}. This might be due to API schema changes. ` +\n `Current SDK version: ${currentVersion}, Latest available: ${latestVersion}. ` +\n `Either you made a mistake in the request arguments, or you should upgrade to the latest ` +\n `${packageName} version by running: 'npm install ${packageName}@${latestVersion}'`;\n if (originalError) {\n message += `. Original error: ${originalError}`;\n }\n return message;\n}\n\nexport async function checkForLatestVersion(options: VersionCheckOptions = {}): Promise<void> {\n const currentVersion = options.currentVersion ?? SDK_VERSION;\n const packageName = options.packageName ?? SDK_PACKAGE_NAME;\n const fetchFn = options.fetchFn ?? globalThis.fetch;\n const warnFn = options.warnFn ?? console.warn;\n const env = options.env ?? getEnv();\n\n if (!shouldCheckVersion(currentVersion, fetchFn, env)) {\n return;\n }\n\n const latestVersion = await fetchLatestVersion(packageName, fetchFn);\n if (!latestVersion) {\n return;\n }\n cachedLatestVersion = latestVersion;\n\n if (!isVersionGreater(latestVersion, currentVersion)) {\n return;\n }\n\n warnFn(\n `⚠️ You are using ${packageName} version ${currentVersion}, but version ${latestVersion} is available on npm. ` +\n `Run 'npm install ${packageName}@${latestVersion}' to avoid any interruptions.`,\n );\n}\n\n/** Test hook: forget the once-per-process state. */\nexport function resetVersionCheckForTests(): void {\n versionCheckPerformed = false;\n cachedLatestVersion = undefined;\n}\n\nfunction shouldCheckVersion(\n currentVersion: string = SDK_VERSION,\n fetchFn: typeof fetch | undefined = globalThis.fetch,\n env: Env | undefined = getEnv(),\n): boolean {\n if (!fetchFn || !env || env[DISABLE_ENV] || env.NODE_ENV === 'test' || env.VITEST || env.CI) {\n return false;\n }\n\n return isPublishedVersion(currentVersion);\n}\n\nasync function fetchLatestVersion(packageName: string, fetchFn: typeof fetch): Promise<string | undefined> {\n const controller = typeof AbortController !== 'undefined' ? new AbortController() : undefined;\n const timeout = controller ? setTimeout(() => controller.abort(), VERSION_CHECK_TIMEOUT_MS) : undefined;\n\n timeout?.unref?.();\n\n try {\n const response = await fetchFn(`https://registry.npmjs.org/${encodeURIComponent(packageName)}/latest`, {\n headers: {\n accept: 'application/json',\n 'user-agent': `${packageName}/${SDK_VERSION} (https://github.com/nottelabs/notte)`,\n },\n signal: controller?.signal,\n });\n\n if (!response.ok) {\n return undefined;\n }\n\n const payload = (await response.json()) as NpmLatestResponse;\n return typeof payload.version === 'string' ? payload.version : undefined;\n } catch {\n return undefined;\n } finally {\n if (timeout) {\n clearTimeout(timeout);\n }\n }\n}\n\nfunction isPublishedVersion(version: string): boolean {\n return /^\\d+\\.\\d+\\.\\d+/.test(version) && !version.includes('dev');\n}\n\nfunction isVersionGreater(candidate: string, current: string): boolean {\n const candidateVersion = parseSemver(candidate);\n const currentVersion = parseSemver(current);\n\n if (!candidateVersion || !currentVersion) {\n return false;\n }\n\n for (let index = 0; index < 3; index += 1) {\n if (candidateVersion.parts[index] > currentVersion.parts[index]) {\n return true;\n }\n\n if (candidateVersion.parts[index] < currentVersion.parts[index]) {\n return false;\n }\n }\n\n return currentVersion.prerelease.length > 0 && candidateVersion.prerelease.length === 0;\n}\n\nfunction parseSemver(version: string): { parts: [number, number, number]; prerelease: string } | undefined {\n const match = version.match(/^(\\d+)\\.(\\d+)\\.(\\d+)(?:-([^+]+))?/);\n\n if (!match) {\n return undefined;\n }\n\n return {\n parts: [Number(match[1]), Number(match[2]), Number(match[3])],\n prerelease: match[4] ?? '',\n };\n}\n\nfunction getEnv(): Env | undefined {\n return typeof process !== 'undefined' ? process.env : undefined;\n}\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerializer.gen';\n\nexport type QuerySerializer = (query: Record<string, unknown>) => string;\n\nexport type BodySerializer = (body: unknown) => unknown;\n\ntype QuerySerializerOptionsObject = {\n allowReserved?: boolean;\n array?: Partial<SerializerOptions<ArrayStyle>>;\n object?: Partial<SerializerOptions<ObjectStyle>>;\n};\n\nexport type QuerySerializerOptions = QuerySerializerOptionsObject & {\n /**\n * Per-parameter serialization overrides. When provided, these settings\n * override the global array/object settings for specific parameter names.\n */\n parameters?: Record<string, QuerySerializerOptionsObject>;\n};\n\nconst serializeFormDataPair = (data: FormData, key: string, value: unknown): void => {\n if (typeof value === 'string' || value instanceof Blob) {\n data.append(key, value);\n } else if (value instanceof Date) {\n data.append(key, value.toISOString());\n } else {\n data.append(key, JSON.stringify(value));\n }\n};\n\nconst serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value: unknown): void => {\n if (typeof value === 'string') {\n data.append(key, value);\n } else {\n data.append(key, JSON.stringify(value));\n }\n};\n\nexport const formDataBodySerializer = {\n bodySerializer: (body: unknown): FormData => {\n const data = new FormData();\n\n Object.entries(body as Record<string, unknown>).forEach(([key, value]) => {\n if (value === undefined || value === null) {\n return;\n }\n if (Array.isArray(value)) {\n value.forEach((v) => serializeFormDataPair(data, key, v));\n } else {\n serializeFormDataPair(data, key, value);\n }\n });\n\n return data;\n },\n};\n\nexport const jsonBodySerializer = {\n bodySerializer: (body: unknown): string =>\n JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)),\n};\n\nexport const urlSearchParamsBodySerializer = {\n bodySerializer: (body: unknown): string => {\n const data = new URLSearchParams();\n\n Object.entries(body as Record<string, unknown>).forEach(([key, value]) => {\n if (value === undefined || value === null) {\n return;\n }\n if (Array.isArray(value)) {\n value.forEach((v) => serializeUrlSearchParamsPair(data, key, v));\n } else {\n serializeUrlSearchParamsPair(data, key, value);\n }\n });\n\n return data.toString();\n },\n};\n","// This file is auto-generated by @hey-api/openapi-ts\n\ntype Slot = 'body' | 'headers' | 'path' | 'query';\n\nexport type Field =\n | {\n in: Exclude<Slot, 'body'>;\n /**\n * Field name. This is the name we want the user to see and use.\n */\n key: string;\n /**\n * Field mapped name. This is the name we want to use in the request.\n * If omitted, we use the same value as `key`.\n */\n map?: string;\n }\n | {\n in: Extract<Slot, 'body'>;\n /**\n * Key isn't required for bodies.\n */\n key?: string;\n map?: string;\n }\n | {\n /**\n * Field name. This is the name we want the user to see and use.\n */\n key: string;\n /**\n * Field mapped name. This is the name we want to use in the request.\n * If `in` is omitted, `map` aliases `key` to the transport layer.\n */\n map: Slot;\n };\n\nexport interface Fields {\n allowExtra?: Partial<Record<Slot, boolean>>;\n args?: ReadonlyArray<Field>;\n}\n\nexport type FieldsConfig = ReadonlyArray<Field | Fields>;\n\nconst extraPrefixesMap: Record<string, Slot> = {\n $body_: 'body',\n $headers_: 'headers',\n $path_: 'path',\n $query_: 'query',\n};\nconst extraPrefixes = Object.entries(extraPrefixesMap);\n\ntype KeyMap = Map<\n string,\n | {\n in: Slot;\n map?: string;\n }\n | {\n in?: never;\n map: Slot;\n }\n>;\n\nfunction buildKeyMap(fields: FieldsConfig, map?: KeyMap): KeyMap {\n if (!map) {\n map = new Map();\n }\n\n for (const config of fields) {\n if ('in' in config) {\n if (config.key) {\n map.set(config.key, {\n in: config.in,\n map: config.map,\n });\n }\n } else if ('key' in config) {\n map.set(config.key, {\n map: config.map,\n });\n } else if (config.args) {\n buildKeyMap(config.args, map);\n }\n }\n\n return map;\n}\n\ninterface Params {\n body?: unknown;\n headers: Record<string, unknown>;\n path: Record<string, unknown>;\n query: Record<string, unknown>;\n}\n\nfunction stripEmptySlots(params: Params): void {\n for (const [slot, value] of Object.entries(params)) {\n if (slot === 'body') continue;\n if (value && typeof value === 'object' && !Array.isArray(value) && !Object.keys(value).length) {\n delete params[slot as Slot];\n }\n }\n}\n\nexport function buildClientParams(args: ReadonlyArray<unknown>, fields: FieldsConfig): Params {\n const params: Params = {\n headers: Object.create(null),\n path: Object.create(null),\n query: Object.create(null),\n };\n\n const map = buildKeyMap(fields);\n\n function writeSlot(slot: Slot, key: string, value: unknown): void {\n let record = params[slot] as Record<string, unknown> | undefined;\n if (record === undefined) {\n record = Object.create(null) as Record<string, unknown>;\n params[slot] = record;\n }\n record[key] = value;\n }\n\n let config: FieldsConfig[number] | undefined;\n\n for (const [index, arg] of args.entries()) {\n if (fields[index]) {\n config = fields[index];\n }\n\n if (!config) {\n continue;\n }\n\n if ('in' in config) {\n if (config.key) {\n const field = map.get(config.key)!;\n const name = field.map || config.key;\n if (field.in) {\n writeSlot(field.in, name, arg);\n }\n } else {\n params.body = arg;\n }\n } else {\n for (const [key, value] of Object.entries(arg ?? {})) {\n const field = map.get(key);\n\n if (field) {\n if (field.in) {\n const name = field.map || key;\n writeSlot(field.in, name, value);\n } else {\n params[field.map] = value;\n }\n } else {\n const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix));\n\n if (extra) {\n const [prefix, slot] = extra;\n writeSlot(slot, key.slice(prefix.length), value);\n } else if ('allowExtra' in config && config.allowExtra) {\n for (const [slot, allowed] of Object.entries(config.allowExtra)) {\n if (allowed) {\n writeSlot(slot as Slot, key, value);\n break;\n }\n }\n }\n }\n }\n }\n }\n\n stripEmptySlots(params);\n\n return params;\n}\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { Config } from './types.gen';\n\nexport type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, 'method'> &\n Pick<Config, 'method' | 'responseTransformer' | 'responseValidator'> & {\n /**\n * Fetch API implementation. You can use this option to provide a custom\n * fetch instance.\n *\n * @default globalThis.fetch\n */\n fetch?: typeof fetch;\n /**\n * Implementing clients can call request interceptors inside this hook.\n */\n onRequest?: (url: string, init: RequestInit) => Promise<Request>;\n /**\n * Callback invoked when a network or parsing error occurs during streaming.\n *\n * This option applies only if the endpoint returns a stream of events.\n *\n * @param error The error that occurred.\n */\n onSseError?: (error: unknown) => void;\n /**\n * Callback invoked when an event is streamed from the server.\n *\n * This option applies only if the endpoint returns a stream of events.\n *\n * @param event Event streamed from the server.\n * @returns Nothing (void).\n */\n onSseEvent?: (event: StreamEvent<TData>) => void;\n serializedBody?: RequestInit['body'];\n /**\n * Default retry delay in milliseconds.\n *\n * This option applies only if the endpoint returns a stream of events.\n *\n * @default 3000\n */\n sseDefaultRetryDelay?: number;\n /**\n * Maximum number of retry attempts before giving up.\n */\n sseMaxRetryAttempts?: number;\n /**\n * Maximum retry delay in milliseconds.\n *\n * Applies only when exponential backoff is used.\n *\n * This option applies only if the endpoint returns a stream of events.\n *\n * @default 30000\n */\n sseMaxRetryDelay?: number;\n /**\n * Optional sleep function for retry backoff.\n *\n * Defaults to using `setTimeout`.\n */\n sseSleepFn?: (ms: number) => Promise<void>;\n url: string;\n };\n\nexport interface StreamEvent<TData = unknown> {\n data: TData;\n event?: string;\n id?: string;\n retry?: number;\n}\n\nexport type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {\n stream: AsyncGenerator<\n TData extends Record<string, unknown> ? TData[keyof TData] : TData,\n TReturn,\n TNext\n >;\n};\n\nexport function createSseClient<TData = unknown>({\n onRequest,\n onSseError,\n onSseEvent,\n responseTransformer,\n responseValidator,\n sseDefaultRetryDelay,\n sseMaxRetryAttempts,\n sseMaxRetryDelay,\n sseSleepFn,\n url,\n ...options\n}: ServerSentEventsOptions): ServerSentEventsResult<TData> {\n let lastEventId: string | undefined;\n\n const sleep = sseSleepFn ?? ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms)));\n\n const createStream = async function* () {\n let retryDelay: number = sseDefaultRetryDelay ?? 3000;\n let attempt = 0;\n const signal = options.signal ?? new AbortController().signal;\n\n while (true) {\n if (signal.aborted) break;\n\n attempt++;\n\n const headers =\n options.headers instanceof Headers\n ? options.headers\n : new Headers(options.headers as Record<string, string> | undefined);\n\n if (lastEventId !== undefined) {\n headers.set('Last-Event-ID', lastEventId);\n }\n\n try {\n const requestInit: RequestInit = {\n redirect: 'follow',\n ...options,\n body: options.serializedBody,\n headers,\n signal,\n };\n let request = new Request(url, requestInit);\n if (onRequest) {\n request = await onRequest(url, requestInit);\n }\n // fetch must be assigned here, otherwise it would throw the error:\n // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation\n const _fetch = options.fetch ?? globalThis.fetch;\n const response = await _fetch(request);\n\n if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);\n\n if (!response.body) throw new Error('No body in SSE response');\n\n const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();\n\n let buffer = '';\n\n const abortHandler = () => {\n try {\n reader.cancel();\n } catch {\n // noop\n }\n };\n\n signal.addEventListener('abort', abortHandler);\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n buffer += value;\n buffer = buffer.replace(/\\r\\n?/g, '\\n'); // normalize line endings\n\n const chunks = buffer.split('\\n\\n');\n buffer = chunks.pop() ?? '';\n\n for (const chunk of chunks) {\n const lines = chunk.split('\\n');\n const dataLines: Array<string> = [];\n let eventName: string | undefined;\n\n for (const line of lines) {\n if (line.startsWith('data:')) {\n dataLines.push(line.replace(/^data:\\s*/, ''));\n } else if (line.startsWith('event:')) {\n eventName = line.replace(/^event:\\s*/, '');\n } else if (line.startsWith('id:')) {\n lastEventId = line.replace(/^id:\\s*/, '');\n } else if (line.startsWith('retry:')) {\n const parsed = Number.parseInt(line.replace(/^retry:\\s*/, ''), 10);\n if (!Number.isNaN(parsed)) {\n retryDelay = parsed;\n }\n }\n }\n\n let data: unknown;\n let parsedJson = false;\n\n if (dataLines.length) {\n const rawData = dataLines.join('\\n');\n try {\n data = JSON.parse(rawData);\n parsedJson = true;\n } catch {\n data = rawData;\n }\n }\n\n if (parsedJson) {\n if (responseValidator) {\n await responseValidator(data);\n }\n\n if (responseTransformer) {\n data = await responseTransformer(data);\n }\n }\n\n onSseEvent?.({\n data,\n event: eventName,\n id: lastEventId,\n retry: retryDelay,\n });\n\n if (dataLines.length) {\n yield data as any;\n }\n }\n }\n } finally {\n signal.removeEventListener('abort', abortHandler);\n reader.releaseLock();\n }\n\n break; // exit loop on normal completion\n } catch (error) {\n // connection failed or aborted; retry after delay\n onSseError?.(error);\n\n if (sseMaxRetryAttempts !== undefined && attempt >= sseMaxRetryAttempts) {\n break; // stop after firing error\n }\n\n // exponential backoff: double retry each attempt, cap at 30s\n const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000);\n await sleep(backoff);\n }\n }\n };\n\n const stream = createStream();\n\n return { stream };\n}\n","// This file is auto-generated by @hey-api/openapi-ts\n\ninterface SerializeOptions<T> extends SerializePrimitiveOptions, SerializerOptions<T> {}\n\ninterface SerializePrimitiveOptions {\n allowReserved?: boolean;\n name: string;\n}\n\nexport interface SerializerOptions<T> {\n /**\n * @default true\n */\n explode: boolean;\n style: T;\n}\n\nexport type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';\nexport type ArraySeparatorStyle = ArrayStyle | MatrixStyle;\ntype MatrixStyle = 'label' | 'matrix' | 'simple';\nexport type ObjectStyle = 'form' | 'deepObject';\ntype ObjectSeparatorStyle = ObjectStyle | MatrixStyle;\n\ninterface SerializePrimitiveParam extends SerializePrimitiveOptions {\n value: string;\n}\n\nexport const separatorArrayExplode = (style: ArraySeparatorStyle): '.' | ';' | ',' | '&' => {\n switch (style) {\n case 'label':\n return '.';\n case 'matrix':\n return ';';\n case 'simple':\n return ',';\n default:\n return '&';\n }\n};\n\nexport const separatorArrayNoExplode = (style: ArraySeparatorStyle): ',' | '|' | '%20' => {\n switch (style) {\n case 'form':\n return ',';\n case 'pipeDelimited':\n return '|';\n case 'spaceDelimited':\n return '%20';\n default:\n return ',';\n }\n};\n\nexport const separatorObjectExplode = (style: ObjectSeparatorStyle): '.' | ';' | ',' | '&' => {\n switch (style) {\n case 'label':\n return '.';\n case 'matrix':\n return ';';\n case 'simple':\n return ',';\n default:\n return '&';\n }\n};\n\nexport const serializeArrayParam = ({\n allowReserved,\n explode,\n name,\n style,\n value,\n}: SerializeOptions<ArraySeparatorStyle> & {\n value: unknown[];\n}): string => {\n if (!explode) {\n const joinedValues = (\n allowReserved ? value : value.map((v) => encodeURIComponent(v as string))\n ).join(separatorArrayNoExplode(style));\n switch (style) {\n case 'label':\n return `.${joinedValues}`;\n case 'matrix':\n return `;${name}=${joinedValues}`;\n case 'simple':\n return joinedValues;\n default:\n return `${name}=${joinedValues}`;\n }\n }\n\n const separator = separatorArrayExplode(style);\n const joinedValues = value\n .map((v) => {\n if (style === 'label' || style === 'simple') {\n return allowReserved ? v : encodeURIComponent(v as string);\n }\n\n return serializePrimitiveParam({\n allowReserved,\n name,\n value: v as string,\n });\n })\n .join(separator);\n return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues;\n};\n\nexport const serializePrimitiveParam = ({\n allowReserved,\n name,\n value,\n}: SerializePrimitiveParam): string => {\n if (value === undefined || value === null) {\n return '';\n }\n\n if (typeof value === 'object') {\n throw new Error(\n 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.',\n );\n }\n\n return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;\n};\n\nexport const serializeObjectParam = ({\n allowReserved,\n explode,\n name,\n style,\n value,\n valueOnly,\n}: SerializeOptions<ObjectSeparatorStyle> & {\n value: Record<string, unknown> | Date;\n valueOnly?: boolean;\n}): string => {\n if (value instanceof Date) {\n return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;\n }\n\n if (style !== 'deepObject' && !explode) {\n let values: string[] = [];\n Object.entries(value).forEach(([key, v]) => {\n values = [...values, key, allowReserved ? (v as string) : encodeURIComponent(v as string)];\n });\n const joinedValues = values.join(',');\n switch (style) {\n case 'form':\n return `${name}=${joinedValues}`;\n case 'label':\n return `.${joinedValues}`;\n case 'matrix':\n return `;${name}=${joinedValues}`;\n default:\n return joinedValues;\n }\n }\n\n const separator = separatorObjectExplode(style);\n const joinedValues = Object.entries(value)\n .map(([key, v]) =>\n serializePrimitiveParam({\n allowReserved,\n name: style === 'deepObject' ? `${name}[${key}]` : key,\n value: v as string,\n }),\n )\n .join(separator);\n return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues;\n};\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { BodySerializer, QuerySerializer } from './bodySerializer.gen';\nimport {\n type ArraySeparatorStyle,\n serializeArrayParam,\n serializeObjectParam,\n serializePrimitiveParam,\n} from './pathSerializer.gen';\n\nexport interface PathSerializer {\n path: Record<string, unknown>;\n url: string;\n}\n\nexport const PATH_PARAM_RE: RegExp = /\\{[^{}]+\\}/g;\n\nexport const defaultPathSerializer = ({ path, url: _url }: PathSerializer): string => {\n let url = _url;\n const matches = _url.match(PATH_PARAM_RE);\n if (matches) {\n for (const match of matches) {\n let explode = false;\n let name = match.substring(1, match.length - 1);\n let style: ArraySeparatorStyle = 'simple';\n\n if (name.endsWith('*')) {\n explode = true;\n name = name.substring(0, name.length - 1);\n }\n\n if (name.startsWith('.')) {\n name = name.substring(1);\n style = 'label';\n } else if (name.startsWith(';')) {\n name = name.substring(1);\n style = 'matrix';\n }\n\n const value = path[name];\n\n if (value === undefined || value === null) {\n continue;\n }\n\n if (Array.isArray(value)) {\n url = url.replace(match, serializeArrayParam({ explode, name, style, value }));\n continue;\n }\n\n if (typeof value === 'object') {\n url = url.replace(\n match,\n serializeObjectParam({\n explode,\n name,\n style,\n value: value as Record<string, unknown>,\n valueOnly: true,\n }),\n );\n continue;\n }\n\n if (style === 'matrix') {\n url = url.replace(\n match,\n `;${serializePrimitiveParam({\n name,\n value: value as string,\n })}`,\n );\n continue;\n }\n\n const replaceValue = encodeURIComponent(\n style === 'label' ? `.${value as string}` : (value as string),\n );\n url = url.replace(match, replaceValue);\n }\n }\n return url;\n};\n\nexport const getUrl = ({\n baseUrl,\n path,\n query,\n querySerializer,\n url: _url,\n}: {\n baseUrl?: string;\n path?: Record<string, unknown>;\n query?: Record<string, unknown>;\n querySerializer: QuerySerializer;\n url: string;\n}): string => {\n const pathUrl = _url.startsWith('/') ? _url : `/${_url}`;\n let url = (baseUrl ?? '') + pathUrl;\n if (path) {\n url = defaultPathSerializer({ path, url });\n }\n let search = query ? querySerializer(query) : '';\n if (search.startsWith('?')) {\n search = search.substring(1);\n }\n if (search) {\n url += `?${search}`;\n }\n return url;\n};\n\nexport function getValidRequestBody(options: {\n body?: unknown;\n bodySerializer?: BodySerializer | null;\n serializedBody?: unknown;\n}): unknown {\n const hasBody = options.body !== undefined;\n const isSerializedBody = hasBody && options.bodySerializer;\n\n if (isSerializedBody) {\n if ('serializedBody' in options) {\n const hasSerializedBody =\n options.serializedBody !== undefined && options.serializedBody !== '';\n\n return hasSerializedBody ? options.serializedBody : null;\n }\n\n // not all clients implement a serializedBody property (i.e., client-axios)\n return options.body !== '' ? options.body : null;\n }\n\n // plain/text body\n if (hasBody) {\n return options.body;\n }\n\n // no body was provided\n return undefined;\n}\n","// This file is auto-generated by @hey-api/openapi-ts\n\nexport type AuthToken = string | undefined;\n\nexport interface Auth {\n /**\n * Which part of the request do we use to send the auth?\n *\n * @default 'header'\n */\n in?: 'header' | 'query' | 'cookie';\n /**\n * A unique identifier for the security scheme.\n *\n * Defined only when there are multiple security schemes whose `Auth`\n * shape would otherwise be identical.\n */\n key?: string;\n /**\n * Header or query parameter name.\n *\n * @default 'Authorization'\n */\n name?: string;\n scheme?: 'basic' | 'bearer';\n type: 'apiKey' | 'http';\n}\n\nexport const getAuthToken = async (\n auth: Auth,\n callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken,\n): Promise<string | undefined> => {\n const token = typeof callback === 'function' ? await callback(auth) : callback;\n\n if (!token) {\n return;\n }\n\n if (auth.scheme === 'bearer') {\n return `Bearer ${token}`;\n }\n\n if (auth.scheme === 'basic') {\n return `Basic ${btoa(token)}`;\n }\n\n return token;\n};\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport { getAuthToken } from '../core/auth.gen';\nimport type { QuerySerializerOptions } from '../core/bodySerializer.gen';\nimport { jsonBodySerializer } from '../core/bodySerializer.gen';\nimport {\n serializeArrayParam,\n serializeObjectParam,\n serializePrimitiveParam,\n} from '../core/pathSerializer.gen';\nimport { getUrl } from '../core/utils.gen';\nimport type { Client, ClientOptions, Config, RequestOptions } from './types.gen';\n\nexport const createQuerySerializer = <T = unknown>({\n parameters = {},\n ...args\n}: QuerySerializerOptions = {}): ((queryParams: T) => string) => {\n const querySerializer = (queryParams: T): string => {\n const search: string[] = [];\n if (queryParams && typeof queryParams === 'object') {\n for (const name in queryParams) {\n const value = queryParams[name];\n\n if (value === undefined || value === null) {\n continue;\n }\n\n const options = parameters[name] || args;\n\n if (Array.isArray(value)) {\n const serializedArray = serializeArrayParam({\n allowReserved: options.allowReserved,\n explode: true,\n name,\n style: 'form',\n value,\n ...options.array,\n });\n if (serializedArray) search.push(serializedArray);\n } else if (typeof value === 'object') {\n const serializedObject = serializeObjectParam({\n allowReserved: options.allowReserved,\n explode: true,\n name,\n style: 'deepObject',\n value: value as Record<string, unknown>,\n ...options.object,\n });\n if (serializedObject) search.push(serializedObject);\n } else {\n const serializedPrimitive = serializePrimitiveParam({\n allowReserved: options.allowReserved,\n name,\n value: value as string,\n });\n if (serializedPrimitive) search.push(serializedPrimitive);\n }\n }\n }\n return search.join('&');\n };\n return querySerializer;\n};\n\n/**\n * Infers parseAs value from provided Content-Type header.\n */\nexport const getParseAs = (contentType: string | null): Exclude<Config['parseAs'], 'auto'> => {\n if (!contentType) {\n // If no Content-Type header is provided, the best we can do is return the raw response body,\n // which is effectively the same as the 'stream' option.\n return 'stream';\n }\n\n const cleanContent = contentType.split(';')[0]?.trim();\n\n if (!cleanContent) {\n return;\n }\n\n if (cleanContent.startsWith('application/json') || cleanContent.endsWith('+json')) {\n return 'json';\n }\n\n if (cleanContent === 'multipart/form-data') {\n return 'formData';\n }\n\n if (\n ['application/', 'audio/', 'image/', 'video/'].some((type) => cleanContent.startsWith(type))\n ) {\n return 'blob';\n }\n\n if (cleanContent.startsWith('text/')) {\n return 'text';\n }\n\n return;\n};\n\nconst checkForExistence = (\n options: Pick<RequestOptions, 'auth' | 'query'> & {\n headers: Headers;\n },\n name?: string,\n): boolean => {\n if (!name) {\n return false;\n }\n if (\n options.headers.has(name) ||\n options.query?.[name] ||\n options.headers.get('Cookie')?.includes(`${name}=`)\n ) {\n return true;\n }\n return false;\n};\n\nexport async function setAuthParams(\n options: Pick<RequestOptions, 'auth' | 'query' | 'security'> & {\n headers: Headers;\n },\n): Promise<void> {\n for (const auth of options.security ?? []) {\n if (checkForExistence(options, auth.name)) {\n continue;\n }\n\n const token = await getAuthToken(auth, options.auth);\n\n if (!token) {\n continue;\n }\n\n const name = auth.name ?? 'Authorization';\n\n switch (auth.in) {\n case 'query':\n if (!options.query) {\n options.query = {};\n }\n options.query[name] = token;\n break;\n case 'cookie':\n options.headers.append('Cookie', `${name}=${token}`);\n break;\n case 'header':\n default:\n options.headers.set(name, token);\n break;\n }\n }\n}\n\nexport const buildUrl: Client['buildUrl'] = (options) =>\n getUrl({\n baseUrl: options.baseUrl as string,\n path: options.path,\n query: options.query,\n querySerializer:\n typeof options.querySerializer === 'function'\n ? options.querySerializer\n : createQuerySerializer(options.querySerializer),\n url: options.url,\n });\n\nexport const mergeConfigs = (a: Config, b: Config): Config => {\n const config = { ...a, ...b };\n if (config.baseUrl?.endsWith('/')) {\n config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);\n }\n config.headers = mergeHeaders(a.headers, b.headers);\n return config;\n};\n\nconst headersEntries = (headers: Headers): Array<[string, string]> => {\n const entries: Array<[string, string]> = [];\n headers.forEach((value, key) => {\n entries.push([key, value]);\n });\n return entries;\n};\n\nexport const mergeHeaders = (\n ...headers: Array<Required<Config>['headers'] | undefined>\n): Headers => {\n const mergedHeaders = new Headers();\n for (const header of headers) {\n if (!header) {\n continue;\n }\n\n const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);\n\n for (const [key, value] of iterator) {\n if (value === null) {\n mergedHeaders.delete(key);\n } else if (Array.isArray(value)) {\n for (const v of value) {\n mergedHeaders.append(key, v as string);\n }\n } else if (value !== undefined) {\n // assume object headers are meant to be JSON stringified, i.e., their\n // content value in OpenAPI specification is 'application/json'\n mergedHeaders.set(\n key,\n typeof value === 'object' ? JSON.stringify(value) : (value as string),\n );\n }\n }\n }\n return mergedHeaders;\n};\n\ntype ErrInterceptor<Err, Res, Req, Options> = (\n error: Err,\n /** response may be undefined due to a network error where no response object is produced */\n response: Res | undefined,\n /** request may be undefined, because error may be from building the request object itself */\n request: Req | undefined,\n options: Options,\n) => Err | Promise<Err>;\n\ntype ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;\n\ntype ResInterceptor<Res, Req, Options> = (\n response: Res,\n request: Req,\n options: Options,\n) => Res | Promise<Res>;\n\nclass Interceptors<Interceptor> {\n fns: Array<Interceptor | null> = [];\n\n clear(): void {\n this.fns = [];\n }\n\n eject(id: number | Interceptor): void {\n const index = this.getInterceptorIndex(id);\n if (this.fns[index]) {\n this.fns[index] = null;\n }\n }\n\n exists(id: number | Interceptor): boolean {\n const index = this.getInterceptorIndex(id);\n return Boolean(this.fns[index]);\n }\n\n getInterceptorIndex(id: number | Interceptor): number {\n if (typeof id === 'number') {\n return this.fns[id] ? id : -1;\n }\n return this.fns.indexOf(id);\n }\n\n update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false {\n const index = this.getInterceptorIndex(id);\n if (this.fns[index]) {\n this.fns[index] = fn;\n return id;\n }\n return false;\n }\n\n use(fn: Interceptor): number {\n this.fns.push(fn);\n return this.fns.length - 1;\n }\n}\n\nexport interface Middleware<Req, Res, Err, Options> {\n error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;\n request: Interceptors<ReqInterceptor<Req, Options>>;\n response: Interceptors<ResInterceptor<Res, Req, Options>>;\n}\n\nexport const createInterceptors = <Req, Res, Err, Options>(): Middleware<\n Req,\n Res,\n Err,\n Options\n> => ({\n error: new Interceptors<ErrInterceptor<Err, Res, Req, Options>>(),\n request: new Interceptors<ReqInterceptor<Req, Options>>(),\n response: new Interceptors<ResInterceptor<Res, Req, Options>>(),\n});\n\nconst defaultQuerySerializer = createQuerySerializer({\n allowReserved: false,\n array: {\n explode: true,\n style: 'form',\n },\n object: {\n explode: true,\n style: 'deepObject',\n },\n});\n\nconst defaultHeaders = {\n 'Content-Type': 'application/json',\n};\n\nexport const createConfig = <T extends ClientOptions = ClientOptions>(\n override: Config<Omit<ClientOptions, keyof T> & T> = {},\n): Config<Omit<ClientOptions, keyof T> & T> => ({\n ...jsonBodySerializer,\n headers: defaultHeaders,\n parseAs: 'auto',\n querySerializer: defaultQuerySerializer,\n ...override,\n});\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport { createSseClient } from '../core/serverSentEvents.gen';\nimport type { HttpMethod } from '../core/types.gen';\nimport { getValidRequestBody } from '../core/utils.gen';\nimport type { Client, Config, RequestOptions, ResolvedRequestOptions } from './types.gen';\nimport {\n buildUrl,\n createConfig,\n createInterceptors,\n getParseAs,\n mergeConfigs,\n mergeHeaders,\n setAuthParams,\n} from './utils.gen';\n\ntype ReqInit = Omit<RequestInit, 'body' | 'headers'> & {\n body?: any;\n headers: ReturnType<typeof mergeHeaders>;\n};\n\nexport const createClient = (config: Config = {}): Client => {\n let _config = mergeConfigs(createConfig(), config);\n\n const getConfig = (): Config => ({ ..._config });\n\n const setConfig = (config: Config): Config => {\n _config = mergeConfigs(_config, config);\n return getConfig();\n };\n\n const interceptors = createInterceptors<Request, Response, unknown, ResolvedRequestOptions>();\n\n const beforeRequest = async <\n TData = unknown,\n TResponseStyle extends 'data' | 'fields' = 'fields',\n ThrowOnError extends boolean = boolean,\n Url extends string = string,\n >(\n options: RequestOptions<TData, TResponseStyle, ThrowOnError, Url>,\n ) => {\n const opts = {\n ..._config,\n ...options,\n fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,\n headers: mergeHeaders(_config.headers, options.headers),\n serializedBody: undefined as string | undefined,\n };\n\n if (opts.security) {\n await setAuthParams(opts);\n }\n\n if (opts.requestValidator) {\n await opts.requestValidator(opts);\n }\n\n if (opts.body !== undefined && opts.bodySerializer) {\n opts.serializedBody = opts.bodySerializer(opts.body) as string | undefined;\n }\n\n // remove Content-Type header if body is empty to avoid sending invalid requests\n if (opts.body === undefined || opts.serializedBody === '') {\n opts.headers.delete('Content-Type');\n }\n\n const resolvedOpts = opts as typeof opts &\n ResolvedRequestOptions<TResponseStyle, ThrowOnError, Url>;\n const url = buildUrl(resolvedOpts);\n\n return { opts: resolvedOpts, url };\n };\n\n const request: Client['request'] = async (options) => {\n const throwOnError = options.throwOnError ?? _config.throwOnError;\n const responseStyle = options.responseStyle ?? _config.responseStyle;\n\n let request: Request | undefined;\n let response: Response | undefined;\n\n try {\n const { opts, url } = await beforeRequest(options);\n const requestInit: ReqInit = {\n redirect: 'follow',\n ...opts,\n body: getValidRequestBody(opts),\n };\n\n request = new Request(url, requestInit);\n\n for (const fn of interceptors.request.fns) {\n if (fn) {\n request = await fn(request, opts);\n }\n }\n\n // fetch must be assigned here, otherwise it would throw the error:\n // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation\n const _fetch = opts.fetch!;\n\n response = await _fetch(request);\n\n for (const fn of interceptors.response.fns) {\n if (fn) {\n response = await fn(response, request, opts);\n }\n }\n\n const result = {\n request,\n response,\n };\n\n if (response.ok) {\n const parseAs =\n (opts.parseAs === 'auto'\n ? getParseAs(response.headers.get('Content-Type'))\n : opts.parseAs) ?? 'json';\n\n if (response.status === 204 || response.headers.get('Content-Length') === '0') {\n let emptyData: any;\n switch (parseAs) {\n case 'arrayBuffer':\n case 'blob':\n case 'text':\n emptyData = await response[parseAs]();\n break;\n case 'formData':\n emptyData = new FormData();\n break;\n case 'stream':\n emptyData = response.body;\n break;\n case 'json':\n default:\n emptyData = {};\n break;\n }\n return opts.responseStyle === 'data'\n ? emptyData\n : {\n data: emptyData,\n ...result,\n };\n }\n\n let data: any;\n switch (parseAs) {\n case 'arrayBuffer':\n case 'blob':\n case 'formData':\n case 'text':\n data = await response[parseAs]();\n break;\n case 'json': {\n // Some servers return 200 with no Content-Length and empty body.\n // response.json() would throw; read as text and parse if non-empty.\n const text = await response.text();\n data = text ? JSON.parse(text) : {};\n break;\n }\n case 'stream':\n return opts.responseStyle === 'data'\n ? response.body\n : {\n data: response.body,\n ...result,\n };\n }\n\n if (parseAs === 'json') {\n if (opts.responseValidator) {\n await opts.responseValidator(data);\n }\n\n if (opts.responseTransformer) {\n data = await opts.responseTransformer(data);\n }\n }\n\n return opts.responseStyle === 'data'\n ? data\n : {\n data,\n ...result,\n };\n }\n\n const textError = await response.text();\n let jsonError: unknown;\n\n try {\n jsonError = JSON.parse(textError);\n } catch {\n // noop\n }\n\n throw jsonError ?? textError;\n } catch (error) {\n let finalError = error;\n\n for (const fn of interceptors.error.fns) {\n if (fn) {\n finalError = await fn(finalError, response, request, options as ResolvedRequestOptions);\n }\n }\n\n finalError = finalError || {};\n\n if (throwOnError) {\n throw finalError;\n }\n\n // TODO: we probably want to return error and improve types\n return responseStyle === 'data'\n ? undefined\n : {\n error: finalError,\n request,\n response,\n };\n }\n };\n\n const makeMethodFn = (method: Uppercase<HttpMethod>) => (options: RequestOptions) =>\n request({ ...options, method });\n\n const makeSseFn = (method: Uppercase<HttpMethod>) => async (options: RequestOptions) => {\n const { opts, url } = await beforeRequest(options);\n return createSseClient({\n ...opts,\n // Request interceptors can replace fetch when the stream starts.\n fetch: (input, init) => {\n const transport = opts.fetch!;\n return transport(input, init);\n },\n body: opts.body as BodyInit | null | undefined,\n method,\n onRequest: async (url, init) => {\n let request = new Request(url, init);\n for (const fn of interceptors.request.fns) {\n if (fn) {\n request = await fn(request, opts);\n }\n }\n return request;\n },\n serializedBody: getValidRequestBody(opts) as BodyInit | null | undefined,\n url,\n });\n };\n\n const _buildUrl: Client['buildUrl'] = (options) => buildUrl({ ..._config, ...options });\n\n return {\n buildUrl: _buildUrl,\n connect: makeMethodFn('CONNECT'),\n delete: makeMethodFn('DELETE'),\n get: makeMethodFn('GET'),\n getConfig,\n head: makeMethodFn('HEAD'),\n interceptors,\n options: makeMethodFn('OPTIONS'),\n patch: makeMethodFn('PATCH'),\n post: makeMethodFn('POST'),\n put: makeMethodFn('PUT'),\n request,\n setConfig,\n sse: {\n connect: makeSseFn('CONNECT'),\n delete: makeSseFn('DELETE'),\n get: makeSseFn('GET'),\n head: makeSseFn('HEAD'),\n options: makeSseFn('OPTIONS'),\n patch: makeSseFn('PATCH'),\n post: makeSseFn('POST'),\n put: makeSseFn('PUT'),\n trace: makeSseFn('TRACE'),\n },\n trace: makeMethodFn('TRACE'),\n } as Client;\n};\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport { type Client, type ClientOptions, type Config, createClient, createConfig } from './client';\nimport type { ClientOptions as ClientOptions2 } from './types.gen';\n\n/**\n * The `createClientConfig()` function will be called on client initialization\n * and the returned object will become the client's initial configuration.\n *\n * You may want to initialize your client this way instead of calling\n * `setConfig()`. This is useful for example if you're using Next.js\n * to ensure your client always has the correct values.\n */\nexport type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;\n\nexport const client: Client = createClient(createConfig<ClientOptions2>({ baseUrl: 'https://api.notte.cc' }));\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport { type Client, type ClientMeta, formDataBodySerializer, type Options as Options2, type RequestResult, type TDataShape } from './client';\nimport { client } from './client.gen';\nimport type { AccountChangesData, AccountChangesErrors, AccountChangesResponses, AccountRunsData, AccountRunsErrors, AccountRunsResponses, AgentStartData, AgentStartErrors, AgentStartResponses, AgentStatusData, AgentStatusErrors, AgentStatusResponses, AgentStopData, AgentStopErrors, AgentStopResponses, AnythingStartData, AnythingStartErrors, AnythingStartResponses, AttemptsData, AttemptsErrors, AttemptsResponses, BrandRetrieveData, BrandRetrieveErrors, BrandRetrieveResponses, ChangesData, ChangesErrors, ChangesResponses, ConnectLinkContextData, ConnectLinkContextErrors, ConnectLinkContextResponses, ConnectLinkMailboxConnectData, ConnectLinkMailboxConnectErrors, ConnectLinkMailboxConnectResponses, ConnectLinkMailboxesData, ConnectLinkMailboxesErrors, ConnectLinkMailboxesResponses, ConnectLinkMailboxSyncData, ConnectLinkMailboxSyncErrors, ConnectLinkMailboxSyncResponses, ConnectLinkStatusData, ConnectLinkStatusErrors, ConnectLinkStatusResponses, ConnectLinkSubmitData, ConnectLinkSubmitErrors, ConnectLinkSubmitResponses, ConnectPaymentWalletData, ConnectPaymentWalletErrors, ConnectPaymentWalletResponses, CreateData, CreateErrors, CreatePaymentData, CreatePaymentErrors, CreatePaymentResponses, CreateResponses, CreditUsageData, CreditUsageErrors, CreditUsageResponses, DeleteData, DeleteErrors, DeleteResponses, DeleteSecretData, DeleteSecretErrors, DeleteSecretResponses, DeleteSessionFileData, DeleteSessionFileErrors, DeleteSessionFileResponses, DeliveriesData, DeliveriesErrors, DeliveriesResponses, DetailData, DetailErrors, DetailResponses, DisconnectPaymentWalletData, DisconnectPaymentWalletErrors, DisconnectPaymentWalletResponses, DownloadRunPayloadData, DownloadRunPayloadErrors, DownloadRunPayloadResponses, DownloadSessionFileData, DownloadSessionFileErrors, DownloadSessionFileResponses, ExecuteSessionFileData, ExecuteSessionFileErrors, ExecuteSessionFileResponses, ExtractProductEndpointData, ExtractProductEndpointErrors, ExtractProductEndpointResponses, FetchSpecializedDataData, FetchSpecializedDataErrors, FetchSpecializedDataResponses, FunctionCreateData, FunctionCreateErrors, FunctionCreateResponses, FunctionDeleteData, FunctionDeleteErrors, FunctionDeleteResponses, FunctionDownloadUrlData, FunctionDownloadUrlErrors, FunctionDownloadUrlResponses, FunctionForkData, FunctionForkErrors, FunctionForkResponses, FunctionMetadataUpdateData, FunctionMetadataUpdateErrors, FunctionMetadataUpdateResponses, FunctionRollbackData, FunctionRollbackErrors, FunctionRollbackResponses, FunctionRunGetMetadataData, FunctionRunGetMetadataErrors, FunctionRunGetMetadataResponses, FunctionRunStartData, FunctionRunStartErrors, FunctionRunStartResponses, FunctionRunStopData, FunctionRunStopErrors, FunctionRunStopResponses, FunctionRuntimeHealthData, FunctionRuntimeHealthErrors, FunctionRuntimeHealthResponses, FunctionRunUpdateMetadataData, FunctionRunUpdateMetadataErrors, FunctionRunUpdateMetadataResponses, FunctionScheduleDeleteData, FunctionScheduleDeleteErrors, FunctionScheduleDeleteResponses, FunctionScheduleSetData, FunctionScheduleSetErrors, FunctionScheduleSetResponses, FunctionUpdateData, FunctionUpdateErrors, FunctionUpdateResponses, GetPaymentData, GetPaymentErrors, GetPaymentResponses, GetPolicyData, GetPolicyErrors, GetPolicyResponses, GetScriptData, GetScriptErrors, GetScriptResponses, GetSecretData, GetSecretErrors, GetSecretResponses, GetSessionScriptData, GetSessionScriptErrors, GetSessionScriptResponses, GetUsageData, GetUsageErrors, GetUsageLogsData, GetUsageLogsErrors, GetUsageLogsResponses, GetUsageResponses, HealthCheckData, HealthCheckResponses, HistoryData, HistoryErrors, HistoryResponses, InvalidateData, InvalidateErrors, InvalidateResponses, LimitsData, LimitsErrors, LimitsResponses, ListAgentsData, ListAgentsErrors, ListAgentsResponses, ListAuditEventsData, ListAuditEventsErrors, ListAuditEventsResponses, ListDataApisData, ListDataApisErrors, ListDataApisResponses, ListFunctionRunsByFunctionIdData, ListFunctionRunsByFunctionIdErrors, ListFunctionRunsByFunctionIdResponses, ListFunctionsData, ListFunctionsErrors, ListFunctionsResponses, ListMonitorsData, ListMonitorsErrors, ListMonitorsResponses, ListPersonasData, ListPersonasErrors, ListPersonasResponses, ListSecretsData, ListSecretsErrors, ListSecretsResponses, ListSessionFilesData, ListSessionFilesErrors, ListSessionFilesResponses, ListSessionsData, ListSessionsErrors, ListSessionsResponses, ListVaultsData, ListVaultsErrors, ListVaultsResponses, MailboxConnectTokenData, MailboxConnectTokenErrors, MailboxConnectTokenResponses, MailboxDeleteData, MailboxDeleteErrors, MailboxDeleteResponses, MailboxGetData, MailboxGetErrors, MailboxGetResponses, MailboxListData, MailboxListErrors, MailboxListResponses, MailboxSyncData, MailboxSyncErrors, MailboxSyncResponses, MailboxUpdateData, MailboxUpdateErrors, MailboxUpdateResponses, ManagedAuthConnectLinkCreateData, ManagedAuthConnectLinkCreateErrors, ManagedAuthConnectLinkCreateResponses, MapsSearchData, MapsSearchErrors, MapsSearchResponses, NewsSearchData, NewsSearchErrors, NewsSearchResponses, PageExecuteData, PageExecuteErrors, PageExecuteResponses, PageObserveData, PageObserveErrors, PageObserveResponses, PageScrapeData, PageScrapeErrors, PageScrapeResponses, PageScreenshotData, PageScreenshotErrors, PageScreenshotResponses, PeopleEnrichData, PeopleEnrichErrors, PeopleEnrichResponses, PersonaCreateData, PersonaCreateErrors, PersonaCreateResponses, PersonaDeleteData, PersonaDeleteErrors, PersonaDeleteResponses, PersonaEmailsListData, PersonaEmailsListErrors, PersonaEmailsListResponses, PersonaGetData, PersonaGetErrors, PersonaGetResponses, PersonaSmsListData, PersonaSmsListErrors, PersonaSmsListResponses, PersonaUpdateData, PersonaUpdateErrors, PersonaUpdateResponses, PrepareRunPayloadUploadData, PrepareRunPayloadUploadErrors, PrepareRunPayloadUploadResponses, ProfileCookiesGetData, ProfileCookiesGetErrors, ProfileCookiesGetResponses, ProfileCookiesSetData, ProfileCookiesSetErrors, ProfileCookiesSetResponses, ProfileCreateData, ProfileCreateErrors, ProfileCreateResponses, ProfileDeleteData, ProfileDeleteErrors, ProfileDeleteResponses, ProfileDuplicateData, ProfileDuplicateErrors, ProfileDuplicateResponses, ProfileGetData, ProfileGetErrors, ProfileGetResponses, ProfileListData, ProfileListErrors, ProfileListResponses, ProfileStateSetData, ProfileStateSetErrors, ProfileStateSetResponses, ReadyCheckData, ReadyCheckResponses, RetrieveChangeData, RetrieveChangeErrors, RetrieveChangeResponses, RetrieveData, RetrieveDeliveryData, RetrieveDeliveryErrors, RetrieveDeliveryResponses, RetrieveErrors, RetrieveResponses, RetrieveRunData, RetrieveRunErrors, RetrieveRunResponses, RetryData, RetryErrors, RetryResponses, RotateSecretData, RotateSecretErrors, RotateSecretResponses, RunNowData, RunNowErrors, RunNowResponses, RunsData, RunsErrors, RunsResponses, ScrapeFromHtmlData, ScrapeFromHtmlErrors, ScrapeFromHtmlResponses, ScrapeWebpageData, ScrapeWebpageErrors, ScrapeWebpageResponses, SearchWebData, SearchWebErrors, SearchWebResponses, SessionAuthReadinessData, SessionAuthReadinessErrors, SessionAuthReadinessResponses, SessionCookiesGetData, SessionCookiesGetErrors, SessionCookiesGetResponses, SessionCookiesSetData, SessionCookiesSetErrors, SessionCookiesSetResponses, SessionDebugInfoData, SessionDebugInfoErrors, SessionDebugInfoResponses, SessionMouseReplayData, SessionMouseReplayErrors, SessionMouseReplayResponses, SessionNetworkLogsData, SessionNetworkLogsErrors, SessionNetworkLogsResponses, SessionOffsetData, SessionOffsetErrors, SessionOffsetResponses, SessionProfilePreviewData, SessionProfilePreviewErrors, SessionProfilePreviewResponses, SessionProfileSaveData, SessionProfileSaveErrors, SessionProfileSaveResponses, SessionReplayData, SessionReplayErrors, SessionReplayResponses, SessionStartData, SessionStartErrors, SessionStartResponses, SessionStatusData, SessionStatusErrors, SessionStatusResponses, SessionStopData, SessionStopErrors, SessionStopResponses, StoreSecretData, StoreSecretErrors, StoreSecretResponses, StyleguideEndpointData, StyleguideEndpointErrors, StyleguideEndpointResponses, SummaryData, SummaryErrors, SummaryResponses, UpdateData, UpdateErrors, UpdateResponses, UploadSessionFileData, UploadSessionFileErrors, UploadSessionFileResponses, VaultCreateData, VaultCreateErrors, VaultCreateResponses, VaultCredentialsAddData, VaultCredentialsAddErrors, VaultCredentialsAddResponses, VaultCredentialsDeleteData, VaultCredentialsDeleteErrors, VaultCredentialsDeleteResponses, VaultCredentialsGetData, VaultCredentialsGetErrors, VaultCredentialsGetResponses, VaultCredentialsListData, VaultCredentialsListErrors, VaultCredentialsListResponses, VaultCreditCardDeleteData, VaultCreditCardDeleteErrors, VaultCreditCardDeleteResponses, VaultCreditCardGetData, VaultCreditCardGetErrors, VaultCreditCardGetResponses, VaultCreditCardSetData, VaultCreditCardSetErrors, VaultCreditCardSetResponses, VaultDeleteData, VaultDeleteErrors, VaultDeleteResponses, VaultUpdateData, VaultUpdateErrors, VaultUpdateResponses, YoutubeEndpointData, YoutubeEndpointErrors, YoutubeEndpointResponses } from './types.gen';\n\nexport type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {\n /**\n * You can provide a client instance returned by `createClient()` instead of\n * individual options. This might be also useful if you want to implement a\n * custom client.\n */\n client?: Client;\n /**\n * You can pass arbitrary values through the `meta` object. This can be\n * used to access values that aren't defined as part of the SDK function.\n */\n meta?: keyof ClientMeta extends never ? Record<string, unknown> : ClientMeta;\n};\n\n/**\n * Session Auth Readiness\n */\nexport const sessionAuthReadiness = <ThrowOnError extends boolean = false>(options: Options<SessionAuthReadinessData, ThrowOnError>): RequestResult<SessionAuthReadinessResponses, SessionAuthReadinessErrors, ThrowOnError> => (options.client ?? client).get<SessionAuthReadinessResponses, SessionAuthReadinessErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/auth',\n ...options\n});\n\n/**\n * List Sessions\n */\nexport const listSessions = <ThrowOnError extends boolean = false>(options?: Options<ListSessionsData, ThrowOnError>): RequestResult<ListSessionsResponses, ListSessionsErrors, ThrowOnError> => (options?.client ?? client).get<ListSessionsResponses, ListSessionsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions',\n ...options\n});\n\n/**\n * Session Start\n */\nexport const sessionStart = <ThrowOnError extends boolean = false>(options: Options<SessionStartData, ThrowOnError>): RequestResult<SessionStartResponses, SessionStartErrors, ThrowOnError> => (options.client ?? client).post<SessionStartResponses, SessionStartErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/start',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Session Status\n */\nexport const sessionStatus = <ThrowOnError extends boolean = false>(options: Options<SessionStatusData, ThrowOnError>): RequestResult<SessionStatusResponses, SessionStatusErrors, ThrowOnError> => (options.client ?? client).get<SessionStatusResponses, SessionStatusErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}',\n ...options\n});\n\n/**\n * Session Profile Preview\n */\nexport const sessionProfilePreview = <ThrowOnError extends boolean = false>(options: Options<SessionProfilePreviewData, ThrowOnError>): RequestResult<SessionProfilePreviewResponses, SessionProfilePreviewErrors, ThrowOnError> => (options.client ?? client).get<SessionProfilePreviewResponses, SessionProfilePreviewErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/profile-preview',\n ...options\n});\n\n/**\n * Session Profile Save\n */\nexport const sessionProfileSave = <ThrowOnError extends boolean = false>(options: Options<SessionProfileSaveData, ThrowOnError>): RequestResult<SessionProfileSaveResponses, SessionProfileSaveErrors, ThrowOnError> => (options.client ?? client).post<SessionProfileSaveResponses, SessionProfileSaveErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/profile/save',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Session Stop\n */\nexport const sessionStop = <ThrowOnError extends boolean = false>(options: Options<SessionStopData, ThrowOnError>): RequestResult<SessionStopResponses, SessionStopErrors, ThrowOnError> => (options.client ?? client).delete<SessionStopResponses, SessionStopErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/stop',\n ...options\n});\n\n/**\n * Session Cookies Get\n */\nexport const sessionCookiesGet = <ThrowOnError extends boolean = false>(options: Options<SessionCookiesGetData, ThrowOnError>): RequestResult<SessionCookiesGetResponses, SessionCookiesGetErrors, ThrowOnError> => (options.client ?? client).get<SessionCookiesGetResponses, SessionCookiesGetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/cookies',\n ...options\n});\n\n/**\n * Session Cookies Set\n */\nexport const sessionCookiesSet = <ThrowOnError extends boolean = false>(options: Options<SessionCookiesSetData, ThrowOnError>): RequestResult<SessionCookiesSetResponses, SessionCookiesSetErrors, ThrowOnError> => (options.client ?? client).post<SessionCookiesSetResponses, SessionCookiesSetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/cookies',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Session Debug Info\n */\nexport const sessionDebugInfo = <ThrowOnError extends boolean = false>(options: Options<SessionDebugInfoData, ThrowOnError>): RequestResult<SessionDebugInfoResponses, SessionDebugInfoErrors, ThrowOnError> => (options.client ?? client).get<SessionDebugInfoResponses, SessionDebugInfoErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/debug',\n ...options\n});\n\n/**\n * Session Offset\n */\nexport const sessionOffset = <ThrowOnError extends boolean = false>(options: Options<SessionOffsetData, ThrowOnError>): RequestResult<SessionOffsetResponses, SessionOffsetErrors, ThrowOnError> => (options.client ?? client).get<SessionOffsetResponses, SessionOffsetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/offset',\n ...options\n});\n\n/**\n * Page Observe\n */\nexport const pageObserve = <ThrowOnError extends boolean = false>(options: Options<PageObserveData, ThrowOnError>): RequestResult<PageObserveResponses, PageObserveErrors, ThrowOnError> => (options.client ?? client).post<PageObserveResponses, PageObserveErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/page/observe',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Page Screenshot\n */\nexport const pageScreenshot = <ThrowOnError extends boolean = false>(options: Options<PageScreenshotData, ThrowOnError>): RequestResult<PageScreenshotResponses, PageScreenshotErrors, ThrowOnError> => (options.client ?? client).post<PageScreenshotResponses, PageScreenshotErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/page/screenshot',\n ...options\n});\n\n/**\n * Page Execute\n */\nexport const pageExecute = <ThrowOnError extends boolean = false>(options: Options<PageExecuteData, ThrowOnError>): RequestResult<PageExecuteResponses, PageExecuteErrors, ThrowOnError> => (options.client ?? client).post<PageExecuteResponses, PageExecuteErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/page/execute',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Page Scrape\n */\nexport const pageScrape = <ThrowOnError extends boolean = false>(options: Options<PageScrapeData, ThrowOnError>): RequestResult<PageScrapeResponses, PageScrapeErrors, ThrowOnError> => (options.client ?? client).post<PageScrapeResponses, PageScrapeErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/page/scrape',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Session Network Logs\n */\nexport const sessionNetworkLogs = <ThrowOnError extends boolean = false>(options: Options<SessionNetworkLogsData, ThrowOnError>): RequestResult<SessionNetworkLogsResponses, SessionNetworkLogsErrors, ThrowOnError> => (options.client ?? client).get<SessionNetworkLogsResponses, SessionNetworkLogsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/network/logs',\n ...options\n});\n\n/**\n * Session Mouse Replay\n */\nexport const sessionMouseReplay = <ThrowOnError extends boolean = false>(options: Options<SessionMouseReplayData, ThrowOnError>): RequestResult<SessionMouseReplayResponses, SessionMouseReplayErrors, ThrowOnError> => (options.client ?? client).get<SessionMouseReplayResponses, SessionMouseReplayErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/replay/mouse',\n ...options\n});\n\n/**\n * Session Replay\n */\nexport const sessionReplay = <ThrowOnError extends boolean = false>(options: Options<SessionReplayData, ThrowOnError>): RequestResult<SessionReplayResponses, SessionReplayErrors, ThrowOnError> => (options.client ?? client).get<SessionReplayResponses, SessionReplayErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/replay',\n ...options\n});\n\n/**\n * Execute Session File\n */\nexport const executeSessionFile = <ThrowOnError extends boolean = false>(options: Options<ExecuteSessionFileData, ThrowOnError>): RequestResult<ExecuteSessionFileResponses, ExecuteSessionFileErrors, ThrowOnError> => (options.client ?? client).post<ExecuteSessionFileResponses, ExecuteSessionFileErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/page/execute/file',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * List Session Files\n */\nexport const listSessionFiles = <ThrowOnError extends boolean = false>(options: Options<ListSessionFilesData, ThrowOnError>): RequestResult<ListSessionFilesResponses, ListSessionFilesErrors, ThrowOnError> => (options.client ?? client).get<ListSessionFilesResponses, ListSessionFilesErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/files',\n ...options\n});\n\n/**\n * Upload Session File\n */\nexport const uploadSessionFile = <ThrowOnError extends boolean = false>(options: Options<UploadSessionFileData, ThrowOnError>): RequestResult<UploadSessionFileResponses, UploadSessionFileErrors, ThrowOnError> => (options.client ?? client).post<UploadSessionFileResponses, UploadSessionFileErrors, ThrowOnError>({\n ...formDataBodySerializer,\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/files',\n ...options,\n headers: {\n 'Content-Type': null,\n ...options.headers\n }\n});\n\n/**\n * Delete Session File\n */\nexport const deleteSessionFile = <ThrowOnError extends boolean = false>(options: Options<DeleteSessionFileData, ThrowOnError>): RequestResult<DeleteSessionFileResponses, DeleteSessionFileErrors, ThrowOnError> => (options.client ?? client).delete<DeleteSessionFileResponses, DeleteSessionFileErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/files/{file_id}',\n ...options\n});\n\n/**\n * Download Session File\n */\nexport const downloadSessionFile = <ThrowOnError extends boolean = false>(options: Options<DownloadSessionFileData, ThrowOnError>): RequestResult<DownloadSessionFileResponses, DownloadSessionFileErrors, ThrowOnError> => (options.client ?? client).get<DownloadSessionFileResponses, DownloadSessionFileErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/files/{file_id}',\n ...options\n});\n\n/**\n * Function Runtime Health\n */\nexport const functionRuntimeHealth = <ThrowOnError extends boolean = false>(options?: Options<FunctionRuntimeHealthData, ThrowOnError>): RequestResult<FunctionRuntimeHealthResponses, FunctionRuntimeHealthErrors, ThrowOnError> => (options?.client ?? client).get<FunctionRuntimeHealthResponses, FunctionRuntimeHealthErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/health',\n ...options\n});\n\n/**\n * List Functions\n */\nexport const listFunctions = <ThrowOnError extends boolean = false>(options?: Options<ListFunctionsData, ThrowOnError>): RequestResult<ListFunctionsResponses, ListFunctionsErrors, ThrowOnError> => (options?.client ?? client).get<ListFunctionsResponses, ListFunctionsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions',\n ...options\n});\n\n/**\n * Function Create\n */\nexport const functionCreate = <ThrowOnError extends boolean = false>(options: Options<FunctionCreateData, ThrowOnError>): RequestResult<FunctionCreateResponses, FunctionCreateErrors, ThrowOnError> => (options.client ?? client).post<FunctionCreateResponses, FunctionCreateErrors, ThrowOnError>({\n ...formDataBodySerializer,\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions',\n ...options,\n headers: {\n 'Content-Type': null,\n ...options.headers\n }\n});\n\n/**\n * Function Delete\n */\nexport const functionDelete = <ThrowOnError extends boolean = false>(options: Options<FunctionDeleteData, ThrowOnError>): RequestResult<FunctionDeleteResponses, FunctionDeleteErrors, ThrowOnError> => (options.client ?? client).delete<FunctionDeleteResponses, FunctionDeleteErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}',\n ...options\n});\n\n/**\n * Function Download Url\n */\nexport const functionDownloadUrl = <ThrowOnError extends boolean = false>(options: Options<FunctionDownloadUrlData, ThrowOnError>): RequestResult<FunctionDownloadUrlResponses, FunctionDownloadUrlErrors, ThrowOnError> => (options.client ?? client).get<FunctionDownloadUrlResponses, FunctionDownloadUrlErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}',\n ...options\n});\n\n/**\n * Function Metadata Update\n */\nexport const functionMetadataUpdate = <ThrowOnError extends boolean = false>(options: Options<FunctionMetadataUpdateData, ThrowOnError>): RequestResult<FunctionMetadataUpdateResponses, FunctionMetadataUpdateErrors, ThrowOnError> => (options.client ?? client).patch<FunctionMetadataUpdateResponses, FunctionMetadataUpdateErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Function Update\n */\nexport const functionUpdate = <ThrowOnError extends boolean = false>(options: Options<FunctionUpdateData, ThrowOnError>): RequestResult<FunctionUpdateResponses, FunctionUpdateErrors, ThrowOnError> => (options.client ?? client).post<FunctionUpdateResponses, FunctionUpdateErrors, ThrowOnError>({\n ...formDataBodySerializer,\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}',\n ...options,\n headers: {\n 'Content-Type': null,\n ...options.headers\n }\n});\n\n/**\n * Function Fork\n */\nexport const functionFork = <ThrowOnError extends boolean = false>(options: Options<FunctionForkData, ThrowOnError>): RequestResult<FunctionForkResponses, FunctionForkErrors, ThrowOnError> => (options.client ?? client).post<FunctionForkResponses, FunctionForkErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}/fork',\n ...options\n});\n\n/**\n * Function Rollback\n */\nexport const functionRollback = <ThrowOnError extends boolean = false>(options: Options<FunctionRollbackData, ThrowOnError>): RequestResult<FunctionRollbackResponses, FunctionRollbackErrors, ThrowOnError> => (options.client ?? client).post<FunctionRollbackResponses, FunctionRollbackErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}/rollback',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Function Schedule Delete\n */\nexport const functionScheduleDelete = <ThrowOnError extends boolean = false>(options: Options<FunctionScheduleDeleteData, ThrowOnError>): RequestResult<FunctionScheduleDeleteResponses, FunctionScheduleDeleteErrors, ThrowOnError> => (options.client ?? client).delete<FunctionScheduleDeleteResponses, FunctionScheduleDeleteErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}/schedule',\n ...options\n});\n\n/**\n * Function Schedule Set\n */\nexport const functionScheduleSet = <ThrowOnError extends boolean = false>(options: Options<FunctionScheduleSetData, ThrowOnError>): RequestResult<FunctionScheduleSetResponses, FunctionScheduleSetErrors, ThrowOnError> => (options.client ?? client).post<FunctionScheduleSetResponses, FunctionScheduleSetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}/schedule',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Function Run Start\n */\nexport const functionRunStart = <ThrowOnError extends boolean = false>(options: Options<FunctionRunStartData, ThrowOnError>): RequestResult<FunctionRunStartResponses, FunctionRunStartErrors, ThrowOnError> => (options.client ?? client).post<FunctionRunStartResponses, FunctionRunStartErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}/runs/start',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Function Run Stop\n */\nexport const functionRunStop = <ThrowOnError extends boolean = false>(options: Options<FunctionRunStopData, ThrowOnError>): RequestResult<FunctionRunStopResponses, FunctionRunStopErrors, ThrowOnError> => (options.client ?? client).delete<FunctionRunStopResponses, FunctionRunStopErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}/runs/{run_id}',\n ...options\n});\n\n/**\n * Function Run Get Metadata\n */\nexport const functionRunGetMetadata = <ThrowOnError extends boolean = false>(options: Options<FunctionRunGetMetadataData, ThrowOnError>): RequestResult<FunctionRunGetMetadataResponses, FunctionRunGetMetadataErrors, ThrowOnError> => (options.client ?? client).get<FunctionRunGetMetadataResponses, FunctionRunGetMetadataErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}/runs/{run_id}',\n ...options\n});\n\n/**\n * Function Run Update Metadata\n */\nexport const functionRunUpdateMetadata = <ThrowOnError extends boolean = false>(options: Options<FunctionRunUpdateMetadataData, ThrowOnError>): RequestResult<FunctionRunUpdateMetadataResponses, FunctionRunUpdateMetadataErrors, ThrowOnError> => (options.client ?? client).patch<FunctionRunUpdateMetadataResponses, FunctionRunUpdateMetadataErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}/runs/{run_id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Prepare Run Payload Upload\n */\nexport const prepareRunPayloadUpload = <ThrowOnError extends boolean = false>(options: Options<PrepareRunPayloadUploadData, ThrowOnError>): RequestResult<PrepareRunPayloadUploadResponses, PrepareRunPayloadUploadErrors, ThrowOnError> => (options.client ?? client).post<PrepareRunPayloadUploadResponses, PrepareRunPayloadUploadErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}/runs/{run_id}/payloads/{field}/upload',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Download Run Payload\n */\nexport const downloadRunPayload = <ThrowOnError extends boolean = false>(options: Options<DownloadRunPayloadData, ThrowOnError>): RequestResult<DownloadRunPayloadResponses, DownloadRunPayloadErrors, ThrowOnError> => (options.client ?? client).get<DownloadRunPayloadResponses, DownloadRunPayloadErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}/runs/{run_id}/payloads/{field}',\n ...options\n});\n\n/**\n * List Function Runs By Function Id\n */\nexport const listFunctionRunsByFunctionId = <ThrowOnError extends boolean = false>(options: Options<ListFunctionRunsByFunctionIdData, ThrowOnError>): RequestResult<ListFunctionRunsByFunctionIdResponses, ListFunctionRunsByFunctionIdErrors, ThrowOnError> => (options.client ?? client).get<ListFunctionRunsByFunctionIdResponses, ListFunctionRunsByFunctionIdErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}/runs',\n ...options\n});\n\n/**\n * Vault Create\n */\nexport const vaultCreate = <ThrowOnError extends boolean = false>(options: Options<VaultCreateData, ThrowOnError>): RequestResult<VaultCreateResponses, VaultCreateErrors, ThrowOnError> => (options.client ?? client).post<VaultCreateResponses, VaultCreateErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/vaults/create',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Vault Credentials Delete\n */\nexport const vaultCredentialsDelete = <ThrowOnError extends boolean = false>(options: Options<VaultCredentialsDeleteData, ThrowOnError>): RequestResult<VaultCredentialsDeleteResponses, VaultCredentialsDeleteErrors, ThrowOnError> => (options.client ?? client).delete<VaultCredentialsDeleteResponses, VaultCredentialsDeleteErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/vaults/{vault_id}/credentials',\n ...options\n});\n\n/**\n * Vault Credentials Get\n */\nexport const vaultCredentialsGet = <ThrowOnError extends boolean = false>(options: Options<VaultCredentialsGetData, ThrowOnError>): RequestResult<VaultCredentialsGetResponses, VaultCredentialsGetErrors, ThrowOnError> => (options.client ?? client).get<VaultCredentialsGetResponses, VaultCredentialsGetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/vaults/{vault_id}/credentials',\n ...options\n});\n\n/**\n * Vault Credentials Add\n */\nexport const vaultCredentialsAdd = <ThrowOnError extends boolean = false>(options: Options<VaultCredentialsAddData, ThrowOnError>): RequestResult<VaultCredentialsAddResponses, VaultCredentialsAddErrors, ThrowOnError> => (options.client ?? client).post<VaultCredentialsAddResponses, VaultCredentialsAddErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/vaults/{vault_id}/credentials',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Vault Delete\n */\nexport const vaultDelete = <ThrowOnError extends boolean = false>(options: Options<VaultDeleteData, ThrowOnError>): RequestResult<VaultDeleteResponses, VaultDeleteErrors, ThrowOnError> => (options.client ?? client).delete<VaultDeleteResponses, VaultDeleteErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/vaults/{vault_id}',\n ...options\n});\n\n/**\n * Vault Credentials List\n */\nexport const vaultCredentialsList = <ThrowOnError extends boolean = false>(options: Options<VaultCredentialsListData, ThrowOnError>): RequestResult<VaultCredentialsListResponses, VaultCredentialsListErrors, ThrowOnError> => (options.client ?? client).get<VaultCredentialsListResponses, VaultCredentialsListErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/vaults/{vault_id}',\n ...options\n});\n\n/**\n * Vault Update\n */\nexport const vaultUpdate = <ThrowOnError extends boolean = false>(options: Options<VaultUpdateData, ThrowOnError>): RequestResult<VaultUpdateResponses, VaultUpdateErrors, ThrowOnError> => (options.client ?? client).patch<VaultUpdateResponses, VaultUpdateErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/vaults/{vault_id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Vault Credit Card Delete\n */\nexport const vaultCreditCardDelete = <ThrowOnError extends boolean = false>(options: Options<VaultCreditCardDeleteData, ThrowOnError>): RequestResult<VaultCreditCardDeleteResponses, VaultCreditCardDeleteErrors, ThrowOnError> => (options.client ?? client).delete<VaultCreditCardDeleteResponses, VaultCreditCardDeleteErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/vaults/{vault_id}/card',\n ...options\n});\n\n/**\n * Vault Credit Card Get\n */\nexport const vaultCreditCardGet = <ThrowOnError extends boolean = false>(options: Options<VaultCreditCardGetData, ThrowOnError>): RequestResult<VaultCreditCardGetResponses, VaultCreditCardGetErrors, ThrowOnError> => (options.client ?? client).get<VaultCreditCardGetResponses, VaultCreditCardGetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/vaults/{vault_id}/card',\n ...options\n});\n\n/**\n * Vault Credit Card Set\n */\nexport const vaultCreditCardSet = <ThrowOnError extends boolean = false>(options: Options<VaultCreditCardSetData, ThrowOnError>): RequestResult<VaultCreditCardSetResponses, VaultCreditCardSetErrors, ThrowOnError> => (options.client ?? client).post<VaultCreditCardSetResponses, VaultCreditCardSetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/vaults/{vault_id}/card',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * List Vaults\n */\nexport const listVaults = <ThrowOnError extends boolean = false>(options?: Options<ListVaultsData, ThrowOnError>): RequestResult<ListVaultsResponses, ListVaultsErrors, ThrowOnError> => (options?.client ?? client).get<ListVaultsResponses, ListVaultsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/vaults',\n ...options\n});\n\n/**\n * Connect Payment Wallet\n */\nexport const connectPaymentWallet = <ThrowOnError extends boolean = false>(options: Options<ConnectPaymentWalletData, ThrowOnError>): RequestResult<ConnectPaymentWalletResponses, ConnectPaymentWalletErrors, ThrowOnError> => (options.client ?? client).post<ConnectPaymentWalletResponses, ConnectPaymentWalletErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/payments/connect',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Disconnect Payment Wallet\n */\nexport const disconnectPaymentWallet = <ThrowOnError extends boolean = false>(options: Options<DisconnectPaymentWalletData, ThrowOnError>): RequestResult<DisconnectPaymentWalletResponses, DisconnectPaymentWalletErrors, ThrowOnError> => (options.client ?? client).post<DisconnectPaymentWalletResponses, DisconnectPaymentWalletErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/payments/disconnect',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Create Payment\n */\nexport const createPayment = <ThrowOnError extends boolean = false>(options: Options<CreatePaymentData, ThrowOnError>): RequestResult<CreatePaymentResponses, CreatePaymentErrors, ThrowOnError> => (options.client ?? client).post<CreatePaymentResponses, CreatePaymentErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/payments',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Get Payment\n */\nexport const getPayment = <ThrowOnError extends boolean = false>(options: Options<GetPaymentData, ThrowOnError>): RequestResult<GetPaymentResponses, GetPaymentErrors, ThrowOnError> => (options.client ?? client).get<GetPaymentResponses, GetPaymentErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/payments/{payment_id}',\n ...options\n});\n\n/**\n * Profile Create\n */\nexport const profileCreate = <ThrowOnError extends boolean = false>(options: Options<ProfileCreateData, ThrowOnError>): RequestResult<ProfileCreateResponses, ProfileCreateErrors, ThrowOnError> => (options.client ?? client).post<ProfileCreateResponses, ProfileCreateErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/profiles/create',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Profile Delete\n */\nexport const profileDelete = <ThrowOnError extends boolean = false>(options: Options<ProfileDeleteData, ThrowOnError>): RequestResult<ProfileDeleteResponses, ProfileDeleteErrors, ThrowOnError> => (options.client ?? client).delete<ProfileDeleteResponses, ProfileDeleteErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/profiles/{profile_id}',\n ...options\n});\n\n/**\n * Profile Get\n */\nexport const profileGet = <ThrowOnError extends boolean = false>(options: Options<ProfileGetData, ThrowOnError>): RequestResult<ProfileGetResponses, ProfileGetErrors, ThrowOnError> => (options.client ?? client).get<ProfileGetResponses, ProfileGetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/profiles/{profile_id}',\n ...options\n});\n\n/**\n * Profile Duplicate\n */\nexport const profileDuplicate = <ThrowOnError extends boolean = false>(options: Options<ProfileDuplicateData, ThrowOnError>): RequestResult<ProfileDuplicateResponses, ProfileDuplicateErrors, ThrowOnError> => (options.client ?? client).post<ProfileDuplicateResponses, ProfileDuplicateErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/profiles/{profile_id}/duplicate',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Profile Cookies Get\n */\nexport const profileCookiesGet = <ThrowOnError extends boolean = false>(options: Options<ProfileCookiesGetData, ThrowOnError>): RequestResult<ProfileCookiesGetResponses, ProfileCookiesGetErrors, ThrowOnError> => (options.client ?? client).get<ProfileCookiesGetResponses, ProfileCookiesGetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/profiles/{profile_id}/cookies',\n ...options\n});\n\n/**\n * Profile Cookies Set\n */\nexport const profileCookiesSet = <ThrowOnError extends boolean = false>(options: Options<ProfileCookiesSetData, ThrowOnError>): RequestResult<ProfileCookiesSetResponses, ProfileCookiesSetErrors, ThrowOnError> => (options.client ?? client).post<ProfileCookiesSetResponses, ProfileCookiesSetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/profiles/{profile_id}/cookies',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Profile State Set\n */\nexport const profileStateSet = <ThrowOnError extends boolean = false>(options: Options<ProfileStateSetData, ThrowOnError>): RequestResult<ProfileStateSetResponses, ProfileStateSetErrors, ThrowOnError> => (options.client ?? client).post<ProfileStateSetResponses, ProfileStateSetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/profiles/{profile_id}/state',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Profile List\n */\nexport const profileList = <ThrowOnError extends boolean = false>(options?: Options<ProfileListData, ThrowOnError>): RequestResult<ProfileListResponses, ProfileListErrors, ThrowOnError> => (options?.client ?? client).get<ProfileListResponses, ProfileListErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/profiles',\n ...options\n});\n\n/**\n * Persona Create\n */\nexport const personaCreate = <ThrowOnError extends boolean = false>(options: Options<PersonaCreateData, ThrowOnError>): RequestResult<PersonaCreateResponses, PersonaCreateErrors, ThrowOnError> => (options.client ?? client).post<PersonaCreateResponses, PersonaCreateErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/personas/create',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Persona Delete\n */\nexport const personaDelete = <ThrowOnError extends boolean = false>(options: Options<PersonaDeleteData, ThrowOnError>): RequestResult<PersonaDeleteResponses, PersonaDeleteErrors, ThrowOnError> => (options.client ?? client).delete<PersonaDeleteResponses, PersonaDeleteErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/personas/{persona_id}',\n ...options\n});\n\n/**\n * Persona Get\n */\nexport const personaGet = <ThrowOnError extends boolean = false>(options: Options<PersonaGetData, ThrowOnError>): RequestResult<PersonaGetResponses, PersonaGetErrors, ThrowOnError> => (options.client ?? client).get<PersonaGetResponses, PersonaGetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/personas/{persona_id}',\n ...options\n});\n\n/**\n * Persona Update\n */\nexport const personaUpdate = <ThrowOnError extends boolean = false>(options: Options<PersonaUpdateData, ThrowOnError>): RequestResult<PersonaUpdateResponses, PersonaUpdateErrors, ThrowOnError> => (options.client ?? client).patch<PersonaUpdateResponses, PersonaUpdateErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/personas/{persona_id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Persona Emails List\n */\nexport const personaEmailsList = <ThrowOnError extends boolean = false>(options: Options<PersonaEmailsListData, ThrowOnError>): RequestResult<PersonaEmailsListResponses, PersonaEmailsListErrors, ThrowOnError> => (options.client ?? client).get<PersonaEmailsListResponses, PersonaEmailsListErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/personas/{persona_id}/emails',\n ...options\n});\n\n/**\n * List Personas\n */\nexport const listPersonas = <ThrowOnError extends boolean = false>(options?: Options<ListPersonasData, ThrowOnError>): RequestResult<ListPersonasResponses, ListPersonasErrors, ThrowOnError> => (options?.client ?? client).get<ListPersonasResponses, ListPersonasErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/personas',\n ...options\n});\n\n/**\n * Persona Sms List\n */\nexport const personaSmsList = <ThrowOnError extends boolean = false>(options: Options<PersonaSmsListData, ThrowOnError>): RequestResult<PersonaSmsListResponses, PersonaSmsListErrors, ThrowOnError> => (options.client ?? client).get<PersonaSmsListResponses, PersonaSmsListErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/personas/{persona_id}/sms',\n ...options\n});\n\n/**\n * Mailbox Connect Token\n */\nexport const mailboxConnectToken = <ThrowOnError extends boolean = false>(options: Options<MailboxConnectTokenData, ThrowOnError>): RequestResult<MailboxConnectTokenResponses, MailboxConnectTokenErrors, ThrowOnError> => (options.client ?? client).post<MailboxConnectTokenResponses, MailboxConnectTokenErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/mailboxes/connect-token',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Mailbox Sync\n */\nexport const mailboxSync = <ThrowOnError extends boolean = false>(options?: Options<MailboxSyncData, ThrowOnError>): RequestResult<MailboxSyncResponses, MailboxSyncErrors, ThrowOnError> => (options?.client ?? client).post<MailboxSyncResponses, MailboxSyncErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/mailboxes/sync',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n});\n\n/**\n * Mailbox List\n */\nexport const mailboxList = <ThrowOnError extends boolean = false>(options?: Options<MailboxListData, ThrowOnError>): RequestResult<MailboxListResponses, MailboxListErrors, ThrowOnError> => (options?.client ?? client).get<MailboxListResponses, MailboxListErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/mailboxes',\n ...options\n});\n\n/**\n * Mailbox Delete\n */\nexport const mailboxDelete = <ThrowOnError extends boolean = false>(options: Options<MailboxDeleteData, ThrowOnError>): RequestResult<MailboxDeleteResponses, MailboxDeleteErrors, ThrowOnError> => (options.client ?? client).delete<MailboxDeleteResponses, MailboxDeleteErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/mailboxes/{mailbox_id}',\n ...options\n});\n\n/**\n * Mailbox Get\n */\nexport const mailboxGet = <ThrowOnError extends boolean = false>(options: Options<MailboxGetData, ThrowOnError>): RequestResult<MailboxGetResponses, MailboxGetErrors, ThrowOnError> => (options.client ?? client).get<MailboxGetResponses, MailboxGetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/mailboxes/{mailbox_id}',\n ...options\n});\n\n/**\n * Mailbox Update\n */\nexport const mailboxUpdate = <ThrowOnError extends boolean = false>(options: Options<MailboxUpdateData, ThrowOnError>): RequestResult<MailboxUpdateResponses, MailboxUpdateErrors, ThrowOnError> => (options.client ?? client).patch<MailboxUpdateResponses, MailboxUpdateErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/mailboxes/{mailbox_id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Managed Auth Connect Link Create\n */\nexport const managedAuthConnectLinkCreate = <ThrowOnError extends boolean = false>(options: Options<ManagedAuthConnectLinkCreateData, ThrowOnError>): RequestResult<ManagedAuthConnectLinkCreateResponses, ManagedAuthConnectLinkCreateErrors, ThrowOnError> => (options.client ?? client).post<ManagedAuthConnectLinkCreateResponses, ManagedAuthConnectLinkCreateErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/managed-auth/connect-links',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Connect Link Context\n */\nexport const connectLinkContext = <ThrowOnError extends boolean = false>(options: Options<ConnectLinkContextData, ThrowOnError>): RequestResult<ConnectLinkContextResponses, ConnectLinkContextErrors, ThrowOnError> => (options.client ?? client).post<ConnectLinkContextResponses, ConnectLinkContextErrors, ThrowOnError>({ url: '/managed-auth/connect-links/context', ...options });\n\n/**\n * Connect Link Mailboxes\n */\nexport const connectLinkMailboxes = <ThrowOnError extends boolean = false>(options: Options<ConnectLinkMailboxesData, ThrowOnError>): RequestResult<ConnectLinkMailboxesResponses, ConnectLinkMailboxesErrors, ThrowOnError> => (options.client ?? client).post<ConnectLinkMailboxesResponses, ConnectLinkMailboxesErrors, ThrowOnError>({ url: '/managed-auth/connect-links/mailboxes', ...options });\n\n/**\n * Connect Link Mailbox Connect\n */\nexport const connectLinkMailboxConnect = <ThrowOnError extends boolean = false>(options: Options<ConnectLinkMailboxConnectData, ThrowOnError>): RequestResult<ConnectLinkMailboxConnectResponses, ConnectLinkMailboxConnectErrors, ThrowOnError> => (options.client ?? client).post<ConnectLinkMailboxConnectResponses, ConnectLinkMailboxConnectErrors, ThrowOnError>({\n url: '/managed-auth/connect-links/mailboxes/connect',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Connect Link Mailbox Sync\n */\nexport const connectLinkMailboxSync = <ThrowOnError extends boolean = false>(options: Options<ConnectLinkMailboxSyncData, ThrowOnError>): RequestResult<ConnectLinkMailboxSyncResponses, ConnectLinkMailboxSyncErrors, ThrowOnError> => (options.client ?? client).post<ConnectLinkMailboxSyncResponses, ConnectLinkMailboxSyncErrors, ThrowOnError>({\n url: '/managed-auth/connect-links/mailboxes/sync',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Connect Link Submit\n */\nexport const connectLinkSubmit = <ThrowOnError extends boolean = false>(options: Options<ConnectLinkSubmitData, ThrowOnError>): RequestResult<ConnectLinkSubmitResponses, ConnectLinkSubmitErrors, ThrowOnError> => (options.client ?? client).post<ConnectLinkSubmitResponses, ConnectLinkSubmitErrors, ThrowOnError>({\n url: '/managed-auth/connect-links/submit',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Connect Link Status\n */\nexport const connectLinkStatus = <ThrowOnError extends boolean = false>(options: Options<ConnectLinkStatusData, ThrowOnError>): RequestResult<ConnectLinkStatusResponses, ConnectLinkStatusErrors, ThrowOnError> => (options.client ?? client).get<ConnectLinkStatusResponses, ConnectLinkStatusErrors, ThrowOnError>({ url: '/managed-auth/connect-links/status', ...options });\n\n/**\n * Get Usage\n */\nexport const getUsage = <ThrowOnError extends boolean = false>(options?: Options<GetUsageData, ThrowOnError>): RequestResult<GetUsageResponses, GetUsageErrors, ThrowOnError> => (options?.client ?? client).get<GetUsageResponses, GetUsageErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/usage',\n ...options\n});\n\n/**\n * Get Usage Logs\n */\nexport const getUsageLogs = <ThrowOnError extends boolean = false>(options?: Options<GetUsageLogsData, ThrowOnError>): RequestResult<GetUsageLogsResponses, GetUsageLogsErrors, ThrowOnError> => (options?.client ?? client).get<GetUsageLogsResponses, GetUsageLogsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/usage/logs',\n ...options\n});\n\n/**\n * Anything Start\n */\nexport const anythingStart = <ThrowOnError extends boolean = false>(options: Options<AnythingStartData, ThrowOnError>): RequestResult<AnythingStartResponses, AnythingStartErrors, ThrowOnError> => (options.client ?? client).post<AnythingStartResponses, AnythingStartErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/anything/start',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * List Secrets\n */\nexport const listSecrets = <ThrowOnError extends boolean = false>(options?: Options<ListSecretsData, ThrowOnError>): RequestResult<ListSecretsResponses, ListSecretsErrors, ThrowOnError> => (options?.client ?? client).get<ListSecretsResponses, ListSecretsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/secrets',\n ...options\n});\n\n/**\n * Store Secret\n */\nexport const storeSecret = <ThrowOnError extends boolean = false>(options: Options<StoreSecretData, ThrowOnError>): RequestResult<StoreSecretResponses, StoreSecretErrors, ThrowOnError> => (options.client ?? client).post<StoreSecretResponses, StoreSecretErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/secrets',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Get Secret\n */\nexport const getSecret = <ThrowOnError extends boolean = false>(options: Options<GetSecretData, ThrowOnError>): RequestResult<GetSecretResponses, GetSecretErrors, ThrowOnError> => (options.client ?? client).get<GetSecretResponses, GetSecretErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/secrets/{name}',\n ...options\n});\n\n/**\n * Delete Secret\n */\nexport const deleteSecret = <ThrowOnError extends boolean = false>(options: Options<DeleteSecretData, ThrowOnError>): RequestResult<DeleteSecretResponses, DeleteSecretErrors, ThrowOnError> => (options.client ?? client).delete<DeleteSecretResponses, DeleteSecretErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/secrets/{secret_id}',\n ...options\n});\n\n/**\n * List Audit Events\n */\nexport const listAuditEvents = <ThrowOnError extends boolean = false>(options?: Options<ListAuditEventsData, ThrowOnError>): RequestResult<ListAuditEventsResponses, ListAuditEventsErrors, ThrowOnError> => (options?.client ?? client).get<ListAuditEventsResponses, ListAuditEventsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/audit-events',\n ...options\n});\n\n/**\n * Health Check\n */\nexport const healthCheck = <ThrowOnError extends boolean = false>(options?: Options<HealthCheckData, ThrowOnError>): RequestResult<HealthCheckResponses, unknown, ThrowOnError> => (options?.client ?? client).get<HealthCheckResponses, unknown, ThrowOnError>({ url: '/health', ...options });\n\n/**\n * Ready Check\n */\nexport const readyCheck = <ThrowOnError extends boolean = false>(options?: Options<ReadyCheckData, ThrowOnError>): RequestResult<ReadyCheckResponses, unknown, ThrowOnError> => (options?.client ?? client).get<ReadyCheckResponses, unknown, ThrowOnError>({ url: '/ready', ...options });\n\n/**\n * Scrape Webpage\n */\nexport const scrapeWebpage = <ThrowOnError extends boolean = false>(options: Options<ScrapeWebpageData, ThrowOnError>): RequestResult<ScrapeWebpageResponses, ScrapeWebpageErrors, ThrowOnError> => (options.client ?? client).post<ScrapeWebpageResponses, ScrapeWebpageErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/scrape',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Search Web\n */\nexport const searchWeb = <ThrowOnError extends boolean = false>(options: Options<SearchWebData, ThrowOnError>): RequestResult<SearchWebResponses, SearchWebErrors, ThrowOnError> => (options.client ?? client).post<SearchWebResponses, SearchWebErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/search',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Summary\n */\nexport const summary = <ThrowOnError extends boolean = false>(options?: Options<SummaryData, ThrowOnError>): RequestResult<SummaryResponses, SummaryErrors, ThrowOnError> => (options?.client ?? client).get<SummaryResponses, SummaryErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/analytics',\n ...options\n});\n\n/**\n * History\n */\nexport const history_ = <ThrowOnError extends boolean = false>(options?: Options<HistoryData, ThrowOnError>): RequestResult<HistoryResponses, HistoryErrors, ThrowOnError> => (options?.client ?? client).get<HistoryResponses, HistoryErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/analytics/requests',\n ...options\n});\n\n/**\n * Detail\n */\nexport const detail = <ThrowOnError extends boolean = false>(options: Options<DetailData, ThrowOnError>): RequestResult<DetailResponses, DetailErrors, ThrowOnError> => (options.client ?? client).get<DetailResponses, DetailErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/analytics/requests/{request_id}',\n ...options\n});\n\n/**\n * Invalidate\n */\nexport const invalidate = <ThrowOnError extends boolean = false>(options?: Options<InvalidateData, ThrowOnError>): RequestResult<InvalidateResponses, InvalidateErrors, ThrowOnError> => (options?.client ?? client).delete<InvalidateResponses, InvalidateErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/cache',\n ...options\n});\n\n/**\n * Get Policy\n */\nexport const getPolicy = <ThrowOnError extends boolean = false>(options?: Options<GetPolicyData, ThrowOnError>): RequestResult<GetPolicyResponses, GetPolicyErrors, ThrowOnError> => (options?.client ?? client).get<GetPolicyResponses, GetPolicyErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/cache',\n ...options\n});\n\n/**\n * Brand Retrieve\n */\nexport const brandRetrieve = <ThrowOnError extends boolean = false>(options: Options<BrandRetrieveData, ThrowOnError>): RequestResult<BrandRetrieveResponses, BrandRetrieveErrors, ThrowOnError> => (options.client ?? client).post<BrandRetrieveResponses, BrandRetrieveErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/brand/retrieve',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Extract Product Endpoint\n */\nexport const extractProductEndpoint = <ThrowOnError extends boolean = false>(options: Options<ExtractProductEndpointData, ThrowOnError>): RequestResult<ExtractProductEndpointResponses, ExtractProductEndpointErrors, ThrowOnError> => (options.client ?? client).post<ExtractProductEndpointResponses, ExtractProductEndpointErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/products/extract',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Extract a website styleguide\n */\nexport const styleguideEndpoint = <ThrowOnError extends boolean = false>(options?: Options<StyleguideEndpointData, ThrowOnError>): RequestResult<StyleguideEndpointResponses, StyleguideEndpointErrors, ThrowOnError> => (options?.client ?? client).get<StyleguideEndpointResponses, StyleguideEndpointErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/web/styleguide',\n ...options\n});\n\n/**\n * Maps Search\n */\nexport const mapsSearch = <ThrowOnError extends boolean = false>(options: Options<MapsSearchData, ThrowOnError>): RequestResult<MapsSearchResponses, MapsSearchErrors, ThrowOnError> => (options.client ?? client).post<MapsSearchResponses, MapsSearchErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/maps/search',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * List Monitors\n */\nexport const listMonitors = <ThrowOnError extends boolean = false>(options?: Options<ListMonitorsData, ThrowOnError>): RequestResult<ListMonitorsResponses, ListMonitorsErrors, ThrowOnError> => (options?.client ?? client).get<ListMonitorsResponses, ListMonitorsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors',\n ...options\n});\n\n/**\n * Create\n */\nexport const create = <ThrowOnError extends boolean = false>(options: Options<CreateData, ThrowOnError>): RequestResult<CreateResponses, CreateErrors, ThrowOnError> => (options.client ?? client).post<CreateResponses, CreateErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Limits\n */\nexport const limits = <ThrowOnError extends boolean = false>(options?: Options<LimitsData, ThrowOnError>): RequestResult<LimitsResponses, LimitsErrors, ThrowOnError> => (options?.client ?? client).get<LimitsResponses, LimitsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/limits',\n ...options\n});\n\n/**\n * Credit Usage\n */\nexport const creditUsage = <ThrowOnError extends boolean = false>(options?: Options<CreditUsageData, ThrowOnError>): RequestResult<CreditUsageResponses, CreditUsageErrors, ThrowOnError> => (options?.client ?? client).get<CreditUsageResponses, CreditUsageErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/credit-usage',\n ...options\n});\n\n/**\n * Account Runs\n */\nexport const accountRuns = <ThrowOnError extends boolean = false>(options?: Options<AccountRunsData, ThrowOnError>): RequestResult<AccountRunsResponses, AccountRunsErrors, ThrowOnError> => (options?.client ?? client).get<AccountRunsResponses, AccountRunsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/runs',\n ...options\n});\n\n/**\n * Account Changes\n */\nexport const accountChanges = <ThrowOnError extends boolean = false>(options?: Options<AccountChangesData, ThrowOnError>): RequestResult<AccountChangesResponses, AccountChangesErrors, ThrowOnError> => (options?.client ?? client).get<AccountChangesResponses, AccountChangesErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/changes',\n ...options\n});\n\n/**\n * Delete\n */\nexport const delete_ = <ThrowOnError extends boolean = false>(options: Options<DeleteData, ThrowOnError>): RequestResult<DeleteResponses, DeleteErrors, ThrowOnError> => (options.client ?? client).delete<DeleteResponses, DeleteErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/{monitor_id}',\n ...options\n});\n\n/**\n * Retrieve\n */\nexport const retrieve = <ThrowOnError extends boolean = false>(options: Options<RetrieveData, ThrowOnError>): RequestResult<RetrieveResponses, RetrieveErrors, ThrowOnError> => (options.client ?? client).get<RetrieveResponses, RetrieveErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/{monitor_id}',\n ...options\n});\n\n/**\n * Update\n */\nexport const update = <ThrowOnError extends boolean = false>(options: Options<UpdateData, ThrowOnError>): RequestResult<UpdateResponses, UpdateErrors, ThrowOnError> => (options.client ?? client).patch<UpdateResponses, UpdateErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/{monitor_id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Run Now\n */\nexport const runNow = <ThrowOnError extends boolean = false>(options: Options<RunNowData, ThrowOnError>): RequestResult<RunNowResponses, RunNowErrors, ThrowOnError> => (options.client ?? client).post<RunNowResponses, RunNowErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/{monitor_id}/run',\n ...options\n});\n\n/**\n * Runs\n */\nexport const runs = <ThrowOnError extends boolean = false>(options: Options<RunsData, ThrowOnError>): RequestResult<RunsResponses, RunsErrors, ThrowOnError> => (options.client ?? client).get<RunsResponses, RunsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/{monitor_id}/runs',\n ...options\n});\n\n/**\n * Changes\n */\nexport const changes = <ThrowOnError extends boolean = false>(options: Options<ChangesData, ThrowOnError>): RequestResult<ChangesResponses, ChangesErrors, ThrowOnError> => (options.client ?? client).get<ChangesResponses, ChangesErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/{monitor_id}/changes',\n ...options\n});\n\n/**\n * Retrieve Run\n */\nexport const retrieveRun = <ThrowOnError extends boolean = false>(options: Options<RetrieveRunData, ThrowOnError>): RequestResult<RetrieveRunResponses, RetrieveRunErrors, ThrowOnError> => (options.client ?? client).get<RetrieveRunResponses, RetrieveRunErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/{monitor_id}/runs/{run_id}',\n ...options\n});\n\n/**\n * Retrieve Change\n */\nexport const retrieveChange = <ThrowOnError extends boolean = false>(options: Options<RetrieveChangeData, ThrowOnError>): RequestResult<RetrieveChangeResponses, RetrieveChangeErrors, ThrowOnError> => (options.client ?? client).get<RetrieveChangeResponses, RetrieveChangeErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/{monitor_id}/changes/{change_id}',\n ...options\n});\n\n/**\n * Rotate Secret\n */\nexport const rotateSecret = <ThrowOnError extends boolean = false>(options: Options<RotateSecretData, ThrowOnError>): RequestResult<RotateSecretResponses, RotateSecretErrors, ThrowOnError> => (options.client ?? client).post<RotateSecretResponses, RotateSecretErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/{monitor_id}/webhook/rotate-secret',\n ...options\n});\n\n/**\n * Deliveries\n */\nexport const deliveries = <ThrowOnError extends boolean = false>(options: Options<DeliveriesData, ThrowOnError>): RequestResult<DeliveriesResponses, DeliveriesErrors, ThrowOnError> => (options.client ?? client).post<DeliveriesResponses, DeliveriesErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/webhooks/deliveries',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Retrieve Delivery\n */\nexport const retrieveDelivery = <ThrowOnError extends boolean = false>(options: Options<RetrieveDeliveryData, ThrowOnError>): RequestResult<RetrieveDeliveryResponses, RetrieveDeliveryErrors, ThrowOnError> => (options.client ?? client).get<RetrieveDeliveryResponses, RetrieveDeliveryErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/webhooks/deliveries/{delivery_id}',\n ...options\n});\n\n/**\n * Attempts\n */\nexport const attempts = <ThrowOnError extends boolean = false>(options: Options<AttemptsData, ThrowOnError>): RequestResult<AttemptsResponses, AttemptsErrors, ThrowOnError> => (options.client ?? client).get<AttemptsResponses, AttemptsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/webhooks/deliveries/{delivery_id}/attempts',\n ...options\n});\n\n/**\n * Retry\n */\nexport const retry = <ThrowOnError extends boolean = false>(options: Options<RetryData, ThrowOnError>): RequestResult<RetryResponses, RetryErrors, ThrowOnError> => (options.client ?? client).post<RetryResponses, RetryErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/webhooks/deliveries/{delivery_id}/retry',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * People Enrich\n */\nexport const peopleEnrich = <ThrowOnError extends boolean = false>(options: Options<PeopleEnrichData, ThrowOnError>): RequestResult<PeopleEnrichResponses, PeopleEnrichErrors, ThrowOnError> => (options.client ?? client).post<PeopleEnrichResponses, PeopleEnrichErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/people/enrich',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * News Search\n */\nexport const newsSearch = <ThrowOnError extends boolean = false>(options: Options<NewsSearchData, ThrowOnError>): RequestResult<NewsSearchResponses, NewsSearchErrors, ThrowOnError> => (options.client ?? client).post<NewsSearchResponses, NewsSearchErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/news/search',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Fetch Specialized Data\n */\nexport const fetchSpecializedData = <ThrowOnError extends boolean = false>(options: Options<FetchSpecializedDataData, ThrowOnError>): RequestResult<FetchSpecializedDataResponses, FetchSpecializedDataErrors, ThrowOnError> => (options.client ?? client).post<FetchSpecializedDataResponses, FetchSpecializedDataErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/web/fetch',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Youtube Endpoint\n */\nexport const youtubeEndpoint = <ThrowOnError extends boolean = false>(options: Options<YoutubeEndpointData, ThrowOnError>): RequestResult<YoutubeEndpointResponses, YoutubeEndpointErrors, ThrowOnError> => (options.client ?? client).post<YoutubeEndpointResponses, YoutubeEndpointErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/youtube/extract',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * List Data Apis\n */\nexport const listDataApis = <ThrowOnError extends boolean = false>(options?: Options<ListDataApisData, ThrowOnError>): RequestResult<ListDataApisResponses, ListDataApisErrors, ThrowOnError> => (options?.client ?? client).get<ListDataApisResponses, ListDataApisErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data',\n ...options\n});\n\n/**\n * Scrape From Html\n */\nexport const scrapeFromHtml = <ThrowOnError extends boolean = false>(options: Options<ScrapeFromHtmlData, ThrowOnError>): RequestResult<ScrapeFromHtmlResponses, ScrapeFromHtmlErrors, ThrowOnError> => (options.client ?? client).post<ScrapeFromHtmlResponses, ScrapeFromHtmlErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/scrape_from_html',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Agent Start\n */\nexport const agentStart = <ThrowOnError extends boolean = false>(options: Options<AgentStartData, ThrowOnError>): RequestResult<AgentStartResponses, AgentStartErrors, ThrowOnError> => (options.client ?? client).post<AgentStartResponses, AgentStartErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/agents/start',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Agent Stop\n */\nexport const agentStop = <ThrowOnError extends boolean = false>(options: Options<AgentStopData, ThrowOnError>): RequestResult<AgentStopResponses, AgentStopErrors, ThrowOnError> => (options.client ?? client).delete<AgentStopResponses, AgentStopErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/agents/{agent_id}/stop',\n ...options\n});\n\n/**\n * Agent Status\n *\n * Retrieves the current status of a specific <agent_id>.\n *\n * The most important fields are:\n * - success: Whether the agent task was successful (None if still running)\n * - answer: The answer to the agent task (None if still running)\n *\n * Also you can check the `steps` field to better understand which actions where taken by the agent.\n */\nexport const agentStatus = <ThrowOnError extends boolean = false>(options: Options<AgentStatusData, ThrowOnError>): RequestResult<AgentStatusResponses, AgentStatusErrors, ThrowOnError> => (options.client ?? client).get<AgentStatusResponses, AgentStatusErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/agents/{agent_id}',\n ...options\n});\n\n/**\n * Get Script\n *\n * Retrieves the current status of a specific <agent_id>.\n *\n * The most important fields are:\n * - success: Whether the agent task was successful (None if still running)\n * - answer: The answer to the agent task (None if still running)\n *\n * Also you can check the `steps` field to better understand which actions where taken by the agent.\n */\nexport const getScript = <ThrowOnError extends boolean = false>(options: Options<GetScriptData, ThrowOnError>): RequestResult<GetScriptResponses, GetScriptErrors, ThrowOnError> => (options.client ?? client).get<GetScriptResponses, GetScriptErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/agents/{agent_id}/workflow/code',\n ...options\n});\n\n/**\n * List Agents\n *\n * Retrieves a list of all agents associated with the authenticated user.\n *\n * Parameters:\n * - request: AgentListRequest containing:\n * - only_active: Whether to only return active agents\n * - limit: Maximum number of agents to return\n */\nexport const listAgents = <ThrowOnError extends boolean = false>(options?: Options<ListAgentsData, ThrowOnError>): RequestResult<ListAgentsResponses, ListAgentsErrors, ThrowOnError> => (options?.client ?? client).get<ListAgentsResponses, ListAgentsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/agents',\n ...options\n});\n\n/**\n * Get Session Script\n *\n * Generate a Python script from a session's trajectory.\n *\n * This endpoint generates executable Python code that replicates the session's actions,\n * with proper `client.AgentFallback` blocks for steps that were executed by agents.\n *\n * Returns both a Python script and JSON actions list.\n */\nexport const getSessionScript = <ThrowOnError extends boolean = false>(options: Options<GetSessionScriptData, ThrowOnError>): RequestResult<GetSessionScriptResponses, GetSessionScriptErrors, ThrowOnError> => (options.client ?? client).get<GetSessionScriptResponses, GetSessionScriptErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/workflow/code',\n ...options\n});\n","import { setTimeout as delay } from 'node:timers/promises';\nimport type { NotteClient } from '@/client';\nimport { TIMEOUT_HEADER } from '@/client';\nimport { InvalidRequestError, NotteAPIError, NotteError, NotteTimeoutError } from '@/errors';\nimport type { SessionResponse, ManagedAuthOperation } from '@/lib/client/types.gen';\nexport type { ManagedAuthOperation, ManagedAuthReadiness } from '@/lib/client/types.gen';\n\n/** Session response including managed authentication readiness. */\nexport type AuthSessionResponse = SessionResponse;\nexport interface ManagedAuthRunResponse {\n operation_id?: string | null;\n authenticated?: boolean | null;\n connection_id: string;\n status: string;\n message: string;\n}\nexport interface AuthWaitOptions {\n /** Overall waiting deadline, milliseconds. Defaults to 615000. */\n timeoutMs?: number;\n /** Delay between short polling requests, milliseconds. Defaults to 1000. */\n pollIntervalMs?: number;\n signal?: AbortSignal;\n}\nexport interface ManagedAuthRunOptions extends AuthWaitOptions {\n /** Wait for completion. Defaults to true. */\n wait?: boolean;\n /** Additional server-side login attempts, from 0 to 2. Defaults to 0. */\n auth_retry?: number;\n}\nexport class ManagedAuthError extends NotteError {}\n\n/** Poll read-only endpoints; never resubmit session creation or login. */\nexport async function pollAuth<T>(read: (signal: AbortSignal) => Promise<T | undefined>, options: AuthWaitOptions): Promise<T> {\n const timeoutMs = options.timeoutMs ?? 615_000;\n const interval = options.pollIntervalMs ?? 1000;\n if (!Number.isFinite(timeoutMs) || timeoutMs <= 0 || !Number.isFinite(interval) || interval <= 0) {\n throw new InvalidRequestError('timeoutMs and pollIntervalMs must be positive finite numbers');\n }\n const deadline = new AbortController();\n const timer = setTimeout(() => deadline.abort(new NotteTimeoutError('Timed out waiting for authentication')), timeoutMs);\n // Forward caller cancellation without AbortSignal.any (unavailable in Node 20.0–20.2).\n const cancel = () => deadline.abort(options.signal?.reason);\n if (options.signal?.aborted) cancel();\n else options.signal?.addEventListener('abort', cancel, { once: true });\n const signal = deadline.signal;\n let errors = 0;\n try {\n while (true) {\n signal.throwIfAborted();\n try {\n const value = await read(signal);\n signal.throwIfAborted();\n if (value !== undefined) return value;\n errors = 0;\n } catch (error) {\n signal.throwIfAborted();\n const retryable = error instanceof NotteAPIError ? error.statusCode >= 500\n : error instanceof TypeError || error instanceof NotteTimeoutError;\n if (!retryable || ++errors >= 3) throw error;\n }\n await delay(interval, undefined, { signal });\n }\n } catch (error) {\n signal.throwIfAborted();\n throw error;\n } finally {\n clearTimeout(timer);\n options.signal?.removeEventListener('abort', cancel);\n }\n}\n\n/**\n * Connection verification and recovery through `client.managedAuth`.\n *\n * ```typescript\n * const operation = await client.managedAuth.refreshConnection(\"<connection-id>\", { wait: false });\n * await client.managedAuth.waitForAuth(operation);\n * ```\n */\n// Legacy: these four managed-auth routes are absent from the committed OpenAPI snapshot.\nexport class NotteManagedAuth {\n constructor(private readonly client: NotteClient) {}\n\n /** Run only the verifier; this does not submit login credentials. */\n async checkConnection(connectionId: string): Promise<ManagedAuthRunResponse> {\n const response = await this.client.getClient().post<{ 200: ManagedAuthRunResponse }, unknown, true>({\n url: `/managed-auth/connections/${encodeURIComponent(connectionId)}/check`,\n body: {}, headers: { 'Content-Type': 'application/json' }, throwOnError: true,\n });\n return response.data;\n }\n\n async getOperation(operationId: string, options: Pick<AuthWaitOptions, 'signal'> = {}): Promise<ManagedAuthOperation> {\n const response = await this.client.getClient().get<{ 200: ManagedAuthOperation }, unknown, true>({\n url: `/managed-auth/operations/${encodeURIComponent(operationId)}`,\n headers: { [TIMEOUT_HEADER]: '10000' }, signal: options.signal, throwOnError: true,\n });\n return response.data;\n }\n\n /** Wait for an accepted operation. Aborting this wait does not cancel the server operation. */\n async waitForAuth(operation: ManagedAuthOperation, options: AuthWaitOptions = {}): Promise<ManagedAuthOperation> {\n const completed = (value: ManagedAuthOperation) => {\n if (value.status === 'succeeded') return value;\n if (value.status === 'pending' || value.status === 'running') return undefined;\n throw new ManagedAuthError(value.error || 'Connection authentication failed');\n };\n options.signal?.throwIfAborted();\n const result = completed(operation);\n if (result) return result;\n return pollAuth(async signal => completed(await this.getOperation(operation.id, { signal })), options);\n }\n\n /** Verify first, logging in only when required and automatic recovery is allowed. */\n async refreshConnection(connectionId: string, options: ManagedAuthRunOptions = {}): Promise<ManagedAuthOperation> {\n return this.run(connectionId, 'refresh', options);\n }\n\n /** Explicitly request a new login. Conflicting operations remain HTTP 409 errors. */\n async reauthenticateConnection(connectionId: string, options: ManagedAuthRunOptions = {}): Promise<ManagedAuthOperation> {\n return this.run(connectionId, 'reauthenticate', options);\n }\n\n private async run(connectionId: string, action: 'refresh' | 'reauthenticate', options: ManagedAuthRunOptions): Promise<ManagedAuthOperation> {\n options.signal?.throwIfAborted();\n const response = await this.client.getClient().post<{ 202: ManagedAuthOperation }, unknown, true>({\n url: `/managed-auth/connections/${encodeURIComponent(connectionId)}/${action}`,\n body: { auth_retry: options.auth_retry }, headers: { 'Content-Type': 'application/json' },\n signal: options.signal, throwOnError: true,\n });\n return options.wait === false ? response.data : this.waitForAuth(response.data, options);\n }\n}\n","/**\n * Typed error hierarchy mirroring `notte_sdk.errors` and the `notte_core` errors\n * the Python SDK raises. Every error thrown by the SDK extends `NotteError`, so\n * callers can `catch (e) { if (e instanceof NotteError) ... }` and branch on the\n * concrete class or on `NotteAPIError.statusCode`.\n */\nimport type { SerializedError } from '@/lib/client/types.gen';\n\nexport class NotteError extends Error {\n constructor(message: string, options?: { cause?: unknown }) {\n super(message, options);\n this.name = new.target.name;\n }\n}\n\n/**\n * Body of a failed HTTP response, best effort. JSON bodies are exposed as-is;\n * non-JSON bodies (HTML error pages, empty 502s) are wrapped as `{ message }`.\n */\nexport type NotteAPIErrorBody = Record<string, unknown>;\n\nfunction describeBody(error: NotteAPIErrorBody): string {\n try {\n return JSON.stringify(error);\n } catch {\n return String(error);\n }\n}\n\n/** The API answered with a non-2xx status. */\nexport class NotteAPIError extends NotteError {\n readonly path: string;\n readonly statusCode: number;\n readonly error: NotteAPIErrorBody;\n readonly response: Response | undefined;\n\n constructor(path: string, statusCode: number, error: NotteAPIErrorBody, response?: Response) {\n super(`Request to \\`${path}\\` failed with status code ${statusCode}: ${describeBody(error)}`);\n this.path = path;\n this.statusCode = statusCode;\n this.error = error;\n this.response = response;\n }\n\n /** The API's own error message, when it sent one. */\n get apiMessage(): string | undefined {\n const message = this.error.message ?? this.error.detail;\n return typeof message === 'string' ? message : undefined;\n }\n\n static fromBody(path: string, statusCode: number, body: unknown, response?: Response): NotteAPIError {\n return new NotteAPIError(path, statusCode, normalizeErrorBody(body), response);\n }\n}\n\n/** The API flagged the failure as an execution error (`x-error-class: NotteApiExecutionError`). */\nexport class NotteAPIExecutionError extends NotteAPIError {\n constructor(path: string, statusCode: number, error: NotteAPIErrorBody, response?: Response) {\n super(path, statusCode, error, response);\n this.message = `Error on ${path}: ${describeBody(error)}`;\n }\n}\n\n/** Missing or rejected credentials. Not retryable. */\nexport class AuthenticationError extends NotteError {\n constructor(message: string) {\n super(`Authentication failed. ${message}`);\n }\n}\n\n/** The request is malformed. Not retryable. */\nexport class InvalidRequestError extends NotteError {\n constructor(message: string) {\n super(`Invalid request. ${message}`);\n }\n}\n\n/** A request or a wait exceeded its deadline. */\nexport class NotteTimeoutError extends NotteError {}\n\n/** A cloud function run finished with `status: \"failed\"`. */\nexport class FailedToRunCloudFunctionError extends NotteError {\n readonly functionId: string;\n readonly functionRunId: string;\n readonly response: unknown;\n\n constructor(functionId: string, functionRunId: string, response: unknown) {\n super(\n `Function ${functionId} run ${functionRunId} failed: ${\n typeof response === 'string' ? response : describeBody((response ?? {}) as NotteAPIErrorBody)\n }`,\n );\n this.functionId = functionId;\n this.functionRunId = functionRunId;\n this.response = response;\n }\n}\n\n/** Structured scrape extraction failed (`StructuredData.success === false`). */\nexport class ScrapeFailedError extends NotteError {\n readonly structuredError: string | undefined;\n\n constructor(error: string | undefined) {\n super(`Scrape failed: ${error ?? 'unknown error'}`);\n this.structuredError = error;\n }\n}\n\n/**\n * An action executed through `session.execute()` failed. Rehydrated from the\n * structured `exception_detail` payload the API returns, so `errorType` names\n * the concrete server-side error class and the three messages carry the same\n * text Python exposes on `NotteBaseError`.\n */\nexport class ActionExecutionError extends NotteError {\n readonly errorType: string;\n readonly devMessage: string;\n readonly userMessage: string;\n readonly agentMessage: string;\n readonly shouldRetryLater: boolean;\n readonly shouldNotifyTeam: boolean;\n\n constructor(detail: SerializedError) {\n super(detail.dev_message || detail.user_message || detail.error_type);\n this.errorType = detail.error_type;\n this.devMessage = detail.dev_message;\n this.userMessage = detail.user_message;\n this.agentMessage = detail.agent_message;\n this.shouldRetryLater = detail.should_retry_later ?? false;\n this.shouldNotifyTeam = detail.should_notify_team ?? false;\n }\n\n static fromMessage(message: string, errorType = 'NotteBaseError'): ActionExecutionError {\n return new ActionExecutionError({\n error_type: errorType,\n dev_message: message,\n user_message: message,\n agent_message: message,\n });\n }\n}\n\n/** `evaluate_js` reported success but the API build predates the data payload. */\nexport class EvaluateJsNoDataError extends NotteError {\n constructor() {\n super('evaluate_js returned no data. Upgrade the Notte API to a build that returns the evaluated value.');\n }\n}\n\n/** The envelope returned by `session.fetch()` could not be decoded. */\nexport class FetchResponseDecodeError extends NotteError {\n constructor(reason: string) {\n super(`Failed to decode the response returned by the page fetch: ${reason}`);\n }\n}\n\nexport function normalizeErrorBody(body: unknown): NotteAPIErrorBody {\n if (body && typeof body === 'object' && !Array.isArray(body)) {\n return body as NotteAPIErrorBody;\n }\n if (body === undefined || body === null || body === '') {\n return {};\n }\n return { message: typeof body === 'string' ? body : String(body) };\n}\n\nexport interface RetryOptions {\n /** Maximum number of attempts, including the first one. */\n maxTries: number;\n /** Delay between attempts in milliseconds. Defaults to 5000 like the Python decorator. */\n delayMs?: number;\n /** Message of the `Error` raised once every attempt failed. */\n errorMessage?: string;\n /** Only retry when this returns true for the thrown error. Defaults to retrying on any error. */\n shouldRetry?: (error: unknown, attempt: number) => boolean;\n /** Called before sleeping between attempts. Defaults to `console.warn`. */\n onRetry?: (error: unknown, attempt: number, maxTries: number) => void;\n}\n\nconst DEFAULT_RETRY_MESSAGE = 'An error occurred while executing the function. Try again later...';\n\n/**\n * Wrap an async function so it is retried when it throws, mirroring\n * `notte_sdk.errors.retry`. The final failure is raised as an `Error` whose\n * `cause` is the last underlying error.\n *\n * ```ts\n * const start = retry(() => session.start(), { maxTries: 3, delayMs: 1000 });\n * await start();\n * ```\n */\nexport function retry<TArgs extends unknown[], TResult>(\n fn: (...args: TArgs) => Promise<TResult>,\n options: RetryOptions,\n): (...args: TArgs) => Promise<TResult> {\n const {\n maxTries,\n delayMs = 5000,\n errorMessage = DEFAULT_RETRY_MESSAGE,\n shouldRetry = () => true,\n onRetry = (error, attempt, total) => {\n console.warn(`Failed to execute ${fn.name || 'function'}: ${String(error)} (attempt ${attempt}/${total})`);\n },\n } = options;\n if (!Number.isInteger(maxTries) || maxTries < 1) {\n throw new InvalidRequestError('maxTries must be a positive integer');\n }\n\n return async (...args: TArgs): Promise<TResult> => {\n let lastError: unknown;\n for (let attempt = 1; attempt <= maxTries; attempt += 1) {\n try {\n return await fn(...args);\n } catch (error) {\n lastError = error;\n if (attempt === maxTries || !shouldRetry(error, attempt)) {\n break;\n }\n onRetry(error, attempt, maxTries);\n await sleep(delayMs);\n }\n }\n throw new Error(errorMessage, { cause: lastError });\n };\n}\n\nexport function sleep(ms: number): Promise<void> {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n","// Auto-generated by scripts/generate-resources.mjs. Do not edit.\nimport type { Client } from './lib/client/client';\nimport type * as Types from './lib/client/types.gen';\nimport * as operations from './lib/client/sdk.gen';\n\n/** Per-request cancellation; authentication and transport stay bound to NotteClient. */\nexport interface ResourceRequestOptions { signal?: AbortSignal }\n\n/** Low-level API resources. Lifecycle helpers remain on Session/Function. */\nexport function createResources(client: Client, getApiKey: () => string) {\n return {\n sessions: {\n /** sessionAuthReadiness: /sessions/{session_id}/auth. Returns the API response body. */\n authReadiness: async (sessionId: Types.SessionAuthReadinessData['path'][\"session_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionAuthReadinessData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.sessionAuthReadiness({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId } });\n return response.data;\n },\n /** createPayment: /sessions/{session_id}/payments. Returns the API response body. */\n createPayment: async (sessionId: Types.CreatePaymentData['path'][\"session_id\"], body: Types.CreatePaymentData['body'], query: Types.CreatePaymentData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers: Omit<NonNullable<Types.CreatePaymentData['headers']>, 'x-notte-api-key'> }) => {\n const response = await operations.createPayment({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, body, query });\n return response.data;\n },\n /** sessionDebugInfo: /sessions/{session_id}/debug. Returns the API response body. */\n debugInfo: async (sessionId: Types.SessionDebugInfoData['path'][\"session_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionDebugInfoData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.sessionDebugInfo({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId } });\n return response.data;\n },\n /** deleteSessionFile: /sessions/{session_id}/files/{file_id}. Returns the API response body. */\n deleteSessionFile: async (sessionId: Types.DeleteSessionFileData['path'][\"session_id\"], fileId: Types.DeleteSessionFileData['path'][\"file_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.DeleteSessionFileData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.deleteSessionFile({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId, \"file_id\": fileId } });\n return response.data;\n },\n /** downloadSessionFile: /sessions/{session_id}/files/{file_id}. Returns the API response body. */\n downloadSessionFile: async (sessionId: Types.DownloadSessionFileData['path'][\"session_id\"], fileId: Types.DownloadSessionFileData['path'][\"file_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.DownloadSessionFileData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.downloadSessionFile({ client, throwOnError: true, signal: requestOptions.signal, parseAs: \"blob\", headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId, \"file_id\": fileId } });\n return response.data;\n },\n /** pageExecute: /sessions/{session_id}/page/execute. Returns the API response body. */\n execute: async (sessionId: Types.PageExecuteData['path'][\"session_id\"], body: Types.PageExecuteData['body'], query: Types.PageExecuteData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.PageExecuteData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.pageExecute({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, body, query });\n return response.data;\n },\n /** executeSessionFile: /sessions/{session_id}/page/execute/file. Returns the API response body. */\n executeSessionFile: async (sessionId: Types.ExecuteSessionFileData['path'][\"session_id\"], body: Types.ExecuteSessionFileData['body'], query: Types.ExecuteSessionFileData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ExecuteSessionFileData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.executeSessionFile({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, body, query });\n return response.data;\n },\n /** sessionCookiesGet: /sessions/{session_id}/cookies. Returns the API response body. */\n getCookies: async (sessionId: Types.SessionCookiesGetData['path'][\"session_id\"], query: Types.SessionCookiesGetData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionCookiesGetData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.sessionCookiesGet({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, query });\n return response.data;\n },\n /** getSessionScript: /sessions/{session_id}/workflow/code. Returns the API response body. */\n getSessionScript: async (sessionId: Types.GetSessionScriptData['path'][\"session_id\"], query: Types.GetSessionScriptData['query'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.GetSessionScriptData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.getSessionScript({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, query });\n return response.data;\n },\n /** listSessions: /sessions. Returns the API response body. */\n list: async (query: Types.ListSessionsData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ListSessionsData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.listSessions({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, query });\n return response.data;\n },\n /** listSessionFiles: /sessions/{session_id}/files. Returns the API response body. */\n listSessionFiles: async (sessionId: Types.ListSessionFilesData['path'][\"session_id\"], query: Types.ListSessionFilesData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ListSessionFilesData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.listSessionFiles({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, query });\n return response.data;\n },\n /** sessionMouseReplay: /sessions/{session_id}/replay/mouse. Returns the API response body. */\n mouseReplay: async (sessionId: Types.SessionMouseReplayData['path'][\"session_id\"], query: Types.SessionMouseReplayData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionMouseReplayData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.sessionMouseReplay({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, query });\n return response.data;\n },\n /** sessionNetworkLogs: /sessions/{session_id}/network/logs. Returns the API response body. */\n networkLogs: async (sessionId: Types.SessionNetworkLogsData['path'][\"session_id\"], query: Types.SessionNetworkLogsData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionNetworkLogsData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.sessionNetworkLogs({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, query });\n return response.data;\n },\n /** pageObserve: /sessions/{session_id}/page/observe. Returns the API response body. */\n observe: async (sessionId: Types.PageObserveData['path'][\"session_id\"], body: Types.PageObserveData['body'], query: Types.PageObserveData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.PageObserveData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.pageObserve({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, body, query });\n return response.data;\n },\n /** sessionOffset: /sessions/{session_id}/offset. Returns the API response body. */\n offset: async (sessionId: Types.SessionOffsetData['path'][\"session_id\"], query: Types.SessionOffsetData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionOffsetData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.sessionOffset({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, query });\n return response.data;\n },\n /** pageScreenshot: /sessions/{session_id}/page/screenshot. Returns the API response body. */\n pageScreenshot: async (sessionId: Types.PageScreenshotData['path'][\"session_id\"], query: Types.PageScreenshotData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.PageScreenshotData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.pageScreenshot({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, query });\n return response.data;\n },\n /** sessionProfilePreview: /sessions/{session_id}/profile-preview. Returns the API response body. */\n profilePreview: async (sessionId: Types.SessionProfilePreviewData['path'][\"session_id\"], query: Types.SessionProfilePreviewData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionProfilePreviewData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.sessionProfilePreview({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, query });\n return response.data;\n },\n /** sessionReplay: /sessions/{session_id}/replay. Returns the API response body. */\n replay: async (sessionId: Types.SessionReplayData['path'][\"session_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionReplayData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.sessionReplay({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId } });\n return response.data;\n },\n /** sessionProfileSave: /sessions/{session_id}/profile/save. Returns the API response body. */\n saveProfile: async (sessionId: Types.SessionProfileSaveData['path'][\"session_id\"], body: Types.SessionProfileSaveData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionProfileSaveData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.sessionProfileSave({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, body });\n return response.data;\n },\n /** pageScrape: /sessions/{session_id}/page/scrape. Returns the API response body. */\n scrape: async (sessionId: Types.PageScrapeData['path'][\"session_id\"], body: Types.PageScrapeData['body'], query: Types.PageScrapeData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.PageScrapeData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.pageScrape({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, body, query });\n return response.data;\n },\n /** sessionCookiesSet: /sessions/{session_id}/cookies. Returns the API response body. */\n setCookies: async (sessionId: Types.SessionCookiesSetData['path'][\"session_id\"], body: Types.SessionCookiesSetData['body'], query: Types.SessionCookiesSetData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionCookiesSetData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.sessionCookiesSet({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, body, query });\n return response.data;\n },\n /** sessionStart: /sessions/start. Returns the API response body. */\n start: async (body: Types.SessionStartData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionStartData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.sessionStart({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, body });\n return response.data;\n },\n /** sessionStatus: /sessions/{session_id}. Returns the API response body. */\n status: async (sessionId: Types.SessionStatusData['path'][\"session_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionStatusData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.sessionStatus({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId } });\n return response.data;\n },\n /** sessionStop: /sessions/{session_id}/stop. Returns the API response body. */\n stop: async (sessionId: Types.SessionStopData['path'][\"session_id\"], query: Types.SessionStopData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionStopData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.sessionStop({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, query });\n return response.data;\n },\n /** uploadSessionFile: /sessions/{session_id}/files. Returns the API response body. */\n uploadSessionFile: async (sessionId: Types.UploadSessionFileData['path'][\"session_id\"], body: Types.UploadSessionFileData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.UploadSessionFileData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.uploadSessionFile({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, body });\n return response.data;\n },\n },\n files: {\n /** deleteSessionFile: /sessions/{session_id}/files/{file_id}. Returns the API response body. */\n delete: async (sessionId: Types.DeleteSessionFileData['path'][\"session_id\"], fileId: Types.DeleteSessionFileData['path'][\"file_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.DeleteSessionFileData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.deleteSessionFile({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId, \"file_id\": fileId } });\n return response.data;\n },\n /** downloadSessionFile: /sessions/{session_id}/files/{file_id}. Returns the API response body. */\n download: async (sessionId: Types.DownloadSessionFileData['path'][\"session_id\"], fileId: Types.DownloadSessionFileData['path'][\"file_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.DownloadSessionFileData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.downloadSessionFile({ client, throwOnError: true, signal: requestOptions.signal, parseAs: \"blob\", headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId, \"file_id\": fileId } });\n return response.data;\n },\n /** executeSessionFile: /sessions/{session_id}/page/execute/file. Returns the API response body. */\n execute: async (sessionId: Types.ExecuteSessionFileData['path'][\"session_id\"], body: Types.ExecuteSessionFileData['body'], query: Types.ExecuteSessionFileData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ExecuteSessionFileData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.executeSessionFile({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, body, query });\n return response.data;\n },\n /** listSessionFiles: /sessions/{session_id}/files. Returns the API response body. */\n list: async (sessionId: Types.ListSessionFilesData['path'][\"session_id\"], query: Types.ListSessionFilesData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ListSessionFilesData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.listSessionFiles({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, query });\n return response.data;\n },\n /** uploadSessionFile: /sessions/{session_id}/files. Returns the API response body. */\n upload: async (sessionId: Types.UploadSessionFileData['path'][\"session_id\"], body: Types.UploadSessionFileData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.UploadSessionFileData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.uploadSessionFile({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, body });\n return response.data;\n },\n },\n functions: {\n /** functionCreate: /functions. Returns the API response body. */\n create: async (body: Types.FunctionCreateData['body'], query: Types.FunctionCreateData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionCreateData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.functionCreate({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, body, query });\n return response.data;\n },\n /** functionDelete: /functions/{function_id}. Returns the API response body. */\n delete: async (functionId: Types.FunctionDeleteData['path'][\"function_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionDeleteData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.functionDelete({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId } });\n return response.data;\n },\n /** functionScheduleDelete: /functions/{function_id}/schedule. Returns the API response body. */\n deleteSchedule: async (functionId: Types.FunctionScheduleDeleteData['path'][\"function_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionScheduleDeleteData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.functionScheduleDelete({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId } });\n return response.data;\n },\n /** downloadRunPayload: /functions/{function_id}/runs/{run_id}/payloads/{field}. Returns the API response body. */\n downloadRunPayload: async (functionId: Types.DownloadRunPayloadData['path'][\"function_id\"], runId: Types.DownloadRunPayloadData['path'][\"run_id\"], field: Types.DownloadRunPayloadData['path'][\"field\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.DownloadRunPayloadData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.downloadRunPayload({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId, \"run_id\": runId, \"field\": field } });\n return response.data;\n },\n /** functionDownloadUrl: /functions/{function_id}. Returns the API response body. */\n downloadUrl: async (functionId: Types.FunctionDownloadUrlData['path'][\"function_id\"], query: Types.FunctionDownloadUrlData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionDownloadUrlData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.functionDownloadUrl({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId }, query });\n return response.data;\n },\n /** functionFork: /functions/{function_id}/fork. Returns the API response body. */\n fork: async (functionId: Types.FunctionForkData['path'][\"function_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionForkData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.functionFork({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId } });\n return response.data;\n },\n /** listFunctions: /functions. Returns the API response body. */\n list: async (query: Types.ListFunctionsData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ListFunctionsData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.listFunctions({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, query });\n return response.data;\n },\n /** listFunctionRunsByFunctionId: /functions/{function_id}/runs. Returns the API response body. */\n listRuns: async (functionId: Types.ListFunctionRunsByFunctionIdData['path'][\"function_id\"], query: Types.ListFunctionRunsByFunctionIdData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ListFunctionRunsByFunctionIdData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.listFunctionRunsByFunctionId({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId }, query });\n return response.data;\n },\n /** functionMetadataUpdate: /functions/{function_id}. Returns the API response body. */\n metadataUpdate: async (functionId: Types.FunctionMetadataUpdateData['path'][\"function_id\"], body: Types.FunctionMetadataUpdateData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionMetadataUpdateData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.functionMetadataUpdate({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId }, body });\n return response.data;\n },\n /** prepareRunPayloadUpload: /functions/{function_id}/runs/{run_id}/payloads/{field}/upload. Returns the API response body. */\n prepareRunPayloadUpload: async (functionId: Types.PrepareRunPayloadUploadData['path'][\"function_id\"], runId: Types.PrepareRunPayloadUploadData['path'][\"run_id\"], field: Types.PrepareRunPayloadUploadData['path'][\"field\"], body: Types.PrepareRunPayloadUploadData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.PrepareRunPayloadUploadData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.prepareRunPayloadUpload({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId, \"run_id\": runId, \"field\": field }, body });\n return response.data;\n },\n /** functionRollback: /functions/{function_id}/rollback. Returns the API response body. */\n rollback: async (functionId: Types.FunctionRollbackData['path'][\"function_id\"], body: Types.FunctionRollbackData['body'], query: Types.FunctionRollbackData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionRollbackData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.functionRollback({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId }, body, query });\n return response.data;\n },\n /** functionRunGetMetadata: /functions/{function_id}/runs/{run_id}. Returns the API response body. */\n runGetMetadata: async (functionId: Types.FunctionRunGetMetadataData['path'][\"function_id\"], runId: Types.FunctionRunGetMetadataData['path'][\"run_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionRunGetMetadataData['headers']>, 'x-notte-api-key'> } = {}, query: Types.FunctionRunGetMetadataData['query'] = undefined) => {\n const response = await operations.functionRunGetMetadata({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId, \"run_id\": runId }, query });\n return response.data;\n },\n /** functionRunStart: /functions/{function_id}/runs/start. Returns the API response body. */\n runStart: async (functionId: Types.FunctionRunStartData['path'][\"function_id\"], body: Types.FunctionRunStartData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionRunStartData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.functionRunStart({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers, 'x-notte-api-key': getApiKey() }, path: { \"function_id\": functionId }, body });\n return response.data;\n },\n /** functionRunStop: /functions/{function_id}/runs/{run_id}. Returns the API response body. */\n runStop: async (functionId: Types.FunctionRunStopData['path'][\"function_id\"], runId: Types.FunctionRunStopData['path'][\"run_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionRunStopData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.functionRunStop({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId, \"run_id\": runId } });\n return response.data;\n },\n /** functionRunUpdateMetadata: /functions/{function_id}/runs/{run_id}. Returns the API response body. */\n runUpdateMetadata: async (functionId: Types.FunctionRunUpdateMetadataData['path'][\"function_id\"], runId: Types.FunctionRunUpdateMetadataData['path'][\"run_id\"], body: Types.FunctionRunUpdateMetadataData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionRunUpdateMetadataData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.functionRunUpdateMetadata({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId, \"run_id\": runId }, body });\n return response.data;\n },\n /** functionRuntimeHealth: /functions/health. Returns the API response body. */\n runtimeHealth: async (requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionRuntimeHealthData['headers']>, 'x-notte-api-key'> } = {}, query: Types.FunctionRuntimeHealthData['query'] = undefined) => {\n const response = await operations.functionRuntimeHealth({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, query });\n return response.data;\n },\n /** functionScheduleSet: /functions/{function_id}/schedule. Returns the API response body. */\n setSchedule: async (functionId: Types.FunctionScheduleSetData['path'][\"function_id\"], body: Types.FunctionScheduleSetData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionScheduleSetData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.functionScheduleSet({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId }, body });\n return response.data;\n },\n /** functionUpdate: /functions/{function_id}. Returns the API response body. */\n update: async (functionId: Types.FunctionUpdateData['path'][\"function_id\"], body: Types.FunctionUpdateData['body'], query: Types.FunctionUpdateData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionUpdateData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.functionUpdate({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId }, body, query });\n return response.data;\n },\n },\n personas: {\n /** personaCreate: /personas/create. Returns the API response body. */\n create: async (body: Types.PersonaCreateData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.PersonaCreateData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.personaCreate({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, body });\n return response.data;\n },\n /** personaDelete: /personas/{persona_id}. Returns the API response body. */\n delete: async (personaId: Types.PersonaDeleteData['path'][\"persona_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.PersonaDeleteData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.personaDelete({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"persona_id\": personaId } });\n return response.data;\n },\n /** personaEmailsList: /personas/{persona_id}/emails. Returns the API response body. */\n emailsList: async (personaId: Types.PersonaEmailsListData['path'][\"persona_id\"], query: Types.PersonaEmailsListData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.PersonaEmailsListData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.personaEmailsList({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"persona_id\": personaId }, query });\n return response.data;\n },\n /** personaGet: /personas/{persona_id}. Returns the API response body. */\n get: async (personaId: Types.PersonaGetData['path'][\"persona_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.PersonaGetData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.personaGet({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"persona_id\": personaId } });\n return response.data;\n },\n /** listPersonas: /personas. Returns the API response body. */\n list: async (query: Types.ListPersonasData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ListPersonasData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.listPersonas({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, query });\n return response.data;\n },\n /** personaSmsList: /personas/{persona_id}/sms. Returns the API response body. */\n smsList: async (personaId: Types.PersonaSmsListData['path'][\"persona_id\"], query: Types.PersonaSmsListData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.PersonaSmsListData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.personaSmsList({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"persona_id\": personaId }, query });\n return response.data;\n },\n /** personaUpdate: /personas/{persona_id}. Returns the API response body. */\n update: async (personaId: Types.PersonaUpdateData['path'][\"persona_id\"], body: Types.PersonaUpdateData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.PersonaUpdateData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.personaUpdate({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"persona_id\": personaId }, body });\n return response.data;\n },\n },\n vaults: {\n /** vaultCreate: /vaults/create. Returns the API response body. */\n create: async (body: Types.VaultCreateData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.VaultCreateData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.vaultCreate({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, body });\n return response.data;\n },\n /** vaultCredentialsAdd: /vaults/{vault_id}/credentials. Returns the API response body. */\n credentialsAdd: async (vaultId: Types.VaultCredentialsAddData['path'][\"vault_id\"], body: Types.VaultCredentialsAddData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.VaultCredentialsAddData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.vaultCredentialsAdd({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"vault_id\": vaultId }, body });\n return response.data;\n },\n /** vaultCredentialsDelete: /vaults/{vault_id}/credentials. Returns the API response body. */\n credentialsDelete: async (vaultId: Types.VaultCredentialsDeleteData['path'][\"vault_id\"], query: Types.VaultCredentialsDeleteData['query'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.VaultCredentialsDeleteData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.vaultCredentialsDelete({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"vault_id\": vaultId }, query });\n return response.data;\n },\n /** vaultCredentialsGet: /vaults/{vault_id}/credentials. Returns the API response body. */\n credentialsGet: async (vaultId: Types.VaultCredentialsGetData['path'][\"vault_id\"], query: Types.VaultCredentialsGetData['query'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.VaultCredentialsGetData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.vaultCredentialsGet({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"vault_id\": vaultId }, query });\n return response.data;\n },\n /** vaultCredentialsList: /vaults/{vault_id}. Returns the API response body. */\n credentialsList: async (vaultId: Types.VaultCredentialsListData['path'][\"vault_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.VaultCredentialsListData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.vaultCredentialsList({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"vault_id\": vaultId } });\n return response.data;\n },\n /** vaultCreditCardDelete: /vaults/{vault_id}/card. Returns the API response body. */\n creditCardDelete: async (vaultId: Types.VaultCreditCardDeleteData['path'][\"vault_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.VaultCreditCardDeleteData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.vaultCreditCardDelete({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"vault_id\": vaultId } });\n return response.data;\n },\n /** vaultCreditCardGet: /vaults/{vault_id}/card. Returns the API response body. */\n creditCardGet: async (vaultId: Types.VaultCreditCardGetData['path'][\"vault_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.VaultCreditCardGetData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.vaultCreditCardGet({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"vault_id\": vaultId } });\n return response.data;\n },\n /** vaultCreditCardSet: /vaults/{vault_id}/card. Returns the API response body. */\n creditCardSet: async (vaultId: Types.VaultCreditCardSetData['path'][\"vault_id\"], body: Types.VaultCreditCardSetData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.VaultCreditCardSetData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.vaultCreditCardSet({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"vault_id\": vaultId }, body });\n return response.data;\n },\n /** vaultDelete: /vaults/{vault_id}. Returns the API response body. */\n delete: async (vaultId: Types.VaultDeleteData['path'][\"vault_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.VaultDeleteData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.vaultDelete({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"vault_id\": vaultId } });\n return response.data;\n },\n /** listVaults: /vaults. Returns the API response body. */\n list: async (query: Types.ListVaultsData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ListVaultsData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.listVaults({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, query });\n return response.data;\n },\n /** vaultUpdate: /vaults/{vault_id}. Returns the API response body. */\n update: async (vaultId: Types.VaultUpdateData['path'][\"vault_id\"], body: Types.VaultUpdateData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.VaultUpdateData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.vaultUpdate({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"vault_id\": vaultId }, body });\n return response.data;\n },\n },\n profiles: {\n /** profileCookiesGet: /profiles/{profile_id}/cookies. Returns the API response body. */\n cookiesGet: async (profileId: Types.ProfileCookiesGetData['path'][\"profile_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ProfileCookiesGetData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.profileCookiesGet({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"profile_id\": profileId } });\n return response.data;\n },\n /** profileCookiesSet: /profiles/{profile_id}/cookies. Returns the API response body. */\n cookiesSet: async (profileId: Types.ProfileCookiesSetData['path'][\"profile_id\"], body: Types.ProfileCookiesSetData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ProfileCookiesSetData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.profileCookiesSet({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"profile_id\": profileId }, body });\n return response.data;\n },\n /** profileCreate: /profiles/create. Returns the API response body. */\n create: async (body: Types.ProfileCreateData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ProfileCreateData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.profileCreate({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, body });\n return response.data;\n },\n /** profileDelete: /profiles/{profile_id}. Returns the API response body. */\n delete: async (profileId: Types.ProfileDeleteData['path'][\"profile_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ProfileDeleteData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.profileDelete({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"profile_id\": profileId } });\n return response.data;\n },\n /** profileDuplicate: /profiles/{profile_id}/duplicate. Returns the API response body. */\n duplicate: async (profileId: Types.ProfileDuplicateData['path'][\"profile_id\"], body: Types.ProfileDuplicateData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ProfileDuplicateData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.profileDuplicate({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"profile_id\": profileId }, body });\n return response.data;\n },\n /** profileGet: /profiles/{profile_id}. Returns the API response body. */\n get: async (profileId: Types.ProfileGetData['path'][\"profile_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ProfileGetData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.profileGet({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"profile_id\": profileId } });\n return response.data;\n },\n /** profileList: /profiles. Returns the API response body. */\n list: async (query: Types.ProfileListData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ProfileListData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.profileList({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, query });\n return response.data;\n },\n /** profileStateSet: /profiles/{profile_id}/state. Returns the API response body. */\n stateSet: async (profileId: Types.ProfileStateSetData['path'][\"profile_id\"], body: Types.ProfileStateSetData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ProfileStateSetData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.profileStateSet({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"profile_id\": profileId }, body });\n return response.data;\n },\n },\n };\n}\n","import { pollAuth, ManagedAuthError, type AuthWaitOptions, type AuthSessionResponse as SessionResponse } from '@/managed-auth';\nimport { existsSync } from 'node:fs';\nimport { writeFile } from 'node:fs/promises';\nimport { resolve } from 'node:path';\nimport { setTimeout as delay } from 'node:timers/promises';\nimport type { Browser, BrowserContext, Dialog, Page } from 'playwright-core';\nimport { DEFAULT_REQUEST_TIMEOUT_MS, MAX_RETRIES_HEADER, NotteClient, REQUEST_ORIGIN, TIMEOUT_HEADER } from '@/client';\nimport { SDK_VERSION } from '@/version';\nimport type {\n AgentFunctionCodeResponse,\n ApiExecutionResponse,\n ApiSessionStartRequest,\n Cookie,\n ExecutionResponse,\n Observation,\n PageExecuteData,\n ObserveRequest,\n ProfileResponse,\n ReplayResponse,\n ScrapeRequest,\n SessionDebugResponse,\n TabSessionDebugResponse,\n} from '@/lib/client/types.gen';\nimport {\n getSessionScript,\n pageExecute,\n pageObserve,\n pageScrape,\n sessionCookiesGet,\n sessionCookiesSet,\n sessionDebugInfo,\n sessionProfileSave,\n sessionReplay,\n sessionStart,\n sessionAuthReadiness,\n sessionStatus,\n sessionStop,\n} from '@/lib/client/sdk.gen';\nimport { ActionExecutionError, EvaluateJsNoDataError, NotteAPIError, NotteTimeoutError, sleep } from '@/errors';\nimport type { ExecuteAction } from '@/actions';\nimport { executeWithCaptcha, type CaptchaExecutionResponse } from '@/captcha';\nimport { buildFetchScript, responseFromEvaluated, type PageFetchOptions, type PageFetchResponse } from '@/page-fetch';\nimport { createOrAppendCookiesToFile, readCookiesFile } from '@/cookies';\nimport {\n buildScrapeBody,\n processScrapeResponse,\n type ScrapeResult,\n type SessionScrapeOptions,\n type StructuredData,\n type ZodLikeSchema,\n} from '@/scrape';\nimport { openBrowser } from '@/utils';\nimport { backoffDelayMs, isRetryableNetworkError, isRetryableStatus, retryDelayMs } from '@/retry';\nimport type { RemoteFileStorage } from '@/files';\n\n/** Number of attempts `start()` makes on 5xx errors, like `RemoteSession.start(tries=3)`. */\nexport const SESSION_START_TRIES = 3;\n/**\n * Delay before `start()` retries an HTTP 529 (cluster overload) when the\n * client's own retries are disabled (`maxRetries: 0`). Otherwise the client\n * already retried the 529, honoring the API's `Retry-After`.\n */\nexport const CLUSTER_OVERLOAD_RETRY_DELAY_MS = 30_000;\n/** @deprecated Legacy request limit; CAPTCHA polls now use at most 10 seconds per request. */\nexport const CAPTCHA_SOLVE_TIMEOUT_MS = 100_000;\n\nexport type PerceptionType = NonNullable<ObserveRequest['perception_type']>;\n\n/** Migration guide for the observe options removed on December 1, 2026. */\nconst OBSERVE_MIGRATION_URL = 'https://docs.notte.cc/features/sessions/observe-migration';\nconst OBSERVE_DEPRECATIONS = {\n instructions: `\\`observe({ instructions })\\` is deprecated and will be removed on December 1, 2026; <<ALTERNATIVE FOR instructions: session.act() — pending>>. See ${OBSERVE_MIGRATION_URL}`,\n deep: `\\`perception_type: 'deep'\\` is deprecated and will be removed on December 1, 2026; use \\`perception_type: 'fast'\\` (the default). See ${OBSERVE_MIGRATION_URL}`,\n} as const;\n\nexport type SessionCloseReason = 'manual' | 'error';\n\nexport interface ExecuteOptions {\n /** Throw when the action fails. Defaults to the session's `raiseOnFailure` (true). */\n raiseOnFailure?: boolean;\n}\n\nexport interface ReplayOptions {\n /** Poll until the replay is ready instead of failing on 404. Defaults to true. */\n wait?: boolean;\n /** Maximum time to wait for the replay, in milliseconds. Defaults to 240 000. */\n timeoutMs?: number;\n /** Delay between polling attempts, in milliseconds. Defaults to 5 000. */\n pollIntervalMs?: number;\n}\n\n/** Target for `session.saveProfile()`. Pass at most one of the two fields. */\nexport interface SaveProfileOptions {\n /** Existing profile to overwrite with the session's current browser state. */\n profile_id?: string;\n /** Create a new profile with this name and save into it. */\n name?: string;\n}\n\nexport interface SessionScriptOptions {\n /** Return a standalone workflow script rather than only the relevant steps. Defaults to true. */\n as_workflow?: boolean;\n /** Infer a `response_format` schema for scrape calls that have instructions but no schema. */\n infer_response_format?: boolean;\n}\n\nexport interface SessionStartOptions extends AuthWaitOptions {\n /** Override the session default; false returns while authentication continues. */\n wait_for_authentication?: boolean;\n}\n\nexport interface SessionOptions extends ApiSessionStartRequest {\n /** Wait in the SDK for managed authentication on start(). Defaults to true; use() always waits. */\n wait_for_authentication?: boolean;\n /** Additional server-side login attempts, from 0 to 2. Only sent with auth_ids. */\n auth_retry?: number;\n /**\n * @deprecated Remote sessions always use the supported browser launch mode.\n * Retained as a boolean so existing typed configuration still compiles.\n * `true` is discarded; `false` raises a migration error when starting.\n */\n headless?: boolean;\n /**\n * Open the live viewer in the local default browser after the session starts.\n * This is a local SDK option and is not sent to the API.\n */\n open_viewer?: boolean;\n /**\n * Default for `execute()`: throw `ActionExecutionError` when an action fails.\n * The counterpart of `raise_on_failure` on `RemoteSession`. Defaults to true.\n */\n raiseOnFailure?: boolean;\n /**\n * Default perception type for `observe()`. Defaults to `fast`. `'deep'` is\n * deprecated and removed on December 1, 2026; use `'fast'`.\n */\n perception_type?: PerceptionType;\n /**\n * JSON cookie file: loaded into the session on `start()` when it exists and\n * appended with the session cookies on `stop()`.\n */\n cookie_file?: string;\n /** File storage to attach to the session for uploads and downloads. */\n storage?: RemoteFileStorage;\n}\n\n/**\n * Keep the external CDP client from competing with Notte for native dialogs.\n *\n * Playwright automatically handles a JavaScript dialog when no listener is\n * registered. Native dialogs are target-global, so that default races the\n * Notte browser controller attached to the same target. The backend owns\n * dialog handling; this listener makes the SDK Playwright connection an\n * observer without issuing a second `Page.handleJavaScriptDialog` command.\n */\nexport function observeServerOwnedDialog(_dialog: Dialog): void {}\n\nexport function installServerOwnedDialogPolicy(browser: Pick<Browser, 'contexts'>): void {\n for (const context of browser.contexts() as BrowserContext[]) {\n context.on('dialog', observeServerOwnedDialog);\n }\n}\n\n/**\n * Browser session created with `client.Session(options)`.\n * Call `start()` before using it and `stop()` when finished, or use `use()`\n * to start and stop automatically around an asynchronous callback.\n */\nexport class Session {\n private client: NotteClient;\n private options: ApiSessionStartRequest & { use_file_storage?: boolean };\n private openViewer: boolean;\n private legacyHeadless: boolean | undefined;\n private defaultRaiseOnFailure: boolean;\n private defaultPerceptionType: PerceptionType;\n private readonly warnedObserveDeprecations = new Set<keyof typeof OBSERVE_DEPRECATIONS>();\n private cookieFile: string | undefined;\n private cookiesLoaded = false;\n private cookieLoadPromise: Promise<void> | undefined;\n private authenticationReady = false;\n private fileStorage: RemoteFileStorage | undefined;\n private sessionId: string | null = null;\n private isActive = false;\n private response: SessionResponse | null = null;\n private playwrightBrowser: Browser | null = null;\n private playwrightPage: Page | null = null;\n\n constructor(client: NotteClient, options: SessionOptions = {}) {\n this.client = client;\n const {\n open_viewer = false,\n headless,\n raiseOnFailure = true,\n perception_type = 'fast',\n cookie_file,\n storage,\n ...sessionOptions\n } = options;\n this.options = storage ? { ...sessionOptions, use_file_storage: true } : sessionOptions;\n this.openViewer = open_viewer;\n this.legacyHeadless = headless;\n this.defaultRaiseOnFailure = raiseOnFailure;\n this.defaultPerceptionType = perception_type;\n this.cookieFile = cookie_file;\n this.fileStorage = storage;\n }\n\n // #######################################################################\n // ############################# Session #################################\n // #######################################################################\n\n /**\n * Start the session: creates a new session on the server.\n *\n * 503, 529, and refused connections follow the client's retry policy\n * (`NotteClientConfig.maxRetries`, honoring `Retry-After`). Other 5xx\n * errors are retried up to `SESSION_START_TRIES` times. With client\n * retries disabled, 529 waits `CLUSTER_OVERLOAD_RETRY_DELAY_MS` instead.\n * 4xx errors are never retried.\n *\n * Managed-auth sessions wait for readiness by default. Pass\n * `{ wait_for_authentication: false }` for an explicit nonblocking start,\n * then call `waitForAuth()` before executing actions or connecting over CDP.\n * Cancellation during creation waits for its response so the new session can\n * be closed. Cancellation or failure during the startup wait also closes it.\n * Prefer `session.use(async session => { ... })`, which also stops the session.\n * @example\n * const session = client.Session();\n * await session.start();\n */\n async start(options: SessionStartOptions = {}): Promise<void> {\n if (this.legacyHeadless === true) {\n console.warn('`headless: true` is deprecated and ignored; remote sessions always use the supported browser launch mode.');\n this.legacyHeadless = undefined;\n }\n if (this.isActive) {\n throw new Error('Session is already active');\n }\n\n options.signal?.throwIfAborted();\n const { auth_retry, wait_for_authentication, ...request } = this.options;\n const body = {\n ...request,\n ...(this.legacyHeadless !== undefined ? { headless: this.legacyHeadless } : {}),\n ...(auth_retry !== undefined ? { auth_retry } : {}),\n ...(request.auth_ids?.length ? { wait_for_authentication: false } : {}),\n };\n const shouldWait = options.wait_for_authentication ?? wait_for_authentication ?? true;\n // The client's retry policy (503, 529, refused connections) is applied\n // here instead of in the transport, so the caller's signal interrupts the\n // wait between attempts without cancelling a creation already in flight.\n const maxRetries = this.client.getConfig().maxRetries ?? 0;\n const timeoutMs = this.client.getConfig().timeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;\n const deadline = timeoutMs > 0 ? Date.now() + timeoutMs : undefined;\n const fitsDeadline = (wait: number) => deadline === undefined || Date.now() + wait < deadline;\n let transientRetries = 0;\n let tries = SESSION_START_TRIES;\n const origTries = tries;\n let sessionData: SessionResponse | undefined;\n while (tries > 0) {\n options.signal?.throwIfAborted();\n if (!fitsDeadline(0)) throw new NotteTimeoutError(`Session start timed out after ${timeoutMs}ms`);\n try {\n const response = await sessionStart({\n client: this.client.getClient(), body, throwOnError: true, headers: {\n [MAX_RETRIES_HEADER]: '0',\n ...(deadline === undefined ? {} : { [TIMEOUT_HEADER]: String(Math.max(1, deadline - Date.now())) }),\n },\n });\n sessionData = response.data;\n break;\n } catch (error) {\n const transient = error instanceof NotteAPIError\n ? isRetryableStatus(error.statusCode, 'POST')\n : isRetryableNetworkError(error, 'POST');\n if (maxRetries > 0 && transient) {\n const wait = transientRetries >= maxRetries ? undefined : error instanceof NotteAPIError\n ? retryDelayMs(transientRetries, error.response?.headers.get('retry-after'))\n : backoffDelayMs(transientRetries);\n if (wait === undefined || !fitsDeadline(wait)) throw error;\n transientRetries += 1;\n console.warn(\n `Failed to start session (${error instanceof NotteAPIError ? error.statusCode : 'connection error'}), retrying in ${(wait / 1000).toFixed(1)}s (${transientRetries}/${maxRetries})`\n );\n await pauseStart(wait, options.signal);\n continue;\n }\n tries -= 1;\n // raise if no tries left, if the error is not an API error, or if it is a 4xx\n if (tries === 0 || !(error instanceof NotteAPIError) || error.statusCode < 500) {\n throw error;\n }\n const retryStr = `${origTries - tries}/${origTries - 1}`;\n if (!fitsDeadline(error.statusCode === 529 ? CLUSTER_OVERLOAD_RETRY_DELAY_MS : 0)) throw error;\n if (error.statusCode === 529) {\n console.warn(\n `Failed to start session due to cluster overload, retrying in ${CLUSTER_OVERLOAD_RETRY_DELAY_MS / 1000} seconds (${retryStr})...`\n );\n await pauseStart(CLUSTER_OVERLOAD_RETRY_DELAY_MS, options.signal);\n } else {\n console.warn(`Failed to start session: retrying (${retryStr})`);\n }\n }\n }\n if (!sessionData) {\n throw new Error('Failed to start session: empty response');\n }\n\n this.sessionId = sessionData.session_id;\n this.isActive = true;\n this.response = sessionData;\n this.cookiesLoaded = false;\n this.cookieLoadPromise = undefined;\n this.authenticationReady = false;\n // `forSession` clones a storage already bound to another session, so one\n // RemoteFileStorage reused across sessions never points at the wrong one.\n this.fileStorage = this.fileStorage?.forSession(sessionData.session_id);\n\n // The remote browser exists from here on: if any post-start step fails,\n // stop it before rethrowing so a bad cookie file cannot leak a session.\n try {\n options.signal?.throwIfAborted();\n if (!fitsDeadline(0)) throw new NotteTimeoutError(`Session start timed out after ${timeoutMs}ms`);\n if (shouldWait) await this.waitForAuth(options);\n if (this.openViewer) {\n this.openViewerInBrowser();\n }\n if (this.response?.status === 'active') await this.loadInitialCookies();\n } catch (error) {\n try {\n await this.stop('error');\n } catch (stopError) {\n console.error(`[Session] Failed to stop ${sessionData.session_id} after a start failure: ${String(stopError)}`);\n }\n throw error;\n }\n }\n\n /**\n * Wait for this session to become usable without creating a session or submitting another login.\n * A standalone wait leaves session ownership with the caller, including on timeout or cancellation.\n */\n async waitForAuth(options: AuthWaitOptions = {}): Promise<void> {\n options.signal?.throwIfAborted();\n if (!this.response) throw new Error('Session has not started');\n if (this.response.status === 'active') {\n await this.loadInitialCookies();\n return;\n }\n const sessionId = this.lastSessionId();\n this.response = await pollAuth(async signal => {\n const response = await sessionAuthReadiness({\n client: this.client.getClient(), path: { session_id: sessionId },\n headers: { [TIMEOUT_HEADER]: '10000' }, signal, throwOnError: true,\n });\n let result: typeof response.data | SessionResponse = response.data;\n if (result.status === 'active') {\n this.authenticationReady = true;\n result = (await sessionStatus({\n client: this.client.getClient(), path: { session_id: sessionId },\n headers: { [TIMEOUT_HEADER]: '10000' }, signal, throwOnError: true,\n })).data;\n this.authenticationReady = result.status === 'active';\n if (this.authenticationReady) return result as SessionResponse;\n }\n if (result.status !== 'authenticating') throw new ManagedAuthError(result.error || 'Session authentication failed');\n return undefined;\n }, options);\n await this.loadInitialCookies();\n }\n\n private async loadInitialCookies(): Promise<void> {\n if (this.cookiesLoaded || this.cookieFile === undefined) return;\n if (!this.cookieLoadPromise) {\n const cookieFile = this.cookieFile;\n this.cookieLoadPromise = (async () => {\n if (existsSync(cookieFile)) {\n console.info(`🍪 Automatically loading cookies from ${cookieFile}`);\n await this.setCookiesFromFile(cookieFile);\n } else {\n console.warn(`🍪 Cookie file ${cookieFile} not found, skipping cookie loading`);\n }\n this.cookiesLoaded = true;\n })();\n }\n const pending = this.cookieLoadPromise;\n try {\n await pending;\n } finally {\n if (this.cookieLoadPromise === pending) this.cookieLoadPromise = undefined;\n }\n }\n\n /**\n * Stop the session and clean up resources (including any Playwright\n * connection opened with `page()`). When a `cookie_file` was given, the\n * session cookies are appended to it first. A session the API reports as\n * already stopped is tolerated with a warning.\n *\n * @example\n * await session.stop();\n */\n async stop(closeReason: SessionCloseReason = 'manual'): Promise<void> {\n if (!this.isActive || !this.sessionId) {\n return;\n }\n const sessionId = this.sessionId;\n await this.closePlaywright();\n\n if (this.cookieFile !== undefined && (this.authenticationReady || this.response?.status === 'active')) {\n try {\n const cookies = await this.getCookies();\n await createOrAppendCookiesToFile(this.cookieFile, cookies);\n } catch (error) {\n console.error(`🍪 Error saving cookies to ${this.cookieFile}: ${String(error)}`);\n }\n }\n\n try {\n const response = await sessionStop({\n client: this.client.getClient(),\n path: { session_id: sessionId },\n query: { close_reason: closeReason },\n throwOnError: true,\n });\n if (response.data.status !== 'closed') {\n throw new Error(`[Session] ${sessionId} failed to stop`);\n }\n this.response = response.data;\n } catch (error) {\n const message = (error instanceof Error ? error.message : String(error)).toLowerCase();\n if (message.includes('already stopped') || message.includes('already closed')) {\n console.warn(`Session ${sessionId} was already stopped`);\n } else {\n throw error;\n }\n }\n this.isActive = false;\n this.sessionId = null;\n }\n\n private async closePlaywright(): Promise<void> {\n const browser = this.playwrightBrowser;\n this.playwrightBrowser = null;\n this.playwrightPage = null;\n if (browser) {\n try {\n await browser.close();\n } catch (error) {\n console.warn(`[Session] Failed to close the Playwright connection: ${String(error)}`);\n }\n }\n }\n\n /**\n * Get the current status of the session. Like Python, this keeps working\n * after `stop()` (for example to read the recorded `steps`).\n *\n * @returns Current session metadata, including lifecycle status and recorded steps. Works after `stop()`.\n * @throws Error if this session has never been started.\n * @throws NotteAPIError if the status request fails.\n * @example\n * const status = await session.status();\n * console.log(status.status); // 'active'\n */\n async status(): Promise<SessionResponse> {\n const response = await sessionStatus({\n client: this.client.getClient(),\n path: { session_id: this.lastSessionId() },\n throwOnError: true,\n });\n return response.data;\n }\n\n /** Session ID while the session is active, `null` otherwise. */\n getId(): string | null {\n return this.sessionId;\n }\n\n /** Whether the session has been started and not stopped yet. */\n isSessionActive(): boolean {\n return this.isActive;\n }\n\n /** The last `SessionResponse` received from the API (start, stop or status). */\n getResponse(): SessionResponse | null {\n return this.response;\n }\n\n /** The file storage attached to the session, when one was given. */\n get storage(): RemoteFileStorage | undefined {\n return this.fileStorage;\n }\n\n private requireSessionId(): string {\n if (!this.sessionId) {\n throw new Error('Session not started');\n }\n return this.sessionId;\n }\n\n /** Session ID of the active session, or of the last one when it was stopped. */\n private lastSessionId(): string {\n const sessionId = this.sessionId ?? this.response?.session_id;\n if (!sessionId) {\n throw new Error('Session not started');\n }\n return sessionId;\n }\n\n /**\n * Open the live viewer for this session in the local default browser.\n * @throws If the session has not started or no viewer URL is available.\n */\n viewer(): void {\n this.requireSessionId();\n const viewerUrl = this.response?.viewer_url;\n if (!viewerUrl) {\n throw new Error('No viewer URL available for this session');\n }\n openBrowser(viewerUrl);\n }\n\n private openViewerInBrowser(): void {\n const viewerUrl = this.response?.viewer_url;\n if (!viewerUrl) {\n console.warn('[Session] No viewer URL available; session started without opening a viewer.');\n return;\n }\n openBrowser(viewerUrl);\n }\n\n /**\n * Get presigned URLs for the session replay. Recordings are finalized after\n * the session is closed, so by default this polls on 404 until the replay is\n * ready. It keeps working after `stop()`.\n *\n * Throws an `Error` when the API reports the session is still active and a\n * `NotteTimeoutError` when the replay is not ready within `timeoutMs`.\n * @example\n * await session.stop();\n * const replay = await session.replay();\n * console.log(replay.mp4_url);\n */\n async replay(options: ReplayOptions = {}): Promise<ReplayResponse> {\n const { wait = true, timeoutMs = 240_000, pollIntervalMs = 5_000 } = options;\n const sessionId = this.lastSessionId();\n const request = async (): Promise<ReplayResponse> => {\n const response = await sessionReplay({\n client: this.client.getClient(),\n path: { session_id: sessionId },\n throwOnError: true,\n });\n if (!response.data) {\n throw new Error('Failed to get session replay: empty response');\n }\n return response.data;\n };\n if (!wait) {\n return request();\n }\n\n const deadline = Date.now() + timeoutMs;\n for (;;) {\n try {\n return await request();\n } catch (error) {\n if (!(error instanceof NotteAPIError) || error.statusCode !== 404) {\n throw error;\n }\n // Stop can complete before the replay service observes the closure.\n // Only reject immediately while this client still considers it active.\n if (this.isActive && (error.apiMessage ?? '').includes('still active')) {\n throw new Error(`Session ${sessionId} is still active — close the session first to generate the replay.`, {\n cause: error,\n });\n }\n if (Date.now() + pollIntervalMs > deadline) {\n throw new NotteTimeoutError(`Replay for session ${sessionId} not ready within ${timeoutMs}ms`, { cause: error });\n }\n await sleep(pollIntervalMs);\n }\n }\n }\n\n /**\n * Download the MP4 replay to a local file, like `ReplayResponse.download()`\n * in Python. Resolves with the absolute path of the written file and throws\n * when the replay has no `mp4_url`.\n *\n * @example\n * await session.stop();\n * const file = await session.downloadReplay('session.mp4');\n */\n async downloadReplay(path = 'replay.mp4', options: ReplayOptions = {}): Promise<string> {\n const replay = await this.replay(options);\n if (!replay.mp4_url) {\n throw new Error('No mp4_url available for download');\n }\n const response = await fetch(replay.mp4_url);\n if (!response.ok) {\n throw new Error(`Failed to download replay: HTTP ${response.status}`);\n }\n const target = resolve(path);\n await writeFile(target, new Uint8Array(await response.arrayBuffer()));\n return target;\n }\n\n // #######################################################################\n // ############################# Cookies #################################\n // #######################################################################\n\n /**\n * Upload cookies to the session.\n *\n * @example\n * await session.setCookies([{ name: 'token', value: 'abc', domain: 'example.com', path: '/', httpOnly: false }]);\n */\n async setCookies(cookies: Cookie[]): Promise<ExecutionResponse> {\n const response = await sessionCookiesSet({\n client: this.client.getClient(),\n path: { session_id: this.requireSessionId() },\n body: { cookies },\n throwOnError: true,\n });\n return response.data;\n }\n\n /**\n * Upload cookies from a JSON file (a list of cookies, like `getCookies()` returns).\n *\n * @example\n * await session.setCookiesFromFile('cookies.json');\n */\n async setCookiesFromFile(cookieFile: string): Promise<ExecutionResponse> {\n return this.setCookies(await readCookiesFile(cookieFile));\n }\n\n /**\n * Get the cookies of the session.\n *\n * @example\n * const cookies = await session.getCookies();\n * await fs.writeFile('cookies.json', JSON.stringify(cookies));\n */\n async getCookies(): Promise<Cookie[]> {\n const response = await sessionCookiesGet({\n client: this.client.getClient(),\n path: { session_id: this.requireSessionId() },\n throwOnError: true,\n });\n return response.data.cookies;\n }\n\n // #######################################################################\n // ############################# Profiles ################################\n // #######################################################################\n\n /**\n * Save the session's current browser state (cookies, localStorage, sessionStorage) into a\n * profile, without stopping the session.\n *\n * Pass `profile_id` to overwrite an existing profile or `name` to create a new one. With\n * neither, the state is saved into the profile the session was started with. The session's\n * start-time profile settings are not changed, so a session started with `persist: true`\n * still saves again when it stops.\n *\n * See [Browser Profiles](/features/sessions/browser-profiles) for the tested Python and TypeScript example.\n */\n async saveProfile(options: SaveProfileOptions = {}): Promise<ProfileResponse> {\n const { profile_id, name } = options;\n if (profile_id !== undefined && name !== undefined) {\n throw new Error('profile_id and name are mutually exclusive');\n }\n if (profile_id !== undefined && profile_id.trim() === '') {\n throw new Error('profile_id must not be empty');\n }\n if (name !== undefined && name.trim() === '') {\n throw new Error('name must not be empty');\n }\n const body: { profile_id?: string; name?: string } = {};\n if (profile_id !== undefined) body.profile_id = profile_id;\n if (name !== undefined) body.name = name;\n const response = await sessionProfileSave({\n client: this.client.getClient(),\n path: { session_id: this.requireSessionId() },\n body,\n throwOnError: true,\n });\n return response.data;\n }\n\n // #######################################################################\n // ############################# Debug / CDP #############################\n // #######################################################################\n\n /** Detailed debug information for the session (debug URL, websocket URLs, tabs). */\n async debugInfo(): Promise<SessionDebugResponse> {\n const response = await sessionDebugInfo({\n client: this.client.getClient(),\n path: { session_id: this.requireSessionId() },\n throwOnError: true,\n });\n return response.data;\n }\n\n /**\n * Debug information for one tab of the session. The API client has no\n * dedicated tab endpoint, so this reads the tab from `debugInfo().tabs`.\n */\n async debugTabInfo(tabIdx = 0): Promise<TabSessionDebugResponse> {\n const debug = await this.debugInfo();\n const tab = debug.tabs[tabIdx];\n if (!tab) {\n throw new Error(`Tab ${tabIdx} not found: the session has ${debug.tabs.length} tab(s)`);\n }\n return tab;\n }\n\n /**\n * Get the Chrome DevTools Protocol WebSocket URL for the session.\n *\n * A `cdp_url` given at construction (another browser provider) is returned\n * untouched. Notte-served URLs, from the start response or the debug info,\n * carry the database preview branch when one is configured.\n *\n * @returns The CDP WebSocket URL for connecting a browser automation client.\n * @throws Error if no session ID or CDP URL is available.\n * @example\n * const browser = await chromium.connectOverCDP(await session.cdpUrl());\n */\n async cdpUrl(): Promise<string> {\n if (!this.response) {\n throw new Error('Session not started');\n }\n if (this.options.cdp_url) {\n // cdp url from another session provider. It is handed to us by the\n // caller and served by someone else, so it gets no preview selector.\n return this.options.cdp_url;\n }\n // The remaining urls are websocket endpoints on our own API, which reads\n // the preview branch from the query string. Without it the handshake is\n // served from the default database and rejects a preview-branch session.\n if (this.response.cdp_url) {\n return this.client.withDbPreview(this.response.cdp_url);\n }\n const debug = await this.debugInfo();\n return this.client.withDbPreview(debug.ws.cdp);\n }\n\n /**\n * Get a Playwright page connected to the session via CDP. The connection is\n * established lazily on first access, cached, and closed by `stop()`.\n * Native dialogs are left to the Notte backend.\n *\n * Requires the optional `playwright-core` peer dependency\n * (`npm install playwright-core`).\n *\n * @example\n * const page = await session.page();\n * await page.goto('https://www.google.com');\n * await page.screenshot({ path: 'screenshot.png' });\n */\n async page(): Promise<Page> {\n if (this.playwrightPage) {\n return this.playwrightPage;\n }\n let playwright: typeof import('playwright-core');\n try {\n playwright = await import('playwright-core');\n } catch (error) {\n throw new Error('Playwright not installed. Run `npm install playwright-core` to use `session.page()`.', {\n cause: error,\n });\n }\n try {\n if (!this.playwrightBrowser) {\n const cdpUrl = await this.cdpUrl();\n // Identify the SDK to Notte's CDP endpoint, as every API call does; a caller's\n // own browser (`cdp_url` option) gets nothing extra.\n this.playwrightBrowser = this.options.cdp_url\n ? await playwright.chromium.connectOverCDP(cdpUrl)\n : await playwright.chromium.connectOverCDP(cdpUrl, {\n headers: { 'x-notte-request-origin': REQUEST_ORIGIN, 'x-notte-sdk-version': SDK_VERSION },\n });\n installServerOwnedDialogPolicy(this.playwrightBrowser);\n }\n const page = this.playwrightBrowser.contexts()[0]?.pages()[0];\n if (!page) {\n throw new Error('the browser has no open page');\n }\n this.playwrightPage = page;\n return page;\n } catch (error) {\n throw new Error(`Failed to access the playwright page from CDP: ${error instanceof Error ? error.message : String(error)}`, {\n cause: error,\n });\n }\n }\n\n /**\n * Get the workflow code generated from the session steps\n * (`GET /sessions/{id}/workflow/code`).\n *\n * @example\n * const { python_script } = await session.getScript();\n */\n async getScript(options: SessionScriptOptions = {}): Promise<AgentFunctionCodeResponse> {\n const { as_workflow = true, infer_response_format } = options;\n const response = await getSessionScript({\n client: this.client.getClient(),\n path: { session_id: this.lastSessionId() },\n query: { as_workflow, ...(infer_response_format === undefined ? {} : { infer_response_format }) },\n throwOnError: true,\n });\n return response.data;\n }\n\n // #######################################################################\n // ############################# Page ####################################\n // #######################################################################\n\n /**\n * Execute an action on the current page.\n *\n * When the action fails and `raiseOnFailure` is true (the default, see the\n * session option), the structured `exception_detail` returned by the API is\n * rehydrated into an `ActionExecutionError` whose `errorType` names the\n * server-side error class. `captcha_solve` actions get a 100 s request\n * timeout and are retried up to 3 times on HTTP 408.\n *\n * @param action - Action type, target, and action-specific arguments.\n * @param options - Override failure handling for this call; otherwise use the session setting.\n * @returns The execution response, including `success` and failure details when throwing is disabled.\n * @throws ActionExecutionError if the action fails and failure throwing is enabled.\n * @throws NotteAPIError if the API request fails.\n * @example\n * import { actions } from 'notte-sdk';\n *\n * await session.execute({ type: 'goto', url: 'https://www.notte.cc' });\n * await session.execute(actions.fill({ selector: \"input[name='email']\", value: 'user@example.com' }));\n * const result = await session.execute({ type: 'click', id: 'B1' }, { raiseOnFailure: false });\n * if (!result.success) console.log(result.message);\n */\n async execute(action: ExecuteAction, options: boolean | ExecuteOptions = {}): Promise<CaptchaExecutionResponse> {\n const sessionId = this.requireSessionId();\n const raiseOnFailure =\n typeof options === 'boolean' ? options : (options.raiseOnFailure ?? this.defaultRaiseOnFailure);\n const result = await executeWithCaptcha(action, this.client.getConfig().captchaTimeoutSeconds ?? 180,\n async (requestAction, params, timeoutMs) => {\n const query: typeof params & NonNullable<PageExecuteData['query']> = params;\n const response = await pageExecute({\n client: this.client.getClient(), path: { session_id: sessionId }, body: requestAction,\n query, headers: timeoutMs === undefined ? undefined : { [TIMEOUT_HEADER]: String(timeoutMs) },\n throwOnError: true,\n });\n return response.data;\n });\n\n // Gate on \"did the action fail\", not \"did something throw\", to mirror the local session.\n if (raiseOnFailure && !result.success) {\n console.error(`🚨 Execution failed with message: '${result.message}'`);\n if (result.exception_detail) {\n // The structured wire payload carries the concrete error type, messages and flags.\n throw new ActionExecutionError(result.exception_detail);\n }\n // An API build that predates `exception_detail` may report a failure without\n // an exception; the message is all the caller has to go on.\n const fallbackMessage = String(result.message ?? '').trim() || `Failed to execute action: ${action.type}`;\n throw ActionExecutionError.fromMessage(fallbackMessage);\n }\n return result;\n }\n\n /**\n * Evaluate JavaScript on the current page and return its result as a string.\n *\n * The result is stringified the way `evaluate_js` records it: objects and\n * arrays as JSON, a JS `null` as the string `\"null\"`. On failure the typed\n * `ActionExecutionError` is thrown with the actual JavaScript error; pass\n * `raiseOnFailure: false` to get the execution result envelope instead.\n *\n * @example\n * const title = await session.evaluateJs('document.title');\n * const payload = JSON.parse(await session.evaluateJs('(async () => JSON.stringify(await (await fetch(\"/api\")).json()))()'));\n */\n async evaluateJs(code: string, options?: { raiseOnFailure?: true }): Promise<string>;\n async evaluateJs(code: string, options: { raiseOnFailure: false }): Promise<ApiExecutionResponse>;\n async evaluateJs(code: string, options: ExecuteOptions = {}): Promise<string | ApiExecutionResponse> {\n const raiseOnFailure = options.raiseOnFailure ?? true;\n const result = await this.execute({ type: 'evaluate_js', code }, { raiseOnFailure });\n if (!raiseOnFailure) {\n return result;\n }\n if (!result.data) {\n // an API build that predates the eval-js fix reports success without data\n throw new EvaluateJsNoDataError();\n }\n return result.data.markdown;\n }\n\n /**\n * Issue an HTTP request from the page the session is on and return the response.\n *\n * The request runs inside the browser through `fetch()`, so it carries the\n * page's cookies, the session's proxy and the browser's own network\n * fingerprint. A relative `url` resolves against the current page, which\n * also makes it same-origin; a cross-origin URL is subject to CORS exactly\n * as in a browser tab, so `goto` the target origin first. Redirects are\n * followed and the final URL is on `response.url`. A non-2xx status is\n * returned, not thrown; `response.raiseForStatus()` throws `PageFetchHTTPError`.\n *\n * `json` is serialised as the body with an `application/json` content type,\n * `data` as a form body when it is an object or verbatim when it is a string.\n *\n * @param url - Absolute URL or a path relative to the current page.\n * @param options - HTTP method, headers, and request body settings.\n * @returns A response with status, headers, and body readers. Non-2xx responses are not automatically thrown.\n * @throws ActionExecutionError if browser-side execution fails.\n * @example\n * await session.execute({ type: 'goto', url: 'https://en.wikipedia.org/wiki/Main_Page' });\n * const summary = await (await session.fetch('/api/rest_v1/page/summary/Main_Page')).json();\n */\n async fetch(url: string, options: PageFetchOptions = {}): Promise<PageFetchResponse> {\n const script = buildFetchScript(url, options);\n return responseFromEvaluated(await this.evaluateJs(script));\n }\n\n /**\n * Observe the current page: the list of actions that can be taken, a\n * screenshot and page metadata.\n *\n * The `perception_type` defaults to the session option (`fast`). A bare\n * string argument is accepted as the perception type.\n *\n * Deprecated: `perception_type: 'deep'` and `instructions` are removed on\n * December 1, 2026, and each warns once per session. Use `perception_type:\n * 'fast'` (the default) instead of `'deep'`. For `instructions`:\n * `<<ALTERNATIVE FOR instructions: session.act() — pending>>`. See https://docs.notte.cc/features/sessions/observe-migration\n *\n * @param options - Observation settings, including an optional URL, or a perception-mode string.\n * @returns Structured page analysis, available actions, and page metadata.\n * @throws NotteAPIError if observation fails.\n * @example\n * const obs = await session.observe();\n * console.log(obs.space.description);\n * const firstActions = await session.observe({ max_nb_actions: 50 });\n */\n async observe(options: ObserveRequest | PerceptionType = {}): Promise<Observation> {\n const body: ObserveRequest = typeof options === 'string' ? { perception_type: options } : { ...options };\n if (body.perception_type == null) {\n body.perception_type = this.defaultPerceptionType;\n }\n if (body.instructions != null) {\n this.warnObserveDeprecation('instructions');\n }\n if (body.perception_type !== 'fast') {\n this.warnObserveDeprecation('deep');\n }\n const response = await pageObserve({\n client: this.client.getClient(),\n path: { session_id: this.requireSessionId() },\n body,\n throwOnError: true,\n });\n return response.data;\n }\n\n private warnObserveDeprecation(option: keyof typeof OBSERVE_DEPRECATIONS): void {\n if (!this.warnedObserveDeprecations.has(option)) {\n this.warnedObserveDeprecations.add(option);\n console.warn(OBSERVE_DEPRECATIONS[option]);\n }\n }\n\n /**\n * Scrape the current page.\n *\n * With `response_format` or `instructions`, the extracted data is returned\n * directly and a failed extraction throws `ScrapeFailedError`. Pass\n * `raiseOnFailure: false` to receive the `StructuredData` wrapper instead.\n * @example\n * const markdown = await session.scrape({ only_main_content: true });\n * const product = await session.scrape({ response_format: Product, instructions: 'Extract the product' });\n * const result = await session.scrape({ response_format: Product, raiseOnFailure: false });\n * if (result.success) console.log(result.data);\n */\n async scrape(options?: SessionScrapeOptions<unknown> & { response_format?: undefined; instructions?: undefined | null }): Promise<string>;\n async scrape<T>(options: SessionScrapeOptions<T> & { response_format: ZodLikeSchema<T>; raiseOnFailure?: true }): Promise<T>;\n async scrape<T>(options: SessionScrapeOptions<T> & { response_format: ZodLikeSchema<T>; raiseOnFailure: false }): Promise<StructuredData<T>>;\n async scrape(options: SessionScrapeOptions<unknown>): Promise<ScrapeResult<unknown>>;\n async scrape<T = unknown>(options: SessionScrapeOptions<T> = {}): Promise<ScrapeResult<T>> {\n const sessionId = this.requireSessionId();\n const body = await buildScrapeBody(options);\n const response = await pageScrape({\n client: this.client.getClient(),\n path: { session_id: sessionId },\n body: body as ScrapeRequest,\n throwOnError: true,\n });\n return processScrapeResponse<T>(response.data, options);\n }\n\n // #######################################################################\n // ############################# Lifecycle ###############################\n // #######################################################################\n\n /**\n * Context manager pattern: start the session, run the callback and stop the\n * session, with close reason `error` when the callback throws.\n *\n * Always waits for Managed Auth readiness before invoking the callback.\n *\n * @param callback - Async work to perform with the ready session.\n * @param options - Controls the Managed Auth readiness wait, including timeout and cancellation.\n * @returns The callback's return value after session cleanup has been attempted.\n * @throws Error if startup fails, the callback throws, or cleanup fails after a successful callback.\n * @example\n * await client.Session().use(async session => {\n * await session.execute({ type: 'goto', url: 'https://www.notte.cc' });\n * });\n */\n async use<T>(callback: (session: Session) => Promise<T>, options: AuthWaitOptions = {}): Promise<T> {\n await this.start({ ...options, wait_for_authentication: true });\n let callbackFailed = false;\n try {\n return await callback(this);\n } catch (error) {\n callbackFailed = true;\n console.warn(`Session exiting because of exception: ${String(error)}`);\n throw error;\n } finally {\n try {\n await this.stop(callbackFailed ? 'error' : 'manual');\n } catch (stopError) {\n if (!callbackFailed) {\n throw stopError;\n }\n console.error('[Session] Failed to stop session after callback error:', stopError);\n }\n }\n }\n\n /**\n * Async iterator pattern for session lifecycle management.\n *\n * ```ts\n * for await (const session of client.Session()) {\n * await session.execute({ type: 'goto', url: 'https://www.notte.cc' });\n * }\n * ```\n */\n async *[Symbol.asyncIterator]() {\n await this.start();\n try {\n yield this;\n } finally {\n await this.stop();\n }\n }\n}\n\n/** Wait between `start()` attempts; the caller's signal interrupts the wait. */\nasync function pauseStart(ms: number, signal: AbortSignal | undefined): Promise<void> {\n if (!signal) {\n await sleep(ms);\n return;\n }\n try {\n await delay(ms, undefined, { signal });\n } catch (error) {\n signal.throwIfAborted();\n throw error;\n }\n}\n","import type { ApiExecutionResponse, CaptchaStatus } from '@/lib/client/types.gen';\nimport type { ExecuteAction } from '@/actions';\nimport { NotteAPIError, NotteTimeoutError, sleep } from '@/errors';\n\nexport type { CaptchaStatus } from '@/lib/client/types.gen';\n\n/** Execution envelope with the backend's additive CAPTCHA coordination fields. */\nexport type CaptchaExecutionResponse = ApiExecutionResponse & {\n captcha?: CaptchaStatus | null;\n action_executed?: boolean | null;\n code?: string | null;\n};\n\nexport interface CaptchaExecuteParams {\n captcha_timeout_seconds: number;\n captcha_id?: string;\n target_page_id?: string;\n target_generation?: number;\n}\n\n/** Poll background work; only an explicit unexecuted response permits action resubmission. */\nexport async function executeWithCaptcha(\n action: ExecuteAction,\n budgetSeconds: number,\n request: (action: ExecuteAction, params: CaptchaExecuteParams, timeoutMs?: number) => Promise<CaptchaExecutionResponse>,\n): Promise<CaptchaExecutionResponse> {\n const explicit = action.type === 'captcha_solve';\n let deadline = explicit ? performance.now() + budgetSeconds * 1000 : undefined;\n let params: CaptchaExecuteParams = { captcha_timeout_seconds: budgetSeconds };\n let requestAction = action;\n let original: CaptchaExecutionResponse | undefined;\n let last: CaptchaExecutionResponse | undefined;\n const remaining = () => deadline === undefined ? budgetSeconds : (deadline - performance.now()) / 1000;\n const pause = (ms = 1000) => sleep(Math.max(0, Math.min(ms, remaining() * 1000)));\n const failure = (message: string, code: string): CaptchaExecutionResponse => ({\n started_at: new Date().toISOString(), ended_at: new Date().toISOString(),\n ...(original ?? last), action, success: false, message, code,\n exception: message, exception_detail: null, captcha: last?.captcha,\n });\n while (true) {\n const left = remaining();\n if (left <= 0) return failure('CAPTCHA wait deadline exceeded', 'captcha_timeout');\n params.captcha_timeout_seconds = left;\n const polling = requestAction.type === 'captcha_solve';\n let result: CaptchaExecutionResponse;\n try {\n result = await request(requestAction, { ...params }, polling ? Math.min(10_000, left * 1000) : undefined);\n } catch (error) {\n const transport = error instanceof NotteTimeoutError || error instanceof TypeError || error instanceof SyntaxError;\n const transient = params.captcha_id !== undefined && error instanceof NotteAPIError &&\n [408, 429, 502, 503, 504].includes(error.statusCode);\n if (!polling || params.captcha_id === undefined || (!transport && !transient)) throw error;\n await pause();\n continue;\n }\n last = result;\n const status = result.captcha;\n if (!status) {\n return params.captcha_id ? failure('Server omitted CAPTCHA polling status', 'captcha_protocol_error') : result;\n }\n if (params.captcha_id && status.captcha_id !== params.captcha_id) {\n return failure('Server returned a different CAPTCHA solve', 'captcha_protocol_error');\n }\n deadline ??= performance.now() + budgetSeconds * 1000;\n if (!original && !explicit && result.action_executed === true) original = result;\n if (status.state === 'cancelled' && status.cancel_reason === 'navigation' && original) {\n // Preserve the executed action, without claiming the old CAPTCHA solved or replaying input.\n return { ...original, captcha: status };\n }\n if (status.state === 'cancelled' && status.cancel_reason === 'navigation' &&\n action.type === 'wait' && result.action_executed === false) {\n // A passive wait can check the new document; targeted actions cannot.\n // Drop the old solve/page guards while retaining the original deadline.\n // The CAPTCHA budget does not shorten the action's requested wait duration.\n params = { captcha_timeout_seconds: remaining() };\n requestAction = action;\n await pause();\n continue;\n }\n if (status.state === 'failed' || status.state === 'cancelled') {\n return failure(status.message || `CAPTCHA ${status.state}`, `captcha_${status.state}`);\n }\n if (status.state === 'solved') {\n if (explicit) return result;\n if (original) return { ...original, captcha: status };\n if (!params.captcha_id && result.action_executed !== false) return result;\n params = {\n captcha_timeout_seconds: remaining(), target_page_id: status.page_id, target_generation: status.generation,\n };\n requestAction = action;\n continue;\n }\n if (!explicit && !original && !params.captcha_id && result.action_executed !== false) {\n return failure('Server did not confirm whether the action executed', 'captcha_execution_unknown');\n }\n params.captcha_id = status.captcha_id;\n requestAction = { type: 'captcha_solve' };\n await pause(Math.min(1000, Math.max(100, status.retry_after_ms ?? 1000)));\n }\n}\n","/**\n * Issue an HTTP request from the page a session is on, the port of\n * `notte_core.fetch`.\n *\n * `session.fetch()` runs the browser's own `fetch()` inside the current page, so\n * the request carries the page's cookies, the session's proxy and the browser's\n * network fingerprint. This module builds the script and reads the result back\n * into a `PageFetchResponse`.\n */\nimport { FetchResponseDecodeError, InvalidRequestError, NotteError } from '@/errors';\n\n/** A form body (`Record`) or a raw string body. */\nexport type FetchData = string | Record<string, unknown>;\n\nexport interface PageFetchOptions {\n /** HTTP method. Defaults to `GET`. */\n method?: string;\n /** Request headers. */\n headers?: Record<string, string>;\n /** Query parameters appended to the URL (before any fragment). Arrays repeat the key. */\n params?: Record<string, unknown>;\n /** JSON body, sent with `Content-Type: application/json` unless a content type is given. */\n json?: unknown;\n /** Form body (`Record`, sent url-encoded) or a raw string body sent verbatim. */\n data?: FetchData;\n /** Abort the request after this many milliseconds. Must be positive. */\n timeoutMs?: number;\n /**\n * Allow `http:` URLs and follow redirects. Off by default because the request\n * carries the page's cookies: an `https:` request redirected to `http:` would\n * send them in cleartext before the response can be inspected, so by default\n * redirects are not followed and a redirected response throws.\n */\n allowInsecure?: boolean;\n /**\n * Browser `fetch` redirect mode. Defaults to `manual` (a redirect throws)\n * unless `allowInsecure` is set, in which case redirects are followed like\n * the Python SDK does.\n */\n redirect?: 'follow' | 'manual' | 'error';\n}\n\nconst CONTENT_TYPE = 'content-type';\n\nfunction hasHeader(headers: Record<string, string>, name: string): boolean {\n return Object.keys(headers).some(key => key.toLowerCase() === name);\n}\n\n/** `urlencode(mapping, doseq=True)`: array values repeat the key. */\nfunction urlencode(mapping: Record<string, unknown>): string {\n const search = new URLSearchParams();\n for (const [key, value] of Object.entries(mapping)) {\n if (Array.isArray(value)) {\n for (const item of value) search.append(key, String(item));\n } else {\n search.append(key, String(value));\n }\n }\n return search.toString();\n}\n\n/** Insert `params` into the query string, before any `#fragment`. */\nfunction withParams(url: string, params: Record<string, unknown>): string {\n const hashIndex = url.indexOf('#');\n const fragment = hashIndex >= 0 ? url.slice(hashIndex) : '';\n const base = hashIndex >= 0 ? url.slice(0, hashIndex) : url;\n const queryIndex = base.indexOf('?');\n const path = queryIndex >= 0 ? base.slice(0, queryIndex) : base;\n const existing = queryIndex >= 0 ? base.slice(queryIndex + 1) : '';\n let query = urlencode(params);\n if (existing) {\n query = `${existing}&${query}`;\n }\n return `${path}?${query}${fragment}`;\n}\n\n/**\n * Return the JavaScript that performs the request and serialises the response.\n *\n * The script is an async IIFE, which `evaluateJs` awaits. It returns a JSON\n * string so the value survives the evaluate round-trip unchanged.\n *\n * ```ts\n * const script = buildFetchScript('/api/items', { params: { page: 2 } });\n * const response = responseFromEvaluated(await session.evaluateJs(script));\n * ```\n */\nexport function buildFetchScript(url: string, options: PageFetchOptions = {}): string {\n const { method = 'GET', headers, params, json, data, timeoutMs, allowInsecure = false } = options;\n const redirect = options.redirect ?? (allowInsecure ? 'follow' : 'manual');\n if (json !== undefined && data !== undefined) {\n throw new InvalidRequestError('pass either json or data, not both');\n }\n if (timeoutMs !== undefined && !(timeoutMs > 0)) {\n throw new InvalidRequestError('timeout must be positive');\n }\n\n let requestUrl = url;\n if (params && Object.keys(params).length > 0) {\n // insert before any fragment: the browser strips `#...` before sending,\n // so parameters appended after it would be silently dropped\n requestUrl = withParams(url, params);\n }\n\n const requestHeaders: Record<string, string> = { ...(headers ?? {}) };\n let body: string | undefined;\n if (json !== undefined) {\n body = JSON.stringify(json);\n if (!hasHeader(requestHeaders, CONTENT_TYPE)) {\n requestHeaders['Content-Type'] = 'application/json';\n }\n } else if (data !== undefined && typeof data !== 'string') {\n body = urlencode(data);\n if (!hasHeader(requestHeaders, CONTENT_TYPE)) {\n requestHeaders['Content-Type'] = 'application/x-www-form-urlencoded';\n }\n } else if (data !== undefined) {\n body = data;\n }\n\n const init: Record<string, unknown> = {\n method: method.toUpperCase(),\n headers: requestHeaders,\n credentials: 'include',\n redirect,\n };\n if (body !== undefined) {\n if (init.method === 'GET' || init.method === 'HEAD') {\n // browser fetch() rejects these outright, so fail before the round-trip\n throw new InvalidRequestError(`${String(init.method)} requests cannot have a body`);\n }\n init.body = body;\n }\n\n let abort = '';\n if (timeoutMs !== undefined) {\n abort =\n 'const controller = new AbortController();' +\n `setTimeout(() => controller.abort(), ${Math.trunc(timeoutMs)});` +\n 'init.signal = controller.signal;';\n }\n return (\n '(async () => {' +\n `const init = ${JSON.stringify(init)};` +\n `${abort}` +\n // resolve against the page so relative URLs inherit its scheme, then refuse\n // plaintext: `credentials: 'include'` would send non-Secure cookies in clear\n `const target = new URL(${JSON.stringify(requestUrl)}, location.href);` +\n `const allowInsecure = ${allowInsecure ? 'true' : 'false'};` +\n \"if (target.protocol !== 'https:' && !allowInsecure) {\" +\n \" throw new Error('Refusing to fetch ' + target.origin + ' over plaintext; pass allowInsecure: true to override');\" +\n '}' +\n 'const response = await fetch(target.toString(), init);' +\n // with redirect: 'manual' the browser stops at the first redirect and hands\n // back an opaque response, so no cookie has left over a downgraded connection\n \"if (response.type === 'opaqueredirect') {\" +\n \" throw new Error('The request to ' + target.origin + ' was redirected; redirects are not followed because the page cookies could be sent in cleartext. Fetch the final URL directly or pass allowInsecure: true');\" +\n '}' +\n \"if (!allowInsecure && new URL(response.url).protocol !== 'https:') {\" +\n \" throw new Error('Refusing to read a response served over plaintext from ' + new URL(response.url).origin + '; pass allowInsecure: true to override');\" +\n '}' +\n // ship the raw bytes as base64: `response.text()` would decode with\n // replacement and lose any non-UTF-8 or binary body for good\n 'const bytes = new Uint8Array(await response.arrayBuffer());' +\n \"let binary = '';\" +\n 'for (let i = 0; i < bytes.length; i += 0x8000) {' +\n ' binary += String.fromCharCode.apply(null, bytes.subarray(i, i + 0x8000));' +\n '}' +\n 'const headers = {};' +\n 'response.headers.forEach((value, key) => { headers[key] = value; });' +\n 'return JSON.stringify({status: response.status, url: response.url, headers: headers, body_b64: btoa(binary)});' +\n '})()'\n );\n}\n\nconst REASON_PHRASES: Record<number, string> = {\n 100: 'Continue', 101: 'Switching Protocols', 102: 'Processing', 103: 'Early Hints',\n 200: 'OK', 201: 'Created', 202: 'Accepted', 203: 'Non-Authoritative Information', 204: 'No Content',\n 205: 'Reset Content', 206: 'Partial Content', 207: 'Multi-Status', 208: 'Already Reported', 226: 'IM Used',\n 300: 'Multiple Choices', 301: 'Moved Permanently', 302: 'Found', 303: 'See Other', 304: 'Not Modified',\n 305: 'Use Proxy', 307: 'Temporary Redirect', 308: 'Permanent Redirect',\n 400: 'Bad Request', 401: 'Unauthorized', 402: 'Payment Required', 403: 'Forbidden', 404: 'Not Found',\n 405: 'Method Not Allowed', 406: 'Not Acceptable', 407: 'Proxy Authentication Required', 408: 'Request Timeout',\n 409: 'Conflict', 410: 'Gone', 411: 'Length Required', 412: 'Precondition Failed', 413: 'Request Entity Too Large',\n 414: 'Request-URI Too Long', 415: 'Unsupported Media Type', 416: 'Requested Range Not Satisfiable',\n 417: 'Expectation Failed', 418: \"I'm a Teapot\", 421: 'Misdirected Request', 422: 'Unprocessable Entity',\n 423: 'Locked', 424: 'Failed Dependency', 425: 'Too Early', 426: 'Upgrade Required', 428: 'Precondition Required',\n 429: 'Too Many Requests', 431: 'Request Header Fields Too Large', 451: 'Unavailable For Legal Reasons',\n 500: 'Internal Server Error', 501: 'Not Implemented', 502: 'Bad Gateway', 503: 'Service Unavailable',\n 504: 'Gateway Timeout', 505: 'HTTP Version Not Supported', 506: 'Variant Also Negotiates',\n 507: 'Insufficient Storage', 508: 'Loop Detected', 510: 'Not Extended', 511: 'Network Authentication Required',\n};\n\n/** `response.raiseForStatus()` rejected a 4xx/5xx response, like `requests.HTTPError`. */\nexport class PageFetchHTTPError extends NotteError {\n readonly response: PageFetchResponse;\n\n constructor(response: PageFetchResponse) {\n const kind = response.status < 500 ? 'Client Error' : 'Server Error';\n super(`${response.status} ${kind}: ${response.statusText} for url: ${response.url}`);\n this.response = response;\n }\n}\n\n/**\n * The charset the response declares, else `utf-8` when the bytes are valid\n * utf-8. `undefined` means the body is binary or of unknown encoding; `text()`\n * then falls back to a lossy utf-8 decode.\n */\nfunction encodingFor(headers: Record<string, string>, content: Uint8Array): string | undefined {\n const contentType = Object.entries(headers).find(([key]) => key.toLowerCase() === CONTENT_TYPE)?.[1] ?? '';\n for (const param of contentType.split(';').slice(1)) {\n const [name, ...rest] = param.split('=');\n const value = rest.join('=');\n if (name?.trim().toLowerCase() === 'charset' && value) {\n return value.trim().replace(/^[\"']|[\"']$/g, '');\n }\n }\n try {\n new TextDecoder('utf-8', { fatal: true }).decode(content);\n } catch {\n return undefined;\n }\n return 'utf-8';\n}\n\n/**\n * The response of `session.fetch()`, shaped like the Web `Response` with the\n * final `url` after redirects exposed as a plain property. A non-2xx status is\n * a response, not an error; `raiseForStatus()` throws `PageFetchHTTPError`.\n * `bytes()` holds the exact bytes the server sent, so binary bodies survive;\n * `text()` decodes them with the declared charset, or utf-8 when none is given.\n */\nexport class PageFetchResponse {\n readonly status: number;\n readonly statusText: string;\n readonly headers: Headers;\n /** The final URL after redirects. */\n readonly url: string;\n /** The declared charset, `utf-8` when the body is valid utf-8, else `undefined`. */\n readonly encoding: string | undefined;\n private readonly content: Uint8Array;\n\n constructor(init: { status: number; headers: Record<string, string>; url: string; content: Uint8Array }) {\n this.status = init.status;\n this.statusText = REASON_PHRASES[init.status] ?? '';\n this.headers = new Headers(init.headers);\n this.url = init.url;\n this.content = init.content;\n this.encoding = encodingFor(init.headers, init.content);\n }\n\n get ok(): boolean {\n return this.status >= 200 && this.status < 300;\n }\n\n /** The raw body bytes. */\n bytes(): Uint8Array {\n return this.content;\n }\n\n async arrayBuffer(): Promise<ArrayBuffer> {\n return this.content.slice().buffer as ArrayBuffer;\n }\n\n async text(): Promise<string> {\n let decoder: TextDecoder;\n try {\n decoder = new TextDecoder(this.encoding ?? 'utf-8');\n } catch {\n decoder = new TextDecoder('utf-8');\n }\n return decoder.decode(this.content);\n }\n\n async json(): Promise<unknown> {\n return JSON.parse(await this.text()) as unknown;\n }\n\n /** Throw `PageFetchHTTPError` on a 4xx/5xx status, like `requests.Response.raise_for_status()`. */\n raiseForStatus(): this {\n if (this.status >= 400) {\n throw new PageFetchHTTPError(this);\n }\n return this;\n }\n}\n\nconst BASE64_PATTERN = /^[A-Za-z0-9+/]*={0,2}$/;\n\nfunction decodeBase64(value: string): Uint8Array {\n if (!BASE64_PATTERN.test(value) || value.length % 4 !== 0) {\n throw new Error('body_b64 is not valid base64');\n }\n return new Uint8Array(Buffer.from(value, 'base64'));\n}\n\n/**\n * Turn the envelope `buildFetchScript` returns into a `PageFetchResponse`.\n * Throws `FetchResponseDecodeError` when the envelope cannot be read.\n */\nexport function responseFromEvaluated(raw: string): PageFetchResponse {\n let payload: unknown;\n try {\n payload = JSON.parse(raw);\n } catch (error) {\n throw new FetchResponseDecodeError(error instanceof Error ? error.message : String(error));\n }\n if (typeof payload !== 'object' || payload === null || Array.isArray(payload)) {\n throw new FetchResponseDecodeError('envelope is not an object');\n }\n const envelope = payload as Record<string, unknown>;\n try {\n if (!('status' in envelope)) {\n throw new Error(\"'status'\");\n }\n const status = Number(envelope.status);\n if (!Number.isInteger(status)) {\n throw new Error(`invalid status: ${String(envelope.status)}`);\n }\n const rawHeaders = envelope.headers ?? {};\n if (typeof rawHeaders !== 'object' || Array.isArray(rawHeaders)) {\n throw new Error('headers is not an object');\n }\n const headers: Record<string, string> = {};\n for (const [key, value] of Object.entries(rawHeaders as Record<string, unknown>)) {\n headers[String(key)] = String(value);\n }\n const content = decodeBase64(String(envelope.body_b64 ?? ''));\n const url = String(envelope.url ?? '');\n return new PageFetchResponse({ status, headers, url, content });\n } catch (error) {\n throw new FetchResponseDecodeError(error instanceof Error ? error.message : String(error));\n }\n}\n","/**\n * Cookie file helpers, the counterpart of `SetCookiesRequest.from_json` and\n * `notte_core.config.create_or_append_cookies_to_file` in Python.\n */\nimport { readFile, writeFile } from 'node:fs/promises';\nimport { resolve } from 'node:path';\nimport type { Cookie } from '@/lib/client/types.gen';\nimport { InvalidRequestError } from '@/errors';\n\n/** Read a JSON cookie file (a list of cookies, like `session.getCookies()` returns). */\nexport async function readCookiesFile(cookieFile: string): Promise<Cookie[]> {\n const cookies: unknown = JSON.parse(await readFile(cookieFile, 'utf-8'));\n if (!Array.isArray(cookies)) {\n throw new InvalidRequestError(`Cookie file ${cookieFile} must contain a JSON list of cookies`);\n }\n return cookies as Cookie[];\n}\n\n/**\n * Merge `cookies` into the JSON list stored in `cookieFile`, one entry per\n * cookie, creating the file when it does not exist yet.\n *\n * Sessions load the file when they start, so the browser's jar on stop repeats\n * the cookies it loaded: appending them blindly duplicated the whole file on\n * every stop. Merging (rather than overwriting) keeps cookies another session\n * saved to the same file. A cookie is identified by name, domain, path and\n * partition key; the newest value wins.\n */\nexport async function createOrAppendCookiesToFile(cookieFile: string, cookies: Cookie[]): Promise<void> {\n console.info(`🍪 Automatically saving cookies to ${cookieFile}`);\n // Sessions sharing one cookie file (stopped concurrently) must not read the\n // same contents and overwrite each other, so the read-modify-write runs\n // under a per-path lock. The lock is per process; a file shared between\n // processes still needs an external lock.\n await withFileLock(cookieFile, async () => {\n let existing: Cookie[] = [];\n try {\n existing = await readCookiesFile(cookieFile);\n } catch (error) {\n if (!isNotFound(error)) {\n throw error;\n }\n }\n const merged = new Map<string, Cookie>();\n for (const cookie of [...existing, ...cookies]) {\n merged.set(cookieIdentity(cookie), cookie);\n }\n await writeFile(cookieFile, JSON.stringify([...merged.values()]), 'utf-8');\n });\n}\n\nfunction cookieIdentity(cookie: Cookie): string {\n return JSON.stringify([cookie.name, cookie.domain ?? null, cookie.path ?? null, cookie.partitionKey ?? null]);\n}\n\nconst fileLocks = new Map<string, Promise<void>>();\n\n/** Run `fn` after every earlier operation queued for the same resolved path. */\nasync function withFileLock<T>(path: string, fn: () => Promise<T>): Promise<T> {\n const key = resolve(path);\n const previous = fileLocks.get(key) ?? Promise.resolve();\n let release!: () => void;\n const current = new Promise<void>(done => {\n release = done;\n });\n const tail = previous.then(() => current);\n fileLocks.set(key, tail);\n await previous;\n try {\n return await fn();\n } finally {\n release();\n // Evict the entry when nobody queued behind us, so paths used once do not\n // accumulate in long-running processes.\n if (fileLocks.get(key) === tail) {\n fileLocks.delete(key);\n }\n }\n}\n\n/** Test hook: number of cookie files with an in-flight or queued update. */\nexport function pendingCookieFileLocks(): number {\n return fileLocks.size;\n}\n\nfunction isNotFound(error: unknown): boolean {\n return typeof error === 'object' && error !== null && (error as { code?: string }).code === 'ENOENT';\n}\n","/**\n * Helper function to format error messages\n */\nimport { spawn } from 'node:child_process';\n\nfunction formatError(error: unknown): string {\n\tif (typeof error === 'object' && error !== null) {\n\t\t// If the error object has a message property, use it\n\t\tif ('message' in error && typeof error.message === 'string') {\n\t\t\treturn error.message;\n\t\t}\n\t\t// Otherwise, try to stringify the object\n\t\ttry {\n\t\t\treturn JSON.stringify(error, null, 2);\n\t\t} catch {\n\t\t\treturn String(error);\n\t\t}\n\t}\n\tif (error instanceof Error) {\n\t\treturn error.message;\n\t}\n\treturn String(error);\n}\n\nfunction openBrowser(url: string): void {\n\tconst platform = process.platform;\n\tlet command: string;\n\tlet args: string[];\n\n\tif (platform === 'darwin') {\n\t\tcommand = 'open';\n\t\targs = [url];\n\t} else if (platform === 'win32') {\n\t\tcommand = 'rundll32';\n\t\targs = ['url.dll,FileProtocolHandler', url];\n\t} else {\n\t\tcommand = 'xdg-open';\n\t\targs = [url];\n\t}\n\n\tconst child = spawn(command, args, {\n\t\tdetached: true,\n\t\tstdio: 'ignore',\n\t});\n\tchild.on('error', () => {\n\t\t// The viewer is a convenience path; avoid crashing the process if no\n\t\t// local browser opener exists in the current environment.\n\t});\n\tchild.unref();\n}\n\n/** JSON Schema keywords whose value is a single subschema (or a boolean). */\nconst SCHEMA_KEYWORDS = new Set([\n 'items', 'additionalItems', 'additionalProperties', 'contains', 'propertyNames',\n 'not', 'if', 'then', 'else', 'unevaluatedItems', 'unevaluatedProperties',\n]);\n/** Keywords whose value is an array of subschemas. */\nconst SCHEMA_ARRAY_KEYWORDS = new Set(['anyOf', 'oneOf', 'allOf', 'prefixItems']);\n/**\n * Keywords that shape the value of one specific type and are read by the API's\n * converter from the branch carrying that type.\n */\nconst TYPE_SCOPED_KEYWORDS = new Set([\n 'items', 'prefixItems', 'additionalItems', 'contains', 'unevaluatedItems',\n 'properties', 'patternProperties', 'required', 'additionalProperties', 'propertyNames', 'unevaluatedProperties',\n 'format',\n]);\n/** Keywords whose value is a map from name to subschema. */\nconst SCHEMA_MAP_KEYWORDS = new Set(['properties', 'patternProperties', '$defs', 'definitions', 'dependentSchemas']);\n\n/**\n * Normalise a JSON Schema produced by `z.toJSONSchema()` into the shape the\n * Notte API accepts. zod >= 4.6 emits nullable fields as a type array\n * (`{ type: ['string', 'null'] }`); the API's structured-output validator\n * only understands the `anyOf` form zod used to emit, so expand type arrays\n * back into `anyOf` branches.\n *\n * Only schema-bearing keywords are traversed. Instance-valued keywords such as\n * `default`, `examples`, `const` and `enum` hold caller data, not schemas, and\n * are passed through untouched even if they happen to contain a `type` key.\n *\n * When a type array is expanded, the split mirrors how the API's converter\n * (`notte_core.schema.create_model_from_schema`) reads a\n * property: it resolves the Python type by recursing into each `anyOf` branch,\n * so type-scoped keywords (`items`, `properties`, `required`, `format`, ...)\n * move into the matching typed branch, while field constraints and\n * annotations (`minimum`, `minItems`, `enum`, `description`, `default`, ...)\n * are read from the property itself and therefore stay on the parent. A\n * pre-existing `anyOf` is intersected with the allowed types instead of being\n * overwritten.\n */\nfunction normalizeJsonSchema(schema: unknown): unknown {\n if (schema === null || typeof schema !== 'object' || Array.isArray(schema)) return schema;\n const out: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(schema as Record<string, unknown>)) {\n if (SCHEMA_KEYWORDS.has(key) || (key === 'items' && Array.isArray(value))) {\n out[key] = Array.isArray(value) ? value.map(normalizeJsonSchema) : normalizeJsonSchema(value);\n } else if (SCHEMA_ARRAY_KEYWORDS.has(key) && Array.isArray(value)) {\n out[key] = value.map(normalizeJsonSchema);\n } else if (SCHEMA_MAP_KEYWORDS.has(key) && value !== null && typeof value === 'object' && !Array.isArray(value)) {\n out[key] = Object.fromEntries(\n Object.entries(value as Record<string, unknown>).map(([name, sub]) => [name, normalizeJsonSchema(sub)]),\n );\n } else {\n out[key] = value;\n }\n }\n if (Array.isArray(out.type)) {\n const { type, anyOf: existing, ...rest } = out;\n const types = type as string[];\n const parent: Record<string, unknown> = {};\n const scoped: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(rest)) {\n (TYPE_SCOPED_KEYWORDS.has(key) ? scoped : parent)[key] = value;\n }\n const typed = (t: string): Record<string, unknown> => (t === 'null' ? { type: t } : { type: t, ...scoped });\n let branches: Record<string, unknown>[];\n if (Array.isArray(existing)) {\n // Intersect the existing alternatives with the allowed types: typed\n // branches survive only if their type is allowed; untyped branches are\n // expanded once per allowed type, null included, so the result never\n // accepts a value the original rejected (e.g. null when no branch did).\n const seen = new Set<string>();\n branches = [];\n const push = (b: Record<string, unknown>) => {\n const key = JSON.stringify(b);\n if (!seen.has(key)) {\n seen.add(key);\n branches.push(b);\n }\n };\n for (const branch of existing as Record<string, unknown>[]) {\n if (typeof branch.type === 'string') {\n if (types.includes(branch.type)) push(branch.type === 'null' ? branch : { ...scoped, ...branch });\n } else {\n for (const t of types) push({ ...typed(t), ...branch });\n }\n }\n } else {\n branches = types.map(typed);\n }\n return { ...parent, anyOf: branches };\n }\n return out;\n}\n\nexport { formatError, normalizeJsonSchema, openBrowser };\n","/**\n * Shared scrape request/response handling for `client.scrape()` and\n * `session.scrape()`, mirroring `PageClient.scrape` in the Python SDK.\n */\nimport { normalizeJsonSchema } from '@/utils';\nimport type { DataSpace, ScrapeRequest, StructuredDataBaseModel } from '@/lib/client/types.gen';\nimport { ScrapeFailedError } from '@/errors';\n\n/** Minimal structural view of a Zod schema so `zod` stays an optional import path. */\nexport interface ZodLikeSchema<T> {\n parse(data: unknown): T;\n}\n\n/** Structured extraction result when `raiseOnFailure` is false, like `StructuredData` in Python. */\nexport interface StructuredData<T> {\n success: boolean;\n error?: string | null;\n data?: T | null;\n}\n\nexport interface ScrapeOptions<T = unknown> {\n /** A Zod schema or a JSON Schema object describing the data to extract. */\n response_format?: ZodLikeSchema<T> | Record<string, unknown> | null;\n /** JSON Schema to send instead of converting `response_format`. Only used with a Zod schema. */\n json_schema?: Record<string, unknown>;\n /**\n * When true (default) a failed structured extraction throws `ScrapeFailedError`\n * and the extracted data is returned directly. When false the `StructuredData`\n * wrapper is returned so callers can inspect `.success`.\n */\n raiseOnFailure?: boolean;\n}\n\n/** `only_images` is still in the generated request type (the 1.x API accepts it) but image scraping was removed. */\nexport type SessionScrapeOptions<T = unknown> = Omit<ScrapeRequest, 'response_format' | 'only_images'> & ScrapeOptions<T>;\n\nexport type ScrapeResult<T> = string | T | StructuredData<T>;\n\nexport function isZodSchema<T>(value: unknown): value is ZodLikeSchema<T> {\n return typeof value === 'object' && value !== null && typeof (value as ZodLikeSchema<T>).parse === 'function';\n}\n\nexport function requiresSchema(options: { response_format?: unknown; instructions?: string | null }): boolean {\n return Boolean(options.response_format || options.instructions);\n}\n\n/**\n * Build the API request body: strips SDK-only options and replaces a Zod\n * `response_format` with its JSON Schema. `instructions` are sent exactly as\n * given; nothing is inferred from the schema.\n */\nexport async function buildScrapeBody<T>(\n options: SessionScrapeOptions<T>,\n): Promise<Omit<ScrapeRequest, 'response_format'> & { response_format?: unknown }> {\n const { raiseOnFailure: _raise, json_schema, response_format, ...rest } = options;\n const body: Omit<ScrapeRequest, 'response_format'> & { response_format?: unknown } = { ...rest };\n if (isZodSchema(response_format)) {\n if (json_schema) {\n body.response_format = json_schema;\n } else {\n const { z } = await import('zod');\n body.response_format = normalizeJsonSchema(z.toJSONSchema(response_format as never));\n }\n } else if (response_format) {\n body.response_format = response_format;\n }\n return body;\n}\n\n/**\n * Post-process a scrape response according to the request options:\n * - `response_format` / `instructions` return the extracted data (validated by\n * the Zod schema when one was given) or throw `ScrapeFailedError`,\n * - otherwise the markdown string is returned.\n */\nexport function processScrapeResponse<T = unknown>(\n scrapeResponse: DataSpace | undefined,\n options: SessionScrapeOptions<T> & { instructions?: string | null },\n): ScrapeResult<T> {\n if (!scrapeResponse) {\n throw new ScrapeFailedError('empty response');\n }\n const raiseOnFailure = options.raiseOnFailure ?? true;\n\n if (requiresSchema(options)) {\n const structured = scrapeResponse.structured as StructuredDataBaseModel | null | undefined;\n if (!structured) {\n throw new ScrapeFailedError('the API returned no structured data. This should not happen, please report it.');\n }\n const success = structured.success ?? false;\n const schema = isZodSchema<T>(options.response_format) ? options.response_format : undefined;\n\n if (!success) {\n if (raiseOnFailure) {\n throw new ScrapeFailedError(structured.error ?? undefined);\n }\n return { success, error: structured.error ?? null, data: null };\n }\n\n const data = schema && structured.data != null ? schema.parse(structured.data) : (structured.data as T);\n if (raiseOnFailure) {\n return data;\n }\n return { success, error: structured.error ?? null, data };\n }\n\n return scrapeResponse.markdown;\n}\n","/**\n * Automatic retries for transient API failures, shared by every request the\n * client sends. The Python SDK implements the same policy in\n * `notte_sdk/_retry.py`.\n *\n * What is retried:\n * - 503 and 529: the API declined the request before doing any work, so every\n * method is retried.\n * - 502 and 504: a gateway lost or timed out on the upstream response, which\n * may already have been processed. Only idempotent methods (GET, HEAD,\n * OPTIONS, PUT, DELETE) are retried, so a POST such as starting a session\n * or an agent is never sent twice.\n * - Connection failures that happen before the request is sent (connection\n * refused, connect timeout, temporary DNS failure): every method.\n * - Connection resets and socket errors, which can happen after the request\n * was sent: idempotent methods only.\n *\n * Nothing else is retried: 500, other 5xx codes, and 4xx always surface as is.\n */\n\n/** Retries after the first attempt, unless `NotteClientConfig.maxRetries` says otherwise. */\nexport const DEFAULT_MAX_RETRIES = 3;\n/** Backoff before the first retry. Doubles with every retry, capped at `RETRY_MAX_DELAY_MS`. */\nexport const RETRY_BASE_DELAY_MS = 1_000;\nexport const RETRY_MAX_DELAY_MS = 10_000;\n/** A longer `Retry-After` is not waited for: the error is returned instead. */\nexport const RETRY_AFTER_MAX_MS = 20_000;\n\nconst IDEMPOTENT_METHODS = new Set(['GET', 'HEAD', 'OPTIONS', 'PUT', 'DELETE']);\n/** Statuses that guarantee the API did no work. */\nconst REFUSED_STATUSES = new Set([503, 529]);\n/** Gateway statuses: the upstream may already have processed the request. */\nconst GATEWAY_STATUSES = new Set([502, 504]);\n/** The connection was never established, so the request was not sent. */\nconst NOT_SENT_ERROR_CODES = new Set([\n 'ECONNREFUSED',\n 'EAI_AGAIN',\n 'ENETUNREACH',\n 'EHOSTUNREACH',\n 'UND_ERR_CONNECT_TIMEOUT',\n]);\n/** The connection broke at an unknown point, possibly after the request was sent. */\nconst BROKEN_CONNECTION_ERROR_CODES = new Set([\n 'ECONNRESET',\n 'EPIPE',\n 'ETIMEDOUT',\n 'UND_ERR_SOCKET',\n 'UND_ERR_CLOSED',\n]);\n\nexport function isIdempotentMethod(method: string): boolean {\n return IDEMPOTENT_METHODS.has(method.toUpperCase());\n}\n\n/** Whether a response with this status is retried for this method. */\nexport function isRetryableStatus(status: number, method: string): boolean {\n return REFUSED_STATUSES.has(status) || (GATEWAY_STATUSES.has(status) && isIdempotentMethod(method));\n}\n\n/** Whether a fetch rejection is a connection failure that is retried for this method. */\nexport function isRetryableNetworkError(error: unknown, method: string): boolean {\n const code = networkErrorCode(error);\n if (code === undefined) return false;\n return NOT_SENT_ERROR_CODES.has(code) || (BROKEN_CONNECTION_ERROR_CODES.has(code) && isIdempotentMethod(method));\n}\n\n/** Find the system error code undici attaches to `TypeError: fetch failed`. */\nfunction networkErrorCode(error: unknown, depth = 0): string | undefined {\n if (typeof error !== 'object' || error === null || depth > 4) return undefined;\n const { code, cause, errors } = error as { code?: unknown; cause?: unknown; errors?: unknown };\n if (typeof code === 'string') return code;\n if (Array.isArray(errors) && errors.length > 0) return networkErrorCode(errors[0], depth + 1);\n return networkErrorCode(cause, depth + 1);\n}\n\n/**\n * Parse a `Retry-After` header (seconds or an HTTP date) into milliseconds.\n * Returns `undefined` when absent or malformed.\n */\nexport function parseRetryAfter(header: string | null | undefined, now = Date.now()): number | undefined {\n if (!header) return undefined;\n const value = header.trim();\n if (/^\\d+(\\.\\d+)?$/.test(value)) return Number(value) * 1000;\n const date = Date.parse(value);\n return Number.isNaN(date) ? undefined : Math.max(0, date - now);\n}\n\n/** Exponential backoff with full jitter for the retry following attempt `attempt` (0-based). */\nexport function backoffDelayMs(attempt: number, random: () => number = Math.random): number {\n return random() * Math.min(RETRY_MAX_DELAY_MS, RETRY_BASE_DELAY_MS * 2 ** attempt);\n}\n\n/**\n * Delay before retrying a response, or `undefined` when its `Retry-After`\n * asks for more than `RETRY_AFTER_MAX_MS`.\n */\nexport function retryDelayMs(attempt: number, retryAfter: string | null | undefined, random?: () => number): number | undefined {\n const requested = parseRetryAfter(retryAfter);\n if (requested === undefined) return backoffDelayMs(attempt, random);\n return requested <= RETRY_AFTER_MAX_MS ? requested : undefined;\n}\n\nexport interface RetryingFetchOptions {\n /** Retries after the first attempt for the request with this signal. `0` disables retries. */\n maxRetries: (signal: AbortSignal | null | undefined) => number;\n /** Absolute time (ms since epoch) after which the request is abandoned, if any. */\n deadline?: (signal: AbortSignal | null | undefined) => number | undefined;\n /** Underlying fetch. Defaults to the global `fetch`, read at call time. */\n fetch?: typeof fetch;\n random?: () => number;\n sleep?: (ms: number, signal: AbortSignal | null | undefined) => Promise<void>;\n}\n\n/** Wrap `fetch` with the retry policy described at the top of this module. */\nexport function createRetryingFetch(options: RetryingFetchOptions): typeof fetch {\n const wait = options.sleep ?? abortableSleep;\n return async (input: RequestInfo | URL, init?: RequestInit): Promise<Response> => {\n const baseFetch = options.fetch ?? globalThis.fetch;\n const request = input instanceof Request ? input : undefined;\n const method = (request?.method ?? init?.method ?? 'GET').toUpperCase();\n const signal = init?.signal ?? request?.signal;\n const maxRetries = Math.max(0, Math.floor(options.maxRetries(signal) || 0));\n // A Request body is a one-shot stream: send a clone while another attempt may follow.\n const send = (last: boolean) =>\n request && request.body !== null && !last ? baseFetch(request.clone(), init) : baseFetch(input, init);\n\n for (let attempt = 0; ; attempt++) {\n const last = attempt >= maxRetries;\n let response: Response;\n try {\n response = await send(last);\n } catch (error) {\n if (last || !isRetryableNetworkError(error, method)) throw error;\n const delay = backoffDelayMs(attempt, options.random);\n if (!fitsDeadline(delay)) throw error;\n warn(`${method} request failed (${networkErrorCode(error)})`, delay, attempt, maxRetries);\n await wait(delay, signal);\n continue;\n }\n if (last || !isRetryableStatus(response.status, method)) return response;\n const delay = retryDelayMs(attempt, response.headers.get('retry-after'), options.random);\n if (delay === undefined || !fitsDeadline(delay)) return response;\n await response.body?.cancel().catch(() => undefined);\n warn(`${method} request returned ${response.status}`, delay, attempt, maxRetries);\n await wait(delay, signal);\n }\n\n function fitsDeadline(delay: number): boolean {\n const deadline = options.deadline?.(signal);\n return deadline === undefined || Date.now() + delay < deadline;\n }\n };\n}\n\nfunction warn(reason: string, delay: number, attempt: number, maxRetries: number): void {\n console.warn(`${reason}, retrying in ${(delay / 1000).toFixed(1)}s (${attempt + 1}/${maxRetries})`);\n}\n\nfunction abortableSleep(ms: number, signal: AbortSignal | null | undefined): Promise<void> {\n return new Promise((resolve, reject) => {\n if (signal?.aborted) {\n reject(signal.reason);\n return;\n }\n const onAbort = () => {\n clearTimeout(timer);\n reject(signal?.reason);\n };\n const timer = setTimeout(() => {\n signal?.removeEventListener('abort', onAbort);\n resolve();\n }, ms);\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n}\n","import type { NotteClient } from '@/client';\nimport type {\n Credential,\n CredentialsDictInput,\n CredentialsDictOutput,\n Vault,\n VaultCreateRequest,\n} from '@/lib/client/types.gen';\nimport {\n vaultCreate,\n vaultCredentialsAdd,\n vaultCredentialsDelete,\n vaultCredentialsGet,\n vaultCredentialsList,\n vaultDelete,\n} from '@/lib/client/sdk.gen';\nimport { getDomain } from 'tldts';\nimport { InvalidRequestError } from '@/errors';\n\n// Constructor overloads for NotteVault - mirrors Python overloads\nexport interface VaultConstructorWithId {\n vault_id: string;\n}\n\nexport interface VaultConstructorCreate extends VaultCreateRequest {\n vault_id?: never;\n}\n\nexport type VaultConstructor = VaultConstructorWithId | VaultConstructorCreate;\n\n/** Credential fields read by `addCredentialsFromEnv`, in the order Python's `CredentialField.registry` declares them. */\nexport const CREDENTIAL_FIELDS = ['email', 'username', 'mfa_secret', 'password'] as const;\nexport type CredentialField = (typeof CREDENTIAL_FIELDS)[number];\n\n\nfunction extractHostname(url: string): string {\n const trimmed = url.trim();\n if (trimmed.length === 0) {\n return '';\n }\n // Bare domains (`peeple.com`, `github.com:443`) get a scheme so `URL` can parse them.\n const hasScheme = /^[a-z][a-z0-9+.-]*:\\/\\//i.test(trimmed);\n const candidates = hasScheme ? [trimmed] : [`https://${trimmed}`];\n for (const candidate of candidates) {\n try {\n const { hostname } = new URL(candidate);\n // Python's tldextract yields an empty domain for names starting with a dot.\n if (hostname.length > 0 && !hostname.startsWith('.')) {\n return hostname.toLowerCase();\n }\n } catch {\n // Not parseable: no domain.\n }\n }\n return '';\n}\n\n/**\n * Get the root domain of a URL, the counterpart of `notte_core.url.get_root_domain`.\n * Returns an empty string when no domain can be extracted.\n *\n * ```ts\n * getRootDomain('https://www.example.com/path'); // 'example.com'\n * getRootDomain('https://test.peeple.com/ok'); // 'peeple.com'\n * getRootDomain('https://shop.example.co.uk'); // 'example.co.uk'\n * ```\n */\nexport function getRootDomain(url: string): string {\n const hostname = extractHostname(url);\n if (hostname.length === 0) {\n return '';\n }\n // IPv6 literals and IPv4 addresses have no public suffix: keep them whole.\n if (hostname.startsWith('[') || /^\\d{1,3}(\\.\\d{1,3}){3}$/.test(hostname)) {\n return hostname;\n }\n // Public Suffix List (ICANN section, like tldextract's default in Python), so\n // multi-label suffixes such as `co.uk` or `pvt.k12.ma.us` are handled and the\n // credential key matches the one the Python SDK derives.\n const domain = getDomain(hostname, { allowPrivateDomains: false, detectIp: false });\n if (domain) {\n return domain.toLowerCase();\n }\n // Unknown suffix (intranet names, `localhost`): keep the hostname whole.\n return hostname.toLowerCase();\n}\n\n/**\n * Explicit opt-in URL utility; vault request methods do not call it.\n * Normalise a credential URL to its root domain, the counterpart of\n * `notte_sdk.types.validate_url`. Throws `InvalidRequestError` when the URL\n * has no domain name.\n *\n * ```ts\n * validateUrl('https://github.com/login'); // 'github.com'\n * validateUrl('https://'); // throws InvalidRequestError\n * ```\n */\nexport function validateUrl(url: string): string {\n const domain = getRootDomain(url);\n if (domain.length === 0) {\n throw new InvalidRequestError(`Invalid URL: ${url}. Please provide a valid URL with a domain name.`);\n }\n return domain;\n}\n\n/**\n * Check that a string is a base32 TOTP secret, with the padding rules Python's\n * `pyotp.TOTP(secret).now()` applies (`base64.b32decode` after right-padding\n * the secret to a multiple of eight characters).\n */\nexport function isValidMfaSecret(secret: string): boolean {\n if (secret.length === 0) {\n return false;\n }\n let padded = secret.toUpperCase();\n if (padded.length % 8 !== 0) {\n padded += '='.repeat(8 - (padded.length % 8));\n }\n let end = padded.length;\n while (end > 0 && padded[end - 1] === '=') {\n end -= 1;\n }\n const stripped = padded.slice(0, end);\n const padding = padded.length - stripped.length;\n return /^[A-Z2-7]*$/.test(stripped) && [0, 1, 3, 4, 6].includes(padding);\n}\n\n/**\n * Explicit opt-in utility; vault request methods leave validation to the API.\n * Validate an MFA secret like `AddCredentialsRequest.check_email_and_username`\n * in Python. Rejects one-time codes (`999777`) and anything that is not base32.\n */\nexport function validateMfaSecret(secret: string): void {\n if (!isValidMfaSecret(secret)) {\n throw new InvalidRequestError('Invalid MFA secret code: did you try to store an OTP instead of a secret?');\n }\n}\n\n/**\n * Explicit opt-in utility; vault request methods leave validation to the API.\n * Apply the client-side rules of Python's `AddCredentialsRequest`: exactly one\n * of `username` / `email`, and a base32 `mfa_secret` when one is provided.\n * Returns the credentials unchanged.\n */\nexport function validateCredentials(credentials: CredentialsDictInput): CredentialsDictInput {\n const hasUsername = credentials.username !== undefined && credentials.username !== null;\n const hasEmail = credentials.email !== undefined && credentials.email !== null;\n if (hasUsername && hasEmail) {\n throw new InvalidRequestError('Can only set either username or email');\n }\n if (!hasUsername && !hasEmail) {\n throw new InvalidRequestError('Need to have either username or email set');\n }\n if (credentials.mfa_secret !== undefined && credentials.mfa_secret !== null) {\n validateMfaSecret(credentials.mfa_secret);\n }\n return credentials;\n}\n\n/**\n * Vault that fetches credentials stored using the SDK, the counterpart of\n * `notte_sdk.endpoints.vaults.NotteVault`.\n *\n * The remote vault is created lazily on the first API operation so local-only\n * helpers such as `generatePassword()` stay side-effect free. Every API\n * failure rejects with a `NotteAPIError`, including server-side validation\n * failures (422 for invalid URLs, credentials, or MFA secrets).\n * // pragma: allowlist secret\n * ```ts\n * const vault = client.Vault({ name: 'My vault' });\n * await vault.addCredentials('https://github.com/', { email: 'me@example.org', password: 'secret' }); // pragma: allowlist secret\n * const credentials = await vault.getCredentials('https://github.com/login');\n * await vault.stop(); // deletes the vault and every credential it holds\n * ```\n */\nexport class NotteVault {\n private client: NotteClient;\n private _vaultId: string | null = null;\n private initPromise: Promise<string> | null = null;\n private createData: VaultCreateRequest | null = null;\n\n constructor(client: NotteClient, options: VaultConstructor = {}) {\n this.client = client;\n\n if (options && 'vault_id' in options && options.vault_id !== undefined) {\n // Constructor for existing vault\n if (options.vault_id.length === 0) {\n throw new InvalidRequestError('Vault ID cannot be empty');\n }\n this.initPromise = this.initExistingVault(options.vault_id);\n // The rejection is surfaced by the first awaited operation; avoid an\n // unhandled rejection when verification fails before anything is awaited.\n this.initPromise.catch(() => undefined);\n } else {\n // Defer remote creation until an operation actually needs a vault. This\n // keeps local-only helpers such as generatePassword() side-effect free.\n const { vault_id: _ignored, ...createData } = (options ?? {}) as VaultConstructorCreate;\n this.createData = createData;\n }\n }\n\n private async initExistingVault(vaultId: string): Promise<string> {\n await this.verifyVaultExists(vaultId);\n this._vaultId = vaultId;\n return this._vaultId;\n }\n\n private async initNewVault(createData: VaultCreateRequest): Promise<string> {\n const response = await vaultCreate({\n client: this.client.getClient(),\n body: createData,\n throwOnError: true,\n });\n const vault: Vault = response.data;\n console.warn(`[Vault] ${vault.vault_id} created since no vault id was provided. Please store this to retrieve it later.`);\n this._vaultId = vault.vault_id;\n return this._vaultId;\n }\n\n private async verifyVaultExists(vaultId: string): Promise<void> {\n // Verify the vault exists by listing its credentials; a missing vault rejects with a NotteAPIError.\n await vaultCredentialsList({\n client: this.client.getClient(),\n path: { vault_id: vaultId },\n throwOnError: true,\n });\n }\n\n private async ensureInitialized(): Promise<string> {\n if (this._vaultId) {\n return this._vaultId;\n }\n if (this.initPromise) {\n return await this.initPromise;\n }\n if (this.createData) {\n const createData = this.createData;\n this.createData = null;\n this.initPromise = this.initNewVault(createData);\n return await this.initPromise;\n }\n throw new InvalidRequestError('Vault not initialized');\n }\n\n /** ID of the remote vault. Throws until the first API operation has created or verified it. */\n get vaultId(): string {\n if (!this._vaultId) {\n throw new InvalidRequestError('Vault not initialized. Await a vault operation first.');\n }\n return this._vaultId;\n }\n\n /**\n * Start the vault. No-op kept for parity with Python's `SyncResource` interface.\n */\n start(): void {\n // No-op - vault is ready to use immediately\n }\n\n /**\n * Stop the vault: deletes it together with every credential it holds.\n *\n * ```ts\n * await vault.stop();\n * ```\n */\n async stop(): Promise<void> {\n const vaultId = await this.ensureInitialized();\n console.info(`[Vault] ${vaultId} deleted. All credentials have been deleted.`);\n await this.delete();\n }\n\n /**\n * Add or update the credentials stored for a website. Values are sent as\n * supplied; the API validates credentials and reduces the URL to its root\n * domain (`https://github.com/login` → `github.com`).\n *\n * ```ts\n * await vault.addCredentials('https://github.com/', {\n * email: 'me@example.org',\n * password: 'secret', // pragma: allowlist secret\n * mfa_secret: 'JBSWY3DPEHPK3PXP', // pragma: allowlist secret\n * });\n * ```\n */\n async addCredentials(url: string, credentials: CredentialsDictInput): Promise<void> {\n const vaultId = await this.ensureInitialized();\n await vaultCredentialsAdd({\n client: this.client.getClient(),\n path: { vault_id: vaultId },\n body: { url, credentials },\n throwOnError: true,\n });\n }\n\n /**\n * Get the credentials stored for a website. Rejects with a `NotteAPIError`\n * when the vault holds no credentials for that domain, like Python's\n * `get_credentials`.\n *\n * ```ts\n * const { email, password } = await vault.getCredentials('https://github.com/login');\n * ```\n */\n async getCredentials(url: string): Promise<CredentialsDictOutput> {\n const vaultId = await this.ensureInitialized();\n const response = await vaultCredentialsGet({\n client: this.client.getClient(),\n path: { vault_id: vaultId },\n query: { url },\n throwOnError: true,\n });\n return response.data.credentials;\n }\n\n /**\n * Check whether the vault holds credentials for a website, the counterpart\n * of `BaseVault.has_credential`. Never rejects for a missing credential.\n *\n * ```ts\n * if (!(await vault.hasCredential('https://github.com/'))) {\n * await vault.addCredentialsFromEnv('https://github.com/');\n * }\n * ```\n */\n async hasCredential(url: string): Promise<boolean> {\n const domain = getRootDomain(url);\n const credentials = await this.listCredentials();\n return credentials.some(credential => credential.url === url || credential.url === domain);\n }\n\n /**\n * Delete the credentials stored for a website.\n *\n * ```ts\n * await vault.deleteCredentials('https://github.com/');\n * ```\n */\n async deleteCredentials(url: string): Promise<void> {\n const vaultId = await this.ensureInitialized();\n await vaultCredentialsDelete({\n client: this.client.getClient(),\n path: { vault_id: vaultId },\n query: { url },\n throwOnError: true,\n });\n }\n\n /**\n * List the websites the vault holds credentials for. Passwords are never returned.\n *\n * ```ts\n * const credentials = await vault.listCredentials();\n * console.log(credentials.map(c => c.url));\n * ```\n */\n async listCredentials(): Promise<Credential[]> {\n const vaultId = await this.ensureInitialized();\n const response = await vaultCredentialsList({\n client: this.client.getClient(),\n path: { vault_id: vaultId },\n throwOnError: true,\n });\n return response.data.credentials;\n }\n\n /**\n * Delete the vault and every credential it holds.\n */\n async delete(): Promise<void> {\n const vaultId = await this.ensureInitialized();\n await vaultDelete({\n client: this.client.getClient(),\n path: { vault_id: vaultId },\n throwOnError: true,\n });\n }\n\n /**\n * Add credentials read from environment variables, the counterpart of\n * `BaseVault.add_credentials_from_env`. For `https://github.com/` the\n * variables are `GITHUB_COM_EMAIL`, `GITHUB_COM_USERNAME`,\n * `GITHUB_COM_MFA_SECRET` and `GITHUB_COM_PASSWORD`.\n *\n * ```ts\n * process.env.GITHUB_COM_EMAIL = 'me@example.org';\n * process.env.GITHUB_COM_PASSWORD = 'secret'; // pragma: allowlist secret\n * await vault.addCredentialsFromEnv('https://github.com/');\n * ```\n */\n async addCredentialsFromEnv(url: string): Promise<void> {\n const rootDomain = getRootDomain(url);\n const prefix = rootDomain.replace(/\\./g, '_').toUpperCase();\n const credentials: Partial<CredentialsDictInput> = {};\n const variableNames: string[] = [];\n for (const field of CREDENTIAL_FIELDS) {\n const variable = `${prefix}_${field.toUpperCase()}`;\n variableNames.push(variable);\n const value = process.env[variable];\n if (value !== undefined) {\n credentials[field] = value;\n }\n }\n if (Object.keys(credentials).length === 0) {\n throw new InvalidRequestError(\n `No credentials found in the environment for ${url}. Please set the following variables: ${variableNames.join(', ')}`,\n );\n }\n await this.addCredentials(url, credentials as CredentialsDictInput);\n }\n\n /**\n * Generate a secure random password, the counterpart of Python's\n * `generate_password`. The result always contains a lowercase letter, an\n * uppercase letter and a digit, plus a special character unless\n * `includeSpecialChars` is false.\n *\n * ```ts\n * const password = vault.generatePassword(24);\n * ```\n */\n generatePassword(length: number = 20, includeSpecialChars: boolean = true): string {\n // Validate minimum length\n const minRequiredLength = includeSpecialChars ? 4 : 3;\n if (length < minRequiredLength) {\n throw new InvalidRequestError(`Password length must be at least ${minRequiredLength} characters`);\n }\n\n // Character sets\n const lowercase = 'abcdefghijklmnopqrstuvwxyz';\n const uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n const digits = '0123456789';\n const specialChars = '!@#$%^&*()_+-=[]|;:,.<>?';\n const alphanumeric = uppercase + lowercase + digits;\n\n // Generate the initial random password from the platform CSPRNG.\n const allowedChars = includeSpecialChars ? `${alphanumeric}-_` : alphanumeric;\n // Rejection sampling keeps the CSPRNG output uniform: a plain modulo would\n // favour the first `2^32 mod size` characters.\n const randomIndex = (size: number): number => {\n const limit = Math.floor(0x1_0000_0000 / size) * size;\n const buffer = new Uint32Array(1);\n for (;;) {\n const [value] = globalThis.crypto.getRandomValues(buffer);\n if (value! < limit) {\n return value! % size;\n }\n }\n };\n const passwordArray = Array.from({ length }, () => allowedChars[randomIndex(allowedChars.length)]!);\n const pick = (chars: string): string => chars[randomIndex(chars.length)]!;\n\n // Guarantee every required character class is present. Fixing one class\n // may overwrite another, so loop until all requirements hold.\n let maxIterations = 10;\n while (maxIterations-- > 0) {\n let allRequirementsMet = true;\n const requirements: Array<[boolean, string]> = [\n [true, lowercase],\n [true, uppercase],\n [true, digits],\n [includeSpecialChars, specialChars],\n ];\n for (const [required, chars] of requirements) {\n if (required && !passwordArray.some(c => chars.includes(c))) {\n passwordArray[randomIndex(passwordArray.length)] = pick(chars);\n allRequirementsMet = false;\n }\n }\n if (allRequirementsMet) {\n break;\n }\n }\n\n return passwordArray.join('');\n }\n}\n","import { NotteClient } from '@/client';\nimport { NotteVault } from '@/vaults';\nimport type {\n PersonaCreateRequest,\n PersonaResponse,\n EmailResponse,\n SmsResponse,\n PaginatedResponsePersonaResponse,\n PersonaEmailsListData,\n ListPersonasData,\n DeletePersonaResponse\n} from '@/lib/client/types.gen';\nimport {\n personaCreate,\n personaGet,\n personaDelete,\n personaEmailsList,\n personaSmsList,\n listPersonas\n} from '@/lib/client/sdk.gen';\nimport { formatError } from '@/utils';\n\n// Type aliases from generated types for convenience\nexport type MessageReadOptions = NonNullable<PersonaEmailsListData['query']>;\nexport type PersonaListOptions = NonNullable<ListPersonasData['query']>;\n// Backwards-compatible convenience alias; the generated response now includes\n// the internal address directly.\nexport type PersonaResponseWithInternalEmail = PersonaResponse;\n\n/** Fill in `email_provider` for API responses that predate the field. */\nexport function withPersonaDefaults<T extends PersonaResponse | null | undefined>(persona: T): T {\n if (!persona || persona.email_provider) return persona;\n return { ...persona, email_provider: 'notte' };\n}\n\n// Constructor overloads for NottePersona - mirrors Python overloads\nexport interface PersonaConstructorWithId {\n persona_id: string;\n}\n\nexport interface PersonaConstructorCreate extends PersonaCreateRequest {\n persona_id?: never;\n}\n\nexport type PersonaConstructor = PersonaConstructorWithId | PersonaConstructorCreate;\n\n/**\n * Self-service identities for web automation (account creation, 2FA, etc.)\n *\n * Notte Personas provide automated identity management for browser workflows, enabling account creation,\n * handle two-factor authentication, and interact with web platforms without manual intervention.\n *\n * Notte Personas come with complete digital identities:\n * - Unique Email Address: Dedicated mailbox for each persona with full email management\n * - Phone Number: SMS-capable phone number for verification and 2FA\n * - Credential Vault: Optional secure storage for passwords and authentication tokens\n * - Automated Communication: Built-in email and SMS reading capabilities\n * - 2FA Support: Seamless handling of two-factor authentication flows\n */\nexport class NottePersona {\n private client: NotteClient;\n private _initRequest: PersonaCreateRequest;\n private response: PersonaResponseWithInternalEmail | null = null;\n private initPromise: Promise<PersonaResponseWithInternalEmail> | null = null;\n private _vault: NotteVault | undefined;\n private readonly ownsPersona: boolean;\n\n constructor(client: NotteClient, options: PersonaConstructor = {}) {\n this.client = client;\n this.ownsPersona = !('persona_id' in options && options.persona_id);\n\n if (options && 'persona_id' in options && options.persona_id) {\n // Constructor for existing persona\n this.initPromise = this.initExistingPersona(options.persona_id);\n this._initRequest = {};\n } else {\n // Constructor for new persona - create it\n const createData = (options || {}) as PersonaConstructorCreate;\n this._initRequest = createData;\n this.initPromise = this.initNewPersona(createData);\n }\n }\n\n /**\n * Get persona info\n */\n get info(): PersonaResponseWithInternalEmail {\n if (this.response === null) {\n throw new Error('Persona not initialized');\n }\n return this.response;\n }\n\n /**\n * Get vault (cached property equivalent)\n */\n get vault(): NotteVault {\n if (this._vault === undefined) {\n const vault = this._getVault();\n if (vault === null) {\n throw new Error(\n 'Persona has no vault. Please create a new persona using `create_vault=true` to use this feature.'\n );\n }\n this._vault = vault;\n }\n return this._vault;\n }\n\n /**\n * Check if persona has a vault\n */\n get hasVault(): boolean {\n return this.info.vault_id !== null;\n }\n\n private async initExistingPersona(personaId: string): Promise<PersonaResponseWithInternalEmail> {\n const response = await personaGet({\n client: this.client.getClient(),\n path: {\n persona_id: personaId\n }\n });\n\n if (response?.error) {\n throw new Error(`Failed to get persona: ${formatError(response.error)}`);\n }\n\n this.response = withPersonaDefaults(response.data as PersonaResponseWithInternalEmail);\n return this.response;\n }\n\n private async initNewPersona(createData: PersonaCreateRequest): Promise<PersonaResponseWithInternalEmail> {\n const response = await personaCreate({\n client: this.client.getClient(),\n body: createData\n });\n\n if (response?.error) {\n throw new Error(`Failed to create persona: ${formatError(response.error)}`);\n }\n\n this.response = withPersonaDefaults(response.data as PersonaResponseWithInternalEmail);\n console.warn(\n `[Persona] ${this.response.persona_id} created since no persona id was provided. Please store this to retrieve it later.`\n );\n return this.response;\n }\n\n private async ensureInitialized(): Promise<PersonaResponseWithInternalEmail> {\n if (this.response) {\n return this.response;\n }\n if (this.initPromise) {\n return await this.initPromise;\n }\n throw new Error('Persona not initialized');\n }\n\n /**\n * Get persona ID\n */\n get personaId(): string {\n if (!this.response) {\n throw new Error('Persona not initialized. Use await on persona operations first.');\n }\n return this.response.persona_id;\n }\n\n /**\n * Public, human-readable email address of the persona\n */\n get email(): string {\n return this.info.email;\n }\n\n /**\n * Internal UUID-backed mailbox address of the persona\n */\n get internalEmail(): string {\n return this.info.internal_email;\n }\n\n /**\n * Start the persona - ensures initialization\n */\n async start(): Promise<void> {\n await this.ensureInitialized();\n }\n\n /**\n * Stop the persona - deletes it\n */\n async stop(): Promise<void> {\n await this.ensureInitialized();\n console.log(`[Persona] ${this.personaId} deleted.`);\n await this.delete();\n }\n\n /**\n * Get vault - private helper method\n */\n private _getVault(): NotteVault | null {\n if (this.info.vault_id === null) {\n return null;\n }\n return new NotteVault(this.client, { vault_id: this.info.vault_id });\n }\n\n /**\n * Create the persona\n */\n async create(): Promise<void> {\n if (this.response !== null) {\n throw new Error(`Persona ${this.personaId} already initialized`);\n }\n await this.ensureInitialized();\n }\n\n /**\n * Delete the persona from the notte console\n */\n async delete(): Promise<DeletePersonaResponse> {\n await this.ensureInitialized();\n const response = await personaDelete({\n client: this.client.getClient(),\n path: {\n persona_id: this.personaId\n }\n });\n\n if (response?.error) {\n throw new Error(`Failed to delete persona: ${formatError(response.error)}`);\n }\n return response.data as DeletePersonaResponse;\n }\n\n /**\n * Add credentials to the persona (generates a password and stores it in the vault)\n */\n async addCredentials(url: string): Promise<void> {\n const vault = this._getVault();\n if (vault === null) {\n throw new Error(\n 'Cannot add credentials to a persona without a vault. Please create a new persona using `create_vault=true` to use this feature.'\n );\n }\n const password = vault.generatePassword();\n await vault.addCredentials(url, {\n email: this.info.email,\n password: password\n });\n }\n\n /**\n * Read recent emails sent to the persona\n */\n async emails(options?: MessageReadOptions): Promise<EmailResponse[]> {\n await this.ensureInitialized();\n const response = await personaEmailsList({\n client: this.client.getClient(),\n path: {\n persona_id: this.personaId\n },\n query: options || {}\n });\n\n if (response?.error) {\n throw new Error(`Failed to list emails: ${formatError(response.error)}`);\n }\n\n return response.data as EmailResponse[];\n }\n\n /**\n * Read recent SMS messages sent to the persona\n */\n async sms(options?: MessageReadOptions): Promise<SmsResponse[]> {\n await this.ensureInitialized();\n const response = await personaSmsList({\n client: this.client.getClient(),\n path: {\n persona_id: this.personaId\n },\n query: options || {}\n });\n\n if (response?.error) {\n throw new Error(`Failed to list SMS messages: ${formatError(response.error)}`);\n }\n\n return response.data as SmsResponse[];\n }\n\n /**\n * Get persona information (alias for ensureInitialized)\n */\n async get(): Promise<PersonaResponseWithInternalEmail> {\n await this.ensureInitialized();\n return this.response!;\n }\n\n /**\n * Run a callback and automatically delete a persona created by this instance.\n * Personas loaded by an existing ID are retained after the callback finishes.\n */\n async use<T>(callback: (persona: NottePersona) => Promise<T>): Promise<T> {\n await this.ensureInitialized();\n try {\n return await callback(this);\n } finally {\n // Only delete if this persona was created (not loaded from existing ID)\n if (this.ownsPersona) {\n try {\n await this.delete();\n } catch (error) {\n console.warn(`Failed to delete persona during cleanup: ${error}`);\n }\n }\n }\n }\n}\n","import { readFile, writeFile } from 'node:fs/promises';\nimport { basename } from 'node:path';\nimport { NotteClient, TIMEOUT_HEADER } from '@/client';\nimport { Encryption } from '@/encryption';\nimport { offloadRunPayloads, resolveRunPayloads } from '@/run-payloads';\nimport { FailedToRunCloudFunctionError, InvalidRequestError, NotteAPIError, NotteError, NotteTimeoutError } from '@/errors';\nimport type {\n\tDeleteFunctionResponse,\n\tFunctionMetadataUpdateRequest,\n\tFunctionResponse,\n\tFunctionRunUpdateRequest as ApiFunctionRunUpdateRequest,\n\tFunctionRollbackRequest,\n\tFunctionScheduleCreateRequest,\n\tFunctionWithLinkResponse,\n\tGetFunctionRunResponse as ApiGetFunctionRunResponse,\n\tGetFunctionRunResponseWritable as ApiGetFunctionRunResponseWritable,\n\tListFunctionRunsByFunctionIdData,\n\tPaginatedResponseFunctionRunListItemResponse,\n\tRunFunctionRequest,\n\tScheduleDeleteResponse,\n\tScheduleResponse,\n\tUpdateFunctionRunResponse,\n} from '@/lib/client/types.gen';\nimport {\n\tfunctionCreate,\n\tfunctionDelete,\n\tfunctionDownloadUrl,\n\tfunctionMetadataUpdate,\n\tfunctionRollback,\n\tfunctionScheduleDelete,\n\tfunctionScheduleSet,\n\tfunctionUpdate,\n\tlistFunctionRunsByFunctionId,\n} from '@/lib/client/sdk.gen';\n\nconst DOWNLOAD_TIMEOUT_MS = 30_000;\n/** Default deadline of `run()`, the counterpart of `WorkflowsClient.WORKFLOW_RUN_TIMEOUT` (5 minutes). */\nexport const FUNCTION_RUN_TIMEOUT_MS = 5 * 60 * 1000;\n\n/**\n * Run endpoints that the OpenAPI spec does not describe. They are the Python\n * SDK's `WorkflowsClient.CREATE_WORKFLOW_RUN` and `START_WORKFLOW_RUN` paths\n * and are only ever called through `NotteFunction.postRunEndpoint()`.\n */\nexport const FUNCTION_RUN_ENDPOINTS = {\n\t/** `POST` creates a run record without executing it (`CreateFunctionRunRequest`). */\n\tcreate: '/functions/{function_id}/runs/create',\n\t/** `POST` executes a previously created run (`StartFunctionRunRequest`). */\n\tstart: '/functions/{function_id}/runs/{run_id}',\n} as const;\n\n/**\n * The run endpoints hand the caller's key to the execution runtime through\n * this header (the `Authorization` header is not forwarded), so `run()` sends\n * it whenever the client holds a key, like `WorkflowsClient.run` in Python.\n * Proxy-mode clients have no key; their proxy must add the header itself.\n */\nexport const RUN_API_KEY_HEADER = 'x-notte-api-key'; // pragma: allowlist secret\n\nexport type FunctionRuntime = NonNullable<RunFunctionRequest['runtime']>;\n/** Function run values after the SDK downloads stored payloads. */\nexport type GetFunctionRunResponse = Omit<ApiGetFunctionRunResponse, 'payloads' | 'payload_urls'>;\n/** Writable run fields retained for compatibility with existing SDK consumers. */\nexport type GetFunctionRunResponseWritable = Omit<ApiGetFunctionRunResponseWritable, 'payloads' | 'payload_urls'>;\n/** Inline fields accepted by updateRun; the SDK manages storage references. */\nexport type FunctionRunUpdateRequest = Omit<ApiFunctionRunUpdateRequest, 'payloads' | 'result_preview'>;\n\nexport type FunctionRunStatus = GetFunctionRunResponse['status'];\nconst FUNCTION_RUN_STATUSES: readonly FunctionRunStatus[] = ['closed', 'active', 'failed'];\n\n/** Reference an existing function by ID. */\nexport interface FunctionConstructorWithId {\n\tfunction_id: string;\n\t/** Key used to decrypt the download URL of Notte managed functions. */\n\tdecryption_key?: string;\n\tpath?: never;\n}\n\n/**\n * Create a function from a local `.py` file, like `client.Function(path=...)`\n * in Python. The upload happens on the first operation that needs the ID.\n */\nexport interface FunctionConstructorCreate {\n\t/** Path to the python file containing the `run` function. Must end with `.py`. */\n\tpath: string;\n\tname?: string | null;\n\tdescription?: string | null;\n\t/** Whether the function is public and shared with other users. Defaults to false. */\n\tshared?: boolean;\n\tdecryption_key?: string;\n\tfunction_id?: never;\n}\n\nexport type FunctionConstructor = FunctionConstructorWithId | FunctionConstructorCreate;\n\n/** Result of executing a run, the counterpart of `FunctionRunResponse` in Python. */\nexport interface FunctionRunResult {\n\tfunction_id: string;\n\tfunction_run_id: string;\n\tsession_id: string | null;\n\t/** The value returned by the script's `run` function, decoded from JSON. */\n\tresult: unknown;\n\tstatus: FunctionRunStatus;\n}\n/** Alias of `FunctionRunResult` using the Python model name. */\nexport type FunctionRunResponse = FunctionRunResult;\n/** @deprecated `run()` now returns `FunctionRunResult` whether or not it streams. */\nexport type FunctionRunStartResult = FunctionRunResult;\n\n/** Run record returned by `createRun()`, the counterpart of `CreateFunctionRunResponse` in Python. */\nexport interface FunctionRunCreateResult {\n\tfunction_id: string;\n\tfunction_run_id: string;\n\tcreated_at: string;\n\tstatus: 'created';\n}\n\nexport interface FunctionRunCreateOptions {\n\t/** Mark the record as a local run. Defaults to false; the Node SDK only executes on the cloud. */\n\tlocal?: boolean;\n}\n\nexport interface FunctionRunOptions {\n\t/** Stream logs and wait for completion. Defaults to true. */\n\tstream?: boolean;\n\t/** Receive streamed logs instead of printing them to console.log. */\n\tonLog?: (message: string) => void;\n\t/** Throw `FailedToRunCloudFunctionError` when execution fails. Defaults to true, matching Python. */\n\traiseOnFailure?: boolean;\n\t/** Execute a record returned by createRun(). Omit to create a new run. */\n\tfunctionRunId?: string;\n\t/** Override the saved function runtime; omit to inherit its default. */\n\truntime?: FunctionRuntime;\n\t/**\n\t * Deadline of the whole execution in milliseconds. The wait is aborted with\n\t * `NotteTimeoutError` once it elapses. Defaults to `FUNCTION_RUN_TIMEOUT_MS` (5 minutes).\n\t */\n\ttimeoutMs?: number;\n}\n\nexport interface FunctionGetOptions {\n\t/** Version to fetch. Defaults to the latest version. */\n\tversion?: string;\n}\n\nexport interface FunctionUrlOptions extends FunctionGetOptions {\n\t/** Overrides the decryption key passed to the constructor. */\n\tdecryption_key?: string;\n}\n\nexport interface FunctionDownloadOptions extends FunctionUrlOptions {\n\t/** Optional local destination ending in `.py`. Source text is returned whether or not a path is supplied. */\n\tpath?: string;\n}\n\nexport interface FunctionUpdateOptions {\n\t/** Path to the new python code. Must end with `.py`. */\n\tpath?: string;\n\t/** Only update this version. Defaults to creating a new version. */\n\tversion?: string;\n\t/** Whether to restrict the function code. Defaults to true, like Python. */\n\trestricted?: boolean;\n}\n\n/** Metadata fields accepted by `PATCH /functions/{function_id}`. */\nexport type FunctionMetadataUpdateOptions = FunctionMetadataUpdateRequest;\n\nexport interface FunctionScheduleOptions {\n\t/** Cron expression of the schedule. */\n\tcron: FunctionScheduleCreateRequest['cron'];\n\t/** Variables passed to every scheduled run. */\n\tvariables?: FunctionScheduleCreateRequest['variables'];\n}\n\nexport interface FunctionRollbackOptions extends FunctionRollbackRequest {\n\t/** Whether to restrict the function code. Defaults to true, like `update()`. */\n\trestricted?: boolean;\n}\n\n/**\n * Query options for listing a function's runs: `page`, `page_size`,\n * `only_active`, `only_current_token`, `include_system`, `source`.\n */\nexport type FunctionRunListOptions = NonNullable<ListFunctionRunsByFunctionIdData['query']>;\n\ntype FunctionRunEndpointRequest = {\n\turl: (typeof FUNCTION_RUN_ENDPOINTS)[keyof typeof FUNCTION_RUN_ENDPOINTS];\n\tpath: { function_id: string; run_id?: string };\n\tbody: Record<string, unknown>;\n\tparseAs?: 'json' | 'stream';\n\theaders?: Record<string, string>;\n\tsignal?: AbortSignal;\n};\n\n/**\n * Cloud function saved in the Notte console, the counterpart of\n * `notte.Function` in Python.\n *\n * ```ts\n * const fn = client.NotteFunction({ function_id: '<your-function-id>' });\n * const result = await fn.run({ url: 'https://example.com' });\n *\n * const created = client.NotteFunction({ path: './scraper.py', name: 'Scraper' });\n * await created.run(); // uploads scraper.py first\n * ```\n */\nexport class NotteFunction {\n\tprivate readonly client: NotteClient;\n\tprivate _functionId: string | null = null;\n\tprivate initPromise: Promise<string> | null = null;\n\tprivate createData: FunctionConstructorCreate | null = null;\n\tpublic readonly decryptionKey?: string;\n\n\tconstructor(client: NotteClient, options: FunctionConstructor) {\n\t\tthis.client = client;\n\t\tthis.decryptionKey = options.decryption_key;\n\t\tif (options.function_id !== undefined) {\n\t\t\tif (options.function_id.length === 0) {\n\t\t\t\tthrow new InvalidRequestError('function_id cannot be empty');\n\t\t\t}\n\t\t\tthis._functionId = options.function_id;\n\t\t} else if (options.path !== undefined) {\n\t\t\tassertPythonPath(options.path);\n\t\t\t// Defer the upload until an operation needs the ID, like NotteVault.\n\t\t\tthis.createData = options;\n\t\t} else {\n\t\t\tthrow new InvalidRequestError(\"Either 'function_id' or 'path' must be provided\");\n\t\t}\n\t}\n\n\t/** The function ID. Throws before a `path`-constructed function has been uploaded. */\n\tget functionId(): string {\n\t\tif (this._functionId === null) {\n\t\t\tthrow new InvalidRequestError(\n\t\t\t\t'Function not initialized. Await a function operation (for example `await fn.get()`) before reading its ID.',\n\t\t\t);\n\t\t}\n\t\treturn this._functionId;\n\t}\n\n\t/** Alias of the `functionId` accessor. */\n\tgetFunctionId(): string {\n\t\treturn this.functionId;\n\t}\n\n\tprivate async ensureInitialized(): Promise<string> {\n\t\tif (this._functionId !== null) {\n\t\t\treturn this._functionId;\n\t\t}\n\t\tif (this.initPromise === null) {\n\t\t\tconst createData = this.createData;\n\t\t\tthis.createData = null;\n\t\t\tif (createData === null) {\n\t\t\t\tthrow new InvalidRequestError('Function not initialized');\n\t\t\t}\n\t\t\tthis.initPromise = this.createFunction(createData);\n\t\t}\n\t\treturn this.initPromise;\n\t}\n\n\tprivate async createFunction(data: FunctionConstructorCreate): Promise<string> {\n\t\tconst file = await readPythonFile(data.path);\n\t\tconst response = await functionCreate({\n\t\t\tclient: this.client.getClient(),\n\t\t\tthrowOnError: true,\n\t\t\tbody: { file, name: data.name, description: data.description, shared: data.shared },\n\t\t});\n\t\tthis._functionId = response.data.function_id;\n\t\tconsole.info(`[Function] ${this._functionId} created successfully.`);\n\t\treturn this._functionId;\n\t}\n\n\t/**\n\t * Get the function metadata together with its download URL, the\n\t * counterpart of `client.functions.get()` in Python.\n\t *\n\t * @param options - Optional version selector; omitted means the latest version.\n\t * @returns Function metadata, version history, and the download link returned by the API.\n\t * @throws NotteAPIError if the function cannot be retrieved.\n\t * @example\n\t * const { latest_version, versions } = await fn.get();\n\t */\n\tasync get(options: FunctionGetOptions = {}): Promise<FunctionWithLinkResponse> {\n\t\tconst functionId = await this.ensureInitialized();\n\t\tconst response = await functionDownloadUrl({\n\t\t\tclient: this.client.getClient(),\n\t\t\tthrowOnError: true,\n\t\t\tpath: { function_id: functionId },\n\t\t\tquery: options.version !== undefined ? { version: options.version } : {},\n\t\t});\n\t\treturn response.data;\n\t}\n\n\t/**\n\t * Upload a new version of the code, mirroring `function.update(path=...)`.\n\t *\n\t * @param options - Local Python file path, optional version, and code-access settings.\n\t * @returns Updated function metadata, including its latest version.\n\t * @throws InvalidRequestError if the path is missing or does not end in `.py`.\n\t * @throws NotteAPIError if the upload is rejected.\n\t * @example\n\t * const updated = await fn.update({ path: './scraper.py' });\n\t * console.log(updated.latest_version);\n\t */\n\tasync update(options: FunctionUpdateOptions): Promise<FunctionResponse> {\n\t\tif (options.path === undefined) {\n\t\t\tthrow new InvalidRequestError(\"'path' must be provided\");\n\t\t}\n\t\tconst functionId = await this.ensureInitialized();\n\t\tconst file = await readPythonFile(options.path);\n\t\tconst response = await functionUpdate({\n\t\t\tclient: this.client.getClient(),\n\t\t\tthrowOnError: true,\n\t\t\tpath: { function_id: functionId },\n\t\t\tquery: {\n\t\t\t\trestricted: options.restricted,\n\t\t\t\t...(options.version !== undefined ? { version: options.version } : {}),\n\t\t\t},\n\t\t\tbody: { file },\n\t\t});\n\t\tconsole.info(`[Function] ${functionId} updated successfully to version ${response.data.latest_version}.`);\n\t\treturn response.data;\n\t}\n\n\t/**\n\t * Update the function metadata (name, description, default runtime, ...).\n\t *\n\t * @param options - Metadata fields to update, such as name, description, or default runtime.\n\t * @returns Updated function metadata.\n\t * @throws NotteAPIError if the metadata update is rejected.\n\t * @example\n\t * await fn.updateMetadata({ name: 'Price monitor', default_runtime: 'extended' });\n\t */\n\tasync updateMetadata(options: FunctionMetadataUpdateOptions): Promise<FunctionResponse> {\n\t\tconst functionId = await this.ensureInitialized();\n\t\tconst response = await functionMetadataUpdate({\n\t\t\tclient: this.client.getClient(),\n\t\t\tthrowOnError: true,\n\t\t\tpath: { function_id: functionId },\n\t\t\tbody: options,\n\t\t});\n\t\treturn response.data;\n\t}\n\n\t/**\n\t * Delete the function from the Notte console.\n\t *\n\t * @returns The API's function-deletion confirmation.\n\t * @throws NotteAPIError if the function cannot be deleted.\n\t * @example\n\t * await fn.delete();\n\t */\n\tasync delete(): Promise<DeleteFunctionResponse> {\n\t\tconst functionId = await this.ensureInitialized();\n\t\tconst response = await functionDelete({\n\t\t\tclient: this.client.getClient(),\n\t\t\tthrowOnError: true,\n\t\t\tpath: { function_id: functionId },\n\t\t});\n\t\tconsole.info(`[Function] ${functionId} deleted successfully.`);\n\t\treturn response.data;\n\t}\n\n\t/**\n\t * Schedule the function to run on a cron expression.\n\t *\n\t * @param options - Cron expression and optional variables passed to each scheduled execution.\n\t * @returns The saved schedule configuration.\n\t * @throws NotteAPIError if the schedule cannot be saved.\n\t * @example\n\t * await fn.setSchedule({ cron: '0 9 * * *', variables: { url: 'https://example.com' } });\n\t */\n\tasync setSchedule(options: FunctionScheduleOptions): Promise<ScheduleResponse> {\n\t\tconst functionId = await this.ensureInitialized();\n\t\tconst response = await functionScheduleSet({\n\t\t\tclient: this.client.getClient(),\n\t\t\tthrowOnError: true,\n\t\t\tpath: { function_id: functionId },\n\t\t\tbody: { cron: options.cron, variables: options.variables ?? null },\n\t\t});\n\t\treturn response.data;\n\t}\n\n\t/**\n\t * Remove the function schedule.\n\t *\n\t * @returns The API's schedule-deletion confirmation.\n\t * @throws NotteAPIError if schedule deletion fails.\n\t * @example\n\t * await fn.deleteSchedule();\n\t */\n\tasync deleteSchedule(): Promise<ScheduleDeleteResponse> {\n\t\tconst functionId = await this.ensureInitialized();\n\t\tconst response = await functionScheduleDelete({\n\t\t\tclient: this.client.getClient(),\n\t\t\tthrowOnError: true,\n\t\t\tpath: { function_id: functionId },\n\t\t});\n\t\treturn response.data;\n\t}\n\n\t/**\n\t * Roll the function back to a previous version.\n\t *\n\t * @param options - Target version and optional code-access restriction, which defaults to true.\n\t * @returns Updated function metadata after rollback.\n\t * @throws NotteAPIError if the requested version cannot be restored.\n\t * @example\n\t * const { versions } = await fn.get();\n\t * await fn.rollback({ version: versions[0] });\n\t */\n\tasync rollback(options: FunctionRollbackOptions): Promise<FunctionResponse> {\n\t\tconst functionId = await this.ensureInitialized();\n\t\tconst response = await functionRollback({\n\t\t\tclient: this.client.getClient(),\n\t\t\tthrowOnError: true,\n\t\t\tpath: { function_id: functionId },\n\t\t\tquery: { restricted: options.restricted },\n\t\t\tbody: { version: options.version },\n\t\t});\n\t\treturn response.data;\n\t}\n\n\t/**\n\t * Get metadata for a specific function run.\n\t *\n\t * @param functionRunId - ID of a run belonging to this function.\n\t * @returns The run's current status, logs, and result metadata. This does not wait for completion.\n\t * @throws NotteAPIError if the run cannot be retrieved.\n\t * @example\n\t * const run = await fn.getRun(result.function_run_id);\n\t * console.log(run.status, run.logs);\n\t */\n\tasync getRun(functionRunId: string): Promise<GetFunctionRunResponse> {\n\t\tconst functionId = await this.ensureInitialized();\n\t\tconst response = await this.client.getClient().get<{ 200: GetFunctionRunResponse }, unknown, true>({\n\t\t\turl: '/functions/{function_id}/runs/{run_id}',\n\t\t\tpath: { function_id: functionId, run_id: functionRunId },\n\t\t\tquery: { payload_mode: 'references' },\n\t\t\tthrowOnError: true,\n\t\t});\n\t\treturn resolveRunPayloads(response.data);\n\t}\n\n\t/**\n\t * Update a run, uploading fields above 1 MiB directly to private storage.\n\t *\n\t * @param functionRunId - ID of a run belonging to this function.\n\t * @param fields - Status and fields to update. Omitted fields remain unchanged.\n\t * @returns Confirmation of the persisted update.\n\t * @throws Error if a field exceeds 256 MiB or an upload fails; the update is not finalized.\n\t * @example\n\t * await fn.updateRun(runId, { status: 'closed', result: { records } });\n\t */\n\tasync updateRun(functionRunId: string, fields: FunctionRunUpdateRequest): Promise<UpdateFunctionRunResponse> {\n\t\tconst functionId = await this.ensureInitialized();\n\t\tconst client = this.client.getClient();\n\t\tconst path = { function_id: functionId, run_id: functionRunId };\n\t\tconst body = await offloadRunPayloads(client, path, fields);\n\t\tconst response = await client.patch<{ 200: UpdateFunctionRunResponse }, unknown, true>({\n\t\t\turl: '/functions/{function_id}/runs/{run_id}', path, body,\n\t\t\theaders: { 'Content-Type': 'application/json' }, throwOnError: true,\n\t\t});\n\t\treturn response.data;\n\t}\n\n\t/**\n\t * Compatibility alias for getRun().\n\t * @deprecated Use getRun() instead. Retained for backwards compatibility.\n\t */\n\tasync retrieve(functionRunId: string): Promise<GetFunctionRunResponse> {\n\t\treturn this.getRun(functionRunId);\n\t}\n\n\t/**\n\t * Create a cloud run record without starting execution, like\n\t * `function.create_run()` in Python. Use this only when you need the ID\n\t * before execution, then pass it to `run(variables, { functionRunId })`.\n\t * `run()` otherwise creates a new run on its own.\n\t *\n\t * @param options - Run-record settings; `local` defaults to false. Node execution remains cloud-only.\n\t * @returns A created run record and its ID. No function code has executed yet.\n\t * @throws NotteAPIError if run creation is rejected.\n\t * @example\n\t * const created = await fn.createRun();\n\t * const result = await fn.run({ url: 'https://example.com' }, { functionRunId: created.function_run_id });\n\t */\n\tasync createRun(options: FunctionRunCreateOptions = {}): Promise<FunctionRunCreateResult> {\n\t\tconst functionId = await this.ensureInitialized();\n\t\treturn this.postRunEndpoint<FunctionRunCreateResult>({\n\t\t\turl: FUNCTION_RUN_ENDPOINTS.create,\n\t\t\tpath: { function_id: functionId },\n\t\t\tbody: { local: options.local ?? false },\n\t\t});\n\t}\n\n\t/**\n\t * List the runs of this function.\n\t *\n\t * Includes completed runs by default. Set `only_active: true` to retrieve\n\t * only in-flight runs. Use the response pagination metadata to request\n\t * additional pages.\n\t *\n\t * @param options - Pagination and filtering options. `only_active` defaults to false, including completed runs.\n\t * @returns One page of run records and pagination metadata; additional pages require another call.\n\t * @throws NotteAPIError if the run history cannot be retrieved.\n\t * @example\n\t * const { items } = await fn.runs({ page_size: 20 });\n\t */\n\tasync runs(options: FunctionRunListOptions = {}): Promise<PaginatedResponseFunctionRunListItemResponse> {\n\t\tconst functionId = await this.ensureInitialized();\n\t\tconst response = await listFunctionRunsByFunctionId({\n\t\t\tclient: this.client.getClient(),\n\t\t\tthrowOnError: true,\n\t\t\tpath: { function_id: functionId },\n\t\t\tquery: options,\n\t\t});\n\t\treturn response.data;\n\t}\n\n\t/**\n\t * Run the function on the cloud and wait for its result, streaming logs by\n\t * default like `function.run(**variables)` in Python.\n\t *\n\t * Pass `{ stream: false }` to receive the backend's JSON response without\n\t * live logs; execution still blocks until completion. Pass `functionRunId`\n\t * to execute a record returned by `createRun()`; otherwise a new run record\n\t * is created first, exactly like Python. A failed execution throws\n\t * `FailedToRunCloudFunctionError` unless `raiseOnFailure` is false, and the\n\t * wait is aborted with `NotteTimeoutError` after `timeoutMs`.\n\t *\n\t * @param variables - JSON-serializable keyword arguments passed to the Python function's `run` entry point.\n\t * @param options - Log streaming, failure handling, runtime, run ID, and timeout settings.\n\t * @returns The completed execution response. The function's return value is in `result`. Disabling streaming still waits for completion.\n\t * @throws FailedToRunCloudFunctionError if execution fails and `raiseOnFailure` is true.\n\t * @throws NotteTimeoutError if the execution request exceeds `timeoutMs`.\n\t * @throws InvalidRequestError if the run options are invalid.\n\t * @example\n\t * const result = await fn.run({ url: 'https://example.com' });\n\t * console.log(result.result);\n\t *\n\t * await fn.run({ url: 'https://example.com' }, { runtime: 'extended', onLog: line => logger.info(line) });\n\t */\n\tasync run(variables: Record<string, unknown> = {}, options: FunctionRunOptions = {}): Promise<FunctionRunResult> {\n\t\tconst stream = options.stream ?? true;\n\t\tconst timeoutMs = options.timeoutMs ?? FUNCTION_RUN_TIMEOUT_MS;\n\t\tif (!(timeoutMs > 0)) {\n\t\t\tthrow new InvalidRequestError('timeoutMs must be a positive number');\n\t\t}\n\t\tconst functionId = await this.ensureInitialized();\n\t\t// Create the run record first, like RemoteWorkflow.run in Python.\n\t\tconst functionRunId = options.functionRunId ?? (await this.createRun()).function_run_id;\n\t\tconst body: RunFunctionRequest = {\n\t\t\tworkflow_id: functionId,\n\t\t\tvariables,\n\t\t\tstream,\n\t\t\t...(options.runtime !== undefined ? { runtime: options.runtime } : {}),\n\t\t};\n\t\t// The run deadline replaces the client's per-request timeout, which would\n\t\t// otherwise cut a long execution (or its log stream) short.\n\t\tconst headers: Record<string, string> = { [TIMEOUT_HEADER]: '0' };\n\t\tconst apiKey = this.client.getConfig().apiKey;\n\t\tif (apiKey) {\n\t\t\theaders[RUN_API_KEY_HEADER] = apiKey;\n\t\t}\n\t\tconst endpointPath = FUNCTION_RUN_ENDPOINTS.start\n\t\t\t.replace('{function_id}', functionId)\n\t\t\t.replace('{run_id}', functionRunId);\n\t\tconst parseAs = stream ? 'stream' : 'json';\n\t\tconst controller = new AbortController();\n\t\tlet timedOut = false;\n\t\tconst timer = Number.isFinite(timeoutMs)\n\t\t\t? setTimeout(() => {\n\t\t\t\ttimedOut = true;\n\t\t\t\tcontroller.abort(new DOMException(`Function run timed out after ${timeoutMs}ms`, 'TimeoutError'));\n\t\t\t}, timeoutMs)\n\t\t\t: undefined;\n\t\ttimer?.unref?.();\n\t\ttry {\n\t\t\tconst raw = await this.postRunEndpoint<unknown>({\n\t\t\t\turl: FUNCTION_RUN_ENDPOINTS.start,\n\t\t\t\tpath: { function_id: functionId, run_id: functionRunId },\n\t\t\t\tbody: { ...body, function_run_id: functionRunId },\n\t\t\t\tparseAs,\n\t\t\t\theaders,\n\t\t\t\tsignal: controller.signal,\n\t\t\t});\n\t\t\tconst result = stream\n\t\t\t\t? await readFunctionStream(raw as ReadableStream<Uint8Array>, options.onLog ?? console.log, endpointPath, controller.signal)\n\t\t\t\t: parseFunctionRunResult(raw, endpointPath);\n\t\t\tif (result.status === 'failed' && (options.raiseOnFailure ?? true)) {\n\t\t\t\tthrow new FailedToRunCloudFunctionError(functionId, result.function_run_id, result);\n\t\t\t}\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tif (timedOut) {\n\t\t\t\tthrow new NotteTimeoutError(`Function ${functionId} run timed out after ${timeoutMs}ms`, { cause: error });\n\t\t\t}\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tclearTimeout(timer);\n\t\t}\n\t}\n\n\t/**\n\t * Get the download URL of the function code, decrypting it when the API\n\t * returns an encrypted one (Notte managed functions).\n\t *\n\t * @param options - Optional version and decryption-key override.\n\t * @returns An HTTP(S) URL for downloading the function source.\n\t * @throws InvalidRequestError if an encrypted URL has no usable decryption key.\n\t * @throws NotteError if decryption does not produce an HTTP(S) URL.\n\t * @example\n\t * const url = await fn.getUrl({ version: 'v1' });\n\t */\n\tasync getUrl(options: FunctionUrlOptions = {}): Promise<string> {\n\t\tconst { url } = await this.get(options);\n\t\tif (isHttpUrl(url)) {\n\t\t\treturn url;\n\t\t}\n\n\t\tconst decryptionKey = options.decryption_key ?? this.decryptionKey;\n\t\tif (decryptionKey === undefined) {\n\t\t\tthrow new InvalidRequestError(\n\t\t\t\t\"Decryption key is required to decrypt the function download url. Set it when creating the function, i.e. client.NotteFunction({ function_id: '<your-function-id>', decryption_key: '<your-key>' }).\",\n\t\t\t);\n\t\t}\n\n\t\tlet decrypted: string;\n\t\ttry {\n\t\t\tdecrypted = new Encryption(decryptionKey).decrypt(url);\n\t\t} catch (error) {\n\t\t\tthrow new InvalidRequestError(\n\t\t\t\t`Failed to decrypt the function download url: ${error instanceof Error ? error.message : String(error)}. Contact support@notte.cc if you need help.`,\n\t\t\t);\n\t\t}\n\n\t\tif (!isHttpUrl(decrypted)) {\n\t\t\tthrow new NotteError(\n\t\t\t\t'Failed to decrypt the function download url: the decrypted value is not a URL. Contact support@notte.cc if you need help.',\n\t\t\t);\n\t\t}\n\n\t\treturn decrypted;\n\t}\n\n\t/**\n\t * Download the function code as a python file. Returns the code, and writes\n\t * it to `path` when one is provided.\n\t *\n\t * @param options - Optional version, decryption key, and local `.py` destination path.\n\t * @returns The Python source text, including when a local destination is supplied.\n\t * @throws InvalidRequestError if the destination does not end in `.py` or the decryption key is invalid.\n\t * @throws NotteError if the source download fails. Local filesystem failures also propagate.\n\t * @example\n\t * const code = await fn.download({ path: './scraper.py' });\n\t */\n\tasync download(options: FunctionDownloadOptions = {}): Promise<string> {\n\t\tconst { path } = options;\n\t\tif (path !== undefined) {\n\t\t\tassertPythonPath(path);\n\t\t}\n\n\t\tconst url = await this.getUrl(options);\n\n\t\tlet response: Response;\n\t\ttry {\n\t\t\tresponse = await fetch(url, { signal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS) });\n\t\t} catch (error) {\n\t\t\t// The url is presigned, so it is deliberately kept out of the message.\n\t\t\tthrow new NotteError(\n\t\t\t\t`Failed to download function code in ${DOWNLOAD_TIMEOUT_MS / 1000} seconds: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t\t{ cause: error },\n\t\t\t);\n\t\t}\n\n\t\tif (!response.ok) {\n\t\t\tthrow new NotteError(`Failed to download function code: ${response.status} ${response.statusText}`);\n\t\t}\n\n\t\tconst code = await response.text();\n\t\tif (path !== undefined) {\n\t\t\tawait writeFile(path, code, 'utf8');\n\t\t}\n\n\t\treturn code;\n\t}\n\n\t/**\n\t * Call one of the run endpoints that the OpenAPI spec does not describe\n\t * (`FUNCTION_RUN_ENDPOINTS`). The generated client has no operation for\n\t * them, so this is the single place where they are hand-rolled; the request\n\t * and response shapes are transcribed from `notte_sdk.types`\n\t * (`CreateFunctionRunRequest` / `CreateFunctionRunResponse` and\n\t * `StartFunctionRunRequest` / `FunctionRunResponse`). Replace the callers\n\t * with generated operations once the spec exposes these paths.\n\t */\n\tprivate async postRunEndpoint<TResponse>(request: FunctionRunEndpointRequest): Promise<TResponse> {\n\t\tconst response = await this.client.getClient().post<{ 200: TResponse }, unknown, true>({\n\t\t\turl: request.url,\n\t\t\tpath: request.path,\n\t\t\tbody: request.body,\n\t\t\theaders: { 'Content-Type': 'application/json', ...request.headers },\n\t\t\tparseAs: request.parseAs ?? 'json',\n\t\t\tsignal: request.signal,\n\t\t\tthrowOnError: true,\n\t\t});\n\t\treturn response.data;\n\t}\n}\n\nfunction isHttpUrl(value: string): boolean {\n\treturn value.startsWith('https://') || value.startsWith('http://');\n}\n\nfunction assertPythonPath(path: string): void {\n\tif (!path.endsWith('.py')) {\n\t\tthrow new InvalidRequestError(`Code file path must end with .py, got '${path}'`);\n\t}\n}\n\n/** Read a local `.py` file into the multipart `file` field the API expects. */\nasync function readPythonFile(path: string): Promise<File> {\n\tassertPythonPath(path);\n\tlet bytes: Buffer;\n\ttry {\n\t\tbytes = await readFile(path);\n\t} catch (error) {\n\t\tthrow new InvalidRequestError(\n\t\t\t`The file '${path}' could not be read: ${error instanceof Error ? error.message : String(error)}`,\n\t\t);\n\t}\n\treturn new File([new Uint8Array(bytes)], basename(path), { type: 'text/x-python' });\n}\n\n/**\n * The execution runtime answers authentication failures with its own HTTP\n * envelope (`{ statusCode, headers, body }`) that the API relays with a 200.\n * Surface it as the `NotteAPIError` it really is.\n */\nfunction unwrapRuntimeEnvelope(candidate: Record<string, unknown>, path: string): void {\n\tconst { statusCode, body } = candidate;\n\tif (typeof statusCode !== 'number' || statusCode < 400 || !('body' in candidate)) {\n\t\treturn;\n\t}\n\tlet parsed: unknown = body;\n\tif (typeof body === 'string') {\n\t\ttry {\n\t\t\tparsed = JSON.parse(body);\n\t\t} catch {\n\t\t\tparsed = body;\n\t\t}\n\t}\n\tthrow NotteAPIError.fromBody(path, statusCode, parsed);\n}\n\n/** Validate the shape of a `FunctionRunResponse` returned by the API. */\nfunction parseFunctionRunResult(value: unknown, path: string): FunctionRunResult {\n\tif (typeof value !== 'object' || value === null) {\n\t\tthrow new NotteError('Invalid function result: expected an object');\n\t}\n\tconst candidate = value as Record<string, unknown>;\n\tunwrapRuntimeEnvelope(candidate, path);\n\tconst status = candidate.status;\n\tif (\n\t\ttypeof candidate.function_run_id !== 'string' ||\n\t\ttypeof candidate.function_id !== 'string' ||\n\t\ttypeof status !== 'string' ||\n\t\t!(FUNCTION_RUN_STATUSES as readonly string[]).includes(status) ||\n\t\t!('result' in candidate)\n\t) {\n\t\tthrow new NotteError('Invalid function result: missing function_id, function_run_id, status or result');\n\t}\n\treturn {\n\t\tfunction_id: candidate.function_id,\n\t\tfunction_run_id: candidate.function_run_id,\n\t\tsession_id: typeof candidate.session_id === 'string' ? candidate.session_id : null,\n\t\tresult: candidate.result,\n\t\tstatus: status as FunctionRunStatus,\n\t};\n}\n\n/** Consume SSE frames, including frames split across network/UTF-8 boundaries. */\nasync function readFunctionStream(\n\tbody: ReadableStream<Uint8Array> | null | undefined,\n\tonLog: (message: string) => void,\n\tpath: string,\n\tsignal?: AbortSignal,\n): Promise<FunctionRunResult> {\n\tif (!body?.getReader) {\n\t\tthrow new NotteError('Missing function response stream');\n\t}\n\tconst reader = body.getReader();\n\tconst onAbort = () => {\n\t\treader.cancel(signal?.reason).catch(() => {});\n\t};\n\tsignal?.addEventListener('abort', onAbort, { once: true });\n\tconst decoder = new TextDecoder();\n\tlet buffer = '';\n\tlet data: string[] = [];\n\tlet result: FunctionRunResult | undefined;\n\t// Kept only until the first SSE frame arrives, to decode a plain JSON body\n\t// (for example the runtime's authentication envelope) sent instead of a stream.\n\tlet sawFrame = false;\n\tlet raw = '';\n\tconst dispatch = () => {\n\t\tif (!data.length) return;\n\t\tconst payload = data.join('\\n');\n\t\tdata = [];\n\t\tlet event: { type?: unknown; message?: unknown };\n\t\ttry {\n\t\t\tevent = JSON.parse(payload) as { type?: unknown; message?: unknown };\n\t\t} catch (error) {\n\t\t\tthrow new NotteError(`Malformed function stream event: ${payload}`, { cause: error });\n\t\t}\n\t\tif (event.type === 'log') onLog(String(event.message ?? ''));\n\t\tif (event.type === 'error') throw new NotteError(`Function stream error: ${String(event.message ?? '')}`);\n\t\tif (event.type === 'result') {\n\t\t\tconst value: unknown = typeof event.message === 'string' ? JSON.parse(event.message) : event.message;\n\t\t\tresult = parseFunctionRunResult(value, path);\n\t\t}\n\t};\n\tconst line = (value: string) => {\n\t\tif (value === '') dispatch();\n\t\telse if (value.startsWith('data:')) {\n\t\t\tsawFrame = true;\n\t\t\tdata.push(value.slice(5).replace(/^ /, ''));\n\t\t}\n\t};\n\ttry {\n\t\twhile (true) {\n\t\t\tconst { value, done } = await reader.read();\n\t\t\tconst text = decoder.decode(value, { stream: !done });\n\t\t\tbuffer += text;\n\t\t\tif (!sawFrame) raw += text;\n\t\t\tlet end: number;\n\t\t\twhile ((end = buffer.indexOf('\\n')) !== -1) {\n\t\t\t\tline(buffer.slice(0, end).replace(/\\r$/, ''));\n\t\t\t\tbuffer = buffer.slice(end + 1);\n\t\t\t}\n\t\t\tif (done) break;\n\t\t}\n\t\tif (buffer) line(buffer.replace(/\\r$/, ''));\n\t\tdispatch();\n\t\tif (!result && !sawFrame && raw.trim().length > 0) {\n\t\t\tlet parsed: unknown;\n\t\t\ttry {\n\t\t\t\tparsed = JSON.parse(raw);\n\t\t\t} catch {\n\t\t\t\tthrow new NotteError(`Function stream ended without a result: ${raw.slice(0, 200)}`);\n\t\t\t}\n\t\t\tresult = parseFunctionRunResult(parsed, path);\n\t\t}\n\t\tif (!result) throw new NotteError('Function stream ended without a result');\n\t\treturn result;\n\t} finally {\n\t\tsignal?.removeEventListener('abort', onAbort);\n\t\tawait reader.cancel().catch(() => {});\n\t\treader.releaseLock();\n\t}\n}\n","import { createDecipheriv, createHmac, pbkdf2Sync, timingSafeEqual } from 'node:crypto';\n\nconst SALT_LENGTH = 16;\nconst PBKDF2_ITERATIONS = 100000;\nconst PBKDF2_KEY_LENGTH = 32;\n\nconst FERNET_VERSION = 0x80;\nconst FERNET_IV_LENGTH = 16;\nconst FERNET_HMAC_LENGTH = 32;\n// version byte + 8 byte timestamp + IV\nconst FERNET_HEADER_LENGTH = 1 + 8 + FERNET_IV_LENGTH;\n\n/**\n * Decrypts the tokens produced by the backend’s Fernet encryption helper.\n *\n * A token is `base64url(salt || fernet_token)`. The Fernet key is derived from\n * the root key with PBKDF2-HMAC-SHA256 (100k iterations) over that salt, and the\n * Fernet token itself is AES-128-CBC with an HMAC-SHA256 suffix.\n */\nexport class Encryption {\n\tprivate readonly rootKey: string;\n\n\tconstructor(rootKey: string) {\n\t\tif (!rootKey) {\n\t\t\tthrow new Error('Root key cannot be empty');\n\t\t}\n\t\tthis.rootKey = rootKey;\n\t}\n\n\tdecrypt(token: string): string {\n\t\tconst combined = Buffer.from(token, 'base64url');\n\t\tif (combined.length <= SALT_LENGTH) {\n\t\t\tthrow new Error('Invalid encrypted token: too short to contain a salt');\n\t\t}\n\n\t\tconst salt = combined.subarray(0, SALT_LENGTH);\n\t\tconst fernetToken = combined.subarray(SALT_LENGTH).toString('utf8');\n\t\tconst key = pbkdf2Sync(this.rootKey, salt, PBKDF2_ITERATIONS, PBKDF2_KEY_LENGTH, 'sha256');\n\n\t\treturn decryptFernet(fernetToken, key);\n\t}\n}\n\nfunction decryptFernet(token: string, key: Buffer): string {\n\tconst signingKey = key.subarray(0, 16);\n\tconst encryptionKey = key.subarray(16);\n\n\tconst data = Buffer.from(token, 'base64url');\n\tif (data.length < FERNET_HEADER_LENGTH + FERNET_HMAC_LENGTH) {\n\t\tthrow new Error('Invalid Fernet token: too short');\n\t}\n\tif (data[0] !== FERNET_VERSION) {\n\t\tthrow new Error(`Invalid Fernet token: unsupported version 0x${data[0].toString(16)}`);\n\t}\n\n\tconst signed = data.subarray(0, data.length - FERNET_HMAC_LENGTH);\n\tconst signature = data.subarray(data.length - FERNET_HMAC_LENGTH);\n\tconst expected = createHmac('sha256', signingKey).update(signed).digest();\n\tif (!timingSafeEqual(signature, expected)) {\n\t\tthrow new Error('Invalid Fernet token: signature verification failed');\n\t}\n\n\tconst iv = signed.subarray(9, FERNET_HEADER_LENGTH);\n\tconst ciphertext = signed.subarray(FERNET_HEADER_LENGTH);\n\tconst decipher = createDecipheriv('aes-128-cbc', encryptionKey, iv);\n\n\treturn Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString('utf8');\n}\n","import { createHash } from 'node:crypto';\nimport { prepareRunPayloadUpload } from '@/lib/client/sdk.gen';\nimport type { RunPayloadReference as UploadReference } from '@/lib/client/types.gen';\nimport type { NotteClient } from '@/client';\nimport type { FunctionRunUpdateRequest, GetFunctionRunResponse } from '@/functions';\n\ntype PayloadField = 'result' | 'logs' | 'variables';\nconst INLINE_FIELD_BYTES = 1024 * 1024;\nconst MAX_PAYLOAD_BYTES = 256 * 1024 * 1024;\n\n/** Upload large fields before sending the run's final metadata update. */\nexport async function offloadRunPayloads(\n\tclient: ReturnType<NotteClient['getClient']>,\n\tpath: { function_id: string; run_id: string },\n\tfields: FunctionRunUpdateRequest,\n): Promise<Record<string, unknown>> {\n\tconst data: Record<string, unknown> = { ...fields };\n\tconst references: Partial<Record<PayloadField, UploadReference>> = {};\n\t// The persisted result and read contract are text, including structured results.\n\tif (data.result != null && typeof data.result !== 'string') data.result = JSON.stringify(data.result);\n\tfor (const field of ['result', 'logs', 'variables'] as const) {\n\t\tif (data[field] == null) continue;\n\t\tconst payload = Buffer.from(JSON.stringify(data[field]), 'utf8');\n\t\tif (payload.length > MAX_PAYLOAD_BYTES) throw new Error(`Function run ${field} exceeds the payload limit`);\n\t\tif (payload.length <= INLINE_FIELD_BYTES) continue;\n\t\tconst checksum = createHash('sha256').update(payload).digest('base64');\n\t\tconst prepared = await prepareRunPayloadUpload({\n\t\t\tclient,\n\t\t\tpath: { ...path, field },\n\t\t\tbody: { size_bytes: payload.length, sha256: checksum },\n\t\t\tthrowOnError: true,\n\t\t});\n\t\tconst upload = prepared.data;\n\t\tif (upload.reference.size_bytes !== payload.length || upload.reference.sha256 !== checksum) {\n\t\t\tthrow new Error('Run payload upload reference does not match the local payload');\n\t\t}\n\t\tif (new URL(upload.url).protocol !== 'https:') throw new Error('Invalid run payload URL');\n\t\t// This request bypasses the authenticated API client and cannot follow redirects.\n\t\tconst response = await fetch(upload.url, {\n\t\t\tmethod: 'PUT', body: payload, headers: upload.headers,\n\t\t\tredirect: 'error', signal: AbortSignal.timeout(300_000),\n\t\t});\n\t\tawait response.body?.cancel();\n\t\tif (!response.ok) throw new Error(`Run payload upload failed (${response.status})`);\n\t\treferences[field] = upload.reference;\n\t\tif (field === 'result' && typeof data.result === 'string') data.result_preview = data.result.slice(0, 16000);\n\t\tdelete data[field];\n\t}\n\tif (Object.keys(references).length) data.payloads = references;\n\treturn data;\n}\n\nexport type RunWithPayloads = GetFunctionRunResponse & {\n\tpayloads?: Partial<Record<PayloadField, { size_bytes: number; sha256: string }>>;\n\tpayload_urls?: Partial<Record<PayloadField, string>>;\n};\n\n/** Decode large fields on the client, never through API JSON buffering. */\nexport async function resolveRunPayloads(input: RunWithPayloads): Promise<GetFunctionRunResponse> {\n\tconst run = { ...input };\n\tfor (const [field, reference] of Object.entries(run.payloads ?? {})) {\n\t\tif (!['result', 'logs', 'variables'].includes(field)) throw new Error('Unknown run payload field');\n\t\tif (!Number.isSafeInteger(reference.size_bytes) || reference.size_bytes <= 0 || reference.size_bytes > 256 * 1024 * 1024) {\n\t\t\tthrow new Error('Invalid run payload size');\n\t\t}\n\t\tconst url = run.payload_urls?.[field as PayloadField];\n\t\tif (!url || new URL(url).protocol !== 'https:') throw new Error('Invalid run payload URL');\n\t\t// Use a separate fetch so API authentication and preview headers cannot\n\t\t// follow the signed URL to storage.\n\t\tconst response = await fetch(url, { redirect: 'error', signal: AbortSignal.timeout(300_000) });\n\t\tif (!response.ok || !response.body) throw new Error(`Run payload download failed (${response.status})`);\n\t\tconst reader = response.body.getReader();\n\t\tconst chunks: Uint8Array[] = [];\n\t\tconst hash = createHash('sha256');\n\t\tlet size = 0;\n\t\ttry {\n\t\t\twhile (true) {\n\t\t\t\tconst { done, value } = await reader.read();\n\t\t\t\tif (done) break;\n\t\t\t\tsize += value.length;\n\t\t\t\tif (size > reference.size_bytes) throw new Error('Run payload exceeds its declared size');\n\t\t\t\thash.update(value);\n\t\t\t\tchunks.push(value);\n\t\t\t}\n\t\t} finally {\n\t\t\tawait reader.cancel();\n\t\t\treader.releaseLock();\n\t\t}\n\t\tif (size !== reference.size_bytes || hash.digest('base64') !== reference.sha256) {\n\t\t\tthrow new Error('Run payload failed size/checksum verification');\n\t\t}\n\t\tconst value: unknown = JSON.parse(Buffer.concat(chunks, size).toString('utf8'));\n\t\tif (field === 'result' && value !== null && typeof value !== 'string') throw new Error('Invalid stored result');\n\t\tif (field === 'logs' && (!Array.isArray(value) || !value.every(line => typeof line === 'string'))) throw new Error('Invalid stored logs');\n\t\tif (field === 'variables' && value !== null && (typeof value !== 'object' || Array.isArray(value))) throw new Error('Invalid stored variables');\n\t\tObject.assign(run, { [field]: value });\n\t}\n\tdelete run.payloads;\n\tdelete run.payload_urls;\n\treturn run;\n}\n","import { createWriteStream } from 'node:fs';\nimport { link, mkdir, readFile, rename, rm, stat } from 'node:fs/promises';\nimport { basename, extname, join } from 'node:path';\nimport { randomBytes } from 'node:crypto';\nimport { Readable } from 'node:stream';\nimport { pipeline } from 'node:stream/promises';\nimport type { ReadableStream as NodeReadableStream } from 'node:stream/web';\n\nimport type { NotteClient } from '@/client';\nimport type { Client } from '@/lib/client/client/types.gen';\nimport type { FileSource, SessionFile, SessionFilesPage } from '@/lib/client/types.gen';\nimport { deleteSessionFile, downloadSessionFile, listSessionFiles, uploadSessionFile } from '@/lib/client/sdk.gen';\nimport { InvalidRequestError, NotteError } from '@/errors';\n\nexport type { FileSource, SessionFile, SessionFilesPage };\n\n/** A file ID was not found in the session, the counterpart of Python's `FileNotFoundError`. */\nexport class FileNotFoundError extends NotteError {}\n\n/** The download destination already exists, the counterpart of Python's `FileExistsError`. */\nexport class FileExistsError extends NotteError {}\n\nexport interface FileListOptions {\n /** Only return files from this source: `user_upload` or `session_download`. */\n source?: FileSource;\n /** Page size. Defaults to 100. */\n limit?: number;\n /** Page offset. Defaults to 0. */\n offset?: number;\n}\n\nexport interface FileDownloadOptions {\n /** Overwrite an existing local file instead of rejecting with `FileExistsError`. */\n force?: boolean;\n}\n\n/** Bytes accepted by `upload()`: a local path, a `Blob`/`File`, or an in-memory buffer. */\nexport type UploadableFile = string | Blob | Uint8Array;\n\n/** Page size used when scanning a session for a file ID, like Python's `metadata()`. */\nconst METADATA_PAGE_SIZE = 1000;\n\nconst MIME_TYPES_BY_EXTENSION: Record<string, string> = {\n '.csv': 'text/csv',\n '.gif': 'image/gif',\n '.htm': 'text/html',\n '.html': 'text/html',\n '.jpeg': 'image/jpeg',\n '.jpg': 'image/jpeg',\n '.json': 'application/json',\n '.md': 'text/markdown',\n '.pdf': 'application/pdf',\n '.png': 'image/png',\n '.svg': 'image/svg+xml',\n '.txt': 'text/plain',\n '.webp': 'image/webp',\n '.xml': 'application/xml',\n '.zip': 'application/zip',\n};\n\nfunction guessMimeType(filename: string): string {\n return MIME_TYPES_BY_EXTENSION[extname(filename).toLowerCase()] ?? 'application/octet-stream';\n}\n\n/**\n * Reduce a server-provided filename to a safe basename, like Python's\n * `Path(PureWindowsPath(filename).name).name`: both separators are honoured,\n * drive letters are dropped and only the last component is kept.\n */\nexport function sanitizeFilename(filename: string): string {\n const segment = filename.split(/[\\\\/]+/).filter(Boolean).pop() ?? '';\n return segment.replace(/^[a-zA-Z]:/, '');\n}\n\nfunction toFile(file: Blob | Uint8Array, filename: string): File {\n if (file instanceof File && file.name === filename) {\n return file;\n }\n const type = file instanceof Blob && file.type ? file.type : guessMimeType(filename);\n return new File([file as BlobPart], filename, { type });\n}\n\n/**\n * Session-scoped file operations built on the generated `sessions/{id}/files`\n * client. Every API failure rejects with a `NotteAPIError`.\n *\n * ```ts\n * const files = client.Files(sessionId);\n * const uploaded = await files.upload(new Blob(['hello']), 'hello.txt');\n * const page = await files.list({ source: 'user_upload' });\n * ```\n */\nexport class SessionFiles {\n constructor(\n private readonly client: Client,\n readonly sessionId: string,\n ) {}\n\n /**\n * Upload bytes as a session file. `filename` is what the browser sees when\n * the file is later attached to a page.\n *\n * @param file - Bytes to upload as a Blob, File, or buffer.\n * @param filename - Stored filename, defaulting to `file`.\n * @returns Metadata for the uploaded file, including its ID, name, and size.\n * @throws NotteAPIError if the storage API request fails.\n */\n async upload(file: Blob | Uint8Array, filename = 'file'): Promise<SessionFile> {\n const response = await uploadSessionFile({\n client: this.client,\n path: { session_id: this.sessionId },\n body: { file: toFile(file, filename) },\n throwOnError: true,\n });\n return response.data;\n }\n\n /** List the session's non-expired files, newest first.\n *\n * @param options - Optional source filter and pagination. Defaults to all sources, limit 100, and offset 0.\n * @returns One page of non-expired files and the total count; pagination is not automatic.\n * @throws NotteAPIError if the storage API request fails.\n */\n async list(options: FileListOptions = {}): Promise<SessionFilesPage> {\n const response = await listSessionFiles({\n client: this.client,\n path: { session_id: this.sessionId },\n query: options,\n throwOnError: true,\n });\n return response.data;\n }\n\n /**\n * Find a file's metadata by ID by scanning the session listing. Rejects with\n * `FileNotFoundError` when the ID is unknown or expired.\n *\n * @param fileId - ID of a file belonging to this session.\n * @returns The matching file's metadata.\n * @throws NotteAPIError if the storage API request fails.\n * @throws FileNotFoundError if the file ID is unknown or expired.\n */\n async metadata(fileId: string): Promise<SessionFile> {\n let offset = 0;\n while (true) {\n const page = await this.list({ limit: METADATA_PAGE_SIZE, offset });\n const match = page.files.find(file => file.id === fileId);\n if (match) {\n return match;\n }\n offset += page.files.length;\n if (offset >= page.total || page.files.length === 0) {\n throw new FileNotFoundError(`File ${fileId} was not found in session ${this.sessionId}`);\n }\n }\n }\n\n /** Download a file's bytes as a `Blob`.\n *\n * @param fileId - ID of a file belonging to this session.\n * @returns The downloaded bytes as a Blob; no local file is written.\n * @throws NotteAPIError if the storage API request fails.\n */\n async download(fileId: string): Promise<Blob> {\n const response = await downloadSessionFile({\n client: this.client,\n path: { session_id: this.sessionId, file_id: fileId },\n parseAs: 'blob',\n throwOnError: true,\n });\n return response.data as Blob;\n }\n\n /** Stream a file's bytes. Used by `RemoteFileStorage.download()` to write to disk without buffering. */\n async stream(fileId: string): Promise<ReadableStream<Uint8Array>> {\n const response = await downloadSessionFile({\n client: this.client,\n path: { session_id: this.sessionId, file_id: fileId },\n parseAs: 'stream',\n throwOnError: true,\n });\n const body = response.data as ReadableStream<Uint8Array> | null;\n if (!body) {\n throw new NotteError(`Download of file ${fileId} returned no body`);\n }\n return body;\n }\n\n /** Delete a session file.\n *\n * @param fileId - ID of the session file to delete.\n * @returns Resolves when deletion succeeds.\n * @throws NotteAPIError if the storage API request fails.\n */\n async delete(fileId: string): Promise<void> {\n await deleteSessionFile({\n client: this.client,\n path: { session_id: this.sessionId, file_id: fileId },\n throwOnError: true,\n });\n }\n}\n\n/**\n * File storage bound to a session, the counterpart of Python's\n * `RemoteFileStorage`. Create it unbound and pass it to `client.Session({ storage })`\n * so the session binds it on start, or bind it yourself with a session ID.\n *\n * ```ts\n * const storage = client.FileStorage(sessionId);\n * const uploaded = await storage.upload('./resume.pdf');\n * const localPath = await storage.download(uploaded.id, './downloads');\n * const blob = await storage.downloadBlob(uploaded.id);\n * ```\n *\n * `download()` saves to disk; `downloadBlob()` returns bytes in memory, and\n * `stream()` returns a readable stream. For lower-level session file access,\n * see [NotteClient.Files](/typescript-sdk-reference/client/files).\n *\n */\nexport class RemoteFileStorage {\n private _sessionId: string | null;\n\n constructor(\n readonly client: NotteClient,\n sessionId?: string,\n ) {\n this._sessionId = sessionId ?? null;\n }\n\n /** Bind the storage to a session. Called by `Session.start()` when the storage was passed to the session. */\n setSessionId(sessionId: string): void {\n this._sessionId = sessionId;\n }\n\n /**\n * Bind this storage once, cloning it when another session already owns it.\n *\n * ```ts\n * const first = storage.forSession('session-a'); // first === storage\n * const second = storage.forSession('session-b'); // a clone sharing the client\n * ```\n */\n forSession(sessionId: string): RemoteFileStorage {\n if (this._sessionId === null) {\n this._sessionId = sessionId;\n return this;\n }\n if (this._sessionId === sessionId) {\n return this;\n }\n return new RemoteFileStorage(this.client, sessionId);\n }\n\n /** ID of the bound session. Throws `InvalidRequestError` while the storage is unbound. */\n get sessionId(): string {\n if (this._sessionId === null) {\n throw new InvalidRequestError('A session ID is required for every file operation');\n }\n return this._sessionId;\n }\n\n /** Whether the storage has been bound to a session yet. */\n get isBound(): boolean {\n return this._sessionId !== null;\n }\n\n private files(): SessionFiles {\n return new SessionFiles(this.client.getClient(), this.sessionId);\n }\n\n /**\n * Upload a file to the session. A string is read as a local path and its\n * basename becomes the uploaded filename unless `uploadFileName` is set.\n *\n * @param file - Local file path, Blob, File, or buffer to upload.\n * @param uploadFileName - Optional stored filename. Local paths default to their basename; File objects keep their name.\n * @returns Metadata for the uploaded file, including its ID, name, and size.\n * @throws NotteAPIError if the storage API request fails.\n * @throws InvalidRequestError if storage has not been bound to a session.\n * @throws InvalidRequestError if a supplied local path is not a file.\n * @example\n * await storage.upload('./data/resume.pdf');\n * await storage.upload(Buffer.from('hello'), 'hello.txt');\n */\n async upload(file: UploadableFile, uploadFileName?: string): Promise<SessionFile> {\n const files = this.files();\n if (typeof file === 'string') {\n const info = await stat(file).catch(() => null);\n if (!info?.isFile()) {\n throw new InvalidRequestError(`Cannot upload file ${file}: it is not a file`);\n }\n const bytes = await readFile(file);\n return files.upload(bytes, uploadFileName ?? basename(file));\n }\n const filename = uploadFileName ?? (file instanceof File ? file.name : 'file');\n return files.upload(file, filename);\n }\n\n /**\n * List the session's files.\n *\n * @param options - Optional source filter and pagination. Defaults to all sources, limit 100, and offset 0.\n * @returns One page of non-expired files and the total count; pagination is not automatic.\n * @throws NotteAPIError if the storage API request fails.\n * @throws InvalidRequestError if storage has not been bound to a session.\n * @example\n * const downloads = await storage.list({ source: 'session_download', limit: 1000 });\n */\n async list(options: FileListOptions = {}): Promise<SessionFilesPage> {\n return this.files().list(options);\n }\n\n /** Metadata of a file by ID. Rejects with `FileNotFoundError` when unknown.\n *\n * @param fileId - ID of a file belonging to this session.\n * @returns The matching file's metadata.\n * @throws NotteAPIError if the storage API request fails.\n * @throws FileNotFoundError if the file ID is unknown or expired.\n * @throws InvalidRequestError if storage has not been bound to a session.\n */\n async metadata(fileId: string): Promise<SessionFile> {\n return this.files().metadata(fileId);\n }\n\n /**\n * Download a file to `<localDir>/<filename>` and return the local path. The\n * file is written atomically (temporary file + rename). Rejects with\n * `FileExistsError` when the destination exists unless `force` is set.\n *\n * @param fileId - ID of the file to download.\n * @param localDir - Destination directory, created if needed. Defaults to the current directory.\n * @param options - Set `force` to overwrite an existing destination; defaults to false.\n * @returns The local file path after the download has been written successfully.\n * @throws NotteAPIError if the storage API request fails.\n * @throws InvalidRequestError if storage has not been bound to a session.\n * @throws FileExistsError if the destination exists and `force` is false. Filesystem errors also propagate.\n * @example\n * const path = await storage.download(fileId, './downloads', { force: true });\n */\n async download(fileId: string, localDir = '.', options: FileDownloadOptions = {}): Promise<string> {\n const files = this.files();\n const metadata = await files.metadata(fileId);\n const safeName = sanitizeFilename(metadata.filename);\n if (safeName === '' || safeName === '.' || safeName === '..') {\n throw new NotteError(`Unsafe filename returned for file ${fileId}: ${JSON.stringify(metadata.filename)}`);\n }\n await mkdir(localDir, { recursive: true });\n const destination = join(localDir, safeName);\n if (!options.force) {\n // Fail fast before the transfer; the atomic `link` below is the real guard.\n const exists = await stat(destination).then(() => true, () => false);\n if (exists) {\n throw new FileExistsError(`${destination} already exists; pass force: true to overwrite it`);\n }\n }\n\n const body = await files.stream(fileId);\n // Unpredictable name plus O_EXCL: a pre-planted symlink is never followed.\n const temporary = join(localDir, `.${safeName}.${randomBytes(8).toString('hex')}.part`);\n try {\n await pipeline(\n Readable.fromWeb(body as unknown as NodeReadableStream<Uint8Array>),\n createWriteStream(temporary, { flags: 'wx' }),\n );\n if (options.force) {\n await rename(temporary, destination);\n } else {\n // `link` fails with EEXIST instead of replacing a file created after the\n // check above, so the no-overwrite contract holds under concurrency.\n try {\n await link(temporary, destination);\n } catch (error) {\n if ((error as { code?: string }).code === 'EEXIST') {\n throw new FileExistsError(`${destination} already exists; pass force: true to overwrite it`);\n }\n throw error;\n }\n await rm(temporary, { force: true });\n }\n } catch (error) {\n await rm(temporary, { force: true });\n throw error;\n }\n return destination;\n }\n\n /** Download a file's bytes as a `Blob` without touching the local filesystem. */\n async downloadBlob(fileId: string): Promise<Blob> {\n return this.files().download(fileId);\n }\n\n /** Stream a file's bytes without buffering the whole file in memory. */\n async stream(fileId: string): Promise<ReadableStream<Uint8Array>> {\n return this.files().stream(fileId);\n }\n\n /** Delete a session file.\n *\n * @param fileId - ID of the session file to delete.\n * @returns Resolves when deletion succeeds.\n * @throws NotteAPIError if the storage API request fails.\n * @throws InvalidRequestError if storage has not been bound to a session.\n */\n async delete(fileId: string): Promise<void> {\n await this.files().delete(fileId);\n }\n}\n","import type { NotteClient } from '@/client';\nimport { NotteError } from '@/errors';\nimport type { AnythingStartRequest } from '@/lib/client/types.gen';\nimport { anythingStart } from '@/lib/client/sdk.gen';\n\n/** Body of `POST /anything/start`: the natural-language description of the task. */\nexport type AnythingStartOptions = AnythingStartRequest;\n\n/**\n * One event of the AI SDK UI message stream. `type` names the event (for\n * example `text-delta`); the remaining keys depend on that type, so read them\n * at runtime rather than relying on a fixed shape.\n */\nexport type AnythingStreamChunk = { type: string } & Record<string, unknown>;\n\n/**\n * Result of `POST /anything/start`. The endpoint answers with an\n * [AI SDK UI message stream](https://ai-sdk.dev/docs/ai-sdk-ui/stream-protocol),\n * not a JSON document, so the run is exposed as chunks to iterate rather than\n * an object to read.\n */\nexport type AnythingStartResult = {\n /** Thread handling this run, from the `x-thread-id` response header. */\n threadId: string | null;\n /** Value of the `x-vercel-ai-ui-message-stream` header: the stream-format version. */\n uiMessageStreamVersion: string | null;\n /** Events of the stream, in order, until the terminating `[DONE]`. */\n chunks: AsyncGenerator<AnythingStreamChunk>;\n};\n\n/** Parse an AI SDK UI message stream into its events. */\nasync function* readAnythingStream(\n body: ReadableStream<Uint8Array>,\n): AsyncGenerator<AnythingStreamChunk> {\n const reader = body.getReader();\n const decoder = new TextDecoder();\n let buffer = '';\n try {\n while (true) {\n const { value, done } = await reader.read();\n buffer += decoder.decode(value, { stream: !done });\n let end: number;\n while ((end = buffer.indexOf('\\n')) !== -1) {\n // Frames may be terminated with CRLF; drop the carriage return.\n const line = buffer.slice(0, end).replace(/\\r$/, '');\n buffer = buffer.slice(end + 1);\n if (!line.startsWith('data:')) continue;\n const payload = line.slice(5).replace(/^ /, '');\n if (payload === '[DONE]') return;\n try {\n yield JSON.parse(payload) as AnythingStreamChunk;\n } catch (error) {\n throw new NotteError(`Malformed Anything stream event: ${payload}`, { cause: error });\n }\n }\n if (done) break;\n }\n } finally {\n await reader.cancel().catch(() => {});\n reader.releaseLock();\n }\n}\n\n/**\n * Anything API, the counterpart of `POST /anything/start`: turn a plain-English\n * description of a web task into a running automation.\n *\n * ```ts\n * const { threadId, chunks } = await client.anything.start({ task: 'fetch the top 3 hacker news posts' });\n * console.log('Thread ID:', threadId);\n * for await (const chunk of chunks) {\n * console.log(chunk.type, chunk);\n * }\n * ```\n */\nexport class NotteAnything {\n private readonly client: NotteClient;\n\n constructor(client: NotteClient) {\n this.client = client;\n }\n\n /**\n * Start a run for `task` and stream the agent's progress back.\n *\n * Running is slow (minutes) and billable; prefer the marketplace\n * (`client.functions.list()`) when a ready-made function already fits.\n *\n * The returned `chunks` generator holds the connection open — iterate it to\n * completion, or `return`/`break` out of the loop to cancel and release the\n * stream.\n *\n * ```ts\n * const run = await client.anything.start({ task: 'get the weather in Paris' });\n * for await (const chunk of run.chunks) {\n * if (chunk.type === 'text-delta') process.stdout.write(String(chunk.delta ?? ''));\n * }\n * ```\n *\n * Rejects with a `NotteAPIError` when the API answers with a non-2xx status.\n */\n async start(body: AnythingStartOptions): Promise<AnythingStartResult> {\n const { data, response } = await anythingStart({\n client: this.client.getClient(),\n body,\n parseAs: 'stream',\n throwOnError: true,\n });\n const stream = data as ReadableStream<Uint8Array> | null;\n if (!stream) {\n throw new NotteError('Anything start returned no response stream');\n }\n return {\n threadId: response.headers.get('x-thread-id'),\n uiMessageStreamVersion: response.headers.get('x-vercel-ai-ui-message-stream'),\n chunks: readAnythingStream(stream),\n };\n }\n}\n","import type { NotteClient } from '@/client';\nimport type {\n ListSecretsData,\n SecretListResponse,\n SecretMetadata,\n SecretNamespace,\n SecretStoreRequest,\n SecretValueResponse,\n} from '@/lib/client/types.gen';\nimport { deleteSecret, getSecret, listSecrets, storeSecret } from '@/lib/client/sdk.gen';\n\n/** Options of `client.secrets.list()`: optionally filter by namespace. */\nexport type SecretListOptions = NonNullable<ListSecretsData['query']>;\n/** Body of `client.secrets.store()`. */\nexport type SecretStoreOptions = SecretStoreRequest;\n\nexport type { SecretListResponse, SecretMetadata, SecretNamespace, SecretValueResponse };\n\n/**\n * Workspace secrets store, the counterpart of the `/secrets` endpoints.\n * Secrets are scoped by namespace: `llm_provider` keys are used by agents and\n * scraping, `function_env` values are injected into function runs.\n *\n * ```ts\n * await client.secrets.store({ namespace: 'function_env', name: 'MY_TOKEN', value: 'xyz' });\n * const secrets = await client.secrets.list({ namespace: 'function_env' });\n * ```\n */\nexport class NotteSecrets {\n private readonly client: NotteClient;\n\n constructor(client: NotteClient) {\n this.client = client;\n }\n\n /**\n * List secret metadata (never the values), optionally filtered by namespace.\n *\n * ```ts\n * const secrets = await client.secrets.list({ namespace: 'llm_provider' });\n * secrets.forEach(s => console.log(s.name, s.key_hint));\n * ```\n */\n async list(options: SecretListOptions = {}): Promise<SecretMetadata[]> {\n const response = await listSecrets({ client: this.client.getClient(), query: options, throwOnError: true });\n return response.data?.items ?? [];\n }\n\n /**\n * Store (or overwrite) a secret and return its metadata.\n *\n * ```ts\n * const meta = await client.secrets.store({ namespace: 'function_env', name: 'API_TOKEN', value: 'xyz' });\n * console.log(meta.id, meta.key_hint);\n * ```\n */\n async store(body: SecretStoreOptions): Promise<SecretMetadata> {\n const response = await storeSecret({ client: this.client.getClient(), body, throwOnError: true });\n return response.data;\n }\n\n /**\n * Read the value of a secret by name within a namespace.\n *\n * ```ts\n * const { value } = await client.secrets.get('API_TOKEN', 'function_env');\n * ```\n */\n async get(name: string, namespace: SecretNamespace): Promise<SecretValueResponse> {\n const response = await getSecret({\n client: this.client.getClient(),\n path: { name },\n query: { namespace },\n throwOnError: true,\n });\n return response.data;\n }\n\n /**\n * Delete a secret by id (the `id` field of `SecretMetadata`).\n *\n * ```ts\n * const meta = await client.secrets.store({ namespace: 'function_env', name: 'TMP', value: 'x' });\n * await client.secrets.delete(meta.id);\n * ```\n */\n async delete(secretId: string): Promise<void> {\n await deleteSecret({ client: this.client.getClient(), path: { secret_id: secretId }, throwOnError: true });\n }\n}\n","import type { NotteClient } from '@/client';\nimport type {\n GetUsageData,\n GetUsageLogsData,\n PaginatedResponseUsageLog,\n UsageLog,\n UsageResponse,\n} from '@/lib/client/types.gen';\nimport { getUsage, getUsageLogs } from '@/lib/client/sdk.gen';\n\n/** Options of `client.usage.get()`: the monthly period, e.g. `\"May 2025\"`. Defaults to the current month. */\nexport type UsageOptions = NonNullable<GetUsageData['query']>;\n/** Options of `client.usage.logs()`: endpoint filter and pagination. */\nexport type UsageLogsOptions = NonNullable<GetUsageLogsData['query']>;\n/** Endpoint names accepted by `UsageLogsOptions.endpoint`. */\nexport type UsageLogEndpoint = NonNullable<UsageLogsOptions['endpoint']>;\n\nexport type { PaginatedResponseUsageLog, UsageLog, UsageResponse };\n\n/**\n * Usage and billing, the counterpart of `GET /usage` and `GET /usage/logs`.\n *\n * ```ts\n * const usage = await client.usage.get();\n * console.log(usage.total_cost, usage.balance_amount);\n * ```\n */\nexport class NotteUsage {\n private readonly client: NotteClient;\n\n constructor(client: NotteClient) {\n this.client = client;\n }\n\n /**\n * Usage summary for a monthly period (current month by default).\n *\n * ```ts\n * const usage = await client.usage.get({ period: 'May 2025' });\n * console.log(`${usage.session_count} sessions, $${usage.total_cost}`);\n * ```\n */\n async get(options: UsageOptions = {}): Promise<UsageResponse> {\n const response = await getUsage({ client: this.client.getClient(), query: options, throwOnError: true });\n return response.data;\n }\n\n /**\n * Paginated per-request usage logs, optionally filtered by endpoint.\n *\n * ```ts\n * const page = await client.usage.logs({ endpoint: 'sessions.start', page: 1, page_size: 50 });\n * page.items.forEach(log => console.log(log.created_at, log.endpoint, log.duration_ms));\n * ```\n */\n async logs(options: UsageLogsOptions = {}): Promise<PaginatedResponseUsageLog> {\n const response = await getUsageLogs({ client: this.client.getClient(), query: options, throwOnError: true });\n return response.data;\n }\n}\n","import { NotteManagedAuth, type AuthSessionResponse as SessionResponse } from '@/managed-auth';\nimport { createClient } from '@/lib/client/client';\nimport { createResources } from '@/resources.gen';\nimport { getParseAs } from '@/lib/client/client/utils.gen';\nimport { Session, type SessionOptions } from '@/session';\nimport type {\n FunctionListItemResponse,\n GlobalScrapeRequest,\n ListFunctionsData,\n ListSessionsData,\n ListVaultsData,\n PersonaResponse,\n Vault,\n} from '@/lib/client/types.gen';\nimport { NotteVault, type VaultConstructor } from '@/vaults';\nimport { NottePersona, withPersonaDefaults, type PersonaConstructor, type PersonaListOptions } from '@/personas';\nimport { NotteFunction, type FunctionConstructor } from '@/functions';\nimport {\n healthCheck,\n listFunctions,\n listPersonas,\n listSessions,\n listVaults,\n scrapeWebpage,\n searchWeb,\n} from '@/lib/client/sdk.gen';\nimport {\n buildScrapeBody,\n processScrapeResponse,\n type ScrapeOptions,\n type ScrapeResult,\n type StructuredData,\n type ZodLikeSchema,\n} from '@/scrape';\nimport { SDK_VERSION } from '@/version';\nimport { RemoteFileStorage, SessionFiles } from '@/files';\nimport type { SearchOptions, SearchResponse, SearchResultsResponse, SearchSourcedAnswerResponse, SearchStructuredResponse } from '@/search';\nimport { NotteAnything } from '@/anything';\nimport { NotteSecrets } from '@/secrets';\nimport { NotteUsage } from '@/usage';\nimport {\n AuthenticationError,\n InvalidRequestError,\n NotteAPIError,\n NotteAPIExecutionError,\n NotteTimeoutError,\n normalizeErrorBody,\n} from '@/errors';\nimport { createUpgradeErrorMessage, startVersionCheck, upgradeSuggestion } from '@/version-check';\nimport { createRetryingFetch, DEFAULT_MAX_RETRIES } from '@/retry';\n\nexport const DEFAULT_NOTTE_API_URL = 'https://api.notte.cc';\nexport const DEFAULT_REQUEST_TIMEOUT_MS = 60_000;\n/** Request origin header, the Node counterpart of `sdk-python`. */\nexport const REQUEST_ORIGIN = 'sdk-node';\n/**\n * Per-call header read by the client's request interceptor to override the\n * default request timeout. `0` disables the timeout (streaming responses).\n * The header is stripped before the request leaves the process.\n */\nexport const TIMEOUT_HEADER = 'x-notte-timeout-ms';\n/**\n * Per-call header read by the request interceptor to override `maxRetries`\n * for one request. Stripped before the request leaves the process.\n */\nexport const MAX_RETRIES_HEADER = 'x-notte-max-retries';\nconst DB_PREVIEW_ENV = 'NOTTE_DB_PREVIEW_BRANCH';\nconst DB_PREVIEW_HEADER = 'x-db-preview';\nconst EXECUTION_ERROR_CLASS = 'NotteApiExecutionError';\n\nexport interface NotteClientConfig {\n /** API base URL. Defaults to `NOTTE_API_URL` or `https://api.notte.cc`. */\n baseUrl?: string;\n /** API key. Defaults to `NOTTE_API_KEY`. Optional only for relative proxy base URLs. */\n apiKey?: string;\n /** Default per-request timeout in milliseconds. Defaults to 60 000, like the Python SDK. */\n timeoutMs?: number;\n /** Maximum CAPTCHA wait in seconds, separate from each HTTP timeout. Defaults to 180. */\n captchaTimeoutSeconds?: number;\n /** Database preview branch. Defaults to `NOTTE_DB_PREVIEW_BRANCH`. Internal. */\n dbPreview?: string;\n /** Log every request like `NotteClient(verbose=True)` in Python. */\n verbose?: boolean;\n /**\n * Retries for transient failures (502, 503, 504, 529, and connection\n * errors), with exponential backoff and full jitter. `Retry-After` is\n * honored. POST and PATCH requests are only retried when the API cannot\n * have processed them (503, 529, connection refused), so they are never\n * applied twice. All attempts share the request timeout. Defaults to 3;\n * `0` disables retries.\n */\n maxRetries?: number;\n}\n\nexport type SessionListOptions = NonNullable<ListSessionsData['query']>;\nexport type VaultListOptions = NonNullable<ListVaultsData['query']>;\nexport type FunctionListOptions = NonNullable<ListFunctionsData['query']>;\n/** Options of `client.scrape()`: the global scrape request minus `url`, plus the SDK-only scrape options. */\nexport type GlobalScrapeOptions<T = unknown> = Omit<GlobalScrapeRequest, 'url' | 'response_format' | 'wait_for_authentication' | 'only_images'> & ScrapeOptions<T> & {\n /** Whether to wait for Managed Auth before the scrape request completes. Defaults to true. Authentication failure or timeout can fail the scrape request. */\n wait_for_authentication?: boolean;\n};\n\ntype ResolvedConfig = Required<Pick<NotteClientConfig, 'baseUrl' | 'timeoutMs' | 'verbose' | 'captchaTimeoutSeconds' | 'maxRetries'>> &\n Pick<NotteClientConfig, 'apiKey' | 'dbPreview'>;\n\nfunction isRelativeProxyUrl(baseUrl: string): boolean {\n // '/api/notte' is a same-origin proxy path; '//host' is protocol-relative and not allowed.\n return /^\\/(?!\\/)/.test(baseUrl);\n}\n\n/** Entry point for sessions, functions, vaults, personas, and session files. */\nexport class NotteClient {\n private readonly config: ResolvedConfig;\n private readonly client = createClient();\n private readonly resources = createResources(this.client, () => this.config.apiKey ?? '');\n\n constructor(config: NotteClientConfig = {}) {\n const apiKey = config.apiKey || process.env.NOTTE_API_KEY;\n const baseUrl = config.baseUrl || process.env.NOTTE_API_URL || DEFAULT_NOTTE_API_URL;\n const dbPreview = config.dbPreview || process.env[DB_PREVIEW_ENV] || undefined;\n const timeoutMs = config.timeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;\n const captchaTimeoutSeconds = config.captchaTimeoutSeconds ?? 180;\n if (!Number.isFinite(captchaTimeoutSeconds) || captchaTimeoutSeconds <= 0) {\n throw new InvalidRequestError('captchaTimeoutSeconds must be positive and finite');\n }\n if (!(timeoutMs >= 0)) {\n throw new InvalidRequestError('timeoutMs must be a non-negative number');\n }\n const maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES;\n if (!Number.isInteger(maxRetries) || maxRetries < 0) {\n throw new InvalidRequestError('maxRetries must be a non-negative integer');\n }\n\n // Only skip the apiKey check for relative proxy paths (e.g. '/api/notte').\n // Any HTTPS URL—including staging—still requires a key.\n const isProxyMode = isRelativeProxyUrl(baseUrl);\n if (!isProxyMode) {\n const url = new URL(baseUrl);\n const loopback = ['localhost', '127.0.0.1', '[::1]'].includes(url.hostname);\n if (url.protocol !== 'https:' && !(url.protocol === 'http:' && loopback)) {\n throw new InvalidRequestError(\n 'API base URL must use HTTPS (HTTP is only allowed on loopback for local development)',\n );\n }\n }\n if (!apiKey && !isProxyMode) {\n throw new AuthenticationError(\n 'NOTTE_API_KEY needs to be provided. Pass config.apiKey or set the NOTTE_API_KEY environment variable.',\n );\n }\n\n this.config = {\n baseUrl, apiKey, timeoutMs, captchaTimeoutSeconds, dbPreview, maxRetries, verbose: config.verbose ?? false,\n };\n\n if (baseUrl !== DEFAULT_NOTTE_API_URL && !isProxyMode) {\n console.warn(`NOTTE_API_URL is set to: ${baseUrl}`);\n }\n\n // Use redirect:'manual' so we handle 3xx ourselves.\n // Node's undici drops POST bodies on cross-origin 307 redirects\n // (e.g. when the API gateway redirects to AWS Lambda function URLs).\n // throwOnError makes every generated call reject with the typed error\n // built by the error interceptor below, like `BaseClient.request` in Python.\n this.client.setConfig({\n baseUrl: this.config.baseUrl,\n redirect: 'manual',\n throwOnError: true,\n });\n\n this.client.interceptors.request.use((request: Request, opts) => {\n const headers = new Headers(request.headers);\n if (this.config.apiKey) headers.set('Authorization', `Bearer ${this.config.apiKey}`);\n headers.set('x-notte-request-origin', REQUEST_ORIGIN);\n headers.set('x-notte-sdk-version', SDK_VERSION);\n if (this.config.dbPreview) headers.set(DB_PREVIEW_HEADER, this.config.dbPreview);\n\n const override = headers.get(TIMEOUT_HEADER);\n headers.delete(TIMEOUT_HEADER);\n const retriesOverride = headers.get(MAX_RETRIES_HEADER);\n headers.delete(MAX_RETRIES_HEADER);\n const timeoutMs = override !== null ? Number(override) : this.config.timeoutMs;\n\n if (this.config.verbose) {\n console.info(`Making \\`${request.method}\\` request to \\`${request.url}\\``);\n }\n // Use the original signal: even request.signal follows opts.signal via\n // an undici WeakRef and can stop receiving aborts after garbage collection.\n const callerSignal = opts.signal ?? request.signal;\n const deadline = timeoutMs > 0 ? withTimeout(callerSignal, timeoutMs) : undefined;\n const signal = deadline?.signal ?? callerSignal;\n const timed = new Request(request, { headers, signal });\n pendingRequests.set(timed, { signal, release: deadline?.release ?? (() => undefined), expiresAt: deadline?.expiresAt ?? Infinity });\n\n // Pass the strongly held signal in fetch's init, bypassing Request's weak\n // signal-following link. Keeping the Request preserves all fetch options\n // (including streamed uploads), without reconstructing them field by field.\n // Wrap the resolved fetch per call so custom transports and redirects use it too.\n // SSE reconnects reuse opts; never wrap a previous attempt's signal.\n const transport = originalTransports.get(opts) ?? opts.fetch ?? globalThis.fetch;\n originalTransports.set(opts, transport);\n const retrying = createRetryingFetch({\n fetch: transport,\n maxRetries: () => retriesOverride !== null ? Number(retriesOverride) : this.config.maxRetries,\n deadline: () => deadline?.expiresAt,\n });\n opts.fetch = (input, init) => retrying(input, { ...init, signal });\n return timed;\n });\n\n // Follow 307/308 redirects manually, replaying the original body.\n // Also normalizes Content-Type from text/plain to application/json\n // (AWS Lambda function URLs return JSON with the wrong Content-Type).\n this.client.interceptors.response.use(async (response: Response, request: Request, opts: any) => {\n const initialUrl = new URL(request.url);\n let currentUrl = initialUrl;\n const headers = new Headers(request.headers);\n // Only the configured API's execution endpoint can delegate runtime\n // authentication. Its first HTTPS redirect is the runtime handoff, not\n // a blanket trust in an AWS domain or in arbitrary API redirects.\n const apiUrl = new URL(this.config.baseUrl, initialUrl);\n const executionPrefix = `${apiUrl.pathname.replace(/\\/$/, '')}/functions/`;\n const executionPath = initialUrl.pathname.slice(executionPrefix.length);\n const runtimeHandoff = request.method === 'POST' &&\n initialUrl.origin === apiUrl.origin && initialUrl.pathname.startsWith(executionPrefix) &&\n /^[^/]+\\/runs\\/[^/]+$/.test(executionPath) && !executionPath.endsWith('/create');\n for (let hop = 0; (response.status === 307 || response.status === 308) && response.headers.get('location'); hop++) {\n if (hop >= 10) throw new InvalidRequestError('Too many API redirects');\n const location = new URL(response.headers.get('location')!, currentUrl);\n const loopback = ['localhost', '127.0.0.1', '[::1]'].includes(location.hostname);\n if (location.protocol !== 'https:' && !(location.protocol === 'http:' && loopback)) {\n throw new InvalidRequestError(`Refusing to follow a redirect to an insecure URL: ${location.origin}`);\n }\n if (location.username || location.password) {\n throw new InvalidRequestError('Refusing to follow a redirect containing URL credentials');\n }\n if (location.origin !== currentUrl.origin) {\n headers.delete('Authorization');\n const localHandoff = location.protocol === 'http:' && initialUrl.protocol === 'http:' &&\n ['localhost', '127.0.0.1', '[::1]'].includes(initialUrl.hostname) && loopback;\n if (!(hop === 0 && runtimeHandoff && (location.protocol === 'https:' || localHandoff))) {\n headers.delete('x-notte-api-key');\n }\n }\n // A runtime cannot delegate the key again, even to another path on\n // its own origin. Handle every hop ourselves so fetch cannot leak it.\n if (hop > 0) headers.delete('x-notte-api-key');\n await response.body?.cancel();\n const headerRecord: Record<string, string> = {};\n headers.forEach((v, k) => { headerRecord[k] = v; });\n response = await (opts.fetch ?? fetch)(location.toString(), {\n method: request.method,\n headers: headerRecord,\n body: opts.serializedBody ?? undefined,\n signal: requestSignal(request),\n redirect: 'manual',\n });\n currentUrl = location;\n }\n\n // Normalize text/plain → application/json (Lambda function URLs)\n const ct = response.headers.get('content-type') ?? '';\n if (opts.parseAs !== 'stream' && ct.split(';')[0]?.trim() === 'text/plain') {\n const body = await response.arrayBuffer();\n const headers = new Headers(response.headers);\n headers.set('content-type', 'application/json');\n return new Response(body, { status: response.status, statusText: response.statusText, headers });\n }\n\n return response;\n });\n\n // Non-streaming calls are not finished until their body has arrived.\n // Buffer under the deadline, then let the generated client parse normally.\n // Explicit streams have a caller-owned lifetime (Function.run supplies its\n // own signal/deadline); do not buffer them or delay delivery of live logs.\n this.client.interceptors.response.use(async (response: Response, request: Request, opts: any) => {\n try {\n const parseAs = opts.parseAs === 'auto'\n ? getParseAs(response.headers.get('content-type'))\n : opts.parseAs;\n if (parseAs !== 'stream' && response.body) {\n const body = await response.arrayBuffer();\n const buffered = new Response(body, {\n status: response.status, statusText: response.statusText, headers: response.headers,\n });\n Object.defineProperty(buffered, 'url', { value: response.url });\n return buffered;\n }\n return response;\n } finally {\n releaseDeadline(request);\n }\n });\n\n // Turn raw failures into the typed error hierarchy.\n this.client.interceptors.error.use((error: unknown, response: Response | undefined, request: Request | undefined) => {\n releaseDeadline(request);\n return this.toTypedError(error, response, request);\n });\n\n startVersionCheck();\n }\n\n /**\n * Map the raw value the generated client rejects with into a `NotteError`.\n * HTTP failures become `NotteAPIError` (or `NotteAPIExecutionError` when the\n * API flags them), timeouts become `NotteTimeoutError`, anything else is\n * returned untouched.\n */\n private toTypedError(error: unknown, response: Response | undefined, request: Request | undefined): unknown {\n if (error instanceof NotteAPIError) {\n return error;\n }\n // Fetch body reads may throw AbortError even when the signal's reason is\n // TimeoutError. Preserve caller cancellation and report SDK deadlines as\n // timeouts rather than HTTP errors with a misleading status of 200.\n const signal = request && requestSignal(request);\n if (signal?.aborted) {\n error = signal.reason ?? error;\n }\n if (isTimeoutAbort(error)) {\n const target = request ? ` to \\`${requestPath(request)}\\`` : '';\n return new NotteTimeoutError(`Request${target} ${(error as Error).message}`, { cause: error });\n }\n if (signal?.aborted) return error;\n if (response) {\n const path = requestPath(request, response);\n const body = normalizeErrorBody(error);\n if (response.status === 422) {\n const latest = upgradeSuggestion();\n const message = typeof body.message === 'string' ? body.message : '';\n const looksLikeSchemaMismatch =\n message.includes('extra_forbidden') || message.includes('Extra inputs are not permitted') || message.includes(\"'type':\");\n if (latest && looksLikeSchemaMismatch) {\n return new NotteAPIError(\n path,\n response.status,\n { ...body, message: createUpgradeErrorMessage('API returned 422 validation error', latest, message) },\n response,\n );\n }\n }\n if (response.headers.get('x-error-class') === EXECUTION_ERROR_CLASS) {\n return new NotteAPIExecutionError(path, response.status, body, response);\n }\n return new NotteAPIError(path, response.status, body, response);\n }\n return error;\n }\n\n /**\n * Add the database preview branch to a websocket URL served by the Notte API.\n * The websocket handshake reads the branch from the query string, so without\n * it a preview-branch session is looked up in the default database.\n */\n withDbPreview(url: string): string {\n if (!this.config.dbPreview) {\n return url;\n }\n const parsed = new URL(url);\n parsed.searchParams.set('db_preview', this.config.dbPreview);\n return parsed.toString();\n }\n\n /**\n * Health check the Notte API. Resolves when the API answers 200 and rejects\n * with a `NotteAPIError` (or a network error) otherwise.\n */\n async healthCheck(): Promise<void> {\n await healthCheck({ client: this.client });\n }\n\n /**\n * Create a new session\n */\n Session(options: SessionOptions = {}): Session {\n return new Session(this, options);\n }\n\n /** Generated file operations; use Files(sessionId) for local file IO helpers. */\n get files() {\n return this.resources.files;\n }\n\n /** Access files owned by a specific session, including closed sessions. */\n Files(sessionId: string): SessionFiles {\n return new SessionFiles(this.getClient(), sessionId);\n }\n\n /**\n * File storage to attach to a session, the counterpart of `client.FileStorage()`.\n *\n * ```ts\n * const storage = client.FileStorage();\n * await client.Session({ storage }).use(async session => {\n * await storage.upload('./invoice.pdf');\n * const files = await storage.list({ source: 'session_download' });\n * });\n * ```\n */\n FileStorage(sessionId?: string): RemoteFileStorage {\n return new RemoteFileStorage(this, sessionId);\n }\n\n /**\n * Create or access a vault\n */\n Vault(options?: VaultConstructor): NotteVault {\n return new NotteVault(this, options);\n }\n\n /**\n * Create or access a persona\n */\n Persona(options?: PersonaConstructor): NottePersona {\n return new NottePersona(this, options);\n }\n\n /**\n * Create or access a function\n */\n NotteFunction(options: FunctionConstructor): NotteFunction {\n return new NotteFunction(this, options);\n }\n\n /** Alias of `NotteFunction`, matching `client.Function` in Python. */\n Function(options: FunctionConstructor): NotteFunction {\n return this.NotteFunction(options);\n }\n\n /** Client-bound session API operations. `list()` retains its array return value. */\n get sessions() {\n return {\n ...this.resources.sessions,\n list: async (options: SessionListOptions = {}): Promise<SessionResponse[]> => {\n const response = await listSessions({ client: this.getClient(), query: options });\n return response.data?.items ?? [];\n },\n };\n }\n\n /** Client-bound vault API operations. `list()` retains its array return value. */\n get vaults() {\n return {\n ...this.resources.vaults,\n list: async (options: VaultListOptions = {}): Promise<Vault[]> => {\n const response = await listVaults({ client: this.getClient(), query: options });\n return response.data?.items ?? [];\n },\n };\n }\n\n /** Client-bound function API operations. `list()` retains its array return value. */\n get functions() {\n return {\n ...this.resources.functions,\n list: async (options: FunctionListOptions = {}): Promise<FunctionListItemResponse[]> => {\n const response = await listFunctions({ client: this.getClient(), query: options });\n return response.data?.items ?? [];\n },\n };\n }\n\n /**\n * Search the public web (`POST /search`). Returns ranked results by default,\n * an answer with sources with `outputType: 'sourcedAnswer'`, or structured\n * output with `outputType: 'structured'`.\n *\n * ```ts\n * import { NotteClient } from 'notte-sdk';\n *\n * const client = new NotteClient();\n * const { results } = await client.search('notte browser agents');\n * const { answer } = await client.search('what is notte?', { outputType: 'sourcedAnswer' });\n * ```\n */\n async search(query: string, options?: SearchOptions & { outputType?: 'searchResults' }): Promise<SearchResultsResponse>;\n async search(query: string, options: SearchOptions & { outputType: 'sourcedAnswer' }): Promise<SearchSourcedAnswerResponse>;\n async search(query: string, options: SearchOptions & { outputType: 'structured' }): Promise<SearchStructuredResponse>;\n async search(query: string, options: SearchOptions): Promise<SearchResponse>;\n async search(query: string, options: SearchOptions = {}): Promise<SearchResponse> {\n const response = await searchWeb({\n client: this.getClient(),\n body: { ...options, q: query },\n throwOnError: true,\n });\n return response.data as SearchResponse;\n }\n\n /** Anything API (`POST /anything/start`). */\n get anything(): NotteAnything {\n return new NotteAnything(this);\n }\n\n /** Workspace secrets (`/secrets`). */\n get secrets(): NotteSecrets {\n return new NotteSecrets(this);\n }\n\n /** Managed authentication: verify connections, request login, and wait for readiness. */\n get managedAuth(): NotteManagedAuth {\n return new NotteManagedAuth(this);\n }\n\n /** Usage and billing (`/usage`, `/usage/logs`). */\n get usage(): NotteUsage {\n return new NotteUsage(this);\n }\n\n /**\n * Personas client for listing and managing personas\n */\n get personas() {\n const personas = this.resources.personas;\n return {\n ...personas,\n create: async (...args: Parameters<typeof personas.create>) =>\n withPersonaDefaults(await personas.create(...args)),\n get: async (...args: Parameters<typeof personas.get>) =>\n withPersonaDefaults(await personas.get(...args)),\n update: async (...args: Parameters<typeof personas.update>) =>\n withPersonaDefaults(await personas.update(...args)),\n list: async (options?: PersonaListOptions): Promise<PersonaResponse[]> => {\n const response = await listPersonas({\n client: this.getClient(),\n query: options || {},\n });\n return ((response.data as any)?.items || []).map(withPersonaDefaults);\n },\n };\n }\n\n /**\n * Get the configured client instance\n */\n getClient() {\n return this.client;\n }\n\n /** Client-bound profile API operations, generated from OpenAPI. */\n get profiles() {\n return this.resources.profiles;\n }\n\n /**\n * Scrape a webpage directly (without session).\n *\n * ```ts\n * const markdown = await client.scrape('https://www.notte.cc', { only_main_content: true });\n * const product = await client.scrape('https://www.notte.cc', { response_format: Product, instructions: 'Extract the product' });\n * ```\n *\n * With `response_format` or `instructions`, the extracted data is returned\n * directly and a failed extraction throws `ScrapeFailedError`. Pass\n * `raiseOnFailure: false` to receive the `StructuredData` wrapper instead.\n */\n async scrape(url: string, options?: GlobalScrapeOptions<unknown> & { response_format?: undefined; instructions?: undefined | null }): Promise<string>;\n async scrape<T>(url: string, options: GlobalScrapeOptions<T> & { response_format: ZodLikeSchema<T>; raiseOnFailure?: true }): Promise<T>;\n async scrape<T>(url: string, options: GlobalScrapeOptions<T> & { response_format: ZodLikeSchema<T>; raiseOnFailure: false }): Promise<StructuredData<T>>;\n async scrape(url: string, options: GlobalScrapeOptions<unknown>): Promise<ScrapeResult<unknown>>;\n async scrape<T = unknown>(url: string, options: GlobalScrapeOptions<T> = {}): Promise<ScrapeResult<T>> {\n const body = await buildScrapeBody(options);\n const response = await scrapeWebpage({\n client: this.getClient(),\n body: { url, ...body } as GlobalScrapeRequest,\n });\n return processScrapeResponse<T>(response.data, options);\n }\n\n /**\n * Get the client configuration\n */\n getConfig(): NotteClientConfig {\n return { ...this.config };\n }\n}\n\nfunction requestPath(request: Request | undefined, response?: Response): string {\n const url = request?.url ?? response?.url;\n if (!url) {\n return 'unknown';\n }\n try {\n return new URL(url).pathname;\n } catch {\n return url;\n }\n}\n\nfunction isTimeoutAbort(error: unknown): boolean {\n return typeof error === 'object' && error !== null && (error as { name?: string }).name === 'TimeoutError';\n}\n\nfunction timeoutReason(timeoutMs: number): DOMException {\n return new DOMException(`timed out after ${timeoutMs}ms`, 'TimeoutError');\n}\n\n// Keep the signal available for typed error mapping even after releasing the\n// timer. Weak keys let completed requests (and their signals) be collected.\nconst pendingRequests = new WeakMap<Request, Deadline>();\nconst originalTransports = new WeakMap<object, typeof fetch>();\n\nfunction requestSignal(request: Request): AbortSignal {\n return pendingRequests.get(request)?.signal ?? request.signal;\n}\n\nfunction releaseDeadline(request: Request | undefined): void {\n if (request) pendingRequests.get(request)?.release();\n}\n\ninterface Deadline {\n signal: AbortSignal;\n /** Clear the timer and detach from the caller's signal. Idempotent. */\n release: () => void;\n /** When the deadline fires, in ms since the epoch. */\n expiresAt: number;\n}\n\n/**\n * Combine the caller's signal with a deadline. `AbortSignal.any` (Node 20.3+)\n * lets the runtime drop the composite signal once the request settles, so a\n * long-lived caller signal never accumulates listeners.\n */\nfunction withTimeout(signal: AbortSignal | null | undefined, timeoutMs: number): Deadline {\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(timeoutReason(timeoutMs)), timeoutMs);\n const expiresAt = Date.now() + timeoutMs;\n timer.unref?.();\n let detach: () => void = () => undefined;\n let composite: AbortSignal;\n\n const signalAny = (AbortSignal as unknown as { any?: (signals: AbortSignal[]) => AbortSignal }).any;\n if (typeof signalAny === 'function') {\n composite = signalAny.call(AbortSignal, signal ? [signal, controller.signal] : [controller.signal]);\n } else {\n // Fallback for runtimes without AbortSignal.any.\n composite = controller.signal;\n if (signal) {\n if (signal.aborted) {\n controller.abort(signal.reason);\n } else {\n const forward = () => controller.abort(signal.reason);\n signal.addEventListener('abort', forward, { once: true });\n detach = () => signal.removeEventListener('abort', forward);\n }\n }\n }\n\n let released = false;\n const release = () => {\n if (released) return;\n released = true;\n clearTimeout(timer);\n detach();\n };\n composite.addEventListener('abort', release, { once: true });\n return { signal: composite, release, expiresAt };\n}\n","/**\n * Typed action builders, the counterpart of `notte_sdk.actions` in Python.\n *\n * Every builder returns the exact member of the `ExecuteAction` union that\n * `session.execute()` accepts, with `type` already set:\n *\n * ```ts\n * import { actions } from 'notte-sdk';\n *\n * await session.execute(actions.goto({ url: 'https://www.notte.cc' }));\n * await session.execute(actions.fill({ id: 'I1', value: 'user@example.com' }));\n * await session.execute(actions.goBack());\n * ```\n */\nimport type {\n PageExecuteData,\n ScrollDownAction as GeneratedScrollDownAction,\n ScrollUpAction as GeneratedScrollUpAction,\n} from '@/lib/client/types.gen';\n\n// Keep additions for the local browser runtime in the handwritten SDK layer\n// until the deployed schema includes them. Generated files must match staging.\n/** Scroll down on the page or in a selected container. */\nexport type ScrollDownAction = GeneratedScrollDownAction & {\n /** Optional selector for the scroll container, including iframe paths. */\n selector?: string | null;\n};\n\n/** Scroll up on the page or in a selected container. */\nexport type ScrollUpAction = GeneratedScrollUpAction & {\n /** Optional selector for the scroll container, including iframe paths. */\n selector?: string | null;\n};\n\n/** Discriminated union of every action `session.execute()` accepts. */\nexport type ExecuteAction =\n | Exclude<PageExecuteData['body'], { type: 'scroll_up' | 'scroll_down' }>\n | ({ type: 'scroll_up' } & ScrollUpAction)\n | ({ type: 'scroll_down' } & ScrollDownAction);\n\n/** The `type` discriminator of an `ExecuteAction`. */\nexport type ActionType = ExecuteAction['type'];\n\n/** The union member whose `type` is `T`. */\nexport type ActionOfType<T extends ActionType> = Extract<ExecuteAction, { type: T }>;\n\n/** The fields of an action minus its `type` discriminator. */\nexport type ActionInput<T extends ActionType> = Omit<ActionOfType<T>, 'type'>;\n\n/** Builders take an optional argument when every field of the action is optional. */\ntype BuilderArgs<T extends ActionType> = Record<never, never> extends ActionInput<T>\n ? [input?: ActionInput<T>]\n : [input: ActionInput<T>];\n\nfunction builder<T extends ActionType>(type: T): (...args: BuilderArgs<T>) => ActionOfType<T> {\n return (...[input]: BuilderArgs<T>): ActionOfType<T> => ({ ...(input ?? {}), type }) as ActionOfType<T>;\n}\n\n// Browser actions\nexport const goto = builder('goto');\nexport const gotoNewTab = builder('goto_new_tab');\nexport const closeTab = builder('close_tab');\nexport const switchTab = builder('switch_tab');\nexport const goBack = builder('go_back');\nexport const goForward = builder('go_forward');\nexport const reload = builder('reload');\nexport const wait = builder('wait');\nexport const pressKey = builder('press_key');\nexport const scrollUp = builder('scroll_up');\nexport const scrollDown = builder('scroll_down');\nexport const captchaSolve = builder('captcha_solve');\nexport const help = builder('help');\nexport const completion = builder('completion');\nexport const scrape = builder('scrape');\nexport const emailRead = builder('email_read');\nexport const emailVerificationRead = builder('email_verification_read');\nexport const smsRead = builder('sms_read');\nexport const evaluateJs = builder('evaluate_js');\nexport const formFill = builder('form_fill');\n\n// Interaction actions (need an element `id` from `observe()` or a `selector`)\nexport const click = builder('click');\nexport const fill = builder('fill');\nexport const multiFactorFill = builder('multi_factor_fill');\nexport const fallbackFill = builder('fallback_fill');\nexport const check = builder('check');\nexport const selectDropdownOption = builder('select_dropdown_option');\nexport const uploadFile = builder('upload_file');\nexport const downloadFile = builder('download_file');\n\n/** Namespace object mirroring `from notte_sdk import actions`. */\nexport const actions = {\n goto,\n gotoNewTab,\n closeTab,\n switchTab,\n goBack,\n goForward,\n reload,\n wait,\n pressKey,\n scrollUp,\n scrollDown,\n captchaSolve,\n help,\n completion,\n scrape,\n emailRead,\n emailVerificationRead,\n smsRead,\n evaluateJs,\n formFill,\n click,\n fill,\n multiFactorFill,\n fallbackFill,\n check,\n selectDropdownOption,\n uploadFile,\n downloadFile,\n} as const;\n\n/** True when the action is a captcha solve, which gets a longer request timeout and 408 retries. */\nexport function isCaptchaSolveAction(action: ExecuteAction): action is ActionOfType<'captcha_solve'> {\n return action.type === 'captcha_solve';\n}\n","/**\n * Error class for authentication/authorization failures in the proxy.\n * Throw this from `authenticate()` to return a 401 response.\n *\n * @example\n * ```typescript\n * authenticate: async (request) => {\n * const session = await getSession(request);\n * if (!session) throw new NotteProxyAuthError('Not logged in');\n * }\n * ```\n */\nexport class NotteProxyAuthError extends Error {\n constructor(message = 'Unauthorized') {\n super(message);\n this.name = 'NotteProxyAuthError';\n }\n}\n\n/**\n * Configuration for the Notte API proxy.\n *\n * The proxy forwards incoming HTTP requests to the Notte API,\n * injecting authentication headers server-side so the API key\n * is never exposed to the client.\n */\nexport interface NotteProxyConfig {\n /**\n * The Notte API key to use for all forwarded requests.\n * Falls back to the NOTTE_API_KEY environment variable when omitted.\n * Can be overridden per-request by returning a string from `authenticate`.\n */\n apiKey?: string;\n\n /**\n * Base URL of the Notte API.\n * @default 'https://api.notte.cc'\n */\n apiUrl?: string;\n\n /**\n * Authenticate and authorize incoming requests. Missing callbacks fail closed (401).\n * Check resource ownership as well as caller identity. With a shared key, every\n * authorized caller otherwise has access to the same account resources.\n *\n * - Throw a `NotteProxyAuthError` to reject the request (returns 401).\n * - Return `void` to allow the request through using the default `apiKey`.\n * - Return a `string` to override the API key for this specific request\n * (useful for per-user API keys).\n */\n authenticate?: (request: Request) => Promise<void | string>;\n\n /**\n * Allowed API endpoint patterns for path validation (SSRF prevention).\n *\n * - `undefined` (default): uses the built-in allowlist derived from the OpenAPI spec.\n * - `RegExp[]`: custom list of allowed patterns.\n * - `false`: disables path validation entirely (not recommended for public-facing proxies).\n */\n allowedPatterns?: RegExp[] | false;\n\n /**\n * Value for the `x-notte-request-origin` header sent to the Notte API.\n * @default 'sdk-proxy'\n */\n requestOrigin?: string;\n\n /**\n * List of header names to forward from the incoming request to the Notte API.\n * @default ['content-type', 'accept']\n */\n forwardHeaders?: string[];\n\n /**\n * Optional hook called just before the request is forwarded to the Notte API.\n * Use this to modify outgoing headers, log requests, etc.\n */\n onBeforeRequest?: (ctx: {\n path: string;\n method: string;\n headers: Headers;\n url: string;\n incomingRequest: Request;\n }) => Promise<void> | void;\n}\n","export { checkForLatestVersion, startVersionCheck } from '@/version-check';\n\n// Re-export all generated types and services\nexport * from '@/lib/client/types.gen';\nexport * from '@/lib/client/sdk.gen';\n\n// Preserve public names when generated operation and model names change.\nimport type { WaitActionOutput } from '@/lib/client/types.gen';\nexport type WaitAction = WaitActionOutput;\nexport { retry as retryWebhookDelivery } from '@/lib/client/sdk.gen';\nexport { fetchSpecializedData as scrapeSpecializedData } from '@/lib/client/sdk.gen';\nexport type {\n FetchSpecializedDataData as ScrapeSpecializedDataData,\n FetchSpecializedDataError as ScrapeSpecializedDataError,\n FetchSpecializedDataErrors as ScrapeSpecializedDataErrors,\n FetchSpecializedDataResponse as ScrapeSpecializedDataResponse,\n FetchSpecializedDataResponses as ScrapeSpecializedDataResponses,\n} from '@/lib/client/types.gen';\n\n// Re-export client for direct access\nexport { client } from '@/lib/client/client.gen';\n\n// Export main SDK classes\nexport { NotteClient, DEFAULT_NOTTE_API_URL, DEFAULT_REQUEST_TIMEOUT_MS, TIMEOUT_HEADER } from '@/client';\nexport { Session } from '@/session';\nexport type { ResourceRequestOptions } from '@/resources.gen';\nexport { NotteVault } from '@/vaults';\nexport { NottePersona } from '@/personas';\nexport { NotteFunction } from '@/functions';\nexport { Encryption } from '@/encryption';\nexport { SessionFiles, RemoteFileStorage, FileNotFoundError, FileExistsError, sanitizeFilename } from '@/files';\nexport type { FileSource, SessionFile, SessionFilesPage, FileListOptions, FileDownloadOptions, UploadableFile } from '@/files';\n\n// Errors and helpers\nexport {\n NotteError,\n NotteAPIError,\n NotteAPIExecutionError,\n AuthenticationError,\n InvalidRequestError,\n NotteTimeoutError,\n FailedToRunCloudFunctionError,\n ScrapeFailedError,\n ActionExecutionError,\n EvaluateJsNoDataError,\n FetchResponseDecodeError,\n retry,\n} from '@/errors';\nexport type { NotteAPIErrorBody, RetryOptions } from '@/errors';\nexport { DEFAULT_MAX_RETRIES } from '@/retry';\n\n// Scrape helpers shared by `client.scrape()` and `session.scrape()`\nexport { processScrapeResponse } from '@/scrape';\nexport type { ScrapeOptions, ScrapeResult, SessionScrapeOptions, StructuredData, ZodLikeSchema } from '@/scrape';\n\n// Export types\nexport type {\n NotteClientConfig,\n GlobalScrapeOptions,\n SessionListOptions,\n VaultListOptions,\n FunctionListOptions,\n} from '@/client';\nexport type {\n SessionOptions,\n ExecuteOptions,\n ReplayOptions,\n SaveProfileOptions,\n SessionScriptOptions,\n PerceptionType,\n SessionCloseReason,\n} from '@/session';\nexport {\n CLUSTER_OVERLOAD_RETRY_DELAY_MS,\n SESSION_START_TRIES,\n CAPTCHA_SOLVE_TIMEOUT_MS,\n observeServerOwnedDialog,\n installServerOwnedDialogPolicy,\n} from '@/session';\n\n// Typed actions for `session.execute()` (`import { actions } from 'notte-sdk'`)\nexport { actions, isCaptchaSolveAction } from '@/actions';\nexport type { ExecuteAction, ActionType, ActionOfType, ActionInput, ScrollUpAction, ScrollDownAction } from '@/actions';\n\n// In-page fetch helpers used by `session.fetch()`\nexport { PageFetchResponse, PageFetchHTTPError, buildFetchScript, responseFromEvaluated } from '@/page-fetch';\nexport type { PageFetchOptions, FetchData } from '@/page-fetch';\n\n// Cookie file helpers\nexport { readCookiesFile, createOrAppendCookiesToFile } from '@/cookies';\nexport type { VaultConstructor, VaultConstructorWithId, VaultConstructorCreate, CredentialField } from '@/vaults';\nexport { getRootDomain, validateUrl, validateMfaSecret, isValidMfaSecret, validateCredentials, CREDENTIAL_FIELDS } from '@/vaults';\nexport type { PersonaConstructor, MessageReadOptions, PersonaListOptions, PersonaResponseWithInternalEmail } from '@/personas';\nexport type {\n FunctionConstructor,\n FunctionConstructorWithId,\n FunctionConstructorCreate,\n FunctionRuntime,\n FunctionRunStatus,\n GetFunctionRunResponse,\n GetFunctionRunResponseWritable,\n FunctionRunUpdateRequest,\n FunctionRunResponse,\n FunctionRunOptions,\n FunctionRunStartResult,\n FunctionRunResult,\n FunctionRunCreateResult,\n FunctionRunCreateOptions,\n FunctionRunListOptions,\n FunctionGetOptions,\n FunctionUpdateOptions,\n FunctionMetadataUpdateOptions,\n FunctionScheduleOptions,\n FunctionRollbackOptions,\n FunctionUrlOptions,\n FunctionDownloadOptions,\n} from '@/functions';\nexport { FUNCTION_RUN_TIMEOUT_MS, FUNCTION_RUN_ENDPOINTS, RUN_API_KEY_HEADER } from '@/functions';\n\n// Top-level API wrappers\nexport type {\n SearchOptions,\n SearchResponse,\n SearchResultItem,\n SearchResultsResponse,\n SearchSource,\n SearchSourcedAnswerResponse,\n SearchStructuredResponse,\n} from '@/search';\nexport { NotteAnything } from '@/anything';\nexport type { AnythingStartOptions, AnythingStartResult, AnythingStreamChunk } from '@/anything';\nexport { NotteSecrets } from '@/secrets';\nexport type { SecretListOptions, SecretStoreOptions } from '@/secrets';\nexport { NotteUsage } from '@/usage';\nexport type { UsageOptions, UsageLogsOptions, UsageLogEndpoint } from '@/usage';\n\n// Export proxy types and errors (the proxy module itself is available via 'notte-sdk/next' and 'notte-sdk/proxy')\nexport type { NotteProxyConfig } from '@/proxy/types';\nexport { NotteProxyAuthError } from '@/proxy/types';\n\n// Create a configured client instance (legacy support)\nimport { createClient as createGeneratedClient } from '@/lib/client/client';\nimport { DEFAULT_NOTTE_API_URL as DEFAULT_API_URL } from '@/client';\n\nexport const createClient = (config?: { baseUrl?: string; token?: string }) => {\n const client = createGeneratedClient({ baseUrl: config?.baseUrl || DEFAULT_API_URL });\n if (config?.baseUrl) {\n client.setConfig({ baseUrl: config.baseUrl });\n }\n\n if (config?.token) {\n client.interceptors.request.use((request: any) => {\n request.headers.set('Authorization', `Bearer ${config.token}`);\n return request;\n });\n }\n\n return client;\n};\n\n// Default export - NotteClient for convenience\nexport { NotteClient as default } from '@/client';\n\nexport type { CaptchaStatus, CaptchaExecutionResponse } from '@/captcha';\nexport { NotteManagedAuth, ManagedAuthError } from '@/managed-auth';\nexport type { AuthSessionResponse as SessionResponse, AuthSessionResponse, ManagedAuthOperation, ManagedAuthReadiness, ManagedAuthRunResponse, AuthWaitOptions, ManagedAuthRunOptions } from '@/managed-auth';\nexport type { SessionStartOptions } from '@/session';\n"],"mappings":";AAKO,IAAM,cAAsB,OAAyC,WAAkB;AACvF,IAAM,mBACX,OAA8C,cAAuB;;;ACLvE,IAAM,cAAc;AACpB,IAAM,2BAA2B;AAmBjC,IAAI,wBAAwB;AAC5B,IAAI;AAOG,SAAS,oBAA0B;AACxC,MAAI,yBAAyB,CAAC,mBAAmB,GAAG;AAClD;AAAA,EACF;AACA,0BAAwB;AAExB,QAAM,QAAQ,WAAW,MAAM;AAC7B,SAAK,sBAAsB,EAAE,MAAM,MAAM,MAAS;AAAA,EACpD,GAAG,CAAC;AACJ,QAAM,QAAQ;AAChB;AAQO,SAAS,eAAe,SAAiB,QAAyB;AACvE,SAAO,iBAAiB,QAAQ,OAAO;AACzC;AAMO,SAAS,kBAAkB,iBAAyB,aAAiC;AAC1F,MAAI,CAAC,uBAAuB,CAAC,mBAAmB,cAAc,GAAG;AAC/D,WAAO;AAA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config","request","url","detail","retry","resolve","client","client","writeFile","resolve","delay","wait","delay","resolve","client","wait","resolve","writeFile","delay","client","client","readFile","writeFile","client","value","client","writeFile","readFile","readFile","basename","client","readFile","basename","client","client","client","NotteClient","timeoutMs","headers","createClient","client"]}
1
+ {"version":3,"sources":["../src/version.ts","../src/version-check.ts","../src/lib/client/core/bodySerializer.gen.ts","../src/lib/client/core/params.gen.ts","../src/lib/client/core/serverSentEvents.gen.ts","../src/lib/client/core/pathSerializer.gen.ts","../src/lib/client/core/utils.gen.ts","../src/lib/client/core/auth.gen.ts","../src/lib/client/client/utils.gen.ts","../src/lib/client/client/client.gen.ts","../src/lib/client/client.gen.ts","../src/lib/client/sdk.gen.ts","../src/managed-auth.ts","../src/errors.ts","../src/resources.gen.ts","../src/session.ts","../src/captcha.ts","../src/page-fetch.ts","../src/cookies.ts","../src/utils.ts","../src/scrape.ts","../src/retry.ts","../src/vaults.ts","../src/personas.ts","../src/functions.ts","../src/encryption.ts","../src/run-payloads.ts","../src/files.ts","../src/anything.ts","../src/secrets.ts","../src/usage.ts","../src/client.ts","../src/actions.ts","../src/proxy/types.ts","../src/index.ts"],"sourcesContent":["declare const __SDK_VERSION__: string;\ndeclare const __SDK_PACKAGE_NAME__: string;\n\n// Injected at build time by tsup from package.json \"version\".\n// Falls back to 'dev' when running outside a build (tsx, ts-node, tests).\nexport const SDK_VERSION: string = typeof __SDK_VERSION__ !== 'undefined' ? __SDK_VERSION__ : 'dev';\nexport const SDK_PACKAGE_NAME: string =\n typeof __SDK_PACKAGE_NAME__ !== 'undefined' ? __SDK_PACKAGE_NAME__ : 'notte-sdk';\n","import { SDK_PACKAGE_NAME, SDK_VERSION } from '@/version';\n\nconst DISABLE_ENV = 'NOTTE_SDK_DISABLE_VERSION_CHECK';\nconst VERSION_CHECK_TIMEOUT_MS = 1_500;\n\ntype Env = Record<string, string | undefined>;\n\ntype VersionCheckOptions = {\n currentVersion?: string;\n packageName?: string;\n fetchFn?: typeof fetch;\n warnFn?: (message: string) => void;\n env?: Env;\n};\n\ntype NpmLatestResponse = {\n version?: unknown;\n};\n\n// Mirrors the module globals of `notte_sdk.endpoints.base`: the registry is\n// contacted at most once per process and the answer is cached so later 422\n// validation errors can suggest the upgrade.\nlet versionCheckPerformed = false;\nlet cachedLatestVersion: string | undefined;\n\n/**\n * Check the npm registry once per process and warn when a newer release exists.\n * Called by `NotteClient` on construction, like `check_and_warn_version_mismatch`\n * in the Python client. Never throws and never blocks the caller.\n */\nexport function startVersionCheck(): void {\n if (versionCheckPerformed || !shouldCheckVersion()) {\n return;\n }\n versionCheckPerformed = true;\n\n const timer = setTimeout(() => {\n void checkForLatestVersion().catch(() => undefined);\n }, 0);\n timer.unref?.();\n}\n\n/** Latest version seen on the registry during this process, if the check ran. */\nexport function getLatestKnownVersion(): string | undefined {\n return cachedLatestVersion;\n}\n\n/** True when `current` is strictly older than `latest`. Unparseable versions never suggest an upgrade. */\nexport function isVersionOlder(current: string, latest: string): boolean {\n return isVersionGreater(latest, current);\n}\n\n/**\n * When the registry reported a newer version, return it so error messages can\n * suggest the upgrade. Development builds never suggest one.\n */\nexport function upgradeSuggestion(currentVersion: string = SDK_VERSION): string | undefined {\n if (!cachedLatestVersion || !isPublishedVersion(currentVersion)) {\n return undefined;\n }\n return isVersionOlder(currentVersion, cachedLatestVersion) ? cachedLatestVersion : undefined;\n}\n\nexport function createUpgradeErrorMessage(\n errorContext: string,\n latestVersion: string,\n originalError?: string,\n currentVersion: string = SDK_VERSION,\n packageName: string = SDK_PACKAGE_NAME,\n): string {\n let message =\n `${errorContext}. This might be due to API schema changes. ` +\n `Current SDK version: ${currentVersion}, Latest available: ${latestVersion}. ` +\n `Either you made a mistake in the request arguments, or you should upgrade to the latest ` +\n `${packageName} version by running: 'npm install ${packageName}@${latestVersion}'`;\n if (originalError) {\n message += `. Original error: ${originalError}`;\n }\n return message;\n}\n\nexport async function checkForLatestVersion(options: VersionCheckOptions = {}): Promise<void> {\n const currentVersion = options.currentVersion ?? SDK_VERSION;\n const packageName = options.packageName ?? SDK_PACKAGE_NAME;\n const fetchFn = options.fetchFn ?? globalThis.fetch;\n const warnFn = options.warnFn ?? console.warn;\n const env = options.env ?? getEnv();\n\n if (!shouldCheckVersion(currentVersion, fetchFn, env)) {\n return;\n }\n\n const latestVersion = await fetchLatestVersion(packageName, fetchFn);\n if (!latestVersion) {\n return;\n }\n cachedLatestVersion = latestVersion;\n\n if (!isVersionGreater(latestVersion, currentVersion)) {\n return;\n }\n\n warnFn(\n `⚠️ You are using ${packageName} version ${currentVersion}, but version ${latestVersion} is available on npm. ` +\n `Run 'npm install ${packageName}@${latestVersion}' to avoid any interruptions.`,\n );\n}\n\n/** Test hook: forget the once-per-process state. */\nexport function resetVersionCheckForTests(): void {\n versionCheckPerformed = false;\n cachedLatestVersion = undefined;\n}\n\nfunction shouldCheckVersion(\n currentVersion: string = SDK_VERSION,\n fetchFn: typeof fetch | undefined = globalThis.fetch,\n env: Env | undefined = getEnv(),\n): boolean {\n if (!fetchFn || !env || env[DISABLE_ENV] || env.NODE_ENV === 'test' || env.VITEST || env.CI) {\n return false;\n }\n\n return isPublishedVersion(currentVersion);\n}\n\nasync function fetchLatestVersion(packageName: string, fetchFn: typeof fetch): Promise<string | undefined> {\n const controller = typeof AbortController !== 'undefined' ? new AbortController() : undefined;\n const timeout = controller ? setTimeout(() => controller.abort(), VERSION_CHECK_TIMEOUT_MS) : undefined;\n\n timeout?.unref?.();\n\n try {\n const response = await fetchFn(`https://registry.npmjs.org/${encodeURIComponent(packageName)}/latest`, {\n headers: {\n accept: 'application/json',\n 'user-agent': `${packageName}/${SDK_VERSION} (https://github.com/nottelabs/notte)`,\n },\n signal: controller?.signal,\n });\n\n if (!response.ok) {\n return undefined;\n }\n\n const payload = (await response.json()) as NpmLatestResponse;\n return typeof payload.version === 'string' ? payload.version : undefined;\n } catch {\n return undefined;\n } finally {\n if (timeout) {\n clearTimeout(timeout);\n }\n }\n}\n\nfunction isPublishedVersion(version: string): boolean {\n return /^\\d+\\.\\d+\\.\\d+/.test(version) && !version.includes('dev');\n}\n\nfunction isVersionGreater(candidate: string, current: string): boolean {\n const candidateVersion = parseSemver(candidate);\n const currentVersion = parseSemver(current);\n\n if (!candidateVersion || !currentVersion) {\n return false;\n }\n\n for (let index = 0; index < 3; index += 1) {\n if (candidateVersion.parts[index] > currentVersion.parts[index]) {\n return true;\n }\n\n if (candidateVersion.parts[index] < currentVersion.parts[index]) {\n return false;\n }\n }\n\n return currentVersion.prerelease.length > 0 && candidateVersion.prerelease.length === 0;\n}\n\nfunction parseSemver(version: string): { parts: [number, number, number]; prerelease: string } | undefined {\n const match = version.match(/^(\\d+)\\.(\\d+)\\.(\\d+)(?:-([^+]+))?/);\n\n if (!match) {\n return undefined;\n }\n\n return {\n parts: [Number(match[1]), Number(match[2]), Number(match[3])],\n prerelease: match[4] ?? '',\n };\n}\n\nfunction getEnv(): Env | undefined {\n return typeof process !== 'undefined' ? process.env : undefined;\n}\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerializer.gen';\n\nexport type QuerySerializer = (query: Record<string, unknown>) => string;\n\nexport type BodySerializer = (body: unknown) => unknown;\n\ntype QuerySerializerOptionsObject = {\n allowReserved?: boolean;\n array?: Partial<SerializerOptions<ArrayStyle>>;\n object?: Partial<SerializerOptions<ObjectStyle>>;\n};\n\nexport type QuerySerializerOptions = QuerySerializerOptionsObject & {\n /**\n * Per-parameter serialization overrides. When provided, these settings\n * override the global array/object settings for specific parameter names.\n */\n parameters?: Record<string, QuerySerializerOptionsObject>;\n};\n\nconst serializeFormDataPair = (data: FormData, key: string, value: unknown): void => {\n if (typeof value === 'string' || value instanceof Blob) {\n data.append(key, value);\n } else if (value instanceof Date) {\n data.append(key, value.toISOString());\n } else {\n data.append(key, JSON.stringify(value));\n }\n};\n\nconst serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value: unknown): void => {\n if (typeof value === 'string') {\n data.append(key, value);\n } else {\n data.append(key, JSON.stringify(value));\n }\n};\n\nexport const formDataBodySerializer = {\n bodySerializer: (body: unknown): FormData => {\n const data = new FormData();\n\n Object.entries(body as Record<string, unknown>).forEach(([key, value]) => {\n if (value === undefined || value === null) {\n return;\n }\n if (Array.isArray(value)) {\n value.forEach((v) => serializeFormDataPair(data, key, v));\n } else {\n serializeFormDataPair(data, key, value);\n }\n });\n\n return data;\n },\n};\n\nexport const jsonBodySerializer = {\n bodySerializer: (body: unknown): string =>\n JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)),\n};\n\nexport const urlSearchParamsBodySerializer = {\n bodySerializer: (body: unknown): string => {\n const data = new URLSearchParams();\n\n Object.entries(body as Record<string, unknown>).forEach(([key, value]) => {\n if (value === undefined || value === null) {\n return;\n }\n if (Array.isArray(value)) {\n value.forEach((v) => serializeUrlSearchParamsPair(data, key, v));\n } else {\n serializeUrlSearchParamsPair(data, key, value);\n }\n });\n\n return data.toString();\n },\n};\n","// This file is auto-generated by @hey-api/openapi-ts\n\ntype Slot = 'body' | 'headers' | 'path' | 'query';\n\nexport type Field =\n | {\n in: Exclude<Slot, 'body'>;\n /**\n * Field name. This is the name we want the user to see and use.\n */\n key: string;\n /**\n * Field mapped name. This is the name we want to use in the request.\n * If omitted, we use the same value as `key`.\n */\n map?: string;\n }\n | {\n in: Extract<Slot, 'body'>;\n /**\n * Key isn't required for bodies.\n */\n key?: string;\n map?: string;\n }\n | {\n /**\n * Field name. This is the name we want the user to see and use.\n */\n key: string;\n /**\n * Field mapped name. This is the name we want to use in the request.\n * If `in` is omitted, `map` aliases `key` to the transport layer.\n */\n map: Slot;\n };\n\nexport interface Fields {\n allowExtra?: Partial<Record<Slot, boolean>>;\n args?: ReadonlyArray<Field>;\n}\n\nexport type FieldsConfig = ReadonlyArray<Field | Fields>;\n\nconst extraPrefixesMap: Record<string, Slot> = {\n $body_: 'body',\n $headers_: 'headers',\n $path_: 'path',\n $query_: 'query',\n};\nconst extraPrefixes = Object.entries(extraPrefixesMap);\n\ntype KeyMap = Map<\n string,\n | {\n in: Slot;\n map?: string;\n }\n | {\n in?: never;\n map: Slot;\n }\n>;\n\nfunction buildKeyMap(fields: FieldsConfig, map?: KeyMap): KeyMap {\n if (!map) {\n map = new Map();\n }\n\n for (const config of fields) {\n if ('in' in config) {\n if (config.key) {\n map.set(config.key, {\n in: config.in,\n map: config.map,\n });\n }\n } else if ('key' in config) {\n map.set(config.key, {\n map: config.map,\n });\n } else if (config.args) {\n buildKeyMap(config.args, map);\n }\n }\n\n return map;\n}\n\ninterface Params {\n body?: unknown;\n headers: Record<string, unknown>;\n path: Record<string, unknown>;\n query: Record<string, unknown>;\n}\n\nfunction stripEmptySlots(params: Params): void {\n for (const [slot, value] of Object.entries(params)) {\n if (slot === 'body') continue;\n if (value && typeof value === 'object' && !Array.isArray(value) && !Object.keys(value).length) {\n delete params[slot as Slot];\n }\n }\n}\n\nexport function buildClientParams(args: ReadonlyArray<unknown>, fields: FieldsConfig): Params {\n const params: Params = {\n headers: Object.create(null),\n path: Object.create(null),\n query: Object.create(null),\n };\n\n const map = buildKeyMap(fields);\n\n function writeSlot(slot: Slot, key: string, value: unknown): void {\n let record = params[slot] as Record<string, unknown> | undefined;\n if (record === undefined) {\n record = Object.create(null) as Record<string, unknown>;\n params[slot] = record;\n }\n record[key] = value;\n }\n\n let config: FieldsConfig[number] | undefined;\n\n for (const [index, arg] of args.entries()) {\n if (fields[index]) {\n config = fields[index];\n }\n\n if (!config) {\n continue;\n }\n\n if ('in' in config) {\n if (config.key) {\n const field = map.get(config.key)!;\n const name = field.map || config.key;\n if (field.in) {\n writeSlot(field.in, name, arg);\n }\n } else {\n params.body = arg;\n }\n } else {\n for (const [key, value] of Object.entries(arg ?? {})) {\n const field = map.get(key);\n\n if (field) {\n if (field.in) {\n const name = field.map || key;\n writeSlot(field.in, name, value);\n } else {\n params[field.map] = value;\n }\n } else {\n const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix));\n\n if (extra) {\n const [prefix, slot] = extra;\n writeSlot(slot, key.slice(prefix.length), value);\n } else if ('allowExtra' in config && config.allowExtra) {\n for (const [slot, allowed] of Object.entries(config.allowExtra)) {\n if (allowed) {\n writeSlot(slot as Slot, key, value);\n break;\n }\n }\n }\n }\n }\n }\n }\n\n stripEmptySlots(params);\n\n return params;\n}\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { Config } from './types.gen';\n\nexport type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, 'method'> &\n Pick<Config, 'method' | 'responseTransformer' | 'responseValidator'> & {\n /**\n * Fetch API implementation. You can use this option to provide a custom\n * fetch instance.\n *\n * @default globalThis.fetch\n */\n fetch?: typeof fetch;\n /**\n * Implementing clients can call request interceptors inside this hook.\n */\n onRequest?: (url: string, init: RequestInit) => Promise<Request>;\n /**\n * Callback invoked when a network or parsing error occurs during streaming.\n *\n * This option applies only if the endpoint returns a stream of events.\n *\n * @param error The error that occurred.\n */\n onSseError?: (error: unknown) => void;\n /**\n * Callback invoked when an event is streamed from the server.\n *\n * This option applies only if the endpoint returns a stream of events.\n *\n * @param event Event streamed from the server.\n * @returns Nothing (void).\n */\n onSseEvent?: (event: StreamEvent<TData>) => void;\n serializedBody?: RequestInit['body'];\n /**\n * Default retry delay in milliseconds.\n *\n * This option applies only if the endpoint returns a stream of events.\n *\n * @default 3000\n */\n sseDefaultRetryDelay?: number;\n /**\n * Maximum number of retry attempts before giving up.\n */\n sseMaxRetryAttempts?: number;\n /**\n * Maximum retry delay in milliseconds.\n *\n * Applies only when exponential backoff is used.\n *\n * This option applies only if the endpoint returns a stream of events.\n *\n * @default 30000\n */\n sseMaxRetryDelay?: number;\n /**\n * Optional sleep function for retry backoff.\n *\n * Defaults to using `setTimeout`.\n */\n sseSleepFn?: (ms: number) => Promise<void>;\n url: string;\n };\n\nexport interface StreamEvent<TData = unknown> {\n data: TData;\n event?: string;\n id?: string;\n retry?: number;\n}\n\nexport type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {\n stream: AsyncGenerator<\n TData extends Record<string, unknown> ? TData[keyof TData] : TData,\n TReturn,\n TNext\n >;\n};\n\nexport function createSseClient<TData = unknown>({\n onRequest,\n onSseError,\n onSseEvent,\n responseTransformer,\n responseValidator,\n sseDefaultRetryDelay,\n sseMaxRetryAttempts,\n sseMaxRetryDelay,\n sseSleepFn,\n url,\n ...options\n}: ServerSentEventsOptions): ServerSentEventsResult<TData> {\n let lastEventId: string | undefined;\n\n const sleep = sseSleepFn ?? ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms)));\n\n const createStream = async function* () {\n let retryDelay: number = sseDefaultRetryDelay ?? 3000;\n let attempt = 0;\n const signal = options.signal ?? new AbortController().signal;\n\n while (true) {\n if (signal.aborted) break;\n\n attempt++;\n\n const headers =\n options.headers instanceof Headers\n ? options.headers\n : new Headers(options.headers as Record<string, string> | undefined);\n\n if (lastEventId !== undefined) {\n headers.set('Last-Event-ID', lastEventId);\n }\n\n try {\n const requestInit: RequestInit = {\n redirect: 'follow',\n ...options,\n body: options.serializedBody,\n headers,\n signal,\n };\n let request = new Request(url, requestInit);\n if (onRequest) {\n request = await onRequest(url, requestInit);\n }\n // fetch must be assigned here, otherwise it would throw the error:\n // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation\n const _fetch = options.fetch ?? globalThis.fetch;\n const response = await _fetch(request);\n\n if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);\n\n if (!response.body) throw new Error('No body in SSE response');\n\n const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();\n\n let buffer = '';\n\n const abortHandler = () => {\n try {\n reader.cancel();\n } catch {\n // noop\n }\n };\n\n signal.addEventListener('abort', abortHandler);\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n buffer += value;\n buffer = buffer.replace(/\\r\\n?/g, '\\n'); // normalize line endings\n\n const chunks = buffer.split('\\n\\n');\n buffer = chunks.pop() ?? '';\n\n for (const chunk of chunks) {\n const lines = chunk.split('\\n');\n const dataLines: Array<string> = [];\n let eventName: string | undefined;\n\n for (const line of lines) {\n if (line.startsWith('data:')) {\n dataLines.push(line.replace(/^data:\\s*/, ''));\n } else if (line.startsWith('event:')) {\n eventName = line.replace(/^event:\\s*/, '');\n } else if (line.startsWith('id:')) {\n lastEventId = line.replace(/^id:\\s*/, '');\n } else if (line.startsWith('retry:')) {\n const parsed = Number.parseInt(line.replace(/^retry:\\s*/, ''), 10);\n if (!Number.isNaN(parsed)) {\n retryDelay = parsed;\n }\n }\n }\n\n let data: unknown;\n let parsedJson = false;\n\n if (dataLines.length) {\n const rawData = dataLines.join('\\n');\n try {\n data = JSON.parse(rawData);\n parsedJson = true;\n } catch {\n data = rawData;\n }\n }\n\n if (parsedJson) {\n if (responseValidator) {\n await responseValidator(data);\n }\n\n if (responseTransformer) {\n data = await responseTransformer(data);\n }\n }\n\n onSseEvent?.({\n data,\n event: eventName,\n id: lastEventId,\n retry: retryDelay,\n });\n\n if (dataLines.length) {\n yield data as any;\n }\n }\n }\n } finally {\n signal.removeEventListener('abort', abortHandler);\n reader.releaseLock();\n }\n\n break; // exit loop on normal completion\n } catch (error) {\n // connection failed or aborted; retry after delay\n onSseError?.(error);\n\n if (sseMaxRetryAttempts !== undefined && attempt >= sseMaxRetryAttempts) {\n break; // stop after firing error\n }\n\n // exponential backoff: double retry each attempt, cap at 30s\n const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000);\n await sleep(backoff);\n }\n }\n };\n\n const stream = createStream();\n\n return { stream };\n}\n","// This file is auto-generated by @hey-api/openapi-ts\n\ninterface SerializeOptions<T> extends SerializePrimitiveOptions, SerializerOptions<T> {}\n\ninterface SerializePrimitiveOptions {\n allowReserved?: boolean;\n name: string;\n}\n\nexport interface SerializerOptions<T> {\n /**\n * @default true\n */\n explode: boolean;\n style: T;\n}\n\nexport type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';\nexport type ArraySeparatorStyle = ArrayStyle | MatrixStyle;\ntype MatrixStyle = 'label' | 'matrix' | 'simple';\nexport type ObjectStyle = 'form' | 'deepObject';\ntype ObjectSeparatorStyle = ObjectStyle | MatrixStyle;\n\ninterface SerializePrimitiveParam extends SerializePrimitiveOptions {\n value: string;\n}\n\nexport const separatorArrayExplode = (style: ArraySeparatorStyle): '.' | ';' | ',' | '&' => {\n switch (style) {\n case 'label':\n return '.';\n case 'matrix':\n return ';';\n case 'simple':\n return ',';\n default:\n return '&';\n }\n};\n\nexport const separatorArrayNoExplode = (style: ArraySeparatorStyle): ',' | '|' | '%20' => {\n switch (style) {\n case 'form':\n return ',';\n case 'pipeDelimited':\n return '|';\n case 'spaceDelimited':\n return '%20';\n default:\n return ',';\n }\n};\n\nexport const separatorObjectExplode = (style: ObjectSeparatorStyle): '.' | ';' | ',' | '&' => {\n switch (style) {\n case 'label':\n return '.';\n case 'matrix':\n return ';';\n case 'simple':\n return ',';\n default:\n return '&';\n }\n};\n\nexport const serializeArrayParam = ({\n allowReserved,\n explode,\n name,\n style,\n value,\n}: SerializeOptions<ArraySeparatorStyle> & {\n value: unknown[];\n}): string => {\n if (!explode) {\n const joinedValues = (\n allowReserved ? value : value.map((v) => encodeURIComponent(v as string))\n ).join(separatorArrayNoExplode(style));\n switch (style) {\n case 'label':\n return `.${joinedValues}`;\n case 'matrix':\n return `;${name}=${joinedValues}`;\n case 'simple':\n return joinedValues;\n default:\n return `${name}=${joinedValues}`;\n }\n }\n\n const separator = separatorArrayExplode(style);\n const joinedValues = value\n .map((v) => {\n if (style === 'label' || style === 'simple') {\n return allowReserved ? v : encodeURIComponent(v as string);\n }\n\n return serializePrimitiveParam({\n allowReserved,\n name,\n value: v as string,\n });\n })\n .join(separator);\n return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues;\n};\n\nexport const serializePrimitiveParam = ({\n allowReserved,\n name,\n value,\n}: SerializePrimitiveParam): string => {\n if (value === undefined || value === null) {\n return '';\n }\n\n if (typeof value === 'object') {\n throw new Error(\n 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.',\n );\n }\n\n return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;\n};\n\nexport const serializeObjectParam = ({\n allowReserved,\n explode,\n name,\n style,\n value,\n valueOnly,\n}: SerializeOptions<ObjectSeparatorStyle> & {\n value: Record<string, unknown> | Date;\n valueOnly?: boolean;\n}): string => {\n if (value instanceof Date) {\n return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;\n }\n\n if (style !== 'deepObject' && !explode) {\n let values: string[] = [];\n Object.entries(value).forEach(([key, v]) => {\n values = [...values, key, allowReserved ? (v as string) : encodeURIComponent(v as string)];\n });\n const joinedValues = values.join(',');\n switch (style) {\n case 'form':\n return `${name}=${joinedValues}`;\n case 'label':\n return `.${joinedValues}`;\n case 'matrix':\n return `;${name}=${joinedValues}`;\n default:\n return joinedValues;\n }\n }\n\n const separator = separatorObjectExplode(style);\n const joinedValues = Object.entries(value)\n .map(([key, v]) =>\n serializePrimitiveParam({\n allowReserved,\n name: style === 'deepObject' ? `${name}[${key}]` : key,\n value: v as string,\n }),\n )\n .join(separator);\n return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues;\n};\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { BodySerializer, QuerySerializer } from './bodySerializer.gen';\nimport {\n type ArraySeparatorStyle,\n serializeArrayParam,\n serializeObjectParam,\n serializePrimitiveParam,\n} from './pathSerializer.gen';\n\nexport interface PathSerializer {\n path: Record<string, unknown>;\n url: string;\n}\n\nexport const PATH_PARAM_RE: RegExp = /\\{[^{}]+\\}/g;\n\nexport const defaultPathSerializer = ({ path, url: _url }: PathSerializer): string => {\n let url = _url;\n const matches = _url.match(PATH_PARAM_RE);\n if (matches) {\n for (const match of matches) {\n let explode = false;\n let name = match.substring(1, match.length - 1);\n let style: ArraySeparatorStyle = 'simple';\n\n if (name.endsWith('*')) {\n explode = true;\n name = name.substring(0, name.length - 1);\n }\n\n if (name.startsWith('.')) {\n name = name.substring(1);\n style = 'label';\n } else if (name.startsWith(';')) {\n name = name.substring(1);\n style = 'matrix';\n }\n\n const value = path[name];\n\n if (value === undefined || value === null) {\n continue;\n }\n\n if (Array.isArray(value)) {\n url = url.replace(match, serializeArrayParam({ explode, name, style, value }));\n continue;\n }\n\n if (typeof value === 'object') {\n url = url.replace(\n match,\n serializeObjectParam({\n explode,\n name,\n style,\n value: value as Record<string, unknown>,\n valueOnly: true,\n }),\n );\n continue;\n }\n\n if (style === 'matrix') {\n url = url.replace(\n match,\n `;${serializePrimitiveParam({\n name,\n value: value as string,\n })}`,\n );\n continue;\n }\n\n const replaceValue = encodeURIComponent(\n style === 'label' ? `.${value as string}` : (value as string),\n );\n url = url.replace(match, replaceValue);\n }\n }\n return url;\n};\n\nexport const getUrl = ({\n baseUrl,\n path,\n query,\n querySerializer,\n url: _url,\n}: {\n baseUrl?: string;\n path?: Record<string, unknown>;\n query?: Record<string, unknown>;\n querySerializer: QuerySerializer;\n url: string;\n}): string => {\n const pathUrl = _url.startsWith('/') ? _url : `/${_url}`;\n let url = (baseUrl ?? '') + pathUrl;\n if (path) {\n url = defaultPathSerializer({ path, url });\n }\n let search = query ? querySerializer(query) : '';\n if (search.startsWith('?')) {\n search = search.substring(1);\n }\n if (search) {\n url += `?${search}`;\n }\n return url;\n};\n\nexport function getValidRequestBody(options: {\n body?: unknown;\n bodySerializer?: BodySerializer | null;\n serializedBody?: unknown;\n}): unknown {\n const hasBody = options.body !== undefined;\n const isSerializedBody = hasBody && options.bodySerializer;\n\n if (isSerializedBody) {\n if ('serializedBody' in options) {\n const hasSerializedBody =\n options.serializedBody !== undefined && options.serializedBody !== '';\n\n return hasSerializedBody ? options.serializedBody : null;\n }\n\n // not all clients implement a serializedBody property (i.e., client-axios)\n return options.body !== '' ? options.body : null;\n }\n\n // plain/text body\n if (hasBody) {\n return options.body;\n }\n\n // no body was provided\n return undefined;\n}\n","// This file is auto-generated by @hey-api/openapi-ts\n\nexport type AuthToken = string | undefined;\n\nexport interface Auth {\n /**\n * Which part of the request do we use to send the auth?\n *\n * @default 'header'\n */\n in?: 'header' | 'query' | 'cookie';\n /**\n * A unique identifier for the security scheme.\n *\n * Defined only when there are multiple security schemes whose `Auth`\n * shape would otherwise be identical.\n */\n key?: string;\n /**\n * Header or query parameter name.\n *\n * @default 'Authorization'\n */\n name?: string;\n scheme?: 'basic' | 'bearer';\n type: 'apiKey' | 'http';\n}\n\nexport const getAuthToken = async (\n auth: Auth,\n callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken,\n): Promise<string | undefined> => {\n const token = typeof callback === 'function' ? await callback(auth) : callback;\n\n if (!token) {\n return;\n }\n\n if (auth.scheme === 'bearer') {\n return `Bearer ${token}`;\n }\n\n if (auth.scheme === 'basic') {\n return `Basic ${btoa(token)}`;\n }\n\n return token;\n};\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport { getAuthToken } from '../core/auth.gen';\nimport type { QuerySerializerOptions } from '../core/bodySerializer.gen';\nimport { jsonBodySerializer } from '../core/bodySerializer.gen';\nimport {\n serializeArrayParam,\n serializeObjectParam,\n serializePrimitiveParam,\n} from '../core/pathSerializer.gen';\nimport { getUrl } from '../core/utils.gen';\nimport type { Client, ClientOptions, Config, RequestOptions } from './types.gen';\n\nexport const createQuerySerializer = <T = unknown>({\n parameters = {},\n ...args\n}: QuerySerializerOptions = {}): ((queryParams: T) => string) => {\n const querySerializer = (queryParams: T): string => {\n const search: string[] = [];\n if (queryParams && typeof queryParams === 'object') {\n for (const name in queryParams) {\n const value = queryParams[name];\n\n if (value === undefined || value === null) {\n continue;\n }\n\n const options = parameters[name] || args;\n\n if (Array.isArray(value)) {\n const serializedArray = serializeArrayParam({\n allowReserved: options.allowReserved,\n explode: true,\n name,\n style: 'form',\n value,\n ...options.array,\n });\n if (serializedArray) search.push(serializedArray);\n } else if (typeof value === 'object') {\n const serializedObject = serializeObjectParam({\n allowReserved: options.allowReserved,\n explode: true,\n name,\n style: 'deepObject',\n value: value as Record<string, unknown>,\n ...options.object,\n });\n if (serializedObject) search.push(serializedObject);\n } else {\n const serializedPrimitive = serializePrimitiveParam({\n allowReserved: options.allowReserved,\n name,\n value: value as string,\n });\n if (serializedPrimitive) search.push(serializedPrimitive);\n }\n }\n }\n return search.join('&');\n };\n return querySerializer;\n};\n\n/**\n * Infers parseAs value from provided Content-Type header.\n */\nexport const getParseAs = (contentType: string | null): Exclude<Config['parseAs'], 'auto'> => {\n if (!contentType) {\n // If no Content-Type header is provided, the best we can do is return the raw response body,\n // which is effectively the same as the 'stream' option.\n return 'stream';\n }\n\n const cleanContent = contentType.split(';')[0]?.trim();\n\n if (!cleanContent) {\n return;\n }\n\n if (cleanContent.startsWith('application/json') || cleanContent.endsWith('+json')) {\n return 'json';\n }\n\n if (cleanContent === 'multipart/form-data') {\n return 'formData';\n }\n\n if (\n ['application/', 'audio/', 'image/', 'video/'].some((type) => cleanContent.startsWith(type))\n ) {\n return 'blob';\n }\n\n if (cleanContent.startsWith('text/')) {\n return 'text';\n }\n\n return;\n};\n\nconst checkForExistence = (\n options: Pick<RequestOptions, 'auth' | 'query'> & {\n headers: Headers;\n },\n name?: string,\n): boolean => {\n if (!name) {\n return false;\n }\n if (\n options.headers.has(name) ||\n options.query?.[name] ||\n options.headers.get('Cookie')?.includes(`${name}=`)\n ) {\n return true;\n }\n return false;\n};\n\nexport async function setAuthParams(\n options: Pick<RequestOptions, 'auth' | 'query' | 'security'> & {\n headers: Headers;\n },\n): Promise<void> {\n for (const auth of options.security ?? []) {\n if (checkForExistence(options, auth.name)) {\n continue;\n }\n\n const token = await getAuthToken(auth, options.auth);\n\n if (!token) {\n continue;\n }\n\n const name = auth.name ?? 'Authorization';\n\n switch (auth.in) {\n case 'query':\n if (!options.query) {\n options.query = {};\n }\n options.query[name] = token;\n break;\n case 'cookie':\n options.headers.append('Cookie', `${name}=${token}`);\n break;\n case 'header':\n default:\n options.headers.set(name, token);\n break;\n }\n }\n}\n\nexport const buildUrl: Client['buildUrl'] = (options) =>\n getUrl({\n baseUrl: options.baseUrl as string,\n path: options.path,\n query: options.query,\n querySerializer:\n typeof options.querySerializer === 'function'\n ? options.querySerializer\n : createQuerySerializer(options.querySerializer),\n url: options.url,\n });\n\nexport const mergeConfigs = (a: Config, b: Config): Config => {\n const config = { ...a, ...b };\n if (config.baseUrl?.endsWith('/')) {\n config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);\n }\n config.headers = mergeHeaders(a.headers, b.headers);\n return config;\n};\n\nconst headersEntries = (headers: Headers): Array<[string, string]> => {\n const entries: Array<[string, string]> = [];\n headers.forEach((value, key) => {\n entries.push([key, value]);\n });\n return entries;\n};\n\nexport const mergeHeaders = (\n ...headers: Array<Required<Config>['headers'] | undefined>\n): Headers => {\n const mergedHeaders = new Headers();\n for (const header of headers) {\n if (!header) {\n continue;\n }\n\n const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);\n\n for (const [key, value] of iterator) {\n if (value === null) {\n mergedHeaders.delete(key);\n } else if (Array.isArray(value)) {\n for (const v of value) {\n mergedHeaders.append(key, v as string);\n }\n } else if (value !== undefined) {\n // assume object headers are meant to be JSON stringified, i.e., their\n // content value in OpenAPI specification is 'application/json'\n mergedHeaders.set(\n key,\n typeof value === 'object' ? JSON.stringify(value) : (value as string),\n );\n }\n }\n }\n return mergedHeaders;\n};\n\ntype ErrInterceptor<Err, Res, Req, Options> = (\n error: Err,\n /** response may be undefined due to a network error where no response object is produced */\n response: Res | undefined,\n /** request may be undefined, because error may be from building the request object itself */\n request: Req | undefined,\n options: Options,\n) => Err | Promise<Err>;\n\ntype ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;\n\ntype ResInterceptor<Res, Req, Options> = (\n response: Res,\n request: Req,\n options: Options,\n) => Res | Promise<Res>;\n\nclass Interceptors<Interceptor> {\n fns: Array<Interceptor | null> = [];\n\n clear(): void {\n this.fns = [];\n }\n\n eject(id: number | Interceptor): void {\n const index = this.getInterceptorIndex(id);\n if (this.fns[index]) {\n this.fns[index] = null;\n }\n }\n\n exists(id: number | Interceptor): boolean {\n const index = this.getInterceptorIndex(id);\n return Boolean(this.fns[index]);\n }\n\n getInterceptorIndex(id: number | Interceptor): number {\n if (typeof id === 'number') {\n return this.fns[id] ? id : -1;\n }\n return this.fns.indexOf(id);\n }\n\n update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false {\n const index = this.getInterceptorIndex(id);\n if (this.fns[index]) {\n this.fns[index] = fn;\n return id;\n }\n return false;\n }\n\n use(fn: Interceptor): number {\n this.fns.push(fn);\n return this.fns.length - 1;\n }\n}\n\nexport interface Middleware<Req, Res, Err, Options> {\n error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;\n request: Interceptors<ReqInterceptor<Req, Options>>;\n response: Interceptors<ResInterceptor<Res, Req, Options>>;\n}\n\nexport const createInterceptors = <Req, Res, Err, Options>(): Middleware<\n Req,\n Res,\n Err,\n Options\n> => ({\n error: new Interceptors<ErrInterceptor<Err, Res, Req, Options>>(),\n request: new Interceptors<ReqInterceptor<Req, Options>>(),\n response: new Interceptors<ResInterceptor<Res, Req, Options>>(),\n});\n\nconst defaultQuerySerializer = createQuerySerializer({\n allowReserved: false,\n array: {\n explode: true,\n style: 'form',\n },\n object: {\n explode: true,\n style: 'deepObject',\n },\n});\n\nconst defaultHeaders = {\n 'Content-Type': 'application/json',\n};\n\nexport const createConfig = <T extends ClientOptions = ClientOptions>(\n override: Config<Omit<ClientOptions, keyof T> & T> = {},\n): Config<Omit<ClientOptions, keyof T> & T> => ({\n ...jsonBodySerializer,\n headers: defaultHeaders,\n parseAs: 'auto',\n querySerializer: defaultQuerySerializer,\n ...override,\n});\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport { createSseClient } from '../core/serverSentEvents.gen';\nimport type { HttpMethod } from '../core/types.gen';\nimport { getValidRequestBody } from '../core/utils.gen';\nimport type { Client, Config, RequestOptions, ResolvedRequestOptions } from './types.gen';\nimport {\n buildUrl,\n createConfig,\n createInterceptors,\n getParseAs,\n mergeConfigs,\n mergeHeaders,\n setAuthParams,\n} from './utils.gen';\n\ntype ReqInit = Omit<RequestInit, 'body' | 'headers'> & {\n body?: any;\n headers: ReturnType<typeof mergeHeaders>;\n};\n\nexport const createClient = (config: Config = {}): Client => {\n let _config = mergeConfigs(createConfig(), config);\n\n const getConfig = (): Config => ({ ..._config });\n\n const setConfig = (config: Config): Config => {\n _config = mergeConfigs(_config, config);\n return getConfig();\n };\n\n const interceptors = createInterceptors<Request, Response, unknown, ResolvedRequestOptions>();\n\n const beforeRequest = async <\n TData = unknown,\n TResponseStyle extends 'data' | 'fields' = 'fields',\n ThrowOnError extends boolean = boolean,\n Url extends string = string,\n >(\n options: RequestOptions<TData, TResponseStyle, ThrowOnError, Url>,\n ) => {\n const opts = {\n ..._config,\n ...options,\n fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,\n headers: mergeHeaders(_config.headers, options.headers),\n serializedBody: undefined as string | undefined,\n };\n\n if (opts.security) {\n await setAuthParams(opts);\n }\n\n if (opts.requestValidator) {\n await opts.requestValidator(opts);\n }\n\n if (opts.body !== undefined && opts.bodySerializer) {\n opts.serializedBody = opts.bodySerializer(opts.body) as string | undefined;\n }\n\n // remove Content-Type header if body is empty to avoid sending invalid requests\n if (opts.body === undefined || opts.serializedBody === '') {\n opts.headers.delete('Content-Type');\n }\n\n const resolvedOpts = opts as typeof opts &\n ResolvedRequestOptions<TResponseStyle, ThrowOnError, Url>;\n const url = buildUrl(resolvedOpts);\n\n return { opts: resolvedOpts, url };\n };\n\n const request: Client['request'] = async (options) => {\n const throwOnError = options.throwOnError ?? _config.throwOnError;\n const responseStyle = options.responseStyle ?? _config.responseStyle;\n\n let request: Request | undefined;\n let response: Response | undefined;\n\n try {\n const { opts, url } = await beforeRequest(options);\n const requestInit: ReqInit = {\n redirect: 'follow',\n ...opts,\n body: getValidRequestBody(opts),\n };\n\n request = new Request(url, requestInit);\n\n for (const fn of interceptors.request.fns) {\n if (fn) {\n request = await fn(request, opts);\n }\n }\n\n // fetch must be assigned here, otherwise it would throw the error:\n // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation\n const _fetch = opts.fetch!;\n\n response = await _fetch(request);\n\n for (const fn of interceptors.response.fns) {\n if (fn) {\n response = await fn(response, request, opts);\n }\n }\n\n const result = {\n request,\n response,\n };\n\n if (response.ok) {\n const parseAs =\n (opts.parseAs === 'auto'\n ? getParseAs(response.headers.get('Content-Type'))\n : opts.parseAs) ?? 'json';\n\n if (response.status === 204 || response.headers.get('Content-Length') === '0') {\n let emptyData: any;\n switch (parseAs) {\n case 'arrayBuffer':\n case 'blob':\n case 'text':\n emptyData = await response[parseAs]();\n break;\n case 'formData':\n emptyData = new FormData();\n break;\n case 'stream':\n emptyData = response.body;\n break;\n case 'json':\n default:\n emptyData = {};\n break;\n }\n return opts.responseStyle === 'data'\n ? emptyData\n : {\n data: emptyData,\n ...result,\n };\n }\n\n let data: any;\n switch (parseAs) {\n case 'arrayBuffer':\n case 'blob':\n case 'formData':\n case 'text':\n data = await response[parseAs]();\n break;\n case 'json': {\n // Some servers return 200 with no Content-Length and empty body.\n // response.json() would throw; read as text and parse if non-empty.\n const text = await response.text();\n data = text ? JSON.parse(text) : {};\n break;\n }\n case 'stream':\n return opts.responseStyle === 'data'\n ? response.body\n : {\n data: response.body,\n ...result,\n };\n }\n\n if (parseAs === 'json') {\n if (opts.responseValidator) {\n await opts.responseValidator(data);\n }\n\n if (opts.responseTransformer) {\n data = await opts.responseTransformer(data);\n }\n }\n\n return opts.responseStyle === 'data'\n ? data\n : {\n data,\n ...result,\n };\n }\n\n const textError = await response.text();\n let jsonError: unknown;\n\n try {\n jsonError = JSON.parse(textError);\n } catch {\n // noop\n }\n\n throw jsonError ?? textError;\n } catch (error) {\n let finalError = error;\n\n for (const fn of interceptors.error.fns) {\n if (fn) {\n finalError = await fn(finalError, response, request, options as ResolvedRequestOptions);\n }\n }\n\n finalError = finalError || {};\n\n if (throwOnError) {\n throw finalError;\n }\n\n // TODO: we probably want to return error and improve types\n return responseStyle === 'data'\n ? undefined\n : {\n error: finalError,\n request,\n response,\n };\n }\n };\n\n const makeMethodFn = (method: Uppercase<HttpMethod>) => (options: RequestOptions) =>\n request({ ...options, method });\n\n const makeSseFn = (method: Uppercase<HttpMethod>) => async (options: RequestOptions) => {\n const { opts, url } = await beforeRequest(options);\n return createSseClient({\n ...opts,\n // Request interceptors can replace fetch when the stream starts.\n fetch: (input, init) => {\n const transport = opts.fetch!;\n return transport(input, init);\n },\n body: opts.body as BodyInit | null | undefined,\n method,\n onRequest: async (url, init) => {\n let request = new Request(url, init);\n for (const fn of interceptors.request.fns) {\n if (fn) {\n request = await fn(request, opts);\n }\n }\n return request;\n },\n serializedBody: getValidRequestBody(opts) as BodyInit | null | undefined,\n url,\n });\n };\n\n const _buildUrl: Client['buildUrl'] = (options) => buildUrl({ ..._config, ...options });\n\n return {\n buildUrl: _buildUrl,\n connect: makeMethodFn('CONNECT'),\n delete: makeMethodFn('DELETE'),\n get: makeMethodFn('GET'),\n getConfig,\n head: makeMethodFn('HEAD'),\n interceptors,\n options: makeMethodFn('OPTIONS'),\n patch: makeMethodFn('PATCH'),\n post: makeMethodFn('POST'),\n put: makeMethodFn('PUT'),\n request,\n setConfig,\n sse: {\n connect: makeSseFn('CONNECT'),\n delete: makeSseFn('DELETE'),\n get: makeSseFn('GET'),\n head: makeSseFn('HEAD'),\n options: makeSseFn('OPTIONS'),\n patch: makeSseFn('PATCH'),\n post: makeSseFn('POST'),\n put: makeSseFn('PUT'),\n trace: makeSseFn('TRACE'),\n },\n trace: makeMethodFn('TRACE'),\n } as Client;\n};\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport { type Client, type ClientOptions, type Config, createClient, createConfig } from './client';\nimport type { ClientOptions as ClientOptions2 } from './types.gen';\n\n/**\n * The `createClientConfig()` function will be called on client initialization\n * and the returned object will become the client's initial configuration.\n *\n * You may want to initialize your client this way instead of calling\n * `setConfig()`. This is useful for example if you're using Next.js\n * to ensure your client always has the correct values.\n */\nexport type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;\n\nexport const client: Client = createClient(createConfig<ClientOptions2>({ baseUrl: 'https://api.notte.cc' }));\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport { type Client, type ClientMeta, formDataBodySerializer, type Options as Options2, type RequestResult, type TDataShape } from './client';\nimport { client } from './client.gen';\nimport type { AccountChangesData, AccountChangesErrors, AccountChangesResponses, AccountRunsData, AccountRunsErrors, AccountRunsResponses, AgentStartData, AgentStartErrors, AgentStartResponses, AgentStatusData, AgentStatusErrors, AgentStatusResponses, AgentStopData, AgentStopErrors, AgentStopResponses, AnythingStartData, AnythingStartErrors, AnythingStartResponses, AttemptsData, AttemptsErrors, AttemptsResponses, BrandRetrieveData, BrandRetrieveErrors, BrandRetrieveResponses, ChangesData, ChangesErrors, ChangesResponses, ConnectLinkContextData, ConnectLinkContextErrors, ConnectLinkContextResponses, ConnectLinkMailboxConnectData, ConnectLinkMailboxConnectErrors, ConnectLinkMailboxConnectResponses, ConnectLinkMailboxesData, ConnectLinkMailboxesErrors, ConnectLinkMailboxesResponses, ConnectLinkMailboxSyncData, ConnectLinkMailboxSyncErrors, ConnectLinkMailboxSyncResponses, ConnectLinkStatusData, ConnectLinkStatusErrors, ConnectLinkStatusResponses, ConnectLinkSubmitData, ConnectLinkSubmitErrors, ConnectLinkSubmitResponses, ConnectPaymentWalletData, ConnectPaymentWalletErrors, ConnectPaymentWalletResponses, CreateData, CreateErrors, CreatePaymentData, CreatePaymentErrors, CreatePaymentResponses, CreateResponses, CreditUsageData, CreditUsageErrors, CreditUsageResponses, DeleteData, DeleteErrors, DeleteResponses, DeleteSecretData, DeleteSecretErrors, DeleteSecretResponses, DeleteSessionFileData, DeleteSessionFileErrors, DeleteSessionFileResponses, DeliveriesData, DeliveriesErrors, DeliveriesResponses, DetailData, DetailErrors, DetailResponses, DisconnectPaymentWalletData, DisconnectPaymentWalletErrors, DisconnectPaymentWalletResponses, DownloadRunPayloadData, DownloadRunPayloadErrors, DownloadRunPayloadResponses, DownloadSessionFileData, DownloadSessionFileErrors, DownloadSessionFileResponses, ExecuteSessionFileData, ExecuteSessionFileErrors, ExecuteSessionFileResponses, ExtractProductEndpointData, ExtractProductEndpointErrors, ExtractProductEndpointResponses, FetchSpecializedDataData, FetchSpecializedDataErrors, FetchSpecializedDataResponses, FunctionConditionalRollbackData, FunctionConditionalRollbackErrors, FunctionConditionalRollbackResponses, FunctionCreateData, FunctionCreateErrors, FunctionCreateResponses, FunctionDeleteData, FunctionDeleteErrors, FunctionDeleteResponses, FunctionDownloadUrlData, FunctionDownloadUrlErrors, FunctionDownloadUrlResponses, FunctionForkData, FunctionForkErrors, FunctionForkResponses, FunctionMetadataUpdateData, FunctionMetadataUpdateErrors, FunctionMetadataUpdateResponses, FunctionRollbackData, FunctionRollbackErrors, FunctionRollbackResponses, FunctionRunGetMetadataData, FunctionRunGetMetadataErrors, FunctionRunGetMetadataResponses, FunctionRunStartData, FunctionRunStartErrors, FunctionRunStartResponses, FunctionRunStopData, FunctionRunStopErrors, FunctionRunStopResponses, FunctionRuntimeHealthData, FunctionRuntimeHealthErrors, FunctionRuntimeHealthResponses, FunctionRunUpdateMetadataData, FunctionRunUpdateMetadataErrors, FunctionRunUpdateMetadataResponses, FunctionScheduleDeleteData, FunctionScheduleDeleteErrors, FunctionScheduleDeleteResponses, FunctionScheduleSetData, FunctionScheduleSetErrors, FunctionScheduleSetResponses, FunctionUpdateData, FunctionUpdateErrors, FunctionUpdateResponses, GetPaymentData, GetPaymentErrors, GetPaymentResponses, GetPolicyData, GetPolicyErrors, GetPolicyResponses, GetScriptData, GetScriptErrors, GetScriptResponses, GetSecretData, GetSecretErrors, GetSecretResponses, GetSessionScriptData, GetSessionScriptErrors, GetSessionScriptResponses, GetUsageData, GetUsageErrors, GetUsageLogsData, GetUsageLogsErrors, GetUsageLogsResponses, GetUsageResponses, HealthCheckData, HealthCheckResponses, HistoryData, HistoryErrors, HistoryResponses, InvalidateData, InvalidateErrors, InvalidateResponses, LimitsData, LimitsErrors, LimitsResponses, ListAgentsData, ListAgentsErrors, ListAgentsResponses, ListAuditEventsData, ListAuditEventsErrors, ListAuditEventsResponses, ListDataApisData, ListDataApisErrors, ListDataApisResponses, ListFunctionRunsByFunctionIdData, ListFunctionRunsByFunctionIdErrors, ListFunctionRunsByFunctionIdResponses, ListFunctionsData, ListFunctionsErrors, ListFunctionsResponses, ListMonitorsData, ListMonitorsErrors, ListMonitorsResponses, ListPersonasData, ListPersonasErrors, ListPersonasResponses, ListSecretsData, ListSecretsErrors, ListSecretsResponses, ListSessionFilesData, ListSessionFilesErrors, ListSessionFilesResponses, ListSessionsData, ListSessionsErrors, ListSessionsResponses, ListVaultsData, ListVaultsErrors, ListVaultsResponses, MailboxConnectTokenData, MailboxConnectTokenErrors, MailboxConnectTokenResponses, MailboxDeleteData, MailboxDeleteErrors, MailboxDeleteResponses, MailboxGetData, MailboxGetErrors, MailboxGetResponses, MailboxListData, MailboxListErrors, MailboxListResponses, MailboxSyncData, MailboxSyncErrors, MailboxSyncResponses, MailboxUpdateData, MailboxUpdateErrors, MailboxUpdateResponses, ManagedAuthConnectLinkCreateData, ManagedAuthConnectLinkCreateErrors, ManagedAuthConnectLinkCreateResponses, MapsSearchData, MapsSearchErrors, MapsSearchResponses, NewsSearchData, NewsSearchErrors, NewsSearchResponses, PageExecuteData, PageExecuteErrors, PageExecuteResponses, PageObserveData, PageObserveErrors, PageObserveResponses, PageScrapeData, PageScrapeErrors, PageScrapeResponses, PageScreenshotData, PageScreenshotErrors, PageScreenshotResponses, PeopleEnrichData, PeopleEnrichErrors, PeopleEnrichResponses, PersonaCreateData, PersonaCreateErrors, PersonaCreateResponses, PersonaDeleteData, PersonaDeleteErrors, PersonaDeleteResponses, PersonaEmailsListData, PersonaEmailsListErrors, PersonaEmailsListResponses, PersonaGetData, PersonaGetErrors, PersonaGetResponses, PersonaSmsListData, PersonaSmsListErrors, PersonaSmsListResponses, PersonaUpdateData, PersonaUpdateErrors, PersonaUpdateResponses, PrepareRunPayloadUploadData, PrepareRunPayloadUploadErrors, PrepareRunPayloadUploadResponses, ProfileCookiesGetData, ProfileCookiesGetErrors, ProfileCookiesGetResponses, ProfileCookiesSetData, ProfileCookiesSetErrors, ProfileCookiesSetResponses, ProfileCreateData, ProfileCreateErrors, ProfileCreateResponses, ProfileDeleteData, ProfileDeleteErrors, ProfileDeleteResponses, ProfileDuplicateData, ProfileDuplicateErrors, ProfileDuplicateResponses, ProfileGetData, ProfileGetErrors, ProfileGetResponses, ProfileListData, ProfileListErrors, ProfileListResponses, ProfileStateSetData, ProfileStateSetErrors, ProfileStateSetResponses, ReadyCheckData, ReadyCheckResponses, RetrieveChangeData, RetrieveChangeErrors, RetrieveChangeResponses, RetrieveData, RetrieveDeliveryData, RetrieveDeliveryErrors, RetrieveDeliveryResponses, RetrieveErrors, RetrieveResponses, RetrieveRunData, RetrieveRunErrors, RetrieveRunResponses, RetryData, RetryErrors, RetryResponses, RotateSecretData, RotateSecretErrors, RotateSecretResponses, RunNowData, RunNowErrors, RunNowResponses, RunsData, RunsErrors, RunsResponses, ScrapeFromHtmlData, ScrapeFromHtmlErrors, ScrapeFromHtmlResponses, ScrapeWebpageData, ScrapeWebpageErrors, ScrapeWebpageResponses, SearchWebData, SearchWebErrors, SearchWebResponses, SessionAuthReadinessData, SessionAuthReadinessErrors, SessionAuthReadinessResponses, SessionCookiesGetData, SessionCookiesGetErrors, SessionCookiesGetResponses, SessionCookiesSetData, SessionCookiesSetErrors, SessionCookiesSetResponses, SessionDebugInfoData, SessionDebugInfoErrors, SessionDebugInfoResponses, SessionMouseReplayData, SessionMouseReplayErrors, SessionMouseReplayResponses, SessionNetworkLogsData, SessionNetworkLogsErrors, SessionNetworkLogsResponses, SessionOffsetData, SessionOffsetErrors, SessionOffsetResponses, SessionProfilePreviewData, SessionProfilePreviewErrors, SessionProfilePreviewResponses, SessionProfileSaveData, SessionProfileSaveErrors, SessionProfileSaveResponses, SessionReplayData, SessionReplayErrors, SessionReplayResponses, SessionStartData, SessionStartErrors, SessionStartResponses, SessionStatusData, SessionStatusErrors, SessionStatusResponses, SessionStopData, SessionStopErrors, SessionStopResponses, StoreSecretData, StoreSecretErrors, StoreSecretResponses, StyleguideEndpointData, StyleguideEndpointErrors, StyleguideEndpointResponses, SummaryData, SummaryErrors, SummaryResponses, UpdateData, UpdateErrors, UpdateResponses, UploadSessionFileData, UploadSessionFileErrors, UploadSessionFileResponses, VaultCreateData, VaultCreateErrors, VaultCreateResponses, VaultCredentialsAddData, VaultCredentialsAddErrors, VaultCredentialsAddResponses, VaultCredentialsDeleteData, VaultCredentialsDeleteErrors, VaultCredentialsDeleteResponses, VaultCredentialsGetData, VaultCredentialsGetErrors, VaultCredentialsGetResponses, VaultCredentialsListData, VaultCredentialsListErrors, VaultCredentialsListResponses, VaultCreditCardDeleteData, VaultCreditCardDeleteErrors, VaultCreditCardDeleteResponses, VaultCreditCardGetData, VaultCreditCardGetErrors, VaultCreditCardGetResponses, VaultCreditCardSetData, VaultCreditCardSetErrors, VaultCreditCardSetResponses, VaultDeleteData, VaultDeleteErrors, VaultDeleteResponses, VaultUpdateData, VaultUpdateErrors, VaultUpdateResponses, YoutubeEndpointData, YoutubeEndpointErrors, YoutubeEndpointResponses } from './types.gen';\n\nexport type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {\n /**\n * You can provide a client instance returned by `createClient()` instead of\n * individual options. This might be also useful if you want to implement a\n * custom client.\n */\n client?: Client;\n /**\n * You can pass arbitrary values through the `meta` object. This can be\n * used to access values that aren't defined as part of the SDK function.\n */\n meta?: keyof ClientMeta extends never ? Record<string, unknown> : ClientMeta;\n};\n\n/**\n * Session Auth Readiness\n */\nexport const sessionAuthReadiness = <ThrowOnError extends boolean = false>(options: Options<SessionAuthReadinessData, ThrowOnError>): RequestResult<SessionAuthReadinessResponses, SessionAuthReadinessErrors, ThrowOnError> => (options.client ?? client).get<SessionAuthReadinessResponses, SessionAuthReadinessErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/auth',\n ...options\n});\n\n/**\n * List Sessions\n */\nexport const listSessions = <ThrowOnError extends boolean = false>(options?: Options<ListSessionsData, ThrowOnError>): RequestResult<ListSessionsResponses, ListSessionsErrors, ThrowOnError> => (options?.client ?? client).get<ListSessionsResponses, ListSessionsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions',\n ...options\n});\n\n/**\n * Session Start\n */\nexport const sessionStart = <ThrowOnError extends boolean = false>(options: Options<SessionStartData, ThrowOnError>): RequestResult<SessionStartResponses, SessionStartErrors, ThrowOnError> => (options.client ?? client).post<SessionStartResponses, SessionStartErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/start',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Session Status\n */\nexport const sessionStatus = <ThrowOnError extends boolean = false>(options: Options<SessionStatusData, ThrowOnError>): RequestResult<SessionStatusResponses, SessionStatusErrors, ThrowOnError> => (options.client ?? client).get<SessionStatusResponses, SessionStatusErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}',\n ...options\n});\n\n/**\n * Session Profile Preview\n */\nexport const sessionProfilePreview = <ThrowOnError extends boolean = false>(options: Options<SessionProfilePreviewData, ThrowOnError>): RequestResult<SessionProfilePreviewResponses, SessionProfilePreviewErrors, ThrowOnError> => (options.client ?? client).get<SessionProfilePreviewResponses, SessionProfilePreviewErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/profile-preview',\n ...options\n});\n\n/**\n * Session Profile Save\n */\nexport const sessionProfileSave = <ThrowOnError extends boolean = false>(options: Options<SessionProfileSaveData, ThrowOnError>): RequestResult<SessionProfileSaveResponses, SessionProfileSaveErrors, ThrowOnError> => (options.client ?? client).post<SessionProfileSaveResponses, SessionProfileSaveErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/profile/save',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Session Stop\n */\nexport const sessionStop = <ThrowOnError extends boolean = false>(options: Options<SessionStopData, ThrowOnError>): RequestResult<SessionStopResponses, SessionStopErrors, ThrowOnError> => (options.client ?? client).delete<SessionStopResponses, SessionStopErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/stop',\n ...options\n});\n\n/**\n * Session Cookies Get\n */\nexport const sessionCookiesGet = <ThrowOnError extends boolean = false>(options: Options<SessionCookiesGetData, ThrowOnError>): RequestResult<SessionCookiesGetResponses, SessionCookiesGetErrors, ThrowOnError> => (options.client ?? client).get<SessionCookiesGetResponses, SessionCookiesGetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/cookies',\n ...options\n});\n\n/**\n * Session Cookies Set\n */\nexport const sessionCookiesSet = <ThrowOnError extends boolean = false>(options: Options<SessionCookiesSetData, ThrowOnError>): RequestResult<SessionCookiesSetResponses, SessionCookiesSetErrors, ThrowOnError> => (options.client ?? client).post<SessionCookiesSetResponses, SessionCookiesSetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/cookies',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Session Debug Info\n */\nexport const sessionDebugInfo = <ThrowOnError extends boolean = false>(options: Options<SessionDebugInfoData, ThrowOnError>): RequestResult<SessionDebugInfoResponses, SessionDebugInfoErrors, ThrowOnError> => (options.client ?? client).get<SessionDebugInfoResponses, SessionDebugInfoErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/debug',\n ...options\n});\n\n/**\n * Session Offset\n */\nexport const sessionOffset = <ThrowOnError extends boolean = false>(options: Options<SessionOffsetData, ThrowOnError>): RequestResult<SessionOffsetResponses, SessionOffsetErrors, ThrowOnError> => (options.client ?? client).get<SessionOffsetResponses, SessionOffsetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/offset',\n ...options\n});\n\n/**\n * Page Observe\n */\nexport const pageObserve = <ThrowOnError extends boolean = false>(options: Options<PageObserveData, ThrowOnError>): RequestResult<PageObserveResponses, PageObserveErrors, ThrowOnError> => (options.client ?? client).post<PageObserveResponses, PageObserveErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/page/observe',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Page Screenshot\n */\nexport const pageScreenshot = <ThrowOnError extends boolean = false>(options: Options<PageScreenshotData, ThrowOnError>): RequestResult<PageScreenshotResponses, PageScreenshotErrors, ThrowOnError> => (options.client ?? client).post<PageScreenshotResponses, PageScreenshotErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/page/screenshot',\n ...options\n});\n\n/**\n * Page Execute\n */\nexport const pageExecute = <ThrowOnError extends boolean = false>(options: Options<PageExecuteData, ThrowOnError>): RequestResult<PageExecuteResponses, PageExecuteErrors, ThrowOnError> => (options.client ?? client).post<PageExecuteResponses, PageExecuteErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/page/execute',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Page Scrape\n */\nexport const pageScrape = <ThrowOnError extends boolean = false>(options: Options<PageScrapeData, ThrowOnError>): RequestResult<PageScrapeResponses, PageScrapeErrors, ThrowOnError> => (options.client ?? client).post<PageScrapeResponses, PageScrapeErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/page/scrape',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Session Network Logs\n */\nexport const sessionNetworkLogs = <ThrowOnError extends boolean = false>(options: Options<SessionNetworkLogsData, ThrowOnError>): RequestResult<SessionNetworkLogsResponses, SessionNetworkLogsErrors, ThrowOnError> => (options.client ?? client).get<SessionNetworkLogsResponses, SessionNetworkLogsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/network/logs',\n ...options\n});\n\n/**\n * Session Mouse Replay\n */\nexport const sessionMouseReplay = <ThrowOnError extends boolean = false>(options: Options<SessionMouseReplayData, ThrowOnError>): RequestResult<SessionMouseReplayResponses, SessionMouseReplayErrors, ThrowOnError> => (options.client ?? client).get<SessionMouseReplayResponses, SessionMouseReplayErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/replay/mouse',\n ...options\n});\n\n/**\n * Session Replay\n */\nexport const sessionReplay = <ThrowOnError extends boolean = false>(options: Options<SessionReplayData, ThrowOnError>): RequestResult<SessionReplayResponses, SessionReplayErrors, ThrowOnError> => (options.client ?? client).get<SessionReplayResponses, SessionReplayErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/replay',\n ...options\n});\n\n/**\n * Execute Session File\n */\nexport const executeSessionFile = <ThrowOnError extends boolean = false>(options: Options<ExecuteSessionFileData, ThrowOnError>): RequestResult<ExecuteSessionFileResponses, ExecuteSessionFileErrors, ThrowOnError> => (options.client ?? client).post<ExecuteSessionFileResponses, ExecuteSessionFileErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/page/execute/file',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * List Session Files\n */\nexport const listSessionFiles = <ThrowOnError extends boolean = false>(options: Options<ListSessionFilesData, ThrowOnError>): RequestResult<ListSessionFilesResponses, ListSessionFilesErrors, ThrowOnError> => (options.client ?? client).get<ListSessionFilesResponses, ListSessionFilesErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/files',\n ...options\n});\n\n/**\n * Upload Session File\n */\nexport const uploadSessionFile = <ThrowOnError extends boolean = false>(options: Options<UploadSessionFileData, ThrowOnError>): RequestResult<UploadSessionFileResponses, UploadSessionFileErrors, ThrowOnError> => (options.client ?? client).post<UploadSessionFileResponses, UploadSessionFileErrors, ThrowOnError>({\n ...formDataBodySerializer,\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/files',\n ...options,\n headers: {\n 'Content-Type': null,\n ...options.headers\n }\n});\n\n/**\n * Delete Session File\n */\nexport const deleteSessionFile = <ThrowOnError extends boolean = false>(options: Options<DeleteSessionFileData, ThrowOnError>): RequestResult<DeleteSessionFileResponses, DeleteSessionFileErrors, ThrowOnError> => (options.client ?? client).delete<DeleteSessionFileResponses, DeleteSessionFileErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/files/{file_id}',\n ...options\n});\n\n/**\n * Download Session File\n */\nexport const downloadSessionFile = <ThrowOnError extends boolean = false>(options: Options<DownloadSessionFileData, ThrowOnError>): RequestResult<DownloadSessionFileResponses, DownloadSessionFileErrors, ThrowOnError> => (options.client ?? client).get<DownloadSessionFileResponses, DownloadSessionFileErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/files/{file_id}',\n ...options\n});\n\n/**\n * Function Runtime Health\n */\nexport const functionRuntimeHealth = <ThrowOnError extends boolean = false>(options?: Options<FunctionRuntimeHealthData, ThrowOnError>): RequestResult<FunctionRuntimeHealthResponses, FunctionRuntimeHealthErrors, ThrowOnError> => (options?.client ?? client).get<FunctionRuntimeHealthResponses, FunctionRuntimeHealthErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/health',\n ...options\n});\n\n/**\n * List Functions\n */\nexport const listFunctions = <ThrowOnError extends boolean = false>(options?: Options<ListFunctionsData, ThrowOnError>): RequestResult<ListFunctionsResponses, ListFunctionsErrors, ThrowOnError> => (options?.client ?? client).get<ListFunctionsResponses, ListFunctionsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions',\n ...options\n});\n\n/**\n * Function Create\n */\nexport const functionCreate = <ThrowOnError extends boolean = false>(options: Options<FunctionCreateData, ThrowOnError>): RequestResult<FunctionCreateResponses, FunctionCreateErrors, ThrowOnError> => (options.client ?? client).post<FunctionCreateResponses, FunctionCreateErrors, ThrowOnError>({\n ...formDataBodySerializer,\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions',\n ...options,\n headers: {\n 'Content-Type': null,\n ...options.headers\n }\n});\n\n/**\n * Function Delete\n */\nexport const functionDelete = <ThrowOnError extends boolean = false>(options: Options<FunctionDeleteData, ThrowOnError>): RequestResult<FunctionDeleteResponses, FunctionDeleteErrors, ThrowOnError> => (options.client ?? client).delete<FunctionDeleteResponses, FunctionDeleteErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}',\n ...options\n});\n\n/**\n * Function Download Url\n */\nexport const functionDownloadUrl = <ThrowOnError extends boolean = false>(options: Options<FunctionDownloadUrlData, ThrowOnError>): RequestResult<FunctionDownloadUrlResponses, FunctionDownloadUrlErrors, ThrowOnError> => (options.client ?? client).get<FunctionDownloadUrlResponses, FunctionDownloadUrlErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}',\n ...options\n});\n\n/**\n * Function Metadata Update\n */\nexport const functionMetadataUpdate = <ThrowOnError extends boolean = false>(options: Options<FunctionMetadataUpdateData, ThrowOnError>): RequestResult<FunctionMetadataUpdateResponses, FunctionMetadataUpdateErrors, ThrowOnError> => (options.client ?? client).patch<FunctionMetadataUpdateResponses, FunctionMetadataUpdateErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Function Update\n */\nexport const functionUpdate = <ThrowOnError extends boolean = false>(options: Options<FunctionUpdateData, ThrowOnError>): RequestResult<FunctionUpdateResponses, FunctionUpdateErrors, ThrowOnError> => (options.client ?? client).post<FunctionUpdateResponses, FunctionUpdateErrors, ThrowOnError>({\n ...formDataBodySerializer,\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}',\n ...options,\n headers: {\n 'Content-Type': null,\n ...options.headers\n }\n});\n\n/**\n * Function Fork\n */\nexport const functionFork = <ThrowOnError extends boolean = false>(options: Options<FunctionForkData, ThrowOnError>): RequestResult<FunctionForkResponses, FunctionForkErrors, ThrowOnError> => (options.client ?? client).post<FunctionForkResponses, FunctionForkErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}/fork',\n ...options\n});\n\n/**\n * Function Rollback\n */\nexport const functionRollback = <ThrowOnError extends boolean = false>(options: Options<FunctionRollbackData, ThrowOnError>): RequestResult<FunctionRollbackResponses, FunctionRollbackErrors, ThrowOnError> => (options.client ?? client).post<FunctionRollbackResponses, FunctionRollbackErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}/rollback',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Function Conditional Rollback\n */\nexport const functionConditionalRollback = <ThrowOnError extends boolean = false>(options: Options<FunctionConditionalRollbackData, ThrowOnError>): RequestResult<FunctionConditionalRollbackResponses, FunctionConditionalRollbackErrors, ThrowOnError> => (options.client ?? client).post<FunctionConditionalRollbackResponses, FunctionConditionalRollbackErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}/rollback/conditional',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Function Schedule Delete\n */\nexport const functionScheduleDelete = <ThrowOnError extends boolean = false>(options: Options<FunctionScheduleDeleteData, ThrowOnError>): RequestResult<FunctionScheduleDeleteResponses, FunctionScheduleDeleteErrors, ThrowOnError> => (options.client ?? client).delete<FunctionScheduleDeleteResponses, FunctionScheduleDeleteErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}/schedule',\n ...options\n});\n\n/**\n * Function Schedule Set\n */\nexport const functionScheduleSet = <ThrowOnError extends boolean = false>(options: Options<FunctionScheduleSetData, ThrowOnError>): RequestResult<FunctionScheduleSetResponses, FunctionScheduleSetErrors, ThrowOnError> => (options.client ?? client).post<FunctionScheduleSetResponses, FunctionScheduleSetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}/schedule',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Function Run Start\n */\nexport const functionRunStart = <ThrowOnError extends boolean = false>(options: Options<FunctionRunStartData, ThrowOnError>): RequestResult<FunctionRunStartResponses, FunctionRunStartErrors, ThrowOnError> => (options.client ?? client).post<FunctionRunStartResponses, FunctionRunStartErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}/runs/start',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Function Run Stop\n */\nexport const functionRunStop = <ThrowOnError extends boolean = false>(options: Options<FunctionRunStopData, ThrowOnError>): RequestResult<FunctionRunStopResponses, FunctionRunStopErrors, ThrowOnError> => (options.client ?? client).delete<FunctionRunStopResponses, FunctionRunStopErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}/runs/{run_id}',\n ...options\n});\n\n/**\n * Function Run Get Metadata\n */\nexport const functionRunGetMetadata = <ThrowOnError extends boolean = false>(options: Options<FunctionRunGetMetadataData, ThrowOnError>): RequestResult<FunctionRunGetMetadataResponses, FunctionRunGetMetadataErrors, ThrowOnError> => (options.client ?? client).get<FunctionRunGetMetadataResponses, FunctionRunGetMetadataErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}/runs/{run_id}',\n ...options\n});\n\n/**\n * Function Run Update Metadata\n */\nexport const functionRunUpdateMetadata = <ThrowOnError extends boolean = false>(options: Options<FunctionRunUpdateMetadataData, ThrowOnError>): RequestResult<FunctionRunUpdateMetadataResponses, FunctionRunUpdateMetadataErrors, ThrowOnError> => (options.client ?? client).patch<FunctionRunUpdateMetadataResponses, FunctionRunUpdateMetadataErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}/runs/{run_id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Prepare Run Payload Upload\n */\nexport const prepareRunPayloadUpload = <ThrowOnError extends boolean = false>(options: Options<PrepareRunPayloadUploadData, ThrowOnError>): RequestResult<PrepareRunPayloadUploadResponses, PrepareRunPayloadUploadErrors, ThrowOnError> => (options.client ?? client).post<PrepareRunPayloadUploadResponses, PrepareRunPayloadUploadErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}/runs/{run_id}/payloads/{field}/upload',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Download Run Payload\n */\nexport const downloadRunPayload = <ThrowOnError extends boolean = false>(options: Options<DownloadRunPayloadData, ThrowOnError>): RequestResult<DownloadRunPayloadResponses, DownloadRunPayloadErrors, ThrowOnError> => (options.client ?? client).get<DownloadRunPayloadResponses, DownloadRunPayloadErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}/runs/{run_id}/payloads/{field}',\n ...options\n});\n\n/**\n * List Function Runs By Function Id\n */\nexport const listFunctionRunsByFunctionId = <ThrowOnError extends boolean = false>(options: Options<ListFunctionRunsByFunctionIdData, ThrowOnError>): RequestResult<ListFunctionRunsByFunctionIdResponses, ListFunctionRunsByFunctionIdErrors, ThrowOnError> => (options.client ?? client).get<ListFunctionRunsByFunctionIdResponses, ListFunctionRunsByFunctionIdErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/functions/{function_id}/runs',\n ...options\n});\n\n/**\n * Vault Create\n */\nexport const vaultCreate = <ThrowOnError extends boolean = false>(options: Options<VaultCreateData, ThrowOnError>): RequestResult<VaultCreateResponses, VaultCreateErrors, ThrowOnError> => (options.client ?? client).post<VaultCreateResponses, VaultCreateErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/vaults/create',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Vault Credentials Delete\n */\nexport const vaultCredentialsDelete = <ThrowOnError extends boolean = false>(options: Options<VaultCredentialsDeleteData, ThrowOnError>): RequestResult<VaultCredentialsDeleteResponses, VaultCredentialsDeleteErrors, ThrowOnError> => (options.client ?? client).delete<VaultCredentialsDeleteResponses, VaultCredentialsDeleteErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/vaults/{vault_id}/credentials',\n ...options\n});\n\n/**\n * Vault Credentials Get\n */\nexport const vaultCredentialsGet = <ThrowOnError extends boolean = false>(options: Options<VaultCredentialsGetData, ThrowOnError>): RequestResult<VaultCredentialsGetResponses, VaultCredentialsGetErrors, ThrowOnError> => (options.client ?? client).get<VaultCredentialsGetResponses, VaultCredentialsGetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/vaults/{vault_id}/credentials',\n ...options\n});\n\n/**\n * Vault Credentials Add\n */\nexport const vaultCredentialsAdd = <ThrowOnError extends boolean = false>(options: Options<VaultCredentialsAddData, ThrowOnError>): RequestResult<VaultCredentialsAddResponses, VaultCredentialsAddErrors, ThrowOnError> => (options.client ?? client).post<VaultCredentialsAddResponses, VaultCredentialsAddErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/vaults/{vault_id}/credentials',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Vault Delete\n */\nexport const vaultDelete = <ThrowOnError extends boolean = false>(options: Options<VaultDeleteData, ThrowOnError>): RequestResult<VaultDeleteResponses, VaultDeleteErrors, ThrowOnError> => (options.client ?? client).delete<VaultDeleteResponses, VaultDeleteErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/vaults/{vault_id}',\n ...options\n});\n\n/**\n * Vault Credentials List\n */\nexport const vaultCredentialsList = <ThrowOnError extends boolean = false>(options: Options<VaultCredentialsListData, ThrowOnError>): RequestResult<VaultCredentialsListResponses, VaultCredentialsListErrors, ThrowOnError> => (options.client ?? client).get<VaultCredentialsListResponses, VaultCredentialsListErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/vaults/{vault_id}',\n ...options\n});\n\n/**\n * Vault Update\n */\nexport const vaultUpdate = <ThrowOnError extends boolean = false>(options: Options<VaultUpdateData, ThrowOnError>): RequestResult<VaultUpdateResponses, VaultUpdateErrors, ThrowOnError> => (options.client ?? client).patch<VaultUpdateResponses, VaultUpdateErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/vaults/{vault_id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Vault Credit Card Delete\n */\nexport const vaultCreditCardDelete = <ThrowOnError extends boolean = false>(options: Options<VaultCreditCardDeleteData, ThrowOnError>): RequestResult<VaultCreditCardDeleteResponses, VaultCreditCardDeleteErrors, ThrowOnError> => (options.client ?? client).delete<VaultCreditCardDeleteResponses, VaultCreditCardDeleteErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/vaults/{vault_id}/card',\n ...options\n});\n\n/**\n * Vault Credit Card Get\n */\nexport const vaultCreditCardGet = <ThrowOnError extends boolean = false>(options: Options<VaultCreditCardGetData, ThrowOnError>): RequestResult<VaultCreditCardGetResponses, VaultCreditCardGetErrors, ThrowOnError> => (options.client ?? client).get<VaultCreditCardGetResponses, VaultCreditCardGetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/vaults/{vault_id}/card',\n ...options\n});\n\n/**\n * Vault Credit Card Set\n */\nexport const vaultCreditCardSet = <ThrowOnError extends boolean = false>(options: Options<VaultCreditCardSetData, ThrowOnError>): RequestResult<VaultCreditCardSetResponses, VaultCreditCardSetErrors, ThrowOnError> => (options.client ?? client).post<VaultCreditCardSetResponses, VaultCreditCardSetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/vaults/{vault_id}/card',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * List Vaults\n */\nexport const listVaults = <ThrowOnError extends boolean = false>(options?: Options<ListVaultsData, ThrowOnError>): RequestResult<ListVaultsResponses, ListVaultsErrors, ThrowOnError> => (options?.client ?? client).get<ListVaultsResponses, ListVaultsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/vaults',\n ...options\n});\n\n/**\n * Connect Payment Wallet\n */\nexport const connectPaymentWallet = <ThrowOnError extends boolean = false>(options: Options<ConnectPaymentWalletData, ThrowOnError>): RequestResult<ConnectPaymentWalletResponses, ConnectPaymentWalletErrors, ThrowOnError> => (options.client ?? client).post<ConnectPaymentWalletResponses, ConnectPaymentWalletErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/payments/connect',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Disconnect Payment Wallet\n */\nexport const disconnectPaymentWallet = <ThrowOnError extends boolean = false>(options: Options<DisconnectPaymentWalletData, ThrowOnError>): RequestResult<DisconnectPaymentWalletResponses, DisconnectPaymentWalletErrors, ThrowOnError> => (options.client ?? client).post<DisconnectPaymentWalletResponses, DisconnectPaymentWalletErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/payments/disconnect',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Create Payment\n */\nexport const createPayment = <ThrowOnError extends boolean = false>(options: Options<CreatePaymentData, ThrowOnError>): RequestResult<CreatePaymentResponses, CreatePaymentErrors, ThrowOnError> => (options.client ?? client).post<CreatePaymentResponses, CreatePaymentErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/payments',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Get Payment\n */\nexport const getPayment = <ThrowOnError extends boolean = false>(options: Options<GetPaymentData, ThrowOnError>): RequestResult<GetPaymentResponses, GetPaymentErrors, ThrowOnError> => (options.client ?? client).get<GetPaymentResponses, GetPaymentErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/payments/{payment_id}',\n ...options\n});\n\n/**\n * Profile Create\n */\nexport const profileCreate = <ThrowOnError extends boolean = false>(options: Options<ProfileCreateData, ThrowOnError>): RequestResult<ProfileCreateResponses, ProfileCreateErrors, ThrowOnError> => (options.client ?? client).post<ProfileCreateResponses, ProfileCreateErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/profiles/create',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Profile Delete\n */\nexport const profileDelete = <ThrowOnError extends boolean = false>(options: Options<ProfileDeleteData, ThrowOnError>): RequestResult<ProfileDeleteResponses, ProfileDeleteErrors, ThrowOnError> => (options.client ?? client).delete<ProfileDeleteResponses, ProfileDeleteErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/profiles/{profile_id}',\n ...options\n});\n\n/**\n * Profile Get\n */\nexport const profileGet = <ThrowOnError extends boolean = false>(options: Options<ProfileGetData, ThrowOnError>): RequestResult<ProfileGetResponses, ProfileGetErrors, ThrowOnError> => (options.client ?? client).get<ProfileGetResponses, ProfileGetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/profiles/{profile_id}',\n ...options\n});\n\n/**\n * Profile Duplicate\n */\nexport const profileDuplicate = <ThrowOnError extends boolean = false>(options: Options<ProfileDuplicateData, ThrowOnError>): RequestResult<ProfileDuplicateResponses, ProfileDuplicateErrors, ThrowOnError> => (options.client ?? client).post<ProfileDuplicateResponses, ProfileDuplicateErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/profiles/{profile_id}/duplicate',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Profile Cookies Get\n */\nexport const profileCookiesGet = <ThrowOnError extends boolean = false>(options: Options<ProfileCookiesGetData, ThrowOnError>): RequestResult<ProfileCookiesGetResponses, ProfileCookiesGetErrors, ThrowOnError> => (options.client ?? client).get<ProfileCookiesGetResponses, ProfileCookiesGetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/profiles/{profile_id}/cookies',\n ...options\n});\n\n/**\n * Profile Cookies Set\n */\nexport const profileCookiesSet = <ThrowOnError extends boolean = false>(options: Options<ProfileCookiesSetData, ThrowOnError>): RequestResult<ProfileCookiesSetResponses, ProfileCookiesSetErrors, ThrowOnError> => (options.client ?? client).post<ProfileCookiesSetResponses, ProfileCookiesSetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/profiles/{profile_id}/cookies',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Profile State Set\n */\nexport const profileStateSet = <ThrowOnError extends boolean = false>(options: Options<ProfileStateSetData, ThrowOnError>): RequestResult<ProfileStateSetResponses, ProfileStateSetErrors, ThrowOnError> => (options.client ?? client).post<ProfileStateSetResponses, ProfileStateSetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/profiles/{profile_id}/state',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Profile List\n */\nexport const profileList = <ThrowOnError extends boolean = false>(options?: Options<ProfileListData, ThrowOnError>): RequestResult<ProfileListResponses, ProfileListErrors, ThrowOnError> => (options?.client ?? client).get<ProfileListResponses, ProfileListErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/profiles',\n ...options\n});\n\n/**\n * Persona Create\n */\nexport const personaCreate = <ThrowOnError extends boolean = false>(options: Options<PersonaCreateData, ThrowOnError>): RequestResult<PersonaCreateResponses, PersonaCreateErrors, ThrowOnError> => (options.client ?? client).post<PersonaCreateResponses, PersonaCreateErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/personas/create',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Persona Delete\n */\nexport const personaDelete = <ThrowOnError extends boolean = false>(options: Options<PersonaDeleteData, ThrowOnError>): RequestResult<PersonaDeleteResponses, PersonaDeleteErrors, ThrowOnError> => (options.client ?? client).delete<PersonaDeleteResponses, PersonaDeleteErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/personas/{persona_id}',\n ...options\n});\n\n/**\n * Persona Get\n */\nexport const personaGet = <ThrowOnError extends boolean = false>(options: Options<PersonaGetData, ThrowOnError>): RequestResult<PersonaGetResponses, PersonaGetErrors, ThrowOnError> => (options.client ?? client).get<PersonaGetResponses, PersonaGetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/personas/{persona_id}',\n ...options\n});\n\n/**\n * Persona Update\n */\nexport const personaUpdate = <ThrowOnError extends boolean = false>(options: Options<PersonaUpdateData, ThrowOnError>): RequestResult<PersonaUpdateResponses, PersonaUpdateErrors, ThrowOnError> => (options.client ?? client).patch<PersonaUpdateResponses, PersonaUpdateErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/personas/{persona_id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Persona Emails List\n */\nexport const personaEmailsList = <ThrowOnError extends boolean = false>(options: Options<PersonaEmailsListData, ThrowOnError>): RequestResult<PersonaEmailsListResponses, PersonaEmailsListErrors, ThrowOnError> => (options.client ?? client).get<PersonaEmailsListResponses, PersonaEmailsListErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/personas/{persona_id}/emails',\n ...options\n});\n\n/**\n * List Personas\n */\nexport const listPersonas = <ThrowOnError extends boolean = false>(options?: Options<ListPersonasData, ThrowOnError>): RequestResult<ListPersonasResponses, ListPersonasErrors, ThrowOnError> => (options?.client ?? client).get<ListPersonasResponses, ListPersonasErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/personas',\n ...options\n});\n\n/**\n * Persona Sms List\n */\nexport const personaSmsList = <ThrowOnError extends boolean = false>(options: Options<PersonaSmsListData, ThrowOnError>): RequestResult<PersonaSmsListResponses, PersonaSmsListErrors, ThrowOnError> => (options.client ?? client).get<PersonaSmsListResponses, PersonaSmsListErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/personas/{persona_id}/sms',\n ...options\n});\n\n/**\n * Mailbox Connect Token\n */\nexport const mailboxConnectToken = <ThrowOnError extends boolean = false>(options: Options<MailboxConnectTokenData, ThrowOnError>): RequestResult<MailboxConnectTokenResponses, MailboxConnectTokenErrors, ThrowOnError> => (options.client ?? client).post<MailboxConnectTokenResponses, MailboxConnectTokenErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/mailboxes/connect-token',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Mailbox Sync\n */\nexport const mailboxSync = <ThrowOnError extends boolean = false>(options?: Options<MailboxSyncData, ThrowOnError>): RequestResult<MailboxSyncResponses, MailboxSyncErrors, ThrowOnError> => (options?.client ?? client).post<MailboxSyncResponses, MailboxSyncErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/mailboxes/sync',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n});\n\n/**\n * Mailbox List\n */\nexport const mailboxList = <ThrowOnError extends boolean = false>(options?: Options<MailboxListData, ThrowOnError>): RequestResult<MailboxListResponses, MailboxListErrors, ThrowOnError> => (options?.client ?? client).get<MailboxListResponses, MailboxListErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/mailboxes',\n ...options\n});\n\n/**\n * Mailbox Delete\n */\nexport const mailboxDelete = <ThrowOnError extends boolean = false>(options: Options<MailboxDeleteData, ThrowOnError>): RequestResult<MailboxDeleteResponses, MailboxDeleteErrors, ThrowOnError> => (options.client ?? client).delete<MailboxDeleteResponses, MailboxDeleteErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/mailboxes/{mailbox_id}',\n ...options\n});\n\n/**\n * Mailbox Get\n */\nexport const mailboxGet = <ThrowOnError extends boolean = false>(options: Options<MailboxGetData, ThrowOnError>): RequestResult<MailboxGetResponses, MailboxGetErrors, ThrowOnError> => (options.client ?? client).get<MailboxGetResponses, MailboxGetErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/mailboxes/{mailbox_id}',\n ...options\n});\n\n/**\n * Mailbox Update\n */\nexport const mailboxUpdate = <ThrowOnError extends boolean = false>(options: Options<MailboxUpdateData, ThrowOnError>): RequestResult<MailboxUpdateResponses, MailboxUpdateErrors, ThrowOnError> => (options.client ?? client).patch<MailboxUpdateResponses, MailboxUpdateErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/mailboxes/{mailbox_id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Managed Auth Connect Link Create\n */\nexport const managedAuthConnectLinkCreate = <ThrowOnError extends boolean = false>(options: Options<ManagedAuthConnectLinkCreateData, ThrowOnError>): RequestResult<ManagedAuthConnectLinkCreateResponses, ManagedAuthConnectLinkCreateErrors, ThrowOnError> => (options.client ?? client).post<ManagedAuthConnectLinkCreateResponses, ManagedAuthConnectLinkCreateErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/managed-auth/connect-links',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Connect Link Context\n */\nexport const connectLinkContext = <ThrowOnError extends boolean = false>(options: Options<ConnectLinkContextData, ThrowOnError>): RequestResult<ConnectLinkContextResponses, ConnectLinkContextErrors, ThrowOnError> => (options.client ?? client).post<ConnectLinkContextResponses, ConnectLinkContextErrors, ThrowOnError>({ url: '/managed-auth/connect-links/context', ...options });\n\n/**\n * Connect Link Mailboxes\n */\nexport const connectLinkMailboxes = <ThrowOnError extends boolean = false>(options: Options<ConnectLinkMailboxesData, ThrowOnError>): RequestResult<ConnectLinkMailboxesResponses, ConnectLinkMailboxesErrors, ThrowOnError> => (options.client ?? client).post<ConnectLinkMailboxesResponses, ConnectLinkMailboxesErrors, ThrowOnError>({ url: '/managed-auth/connect-links/mailboxes', ...options });\n\n/**\n * Connect Link Mailbox Connect\n */\nexport const connectLinkMailboxConnect = <ThrowOnError extends boolean = false>(options: Options<ConnectLinkMailboxConnectData, ThrowOnError>): RequestResult<ConnectLinkMailboxConnectResponses, ConnectLinkMailboxConnectErrors, ThrowOnError> => (options.client ?? client).post<ConnectLinkMailboxConnectResponses, ConnectLinkMailboxConnectErrors, ThrowOnError>({\n url: '/managed-auth/connect-links/mailboxes/connect',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Connect Link Mailbox Sync\n */\nexport const connectLinkMailboxSync = <ThrowOnError extends boolean = false>(options: Options<ConnectLinkMailboxSyncData, ThrowOnError>): RequestResult<ConnectLinkMailboxSyncResponses, ConnectLinkMailboxSyncErrors, ThrowOnError> => (options.client ?? client).post<ConnectLinkMailboxSyncResponses, ConnectLinkMailboxSyncErrors, ThrowOnError>({\n url: '/managed-auth/connect-links/mailboxes/sync',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Connect Link Submit\n */\nexport const connectLinkSubmit = <ThrowOnError extends boolean = false>(options: Options<ConnectLinkSubmitData, ThrowOnError>): RequestResult<ConnectLinkSubmitResponses, ConnectLinkSubmitErrors, ThrowOnError> => (options.client ?? client).post<ConnectLinkSubmitResponses, ConnectLinkSubmitErrors, ThrowOnError>({\n url: '/managed-auth/connect-links/submit',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Connect Link Status\n */\nexport const connectLinkStatus = <ThrowOnError extends boolean = false>(options: Options<ConnectLinkStatusData, ThrowOnError>): RequestResult<ConnectLinkStatusResponses, ConnectLinkStatusErrors, ThrowOnError> => (options.client ?? client).get<ConnectLinkStatusResponses, ConnectLinkStatusErrors, ThrowOnError>({ url: '/managed-auth/connect-links/status', ...options });\n\n/**\n * Get Usage\n */\nexport const getUsage = <ThrowOnError extends boolean = false>(options?: Options<GetUsageData, ThrowOnError>): RequestResult<GetUsageResponses, GetUsageErrors, ThrowOnError> => (options?.client ?? client).get<GetUsageResponses, GetUsageErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/usage',\n ...options\n});\n\n/**\n * Get Usage Logs\n */\nexport const getUsageLogs = <ThrowOnError extends boolean = false>(options?: Options<GetUsageLogsData, ThrowOnError>): RequestResult<GetUsageLogsResponses, GetUsageLogsErrors, ThrowOnError> => (options?.client ?? client).get<GetUsageLogsResponses, GetUsageLogsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/usage/logs',\n ...options\n});\n\n/**\n * Anything Start\n */\nexport const anythingStart = <ThrowOnError extends boolean = false>(options: Options<AnythingStartData, ThrowOnError>): RequestResult<AnythingStartResponses, AnythingStartErrors, ThrowOnError> => (options.client ?? client).post<AnythingStartResponses, AnythingStartErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/anything/start',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * List Secrets\n */\nexport const listSecrets = <ThrowOnError extends boolean = false>(options?: Options<ListSecretsData, ThrowOnError>): RequestResult<ListSecretsResponses, ListSecretsErrors, ThrowOnError> => (options?.client ?? client).get<ListSecretsResponses, ListSecretsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/secrets',\n ...options\n});\n\n/**\n * Store Secret\n */\nexport const storeSecret = <ThrowOnError extends boolean = false>(options: Options<StoreSecretData, ThrowOnError>): RequestResult<StoreSecretResponses, StoreSecretErrors, ThrowOnError> => (options.client ?? client).post<StoreSecretResponses, StoreSecretErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/secrets',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Get Secret\n */\nexport const getSecret = <ThrowOnError extends boolean = false>(options: Options<GetSecretData, ThrowOnError>): RequestResult<GetSecretResponses, GetSecretErrors, ThrowOnError> => (options.client ?? client).get<GetSecretResponses, GetSecretErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/secrets/{name}',\n ...options\n});\n\n/**\n * Delete Secret\n */\nexport const deleteSecret = <ThrowOnError extends boolean = false>(options: Options<DeleteSecretData, ThrowOnError>): RequestResult<DeleteSecretResponses, DeleteSecretErrors, ThrowOnError> => (options.client ?? client).delete<DeleteSecretResponses, DeleteSecretErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/secrets/{secret_id}',\n ...options\n});\n\n/**\n * List Audit Events\n */\nexport const listAuditEvents = <ThrowOnError extends boolean = false>(options?: Options<ListAuditEventsData, ThrowOnError>): RequestResult<ListAuditEventsResponses, ListAuditEventsErrors, ThrowOnError> => (options?.client ?? client).get<ListAuditEventsResponses, ListAuditEventsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/audit-events',\n ...options\n});\n\n/**\n * Health Check\n */\nexport const healthCheck = <ThrowOnError extends boolean = false>(options?: Options<HealthCheckData, ThrowOnError>): RequestResult<HealthCheckResponses, unknown, ThrowOnError> => (options?.client ?? client).get<HealthCheckResponses, unknown, ThrowOnError>({ url: '/health', ...options });\n\n/**\n * Ready Check\n */\nexport const readyCheck = <ThrowOnError extends boolean = false>(options?: Options<ReadyCheckData, ThrowOnError>): RequestResult<ReadyCheckResponses, unknown, ThrowOnError> => (options?.client ?? client).get<ReadyCheckResponses, unknown, ThrowOnError>({ url: '/ready', ...options });\n\n/**\n * Scrape Webpage\n */\nexport const scrapeWebpage = <ThrowOnError extends boolean = false>(options: Options<ScrapeWebpageData, ThrowOnError>): RequestResult<ScrapeWebpageResponses, ScrapeWebpageErrors, ThrowOnError> => (options.client ?? client).post<ScrapeWebpageResponses, ScrapeWebpageErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/scrape',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Search Web\n */\nexport const searchWeb = <ThrowOnError extends boolean = false>(options: Options<SearchWebData, ThrowOnError>): RequestResult<SearchWebResponses, SearchWebErrors, ThrowOnError> => (options.client ?? client).post<SearchWebResponses, SearchWebErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/search',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Summary\n */\nexport const summary = <ThrowOnError extends boolean = false>(options?: Options<SummaryData, ThrowOnError>): RequestResult<SummaryResponses, SummaryErrors, ThrowOnError> => (options?.client ?? client).get<SummaryResponses, SummaryErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/analytics',\n ...options\n});\n\n/**\n * History\n */\nexport const history_ = <ThrowOnError extends boolean = false>(options?: Options<HistoryData, ThrowOnError>): RequestResult<HistoryResponses, HistoryErrors, ThrowOnError> => (options?.client ?? client).get<HistoryResponses, HistoryErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/analytics/requests',\n ...options\n});\n\n/**\n * Detail\n */\nexport const detail = <ThrowOnError extends boolean = false>(options: Options<DetailData, ThrowOnError>): RequestResult<DetailResponses, DetailErrors, ThrowOnError> => (options.client ?? client).get<DetailResponses, DetailErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/analytics/requests/{request_id}',\n ...options\n});\n\n/**\n * Invalidate\n */\nexport const invalidate = <ThrowOnError extends boolean = false>(options?: Options<InvalidateData, ThrowOnError>): RequestResult<InvalidateResponses, InvalidateErrors, ThrowOnError> => (options?.client ?? client).delete<InvalidateResponses, InvalidateErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/cache',\n ...options\n});\n\n/**\n * Get Policy\n */\nexport const getPolicy = <ThrowOnError extends boolean = false>(options?: Options<GetPolicyData, ThrowOnError>): RequestResult<GetPolicyResponses, GetPolicyErrors, ThrowOnError> => (options?.client ?? client).get<GetPolicyResponses, GetPolicyErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/cache',\n ...options\n});\n\n/**\n * Brand Retrieve\n */\nexport const brandRetrieve = <ThrowOnError extends boolean = false>(options: Options<BrandRetrieveData, ThrowOnError>): RequestResult<BrandRetrieveResponses, BrandRetrieveErrors, ThrowOnError> => (options.client ?? client).post<BrandRetrieveResponses, BrandRetrieveErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/brand/retrieve',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Extract Product Endpoint\n */\nexport const extractProductEndpoint = <ThrowOnError extends boolean = false>(options: Options<ExtractProductEndpointData, ThrowOnError>): RequestResult<ExtractProductEndpointResponses, ExtractProductEndpointErrors, ThrowOnError> => (options.client ?? client).post<ExtractProductEndpointResponses, ExtractProductEndpointErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/products/extract',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Extract a website styleguide\n */\nexport const styleguideEndpoint = <ThrowOnError extends boolean = false>(options?: Options<StyleguideEndpointData, ThrowOnError>): RequestResult<StyleguideEndpointResponses, StyleguideEndpointErrors, ThrowOnError> => (options?.client ?? client).get<StyleguideEndpointResponses, StyleguideEndpointErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/web/styleguide',\n ...options\n});\n\n/**\n * Maps Search\n */\nexport const mapsSearch = <ThrowOnError extends boolean = false>(options: Options<MapsSearchData, ThrowOnError>): RequestResult<MapsSearchResponses, MapsSearchErrors, ThrowOnError> => (options.client ?? client).post<MapsSearchResponses, MapsSearchErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/maps/search',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * List Monitors\n */\nexport const listMonitors = <ThrowOnError extends boolean = false>(options?: Options<ListMonitorsData, ThrowOnError>): RequestResult<ListMonitorsResponses, ListMonitorsErrors, ThrowOnError> => (options?.client ?? client).get<ListMonitorsResponses, ListMonitorsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors',\n ...options\n});\n\n/**\n * Create\n */\nexport const create = <ThrowOnError extends boolean = false>(options: Options<CreateData, ThrowOnError>): RequestResult<CreateResponses, CreateErrors, ThrowOnError> => (options.client ?? client).post<CreateResponses, CreateErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Limits\n */\nexport const limits = <ThrowOnError extends boolean = false>(options?: Options<LimitsData, ThrowOnError>): RequestResult<LimitsResponses, LimitsErrors, ThrowOnError> => (options?.client ?? client).get<LimitsResponses, LimitsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/limits',\n ...options\n});\n\n/**\n * Credit Usage\n */\nexport const creditUsage = <ThrowOnError extends boolean = false>(options?: Options<CreditUsageData, ThrowOnError>): RequestResult<CreditUsageResponses, CreditUsageErrors, ThrowOnError> => (options?.client ?? client).get<CreditUsageResponses, CreditUsageErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/credit-usage',\n ...options\n});\n\n/**\n * Account Runs\n */\nexport const accountRuns = <ThrowOnError extends boolean = false>(options?: Options<AccountRunsData, ThrowOnError>): RequestResult<AccountRunsResponses, AccountRunsErrors, ThrowOnError> => (options?.client ?? client).get<AccountRunsResponses, AccountRunsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/runs',\n ...options\n});\n\n/**\n * Account Changes\n */\nexport const accountChanges = <ThrowOnError extends boolean = false>(options?: Options<AccountChangesData, ThrowOnError>): RequestResult<AccountChangesResponses, AccountChangesErrors, ThrowOnError> => (options?.client ?? client).get<AccountChangesResponses, AccountChangesErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/changes',\n ...options\n});\n\n/**\n * Delete\n */\nexport const delete_ = <ThrowOnError extends boolean = false>(options: Options<DeleteData, ThrowOnError>): RequestResult<DeleteResponses, DeleteErrors, ThrowOnError> => (options.client ?? client).delete<DeleteResponses, DeleteErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/{monitor_id}',\n ...options\n});\n\n/**\n * Retrieve\n */\nexport const retrieve = <ThrowOnError extends boolean = false>(options: Options<RetrieveData, ThrowOnError>): RequestResult<RetrieveResponses, RetrieveErrors, ThrowOnError> => (options.client ?? client).get<RetrieveResponses, RetrieveErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/{monitor_id}',\n ...options\n});\n\n/**\n * Update\n */\nexport const update = <ThrowOnError extends boolean = false>(options: Options<UpdateData, ThrowOnError>): RequestResult<UpdateResponses, UpdateErrors, ThrowOnError> => (options.client ?? client).patch<UpdateResponses, UpdateErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/{monitor_id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Run Now\n */\nexport const runNow = <ThrowOnError extends boolean = false>(options: Options<RunNowData, ThrowOnError>): RequestResult<RunNowResponses, RunNowErrors, ThrowOnError> => (options.client ?? client).post<RunNowResponses, RunNowErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/{monitor_id}/run',\n ...options\n});\n\n/**\n * Runs\n */\nexport const runs = <ThrowOnError extends boolean = false>(options: Options<RunsData, ThrowOnError>): RequestResult<RunsResponses, RunsErrors, ThrowOnError> => (options.client ?? client).get<RunsResponses, RunsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/{monitor_id}/runs',\n ...options\n});\n\n/**\n * Changes\n */\nexport const changes = <ThrowOnError extends boolean = false>(options: Options<ChangesData, ThrowOnError>): RequestResult<ChangesResponses, ChangesErrors, ThrowOnError> => (options.client ?? client).get<ChangesResponses, ChangesErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/{monitor_id}/changes',\n ...options\n});\n\n/**\n * Retrieve Run\n */\nexport const retrieveRun = <ThrowOnError extends boolean = false>(options: Options<RetrieveRunData, ThrowOnError>): RequestResult<RetrieveRunResponses, RetrieveRunErrors, ThrowOnError> => (options.client ?? client).get<RetrieveRunResponses, RetrieveRunErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/{monitor_id}/runs/{run_id}',\n ...options\n});\n\n/**\n * Retrieve Change\n */\nexport const retrieveChange = <ThrowOnError extends boolean = false>(options: Options<RetrieveChangeData, ThrowOnError>): RequestResult<RetrieveChangeResponses, RetrieveChangeErrors, ThrowOnError> => (options.client ?? client).get<RetrieveChangeResponses, RetrieveChangeErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/{monitor_id}/changes/{change_id}',\n ...options\n});\n\n/**\n * Rotate Secret\n */\nexport const rotateSecret = <ThrowOnError extends boolean = false>(options: Options<RotateSecretData, ThrowOnError>): RequestResult<RotateSecretResponses, RotateSecretErrors, ThrowOnError> => (options.client ?? client).post<RotateSecretResponses, RotateSecretErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/monitors/{monitor_id}/webhook/rotate-secret',\n ...options\n});\n\n/**\n * Deliveries\n */\nexport const deliveries = <ThrowOnError extends boolean = false>(options: Options<DeliveriesData, ThrowOnError>): RequestResult<DeliveriesResponses, DeliveriesErrors, ThrowOnError> => (options.client ?? client).post<DeliveriesResponses, DeliveriesErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/webhooks/deliveries',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Retrieve Delivery\n */\nexport const retrieveDelivery = <ThrowOnError extends boolean = false>(options: Options<RetrieveDeliveryData, ThrowOnError>): RequestResult<RetrieveDeliveryResponses, RetrieveDeliveryErrors, ThrowOnError> => (options.client ?? client).get<RetrieveDeliveryResponses, RetrieveDeliveryErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/webhooks/deliveries/{delivery_id}',\n ...options\n});\n\n/**\n * Attempts\n */\nexport const attempts = <ThrowOnError extends boolean = false>(options: Options<AttemptsData, ThrowOnError>): RequestResult<AttemptsResponses, AttemptsErrors, ThrowOnError> => (options.client ?? client).get<AttemptsResponses, AttemptsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/webhooks/deliveries/{delivery_id}/attempts',\n ...options\n});\n\n/**\n * Retry\n */\nexport const retry = <ThrowOnError extends boolean = false>(options: Options<RetryData, ThrowOnError>): RequestResult<RetryResponses, RetryErrors, ThrowOnError> => (options.client ?? client).post<RetryResponses, RetryErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/webhooks/deliveries/{delivery_id}/retry',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * People Enrich\n */\nexport const peopleEnrich = <ThrowOnError extends boolean = false>(options: Options<PeopleEnrichData, ThrowOnError>): RequestResult<PeopleEnrichResponses, PeopleEnrichErrors, ThrowOnError> => (options.client ?? client).post<PeopleEnrichResponses, PeopleEnrichErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/people/enrich',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * News Search\n */\nexport const newsSearch = <ThrowOnError extends boolean = false>(options: Options<NewsSearchData, ThrowOnError>): RequestResult<NewsSearchResponses, NewsSearchErrors, ThrowOnError> => (options.client ?? client).post<NewsSearchResponses, NewsSearchErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/news/search',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Fetch Specialized Data\n */\nexport const fetchSpecializedData = <ThrowOnError extends boolean = false>(options: Options<FetchSpecializedDataData, ThrowOnError>): RequestResult<FetchSpecializedDataResponses, FetchSpecializedDataErrors, ThrowOnError> => (options.client ?? client).post<FetchSpecializedDataResponses, FetchSpecializedDataErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/web/fetch',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Youtube Endpoint\n */\nexport const youtubeEndpoint = <ThrowOnError extends boolean = false>(options: Options<YoutubeEndpointData, ThrowOnError>): RequestResult<YoutubeEndpointResponses, YoutubeEndpointErrors, ThrowOnError> => (options.client ?? client).post<YoutubeEndpointResponses, YoutubeEndpointErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data/youtube/extract',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * List Data Apis\n */\nexport const listDataApis = <ThrowOnError extends boolean = false>(options?: Options<ListDataApisData, ThrowOnError>): RequestResult<ListDataApisResponses, ListDataApisErrors, ThrowOnError> => (options?.client ?? client).get<ListDataApisResponses, ListDataApisErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/data',\n ...options\n});\n\n/**\n * Scrape From Html\n */\nexport const scrapeFromHtml = <ThrowOnError extends boolean = false>(options: Options<ScrapeFromHtmlData, ThrowOnError>): RequestResult<ScrapeFromHtmlResponses, ScrapeFromHtmlErrors, ThrowOnError> => (options.client ?? client).post<ScrapeFromHtmlResponses, ScrapeFromHtmlErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/scrape_from_html',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Agent Start\n */\nexport const agentStart = <ThrowOnError extends boolean = false>(options: Options<AgentStartData, ThrowOnError>): RequestResult<AgentStartResponses, AgentStartErrors, ThrowOnError> => (options.client ?? client).post<AgentStartResponses, AgentStartErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/agents/start',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n});\n\n/**\n * Agent Stop\n */\nexport const agentStop = <ThrowOnError extends boolean = false>(options: Options<AgentStopData, ThrowOnError>): RequestResult<AgentStopResponses, AgentStopErrors, ThrowOnError> => (options.client ?? client).delete<AgentStopResponses, AgentStopErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/agents/{agent_id}/stop',\n ...options\n});\n\n/**\n * Agent Status\n *\n * Retrieves the current status of a specific <agent_id>.\n *\n * The most important fields are:\n * - success: Whether the agent task was successful (None if still running)\n * - answer: The answer to the agent task (None if still running)\n *\n * Also you can check the `steps` field to better understand which actions where taken by the agent.\n */\nexport const agentStatus = <ThrowOnError extends boolean = false>(options: Options<AgentStatusData, ThrowOnError>): RequestResult<AgentStatusResponses, AgentStatusErrors, ThrowOnError> => (options.client ?? client).get<AgentStatusResponses, AgentStatusErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/agents/{agent_id}',\n ...options\n});\n\n/**\n * Get Script\n *\n * Retrieves the current status of a specific <agent_id>.\n *\n * The most important fields are:\n * - success: Whether the agent task was successful (None if still running)\n * - answer: The answer to the agent task (None if still running)\n *\n * Also you can check the `steps` field to better understand which actions where taken by the agent.\n */\nexport const getScript = <ThrowOnError extends boolean = false>(options: Options<GetScriptData, ThrowOnError>): RequestResult<GetScriptResponses, GetScriptErrors, ThrowOnError> => (options.client ?? client).get<GetScriptResponses, GetScriptErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/agents/{agent_id}/workflow/code',\n ...options\n});\n\n/**\n * List Agents\n *\n * Retrieves a list of all agents associated with the authenticated user.\n *\n * Parameters:\n * - request: AgentListRequest containing:\n * - only_active: Whether to only return active agents\n * - limit: Maximum number of agents to return\n */\nexport const listAgents = <ThrowOnError extends boolean = false>(options?: Options<ListAgentsData, ThrowOnError>): RequestResult<ListAgentsResponses, ListAgentsErrors, ThrowOnError> => (options?.client ?? client).get<ListAgentsResponses, ListAgentsErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/agents',\n ...options\n});\n\n/**\n * Get Session Script\n *\n * Generate a Python script from a session's trajectory.\n *\n * This endpoint generates executable Python code that replicates the session's actions,\n * with proper `client.AgentFallback` blocks for steps that were executed by agents.\n *\n * Returns both a Python script and JSON actions list.\n */\nexport const getSessionScript = <ThrowOnError extends boolean = false>(options: Options<GetSessionScriptData, ThrowOnError>): RequestResult<GetSessionScriptResponses, GetSessionScriptErrors, ThrowOnError> => (options.client ?? client).get<GetSessionScriptResponses, GetSessionScriptErrors, ThrowOnError>({\n security: [{ scheme: 'bearer', type: 'http' }],\n url: '/sessions/{session_id}/workflow/code',\n ...options\n});\n","import { setTimeout as delay } from 'node:timers/promises';\nimport type { NotteClient } from '@/client';\nimport { TIMEOUT_HEADER } from '@/client';\nimport { InvalidRequestError, NotteAPIError, NotteError, NotteTimeoutError } from '@/errors';\nimport type { SessionResponse, ManagedAuthOperation } from '@/lib/client/types.gen';\nexport type { ManagedAuthOperation, ManagedAuthReadiness } from '@/lib/client/types.gen';\n\n/** Session response including managed authentication readiness. */\nexport type AuthSessionResponse = SessionResponse;\nexport interface ManagedAuthRunResponse {\n operation_id?: string | null;\n authenticated?: boolean | null;\n connection_id: string;\n status: string;\n message: string;\n}\nexport interface AuthWaitOptions {\n /** Overall waiting deadline, milliseconds. Defaults to 615000. */\n timeoutMs?: number;\n /** Delay between short polling requests, milliseconds. Defaults to 1000. */\n pollIntervalMs?: number;\n signal?: AbortSignal;\n}\nexport interface ManagedAuthRunOptions extends AuthWaitOptions {\n /** Wait for completion. Defaults to true. */\n wait?: boolean;\n /** Additional server-side login attempts, from 0 to 2. Defaults to 0. */\n auth_retry?: number;\n}\nexport class ManagedAuthError extends NotteError {}\n\n/** Poll read-only endpoints; never resubmit session creation or login. */\nexport async function pollAuth<T>(read: (signal: AbortSignal) => Promise<T | undefined>, options: AuthWaitOptions): Promise<T> {\n const timeoutMs = options.timeoutMs ?? 615_000;\n const interval = options.pollIntervalMs ?? 1000;\n if (!Number.isFinite(timeoutMs) || timeoutMs <= 0 || !Number.isFinite(interval) || interval <= 0) {\n throw new InvalidRequestError('timeoutMs and pollIntervalMs must be positive finite numbers');\n }\n const deadline = new AbortController();\n const timer = setTimeout(() => deadline.abort(new NotteTimeoutError('Timed out waiting for authentication')), timeoutMs);\n // Forward caller cancellation without AbortSignal.any (unavailable in Node 20.0–20.2).\n const cancel = () => deadline.abort(options.signal?.reason);\n if (options.signal?.aborted) cancel();\n else options.signal?.addEventListener('abort', cancel, { once: true });\n const signal = deadline.signal;\n let errors = 0;\n try {\n while (true) {\n signal.throwIfAborted();\n try {\n const value = await read(signal);\n signal.throwIfAborted();\n if (value !== undefined) return value;\n errors = 0;\n } catch (error) {\n signal.throwIfAborted();\n const retryable = error instanceof NotteAPIError ? error.statusCode >= 500\n : error instanceof TypeError || error instanceof NotteTimeoutError;\n if (!retryable || ++errors >= 3) throw error;\n }\n await delay(interval, undefined, { signal });\n }\n } catch (error) {\n signal.throwIfAborted();\n throw error;\n } finally {\n clearTimeout(timer);\n options.signal?.removeEventListener('abort', cancel);\n }\n}\n\n/**\n * Connection verification and recovery through `client.managedAuth`.\n *\n * ```typescript\n * const operation = await client.managedAuth.refreshConnection(\"<connection-id>\", { wait: false });\n * await client.managedAuth.waitForAuth(operation);\n * ```\n */\n// Legacy: these four managed-auth routes are absent from the committed OpenAPI snapshot.\nexport class NotteManagedAuth {\n constructor(private readonly client: NotteClient) {}\n\n /** Run only the verifier; this does not submit login credentials. */\n async checkConnection(connectionId: string): Promise<ManagedAuthRunResponse> {\n const response = await this.client.getClient().post<{ 200: ManagedAuthRunResponse }, unknown, true>({\n url: `/managed-auth/connections/${encodeURIComponent(connectionId)}/check`,\n body: {}, headers: { 'Content-Type': 'application/json' }, throwOnError: true,\n });\n return response.data;\n }\n\n async getOperation(operationId: string, options: Pick<AuthWaitOptions, 'signal'> = {}): Promise<ManagedAuthOperation> {\n const response = await this.client.getClient().get<{ 200: ManagedAuthOperation }, unknown, true>({\n url: `/managed-auth/operations/${encodeURIComponent(operationId)}`,\n headers: { [TIMEOUT_HEADER]: '10000' }, signal: options.signal, throwOnError: true,\n });\n return response.data;\n }\n\n /** Wait for an accepted operation. Aborting this wait does not cancel the server operation. */\n async waitForAuth(operation: ManagedAuthOperation, options: AuthWaitOptions = {}): Promise<ManagedAuthOperation> {\n const completed = (value: ManagedAuthOperation) => {\n if (value.status === 'succeeded') return value;\n if (value.status === 'pending' || value.status === 'running') return undefined;\n throw new ManagedAuthError(value.error || 'Connection authentication failed');\n };\n options.signal?.throwIfAborted();\n const result = completed(operation);\n if (result) return result;\n return pollAuth(async signal => completed(await this.getOperation(operation.id, { signal })), options);\n }\n\n /** Verify first, logging in only when required and automatic recovery is allowed. */\n async refreshConnection(connectionId: string, options: ManagedAuthRunOptions = {}): Promise<ManagedAuthOperation> {\n return this.run(connectionId, 'refresh', options);\n }\n\n /** Explicitly request a new login. Conflicting operations remain HTTP 409 errors. */\n async reauthenticateConnection(connectionId: string, options: ManagedAuthRunOptions = {}): Promise<ManagedAuthOperation> {\n return this.run(connectionId, 'reauthenticate', options);\n }\n\n private async run(connectionId: string, action: 'refresh' | 'reauthenticate', options: ManagedAuthRunOptions): Promise<ManagedAuthOperation> {\n options.signal?.throwIfAborted();\n const response = await this.client.getClient().post<{ 202: ManagedAuthOperation }, unknown, true>({\n url: `/managed-auth/connections/${encodeURIComponent(connectionId)}/${action}`,\n body: { auth_retry: options.auth_retry }, headers: { 'Content-Type': 'application/json' },\n signal: options.signal, throwOnError: true,\n });\n return options.wait === false ? response.data : this.waitForAuth(response.data, options);\n }\n}\n","/**\n * Typed error hierarchy mirroring `notte_sdk.errors` and the `notte_core` errors\n * the Python SDK raises. Every error thrown by the SDK extends `NotteError`, so\n * callers can `catch (e) { if (e instanceof NotteError) ... }` and branch on the\n * concrete class or on `NotteAPIError.statusCode`.\n */\nimport type { SerializedError } from '@/lib/client/types.gen';\n\nexport class NotteError extends Error {\n constructor(message: string, options?: { cause?: unknown }) {\n super(message, options);\n this.name = new.target.name;\n }\n}\n\n/**\n * Body of a failed HTTP response, best effort. JSON bodies are exposed as-is;\n * non-JSON bodies (HTML error pages, empty 502s) are wrapped as `{ message }`.\n */\nexport type NotteAPIErrorBody = Record<string, unknown>;\n\nfunction describeBody(error: NotteAPIErrorBody): string {\n try {\n return JSON.stringify(error);\n } catch {\n return String(error);\n }\n}\n\n/** The API answered with a non-2xx status. */\nexport class NotteAPIError extends NotteError {\n readonly path: string;\n readonly statusCode: number;\n readonly error: NotteAPIErrorBody;\n readonly response: Response | undefined;\n\n constructor(path: string, statusCode: number, error: NotteAPIErrorBody, response?: Response) {\n super(`Request to \\`${path}\\` failed with status code ${statusCode}: ${describeBody(error)}`);\n this.path = path;\n this.statusCode = statusCode;\n this.error = error;\n this.response = response;\n }\n\n /** The API's own error message, when it sent one. */\n get apiMessage(): string | undefined {\n const message = this.error.message ?? this.error.detail;\n return typeof message === 'string' ? message : undefined;\n }\n\n static fromBody(path: string, statusCode: number, body: unknown, response?: Response): NotteAPIError {\n return new NotteAPIError(path, statusCode, normalizeErrorBody(body), response);\n }\n}\n\n/** The API flagged the failure as an execution error (`x-error-class: NotteApiExecutionError`). */\nexport class NotteAPIExecutionError extends NotteAPIError {\n constructor(path: string, statusCode: number, error: NotteAPIErrorBody, response?: Response) {\n super(path, statusCode, error, response);\n this.message = `Error on ${path}: ${describeBody(error)}`;\n }\n}\n\n/** Missing or rejected credentials. Not retryable. */\nexport class AuthenticationError extends NotteError {\n constructor(message: string) {\n super(`Authentication failed. ${message}`);\n }\n}\n\n/** The request is malformed. Not retryable. */\nexport class InvalidRequestError extends NotteError {\n constructor(message: string) {\n super(`Invalid request. ${message}`);\n }\n}\n\n/** A request or a wait exceeded its deadline. */\nexport class NotteTimeoutError extends NotteError {}\n\n/** A cloud function run finished with `status: \"failed\"`. */\nexport class FailedToRunCloudFunctionError extends NotteError {\n readonly functionId: string;\n readonly functionRunId: string;\n readonly response: unknown;\n\n constructor(functionId: string, functionRunId: string, response: unknown) {\n super(\n `Function ${functionId} run ${functionRunId} failed: ${\n typeof response === 'string' ? response : describeBody((response ?? {}) as NotteAPIErrorBody)\n }`,\n );\n this.functionId = functionId;\n this.functionRunId = functionRunId;\n this.response = response;\n }\n}\n\n/** Structured scrape extraction failed (`StructuredData.success === false`). */\nexport class ScrapeFailedError extends NotteError {\n readonly structuredError: string | undefined;\n\n constructor(error: string | undefined) {\n super(`Scrape failed: ${error ?? 'unknown error'}`);\n this.structuredError = error;\n }\n}\n\n/**\n * An action executed through `session.execute()` failed. Rehydrated from the\n * structured `exception_detail` payload the API returns, so `errorType` names\n * the concrete server-side error class and the three messages carry the same\n * text Python exposes on `NotteBaseError`.\n */\nexport class ActionExecutionError extends NotteError {\n readonly errorType: string;\n readonly devMessage: string;\n readonly userMessage: string;\n readonly agentMessage: string;\n readonly shouldRetryLater: boolean;\n readonly shouldNotifyTeam: boolean;\n\n constructor(detail: SerializedError) {\n super(detail.dev_message || detail.user_message || detail.error_type);\n this.errorType = detail.error_type;\n this.devMessage = detail.dev_message;\n this.userMessage = detail.user_message;\n this.agentMessage = detail.agent_message;\n this.shouldRetryLater = detail.should_retry_later ?? false;\n this.shouldNotifyTeam = detail.should_notify_team ?? false;\n }\n\n static fromMessage(message: string, errorType = 'NotteBaseError'): ActionExecutionError {\n return new ActionExecutionError({\n error_type: errorType,\n dev_message: message,\n user_message: message,\n agent_message: message,\n });\n }\n}\n\n/** `evaluate_js` reported success but the API build predates the data payload. */\nexport class EvaluateJsNoDataError extends NotteError {\n constructor() {\n super('evaluate_js returned no data. Upgrade the Notte API to a build that returns the evaluated value.');\n }\n}\n\n/** The envelope returned by `session.fetch()` could not be decoded. */\nexport class FetchResponseDecodeError extends NotteError {\n constructor(reason: string) {\n super(`Failed to decode the response returned by the page fetch: ${reason}`);\n }\n}\n\nexport function normalizeErrorBody(body: unknown): NotteAPIErrorBody {\n if (body && typeof body === 'object' && !Array.isArray(body)) {\n return body as NotteAPIErrorBody;\n }\n if (body === undefined || body === null || body === '') {\n return {};\n }\n return { message: typeof body === 'string' ? body : String(body) };\n}\n\nexport interface RetryOptions {\n /** Maximum number of attempts, including the first one. */\n maxTries: number;\n /** Delay between attempts in milliseconds. Defaults to 5000 like the Python decorator. */\n delayMs?: number;\n /** Message of the `Error` raised once every attempt failed. */\n errorMessage?: string;\n /** Only retry when this returns true for the thrown error. Defaults to retrying on any error. */\n shouldRetry?: (error: unknown, attempt: number) => boolean;\n /** Called before sleeping between attempts. Defaults to `console.warn`. */\n onRetry?: (error: unknown, attempt: number, maxTries: number) => void;\n}\n\nconst DEFAULT_RETRY_MESSAGE = 'An error occurred while executing the function. Try again later...';\n\n/**\n * Wrap an async function so it is retried when it throws, mirroring\n * `notte_sdk.errors.retry`. The final failure is raised as an `Error` whose\n * `cause` is the last underlying error.\n *\n * ```ts\n * const start = retry(() => session.start(), { maxTries: 3, delayMs: 1000 });\n * await start();\n * ```\n */\nexport function retry<TArgs extends unknown[], TResult>(\n fn: (...args: TArgs) => Promise<TResult>,\n options: RetryOptions,\n): (...args: TArgs) => Promise<TResult> {\n const {\n maxTries,\n delayMs = 5000,\n errorMessage = DEFAULT_RETRY_MESSAGE,\n shouldRetry = () => true,\n onRetry = (error, attempt, total) => {\n console.warn(`Failed to execute ${fn.name || 'function'}: ${String(error)} (attempt ${attempt}/${total})`);\n },\n } = options;\n if (!Number.isInteger(maxTries) || maxTries < 1) {\n throw new InvalidRequestError('maxTries must be a positive integer');\n }\n\n return async (...args: TArgs): Promise<TResult> => {\n let lastError: unknown;\n for (let attempt = 1; attempt <= maxTries; attempt += 1) {\n try {\n return await fn(...args);\n } catch (error) {\n lastError = error;\n if (attempt === maxTries || !shouldRetry(error, attempt)) {\n break;\n }\n onRetry(error, attempt, maxTries);\n await sleep(delayMs);\n }\n }\n throw new Error(errorMessage, { cause: lastError });\n };\n}\n\nexport function sleep(ms: number): Promise<void> {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n","// Auto-generated by scripts/generate-resources.mjs. Do not edit.\nimport type { Client } from './lib/client/client';\nimport type * as Types from './lib/client/types.gen';\nimport * as operations from './lib/client/sdk.gen';\n\n/** Per-request cancellation; authentication and transport stay bound to NotteClient. */\nexport interface ResourceRequestOptions { signal?: AbortSignal }\n\n/** Low-level API resources. Lifecycle helpers remain on Session/Function. */\nexport function createResources(client: Client, getApiKey: () => string) {\n return {\n sessions: {\n /** sessionAuthReadiness: /sessions/{session_id}/auth. Returns the API response body. */\n authReadiness: async (sessionId: Types.SessionAuthReadinessData['path'][\"session_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionAuthReadinessData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.sessionAuthReadiness({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId } });\n return response.data;\n },\n /** createPayment: /sessions/{session_id}/payments. Returns the API response body. */\n createPayment: async (sessionId: Types.CreatePaymentData['path'][\"session_id\"], body: Types.CreatePaymentData['body'], query: Types.CreatePaymentData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers: Omit<NonNullable<Types.CreatePaymentData['headers']>, 'x-notte-api-key'> }) => {\n const response = await operations.createPayment({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, body, query });\n return response.data;\n },\n /** sessionDebugInfo: /sessions/{session_id}/debug. Returns the API response body. */\n debugInfo: async (sessionId: Types.SessionDebugInfoData['path'][\"session_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionDebugInfoData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.sessionDebugInfo({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId } });\n return response.data;\n },\n /** deleteSessionFile: /sessions/{session_id}/files/{file_id}. Returns the API response body. */\n deleteSessionFile: async (sessionId: Types.DeleteSessionFileData['path'][\"session_id\"], fileId: Types.DeleteSessionFileData['path'][\"file_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.DeleteSessionFileData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.deleteSessionFile({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId, \"file_id\": fileId } });\n return response.data;\n },\n /** downloadSessionFile: /sessions/{session_id}/files/{file_id}. Returns the API response body. */\n downloadSessionFile: async (sessionId: Types.DownloadSessionFileData['path'][\"session_id\"], fileId: Types.DownloadSessionFileData['path'][\"file_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.DownloadSessionFileData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.downloadSessionFile({ client, throwOnError: true, signal: requestOptions.signal, parseAs: \"blob\", headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId, \"file_id\": fileId } });\n return response.data;\n },\n /** pageExecute: /sessions/{session_id}/page/execute. Returns the API response body. */\n execute: async (sessionId: Types.PageExecuteData['path'][\"session_id\"], body: Types.PageExecuteData['body'], query: Types.PageExecuteData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.PageExecuteData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.pageExecute({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, body, query });\n return response.data;\n },\n /** executeSessionFile: /sessions/{session_id}/page/execute/file. Returns the API response body. */\n executeSessionFile: async (sessionId: Types.ExecuteSessionFileData['path'][\"session_id\"], body: Types.ExecuteSessionFileData['body'], query: Types.ExecuteSessionFileData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ExecuteSessionFileData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.executeSessionFile({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, body, query });\n return response.data;\n },\n /** sessionCookiesGet: /sessions/{session_id}/cookies. Returns the API response body. */\n getCookies: async (sessionId: Types.SessionCookiesGetData['path'][\"session_id\"], query: Types.SessionCookiesGetData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionCookiesGetData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.sessionCookiesGet({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, query });\n return response.data;\n },\n /** getSessionScript: /sessions/{session_id}/workflow/code. Returns the API response body. */\n getSessionScript: async (sessionId: Types.GetSessionScriptData['path'][\"session_id\"], query: Types.GetSessionScriptData['query'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.GetSessionScriptData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.getSessionScript({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, query });\n return response.data;\n },\n /** listSessions: /sessions. Returns the API response body. */\n list: async (query: Types.ListSessionsData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ListSessionsData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.listSessions({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, query });\n return response.data;\n },\n /** listSessionFiles: /sessions/{session_id}/files. Returns the API response body. */\n listSessionFiles: async (sessionId: Types.ListSessionFilesData['path'][\"session_id\"], query: Types.ListSessionFilesData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ListSessionFilesData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.listSessionFiles({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, query });\n return response.data;\n },\n /** sessionMouseReplay: /sessions/{session_id}/replay/mouse. Returns the API response body. */\n mouseReplay: async (sessionId: Types.SessionMouseReplayData['path'][\"session_id\"], query: Types.SessionMouseReplayData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionMouseReplayData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.sessionMouseReplay({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, query });\n return response.data;\n },\n /** sessionNetworkLogs: /sessions/{session_id}/network/logs. Returns the API response body. */\n networkLogs: async (sessionId: Types.SessionNetworkLogsData['path'][\"session_id\"], query: Types.SessionNetworkLogsData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionNetworkLogsData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.sessionNetworkLogs({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, query });\n return response.data;\n },\n /** pageObserve: /sessions/{session_id}/page/observe. Returns the API response body. */\n observe: async (sessionId: Types.PageObserveData['path'][\"session_id\"], body: Types.PageObserveData['body'], query: Types.PageObserveData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.PageObserveData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.pageObserve({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, body, query });\n return response.data;\n },\n /** sessionOffset: /sessions/{session_id}/offset. Returns the API response body. */\n offset: async (sessionId: Types.SessionOffsetData['path'][\"session_id\"], query: Types.SessionOffsetData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionOffsetData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.sessionOffset({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, query });\n return response.data;\n },\n /** pageScreenshot: /sessions/{session_id}/page/screenshot. Returns the API response body. */\n pageScreenshot: async (sessionId: Types.PageScreenshotData['path'][\"session_id\"], query: Types.PageScreenshotData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.PageScreenshotData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.pageScreenshot({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, query });\n return response.data;\n },\n /** sessionProfilePreview: /sessions/{session_id}/profile-preview. Returns the API response body. */\n profilePreview: async (sessionId: Types.SessionProfilePreviewData['path'][\"session_id\"], query: Types.SessionProfilePreviewData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionProfilePreviewData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.sessionProfilePreview({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, query });\n return response.data;\n },\n /** sessionReplay: /sessions/{session_id}/replay. Returns the API response body. */\n replay: async (sessionId: Types.SessionReplayData['path'][\"session_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionReplayData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.sessionReplay({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId } });\n return response.data;\n },\n /** sessionProfileSave: /sessions/{session_id}/profile/save. Returns the API response body. */\n saveProfile: async (sessionId: Types.SessionProfileSaveData['path'][\"session_id\"], body: Types.SessionProfileSaveData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionProfileSaveData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.sessionProfileSave({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, body });\n return response.data;\n },\n /** pageScrape: /sessions/{session_id}/page/scrape. Returns the API response body. */\n scrape: async (sessionId: Types.PageScrapeData['path'][\"session_id\"], body: Types.PageScrapeData['body'], query: Types.PageScrapeData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.PageScrapeData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.pageScrape({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, body, query });\n return response.data;\n },\n /** sessionCookiesSet: /sessions/{session_id}/cookies. Returns the API response body. */\n setCookies: async (sessionId: Types.SessionCookiesSetData['path'][\"session_id\"], body: Types.SessionCookiesSetData['body'], query: Types.SessionCookiesSetData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionCookiesSetData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.sessionCookiesSet({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, body, query });\n return response.data;\n },\n /** sessionStart: /sessions/start. Returns the API response body. */\n start: async (body: Types.SessionStartData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionStartData['headers']>, 'x-notte-api-key'> } = {}) => {\n body = { ...body };\n if (body.record_session === true) delete body.record_session;\n if (body.log_session === true) delete body.log_session;\n const response = await operations.sessionStart({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, body });\n return response.data;\n },\n /** sessionStatus: /sessions/{session_id}. Returns the API response body. */\n status: async (sessionId: Types.SessionStatusData['path'][\"session_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionStatusData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.sessionStatus({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId } });\n return response.data;\n },\n /** sessionStop: /sessions/{session_id}/stop. Returns the API response body. */\n stop: async (sessionId: Types.SessionStopData['path'][\"session_id\"], query: Types.SessionStopData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.SessionStopData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.sessionStop({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, query });\n return response.data;\n },\n /** uploadSessionFile: /sessions/{session_id}/files. Returns the API response body. */\n uploadSessionFile: async (sessionId: Types.UploadSessionFileData['path'][\"session_id\"], body: Types.UploadSessionFileData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.UploadSessionFileData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.uploadSessionFile({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, body });\n return response.data;\n },\n },\n files: {\n /** deleteSessionFile: /sessions/{session_id}/files/{file_id}. Returns the API response body. */\n delete: async (sessionId: Types.DeleteSessionFileData['path'][\"session_id\"], fileId: Types.DeleteSessionFileData['path'][\"file_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.DeleteSessionFileData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.deleteSessionFile({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId, \"file_id\": fileId } });\n return response.data;\n },\n /** downloadSessionFile: /sessions/{session_id}/files/{file_id}. Returns the API response body. */\n download: async (sessionId: Types.DownloadSessionFileData['path'][\"session_id\"], fileId: Types.DownloadSessionFileData['path'][\"file_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.DownloadSessionFileData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.downloadSessionFile({ client, throwOnError: true, signal: requestOptions.signal, parseAs: \"blob\", headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId, \"file_id\": fileId } });\n return response.data;\n },\n /** executeSessionFile: /sessions/{session_id}/page/execute/file. Returns the API response body. */\n execute: async (sessionId: Types.ExecuteSessionFileData['path'][\"session_id\"], body: Types.ExecuteSessionFileData['body'], query: Types.ExecuteSessionFileData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ExecuteSessionFileData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.executeSessionFile({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, body, query });\n return response.data;\n },\n /** listSessionFiles: /sessions/{session_id}/files. Returns the API response body. */\n list: async (sessionId: Types.ListSessionFilesData['path'][\"session_id\"], query: Types.ListSessionFilesData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ListSessionFilesData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.listSessionFiles({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, query });\n return response.data;\n },\n /** uploadSessionFile: /sessions/{session_id}/files. Returns the API response body. */\n upload: async (sessionId: Types.UploadSessionFileData['path'][\"session_id\"], body: Types.UploadSessionFileData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.UploadSessionFileData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.uploadSessionFile({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"session_id\": sessionId }, body });\n return response.data;\n },\n },\n functions: {\n /** functionCreate: /functions. Returns the API response body. */\n create: async (body: Types.FunctionCreateData['body'], query: Types.FunctionCreateData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionCreateData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.functionCreate({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, body, query });\n return response.data;\n },\n /** functionDelete: /functions/{function_id}. Returns the API response body. */\n delete: async (functionId: Types.FunctionDeleteData['path'][\"function_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionDeleteData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.functionDelete({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId } });\n return response.data;\n },\n /** functionScheduleDelete: /functions/{function_id}/schedule. Returns the API response body. */\n deleteSchedule: async (functionId: Types.FunctionScheduleDeleteData['path'][\"function_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionScheduleDeleteData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.functionScheduleDelete({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId } });\n return response.data;\n },\n /** downloadRunPayload: /functions/{function_id}/runs/{run_id}/payloads/{field}. Returns the API response body. */\n downloadRunPayload: async (functionId: Types.DownloadRunPayloadData['path'][\"function_id\"], runId: Types.DownloadRunPayloadData['path'][\"run_id\"], field: Types.DownloadRunPayloadData['path'][\"field\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.DownloadRunPayloadData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.downloadRunPayload({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId, \"run_id\": runId, \"field\": field } });\n return response.data;\n },\n /** functionDownloadUrl: /functions/{function_id}. Returns the API response body. */\n downloadUrl: async (functionId: Types.FunctionDownloadUrlData['path'][\"function_id\"], query: Types.FunctionDownloadUrlData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionDownloadUrlData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.functionDownloadUrl({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId }, query });\n return response.data;\n },\n /** functionFork: /functions/{function_id}/fork. Returns the API response body. */\n fork: async (functionId: Types.FunctionForkData['path'][\"function_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionForkData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.functionFork({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId } });\n return response.data;\n },\n /** listFunctions: /functions. Returns the API response body. */\n list: async (query: Types.ListFunctionsData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ListFunctionsData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.listFunctions({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, query });\n return response.data;\n },\n /** listFunctionRunsByFunctionId: /functions/{function_id}/runs. Returns the API response body. */\n listRuns: async (functionId: Types.ListFunctionRunsByFunctionIdData['path'][\"function_id\"], query: Types.ListFunctionRunsByFunctionIdData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ListFunctionRunsByFunctionIdData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.listFunctionRunsByFunctionId({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId }, query });\n return response.data;\n },\n /** functionMetadataUpdate: /functions/{function_id}. Returns the API response body. */\n metadataUpdate: async (functionId: Types.FunctionMetadataUpdateData['path'][\"function_id\"], body: Types.FunctionMetadataUpdateData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionMetadataUpdateData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.functionMetadataUpdate({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId }, body });\n return response.data;\n },\n /** prepareRunPayloadUpload: /functions/{function_id}/runs/{run_id}/payloads/{field}/upload. Returns the API response body. */\n prepareRunPayloadUpload: async (functionId: Types.PrepareRunPayloadUploadData['path'][\"function_id\"], runId: Types.PrepareRunPayloadUploadData['path'][\"run_id\"], field: Types.PrepareRunPayloadUploadData['path'][\"field\"], body: Types.PrepareRunPayloadUploadData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.PrepareRunPayloadUploadData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.prepareRunPayloadUpload({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId, \"run_id\": runId, \"field\": field }, body });\n return response.data;\n },\n /** functionRollback: /functions/{function_id}/rollback. Returns the API response body. */\n rollback: async (functionId: Types.FunctionRollbackData['path'][\"function_id\"], body: Types.FunctionRollbackData['body'], query: Types.FunctionRollbackData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionRollbackData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.functionRollback({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId }, body, query });\n return response.data;\n },\n /** functionRunGetMetadata: /functions/{function_id}/runs/{run_id}. Returns the API response body. */\n runGetMetadata: async (functionId: Types.FunctionRunGetMetadataData['path'][\"function_id\"], runId: Types.FunctionRunGetMetadataData['path'][\"run_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionRunGetMetadataData['headers']>, 'x-notte-api-key'> } = {}, query: Types.FunctionRunGetMetadataData['query'] = undefined) => {\n const response = await operations.functionRunGetMetadata({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId, \"run_id\": runId }, query });\n return response.data;\n },\n /** functionRunStart: /functions/{function_id}/runs/start. Returns the API response body. */\n runStart: async (functionId: Types.FunctionRunStartData['path'][\"function_id\"], body: Types.FunctionRunStartData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionRunStartData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.functionRunStart({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers, 'x-notte-api-key': getApiKey() }, path: { \"function_id\": functionId }, body });\n return response.data;\n },\n /** functionRunStop: /functions/{function_id}/runs/{run_id}. Returns the API response body. */\n runStop: async (functionId: Types.FunctionRunStopData['path'][\"function_id\"], runId: Types.FunctionRunStopData['path'][\"run_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionRunStopData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.functionRunStop({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId, \"run_id\": runId } });\n return response.data;\n },\n /** functionRunUpdateMetadata: /functions/{function_id}/runs/{run_id}. Returns the API response body. */\n runUpdateMetadata: async (functionId: Types.FunctionRunUpdateMetadataData['path'][\"function_id\"], runId: Types.FunctionRunUpdateMetadataData['path'][\"run_id\"], body: Types.FunctionRunUpdateMetadataData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionRunUpdateMetadataData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.functionRunUpdateMetadata({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId, \"run_id\": runId }, body });\n return response.data;\n },\n /** functionRuntimeHealth: /functions/health. Returns the API response body. */\n runtimeHealth: async (requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionRuntimeHealthData['headers']>, 'x-notte-api-key'> } = {}, query: Types.FunctionRuntimeHealthData['query'] = undefined) => {\n const response = await operations.functionRuntimeHealth({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, query });\n return response.data;\n },\n /** functionScheduleSet: /functions/{function_id}/schedule. Returns the API response body. */\n setSchedule: async (functionId: Types.FunctionScheduleSetData['path'][\"function_id\"], body: Types.FunctionScheduleSetData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionScheduleSetData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.functionScheduleSet({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId }, body });\n return response.data;\n },\n /** functionUpdate: /functions/{function_id}. Returns the API response body. */\n update: async (functionId: Types.FunctionUpdateData['path'][\"function_id\"], body: Types.FunctionUpdateData['body'], query: Types.FunctionUpdateData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.FunctionUpdateData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.functionUpdate({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"function_id\": functionId }, body, query });\n return response.data;\n },\n },\n personas: {\n /** personaCreate: /personas/create. Returns the API response body. */\n create: async (body: Types.PersonaCreateData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.PersonaCreateData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.personaCreate({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, body });\n return response.data;\n },\n /** personaDelete: /personas/{persona_id}. Returns the API response body. */\n delete: async (personaId: Types.PersonaDeleteData['path'][\"persona_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.PersonaDeleteData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.personaDelete({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"persona_id\": personaId } });\n return response.data;\n },\n /** personaEmailsList: /personas/{persona_id}/emails. Returns the API response body. */\n emailsList: async (personaId: Types.PersonaEmailsListData['path'][\"persona_id\"], query: Types.PersonaEmailsListData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.PersonaEmailsListData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.personaEmailsList({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"persona_id\": personaId }, query });\n return response.data;\n },\n /** personaGet: /personas/{persona_id}. Returns the API response body. */\n get: async (personaId: Types.PersonaGetData['path'][\"persona_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.PersonaGetData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.personaGet({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"persona_id\": personaId } });\n return response.data;\n },\n /** listPersonas: /personas. Returns the API response body. */\n list: async (query: Types.ListPersonasData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ListPersonasData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.listPersonas({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, query });\n return response.data;\n },\n /** personaSmsList: /personas/{persona_id}/sms. Returns the API response body. */\n smsList: async (personaId: Types.PersonaSmsListData['path'][\"persona_id\"], query: Types.PersonaSmsListData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.PersonaSmsListData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.personaSmsList({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"persona_id\": personaId }, query });\n return response.data;\n },\n /** personaUpdate: /personas/{persona_id}. Returns the API response body. */\n update: async (personaId: Types.PersonaUpdateData['path'][\"persona_id\"], body: Types.PersonaUpdateData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.PersonaUpdateData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.personaUpdate({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"persona_id\": personaId }, body });\n return response.data;\n },\n },\n vaults: {\n /** vaultCreate: /vaults/create. Returns the API response body. */\n create: async (body: Types.VaultCreateData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.VaultCreateData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.vaultCreate({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, body });\n return response.data;\n },\n /** vaultCredentialsAdd: /vaults/{vault_id}/credentials. Returns the API response body. */\n credentialsAdd: async (vaultId: Types.VaultCredentialsAddData['path'][\"vault_id\"], body: Types.VaultCredentialsAddData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.VaultCredentialsAddData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.vaultCredentialsAdd({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"vault_id\": vaultId }, body });\n return response.data;\n },\n /** vaultCredentialsDelete: /vaults/{vault_id}/credentials. Returns the API response body. */\n credentialsDelete: async (vaultId: Types.VaultCredentialsDeleteData['path'][\"vault_id\"], query: Types.VaultCredentialsDeleteData['query'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.VaultCredentialsDeleteData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.vaultCredentialsDelete({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"vault_id\": vaultId }, query });\n return response.data;\n },\n /** vaultCredentialsGet: /vaults/{vault_id}/credentials. Returns the API response body. */\n credentialsGet: async (vaultId: Types.VaultCredentialsGetData['path'][\"vault_id\"], query: Types.VaultCredentialsGetData['query'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.VaultCredentialsGetData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.vaultCredentialsGet({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"vault_id\": vaultId }, query });\n return response.data;\n },\n /** vaultCredentialsList: /vaults/{vault_id}. Returns the API response body. */\n credentialsList: async (vaultId: Types.VaultCredentialsListData['path'][\"vault_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.VaultCredentialsListData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.vaultCredentialsList({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"vault_id\": vaultId } });\n return response.data;\n },\n /** vaultCreditCardDelete: /vaults/{vault_id}/card. Returns the API response body. */\n creditCardDelete: async (vaultId: Types.VaultCreditCardDeleteData['path'][\"vault_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.VaultCreditCardDeleteData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.vaultCreditCardDelete({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"vault_id\": vaultId } });\n return response.data;\n },\n /** vaultCreditCardGet: /vaults/{vault_id}/card. Returns the API response body. */\n creditCardGet: async (vaultId: Types.VaultCreditCardGetData['path'][\"vault_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.VaultCreditCardGetData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.vaultCreditCardGet({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"vault_id\": vaultId } });\n return response.data;\n },\n /** vaultCreditCardSet: /vaults/{vault_id}/card. Returns the API response body. */\n creditCardSet: async (vaultId: Types.VaultCreditCardSetData['path'][\"vault_id\"], body: Types.VaultCreditCardSetData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.VaultCreditCardSetData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.vaultCreditCardSet({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"vault_id\": vaultId }, body });\n return response.data;\n },\n /** vaultDelete: /vaults/{vault_id}. Returns the API response body. */\n delete: async (vaultId: Types.VaultDeleteData['path'][\"vault_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.VaultDeleteData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.vaultDelete({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"vault_id\": vaultId } });\n return response.data;\n },\n /** listVaults: /vaults. Returns the API response body. */\n list: async (query: Types.ListVaultsData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ListVaultsData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.listVaults({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, query });\n return response.data;\n },\n /** vaultUpdate: /vaults/{vault_id}. Returns the API response body. */\n update: async (vaultId: Types.VaultUpdateData['path'][\"vault_id\"], body: Types.VaultUpdateData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.VaultUpdateData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.vaultUpdate({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"vault_id\": vaultId }, body });\n return response.data;\n },\n },\n profiles: {\n /** profileCookiesGet: /profiles/{profile_id}/cookies. Returns the API response body. */\n cookiesGet: async (profileId: Types.ProfileCookiesGetData['path'][\"profile_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ProfileCookiesGetData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.profileCookiesGet({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"profile_id\": profileId } });\n return response.data;\n },\n /** profileCookiesSet: /profiles/{profile_id}/cookies. Returns the API response body. */\n cookiesSet: async (profileId: Types.ProfileCookiesSetData['path'][\"profile_id\"], body: Types.ProfileCookiesSetData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ProfileCookiesSetData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.profileCookiesSet({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"profile_id\": profileId }, body });\n return response.data;\n },\n /** profileCreate: /profiles/create. Returns the API response body. */\n create: async (body: Types.ProfileCreateData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ProfileCreateData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.profileCreate({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, body });\n return response.data;\n },\n /** profileDelete: /profiles/{profile_id}. Returns the API response body. */\n delete: async (profileId: Types.ProfileDeleteData['path'][\"profile_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ProfileDeleteData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.profileDelete({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"profile_id\": profileId } });\n return response.data;\n },\n /** profileDuplicate: /profiles/{profile_id}/duplicate. Returns the API response body. */\n duplicate: async (profileId: Types.ProfileDuplicateData['path'][\"profile_id\"], body: Types.ProfileDuplicateData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ProfileDuplicateData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.profileDuplicate({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"profile_id\": profileId }, body });\n return response.data;\n },\n /** profileGet: /profiles/{profile_id}. Returns the API response body. */\n get: async (profileId: Types.ProfileGetData['path'][\"profile_id\"], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ProfileGetData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.profileGet({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"profile_id\": profileId } });\n return response.data;\n },\n /** profileList: /profiles. Returns the API response body. */\n list: async (query: Types.ProfileListData['query'] = undefined, requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ProfileListData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.profileList({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, query });\n return response.data;\n },\n /** profileStateSet: /profiles/{profile_id}/state. Returns the API response body. */\n stateSet: async (profileId: Types.ProfileStateSetData['path'][\"profile_id\"], body: Types.ProfileStateSetData['body'], requestOptions: ResourceRequestOptions & { headers?: Omit<NonNullable<Types.ProfileStateSetData['headers']>, 'x-notte-api-key'> } = {}) => {\n const response = await operations.profileStateSet({ client, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { \"profile_id\": profileId }, body });\n return response.data;\n },\n },\n };\n}\n","import { pollAuth, ManagedAuthError, type AuthWaitOptions, type AuthSessionResponse as SessionResponse } from '@/managed-auth';\nimport { existsSync } from 'node:fs';\nimport { writeFile } from 'node:fs/promises';\nimport { resolve } from 'node:path';\nimport { setTimeout as delay } from 'node:timers/promises';\nimport type { Browser, BrowserContext, Dialog, Page } from 'playwright-core';\nimport { DEFAULT_REQUEST_TIMEOUT_MS, MAX_RETRIES_HEADER, NotteClient, REQUEST_ORIGIN, TIMEOUT_HEADER } from '@/client';\nimport { SDK_VERSION } from '@/version';\nimport type {\n AgentFunctionCodeResponse,\n ApiExecutionResponse,\n ApiSessionStartRequest,\n Cookie,\n ExecutionResponse,\n Observation,\n PageExecuteData,\n ObserveRequest,\n ProfileResponse,\n ReplayResponse,\n ScrapeRequest,\n SessionDebugResponse,\n TabSessionDebugResponse,\n} from '@/lib/client/types.gen';\nimport {\n getSessionScript,\n pageExecute,\n pageObserve,\n pageScrape,\n sessionCookiesGet,\n sessionCookiesSet,\n sessionDebugInfo,\n sessionProfileSave,\n sessionReplay,\n sessionStart,\n sessionAuthReadiness,\n sessionStatus,\n sessionStop,\n} from '@/lib/client/sdk.gen';\nimport { ActionExecutionError, EvaluateJsNoDataError, NotteAPIError, NotteTimeoutError, sleep } from '@/errors';\nimport type { ExecuteAction } from '@/actions';\nimport { executeWithCaptcha, type CaptchaExecutionResponse } from '@/captcha';\nimport { buildFetchScript, responseFromEvaluated, type PageFetchOptions, type PageFetchResponse } from '@/page-fetch';\nimport { createOrAppendCookiesToFile, readCookiesFile } from '@/cookies';\nimport {\n buildScrapeBody,\n processScrapeResponse,\n type ScrapeResult,\n type SessionScrapeOptions,\n type StructuredData,\n type ZodLikeSchema,\n} from '@/scrape';\nimport { openBrowser } from '@/utils';\nimport { backoffDelayMs, isRetryableNetworkError, isRetryableStatus, retryDelayMs } from '@/retry';\nimport type { RemoteFileStorage } from '@/files';\n\n/** Number of attempts `start()` makes on 5xx errors, like `RemoteSession.start(tries=3)`. */\nexport const SESSION_START_TRIES = 3;\n/**\n * Delay before `start()` retries an HTTP 529 (cluster overload) when the\n * client's own retries are disabled (`maxRetries: 0`). Otherwise the client\n * already retried the 529, honoring the API's `Retry-After`.\n */\nexport const CLUSTER_OVERLOAD_RETRY_DELAY_MS = 30_000;\n/** @deprecated Legacy request limit; CAPTCHA polls now use at most 10 seconds per request. */\nexport const CAPTCHA_SOLVE_TIMEOUT_MS = 100_000;\n\nexport type PerceptionType = NonNullable<ObserveRequest['perception_type']>;\n\n/** Migration guide for the observe options removed on December 1, 2026. */\nconst OBSERVE_MIGRATION_URL = 'https://docs.notte.cc/features/sessions/observe-migration';\nconst OBSERVE_DEPRECATIONS = {\n instructions: `\\`observe({ instructions })\\` is deprecated and will be removed on December 1, 2026; the Python SDK's local sessions replace it with session.act(); here, call observe() without it and pick from the returned actions. See ${OBSERVE_MIGRATION_URL}`,\n deep: `\\`perception_type: 'deep'\\` is deprecated and will be removed on December 1, 2026; use \\`perception_type: 'fast'\\` (the default). See ${OBSERVE_MIGRATION_URL}`,\n} as const;\n\nexport type SessionCloseReason = 'manual' | 'error';\n\nexport interface ExecuteOptions {\n /** Throw when the action fails. Defaults to the session's `raiseOnFailure` (true). */\n raiseOnFailure?: boolean;\n}\n\nexport interface ReplayOptions {\n /** Poll until the replay is ready instead of failing on 404. Defaults to true. */\n wait?: boolean;\n /** Maximum time to wait for the replay, in milliseconds. Defaults to 240 000. */\n timeoutMs?: number;\n /** Delay between polling attempts, in milliseconds. Defaults to 5 000. */\n pollIntervalMs?: number;\n}\n\n/** Target for `session.saveProfile()`. Pass at most one of the two fields. */\nexport interface SaveProfileOptions {\n /** Existing profile to overwrite with the session's current browser state. */\n profile_id?: string;\n /** Create a new profile with this name and save into it. */\n name?: string;\n}\n\nexport interface SessionScriptOptions {\n /** Return a standalone workflow script rather than only the relevant steps. Defaults to true. */\n as_workflow?: boolean;\n /** Infer a `response_format` schema for scrape calls that have instructions but no schema. */\n infer_response_format?: boolean;\n}\n\nexport interface SessionStartOptions extends AuthWaitOptions {\n /** Override the session default; false returns while authentication continues. */\n wait_for_authentication?: boolean;\n}\n\nexport interface SessionOptions extends ApiSessionStartRequest {\n /** Wait in the SDK for managed authentication on start(). Defaults to true; use() always waits. */\n wait_for_authentication?: boolean;\n /** Additional server-side login attempts, from 0 to 2. Only sent with auth_ids. */\n auth_retry?: number;\n /**\n * @deprecated Remote sessions always use the supported browser launch mode.\n * Retained as a boolean so existing typed configuration still compiles.\n * `true` is discarded; `false` raises a migration error when starting.\n */\n headless?: boolean;\n /**\n * Open the live viewer in the local default browser after the session starts.\n * This is a local SDK option and is not sent to the API.\n */\n open_viewer?: boolean;\n /**\n * Default for `execute()`: throw `ActionExecutionError` when an action fails.\n * The counterpart of `raise_on_failure` on `RemoteSession`. Defaults to true.\n */\n raiseOnFailure?: boolean;\n /**\n * Default perception type for `observe()`. Defaults to `fast`. `'deep'` is\n * deprecated and removed on December 1, 2026; use `'fast'`.\n */\n perception_type?: PerceptionType;\n /**\n * JSON cookie file: loaded into the session on `start()` when it exists and\n * appended with the session cookies on `stop()`.\n */\n cookie_file?: string;\n /** File storage to attach to the session for uploads and downloads. */\n storage?: RemoteFileStorage;\n}\n\n/**\n * Keep the external CDP client from competing with Notte for native dialogs.\n *\n * Playwright automatically handles a JavaScript dialog when no listener is\n * registered. Native dialogs are target-global, so that default races the\n * Notte browser controller attached to the same target. The backend owns\n * dialog handling; this listener makes the SDK Playwright connection an\n * observer without issuing a second `Page.handleJavaScriptDialog` command.\n */\nexport function observeServerOwnedDialog(_dialog: Dialog): void {}\n\nexport function installServerOwnedDialogPolicy(browser: Pick<Browser, 'contexts'>): void {\n for (const context of browser.contexts() as BrowserContext[]) {\n context.on('dialog', observeServerOwnedDialog);\n }\n}\n\n/**\n * Browser session created with `client.Session(options)`.\n * Call `start()` before using it and `stop()` when finished, or use `use()`\n * to start and stop automatically around an asynchronous callback.\n */\nexport class Session {\n private client: NotteClient;\n private options: ApiSessionStartRequest & { use_file_storage?: boolean };\n private openViewer: boolean;\n private legacyHeadless: boolean | undefined;\n private defaultRaiseOnFailure: boolean;\n private defaultPerceptionType: PerceptionType;\n private readonly warnedObserveDeprecations = new Set<keyof typeof OBSERVE_DEPRECATIONS>();\n private cookieFile: string | undefined;\n private cookiesLoaded = false;\n private cookieLoadPromise: Promise<void> | undefined;\n private authenticationReady = false;\n private fileStorage: RemoteFileStorage | undefined;\n private sessionId: string | null = null;\n private isActive = false;\n private response: SessionResponse | null = null;\n private playwrightBrowser: Browser | null = null;\n private playwrightPage: Page | null = null;\n\n constructor(client: NotteClient, options: SessionOptions = {}) {\n this.client = client;\n const {\n open_viewer = false,\n headless,\n raiseOnFailure = true,\n perception_type = 'fast',\n cookie_file,\n storage,\n ...sessionOptions\n } = options;\n this.options = storage ? { ...sessionOptions, use_file_storage: true } : sessionOptions;\n this.openViewer = open_viewer;\n this.legacyHeadless = headless;\n this.defaultRaiseOnFailure = raiseOnFailure;\n this.defaultPerceptionType = perception_type;\n this.cookieFile = cookie_file;\n this.fileStorage = storage;\n }\n\n // #######################################################################\n // ############################# Session #################################\n // #######################################################################\n\n /**\n * Start the session: creates a new session on the server.\n *\n * 503, 529, and refused connections follow the client's retry policy\n * (`NotteClientConfig.maxRetries`, honoring `Retry-After`). Other 5xx\n * errors are retried up to `SESSION_START_TRIES` times. With client\n * retries disabled, 529 waits `CLUSTER_OVERLOAD_RETRY_DELAY_MS` instead.\n * 4xx errors are never retried.\n *\n * Managed-auth sessions wait for readiness by default. Pass\n * `{ wait_for_authentication: false }` for an explicit nonblocking start,\n * then call `waitForAuth()` before executing actions or connecting over CDP.\n * Cancellation during creation waits for its response so the new session can\n * be closed. Cancellation or failure during the startup wait also closes it.\n * Prefer `session.use(async session => { ... })`, which also stops the session.\n * @example\n * const session = client.Session();\n * await session.start();\n */\n async start(options: SessionStartOptions = {}): Promise<void> {\n if (this.legacyHeadless === true) {\n console.warn('`headless: true` is deprecated and ignored; remote sessions always use the supported browser launch mode.');\n this.legacyHeadless = undefined;\n }\n if (this.isActive) {\n throw new Error('Session is already active');\n }\n\n options.signal?.throwIfAborted();\n const { auth_retry, wait_for_authentication, ...request } = this.options;\n const body = {\n ...request,\n ...(this.legacyHeadless !== undefined ? { headless: this.legacyHeadless } : {}),\n ...(auth_retry !== undefined ? { auth_retry } : {}),\n ...(request.auth_ids?.length ? { wait_for_authentication: false } : {}),\n };\n // Both API generations enable capture by default. Keep opt-outs explicit.\n if (body.record_session === true) delete body.record_session;\n if (body.log_session === true) delete body.log_session;\n const shouldWait = options.wait_for_authentication ?? wait_for_authentication ?? true;\n // The client's retry policy (503, 529, refused connections) is applied\n // here instead of in the transport, so the caller's signal interrupts the\n // wait between attempts without cancelling a creation already in flight.\n const maxRetries = this.client.getConfig().maxRetries ?? 0;\n const timeoutMs = this.client.getConfig().timeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;\n const deadline = timeoutMs > 0 ? Date.now() + timeoutMs : undefined;\n const fitsDeadline = (wait: number) => deadline === undefined || Date.now() + wait < deadline;\n let transientRetries = 0;\n let tries = SESSION_START_TRIES;\n const origTries = tries;\n let sessionData: SessionResponse | undefined;\n while (tries > 0) {\n options.signal?.throwIfAborted();\n if (!fitsDeadline(0)) throw new NotteTimeoutError(`Session start timed out after ${timeoutMs}ms`);\n try {\n const response = await sessionStart({\n client: this.client.getClient(), body, throwOnError: true, headers: {\n [MAX_RETRIES_HEADER]: '0',\n ...(deadline === undefined ? {} : { [TIMEOUT_HEADER]: String(Math.max(1, deadline - Date.now())) }),\n },\n });\n sessionData = response.data;\n break;\n } catch (error) {\n const transient = error instanceof NotteAPIError\n ? isRetryableStatus(error.statusCode, 'POST')\n : isRetryableNetworkError(error, 'POST');\n if (maxRetries > 0 && transient) {\n const wait = transientRetries >= maxRetries ? undefined : error instanceof NotteAPIError\n ? retryDelayMs(transientRetries, error.response?.headers.get('retry-after'))\n : backoffDelayMs(transientRetries);\n if (wait === undefined || !fitsDeadline(wait)) throw error;\n transientRetries += 1;\n console.warn(\n `Failed to start session (${error instanceof NotteAPIError ? error.statusCode : 'connection error'}), retrying in ${(wait / 1000).toFixed(1)}s (${transientRetries}/${maxRetries})`\n );\n await pauseStart(wait, options.signal);\n continue;\n }\n tries -= 1;\n // raise if no tries left, if the error is not an API error, or if it is a 4xx\n if (tries === 0 || !(error instanceof NotteAPIError) || error.statusCode < 500) {\n throw error;\n }\n const retryStr = `${origTries - tries}/${origTries - 1}`;\n if (!fitsDeadline(error.statusCode === 529 ? CLUSTER_OVERLOAD_RETRY_DELAY_MS : 0)) throw error;\n if (error.statusCode === 529) {\n console.warn(\n `Failed to start session due to cluster overload, retrying in ${CLUSTER_OVERLOAD_RETRY_DELAY_MS / 1000} seconds (${retryStr})...`\n );\n await pauseStart(CLUSTER_OVERLOAD_RETRY_DELAY_MS, options.signal);\n } else {\n console.warn(`Failed to start session: retrying (${retryStr})`);\n }\n }\n }\n if (!sessionData) {\n throw new Error('Failed to start session: empty response');\n }\n\n this.sessionId = sessionData.session_id;\n this.isActive = true;\n this.response = sessionData;\n this.cookiesLoaded = false;\n this.cookieLoadPromise = undefined;\n this.authenticationReady = false;\n // `forSession` clones a storage already bound to another session, so one\n // RemoteFileStorage reused across sessions never points at the wrong one.\n this.fileStorage = this.fileStorage?.forSession(sessionData.session_id);\n\n // The remote browser exists from here on: if any post-start step fails,\n // stop it before rethrowing so a bad cookie file cannot leak a session.\n try {\n options.signal?.throwIfAborted();\n if (!fitsDeadline(0)) throw new NotteTimeoutError(`Session start timed out after ${timeoutMs}ms`);\n if (shouldWait) await this.waitForAuth(options);\n if (this.openViewer) {\n this.openViewerInBrowser();\n }\n if (this.response?.status === 'active') await this.loadInitialCookies();\n } catch (error) {\n try {\n await this.stop('error');\n } catch (stopError) {\n console.error(`[Session] Failed to stop ${sessionData.session_id} after a start failure: ${String(stopError)}`);\n }\n throw error;\n }\n }\n\n /**\n * Wait for this session to become usable without creating a session or submitting another login.\n * A standalone wait leaves session ownership with the caller, including on timeout or cancellation.\n */\n async waitForAuth(options: AuthWaitOptions = {}): Promise<void> {\n options.signal?.throwIfAborted();\n if (!this.response) throw new Error('Session has not started');\n if (this.response.status === 'active') {\n await this.loadInitialCookies();\n return;\n }\n const sessionId = this.lastSessionId();\n this.response = await pollAuth(async signal => {\n const response = await sessionAuthReadiness({\n client: this.client.getClient(), path: { session_id: sessionId },\n headers: { [TIMEOUT_HEADER]: '10000' }, signal, throwOnError: true,\n });\n let result: typeof response.data | SessionResponse = response.data;\n if (result.status === 'active') {\n this.authenticationReady = true;\n result = (await sessionStatus({\n client: this.client.getClient(), path: { session_id: sessionId },\n headers: { [TIMEOUT_HEADER]: '10000' }, signal, throwOnError: true,\n })).data;\n this.authenticationReady = result.status === 'active';\n if (this.authenticationReady) return result as SessionResponse;\n }\n if (result.status !== 'authenticating') throw new ManagedAuthError(result.error || 'Session authentication failed');\n return undefined;\n }, options);\n await this.loadInitialCookies();\n }\n\n private async loadInitialCookies(): Promise<void> {\n if (this.cookiesLoaded || this.cookieFile === undefined) return;\n if (!this.cookieLoadPromise) {\n const cookieFile = this.cookieFile;\n this.cookieLoadPromise = (async () => {\n if (existsSync(cookieFile)) {\n console.info(`🍪 Automatically loading cookies from ${cookieFile}`);\n await this.setCookiesFromFile(cookieFile);\n } else {\n console.warn(`🍪 Cookie file ${cookieFile} not found, skipping cookie loading`);\n }\n this.cookiesLoaded = true;\n })();\n }\n const pending = this.cookieLoadPromise;\n try {\n await pending;\n } finally {\n if (this.cookieLoadPromise === pending) this.cookieLoadPromise = undefined;\n }\n }\n\n /**\n * Stop the session and clean up resources (including any Playwright\n * connection opened with `page()`). When a `cookie_file` was given, the\n * session cookies are appended to it first. A session the API reports as\n * already stopped is tolerated with a warning.\n *\n * @example\n * await session.stop();\n */\n async stop(closeReason: SessionCloseReason = 'manual'): Promise<void> {\n if (!this.isActive || !this.sessionId) {\n return;\n }\n const sessionId = this.sessionId;\n await this.closePlaywright();\n\n if (this.cookieFile !== undefined && (this.authenticationReady || this.response?.status === 'active')) {\n try {\n const cookies = await this.getCookies();\n await createOrAppendCookiesToFile(this.cookieFile, cookies);\n } catch (error) {\n console.error(`🍪 Error saving cookies to ${this.cookieFile}: ${String(error)}`);\n }\n }\n\n try {\n const response = await sessionStop({\n client: this.client.getClient(),\n path: { session_id: sessionId },\n query: { close_reason: closeReason },\n throwOnError: true,\n });\n if (response.data.status !== 'closed') {\n throw new Error(`[Session] ${sessionId} failed to stop`);\n }\n this.response = response.data;\n } catch (error) {\n const message = (error instanceof Error ? error.message : String(error)).toLowerCase();\n if (message.includes('already stopped') || message.includes('already closed')) {\n console.warn(`Session ${sessionId} was already stopped`);\n } else {\n throw error;\n }\n }\n this.isActive = false;\n this.sessionId = null;\n }\n\n private async closePlaywright(): Promise<void> {\n const browser = this.playwrightBrowser;\n this.playwrightBrowser = null;\n this.playwrightPage = null;\n if (browser) {\n try {\n await browser.close();\n } catch (error) {\n console.warn(`[Session] Failed to close the Playwright connection: ${String(error)}`);\n }\n }\n }\n\n /**\n * Get the current status of the session. Like Python, this keeps working\n * after `stop()` (for example to read the recorded `steps`).\n *\n * @returns Current session metadata, including lifecycle status and recorded steps. Works after `stop()`.\n * @throws Error if this session has never been started.\n * @throws NotteAPIError if the status request fails.\n * @example\n * const status = await session.status();\n * console.log(status.status); // 'active'\n */\n async status(): Promise<SessionResponse> {\n const response = await sessionStatus({\n client: this.client.getClient(),\n path: { session_id: this.lastSessionId() },\n throwOnError: true,\n });\n return response.data;\n }\n\n /** Session ID while the session is active, `null` otherwise. */\n getId(): string | null {\n return this.sessionId;\n }\n\n /** Whether the session has been started and not stopped yet. */\n isSessionActive(): boolean {\n return this.isActive;\n }\n\n /** The last `SessionResponse` received from the API (start, stop or status). */\n getResponse(): SessionResponse | null {\n return this.response;\n }\n\n /** The file storage attached to the session, when one was given. */\n get storage(): RemoteFileStorage | undefined {\n return this.fileStorage;\n }\n\n private requireSessionId(): string {\n if (!this.sessionId) {\n throw new Error('Session not started');\n }\n return this.sessionId;\n }\n\n /** Session ID of the active session, or of the last one when it was stopped. */\n private lastSessionId(): string {\n const sessionId = this.sessionId ?? this.response?.session_id;\n if (!sessionId) {\n throw new Error('Session not started');\n }\n return sessionId;\n }\n\n /**\n * Open the live viewer for this session in the local default browser.\n * @throws If the session has not started or no viewer URL is available.\n */\n viewer(): void {\n this.requireSessionId();\n const viewerUrl = this.response?.viewer_url;\n if (!viewerUrl) {\n throw new Error('No viewer URL available for this session');\n }\n openBrowser(viewerUrl);\n }\n\n private openViewerInBrowser(): void {\n const viewerUrl = this.response?.viewer_url;\n if (!viewerUrl) {\n console.warn('[Session] No viewer URL available; session started without opening a viewer.');\n return;\n }\n openBrowser(viewerUrl);\n }\n\n /**\n * Get presigned URLs for the session replay. Recordings are finalized after\n * the session is closed, so by default this polls on 404 until the replay is\n * ready. It keeps working after `stop()`.\n *\n * Throws an `Error` when the API reports the session is still active and a\n * `NotteTimeoutError` when the replay is not ready within `timeoutMs`.\n * @example\n * await session.stop();\n * const replay = await session.replay();\n * console.log(replay.mp4_url);\n */\n async replay(options: ReplayOptions = {}): Promise<ReplayResponse> {\n const { wait = true, timeoutMs = 240_000, pollIntervalMs = 5_000 } = options;\n const sessionId = this.lastSessionId();\n const request = async (): Promise<ReplayResponse> => {\n const response = await sessionReplay({\n client: this.client.getClient(),\n path: { session_id: sessionId },\n throwOnError: true,\n });\n if (!response.data) {\n throw new Error('Failed to get session replay: empty response');\n }\n return response.data;\n };\n if (!wait) {\n return request();\n }\n\n const deadline = Date.now() + timeoutMs;\n for (;;) {\n try {\n return await request();\n } catch (error) {\n if (!(error instanceof NotteAPIError) || error.statusCode !== 404) {\n throw error;\n }\n const waitingForClose = error.error.replay_status === 'waiting_for_session';\n if (error.error.replay_status === 'disabled' || (error.error.retryable === false && !waitingForClose)) {\n throw error;\n }\n // Stop can complete before the replay service observes the closure.\n // Only reject immediately while this client still considers it active.\n if (this.isActive && this.sessionId === sessionId && (waitingForClose || (error.apiMessage ?? '').includes('still active'))) {\n throw new Error(`Session ${sessionId} is still active — close the session first to generate the replay.`, {\n cause: error,\n });\n }\n if (Date.now() + pollIntervalMs > deadline) {\n throw new NotteTimeoutError(`Replay for session ${sessionId} not ready within ${timeoutMs}ms`, { cause: error });\n }\n await sleep(pollIntervalMs);\n }\n }\n }\n\n /**\n * Download the MP4 replay to a local file, like `ReplayResponse.download()`\n * in Python. Resolves with the absolute path of the written file and throws\n * when the replay has no `mp4_url`.\n *\n * @example\n * await session.stop();\n * const file = await session.downloadReplay('session.mp4');\n */\n async downloadReplay(path = 'replay.mp4', options: ReplayOptions = {}): Promise<string> {\n const replay = await this.replay(options);\n if (!replay.mp4_url) {\n throw new Error('No mp4_url available for download');\n }\n const response = await fetch(replay.mp4_url);\n if (!response.ok) {\n throw new Error(`Failed to download replay: HTTP ${response.status}`);\n }\n const target = resolve(path);\n await writeFile(target, new Uint8Array(await response.arrayBuffer()));\n return target;\n }\n\n // #######################################################################\n // ############################# Cookies #################################\n // #######################################################################\n\n /**\n * Upload cookies to the session.\n *\n * @example\n * await session.setCookies([{ name: 'token', value: 'abc', domain: 'example.com', path: '/', httpOnly: false }]);\n */\n async setCookies(cookies: Cookie[]): Promise<ExecutionResponse> {\n const response = await sessionCookiesSet({\n client: this.client.getClient(),\n path: { session_id: this.requireSessionId() },\n body: { cookies },\n throwOnError: true,\n });\n return response.data;\n }\n\n /**\n * Upload cookies from a JSON file (a list of cookies, like `getCookies()` returns).\n *\n * @example\n * await session.setCookiesFromFile('cookies.json');\n */\n async setCookiesFromFile(cookieFile: string): Promise<ExecutionResponse> {\n return this.setCookies(await readCookiesFile(cookieFile));\n }\n\n /**\n * Get the cookies of the session.\n *\n * @example\n * const cookies = await session.getCookies();\n * await fs.writeFile('cookies.json', JSON.stringify(cookies));\n */\n async getCookies(): Promise<Cookie[]> {\n const response = await sessionCookiesGet({\n client: this.client.getClient(),\n path: { session_id: this.requireSessionId() },\n throwOnError: true,\n });\n return response.data.cookies;\n }\n\n // #######################################################################\n // ############################# Profiles ################################\n // #######################################################################\n\n /**\n * Save the session's current browser state (cookies, localStorage, sessionStorage) into a\n * profile, without stopping the session.\n *\n * Pass `profile_id` to overwrite an existing profile or `name` to create a new one. With\n * neither, the state is saved into the profile the session was started with. The session's\n * start-time profile settings are not changed, so a session started with `persist: true`\n * still saves again when it stops.\n *\n * See [Browser Profiles](/features/sessions/browser-profiles) for the tested Python and TypeScript example.\n */\n async saveProfile(options: SaveProfileOptions = {}): Promise<ProfileResponse> {\n const { profile_id, name } = options;\n if (profile_id !== undefined && name !== undefined) {\n throw new Error('profile_id and name are mutually exclusive');\n }\n if (profile_id !== undefined && profile_id.trim() === '') {\n throw new Error('profile_id must not be empty');\n }\n if (name !== undefined && name.trim() === '') {\n throw new Error('name must not be empty');\n }\n const body: { profile_id?: string; name?: string } = {};\n if (profile_id !== undefined) body.profile_id = profile_id;\n if (name !== undefined) body.name = name;\n const response = await sessionProfileSave({\n client: this.client.getClient(),\n path: { session_id: this.requireSessionId() },\n body,\n throwOnError: true,\n });\n return response.data;\n }\n\n // #######################################################################\n // ############################# Debug / CDP #############################\n // #######################################################################\n\n /** Detailed debug information for the session (debug URL, websocket URLs, tabs). */\n async debugInfo(): Promise<SessionDebugResponse> {\n const response = await sessionDebugInfo({\n client: this.client.getClient(),\n path: { session_id: this.requireSessionId() },\n throwOnError: true,\n });\n return response.data;\n }\n\n /**\n * Debug information for one tab of the session. The API client has no\n * dedicated tab endpoint, so this reads the tab from `debugInfo().tabs`.\n */\n async debugTabInfo(tabIdx = 0): Promise<TabSessionDebugResponse> {\n const debug = await this.debugInfo();\n const tab = debug.tabs[tabIdx];\n if (!tab) {\n throw new Error(`Tab ${tabIdx} not found: the session has ${debug.tabs.length} tab(s)`);\n }\n return tab;\n }\n\n /**\n * Get the Chrome DevTools Protocol WebSocket URL for the session.\n *\n * A `cdp_url` given at construction (another browser provider) is returned\n * untouched. Notte-served URLs, from the start response or the debug info,\n * carry the database preview branch when one is configured.\n *\n * @returns The CDP WebSocket URL for connecting a browser automation client.\n * @throws Error if no session ID or CDP URL is available.\n * @example\n * const browser = await chromium.connectOverCDP(await session.cdpUrl());\n */\n async cdpUrl(): Promise<string> {\n if (!this.response) {\n throw new Error('Session not started');\n }\n if (this.options.cdp_url) {\n // cdp url from another session provider. It is handed to us by the\n // caller and served by someone else, so it gets no preview selector.\n return this.options.cdp_url;\n }\n // The remaining urls are websocket endpoints on our own API, which reads\n // the preview branch from the query string. Without it the handshake is\n // served from the default database and rejects a preview-branch session.\n if (this.response.cdp_url) {\n return this.client.withDbPreview(this.response.cdp_url);\n }\n const debug = await this.debugInfo();\n return this.client.withDbPreview(debug.ws.cdp);\n }\n\n /**\n * Get a Playwright page connected to the session via CDP. The connection is\n * established lazily on first access, cached, and closed by `stop()`.\n * Native dialogs are left to the Notte backend.\n *\n * Requires the optional `playwright-core` peer dependency\n * (`npm install playwright-core`).\n *\n * @example\n * const page = await session.page();\n * await page.goto('https://www.google.com');\n * await page.screenshot({ path: 'screenshot.png' });\n */\n async page(): Promise<Page> {\n if (this.playwrightPage) {\n return this.playwrightPage;\n }\n let playwright: typeof import('playwright-core');\n try {\n playwright = await import('playwright-core');\n } catch (error) {\n throw new Error('Playwright not installed. Run `npm install playwright-core` to use `session.page()`.', {\n cause: error,\n });\n }\n try {\n if (!this.playwrightBrowser) {\n const cdpUrl = await this.cdpUrl();\n // Identify the SDK to Notte's CDP endpoint, as every API call does; a caller's\n // own browser (`cdp_url` option) gets nothing extra.\n this.playwrightBrowser = this.options.cdp_url\n ? await playwright.chromium.connectOverCDP(cdpUrl)\n : await playwright.chromium.connectOverCDP(cdpUrl, {\n headers: { 'x-notte-request-origin': REQUEST_ORIGIN, 'x-notte-sdk-version': SDK_VERSION },\n });\n installServerOwnedDialogPolicy(this.playwrightBrowser);\n }\n const page = this.playwrightBrowser.contexts()[0]?.pages()[0];\n if (!page) {\n throw new Error('the browser has no open page');\n }\n this.playwrightPage = page;\n return page;\n } catch (error) {\n throw new Error(`Failed to access the playwright page from CDP: ${error instanceof Error ? error.message : String(error)}`, {\n cause: error,\n });\n }\n }\n\n /**\n * Get the workflow code generated from the session steps\n * (`GET /sessions/{id}/workflow/code`).\n *\n * @example\n * const { python_script } = await session.getScript();\n */\n async getScript(options: SessionScriptOptions = {}): Promise<AgentFunctionCodeResponse> {\n const { as_workflow = true, infer_response_format } = options;\n const response = await getSessionScript({\n client: this.client.getClient(),\n path: { session_id: this.lastSessionId() },\n query: { as_workflow, ...(infer_response_format === undefined ? {} : { infer_response_format }) },\n throwOnError: true,\n });\n return response.data;\n }\n\n // #######################################################################\n // ############################# Page ####################################\n // #######################################################################\n\n /**\n * Execute an action on the current page.\n *\n * When the action fails and `raiseOnFailure` is true (the default, see the\n * session option), the structured `exception_detail` returned by the API is\n * rehydrated into an `ActionExecutionError` whose `errorType` names the\n * server-side error class. `captcha_solve` actions get a 100 s request\n * timeout and are retried up to 3 times on HTTP 408.\n *\n * @param action - Action type, target, and action-specific arguments.\n * @param options - Override failure handling for this call; otherwise use the session setting.\n * @returns The execution response, including `success` and failure details when throwing is disabled.\n * @throws ActionExecutionError if the action fails and failure throwing is enabled.\n * @throws NotteAPIError if the API request fails.\n * @example\n * import { actions } from 'notte-sdk';\n *\n * await session.execute({ type: 'goto', url: 'https://www.notte.cc' });\n * await session.execute(actions.fill({ selector: \"input[name='email']\", value: 'user@example.com' }));\n * const result = await session.execute({ type: 'click', id: 'B1' }, { raiseOnFailure: false });\n * if (!result.success) console.log(result.message);\n */\n async execute(action: ExecuteAction, options: boolean | ExecuteOptions = {}): Promise<CaptchaExecutionResponse> {\n const sessionId = this.requireSessionId();\n const raiseOnFailure =\n typeof options === 'boolean' ? options : (options.raiseOnFailure ?? this.defaultRaiseOnFailure);\n const result = await executeWithCaptcha(action, this.client.getConfig().captchaTimeoutSeconds ?? 180,\n async (requestAction, params, timeoutMs) => {\n const query: typeof params & NonNullable<PageExecuteData['query']> = params;\n const response = await pageExecute({\n client: this.client.getClient(), path: { session_id: sessionId }, body: requestAction,\n query, headers: timeoutMs === undefined ? undefined : { [TIMEOUT_HEADER]: String(timeoutMs) },\n throwOnError: true,\n });\n return response.data;\n });\n\n // Gate on \"did the action fail\", not \"did something throw\", to mirror the local session.\n if (raiseOnFailure && !result.success) {\n console.error(`🚨 Execution failed with message: '${result.message}'`);\n if (result.exception_detail) {\n // The structured wire payload carries the concrete error type, messages and flags.\n throw new ActionExecutionError(result.exception_detail);\n }\n // An API build that predates `exception_detail` may report a failure without\n // an exception; the message is all the caller has to go on.\n const fallbackMessage = String(result.message ?? '').trim() || `Failed to execute action: ${action.type}`;\n throw ActionExecutionError.fromMessage(fallbackMessage);\n }\n return result;\n }\n\n /**\n * Evaluate JavaScript on the current page and return its result as a string.\n *\n * The result is stringified the way `evaluate_js` records it: objects and\n * arrays as JSON, a JS `null` as the string `\"null\"`. On failure the typed\n * `ActionExecutionError` is thrown with the actual JavaScript error; pass\n * `raiseOnFailure: false` to get the execution result envelope instead.\n *\n * @example\n * const title = await session.evaluateJs('document.title');\n * const payload = JSON.parse(await session.evaluateJs('(async () => JSON.stringify(await (await fetch(\"/api\")).json()))()'));\n */\n async evaluateJs(code: string, options?: { raiseOnFailure?: true }): Promise<string>;\n async evaluateJs(code: string, options: { raiseOnFailure: false }): Promise<ApiExecutionResponse>;\n async evaluateJs(code: string, options: ExecuteOptions = {}): Promise<string | ApiExecutionResponse> {\n const raiseOnFailure = options.raiseOnFailure ?? true;\n const result = await this.execute({ type: 'evaluate_js', code }, { raiseOnFailure });\n if (!raiseOnFailure) {\n return result;\n }\n if (!result.data) {\n // an API build that predates the eval-js fix reports success without data\n throw new EvaluateJsNoDataError();\n }\n return result.data.markdown;\n }\n\n /**\n * Issue an HTTP request from the page the session is on and return the response.\n *\n * The request runs inside the browser through `fetch()`, so it carries the\n * page's cookies, the session's proxy and the browser's own network\n * fingerprint. A relative `url` resolves against the current page, which\n * also makes it same-origin; a cross-origin URL is subject to CORS exactly\n * as in a browser tab, so `goto` the target origin first. Redirects are\n * followed and the final URL is on `response.url`. A non-2xx status is\n * returned, not thrown; `response.raiseForStatus()` throws `PageFetchHTTPError`.\n *\n * `json` is serialised as the body with an `application/json` content type,\n * `data` as a form body when it is an object or verbatim when it is a string.\n *\n * @param url - Absolute URL or a path relative to the current page.\n * @param options - HTTP method, headers, and request body settings.\n * @returns A response with status, headers, and body readers. Non-2xx responses are not automatically thrown.\n * @throws ActionExecutionError if browser-side execution fails.\n * @example\n * await session.execute({ type: 'goto', url: 'https://en.wikipedia.org/wiki/Main_Page' });\n * const summary = await (await session.fetch('/api/rest_v1/page/summary/Main_Page')).json();\n */\n async fetch(url: string, options: PageFetchOptions = {}): Promise<PageFetchResponse> {\n const script = buildFetchScript(url, options);\n return responseFromEvaluated(await this.evaluateJs(script));\n }\n\n /**\n * Observe the current page: the list of actions that can be taken, a\n * screenshot and page metadata.\n *\n * The `perception_type` defaults to the session option (`fast`). A bare\n * string argument is accepted as the perception type.\n *\n * Deprecated: `perception_type: 'deep'` and `instructions` are removed on\n * December 1, 2026, and each warns once per session. Use `perception_type:\n * 'fast'` (the default) instead of `'deep'`. For `instructions`:\n * the Python SDK's local sessions replace it with `session.act()`; here, call\n * `observe()` without it and pick from the returned actions. See\n * https://docs.notte.cc/features/sessions/observe-migration\n *\n * @param options - Observation settings, including an optional URL, or a perception-mode string.\n * @returns Structured page analysis, available actions, and page metadata.\n * @throws NotteAPIError if observation fails.\n * @example\n * const obs = await session.observe();\n * console.log(obs.space.description);\n * const firstActions = await session.observe({ max_nb_actions: 50 });\n */\n async observe(options: ObserveRequest | PerceptionType = {}): Promise<Observation> {\n const body: ObserveRequest = typeof options === 'string' ? { perception_type: options } : { ...options };\n if (body.perception_type == null) {\n body.perception_type = this.defaultPerceptionType;\n }\n if (body.instructions != null) {\n this.warnObserveDeprecation('instructions');\n }\n if (body.perception_type !== 'fast') {\n this.warnObserveDeprecation('deep');\n }\n const response = await pageObserve({\n client: this.client.getClient(),\n path: { session_id: this.requireSessionId() },\n body,\n throwOnError: true,\n });\n return response.data;\n }\n\n private warnObserveDeprecation(option: keyof typeof OBSERVE_DEPRECATIONS): void {\n if (!this.warnedObserveDeprecations.has(option)) {\n this.warnedObserveDeprecations.add(option);\n console.warn(OBSERVE_DEPRECATIONS[option]);\n }\n }\n\n /**\n * Scrape the current page.\n *\n * With `response_format` or `instructions`, the extracted data is returned\n * directly and a failed extraction throws `ScrapeFailedError`. Pass\n * `raiseOnFailure: false` to receive the `StructuredData` wrapper instead.\n * @example\n * const markdown = await session.scrape({ only_main_content: true });\n * const product = await session.scrape({ response_format: Product, instructions: 'Extract the product' });\n * const result = await session.scrape({ response_format: Product, raiseOnFailure: false });\n * if (result.success) console.log(result.data);\n */\n async scrape(options?: SessionScrapeOptions<unknown> & { response_format?: undefined; instructions?: undefined | null }): Promise<string>;\n async scrape<T>(options: SessionScrapeOptions<T> & { response_format: ZodLikeSchema<T>; raiseOnFailure?: true }): Promise<T>;\n async scrape<T>(options: SessionScrapeOptions<T> & { response_format: ZodLikeSchema<T>; raiseOnFailure: false }): Promise<StructuredData<T>>;\n async scrape(options: SessionScrapeOptions<unknown>): Promise<ScrapeResult<unknown>>;\n async scrape<T = unknown>(options: SessionScrapeOptions<T> = {}): Promise<ScrapeResult<T>> {\n const sessionId = this.requireSessionId();\n const body = await buildScrapeBody(options);\n const response = await pageScrape({\n client: this.client.getClient(),\n path: { session_id: sessionId },\n body: body as ScrapeRequest,\n throwOnError: true,\n });\n return processScrapeResponse<T>(response.data, options);\n }\n\n // #######################################################################\n // ############################# Lifecycle ###############################\n // #######################################################################\n\n /**\n * Context manager pattern: start the session, run the callback and stop the\n * session, with close reason `error` when the callback throws.\n *\n * Always waits for Managed Auth readiness before invoking the callback.\n *\n * @param callback - Async work to perform with the ready session.\n * @param options - Controls the Managed Auth readiness wait, including timeout and cancellation.\n * @returns The callback's return value after session cleanup has been attempted.\n * @throws Error if startup fails, the callback throws, or cleanup fails after a successful callback.\n * @example\n * await client.Session().use(async session => {\n * await session.execute({ type: 'goto', url: 'https://www.notte.cc' });\n * });\n */\n async use<T>(callback: (session: Session) => Promise<T>, options: AuthWaitOptions = {}): Promise<T> {\n await this.start({ ...options, wait_for_authentication: true });\n let callbackFailed = false;\n try {\n return await callback(this);\n } catch (error) {\n callbackFailed = true;\n console.warn(`Session exiting because of exception: ${String(error)}`);\n throw error;\n } finally {\n try {\n await this.stop(callbackFailed ? 'error' : 'manual');\n } catch (stopError) {\n if (!callbackFailed) {\n throw stopError;\n }\n console.error('[Session] Failed to stop session after callback error:', stopError);\n }\n }\n }\n\n /**\n * Async iterator pattern for session lifecycle management.\n *\n * ```ts\n * for await (const session of client.Session()) {\n * await session.execute({ type: 'goto', url: 'https://www.notte.cc' });\n * }\n * ```\n */\n async *[Symbol.asyncIterator]() {\n await this.start();\n try {\n yield this;\n } finally {\n await this.stop();\n }\n }\n}\n\n/** Wait between `start()` attempts; the caller's signal interrupts the wait. */\nasync function pauseStart(ms: number, signal: AbortSignal | undefined): Promise<void> {\n if (!signal) {\n await sleep(ms);\n return;\n }\n try {\n await delay(ms, undefined, { signal });\n } catch (error) {\n signal.throwIfAborted();\n throw error;\n }\n}\n","import type { ApiExecutionResponse, CaptchaStatus } from '@/lib/client/types.gen';\nimport type { ExecuteAction } from '@/actions';\nimport { NotteAPIError, NotteTimeoutError, sleep } from '@/errors';\n\nexport type { CaptchaStatus } from '@/lib/client/types.gen';\n\n/** Execution envelope with the backend's additive CAPTCHA coordination fields. */\nexport type CaptchaExecutionResponse = ApiExecutionResponse & {\n captcha?: CaptchaStatus | null;\n action_executed?: boolean | null;\n code?: string | null;\n};\n\nexport interface CaptchaExecuteParams {\n captcha_timeout_seconds: number;\n captcha_id?: string;\n target_page_id?: string;\n target_generation?: number;\n}\n\n/** Poll background work; only an explicit unexecuted response permits action resubmission. */\nexport async function executeWithCaptcha(\n action: ExecuteAction,\n budgetSeconds: number,\n request: (action: ExecuteAction, params: CaptchaExecuteParams, timeoutMs?: number) => Promise<CaptchaExecutionResponse>,\n): Promise<CaptchaExecutionResponse> {\n const explicit = action.type === 'captcha_solve';\n let deadline = explicit ? performance.now() + budgetSeconds * 1000 : undefined;\n let params: CaptchaExecuteParams = { captcha_timeout_seconds: budgetSeconds };\n let requestAction = action;\n let original: CaptchaExecutionResponse | undefined;\n let last: CaptchaExecutionResponse | undefined;\n const remaining = () => deadline === undefined ? budgetSeconds : (deadline - performance.now()) / 1000;\n const pause = (ms = 1000) => sleep(Math.max(0, Math.min(ms, remaining() * 1000)));\n const failure = (message: string, code: string): CaptchaExecutionResponse => ({\n started_at: new Date().toISOString(), ended_at: new Date().toISOString(),\n ...(original ?? last), action, success: false, message, code,\n exception: message, exception_detail: null, captcha: last?.captcha,\n });\n while (true) {\n const left = remaining();\n if (left <= 0) return failure('CAPTCHA wait deadline exceeded', 'captcha_timeout');\n params.captcha_timeout_seconds = left;\n const polling = requestAction.type === 'captcha_solve';\n let result: CaptchaExecutionResponse;\n try {\n result = await request(requestAction, { ...params }, polling ? Math.min(10_000, left * 1000) : undefined);\n } catch (error) {\n const transport = error instanceof NotteTimeoutError || error instanceof TypeError || error instanceof SyntaxError;\n const transient = params.captcha_id !== undefined && error instanceof NotteAPIError &&\n [408, 429, 502, 503, 504].includes(error.statusCode);\n if (!polling || params.captcha_id === undefined || (!transport && !transient)) throw error;\n await pause();\n continue;\n }\n last = result;\n const status = result.captcha;\n if (!status) {\n return params.captcha_id ? failure('Server omitted CAPTCHA polling status', 'captcha_protocol_error') : result;\n }\n if (params.captcha_id && status.captcha_id !== params.captcha_id) {\n return failure('Server returned a different CAPTCHA solve', 'captcha_protocol_error');\n }\n deadline ??= performance.now() + budgetSeconds * 1000;\n if (!original && !explicit && result.action_executed === true) original = result;\n if (status.state === 'cancelled' && status.cancel_reason === 'navigation' && original) {\n // Preserve the executed action, without claiming the old CAPTCHA solved or replaying input.\n return { ...original, captcha: status };\n }\n if (status.state === 'cancelled' && status.cancel_reason === 'navigation' &&\n action.type === 'wait' && result.action_executed === false) {\n // A passive wait can check the new document; targeted actions cannot.\n // Drop the old solve/page guards while retaining the original deadline.\n // The CAPTCHA budget does not shorten the action's requested wait duration.\n params = { captcha_timeout_seconds: remaining() };\n requestAction = action;\n await pause();\n continue;\n }\n if (status.state === 'failed' || status.state === 'cancelled') {\n return failure(status.message || `CAPTCHA ${status.state}`, `captcha_${status.state}`);\n }\n if (status.state === 'solved') {\n if (explicit) return result;\n if (original) return { ...original, captcha: status };\n if (!params.captcha_id && result.action_executed !== false) return result;\n params = {\n captcha_timeout_seconds: remaining(), target_page_id: status.page_id, target_generation: status.generation,\n };\n requestAction = action;\n continue;\n }\n if (!explicit && !original && !params.captcha_id && result.action_executed !== false) {\n return failure('Server did not confirm whether the action executed', 'captcha_execution_unknown');\n }\n params.captcha_id = status.captcha_id;\n requestAction = { type: 'captcha_solve' };\n await pause(Math.min(1000, Math.max(100, status.retry_after_ms ?? 1000)));\n }\n}\n","/**\n * Issue an HTTP request from the page a session is on, the port of\n * `notte_core.fetch`.\n *\n * `session.fetch()` runs the browser's own `fetch()` inside the current page, so\n * the request carries the page's cookies, the session's proxy and the browser's\n * network fingerprint. This module builds the script and reads the result back\n * into a `PageFetchResponse`.\n */\nimport { FetchResponseDecodeError, InvalidRequestError, NotteError } from '@/errors';\n\n/** A form body (`Record`) or a raw string body. */\nexport type FetchData = string | Record<string, unknown>;\n\nexport interface PageFetchOptions {\n /** HTTP method. Defaults to `GET`. */\n method?: string;\n /** Request headers. */\n headers?: Record<string, string>;\n /** Query parameters appended to the URL (before any fragment). Arrays repeat the key. */\n params?: Record<string, unknown>;\n /** JSON body, sent with `Content-Type: application/json` unless a content type is given. */\n json?: unknown;\n /** Form body (`Record`, sent url-encoded) or a raw string body sent verbatim. */\n data?: FetchData;\n /** Abort the request after this many milliseconds. Must be positive. */\n timeoutMs?: number;\n /**\n * Allow `http:` URLs and follow redirects. Off by default because the request\n * carries the page's cookies: an `https:` request redirected to `http:` would\n * send them in cleartext before the response can be inspected, so by default\n * redirects are not followed and a redirected response throws.\n */\n allowInsecure?: boolean;\n /**\n * Browser `fetch` redirect mode. Defaults to `manual` (a redirect throws)\n * unless `allowInsecure` is set, in which case redirects are followed like\n * the Python SDK does.\n */\n redirect?: 'follow' | 'manual' | 'error';\n}\n\nconst CONTENT_TYPE = 'content-type';\n\nfunction hasHeader(headers: Record<string, string>, name: string): boolean {\n return Object.keys(headers).some(key => key.toLowerCase() === name);\n}\n\n/** `urlencode(mapping, doseq=True)`: array values repeat the key. */\nfunction urlencode(mapping: Record<string, unknown>): string {\n const search = new URLSearchParams();\n for (const [key, value] of Object.entries(mapping)) {\n if (Array.isArray(value)) {\n for (const item of value) search.append(key, String(item));\n } else {\n search.append(key, String(value));\n }\n }\n return search.toString();\n}\n\n/** Insert `params` into the query string, before any `#fragment`. */\nfunction withParams(url: string, params: Record<string, unknown>): string {\n const hashIndex = url.indexOf('#');\n const fragment = hashIndex >= 0 ? url.slice(hashIndex) : '';\n const base = hashIndex >= 0 ? url.slice(0, hashIndex) : url;\n const queryIndex = base.indexOf('?');\n const path = queryIndex >= 0 ? base.slice(0, queryIndex) : base;\n const existing = queryIndex >= 0 ? base.slice(queryIndex + 1) : '';\n let query = urlencode(params);\n if (existing) {\n query = `${existing}&${query}`;\n }\n return `${path}?${query}${fragment}`;\n}\n\n/**\n * Return the JavaScript that performs the request and serialises the response.\n *\n * The script is an async IIFE, which `evaluateJs` awaits. It returns a JSON\n * string so the value survives the evaluate round-trip unchanged.\n *\n * ```ts\n * const script = buildFetchScript('/api/items', { params: { page: 2 } });\n * const response = responseFromEvaluated(await session.evaluateJs(script));\n * ```\n */\nexport function buildFetchScript(url: string, options: PageFetchOptions = {}): string {\n const { method = 'GET', headers, params, json, data, timeoutMs, allowInsecure = false } = options;\n const redirect = options.redirect ?? (allowInsecure ? 'follow' : 'manual');\n if (json !== undefined && data !== undefined) {\n throw new InvalidRequestError('pass either json or data, not both');\n }\n if (timeoutMs !== undefined && !(timeoutMs > 0)) {\n throw new InvalidRequestError('timeout must be positive');\n }\n\n let requestUrl = url;\n if (params && Object.keys(params).length > 0) {\n // insert before any fragment: the browser strips `#...` before sending,\n // so parameters appended after it would be silently dropped\n requestUrl = withParams(url, params);\n }\n\n const requestHeaders: Record<string, string> = { ...(headers ?? {}) };\n let body: string | undefined;\n if (json !== undefined) {\n body = JSON.stringify(json);\n if (!hasHeader(requestHeaders, CONTENT_TYPE)) {\n requestHeaders['Content-Type'] = 'application/json';\n }\n } else if (data !== undefined && typeof data !== 'string') {\n body = urlencode(data);\n if (!hasHeader(requestHeaders, CONTENT_TYPE)) {\n requestHeaders['Content-Type'] = 'application/x-www-form-urlencoded';\n }\n } else if (data !== undefined) {\n body = data;\n }\n\n const init: Record<string, unknown> = {\n method: method.toUpperCase(),\n headers: requestHeaders,\n credentials: 'include',\n redirect,\n };\n if (body !== undefined) {\n if (init.method === 'GET' || init.method === 'HEAD') {\n // browser fetch() rejects these outright, so fail before the round-trip\n throw new InvalidRequestError(`${String(init.method)} requests cannot have a body`);\n }\n init.body = body;\n }\n\n let abort = '';\n if (timeoutMs !== undefined) {\n abort =\n 'const controller = new AbortController();' +\n `setTimeout(() => controller.abort(), ${Math.trunc(timeoutMs)});` +\n 'init.signal = controller.signal;';\n }\n return (\n '(async () => {' +\n `const init = ${JSON.stringify(init)};` +\n `${abort}` +\n // resolve against the page so relative URLs inherit its scheme, then refuse\n // plaintext: `credentials: 'include'` would send non-Secure cookies in clear\n `const target = new URL(${JSON.stringify(requestUrl)}, location.href);` +\n `const allowInsecure = ${allowInsecure ? 'true' : 'false'};` +\n \"if (target.protocol !== 'https:' && !allowInsecure) {\" +\n \" throw new Error('Refusing to fetch ' + target.origin + ' over plaintext; pass allowInsecure: true to override');\" +\n '}' +\n 'const response = await fetch(target.toString(), init);' +\n // with redirect: 'manual' the browser stops at the first redirect and hands\n // back an opaque response, so no cookie has left over a downgraded connection\n \"if (response.type === 'opaqueredirect') {\" +\n \" throw new Error('The request to ' + target.origin + ' was redirected; redirects are not followed because the page cookies could be sent in cleartext. Fetch the final URL directly or pass allowInsecure: true');\" +\n '}' +\n \"if (!allowInsecure && new URL(response.url).protocol !== 'https:') {\" +\n \" throw new Error('Refusing to read a response served over plaintext from ' + new URL(response.url).origin + '; pass allowInsecure: true to override');\" +\n '}' +\n // ship the raw bytes as base64: `response.text()` would decode with\n // replacement and lose any non-UTF-8 or binary body for good\n 'const bytes = new Uint8Array(await response.arrayBuffer());' +\n \"let binary = '';\" +\n 'for (let i = 0; i < bytes.length; i += 0x8000) {' +\n ' binary += String.fromCharCode.apply(null, bytes.subarray(i, i + 0x8000));' +\n '}' +\n 'const headers = {};' +\n 'response.headers.forEach((value, key) => { headers[key] = value; });' +\n 'return JSON.stringify({status: response.status, url: response.url, headers: headers, body_b64: btoa(binary)});' +\n '})()'\n );\n}\n\nconst REASON_PHRASES: Record<number, string> = {\n 100: 'Continue', 101: 'Switching Protocols', 102: 'Processing', 103: 'Early Hints',\n 200: 'OK', 201: 'Created', 202: 'Accepted', 203: 'Non-Authoritative Information', 204: 'No Content',\n 205: 'Reset Content', 206: 'Partial Content', 207: 'Multi-Status', 208: 'Already Reported', 226: 'IM Used',\n 300: 'Multiple Choices', 301: 'Moved Permanently', 302: 'Found', 303: 'See Other', 304: 'Not Modified',\n 305: 'Use Proxy', 307: 'Temporary Redirect', 308: 'Permanent Redirect',\n 400: 'Bad Request', 401: 'Unauthorized', 402: 'Payment Required', 403: 'Forbidden', 404: 'Not Found',\n 405: 'Method Not Allowed', 406: 'Not Acceptable', 407: 'Proxy Authentication Required', 408: 'Request Timeout',\n 409: 'Conflict', 410: 'Gone', 411: 'Length Required', 412: 'Precondition Failed', 413: 'Request Entity Too Large',\n 414: 'Request-URI Too Long', 415: 'Unsupported Media Type', 416: 'Requested Range Not Satisfiable',\n 417: 'Expectation Failed', 418: \"I'm a Teapot\", 421: 'Misdirected Request', 422: 'Unprocessable Entity',\n 423: 'Locked', 424: 'Failed Dependency', 425: 'Too Early', 426: 'Upgrade Required', 428: 'Precondition Required',\n 429: 'Too Many Requests', 431: 'Request Header Fields Too Large', 451: 'Unavailable For Legal Reasons',\n 500: 'Internal Server Error', 501: 'Not Implemented', 502: 'Bad Gateway', 503: 'Service Unavailable',\n 504: 'Gateway Timeout', 505: 'HTTP Version Not Supported', 506: 'Variant Also Negotiates',\n 507: 'Insufficient Storage', 508: 'Loop Detected', 510: 'Not Extended', 511: 'Network Authentication Required',\n};\n\n/** `response.raiseForStatus()` rejected a 4xx/5xx response, like `requests.HTTPError`. */\nexport class PageFetchHTTPError extends NotteError {\n readonly response: PageFetchResponse;\n\n constructor(response: PageFetchResponse) {\n const kind = response.status < 500 ? 'Client Error' : 'Server Error';\n super(`${response.status} ${kind}: ${response.statusText} for url: ${response.url}`);\n this.response = response;\n }\n}\n\n/**\n * The charset the response declares, else `utf-8` when the bytes are valid\n * utf-8. `undefined` means the body is binary or of unknown encoding; `text()`\n * then falls back to a lossy utf-8 decode.\n */\nfunction encodingFor(headers: Record<string, string>, content: Uint8Array): string | undefined {\n const contentType = Object.entries(headers).find(([key]) => key.toLowerCase() === CONTENT_TYPE)?.[1] ?? '';\n for (const param of contentType.split(';').slice(1)) {\n const [name, ...rest] = param.split('=');\n const value = rest.join('=');\n if (name?.trim().toLowerCase() === 'charset' && value) {\n return value.trim().replace(/^[\"']|[\"']$/g, '');\n }\n }\n try {\n new TextDecoder('utf-8', { fatal: true }).decode(content);\n } catch {\n return undefined;\n }\n return 'utf-8';\n}\n\n/**\n * The response of `session.fetch()`, shaped like the Web `Response` with the\n * final `url` after redirects exposed as a plain property. A non-2xx status is\n * a response, not an error; `raiseForStatus()` throws `PageFetchHTTPError`.\n * `bytes()` holds the exact bytes the server sent, so binary bodies survive;\n * `text()` decodes them with the declared charset, or utf-8 when none is given.\n */\nexport class PageFetchResponse {\n readonly status: number;\n readonly statusText: string;\n readonly headers: Headers;\n /** The final URL after redirects. */\n readonly url: string;\n /** The declared charset, `utf-8` when the body is valid utf-8, else `undefined`. */\n readonly encoding: string | undefined;\n private readonly content: Uint8Array;\n\n constructor(init: { status: number; headers: Record<string, string>; url: string; content: Uint8Array }) {\n this.status = init.status;\n this.statusText = REASON_PHRASES[init.status] ?? '';\n this.headers = new Headers(init.headers);\n this.url = init.url;\n this.content = init.content;\n this.encoding = encodingFor(init.headers, init.content);\n }\n\n get ok(): boolean {\n return this.status >= 200 && this.status < 300;\n }\n\n /** The raw body bytes. */\n bytes(): Uint8Array {\n return this.content;\n }\n\n async arrayBuffer(): Promise<ArrayBuffer> {\n return this.content.slice().buffer as ArrayBuffer;\n }\n\n async text(): Promise<string> {\n let decoder: TextDecoder;\n try {\n decoder = new TextDecoder(this.encoding ?? 'utf-8');\n } catch {\n decoder = new TextDecoder('utf-8');\n }\n return decoder.decode(this.content);\n }\n\n async json(): Promise<unknown> {\n return JSON.parse(await this.text()) as unknown;\n }\n\n /** Throw `PageFetchHTTPError` on a 4xx/5xx status, like `requests.Response.raise_for_status()`. */\n raiseForStatus(): this {\n if (this.status >= 400) {\n throw new PageFetchHTTPError(this);\n }\n return this;\n }\n}\n\nconst BASE64_PATTERN = /^[A-Za-z0-9+/]*={0,2}$/;\n\nfunction decodeBase64(value: string): Uint8Array {\n if (!BASE64_PATTERN.test(value) || value.length % 4 !== 0) {\n throw new Error('body_b64 is not valid base64');\n }\n return new Uint8Array(Buffer.from(value, 'base64'));\n}\n\n/**\n * Turn the envelope `buildFetchScript` returns into a `PageFetchResponse`.\n * Throws `FetchResponseDecodeError` when the envelope cannot be read.\n */\nexport function responseFromEvaluated(raw: string): PageFetchResponse {\n let payload: unknown;\n try {\n payload = JSON.parse(raw);\n } catch (error) {\n throw new FetchResponseDecodeError(error instanceof Error ? error.message : String(error));\n }\n if (typeof payload !== 'object' || payload === null || Array.isArray(payload)) {\n throw new FetchResponseDecodeError('envelope is not an object');\n }\n const envelope = payload as Record<string, unknown>;\n try {\n if (!('status' in envelope)) {\n throw new Error(\"'status'\");\n }\n const status = Number(envelope.status);\n if (!Number.isInteger(status)) {\n throw new Error(`invalid status: ${String(envelope.status)}`);\n }\n const rawHeaders = envelope.headers ?? {};\n if (typeof rawHeaders !== 'object' || Array.isArray(rawHeaders)) {\n throw new Error('headers is not an object');\n }\n const headers: Record<string, string> = {};\n for (const [key, value] of Object.entries(rawHeaders as Record<string, unknown>)) {\n headers[String(key)] = String(value);\n }\n const content = decodeBase64(String(envelope.body_b64 ?? ''));\n const url = String(envelope.url ?? '');\n return new PageFetchResponse({ status, headers, url, content });\n } catch (error) {\n throw new FetchResponseDecodeError(error instanceof Error ? error.message : String(error));\n }\n}\n","/**\n * Cookie file helpers, the counterpart of `SetCookiesRequest.from_json` and\n * `notte_core.config.create_or_append_cookies_to_file` in Python.\n */\nimport { readFile, writeFile } from 'node:fs/promises';\nimport { resolve } from 'node:path';\nimport type { Cookie } from '@/lib/client/types.gen';\nimport { InvalidRequestError } from '@/errors';\n\n/** Read a JSON cookie file (a list of cookies, like `session.getCookies()` returns). */\nexport async function readCookiesFile(cookieFile: string): Promise<Cookie[]> {\n const cookies: unknown = JSON.parse(await readFile(cookieFile, 'utf-8'));\n if (!Array.isArray(cookies)) {\n throw new InvalidRequestError(`Cookie file ${cookieFile} must contain a JSON list of cookies`);\n }\n return cookies as Cookie[];\n}\n\n/**\n * Merge `cookies` into the JSON list stored in `cookieFile`, one entry per\n * cookie, creating the file when it does not exist yet.\n *\n * Sessions load the file when they start, so the browser's jar on stop repeats\n * the cookies it loaded: appending them blindly duplicated the whole file on\n * every stop. Merging (rather than overwriting) keeps cookies another session\n * saved to the same file. A cookie is identified by name, domain, path and\n * partition key; the newest value wins.\n */\nexport async function createOrAppendCookiesToFile(cookieFile: string, cookies: Cookie[]): Promise<void> {\n console.info(`🍪 Automatically saving cookies to ${cookieFile}`);\n // Sessions sharing one cookie file (stopped concurrently) must not read the\n // same contents and overwrite each other, so the read-modify-write runs\n // under a per-path lock. The lock is per process; a file shared between\n // processes still needs an external lock.\n await withFileLock(cookieFile, async () => {\n let existing: Cookie[] = [];\n try {\n existing = await readCookiesFile(cookieFile);\n } catch (error) {\n if (!isNotFound(error)) {\n throw error;\n }\n }\n const merged = new Map<string, Cookie>();\n for (const cookie of [...existing, ...cookies]) {\n merged.set(cookieIdentity(cookie), cookie);\n }\n await writeFile(cookieFile, JSON.stringify([...merged.values()]), 'utf-8');\n });\n}\n\nfunction cookieIdentity(cookie: Cookie): string {\n return JSON.stringify([cookie.name, cookie.domain ?? null, cookie.path ?? null, cookie.partitionKey ?? null]);\n}\n\nconst fileLocks = new Map<string, Promise<void>>();\n\n/** Run `fn` after every earlier operation queued for the same resolved path. */\nasync function withFileLock<T>(path: string, fn: () => Promise<T>): Promise<T> {\n const key = resolve(path);\n const previous = fileLocks.get(key) ?? Promise.resolve();\n let release!: () => void;\n const current = new Promise<void>(done => {\n release = done;\n });\n const tail = previous.then(() => current);\n fileLocks.set(key, tail);\n await previous;\n try {\n return await fn();\n } finally {\n release();\n // Evict the entry when nobody queued behind us, so paths used once do not\n // accumulate in long-running processes.\n if (fileLocks.get(key) === tail) {\n fileLocks.delete(key);\n }\n }\n}\n\n/** Test hook: number of cookie files with an in-flight or queued update. */\nexport function pendingCookieFileLocks(): number {\n return fileLocks.size;\n}\n\nfunction isNotFound(error: unknown): boolean {\n return typeof error === 'object' && error !== null && (error as { code?: string }).code === 'ENOENT';\n}\n","/**\n * Helper function to format error messages\n */\nimport { spawn } from 'node:child_process';\n\nfunction formatError(error: unknown): string {\n\tif (typeof error === 'object' && error !== null) {\n\t\t// If the error object has a message property, use it\n\t\tif ('message' in error && typeof error.message === 'string') {\n\t\t\treturn error.message;\n\t\t}\n\t\t// Otherwise, try to stringify the object\n\t\ttry {\n\t\t\treturn JSON.stringify(error, null, 2);\n\t\t} catch {\n\t\t\treturn String(error);\n\t\t}\n\t}\n\tif (error instanceof Error) {\n\t\treturn error.message;\n\t}\n\treturn String(error);\n}\n\nfunction openBrowser(url: string): void {\n\tconst platform = process.platform;\n\tlet command: string;\n\tlet args: string[];\n\n\tif (platform === 'darwin') {\n\t\tcommand = 'open';\n\t\targs = [url];\n\t} else if (platform === 'win32') {\n\t\tcommand = 'rundll32';\n\t\targs = ['url.dll,FileProtocolHandler', url];\n\t} else {\n\t\tcommand = 'xdg-open';\n\t\targs = [url];\n\t}\n\n\tconst child = spawn(command, args, {\n\t\tdetached: true,\n\t\tstdio: 'ignore',\n\t});\n\tchild.on('error', () => {\n\t\t// The viewer is a convenience path; avoid crashing the process if no\n\t\t// local browser opener exists in the current environment.\n\t});\n\tchild.unref();\n}\n\n/** JSON Schema keywords whose value is a single subschema (or a boolean). */\nconst SCHEMA_KEYWORDS = new Set([\n 'items', 'additionalItems', 'additionalProperties', 'contains', 'propertyNames',\n 'not', 'if', 'then', 'else', 'unevaluatedItems', 'unevaluatedProperties',\n]);\n/** Keywords whose value is an array of subschemas. */\nconst SCHEMA_ARRAY_KEYWORDS = new Set(['anyOf', 'oneOf', 'allOf', 'prefixItems']);\n/**\n * Keywords that shape the value of one specific type and are read by the API's\n * converter from the branch carrying that type.\n */\nconst TYPE_SCOPED_KEYWORDS = new Set([\n 'items', 'prefixItems', 'additionalItems', 'contains', 'unevaluatedItems',\n 'properties', 'patternProperties', 'required', 'additionalProperties', 'propertyNames', 'unevaluatedProperties',\n 'format',\n]);\n/** Keywords whose value is a map from name to subschema. */\nconst SCHEMA_MAP_KEYWORDS = new Set(['properties', 'patternProperties', '$defs', 'definitions', 'dependentSchemas']);\n\n/**\n * Normalise a JSON Schema produced by `z.toJSONSchema()` into the shape the\n * Notte API accepts. zod >= 4.6 emits nullable fields as a type array\n * (`{ type: ['string', 'null'] }`); the API's structured-output validator\n * only understands the `anyOf` form zod used to emit, so expand type arrays\n * back into `anyOf` branches.\n *\n * Only schema-bearing keywords are traversed. Instance-valued keywords such as\n * `default`, `examples`, `const` and `enum` hold caller data, not schemas, and\n * are passed through untouched even if they happen to contain a `type` key.\n *\n * When a type array is expanded, the split mirrors how the API's converter\n * (`notte_core.schema.create_model_from_schema`) reads a\n * property: it resolves the Python type by recursing into each `anyOf` branch,\n * so type-scoped keywords (`items`, `properties`, `required`, `format`, ...)\n * move into the matching typed branch, while field constraints and\n * annotations (`minimum`, `minItems`, `enum`, `description`, `default`, ...)\n * are read from the property itself and therefore stay on the parent. A\n * pre-existing `anyOf` is intersected with the allowed types instead of being\n * overwritten.\n */\nfunction normalizeJsonSchema(schema: unknown): unknown {\n if (schema === null || typeof schema !== 'object' || Array.isArray(schema)) return schema;\n const out: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(schema as Record<string, unknown>)) {\n if (SCHEMA_KEYWORDS.has(key) || (key === 'items' && Array.isArray(value))) {\n out[key] = Array.isArray(value) ? value.map(normalizeJsonSchema) : normalizeJsonSchema(value);\n } else if (SCHEMA_ARRAY_KEYWORDS.has(key) && Array.isArray(value)) {\n out[key] = value.map(normalizeJsonSchema);\n } else if (SCHEMA_MAP_KEYWORDS.has(key) && value !== null && typeof value === 'object' && !Array.isArray(value)) {\n out[key] = Object.fromEntries(\n Object.entries(value as Record<string, unknown>).map(([name, sub]) => [name, normalizeJsonSchema(sub)]),\n );\n } else {\n out[key] = value;\n }\n }\n if (Array.isArray(out.type)) {\n const { type, anyOf: existing, ...rest } = out;\n const types = type as string[];\n const parent: Record<string, unknown> = {};\n const scoped: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(rest)) {\n (TYPE_SCOPED_KEYWORDS.has(key) ? scoped : parent)[key] = value;\n }\n const typed = (t: string): Record<string, unknown> => (t === 'null' ? { type: t } : { type: t, ...scoped });\n let branches: Record<string, unknown>[];\n if (Array.isArray(existing)) {\n // Intersect the existing alternatives with the allowed types: typed\n // branches survive only if their type is allowed; untyped branches are\n // expanded once per allowed type, null included, so the result never\n // accepts a value the original rejected (e.g. null when no branch did).\n const seen = new Set<string>();\n branches = [];\n const push = (b: Record<string, unknown>) => {\n const key = JSON.stringify(b);\n if (!seen.has(key)) {\n seen.add(key);\n branches.push(b);\n }\n };\n for (const branch of existing as Record<string, unknown>[]) {\n if (typeof branch.type === 'string') {\n if (types.includes(branch.type)) push(branch.type === 'null' ? branch : { ...scoped, ...branch });\n } else {\n for (const t of types) push({ ...typed(t), ...branch });\n }\n }\n } else {\n branches = types.map(typed);\n }\n return { ...parent, anyOf: branches };\n }\n return out;\n}\n\nexport { formatError, normalizeJsonSchema, openBrowser };\n","/**\n * Shared scrape request/response handling for `client.scrape()` and\n * `session.scrape()`, mirroring `PageClient.scrape` in the Python SDK.\n */\nimport { normalizeJsonSchema } from '@/utils';\nimport type { DataSpace, ScrapeRequest, StructuredDataBaseModel } from '@/lib/client/types.gen';\nimport { ScrapeFailedError } from '@/errors';\n\n/** Minimal structural view of a Zod schema so `zod` stays an optional import path. */\nexport interface ZodLikeSchema<T> {\n parse(data: unknown): T;\n}\n\n/** Structured extraction result when `raiseOnFailure` is false, like `StructuredData` in Python. */\nexport interface StructuredData<T> {\n success: boolean;\n error?: string | null;\n data?: T | null;\n}\n\nexport interface ScrapeOptions<T = unknown> {\n /** A Zod schema or a JSON Schema object describing the data to extract. */\n response_format?: ZodLikeSchema<T> | Record<string, unknown> | null;\n /** JSON Schema to send instead of converting `response_format`. Only used with a Zod schema. */\n json_schema?: Record<string, unknown>;\n /**\n * When true (default) a failed structured extraction throws `ScrapeFailedError`\n * and the extracted data is returned directly. When false the `StructuredData`\n * wrapper is returned so callers can inspect `.success`.\n */\n raiseOnFailure?: boolean;\n}\n\n/** `only_images` is still in the generated request type (the 1.x API accepts it) but image scraping was removed. */\nexport type SessionScrapeOptions<T = unknown> = Omit<ScrapeRequest, 'response_format' | 'only_images'> & ScrapeOptions<T>;\n\nexport type ScrapeResult<T> = string | T | StructuredData<T>;\n\nexport function isZodSchema<T>(value: unknown): value is ZodLikeSchema<T> {\n return typeof value === 'object' && value !== null && typeof (value as ZodLikeSchema<T>).parse === 'function';\n}\n\nexport function requiresSchema(options: { response_format?: unknown; instructions?: string | null }): boolean {\n return Boolean(options.response_format || options.instructions);\n}\n\n/**\n * Build the API request body: strips SDK-only options and replaces a Zod\n * `response_format` with its JSON Schema. `instructions` are sent exactly as\n * given; nothing is inferred from the schema.\n */\nexport async function buildScrapeBody<T>(\n options: SessionScrapeOptions<T>,\n): Promise<Omit<ScrapeRequest, 'response_format'> & { response_format?: unknown }> {\n const { raiseOnFailure: _raise, json_schema, response_format, ...rest } = options;\n const body: Omit<ScrapeRequest, 'response_format'> & { response_format?: unknown } = { ...rest };\n if (isZodSchema(response_format)) {\n if (json_schema) {\n body.response_format = json_schema;\n } else {\n const { z } = await import('zod');\n body.response_format = normalizeJsonSchema(z.toJSONSchema(response_format as never));\n }\n } else if (response_format) {\n body.response_format = response_format;\n }\n return body;\n}\n\n/**\n * Post-process a scrape response according to the request options:\n * - `response_format` / `instructions` return the extracted data (validated by\n * the Zod schema when one was given) or throw `ScrapeFailedError`,\n * - otherwise the markdown string is returned.\n */\nexport function processScrapeResponse<T = unknown>(\n scrapeResponse: DataSpace | undefined,\n options: SessionScrapeOptions<T> & { instructions?: string | null },\n): ScrapeResult<T> {\n if (!scrapeResponse) {\n throw new ScrapeFailedError('empty response');\n }\n const raiseOnFailure = options.raiseOnFailure ?? true;\n\n if (requiresSchema(options)) {\n const structured = scrapeResponse.structured as StructuredDataBaseModel | null | undefined;\n if (!structured) {\n throw new ScrapeFailedError('the API returned no structured data. This should not happen, please report it.');\n }\n const success = structured.success ?? false;\n const schema = isZodSchema<T>(options.response_format) ? options.response_format : undefined;\n\n if (!success) {\n if (raiseOnFailure) {\n throw new ScrapeFailedError(structured.error ?? undefined);\n }\n return { success, error: structured.error ?? null, data: null };\n }\n\n const data = schema && structured.data != null ? schema.parse(structured.data) : (structured.data as T);\n if (raiseOnFailure) {\n return data;\n }\n return { success, error: structured.error ?? null, data };\n }\n\n return scrapeResponse.markdown;\n}\n","/**\n * Automatic retries for transient API failures, shared by every request the\n * client sends. The Python SDK implements the same policy in\n * `notte_sdk/_retry.py`.\n *\n * What is retried:\n * - 503 and 529: the API declined the request before doing any work, so every\n * method is retried.\n * - 502 and 504: a gateway lost or timed out on the upstream response, which\n * may already have been processed. Only idempotent methods (GET, HEAD,\n * OPTIONS, PUT, DELETE) are retried, so a POST such as starting a session\n * or an agent is never sent twice.\n * - Connection failures that happen before the request is sent (connection\n * refused, connect timeout, temporary DNS failure): every method.\n * - Connection resets and socket errors, which can happen after the request\n * was sent: idempotent methods only.\n *\n * Nothing else is retried: 500, other 5xx codes, and 4xx always surface as is.\n */\n\n/** Retries after the first attempt, unless `NotteClientConfig.maxRetries` says otherwise. */\nexport const DEFAULT_MAX_RETRIES = 3;\n/** Backoff before the first retry. Doubles with every retry, capped at `RETRY_MAX_DELAY_MS`. */\nexport const RETRY_BASE_DELAY_MS = 1_000;\nexport const RETRY_MAX_DELAY_MS = 10_000;\n/** A longer `Retry-After` is not waited for: the error is returned instead. */\nexport const RETRY_AFTER_MAX_MS = 20_000;\n\nconst IDEMPOTENT_METHODS = new Set(['GET', 'HEAD', 'OPTIONS', 'PUT', 'DELETE']);\n/** Statuses that guarantee the API did no work. */\nconst REFUSED_STATUSES = new Set([503, 529]);\n/** Gateway statuses: the upstream may already have processed the request. */\nconst GATEWAY_STATUSES = new Set([502, 504]);\n/** The connection was never established, so the request was not sent. */\nconst NOT_SENT_ERROR_CODES = new Set([\n 'ECONNREFUSED',\n 'EAI_AGAIN',\n 'ENETUNREACH',\n 'EHOSTUNREACH',\n 'UND_ERR_CONNECT_TIMEOUT',\n]);\n/** The connection broke at an unknown point, possibly after the request was sent. */\nconst BROKEN_CONNECTION_ERROR_CODES = new Set([\n 'ECONNRESET',\n 'EPIPE',\n 'ETIMEDOUT',\n 'UND_ERR_SOCKET',\n 'UND_ERR_CLOSED',\n]);\n\nexport function isIdempotentMethod(method: string): boolean {\n return IDEMPOTENT_METHODS.has(method.toUpperCase());\n}\n\n/** Whether a response with this status is retried for this method. */\nexport function isRetryableStatus(status: number, method: string): boolean {\n return REFUSED_STATUSES.has(status) || (GATEWAY_STATUSES.has(status) && isIdempotentMethod(method));\n}\n\n/** Whether a fetch rejection is a connection failure that is retried for this method. */\nexport function isRetryableNetworkError(error: unknown, method: string): boolean {\n const code = networkErrorCode(error);\n if (code === undefined) return false;\n return NOT_SENT_ERROR_CODES.has(code) || (BROKEN_CONNECTION_ERROR_CODES.has(code) && isIdempotentMethod(method));\n}\n\n/** Find the system error code undici attaches to `TypeError: fetch failed`. */\nfunction networkErrorCode(error: unknown, depth = 0): string | undefined {\n if (typeof error !== 'object' || error === null || depth > 4) return undefined;\n const { code, cause, errors } = error as { code?: unknown; cause?: unknown; errors?: unknown };\n if (typeof code === 'string') return code;\n if (Array.isArray(errors) && errors.length > 0) return networkErrorCode(errors[0], depth + 1);\n return networkErrorCode(cause, depth + 1);\n}\n\n/**\n * Parse a `Retry-After` header (seconds or an HTTP date) into milliseconds.\n * Returns `undefined` when absent or malformed.\n */\nexport function parseRetryAfter(header: string | null | undefined, now = Date.now()): number | undefined {\n if (!header) return undefined;\n const value = header.trim();\n if (/^\\d+(\\.\\d+)?$/.test(value)) return Number(value) * 1000;\n const date = Date.parse(value);\n return Number.isNaN(date) ? undefined : Math.max(0, date - now);\n}\n\n/** Exponential backoff with full jitter for the retry following attempt `attempt` (0-based). */\nexport function backoffDelayMs(attempt: number, random: () => number = Math.random): number {\n return random() * Math.min(RETRY_MAX_DELAY_MS, RETRY_BASE_DELAY_MS * 2 ** attempt);\n}\n\n/**\n * Delay before retrying a response, or `undefined` when its `Retry-After`\n * asks for more than `RETRY_AFTER_MAX_MS`.\n */\nexport function retryDelayMs(attempt: number, retryAfter: string | null | undefined, random?: () => number): number | undefined {\n const requested = parseRetryAfter(retryAfter);\n if (requested === undefined) return backoffDelayMs(attempt, random);\n return requested <= RETRY_AFTER_MAX_MS ? requested : undefined;\n}\n\nexport interface RetryingFetchOptions {\n /** Retries after the first attempt for the request with this signal. `0` disables retries. */\n maxRetries: (signal: AbortSignal | null | undefined) => number;\n /** Absolute time (ms since epoch) after which the request is abandoned, if any. */\n deadline?: (signal: AbortSignal | null | undefined) => number | undefined;\n /** Underlying fetch. Defaults to the global `fetch`, read at call time. */\n fetch?: typeof fetch;\n random?: () => number;\n sleep?: (ms: number, signal: AbortSignal | null | undefined) => Promise<void>;\n}\n\n/** Wrap `fetch` with the retry policy described at the top of this module. */\nexport function createRetryingFetch(options: RetryingFetchOptions): typeof fetch {\n const wait = options.sleep ?? abortableSleep;\n return async (input: RequestInfo | URL, init?: RequestInit): Promise<Response> => {\n const baseFetch = options.fetch ?? globalThis.fetch;\n const request = input instanceof Request ? input : undefined;\n const method = (request?.method ?? init?.method ?? 'GET').toUpperCase();\n const signal = init?.signal ?? request?.signal;\n const maxRetries = Math.max(0, Math.floor(options.maxRetries(signal) || 0));\n // A Request body is a one-shot stream: send a clone while another attempt may follow.\n const send = (last: boolean) =>\n request && request.body !== null && !last ? baseFetch(request.clone(), init) : baseFetch(input, init);\n\n for (let attempt = 0; ; attempt++) {\n const last = attempt >= maxRetries;\n let response: Response;\n try {\n response = await send(last);\n } catch (error) {\n if (last || !isRetryableNetworkError(error, method)) throw error;\n const delay = backoffDelayMs(attempt, options.random);\n if (!fitsDeadline(delay)) throw error;\n warn(`${method} request failed (${networkErrorCode(error)})`, delay, attempt, maxRetries);\n await wait(delay, signal);\n continue;\n }\n if (last || !isRetryableStatus(response.status, method)) return response;\n const delay = retryDelayMs(attempt, response.headers.get('retry-after'), options.random);\n if (delay === undefined || !fitsDeadline(delay)) return response;\n await response.body?.cancel().catch(() => undefined);\n warn(`${method} request returned ${response.status}`, delay, attempt, maxRetries);\n await wait(delay, signal);\n }\n\n function fitsDeadline(delay: number): boolean {\n const deadline = options.deadline?.(signal);\n return deadline === undefined || Date.now() + delay < deadline;\n }\n };\n}\n\nfunction warn(reason: string, delay: number, attempt: number, maxRetries: number): void {\n console.warn(`${reason}, retrying in ${(delay / 1000).toFixed(1)}s (${attempt + 1}/${maxRetries})`);\n}\n\nfunction abortableSleep(ms: number, signal: AbortSignal | null | undefined): Promise<void> {\n return new Promise((resolve, reject) => {\n if (signal?.aborted) {\n reject(signal.reason);\n return;\n }\n const onAbort = () => {\n clearTimeout(timer);\n reject(signal?.reason);\n };\n const timer = setTimeout(() => {\n signal?.removeEventListener('abort', onAbort);\n resolve();\n }, ms);\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n}\n","import type { NotteClient } from '@/client';\nimport type {\n Credential,\n CredentialsDictInput,\n CredentialsDictOutput,\n Vault,\n VaultCreateRequest,\n} from '@/lib/client/types.gen';\nimport {\n vaultCreate,\n vaultCredentialsAdd,\n vaultCredentialsDelete,\n vaultCredentialsGet,\n vaultCredentialsList,\n vaultDelete,\n} from '@/lib/client/sdk.gen';\nimport { getDomain } from 'tldts';\nimport { InvalidRequestError } from '@/errors';\n\n// Constructor overloads for NotteVault - mirrors Python overloads\nexport interface VaultConstructorWithId {\n vault_id: string;\n}\n\nexport interface VaultConstructorCreate extends VaultCreateRequest {\n vault_id?: never;\n}\n\nexport type VaultConstructor = VaultConstructorWithId | VaultConstructorCreate;\n\n/** Credential fields read by `addCredentialsFromEnv`, in the order Python's `CredentialField.registry` declares them. */\nexport const CREDENTIAL_FIELDS = ['email', 'username', 'mfa_secret', 'password'] as const;\nexport type CredentialField = (typeof CREDENTIAL_FIELDS)[number];\n\n\nfunction extractHostname(url: string): string {\n const trimmed = url.trim();\n if (trimmed.length === 0) {\n return '';\n }\n // Bare domains (`peeple.com`, `github.com:443`) get a scheme so `URL` can parse them.\n const hasScheme = /^[a-z][a-z0-9+.-]*:\\/\\//i.test(trimmed);\n const candidates = hasScheme ? [trimmed] : [`https://${trimmed}`];\n for (const candidate of candidates) {\n try {\n const { hostname } = new URL(candidate);\n // Python's tldextract yields an empty domain for names starting with a dot.\n if (hostname.length > 0 && !hostname.startsWith('.')) {\n return hostname.toLowerCase();\n }\n } catch {\n // Not parseable: no domain.\n }\n }\n return '';\n}\n\n/**\n * Get the root domain of a URL, the counterpart of `notte_core.url.get_root_domain`.\n * Returns an empty string when no domain can be extracted.\n *\n * ```ts\n * getRootDomain('https://www.example.com/path'); // 'example.com'\n * getRootDomain('https://test.peeple.com/ok'); // 'peeple.com'\n * getRootDomain('https://shop.example.co.uk'); // 'example.co.uk'\n * ```\n */\nexport function getRootDomain(url: string): string {\n const hostname = extractHostname(url);\n if (hostname.length === 0) {\n return '';\n }\n // IPv6 literals and IPv4 addresses have no public suffix: keep them whole.\n if (hostname.startsWith('[') || /^\\d{1,3}(\\.\\d{1,3}){3}$/.test(hostname)) {\n return hostname;\n }\n // Public Suffix List (ICANN section, like tldextract's default in Python), so\n // multi-label suffixes such as `co.uk` or `pvt.k12.ma.us` are handled and the\n // credential key matches the one the Python SDK derives.\n const domain = getDomain(hostname, { allowPrivateDomains: false, detectIp: false });\n if (domain) {\n return domain.toLowerCase();\n }\n // Unknown suffix (intranet names, `localhost`): keep the hostname whole.\n return hostname.toLowerCase();\n}\n\n/**\n * Explicit opt-in URL utility; vault request methods do not call it.\n * Normalise a credential URL to its root domain, the counterpart of\n * `notte_sdk.types.validate_url`. Throws `InvalidRequestError` when the URL\n * has no domain name.\n *\n * ```ts\n * validateUrl('https://github.com/login'); // 'github.com'\n * validateUrl('https://'); // throws InvalidRequestError\n * ```\n */\nexport function validateUrl(url: string): string {\n const domain = getRootDomain(url);\n if (domain.length === 0) {\n throw new InvalidRequestError(`Invalid URL: ${url}. Please provide a valid URL with a domain name.`);\n }\n return domain;\n}\n\n/**\n * Check that a string is a base32 TOTP secret, with the padding rules Python's\n * `pyotp.TOTP(secret).now()` applies (`base64.b32decode` after right-padding\n * the secret to a multiple of eight characters).\n */\nexport function isValidMfaSecret(secret: string): boolean {\n if (secret.length === 0) {\n return false;\n }\n let padded = secret.toUpperCase();\n if (padded.length % 8 !== 0) {\n padded += '='.repeat(8 - (padded.length % 8));\n }\n let end = padded.length;\n while (end > 0 && padded[end - 1] === '=') {\n end -= 1;\n }\n const stripped = padded.slice(0, end);\n const padding = padded.length - stripped.length;\n return /^[A-Z2-7]*$/.test(stripped) && [0, 1, 3, 4, 6].includes(padding);\n}\n\n/**\n * Explicit opt-in utility; vault request methods leave validation to the API.\n * Validate an MFA secret like `AddCredentialsRequest.check_email_and_username`\n * in Python. Rejects one-time codes (`999777`) and anything that is not base32.\n */\nexport function validateMfaSecret(secret: string): void {\n if (!isValidMfaSecret(secret)) {\n throw new InvalidRequestError('Invalid MFA secret code: did you try to store an OTP instead of a secret?');\n }\n}\n\n/**\n * Explicit opt-in utility; vault request methods leave validation to the API.\n * Apply the client-side rules of Python's `AddCredentialsRequest`: exactly one\n * of `username` / `email`, and a base32 `mfa_secret` when one is provided.\n * Returns the credentials unchanged.\n */\nexport function validateCredentials(credentials: CredentialsDictInput): CredentialsDictInput {\n const hasUsername = credentials.username !== undefined && credentials.username !== null;\n const hasEmail = credentials.email !== undefined && credentials.email !== null;\n if (hasUsername && hasEmail) {\n throw new InvalidRequestError('Can only set either username or email');\n }\n if (!hasUsername && !hasEmail) {\n throw new InvalidRequestError('Need to have either username or email set');\n }\n if (credentials.mfa_secret !== undefined && credentials.mfa_secret !== null) {\n validateMfaSecret(credentials.mfa_secret);\n }\n return credentials;\n}\n\n/**\n * Vault that fetches credentials stored using the SDK, the counterpart of\n * `notte_sdk.endpoints.vaults.NotteVault`.\n *\n * The remote vault is created lazily on the first API operation so local-only\n * helpers such as `generatePassword()` stay side-effect free. Every API\n * failure rejects with a `NotteAPIError`, including server-side validation\n * failures (422 for invalid URLs, credentials, or MFA secrets).\n * // pragma: allowlist secret\n * ```ts\n * const vault = client.Vault({ name: 'My vault' });\n * await vault.addCredentials('https://github.com/', { email: 'me@example.org', password: 'secret' }); // pragma: allowlist secret\n * const credentials = await vault.getCredentials('https://github.com/login');\n * await vault.stop(); // deletes the vault and every credential it holds\n * ```\n */\nexport class NotteVault {\n private client: NotteClient;\n private _vaultId: string | null = null;\n private initPromise: Promise<string> | null = null;\n private createData: VaultCreateRequest | null = null;\n\n constructor(client: NotteClient, options: VaultConstructor = {}) {\n this.client = client;\n\n if (options && 'vault_id' in options && options.vault_id !== undefined) {\n // Constructor for existing vault\n if (options.vault_id.length === 0) {\n throw new InvalidRequestError('Vault ID cannot be empty');\n }\n this.initPromise = this.initExistingVault(options.vault_id);\n // The rejection is surfaced by the first awaited operation; avoid an\n // unhandled rejection when verification fails before anything is awaited.\n this.initPromise.catch(() => undefined);\n } else {\n // Defer remote creation until an operation actually needs a vault. This\n // keeps local-only helpers such as generatePassword() side-effect free.\n const { vault_id: _ignored, ...createData } = (options ?? {}) as VaultConstructorCreate;\n this.createData = createData;\n }\n }\n\n private async initExistingVault(vaultId: string): Promise<string> {\n await this.verifyVaultExists(vaultId);\n this._vaultId = vaultId;\n return this._vaultId;\n }\n\n private async initNewVault(createData: VaultCreateRequest): Promise<string> {\n const response = await vaultCreate({\n client: this.client.getClient(),\n body: createData,\n throwOnError: true,\n });\n const vault: Vault = response.data;\n console.warn(`[Vault] ${vault.vault_id} created since no vault id was provided. Please store this to retrieve it later.`);\n this._vaultId = vault.vault_id;\n return this._vaultId;\n }\n\n private async verifyVaultExists(vaultId: string): Promise<void> {\n // Verify the vault exists by listing its credentials; a missing vault rejects with a NotteAPIError.\n await vaultCredentialsList({\n client: this.client.getClient(),\n path: { vault_id: vaultId },\n throwOnError: true,\n });\n }\n\n private async ensureInitialized(): Promise<string> {\n if (this._vaultId) {\n return this._vaultId;\n }\n if (this.initPromise) {\n return await this.initPromise;\n }\n if (this.createData) {\n const createData = this.createData;\n this.createData = null;\n this.initPromise = this.initNewVault(createData);\n return await this.initPromise;\n }\n throw new InvalidRequestError('Vault not initialized');\n }\n\n /** ID of the remote vault. Throws until the first API operation has created or verified it. */\n get vaultId(): string {\n if (!this._vaultId) {\n throw new InvalidRequestError('Vault not initialized. Await a vault operation first.');\n }\n return this._vaultId;\n }\n\n /**\n * Start the vault. No-op kept for parity with Python's `SyncResource` interface.\n */\n start(): void {\n // No-op - vault is ready to use immediately\n }\n\n /**\n * Stop the vault: deletes it together with every credential it holds.\n *\n * ```ts\n * await vault.stop();\n * ```\n */\n async stop(): Promise<void> {\n const vaultId = await this.ensureInitialized();\n console.info(`[Vault] ${vaultId} deleted. All credentials have been deleted.`);\n await this.delete();\n }\n\n /**\n * Add or update the credentials stored for a website. Values are sent as\n * supplied; the API validates credentials and reduces the URL to its root\n * domain (`https://github.com/login` → `github.com`).\n *\n * ```ts\n * await vault.addCredentials('https://github.com/', {\n * email: 'me@example.org',\n * password: 'secret', // pragma: allowlist secret\n * mfa_secret: 'JBSWY3DPEHPK3PXP', // pragma: allowlist secret\n * });\n * ```\n */\n async addCredentials(url: string, credentials: CredentialsDictInput): Promise<void> {\n const vaultId = await this.ensureInitialized();\n await vaultCredentialsAdd({\n client: this.client.getClient(),\n path: { vault_id: vaultId },\n body: { url, credentials },\n throwOnError: true,\n });\n }\n\n /**\n * Get the credentials stored for a website. Rejects with a `NotteAPIError`\n * when the vault holds no credentials for that domain, like Python's\n * `get_credentials`.\n *\n * ```ts\n * const { email, password } = await vault.getCredentials('https://github.com/login');\n * ```\n */\n async getCredentials(url: string): Promise<CredentialsDictOutput> {\n const vaultId = await this.ensureInitialized();\n const response = await vaultCredentialsGet({\n client: this.client.getClient(),\n path: { vault_id: vaultId },\n query: { url },\n throwOnError: true,\n });\n return response.data.credentials;\n }\n\n /**\n * Check whether the vault holds credentials for a website, the counterpart\n * of `BaseVault.has_credential`. Never rejects for a missing credential.\n *\n * ```ts\n * if (!(await vault.hasCredential('https://github.com/'))) {\n * await vault.addCredentialsFromEnv('https://github.com/');\n * }\n * ```\n */\n async hasCredential(url: string): Promise<boolean> {\n const domain = getRootDomain(url);\n const credentials = await this.listCredentials();\n return credentials.some(credential => credential.url === url || credential.url === domain);\n }\n\n /**\n * Delete the credentials stored for a website.\n *\n * ```ts\n * await vault.deleteCredentials('https://github.com/');\n * ```\n */\n async deleteCredentials(url: string): Promise<void> {\n const vaultId = await this.ensureInitialized();\n await vaultCredentialsDelete({\n client: this.client.getClient(),\n path: { vault_id: vaultId },\n query: { url },\n throwOnError: true,\n });\n }\n\n /**\n * List the websites the vault holds credentials for. Passwords are never returned.\n *\n * ```ts\n * const credentials = await vault.listCredentials();\n * console.log(credentials.map(c => c.url));\n * ```\n */\n async listCredentials(): Promise<Credential[]> {\n const vaultId = await this.ensureInitialized();\n const response = await vaultCredentialsList({\n client: this.client.getClient(),\n path: { vault_id: vaultId },\n throwOnError: true,\n });\n return response.data.credentials;\n }\n\n /**\n * Delete the vault and every credential it holds.\n */\n async delete(): Promise<void> {\n const vaultId = await this.ensureInitialized();\n await vaultDelete({\n client: this.client.getClient(),\n path: { vault_id: vaultId },\n throwOnError: true,\n });\n }\n\n /**\n * Add credentials read from environment variables, the counterpart of\n * `BaseVault.add_credentials_from_env`. For `https://github.com/` the\n * variables are `GITHUB_COM_EMAIL`, `GITHUB_COM_USERNAME`,\n * `GITHUB_COM_MFA_SECRET` and `GITHUB_COM_PASSWORD`.\n *\n * ```ts\n * process.env.GITHUB_COM_EMAIL = 'me@example.org';\n * process.env.GITHUB_COM_PASSWORD = 'secret'; // pragma: allowlist secret\n * await vault.addCredentialsFromEnv('https://github.com/');\n * ```\n */\n async addCredentialsFromEnv(url: string): Promise<void> {\n const rootDomain = getRootDomain(url);\n const prefix = rootDomain.replace(/\\./g, '_').toUpperCase();\n const credentials: Partial<CredentialsDictInput> = {};\n const variableNames: string[] = [];\n for (const field of CREDENTIAL_FIELDS) {\n const variable = `${prefix}_${field.toUpperCase()}`;\n variableNames.push(variable);\n const value = process.env[variable];\n if (value !== undefined) {\n credentials[field] = value;\n }\n }\n if (Object.keys(credentials).length === 0) {\n throw new InvalidRequestError(\n `No credentials found in the environment for ${url}. Please set the following variables: ${variableNames.join(', ')}`,\n );\n }\n await this.addCredentials(url, credentials as CredentialsDictInput);\n }\n\n /**\n * Generate a secure random password, the counterpart of Python's\n * `generate_password`. The result always contains a lowercase letter, an\n * uppercase letter and a digit, plus a special character unless\n * `includeSpecialChars` is false.\n *\n * ```ts\n * const password = vault.generatePassword(24);\n * ```\n */\n generatePassword(length: number = 20, includeSpecialChars: boolean = true): string {\n // Validate minimum length\n const minRequiredLength = includeSpecialChars ? 4 : 3;\n if (length < minRequiredLength) {\n throw new InvalidRequestError(`Password length must be at least ${minRequiredLength} characters`);\n }\n\n // Character sets\n const lowercase = 'abcdefghijklmnopqrstuvwxyz';\n const uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n const digits = '0123456789';\n const specialChars = '!@#$%^&*()_+-=[]|;:,.<>?';\n const alphanumeric = uppercase + lowercase + digits;\n\n // Generate the initial random password from the platform CSPRNG.\n const allowedChars = includeSpecialChars ? `${alphanumeric}-_` : alphanumeric;\n // Rejection sampling keeps the CSPRNG output uniform: a plain modulo would\n // favour the first `2^32 mod size` characters.\n const randomIndex = (size: number): number => {\n const limit = Math.floor(0x1_0000_0000 / size) * size;\n const buffer = new Uint32Array(1);\n for (;;) {\n const [value] = globalThis.crypto.getRandomValues(buffer);\n if (value! < limit) {\n return value! % size;\n }\n }\n };\n const passwordArray = Array.from({ length }, () => allowedChars[randomIndex(allowedChars.length)]!);\n const pick = (chars: string): string => chars[randomIndex(chars.length)]!;\n\n // Guarantee every required character class is present. Fixing one class\n // may overwrite another, so loop until all requirements hold.\n let maxIterations = 10;\n while (maxIterations-- > 0) {\n let allRequirementsMet = true;\n const requirements: Array<[boolean, string]> = [\n [true, lowercase],\n [true, uppercase],\n [true, digits],\n [includeSpecialChars, specialChars],\n ];\n for (const [required, chars] of requirements) {\n if (required && !passwordArray.some(c => chars.includes(c))) {\n passwordArray[randomIndex(passwordArray.length)] = pick(chars);\n allRequirementsMet = false;\n }\n }\n if (allRequirementsMet) {\n break;\n }\n }\n\n return passwordArray.join('');\n }\n}\n","import { NotteClient } from '@/client';\nimport { NotteVault } from '@/vaults';\nimport type {\n PersonaCreateRequest,\n PersonaResponse,\n EmailResponse,\n SmsResponse,\n PaginatedResponsePersonaResponse,\n PersonaEmailsListData,\n ListPersonasData,\n DeletePersonaResponse\n} from '@/lib/client/types.gen';\nimport {\n personaCreate,\n personaGet,\n personaDelete,\n personaEmailsList,\n personaSmsList,\n listPersonas\n} from '@/lib/client/sdk.gen';\nimport { formatError } from '@/utils';\n\n// Type aliases from generated types for convenience\nexport type MessageReadOptions = NonNullable<PersonaEmailsListData['query']>;\nexport type PersonaListOptions = NonNullable<ListPersonasData['query']>;\n// Backwards-compatible convenience alias; the generated response now includes\n// the internal address directly.\nexport type PersonaResponseWithInternalEmail = PersonaResponse;\n\n/** Fill in `email_provider` for API responses that predate the field. */\nexport function withPersonaDefaults<T extends PersonaResponse | null | undefined>(persona: T): T {\n if (!persona || persona.email_provider) return persona;\n return { ...persona, email_provider: 'notte' };\n}\n\n// Constructor overloads for NottePersona - mirrors Python overloads\nexport interface PersonaConstructorWithId {\n persona_id: string;\n}\n\nexport interface PersonaConstructorCreate extends PersonaCreateRequest {\n persona_id?: never;\n}\n\nexport type PersonaConstructor = PersonaConstructorWithId | PersonaConstructorCreate;\n\n/**\n * Self-service identities for web automation (account creation, 2FA, etc.)\n *\n * Notte Personas provide automated identity management for browser workflows, enabling account creation,\n * handle two-factor authentication, and interact with web platforms without manual intervention.\n *\n * Notte Personas come with complete digital identities:\n * - Unique Email Address: Dedicated mailbox for each persona with full email management\n * - Phone Number: SMS-capable phone number for verification and 2FA\n * - Credential Vault: Optional secure storage for passwords and authentication tokens\n * - Automated Communication: Built-in email and SMS reading capabilities\n * - 2FA Support: Seamless handling of two-factor authentication flows\n */\nexport class NottePersona {\n private client: NotteClient;\n private _initRequest: PersonaCreateRequest;\n private response: PersonaResponseWithInternalEmail | null = null;\n private initPromise: Promise<PersonaResponseWithInternalEmail> | null = null;\n private _vault: NotteVault | undefined;\n private readonly ownsPersona: boolean;\n\n constructor(client: NotteClient, options: PersonaConstructor = {}) {\n this.client = client;\n this.ownsPersona = !('persona_id' in options && options.persona_id);\n\n if (options && 'persona_id' in options && options.persona_id) {\n // Constructor for existing persona\n this.initPromise = this.initExistingPersona(options.persona_id);\n this._initRequest = {};\n } else {\n // Constructor for new persona - create it\n const createData = (options || {}) as PersonaConstructorCreate;\n this._initRequest = createData;\n this.initPromise = this.initNewPersona(createData);\n }\n }\n\n /**\n * Get persona info\n */\n get info(): PersonaResponseWithInternalEmail {\n if (this.response === null) {\n throw new Error('Persona not initialized');\n }\n return this.response;\n }\n\n /**\n * Get vault (cached property equivalent)\n */\n get vault(): NotteVault {\n if (this._vault === undefined) {\n const vault = this._getVault();\n if (vault === null) {\n throw new Error(\n 'Persona has no vault. Please create a new persona using `create_vault=true` to use this feature.'\n );\n }\n this._vault = vault;\n }\n return this._vault;\n }\n\n /**\n * Check if persona has a vault\n */\n get hasVault(): boolean {\n return this.info.vault_id !== null;\n }\n\n private async initExistingPersona(personaId: string): Promise<PersonaResponseWithInternalEmail> {\n const response = await personaGet({\n client: this.client.getClient(),\n path: {\n persona_id: personaId\n }\n });\n\n if (response?.error) {\n throw new Error(`Failed to get persona: ${formatError(response.error)}`);\n }\n\n this.response = withPersonaDefaults(response.data as PersonaResponseWithInternalEmail);\n return this.response;\n }\n\n private async initNewPersona(createData: PersonaCreateRequest): Promise<PersonaResponseWithInternalEmail> {\n const response = await personaCreate({\n client: this.client.getClient(),\n body: createData\n });\n\n if (response?.error) {\n throw new Error(`Failed to create persona: ${formatError(response.error)}`);\n }\n\n this.response = withPersonaDefaults(response.data as PersonaResponseWithInternalEmail);\n console.warn(\n `[Persona] ${this.response.persona_id} created since no persona id was provided. Please store this to retrieve it later.`\n );\n return this.response;\n }\n\n private async ensureInitialized(): Promise<PersonaResponseWithInternalEmail> {\n if (this.response) {\n return this.response;\n }\n if (this.initPromise) {\n return await this.initPromise;\n }\n throw new Error('Persona not initialized');\n }\n\n /**\n * Get persona ID\n */\n get personaId(): string {\n if (!this.response) {\n throw new Error('Persona not initialized. Use await on persona operations first.');\n }\n return this.response.persona_id;\n }\n\n /**\n * Public, human-readable email address of the persona\n */\n get email(): string {\n return this.info.email;\n }\n\n /**\n * Internal UUID-backed mailbox address of the persona\n */\n get internalEmail(): string {\n return this.info.internal_email;\n }\n\n /**\n * Start the persona - ensures initialization\n */\n async start(): Promise<void> {\n await this.ensureInitialized();\n }\n\n /**\n * Stop the persona - deletes it\n */\n async stop(): Promise<void> {\n await this.ensureInitialized();\n console.log(`[Persona] ${this.personaId} deleted.`);\n await this.delete();\n }\n\n /**\n * Get vault - private helper method\n */\n private _getVault(): NotteVault | null {\n if (this.info.vault_id === null) {\n return null;\n }\n return new NotteVault(this.client, { vault_id: this.info.vault_id });\n }\n\n /**\n * Create the persona\n */\n async create(): Promise<void> {\n if (this.response !== null) {\n throw new Error(`Persona ${this.personaId} already initialized`);\n }\n await this.ensureInitialized();\n }\n\n /**\n * Delete the persona from the notte console\n */\n async delete(): Promise<DeletePersonaResponse> {\n await this.ensureInitialized();\n const response = await personaDelete({\n client: this.client.getClient(),\n path: {\n persona_id: this.personaId\n }\n });\n\n if (response?.error) {\n throw new Error(`Failed to delete persona: ${formatError(response.error)}`);\n }\n return response.data as DeletePersonaResponse;\n }\n\n /**\n * Add credentials to the persona (generates a password and stores it in the vault)\n */\n async addCredentials(url: string): Promise<void> {\n const vault = this._getVault();\n if (vault === null) {\n throw new Error(\n 'Cannot add credentials to a persona without a vault. Please create a new persona using `create_vault=true` to use this feature.'\n );\n }\n const password = vault.generatePassword();\n await vault.addCredentials(url, {\n email: this.info.email,\n password: password\n });\n }\n\n /**\n * Read recent emails sent to the persona\n */\n async emails(options?: MessageReadOptions): Promise<EmailResponse[]> {\n await this.ensureInitialized();\n const response = await personaEmailsList({\n client: this.client.getClient(),\n path: {\n persona_id: this.personaId\n },\n query: options || {}\n });\n\n if (response?.error) {\n throw new Error(`Failed to list emails: ${formatError(response.error)}`);\n }\n\n return response.data as EmailResponse[];\n }\n\n /**\n * Read recent SMS messages sent to the persona\n */\n async sms(options?: MessageReadOptions): Promise<SmsResponse[]> {\n await this.ensureInitialized();\n const response = await personaSmsList({\n client: this.client.getClient(),\n path: {\n persona_id: this.personaId\n },\n query: options || {}\n });\n\n if (response?.error) {\n throw new Error(`Failed to list SMS messages: ${formatError(response.error)}`);\n }\n\n return response.data as SmsResponse[];\n }\n\n /**\n * Get persona information (alias for ensureInitialized)\n */\n async get(): Promise<PersonaResponseWithInternalEmail> {\n await this.ensureInitialized();\n return this.response!;\n }\n\n /**\n * Run a callback and automatically delete a persona created by this instance.\n * Personas loaded by an existing ID are retained after the callback finishes.\n */\n async use<T>(callback: (persona: NottePersona) => Promise<T>): Promise<T> {\n await this.ensureInitialized();\n try {\n return await callback(this);\n } finally {\n // Only delete if this persona was created (not loaded from existing ID)\n if (this.ownsPersona) {\n try {\n await this.delete();\n } catch (error) {\n console.warn(`Failed to delete persona during cleanup: ${error}`);\n }\n }\n }\n }\n}\n","import { readFile, writeFile } from 'node:fs/promises';\nimport { basename } from 'node:path';\nimport { NotteClient, TIMEOUT_HEADER } from '@/client';\nimport { Encryption } from '@/encryption';\nimport { offloadRunPayloads, resolveRunPayloads } from '@/run-payloads';\nimport { FailedToRunCloudFunctionError, InvalidRequestError, NotteAPIError, NotteError, NotteTimeoutError } from '@/errors';\nimport type {\n\tDeleteFunctionResponse,\n\tFunctionMetadataUpdateRequest,\n\tFunctionResponse,\n\tFunctionRunUpdateRequest as ApiFunctionRunUpdateRequest,\n\tFunctionRollbackRequest,\n\tFunctionScheduleCreateRequest,\n\tFunctionWithLinkResponse,\n\tGetFunctionRunResponse as ApiGetFunctionRunResponse,\n\tGetFunctionRunResponseWritable as ApiGetFunctionRunResponseWritable,\n\tListFunctionRunsByFunctionIdData,\n\tPaginatedResponseFunctionRunListItemResponse,\n\tRunFunctionRequest,\n\tScheduleDeleteResponse,\n\tScheduleResponse,\n\tUpdateFunctionRunResponse,\n} from '@/lib/client/types.gen';\nimport {\n\tfunctionCreate,\n\tfunctionDelete,\n\tfunctionDownloadUrl,\n\tfunctionMetadataUpdate,\n\tfunctionRollback,\n\tfunctionScheduleDelete,\n\tfunctionScheduleSet,\n\tfunctionUpdate,\n\tlistFunctionRunsByFunctionId,\n} from '@/lib/client/sdk.gen';\n\nconst DOWNLOAD_TIMEOUT_MS = 30_000;\n/** Default deadline of `run()`, the counterpart of `WorkflowsClient.WORKFLOW_RUN_TIMEOUT` (5 minutes). */\nexport const FUNCTION_RUN_TIMEOUT_MS = 5 * 60 * 1000;\n\n/**\n * Run endpoints that the OpenAPI spec does not describe. They are the Python\n * SDK's `WorkflowsClient.CREATE_WORKFLOW_RUN` and `START_WORKFLOW_RUN` paths\n * and are only ever called through `NotteFunction.postRunEndpoint()`.\n */\nexport const FUNCTION_RUN_ENDPOINTS = {\n\t/** `POST` creates a run record without executing it (`CreateFunctionRunRequest`). */\n\tcreate: '/functions/{function_id}/runs/create',\n\t/** `POST` executes a previously created run (`StartFunctionRunRequest`). */\n\tstart: '/functions/{function_id}/runs/{run_id}',\n} as const;\n\n/**\n * The run endpoints hand the caller's key to the execution runtime through\n * this header (the `Authorization` header is not forwarded), so `run()` sends\n * it whenever the client holds a key, like `WorkflowsClient.run` in Python.\n * Proxy-mode clients have no key; their proxy must add the header itself.\n */\nexport const RUN_API_KEY_HEADER = 'x-notte-api-key'; // pragma: allowlist secret\n\nexport type FunctionRuntime = NonNullable<RunFunctionRequest['runtime']>;\n/** Function run values after the SDK downloads stored payloads. */\nexport type GetFunctionRunResponse = Omit<ApiGetFunctionRunResponse, 'payloads' | 'payload_urls'>;\n/** Writable run fields retained for compatibility with existing SDK consumers. */\nexport type GetFunctionRunResponseWritable = Omit<ApiGetFunctionRunResponseWritable, 'payloads' | 'payload_urls'>;\n/** Inline fields accepted by updateRun; the SDK manages storage references. */\nexport type FunctionRunUpdateRequest = Omit<ApiFunctionRunUpdateRequest, 'payloads' | 'result_preview'>;\n\nexport type FunctionRunStatus = GetFunctionRunResponse['status'];\nconst FUNCTION_RUN_STATUSES: readonly FunctionRunStatus[] = ['closed', 'active', 'failed'];\n\n/** Reference an existing function by ID. */\nexport interface FunctionConstructorWithId {\n\tfunction_id: string;\n\t/** Key used to decrypt the download URL of Notte managed functions. */\n\tdecryption_key?: string;\n\tpath?: never;\n}\n\n/**\n * Create a function from a local `.py` file, like `client.Function(path=...)`\n * in Python. The upload happens on the first operation that needs the ID.\n */\nexport interface FunctionConstructorCreate {\n\t/** Path to the python file containing the `run` function. Must end with `.py`. */\n\tpath: string;\n\tname?: string | null;\n\tdescription?: string | null;\n\t/** Whether the function is public and shared with other users. Defaults to false. */\n\tshared?: boolean;\n\tdecryption_key?: string;\n\tfunction_id?: never;\n}\n\nexport type FunctionConstructor = FunctionConstructorWithId | FunctionConstructorCreate;\n\n/** Result of executing a run, the counterpart of `FunctionRunResponse` in Python. */\nexport interface FunctionRunResult {\n\tfunction_id: string;\n\tfunction_run_id: string;\n\tsession_id: string | null;\n\t/** The value returned by the script's `run` function, decoded from JSON. */\n\tresult: unknown;\n\tstatus: FunctionRunStatus;\n}\n/** Alias of `FunctionRunResult` using the Python model name. */\nexport type FunctionRunResponse = FunctionRunResult;\n/** @deprecated `run()` now returns `FunctionRunResult` whether or not it streams. */\nexport type FunctionRunStartResult = FunctionRunResult;\n\n/** Run record returned by `createRun()`, the counterpart of `CreateFunctionRunResponse` in Python. */\nexport interface FunctionRunCreateResult {\n\tfunction_id: string;\n\tfunction_run_id: string;\n\tcreated_at: string;\n\tstatus: 'created';\n}\n\nexport interface FunctionRunCreateOptions {\n\t/** Mark the record as a local run. Defaults to false; the Node SDK only executes on the cloud. */\n\tlocal?: boolean;\n}\n\nexport interface FunctionRunOptions {\n\t/** Stream logs and wait for completion. Defaults to true. */\n\tstream?: boolean;\n\t/** Receive streamed logs instead of printing them to console.log. */\n\tonLog?: (message: string) => void;\n\t/** Throw `FailedToRunCloudFunctionError` when execution fails. Defaults to true, matching Python. */\n\traiseOnFailure?: boolean;\n\t/** Execute a record returned by createRun(). Omit to create a new run. */\n\tfunctionRunId?: string;\n\t/** Override the saved function runtime; omit to inherit its default. */\n\truntime?: FunctionRuntime;\n\t/**\n\t * Deadline of the whole execution in milliseconds. The wait is aborted with\n\t * `NotteTimeoutError` once it elapses. Defaults to `FUNCTION_RUN_TIMEOUT_MS` (5 minutes).\n\t */\n\ttimeoutMs?: number;\n}\n\nexport interface FunctionGetOptions {\n\t/** Version to fetch. Defaults to the latest version. */\n\tversion?: string;\n}\n\nexport interface FunctionUrlOptions extends FunctionGetOptions {\n\t/** Overrides the decryption key passed to the constructor. */\n\tdecryption_key?: string;\n}\n\nexport interface FunctionDownloadOptions extends FunctionUrlOptions {\n\t/** Optional local destination ending in `.py`. Source text is returned whether or not a path is supplied. */\n\tpath?: string;\n}\n\nexport interface FunctionUpdateOptions {\n\t/** Path to the new python code. Must end with `.py`. */\n\tpath?: string;\n\t/** Only update this version. Defaults to creating a new version. */\n\tversion?: string;\n\t/** Whether to restrict the function code. Defaults to true, like Python. */\n\trestricted?: boolean;\n}\n\n/** Metadata fields accepted by `PATCH /functions/{function_id}`. */\nexport type FunctionMetadataUpdateOptions = FunctionMetadataUpdateRequest;\n\nexport interface FunctionScheduleOptions {\n\t/** Cron expression of the schedule. */\n\tcron: FunctionScheduleCreateRequest['cron'];\n\t/** Variables passed to every scheduled run. */\n\tvariables?: FunctionScheduleCreateRequest['variables'];\n}\n\nexport interface FunctionRollbackOptions extends FunctionRollbackRequest {\n\t/** Whether to restrict the function code. Defaults to true, like `update()`. */\n\trestricted?: boolean;\n}\n\n/**\n * Query options for listing a function's runs: `page`, `page_size`,\n * `only_active`, `only_current_token`, `include_system`, `source`.\n */\nexport type FunctionRunListOptions = NonNullable<ListFunctionRunsByFunctionIdData['query']>;\n\ntype FunctionRunEndpointRequest = {\n\turl: (typeof FUNCTION_RUN_ENDPOINTS)[keyof typeof FUNCTION_RUN_ENDPOINTS];\n\tpath: { function_id: string; run_id?: string };\n\tbody: Record<string, unknown>;\n\tparseAs?: 'json' | 'stream';\n\theaders?: Record<string, string>;\n\tsignal?: AbortSignal;\n};\n\n/**\n * Cloud function saved in the Notte console, the counterpart of\n * `notte.Function` in Python.\n *\n * ```ts\n * const fn = client.NotteFunction({ function_id: '<your-function-id>' });\n * const result = await fn.run({ url: 'https://example.com' });\n *\n * const created = client.NotteFunction({ path: './scraper.py', name: 'Scraper' });\n * await created.run(); // uploads scraper.py first\n * ```\n */\nexport class NotteFunction {\n\tprivate readonly client: NotteClient;\n\tprivate _functionId: string | null = null;\n\tprivate initPromise: Promise<string> | null = null;\n\tprivate createData: FunctionConstructorCreate | null = null;\n\tpublic readonly decryptionKey?: string;\n\n\tconstructor(client: NotteClient, options: FunctionConstructor) {\n\t\tthis.client = client;\n\t\tthis.decryptionKey = options.decryption_key;\n\t\tif (options.function_id !== undefined) {\n\t\t\tif (options.function_id.length === 0) {\n\t\t\t\tthrow new InvalidRequestError('function_id cannot be empty');\n\t\t\t}\n\t\t\tthis._functionId = options.function_id;\n\t\t} else if (options.path !== undefined) {\n\t\t\tassertPythonPath(options.path);\n\t\t\t// Defer the upload until an operation needs the ID, like NotteVault.\n\t\t\tthis.createData = options;\n\t\t} else {\n\t\t\tthrow new InvalidRequestError(\"Either 'function_id' or 'path' must be provided\");\n\t\t}\n\t}\n\n\t/** The function ID. Throws before a `path`-constructed function has been uploaded. */\n\tget functionId(): string {\n\t\tif (this._functionId === null) {\n\t\t\tthrow new InvalidRequestError(\n\t\t\t\t'Function not initialized. Await a function operation (for example `await fn.get()`) before reading its ID.',\n\t\t\t);\n\t\t}\n\t\treturn this._functionId;\n\t}\n\n\t/** Alias of the `functionId` accessor. */\n\tgetFunctionId(): string {\n\t\treturn this.functionId;\n\t}\n\n\tprivate async ensureInitialized(): Promise<string> {\n\t\tif (this._functionId !== null) {\n\t\t\treturn this._functionId;\n\t\t}\n\t\tif (this.initPromise === null) {\n\t\t\tconst createData = this.createData;\n\t\t\tthis.createData = null;\n\t\t\tif (createData === null) {\n\t\t\t\tthrow new InvalidRequestError('Function not initialized');\n\t\t\t}\n\t\t\tthis.initPromise = this.createFunction(createData);\n\t\t}\n\t\treturn this.initPromise;\n\t}\n\n\tprivate async createFunction(data: FunctionConstructorCreate): Promise<string> {\n\t\tconst file = await readPythonFile(data.path);\n\t\tconst response = await functionCreate({\n\t\t\tclient: this.client.getClient(),\n\t\t\tthrowOnError: true,\n\t\t\tbody: { file, name: data.name, description: data.description, shared: data.shared },\n\t\t});\n\t\tthis._functionId = response.data.function_id;\n\t\tconsole.info(`[Function] ${this._functionId} created successfully.`);\n\t\treturn this._functionId;\n\t}\n\n\t/**\n\t * Get the function metadata together with its download URL, the\n\t * counterpart of `client.functions.get()` in Python.\n\t *\n\t * @param options - Optional version selector; omitted means the latest version.\n\t * @returns Function metadata, version history, and the download link returned by the API.\n\t * @throws NotteAPIError if the function cannot be retrieved.\n\t * @example\n\t * const { latest_version, versions } = await fn.get();\n\t */\n\tasync get(options: FunctionGetOptions = {}): Promise<FunctionWithLinkResponse> {\n\t\tconst functionId = await this.ensureInitialized();\n\t\tconst response = await functionDownloadUrl({\n\t\t\tclient: this.client.getClient(),\n\t\t\tthrowOnError: true,\n\t\t\tpath: { function_id: functionId },\n\t\t\tquery: options.version !== undefined ? { version: options.version } : {},\n\t\t});\n\t\treturn response.data;\n\t}\n\n\t/**\n\t * Upload a new version of the code, mirroring `function.update(path=...)`.\n\t *\n\t * @param options - Local Python file path, optional version, and code-access settings.\n\t * @returns Updated function metadata, including its latest version.\n\t * @throws InvalidRequestError if the path is missing or does not end in `.py`.\n\t * @throws NotteAPIError if the upload is rejected.\n\t * @example\n\t * const updated = await fn.update({ path: './scraper.py' });\n\t * console.log(updated.latest_version);\n\t */\n\tasync update(options: FunctionUpdateOptions): Promise<FunctionResponse> {\n\t\tif (options.path === undefined) {\n\t\t\tthrow new InvalidRequestError(\"'path' must be provided\");\n\t\t}\n\t\tconst functionId = await this.ensureInitialized();\n\t\tconst file = await readPythonFile(options.path);\n\t\tconst response = await functionUpdate({\n\t\t\tclient: this.client.getClient(),\n\t\t\tthrowOnError: true,\n\t\t\tpath: { function_id: functionId },\n\t\t\tquery: {\n\t\t\t\trestricted: options.restricted,\n\t\t\t\t...(options.version !== undefined ? { version: options.version } : {}),\n\t\t\t},\n\t\t\tbody: { file },\n\t\t});\n\t\tconsole.info(`[Function] ${functionId} updated successfully to version ${response.data.latest_version}.`);\n\t\treturn response.data;\n\t}\n\n\t/**\n\t * Update the function metadata (name, description, default runtime, ...).\n\t *\n\t * @param options - Metadata fields to update, such as name, description, or default runtime.\n\t * @returns Updated function metadata.\n\t * @throws NotteAPIError if the metadata update is rejected.\n\t * @example\n\t * await fn.updateMetadata({ name: 'Price monitor', default_runtime: 'extended' });\n\t */\n\tasync updateMetadata(options: FunctionMetadataUpdateOptions): Promise<FunctionResponse> {\n\t\tconst functionId = await this.ensureInitialized();\n\t\tconst response = await functionMetadataUpdate({\n\t\t\tclient: this.client.getClient(),\n\t\t\tthrowOnError: true,\n\t\t\tpath: { function_id: functionId },\n\t\t\tbody: options,\n\t\t});\n\t\treturn response.data;\n\t}\n\n\t/**\n\t * Delete the function from the Notte console.\n\t *\n\t * @returns The API's function-deletion confirmation.\n\t * @throws NotteAPIError if the function cannot be deleted.\n\t * @example\n\t * await fn.delete();\n\t */\n\tasync delete(): Promise<DeleteFunctionResponse> {\n\t\tconst functionId = await this.ensureInitialized();\n\t\tconst response = await functionDelete({\n\t\t\tclient: this.client.getClient(),\n\t\t\tthrowOnError: true,\n\t\t\tpath: { function_id: functionId },\n\t\t});\n\t\tconsole.info(`[Function] ${functionId} deleted successfully.`);\n\t\treturn response.data;\n\t}\n\n\t/**\n\t * Schedule the function to run on a cron expression.\n\t *\n\t * @param options - Cron expression and optional variables passed to each scheduled execution.\n\t * @returns The saved schedule configuration.\n\t * @throws NotteAPIError if the schedule cannot be saved.\n\t * @example\n\t * await fn.setSchedule({ cron: '0 9 * * *', variables: { url: 'https://example.com' } });\n\t */\n\tasync setSchedule(options: FunctionScheduleOptions): Promise<ScheduleResponse> {\n\t\tconst functionId = await this.ensureInitialized();\n\t\tconst response = await functionScheduleSet({\n\t\t\tclient: this.client.getClient(),\n\t\t\tthrowOnError: true,\n\t\t\tpath: { function_id: functionId },\n\t\t\tbody: { cron: options.cron, variables: options.variables ?? null },\n\t\t});\n\t\treturn response.data;\n\t}\n\n\t/**\n\t * Remove the function schedule.\n\t *\n\t * @returns The API's schedule-deletion confirmation.\n\t * @throws NotteAPIError if schedule deletion fails.\n\t * @example\n\t * await fn.deleteSchedule();\n\t */\n\tasync deleteSchedule(): Promise<ScheduleDeleteResponse> {\n\t\tconst functionId = await this.ensureInitialized();\n\t\tconst response = await functionScheduleDelete({\n\t\t\tclient: this.client.getClient(),\n\t\t\tthrowOnError: true,\n\t\t\tpath: { function_id: functionId },\n\t\t});\n\t\treturn response.data;\n\t}\n\n\t/**\n\t * Roll the function back to a previous version.\n\t *\n\t * @param options - Target version and optional code-access restriction, which defaults to true.\n\t * @returns Updated function metadata after rollback.\n\t * @throws NotteAPIError if the requested version cannot be restored.\n\t * @example\n\t * const { versions } = await fn.get();\n\t * await fn.rollback({ version: versions[0] });\n\t */\n\tasync rollback(options: FunctionRollbackOptions): Promise<FunctionResponse> {\n\t\tconst functionId = await this.ensureInitialized();\n\t\tconst response = await functionRollback({\n\t\t\tclient: this.client.getClient(),\n\t\t\tthrowOnError: true,\n\t\t\tpath: { function_id: functionId },\n\t\t\tquery: { restricted: options.restricted },\n\t\t\tbody: { version: options.version },\n\t\t});\n\t\treturn response.data;\n\t}\n\n\t/**\n\t * Get metadata for a specific function run.\n\t *\n\t * @param functionRunId - ID of a run belonging to this function.\n\t * @returns The run's current status, logs, and result metadata. This does not wait for completion.\n\t * @throws NotteAPIError if the run cannot be retrieved.\n\t * @example\n\t * const run = await fn.getRun(result.function_run_id);\n\t * console.log(run.status, run.logs);\n\t */\n\tasync getRun(functionRunId: string): Promise<GetFunctionRunResponse> {\n\t\tconst functionId = await this.ensureInitialized();\n\t\tconst response = await this.client.getClient().get<{ 200: GetFunctionRunResponse }, unknown, true>({\n\t\t\turl: '/functions/{function_id}/runs/{run_id}',\n\t\t\tpath: { function_id: functionId, run_id: functionRunId },\n\t\t\tquery: { payload_mode: 'references' },\n\t\t\tthrowOnError: true,\n\t\t});\n\t\treturn resolveRunPayloads(response.data);\n\t}\n\n\t/**\n\t * Update a run, uploading fields above 1 MiB directly to private storage.\n\t *\n\t * @param functionRunId - ID of a run belonging to this function.\n\t * @param fields - Status and fields to update. Omitted fields remain unchanged.\n\t * @returns Confirmation of the persisted update.\n\t * @throws Error if a field exceeds 256 MiB or an upload fails; the update is not finalized.\n\t * @example\n\t * await fn.updateRun(runId, { status: 'closed', result: { records } });\n\t */\n\tasync updateRun(functionRunId: string, fields: FunctionRunUpdateRequest): Promise<UpdateFunctionRunResponse> {\n\t\tconst functionId = await this.ensureInitialized();\n\t\tconst client = this.client.getClient();\n\t\tconst path = { function_id: functionId, run_id: functionRunId };\n\t\tconst body = await offloadRunPayloads(client, path, fields);\n\t\tconst response = await client.patch<{ 200: UpdateFunctionRunResponse }, unknown, true>({\n\t\t\turl: '/functions/{function_id}/runs/{run_id}', path, body,\n\t\t\theaders: { 'Content-Type': 'application/json' }, throwOnError: true,\n\t\t});\n\t\treturn response.data;\n\t}\n\n\t/**\n\t * Compatibility alias for getRun().\n\t * @deprecated Use getRun() instead. Retained for backwards compatibility.\n\t */\n\tasync retrieve(functionRunId: string): Promise<GetFunctionRunResponse> {\n\t\treturn this.getRun(functionRunId);\n\t}\n\n\t/**\n\t * Create a cloud run record without starting execution, like\n\t * `function.create_run()` in Python. Use this only when you need the ID\n\t * before execution, then pass it to `run(variables, { functionRunId })`.\n\t * `run()` otherwise creates a new run on its own.\n\t *\n\t * @param options - Run-record settings; `local` defaults to false. Node execution remains cloud-only.\n\t * @returns A created run record and its ID. No function code has executed yet.\n\t * @throws NotteAPIError if run creation is rejected.\n\t * @example\n\t * const created = await fn.createRun();\n\t * const result = await fn.run({ url: 'https://example.com' }, { functionRunId: created.function_run_id });\n\t */\n\tasync createRun(options: FunctionRunCreateOptions = {}): Promise<FunctionRunCreateResult> {\n\t\tconst functionId = await this.ensureInitialized();\n\t\treturn this.postRunEndpoint<FunctionRunCreateResult>({\n\t\t\turl: FUNCTION_RUN_ENDPOINTS.create,\n\t\t\tpath: { function_id: functionId },\n\t\t\tbody: { local: options.local ?? false },\n\t\t});\n\t}\n\n\t/**\n\t * List the runs of this function.\n\t *\n\t * Includes completed runs by default. Set `only_active: true` to retrieve\n\t * only in-flight runs. Use the response pagination metadata to request\n\t * additional pages.\n\t *\n\t * @param options - Pagination and filtering options. `only_active` defaults to false, including completed runs.\n\t * @returns One page of run records and pagination metadata; additional pages require another call.\n\t * @throws NotteAPIError if the run history cannot be retrieved.\n\t * @example\n\t * const { items } = await fn.runs({ page_size: 20 });\n\t */\n\tasync runs(options: FunctionRunListOptions = {}): Promise<PaginatedResponseFunctionRunListItemResponse> {\n\t\tconst functionId = await this.ensureInitialized();\n\t\tconst response = await listFunctionRunsByFunctionId({\n\t\t\tclient: this.client.getClient(),\n\t\t\tthrowOnError: true,\n\t\t\tpath: { function_id: functionId },\n\t\t\tquery: options,\n\t\t});\n\t\treturn response.data;\n\t}\n\n\t/**\n\t * Run the function on the cloud and wait for its result, streaming logs by\n\t * default like `function.run(**variables)` in Python.\n\t *\n\t * Pass `{ stream: false }` to receive the backend's JSON response without\n\t * live logs; execution still blocks until completion. Pass `functionRunId`\n\t * to execute a record returned by `createRun()`; otherwise a new run record\n\t * is created first, exactly like Python. A failed execution throws\n\t * `FailedToRunCloudFunctionError` unless `raiseOnFailure` is false, and the\n\t * wait is aborted with `NotteTimeoutError` after `timeoutMs`.\n\t *\n\t * @param variables - JSON-serializable keyword arguments passed to the Python function's `run` entry point.\n\t * @param options - Log streaming, failure handling, runtime, run ID, and timeout settings.\n\t * @returns The completed execution response. The function's return value is in `result`. Disabling streaming still waits for completion.\n\t * @throws FailedToRunCloudFunctionError if execution fails and `raiseOnFailure` is true.\n\t * @throws NotteTimeoutError if the execution request exceeds `timeoutMs`.\n\t * @throws InvalidRequestError if the run options are invalid.\n\t * @example\n\t * const result = await fn.run({ url: 'https://example.com' });\n\t * console.log(result.result);\n\t *\n\t * await fn.run({ url: 'https://example.com' }, { runtime: 'extended', onLog: line => logger.info(line) });\n\t */\n\tasync run(variables: Record<string, unknown> = {}, options: FunctionRunOptions = {}): Promise<FunctionRunResult> {\n\t\tconst stream = options.stream ?? true;\n\t\tconst timeoutMs = options.timeoutMs ?? FUNCTION_RUN_TIMEOUT_MS;\n\t\tif (!(timeoutMs > 0)) {\n\t\t\tthrow new InvalidRequestError('timeoutMs must be a positive number');\n\t\t}\n\t\tconst functionId = await this.ensureInitialized();\n\t\t// Create the run record first, like RemoteWorkflow.run in Python.\n\t\tconst functionRunId = options.functionRunId ?? (await this.createRun()).function_run_id;\n\t\tconst body: RunFunctionRequest = {\n\t\t\tworkflow_id: functionId,\n\t\t\tvariables,\n\t\t\tstream,\n\t\t\t...(options.runtime !== undefined ? { runtime: options.runtime } : {}),\n\t\t};\n\t\t// The run deadline replaces the client's per-request timeout, which would\n\t\t// otherwise cut a long execution (or its log stream) short.\n\t\tconst headers: Record<string, string> = { [TIMEOUT_HEADER]: '0' };\n\t\tconst apiKey = this.client.getConfig().apiKey;\n\t\tif (apiKey) {\n\t\t\theaders[RUN_API_KEY_HEADER] = apiKey;\n\t\t}\n\t\tconst endpointPath = FUNCTION_RUN_ENDPOINTS.start\n\t\t\t.replace('{function_id}', functionId)\n\t\t\t.replace('{run_id}', functionRunId);\n\t\tconst parseAs = stream ? 'stream' : 'json';\n\t\tconst controller = new AbortController();\n\t\tlet timedOut = false;\n\t\tconst timer = Number.isFinite(timeoutMs)\n\t\t\t? setTimeout(() => {\n\t\t\t\ttimedOut = true;\n\t\t\t\tcontroller.abort(new DOMException(`Function run timed out after ${timeoutMs}ms`, 'TimeoutError'));\n\t\t\t}, timeoutMs)\n\t\t\t: undefined;\n\t\ttimer?.unref?.();\n\t\ttry {\n\t\t\tconst raw = await this.postRunEndpoint<unknown>({\n\t\t\t\turl: FUNCTION_RUN_ENDPOINTS.start,\n\t\t\t\tpath: { function_id: functionId, run_id: functionRunId },\n\t\t\t\tbody: { ...body, function_run_id: functionRunId },\n\t\t\t\tparseAs,\n\t\t\t\theaders,\n\t\t\t\tsignal: controller.signal,\n\t\t\t});\n\t\t\tconst result = stream\n\t\t\t\t? await readFunctionStream(raw as ReadableStream<Uint8Array>, options.onLog ?? console.log, endpointPath, controller.signal)\n\t\t\t\t: parseFunctionRunResult(raw, endpointPath);\n\t\t\tif (result.status === 'failed' && (options.raiseOnFailure ?? true)) {\n\t\t\t\tthrow new FailedToRunCloudFunctionError(functionId, result.function_run_id, result);\n\t\t\t}\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tif (timedOut) {\n\t\t\t\tthrow new NotteTimeoutError(`Function ${functionId} run timed out after ${timeoutMs}ms`, { cause: error });\n\t\t\t}\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tclearTimeout(timer);\n\t\t}\n\t}\n\n\t/**\n\t * Get the download URL of the function code, decrypting it when the API\n\t * returns an encrypted one (Notte managed functions).\n\t *\n\t * @param options - Optional version and decryption-key override.\n\t * @returns An HTTP(S) URL for downloading the function source.\n\t * @throws InvalidRequestError if an encrypted URL has no usable decryption key.\n\t * @throws NotteError if decryption does not produce an HTTP(S) URL.\n\t * @example\n\t * const url = await fn.getUrl({ version: 'v1' });\n\t */\n\tasync getUrl(options: FunctionUrlOptions = {}): Promise<string> {\n\t\tconst { url } = await this.get(options);\n\t\tif (isHttpUrl(url)) {\n\t\t\treturn url;\n\t\t}\n\n\t\tconst decryptionKey = options.decryption_key ?? this.decryptionKey;\n\t\tif (decryptionKey === undefined) {\n\t\t\tthrow new InvalidRequestError(\n\t\t\t\t\"Decryption key is required to decrypt the function download url. Set it when creating the function, i.e. client.NotteFunction({ function_id: '<your-function-id>', decryption_key: '<your-key>' }).\",\n\t\t\t);\n\t\t}\n\n\t\tlet decrypted: string;\n\t\ttry {\n\t\t\tdecrypted = new Encryption(decryptionKey).decrypt(url);\n\t\t} catch (error) {\n\t\t\tthrow new InvalidRequestError(\n\t\t\t\t`Failed to decrypt the function download url: ${error instanceof Error ? error.message : String(error)}. Contact support@notte.cc if you need help.`,\n\t\t\t);\n\t\t}\n\n\t\tif (!isHttpUrl(decrypted)) {\n\t\t\tthrow new NotteError(\n\t\t\t\t'Failed to decrypt the function download url: the decrypted value is not a URL. Contact support@notte.cc if you need help.',\n\t\t\t);\n\t\t}\n\n\t\treturn decrypted;\n\t}\n\n\t/**\n\t * Download the function code as a python file. Returns the code, and writes\n\t * it to `path` when one is provided.\n\t *\n\t * @param options - Optional version, decryption key, and local `.py` destination path.\n\t * @returns The Python source text, including when a local destination is supplied.\n\t * @throws InvalidRequestError if the destination does not end in `.py` or the decryption key is invalid.\n\t * @throws NotteError if the source download fails. Local filesystem failures also propagate.\n\t * @example\n\t * const code = await fn.download({ path: './scraper.py' });\n\t */\n\tasync download(options: FunctionDownloadOptions = {}): Promise<string> {\n\t\tconst { path } = options;\n\t\tif (path !== undefined) {\n\t\t\tassertPythonPath(path);\n\t\t}\n\n\t\tconst url = await this.getUrl(options);\n\n\t\tlet response: Response;\n\t\ttry {\n\t\t\tresponse = await fetch(url, { signal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS) });\n\t\t} catch (error) {\n\t\t\t// The url is presigned, so it is deliberately kept out of the message.\n\t\t\tthrow new NotteError(\n\t\t\t\t`Failed to download function code in ${DOWNLOAD_TIMEOUT_MS / 1000} seconds: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t\t{ cause: error },\n\t\t\t);\n\t\t}\n\n\t\tif (!response.ok) {\n\t\t\tthrow new NotteError(`Failed to download function code: ${response.status} ${response.statusText}`);\n\t\t}\n\n\t\tconst code = await response.text();\n\t\tif (path !== undefined) {\n\t\t\tawait writeFile(path, code, 'utf8');\n\t\t}\n\n\t\treturn code;\n\t}\n\n\t/**\n\t * Call one of the run endpoints that the OpenAPI spec does not describe\n\t * (`FUNCTION_RUN_ENDPOINTS`). The generated client has no operation for\n\t * them, so this is the single place where they are hand-rolled; the request\n\t * and response shapes are transcribed from `notte_sdk.types`\n\t * (`CreateFunctionRunRequest` / `CreateFunctionRunResponse` and\n\t * `StartFunctionRunRequest` / `FunctionRunResponse`). Replace the callers\n\t * with generated operations once the spec exposes these paths.\n\t */\n\tprivate async postRunEndpoint<TResponse>(request: FunctionRunEndpointRequest): Promise<TResponse> {\n\t\tconst response = await this.client.getClient().post<{ 200: TResponse }, unknown, true>({\n\t\t\turl: request.url,\n\t\t\tpath: request.path,\n\t\t\tbody: request.body,\n\t\t\theaders: { 'Content-Type': 'application/json', ...request.headers },\n\t\t\tparseAs: request.parseAs ?? 'json',\n\t\t\tsignal: request.signal,\n\t\t\tthrowOnError: true,\n\t\t});\n\t\treturn response.data;\n\t}\n}\n\nfunction isHttpUrl(value: string): boolean {\n\treturn value.startsWith('https://') || value.startsWith('http://');\n}\n\nfunction assertPythonPath(path: string): void {\n\tif (!path.endsWith('.py')) {\n\t\tthrow new InvalidRequestError(`Code file path must end with .py, got '${path}'`);\n\t}\n}\n\n/** Read a local `.py` file into the multipart `file` field the API expects. */\nasync function readPythonFile(path: string): Promise<File> {\n\tassertPythonPath(path);\n\tlet bytes: Buffer;\n\ttry {\n\t\tbytes = await readFile(path);\n\t} catch (error) {\n\t\tthrow new InvalidRequestError(\n\t\t\t`The file '${path}' could not be read: ${error instanceof Error ? error.message : String(error)}`,\n\t\t);\n\t}\n\treturn new File([new Uint8Array(bytes)], basename(path), { type: 'text/x-python' });\n}\n\n/**\n * The execution runtime answers authentication failures with its own HTTP\n * envelope (`{ statusCode, headers, body }`) that the API relays with a 200.\n * Surface it as the `NotteAPIError` it really is.\n */\nfunction unwrapRuntimeEnvelope(candidate: Record<string, unknown>, path: string): void {\n\tconst { statusCode, body } = candidate;\n\tif (typeof statusCode !== 'number' || statusCode < 400 || !('body' in candidate)) {\n\t\treturn;\n\t}\n\tlet parsed: unknown = body;\n\tif (typeof body === 'string') {\n\t\ttry {\n\t\t\tparsed = JSON.parse(body);\n\t\t} catch {\n\t\t\tparsed = body;\n\t\t}\n\t}\n\tthrow NotteAPIError.fromBody(path, statusCode, parsed);\n}\n\n/** Validate the shape of a `FunctionRunResponse` returned by the API. */\nfunction parseFunctionRunResult(value: unknown, path: string): FunctionRunResult {\n\tif (typeof value !== 'object' || value === null) {\n\t\tthrow new NotteError('Invalid function result: expected an object');\n\t}\n\tconst candidate = value as Record<string, unknown>;\n\tunwrapRuntimeEnvelope(candidate, path);\n\tconst status = candidate.status;\n\tif (\n\t\ttypeof candidate.function_run_id !== 'string' ||\n\t\ttypeof candidate.function_id !== 'string' ||\n\t\ttypeof status !== 'string' ||\n\t\t!(FUNCTION_RUN_STATUSES as readonly string[]).includes(status) ||\n\t\t!('result' in candidate)\n\t) {\n\t\tthrow new NotteError('Invalid function result: missing function_id, function_run_id, status or result');\n\t}\n\treturn {\n\t\tfunction_id: candidate.function_id,\n\t\tfunction_run_id: candidate.function_run_id,\n\t\tsession_id: typeof candidate.session_id === 'string' ? candidate.session_id : null,\n\t\tresult: candidate.result,\n\t\tstatus: status as FunctionRunStatus,\n\t};\n}\n\n/** Consume SSE frames, including frames split across network/UTF-8 boundaries. */\nasync function readFunctionStream(\n\tbody: ReadableStream<Uint8Array> | null | undefined,\n\tonLog: (message: string) => void,\n\tpath: string,\n\tsignal?: AbortSignal,\n): Promise<FunctionRunResult> {\n\tif (!body?.getReader) {\n\t\tthrow new NotteError('Missing function response stream');\n\t}\n\tconst reader = body.getReader();\n\tconst onAbort = () => {\n\t\treader.cancel(signal?.reason).catch(() => {});\n\t};\n\tsignal?.addEventListener('abort', onAbort, { once: true });\n\tconst decoder = new TextDecoder();\n\tlet buffer = '';\n\tlet data: string[] = [];\n\tlet result: FunctionRunResult | undefined;\n\t// Kept only until the first SSE frame arrives, to decode a plain JSON body\n\t// (for example the runtime's authentication envelope) sent instead of a stream.\n\tlet sawFrame = false;\n\tlet raw = '';\n\tconst dispatch = () => {\n\t\tif (!data.length) return;\n\t\tconst payload = data.join('\\n');\n\t\tdata = [];\n\t\tlet event: { type?: unknown; message?: unknown };\n\t\ttry {\n\t\t\tevent = JSON.parse(payload) as { type?: unknown; message?: unknown };\n\t\t} catch (error) {\n\t\t\tthrow new NotteError(`Malformed function stream event: ${payload}`, { cause: error });\n\t\t}\n\t\tif (event.type === 'log') onLog(String(event.message ?? ''));\n\t\tif (event.type === 'error') throw new NotteError(`Function stream error: ${String(event.message ?? '')}`);\n\t\tif (event.type === 'result') {\n\t\t\tconst value: unknown = typeof event.message === 'string' ? JSON.parse(event.message) : event.message;\n\t\t\tresult = parseFunctionRunResult(value, path);\n\t\t}\n\t};\n\tconst line = (value: string) => {\n\t\tif (value === '') dispatch();\n\t\telse if (value.startsWith('data:')) {\n\t\t\tsawFrame = true;\n\t\t\tdata.push(value.slice(5).replace(/^ /, ''));\n\t\t}\n\t};\n\ttry {\n\t\twhile (true) {\n\t\t\tconst { value, done } = await reader.read();\n\t\t\tconst text = decoder.decode(value, { stream: !done });\n\t\t\tbuffer += text;\n\t\t\tif (!sawFrame) raw += text;\n\t\t\tlet end: number;\n\t\t\twhile ((end = buffer.indexOf('\\n')) !== -1) {\n\t\t\t\tline(buffer.slice(0, end).replace(/\\r$/, ''));\n\t\t\t\tbuffer = buffer.slice(end + 1);\n\t\t\t}\n\t\t\tif (done) break;\n\t\t}\n\t\tif (buffer) line(buffer.replace(/\\r$/, ''));\n\t\tdispatch();\n\t\tif (!result && !sawFrame && raw.trim().length > 0) {\n\t\t\tlet parsed: unknown;\n\t\t\ttry {\n\t\t\t\tparsed = JSON.parse(raw);\n\t\t\t} catch {\n\t\t\t\tthrow new NotteError(`Function stream ended without a result: ${raw.slice(0, 200)}`);\n\t\t\t}\n\t\t\tresult = parseFunctionRunResult(parsed, path);\n\t\t}\n\t\tif (!result) throw new NotteError('Function stream ended without a result');\n\t\treturn result;\n\t} finally {\n\t\tsignal?.removeEventListener('abort', onAbort);\n\t\tawait reader.cancel().catch(() => {});\n\t\treader.releaseLock();\n\t}\n}\n","import { createDecipheriv, createHmac, pbkdf2Sync, timingSafeEqual } from 'node:crypto';\n\nconst SALT_LENGTH = 16;\nconst PBKDF2_ITERATIONS = 100000;\nconst PBKDF2_KEY_LENGTH = 32;\n\nconst FERNET_VERSION = 0x80;\nconst FERNET_IV_LENGTH = 16;\nconst FERNET_HMAC_LENGTH = 32;\n// version byte + 8 byte timestamp + IV\nconst FERNET_HEADER_LENGTH = 1 + 8 + FERNET_IV_LENGTH;\n\n/**\n * Decrypts the tokens produced by the backend’s Fernet encryption helper.\n *\n * A token is `base64url(salt || fernet_token)`. The Fernet key is derived from\n * the root key with PBKDF2-HMAC-SHA256 (100k iterations) over that salt, and the\n * Fernet token itself is AES-128-CBC with an HMAC-SHA256 suffix.\n */\nexport class Encryption {\n\tprivate readonly rootKey: string;\n\n\tconstructor(rootKey: string) {\n\t\tif (!rootKey) {\n\t\t\tthrow new Error('Root key cannot be empty');\n\t\t}\n\t\tthis.rootKey = rootKey;\n\t}\n\n\tdecrypt(token: string): string {\n\t\tconst combined = Buffer.from(token, 'base64url');\n\t\tif (combined.length <= SALT_LENGTH) {\n\t\t\tthrow new Error('Invalid encrypted token: too short to contain a salt');\n\t\t}\n\n\t\tconst salt = combined.subarray(0, SALT_LENGTH);\n\t\tconst fernetToken = combined.subarray(SALT_LENGTH).toString('utf8');\n\t\tconst key = pbkdf2Sync(this.rootKey, salt, PBKDF2_ITERATIONS, PBKDF2_KEY_LENGTH, 'sha256');\n\n\t\treturn decryptFernet(fernetToken, key);\n\t}\n}\n\nfunction decryptFernet(token: string, key: Buffer): string {\n\tconst signingKey = key.subarray(0, 16);\n\tconst encryptionKey = key.subarray(16);\n\n\tconst data = Buffer.from(token, 'base64url');\n\tif (data.length < FERNET_HEADER_LENGTH + FERNET_HMAC_LENGTH) {\n\t\tthrow new Error('Invalid Fernet token: too short');\n\t}\n\tif (data[0] !== FERNET_VERSION) {\n\t\tthrow new Error(`Invalid Fernet token: unsupported version 0x${data[0].toString(16)}`);\n\t}\n\n\tconst signed = data.subarray(0, data.length - FERNET_HMAC_LENGTH);\n\tconst signature = data.subarray(data.length - FERNET_HMAC_LENGTH);\n\tconst expected = createHmac('sha256', signingKey).update(signed).digest();\n\tif (!timingSafeEqual(signature, expected)) {\n\t\tthrow new Error('Invalid Fernet token: signature verification failed');\n\t}\n\n\tconst iv = signed.subarray(9, FERNET_HEADER_LENGTH);\n\tconst ciphertext = signed.subarray(FERNET_HEADER_LENGTH);\n\tconst decipher = createDecipheriv('aes-128-cbc', encryptionKey, iv);\n\n\treturn Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString('utf8');\n}\n","import { createHash } from 'node:crypto';\nimport { prepareRunPayloadUpload } from '@/lib/client/sdk.gen';\nimport type { RunPayloadReference as UploadReference } from '@/lib/client/types.gen';\nimport type { NotteClient } from '@/client';\nimport type { FunctionRunUpdateRequest, GetFunctionRunResponse } from '@/functions';\n\ntype PayloadField = 'result' | 'logs' | 'variables';\nconst INLINE_FIELD_BYTES = 1024 * 1024;\nconst MAX_PAYLOAD_BYTES = 256 * 1024 * 1024;\n\n/** Upload large fields before sending the run's final metadata update. */\nexport async function offloadRunPayloads(\n\tclient: ReturnType<NotteClient['getClient']>,\n\tpath: { function_id: string; run_id: string },\n\tfields: FunctionRunUpdateRequest,\n): Promise<Record<string, unknown>> {\n\tconst data: Record<string, unknown> = { ...fields };\n\tconst references: Partial<Record<PayloadField, UploadReference>> = {};\n\t// The persisted result and read contract are text, including structured results.\n\tif (data.result != null && typeof data.result !== 'string') data.result = JSON.stringify(data.result);\n\tfor (const field of ['result', 'logs', 'variables'] as const) {\n\t\tif (data[field] == null) continue;\n\t\tconst payload = Buffer.from(JSON.stringify(data[field]), 'utf8');\n\t\tif (payload.length > MAX_PAYLOAD_BYTES) throw new Error(`Function run ${field} exceeds the payload limit`);\n\t\tif (payload.length <= INLINE_FIELD_BYTES) continue;\n\t\tconst checksum = createHash('sha256').update(payload).digest('base64');\n\t\tconst prepared = await prepareRunPayloadUpload({\n\t\t\tclient,\n\t\t\tpath: { ...path, field },\n\t\t\tbody: { size_bytes: payload.length, sha256: checksum },\n\t\t\tthrowOnError: true,\n\t\t});\n\t\tconst upload = prepared.data;\n\t\tif (upload.reference.size_bytes !== payload.length || upload.reference.sha256 !== checksum) {\n\t\t\tthrow new Error('Run payload upload reference does not match the local payload');\n\t\t}\n\t\tif (new URL(upload.url).protocol !== 'https:') throw new Error('Invalid run payload URL');\n\t\t// This request bypasses the authenticated API client and cannot follow redirects.\n\t\tconst response = await fetch(upload.url, {\n\t\t\tmethod: 'PUT', body: payload, headers: upload.headers,\n\t\t\tredirect: 'error', signal: AbortSignal.timeout(300_000),\n\t\t});\n\t\tawait response.body?.cancel();\n\t\tif (!response.ok) throw new Error(`Run payload upload failed (${response.status})`);\n\t\treferences[field] = upload.reference;\n\t\tif (field === 'result' && typeof data.result === 'string') data.result_preview = data.result.slice(0, 16000);\n\t\tdelete data[field];\n\t}\n\tif (Object.keys(references).length) data.payloads = references;\n\treturn data;\n}\n\nexport type RunWithPayloads = GetFunctionRunResponse & {\n\tpayloads?: Partial<Record<PayloadField, { size_bytes: number; sha256: string }>>;\n\tpayload_urls?: Partial<Record<PayloadField, string>>;\n};\n\n/** Decode large fields on the client, never through API JSON buffering. */\nexport async function resolveRunPayloads(input: RunWithPayloads): Promise<GetFunctionRunResponse> {\n\tconst run = { ...input };\n\tfor (const [field, reference] of Object.entries(run.payloads ?? {})) {\n\t\tif (!['result', 'logs', 'variables'].includes(field)) throw new Error('Unknown run payload field');\n\t\tif (!Number.isSafeInteger(reference.size_bytes) || reference.size_bytes <= 0 || reference.size_bytes > 256 * 1024 * 1024) {\n\t\t\tthrow new Error('Invalid run payload size');\n\t\t}\n\t\tconst url = run.payload_urls?.[field as PayloadField];\n\t\tif (!url || new URL(url).protocol !== 'https:') throw new Error('Invalid run payload URL');\n\t\t// Use a separate fetch so API authentication and preview headers cannot\n\t\t// follow the signed URL to storage.\n\t\tconst response = await fetch(url, { redirect: 'error', signal: AbortSignal.timeout(300_000) });\n\t\tif (!response.ok || !response.body) throw new Error(`Run payload download failed (${response.status})`);\n\t\tconst reader = response.body.getReader();\n\t\tconst chunks: Uint8Array[] = [];\n\t\tconst hash = createHash('sha256');\n\t\tlet size = 0;\n\t\ttry {\n\t\t\twhile (true) {\n\t\t\t\tconst { done, value } = await reader.read();\n\t\t\t\tif (done) break;\n\t\t\t\tsize += value.length;\n\t\t\t\tif (size > reference.size_bytes) throw new Error('Run payload exceeds its declared size');\n\t\t\t\thash.update(value);\n\t\t\t\tchunks.push(value);\n\t\t\t}\n\t\t} finally {\n\t\t\tawait reader.cancel();\n\t\t\treader.releaseLock();\n\t\t}\n\t\tif (size !== reference.size_bytes || hash.digest('base64') !== reference.sha256) {\n\t\t\tthrow new Error('Run payload failed size/checksum verification');\n\t\t}\n\t\tconst value: unknown = JSON.parse(Buffer.concat(chunks, size).toString('utf8'));\n\t\tif (field === 'result' && value !== null && typeof value !== 'string') throw new Error('Invalid stored result');\n\t\tif (field === 'logs' && (!Array.isArray(value) || !value.every(line => typeof line === 'string'))) throw new Error('Invalid stored logs');\n\t\tif (field === 'variables' && value !== null && (typeof value !== 'object' || Array.isArray(value))) throw new Error('Invalid stored variables');\n\t\tObject.assign(run, { [field]: value });\n\t}\n\tdelete run.payloads;\n\tdelete run.payload_urls;\n\treturn run;\n}\n","import { createWriteStream } from 'node:fs';\nimport { link, mkdir, readFile, rename, rm, stat } from 'node:fs/promises';\nimport { basename, extname, join } from 'node:path';\nimport { randomBytes } from 'node:crypto';\nimport { Readable } from 'node:stream';\nimport { pipeline } from 'node:stream/promises';\nimport type { ReadableStream as NodeReadableStream } from 'node:stream/web';\n\nimport type { NotteClient } from '@/client';\nimport type { Client } from '@/lib/client/client/types.gen';\nimport type { FileSource, SessionFile, SessionFilesPage } from '@/lib/client/types.gen';\nimport { deleteSessionFile, downloadSessionFile, listSessionFiles, uploadSessionFile } from '@/lib/client/sdk.gen';\nimport { InvalidRequestError, NotteError } from '@/errors';\n\nexport type { FileSource, SessionFile, SessionFilesPage };\n\n/** A file ID was not found in the session, the counterpart of Python's `FileNotFoundError`. */\nexport class FileNotFoundError extends NotteError {}\n\n/** The download destination already exists, the counterpart of Python's `FileExistsError`. */\nexport class FileExistsError extends NotteError {}\n\nexport interface FileListOptions {\n /** Only return files from this source: `user_upload` or `session_download`. */\n source?: FileSource;\n /** Page size. Defaults to 100. */\n limit?: number;\n /** Page offset. Defaults to 0. */\n offset?: number;\n}\n\nexport interface FileDownloadOptions {\n /** Overwrite an existing local file instead of rejecting with `FileExistsError`. */\n force?: boolean;\n}\n\n/** Bytes accepted by `upload()`: a local path, a `Blob`/`File`, or an in-memory buffer. */\nexport type UploadableFile = string | Blob | Uint8Array;\n\n/** Page size used when scanning a session for a file ID, like Python's `metadata()`. */\nconst METADATA_PAGE_SIZE = 1000;\n\nconst MIME_TYPES_BY_EXTENSION: Record<string, string> = {\n '.csv': 'text/csv',\n '.gif': 'image/gif',\n '.htm': 'text/html',\n '.html': 'text/html',\n '.jpeg': 'image/jpeg',\n '.jpg': 'image/jpeg',\n '.json': 'application/json',\n '.md': 'text/markdown',\n '.pdf': 'application/pdf',\n '.png': 'image/png',\n '.svg': 'image/svg+xml',\n '.txt': 'text/plain',\n '.webp': 'image/webp',\n '.xml': 'application/xml',\n '.zip': 'application/zip',\n};\n\nfunction guessMimeType(filename: string): string {\n return MIME_TYPES_BY_EXTENSION[extname(filename).toLowerCase()] ?? 'application/octet-stream';\n}\n\n/**\n * Reduce a server-provided filename to a safe basename, like Python's\n * `Path(PureWindowsPath(filename).name).name`: both separators are honoured,\n * drive letters are dropped and only the last component is kept.\n */\nexport function sanitizeFilename(filename: string): string {\n const segment = filename.split(/[\\\\/]+/).filter(Boolean).pop() ?? '';\n return segment.replace(/^[a-zA-Z]:/, '');\n}\n\nfunction toFile(file: Blob | Uint8Array, filename: string): File {\n if (file instanceof File && file.name === filename) {\n return file;\n }\n const type = file instanceof Blob && file.type ? file.type : guessMimeType(filename);\n return new File([file as BlobPart], filename, { type });\n}\n\n/**\n * Session-scoped file operations built on the generated `sessions/{id}/files`\n * client. Every API failure rejects with a `NotteAPIError`.\n *\n * ```ts\n * const files = client.Files(sessionId);\n * const uploaded = await files.upload(new Blob(['hello']), 'hello.txt');\n * const page = await files.list({ source: 'user_upload' });\n * ```\n */\nexport class SessionFiles {\n constructor(\n private readonly client: Client,\n readonly sessionId: string,\n ) {}\n\n /**\n * Upload bytes as a session file. `filename` is what the browser sees when\n * the file is later attached to a page.\n *\n * @param file - Bytes to upload as a Blob, File, or buffer.\n * @param filename - Stored filename, defaulting to `file`.\n * @returns Metadata for the uploaded file, including its ID, name, and size.\n * @throws NotteAPIError if the storage API request fails.\n */\n async upload(file: Blob | Uint8Array, filename = 'file'): Promise<SessionFile> {\n const response = await uploadSessionFile({\n client: this.client,\n path: { session_id: this.sessionId },\n body: { file: toFile(file, filename) },\n throwOnError: true,\n });\n return response.data;\n }\n\n /** List the session's non-expired files, newest first.\n *\n * @param options - Optional source filter and pagination. Defaults to all sources, limit 100, and offset 0.\n * @returns One page of non-expired files and the total count; pagination is not automatic.\n * @throws NotteAPIError if the storage API request fails.\n */\n async list(options: FileListOptions = {}): Promise<SessionFilesPage> {\n const response = await listSessionFiles({\n client: this.client,\n path: { session_id: this.sessionId },\n query: options,\n throwOnError: true,\n });\n return response.data;\n }\n\n /**\n * Find a file's metadata by ID by scanning the session listing. Rejects with\n * `FileNotFoundError` when the ID is unknown or expired.\n *\n * @param fileId - ID of a file belonging to this session.\n * @returns The matching file's metadata.\n * @throws NotteAPIError if the storage API request fails.\n * @throws FileNotFoundError if the file ID is unknown or expired.\n */\n async metadata(fileId: string): Promise<SessionFile> {\n let offset = 0;\n while (true) {\n const page = await this.list({ limit: METADATA_PAGE_SIZE, offset });\n const match = page.files.find(file => file.id === fileId);\n if (match) {\n return match;\n }\n offset += page.files.length;\n if (offset >= page.total || page.files.length === 0) {\n throw new FileNotFoundError(`File ${fileId} was not found in session ${this.sessionId}`);\n }\n }\n }\n\n /** Download a file's bytes as a `Blob`.\n *\n * @param fileId - ID of a file belonging to this session.\n * @returns The downloaded bytes as a Blob; no local file is written.\n * @throws NotteAPIError if the storage API request fails.\n */\n async download(fileId: string): Promise<Blob> {\n const response = await downloadSessionFile({\n client: this.client,\n path: { session_id: this.sessionId, file_id: fileId },\n parseAs: 'blob',\n throwOnError: true,\n });\n return response.data as Blob;\n }\n\n /** Stream a file's bytes. Used by `RemoteFileStorage.download()` to write to disk without buffering. */\n async stream(fileId: string): Promise<ReadableStream<Uint8Array>> {\n const response = await downloadSessionFile({\n client: this.client,\n path: { session_id: this.sessionId, file_id: fileId },\n parseAs: 'stream',\n throwOnError: true,\n });\n const body = response.data as ReadableStream<Uint8Array> | null;\n if (!body) {\n throw new NotteError(`Download of file ${fileId} returned no body`);\n }\n return body;\n }\n\n /** Delete a session file.\n *\n * @param fileId - ID of the session file to delete.\n * @returns Resolves when deletion succeeds.\n * @throws NotteAPIError if the storage API request fails.\n */\n async delete(fileId: string): Promise<void> {\n await deleteSessionFile({\n client: this.client,\n path: { session_id: this.sessionId, file_id: fileId },\n throwOnError: true,\n });\n }\n}\n\n/**\n * File storage bound to a session, the counterpart of Python's\n * `RemoteFileStorage`. Create it unbound and pass it to `client.Session({ storage })`\n * so the session binds it on start, or bind it yourself with a session ID.\n *\n * ```ts\n * const storage = client.FileStorage(sessionId);\n * const uploaded = await storage.upload('./resume.pdf');\n * const localPath = await storage.download(uploaded.id, './downloads');\n * const blob = await storage.downloadBlob(uploaded.id);\n * ```\n *\n * `download()` saves to disk; `downloadBlob()` returns bytes in memory, and\n * `stream()` returns a readable stream. For lower-level session file access,\n * see [NotteClient.Files](/typescript-sdk-reference/client/files).\n *\n */\nexport class RemoteFileStorage {\n private _sessionId: string | null;\n\n constructor(\n readonly client: NotteClient,\n sessionId?: string,\n ) {\n this._sessionId = sessionId ?? null;\n }\n\n /** Bind the storage to a session. Called by `Session.start()` when the storage was passed to the session. */\n setSessionId(sessionId: string): void {\n this._sessionId = sessionId;\n }\n\n /**\n * Bind this storage once, cloning it when another session already owns it.\n *\n * ```ts\n * const first = storage.forSession('session-a'); // first === storage\n * const second = storage.forSession('session-b'); // a clone sharing the client\n * ```\n */\n forSession(sessionId: string): RemoteFileStorage {\n if (this._sessionId === null) {\n this._sessionId = sessionId;\n return this;\n }\n if (this._sessionId === sessionId) {\n return this;\n }\n return new RemoteFileStorage(this.client, sessionId);\n }\n\n /** ID of the bound session. Throws `InvalidRequestError` while the storage is unbound. */\n get sessionId(): string {\n if (this._sessionId === null) {\n throw new InvalidRequestError('A session ID is required for every file operation');\n }\n return this._sessionId;\n }\n\n /** Whether the storage has been bound to a session yet. */\n get isBound(): boolean {\n return this._sessionId !== null;\n }\n\n private files(): SessionFiles {\n return new SessionFiles(this.client.getClient(), this.sessionId);\n }\n\n /**\n * Upload a file to the session. A string is read as a local path and its\n * basename becomes the uploaded filename unless `uploadFileName` is set.\n *\n * @param file - Local file path, Blob, File, or buffer to upload.\n * @param uploadFileName - Optional stored filename. Local paths default to their basename; File objects keep their name.\n * @returns Metadata for the uploaded file, including its ID, name, and size.\n * @throws NotteAPIError if the storage API request fails.\n * @throws InvalidRequestError if storage has not been bound to a session.\n * @throws InvalidRequestError if a supplied local path is not a file.\n * @example\n * await storage.upload('./data/resume.pdf');\n * await storage.upload(Buffer.from('hello'), 'hello.txt');\n */\n async upload(file: UploadableFile, uploadFileName?: string): Promise<SessionFile> {\n const files = this.files();\n if (typeof file === 'string') {\n const info = await stat(file).catch(() => null);\n if (!info?.isFile()) {\n throw new InvalidRequestError(`Cannot upload file ${file}: it is not a file`);\n }\n const bytes = await readFile(file);\n return files.upload(bytes, uploadFileName ?? basename(file));\n }\n const filename = uploadFileName ?? (file instanceof File ? file.name : 'file');\n return files.upload(file, filename);\n }\n\n /**\n * List the session's files.\n *\n * @param options - Optional source filter and pagination. Defaults to all sources, limit 100, and offset 0.\n * @returns One page of non-expired files and the total count; pagination is not automatic.\n * @throws NotteAPIError if the storage API request fails.\n * @throws InvalidRequestError if storage has not been bound to a session.\n * @example\n * const downloads = await storage.list({ source: 'session_download', limit: 1000 });\n */\n async list(options: FileListOptions = {}): Promise<SessionFilesPage> {\n return this.files().list(options);\n }\n\n /** Metadata of a file by ID. Rejects with `FileNotFoundError` when unknown.\n *\n * @param fileId - ID of a file belonging to this session.\n * @returns The matching file's metadata.\n * @throws NotteAPIError if the storage API request fails.\n * @throws FileNotFoundError if the file ID is unknown or expired.\n * @throws InvalidRequestError if storage has not been bound to a session.\n */\n async metadata(fileId: string): Promise<SessionFile> {\n return this.files().metadata(fileId);\n }\n\n /**\n * Download a file to `<localDir>/<filename>` and return the local path. The\n * file is written atomically (temporary file + rename). Rejects with\n * `FileExistsError` when the destination exists unless `force` is set.\n *\n * @param fileId - ID of the file to download.\n * @param localDir - Destination directory, created if needed. Defaults to the current directory.\n * @param options - Set `force` to overwrite an existing destination; defaults to false.\n * @returns The local file path after the download has been written successfully.\n * @throws NotteAPIError if the storage API request fails.\n * @throws InvalidRequestError if storage has not been bound to a session.\n * @throws FileExistsError if the destination exists and `force` is false. Filesystem errors also propagate.\n * @example\n * const path = await storage.download(fileId, './downloads', { force: true });\n */\n async download(fileId: string, localDir = '.', options: FileDownloadOptions = {}): Promise<string> {\n const files = this.files();\n const metadata = await files.metadata(fileId);\n const safeName = sanitizeFilename(metadata.filename);\n if (safeName === '' || safeName === '.' || safeName === '..') {\n throw new NotteError(`Unsafe filename returned for file ${fileId}: ${JSON.stringify(metadata.filename)}`);\n }\n await mkdir(localDir, { recursive: true });\n const destination = join(localDir, safeName);\n if (!options.force) {\n // Fail fast before the transfer; the atomic `link` below is the real guard.\n const exists = await stat(destination).then(() => true, () => false);\n if (exists) {\n throw new FileExistsError(`${destination} already exists; pass force: true to overwrite it`);\n }\n }\n\n const body = await files.stream(fileId);\n // Unpredictable name plus O_EXCL: a pre-planted symlink is never followed.\n const temporary = join(localDir, `.${safeName}.${randomBytes(8).toString('hex')}.part`);\n try {\n await pipeline(\n Readable.fromWeb(body as unknown as NodeReadableStream<Uint8Array>),\n createWriteStream(temporary, { flags: 'wx' }),\n );\n if (options.force) {\n await rename(temporary, destination);\n } else {\n // `link` fails with EEXIST instead of replacing a file created after the\n // check above, so the no-overwrite contract holds under concurrency.\n try {\n await link(temporary, destination);\n } catch (error) {\n if ((error as { code?: string }).code === 'EEXIST') {\n throw new FileExistsError(`${destination} already exists; pass force: true to overwrite it`);\n }\n throw error;\n }\n await rm(temporary, { force: true });\n }\n } catch (error) {\n await rm(temporary, { force: true });\n throw error;\n }\n return destination;\n }\n\n /** Download a file's bytes as a `Blob` without touching the local filesystem. */\n async downloadBlob(fileId: string): Promise<Blob> {\n return this.files().download(fileId);\n }\n\n /** Stream a file's bytes without buffering the whole file in memory. */\n async stream(fileId: string): Promise<ReadableStream<Uint8Array>> {\n return this.files().stream(fileId);\n }\n\n /** Delete a session file.\n *\n * @param fileId - ID of the session file to delete.\n * @returns Resolves when deletion succeeds.\n * @throws NotteAPIError if the storage API request fails.\n * @throws InvalidRequestError if storage has not been bound to a session.\n */\n async delete(fileId: string): Promise<void> {\n await this.files().delete(fileId);\n }\n}\n","import type { NotteClient } from '@/client';\nimport { NotteError } from '@/errors';\nimport type { AnythingStartRequest } from '@/lib/client/types.gen';\nimport { anythingStart } from '@/lib/client/sdk.gen';\n\n/** Body of `POST /anything/start`: the natural-language description of the task. */\nexport type AnythingStartOptions = AnythingStartRequest;\n\n/**\n * One event of the AI SDK UI message stream. `type` names the event (for\n * example `text-delta`); the remaining keys depend on that type, so read them\n * at runtime rather than relying on a fixed shape.\n */\nexport type AnythingStreamChunk = { type: string } & Record<string, unknown>;\n\n/**\n * Result of `POST /anything/start`. The endpoint answers with an\n * [AI SDK UI message stream](https://ai-sdk.dev/docs/ai-sdk-ui/stream-protocol),\n * not a JSON document, so the run is exposed as chunks to iterate rather than\n * an object to read.\n */\nexport type AnythingStartResult = {\n /** Thread handling this run, from the `x-thread-id` response header. */\n threadId: string | null;\n /** Value of the `x-vercel-ai-ui-message-stream` header: the stream-format version. */\n uiMessageStreamVersion: string | null;\n /** Events of the stream, in order, until the terminating `[DONE]`. */\n chunks: AsyncGenerator<AnythingStreamChunk>;\n};\n\n/** Parse an AI SDK UI message stream into its events. */\nasync function* readAnythingStream(\n body: ReadableStream<Uint8Array>,\n): AsyncGenerator<AnythingStreamChunk> {\n const reader = body.getReader();\n const decoder = new TextDecoder();\n let buffer = '';\n try {\n while (true) {\n const { value, done } = await reader.read();\n buffer += decoder.decode(value, { stream: !done });\n let end: number;\n while ((end = buffer.indexOf('\\n')) !== -1) {\n // Frames may be terminated with CRLF; drop the carriage return.\n const line = buffer.slice(0, end).replace(/\\r$/, '');\n buffer = buffer.slice(end + 1);\n if (!line.startsWith('data:')) continue;\n const payload = line.slice(5).replace(/^ /, '');\n if (payload === '[DONE]') return;\n try {\n yield JSON.parse(payload) as AnythingStreamChunk;\n } catch (error) {\n throw new NotteError(`Malformed Anything stream event: ${payload}`, { cause: error });\n }\n }\n if (done) break;\n }\n } finally {\n await reader.cancel().catch(() => {});\n reader.releaseLock();\n }\n}\n\n/**\n * Anything API, the counterpart of `POST /anything/start`: turn a plain-English\n * description of a web task into a running automation.\n *\n * ```ts\n * const { threadId, chunks } = await client.anything.start({ task: 'fetch the top 3 hacker news posts' });\n * console.log('Thread ID:', threadId);\n * for await (const chunk of chunks) {\n * console.log(chunk.type, chunk);\n * }\n * ```\n */\nexport class NotteAnything {\n private readonly client: NotteClient;\n\n constructor(client: NotteClient) {\n this.client = client;\n }\n\n /**\n * Start a run for `task` and stream the agent's progress back.\n *\n * Running is slow (minutes) and billable; prefer the marketplace\n * (`client.functions.list()`) when a ready-made function already fits.\n *\n * The returned `chunks` generator holds the connection open — iterate it to\n * completion, or `return`/`break` out of the loop to cancel and release the\n * stream.\n *\n * ```ts\n * const run = await client.anything.start({ task: 'get the weather in Paris' });\n * for await (const chunk of run.chunks) {\n * if (chunk.type === 'text-delta') process.stdout.write(String(chunk.delta ?? ''));\n * }\n * ```\n *\n * Rejects with a `NotteAPIError` when the API answers with a non-2xx status.\n */\n async start(body: AnythingStartOptions): Promise<AnythingStartResult> {\n const { data, response } = await anythingStart({\n client: this.client.getClient(),\n body,\n parseAs: 'stream',\n throwOnError: true,\n });\n const stream = data as ReadableStream<Uint8Array> | null;\n if (!stream) {\n throw new NotteError('Anything start returned no response stream');\n }\n return {\n threadId: response.headers.get('x-thread-id'),\n uiMessageStreamVersion: response.headers.get('x-vercel-ai-ui-message-stream'),\n chunks: readAnythingStream(stream),\n };\n }\n}\n","import type { NotteClient } from '@/client';\nimport type {\n ListSecretsData,\n SecretListResponse,\n SecretMetadata,\n SecretNamespace,\n SecretStoreRequest,\n SecretValueResponse,\n} from '@/lib/client/types.gen';\nimport { deleteSecret, getSecret, listSecrets, storeSecret } from '@/lib/client/sdk.gen';\n\n/** Options of `client.secrets.list()`: optionally filter by namespace. */\nexport type SecretListOptions = NonNullable<ListSecretsData['query']>;\n/** Body of `client.secrets.store()`. */\nexport type SecretStoreOptions = SecretStoreRequest;\n\nexport type { SecretListResponse, SecretMetadata, SecretNamespace, SecretValueResponse };\n\n/**\n * Workspace secrets store, the counterpart of the `/secrets` endpoints.\n * Secrets are scoped by namespace: `llm_provider` keys are used by agents and\n * scraping, `function_env` values are injected into function runs.\n *\n * ```ts\n * await client.secrets.store({ namespace: 'function_env', name: 'MY_TOKEN', value: 'xyz' });\n * const secrets = await client.secrets.list({ namespace: 'function_env' });\n * ```\n */\nexport class NotteSecrets {\n private readonly client: NotteClient;\n\n constructor(client: NotteClient) {\n this.client = client;\n }\n\n /**\n * List secret metadata (never the values), optionally filtered by namespace.\n *\n * ```ts\n * const secrets = await client.secrets.list({ namespace: 'llm_provider' });\n * secrets.forEach(s => console.log(s.name, s.key_hint));\n * ```\n */\n async list(options: SecretListOptions = {}): Promise<SecretMetadata[]> {\n const response = await listSecrets({ client: this.client.getClient(), query: options, throwOnError: true });\n return response.data?.items ?? [];\n }\n\n /**\n * Store (or overwrite) a secret and return its metadata.\n *\n * ```ts\n * const meta = await client.secrets.store({ namespace: 'function_env', name: 'API_TOKEN', value: 'xyz' });\n * console.log(meta.id, meta.key_hint);\n * ```\n */\n async store(body: SecretStoreOptions): Promise<SecretMetadata> {\n const response = await storeSecret({ client: this.client.getClient(), body, throwOnError: true });\n return response.data;\n }\n\n /**\n * Read the value of a secret by name within a namespace.\n *\n * ```ts\n * const { value } = await client.secrets.get('API_TOKEN', 'function_env');\n * ```\n */\n async get(name: string, namespace: SecretNamespace): Promise<SecretValueResponse> {\n const response = await getSecret({\n client: this.client.getClient(),\n path: { name },\n query: { namespace },\n throwOnError: true,\n });\n return response.data;\n }\n\n /**\n * Delete a secret by id (the `id` field of `SecretMetadata`).\n *\n * ```ts\n * const meta = await client.secrets.store({ namespace: 'function_env', name: 'TMP', value: 'x' });\n * await client.secrets.delete(meta.id);\n * ```\n */\n async delete(secretId: string): Promise<void> {\n await deleteSecret({ client: this.client.getClient(), path: { secret_id: secretId }, throwOnError: true });\n }\n}\n","import type { NotteClient } from '@/client';\nimport type {\n GetUsageData,\n GetUsageLogsData,\n PaginatedResponseUsageLog,\n UsageLog,\n UsageResponse,\n} from '@/lib/client/types.gen';\nimport { getUsage, getUsageLogs } from '@/lib/client/sdk.gen';\n\n/** Options of `client.usage.get()`: the monthly period, e.g. `\"May 2025\"`. Defaults to the current month. */\nexport type UsageOptions = NonNullable<GetUsageData['query']>;\n/** Options of `client.usage.logs()`: endpoint filter and pagination. */\nexport type UsageLogsOptions = NonNullable<GetUsageLogsData['query']>;\n/** Endpoint names accepted by `UsageLogsOptions.endpoint`. */\nexport type UsageLogEndpoint = NonNullable<UsageLogsOptions['endpoint']>;\n\nexport type { PaginatedResponseUsageLog, UsageLog, UsageResponse };\n\n/**\n * Usage and billing, the counterpart of `GET /usage` and `GET /usage/logs`.\n *\n * ```ts\n * const usage = await client.usage.get();\n * console.log(usage.total_cost, usage.balance_amount);\n * ```\n */\nexport class NotteUsage {\n private readonly client: NotteClient;\n\n constructor(client: NotteClient) {\n this.client = client;\n }\n\n /**\n * Usage summary for a monthly period (current month by default).\n *\n * ```ts\n * const usage = await client.usage.get({ period: 'May 2025' });\n * console.log(`${usage.session_count} sessions, $${usage.total_cost}`);\n * ```\n */\n async get(options: UsageOptions = {}): Promise<UsageResponse> {\n const response = await getUsage({ client: this.client.getClient(), query: options, throwOnError: true });\n return response.data;\n }\n\n /**\n * Paginated per-request usage logs, optionally filtered by endpoint.\n *\n * ```ts\n * const page = await client.usage.logs({ endpoint: 'sessions.start', page: 1, page_size: 50 });\n * page.items.forEach(log => console.log(log.created_at, log.endpoint, log.duration_ms));\n * ```\n */\n async logs(options: UsageLogsOptions = {}): Promise<PaginatedResponseUsageLog> {\n const response = await getUsageLogs({ client: this.client.getClient(), query: options, throwOnError: true });\n return response.data;\n }\n}\n","import { NotteManagedAuth, type AuthSessionResponse as SessionResponse } from '@/managed-auth';\nimport { createClient } from '@/lib/client/client';\nimport { createResources } from '@/resources.gen';\nimport { getParseAs } from '@/lib/client/client/utils.gen';\nimport { Session, type SessionOptions } from '@/session';\nimport type {\n FunctionListItemResponse,\n GlobalScrapeRequest,\n ListFunctionsData,\n ListSessionsData,\n ListVaultsData,\n PersonaResponse,\n Vault,\n} from '@/lib/client/types.gen';\nimport { NotteVault, type VaultConstructor } from '@/vaults';\nimport { NottePersona, withPersonaDefaults, type PersonaConstructor, type PersonaListOptions } from '@/personas';\nimport { NotteFunction, type FunctionConstructor } from '@/functions';\nimport {\n healthCheck,\n listFunctions,\n listPersonas,\n listSessions,\n listVaults,\n scrapeWebpage,\n searchWeb,\n} from '@/lib/client/sdk.gen';\nimport {\n buildScrapeBody,\n processScrapeResponse,\n type ScrapeOptions,\n type ScrapeResult,\n type StructuredData,\n type ZodLikeSchema,\n} from '@/scrape';\nimport { SDK_VERSION } from '@/version';\nimport { RemoteFileStorage, SessionFiles } from '@/files';\nimport type { SearchOptions, SearchResponse, SearchResultsResponse, SearchSourcedAnswerResponse, SearchStructuredResponse } from '@/search';\nimport { NotteAnything } from '@/anything';\nimport { NotteSecrets } from '@/secrets';\nimport { NotteUsage } from '@/usage';\nimport {\n AuthenticationError,\n InvalidRequestError,\n NotteAPIError,\n NotteAPIExecutionError,\n NotteTimeoutError,\n normalizeErrorBody,\n} from '@/errors';\nimport { createUpgradeErrorMessage, startVersionCheck, upgradeSuggestion } from '@/version-check';\nimport { createRetryingFetch, DEFAULT_MAX_RETRIES } from '@/retry';\n\nexport const DEFAULT_NOTTE_API_URL = 'https://api.notte.cc';\nexport const DEFAULT_REQUEST_TIMEOUT_MS = 60_000;\n/** Request origin header, the Node counterpart of `sdk-python`. */\nexport const REQUEST_ORIGIN = 'sdk-node';\n/**\n * Per-call header read by the client's request interceptor to override the\n * default request timeout. `0` disables the timeout (streaming responses).\n * The header is stripped before the request leaves the process.\n */\nexport const TIMEOUT_HEADER = 'x-notte-timeout-ms';\n/**\n * Per-call header read by the request interceptor to override `maxRetries`\n * for one request. Stripped before the request leaves the process.\n */\nexport const MAX_RETRIES_HEADER = 'x-notte-max-retries';\nconst DB_PREVIEW_ENV = 'NOTTE_DB_PREVIEW_BRANCH';\nconst DB_PREVIEW_HEADER = 'x-db-preview';\nconst EXECUTION_ERROR_CLASS = 'NotteApiExecutionError';\n\nexport interface NotteClientConfig {\n /** API base URL. Defaults to `NOTTE_API_URL` or `https://api.notte.cc`. */\n baseUrl?: string;\n /** API key. Defaults to `NOTTE_API_KEY`. Optional only for relative proxy base URLs. */\n apiKey?: string;\n /** Default per-request timeout in milliseconds. Defaults to 60 000, like the Python SDK. */\n timeoutMs?: number;\n /** Maximum CAPTCHA wait in seconds, separate from each HTTP timeout. Defaults to 180. */\n captchaTimeoutSeconds?: number;\n /** Database preview branch. Defaults to `NOTTE_DB_PREVIEW_BRANCH`. Internal. */\n dbPreview?: string;\n /** Log every request like `NotteClient(verbose=True)` in Python. */\n verbose?: boolean;\n /**\n * Retries for transient failures (502, 503, 504, 529, and connection\n * errors), with exponential backoff and full jitter. `Retry-After` is\n * honored. POST and PATCH requests are only retried when the API cannot\n * have processed them (503, 529, connection refused), so they are never\n * applied twice. All attempts share the request timeout. Defaults to 3;\n * `0` disables retries.\n */\n maxRetries?: number;\n}\n\nexport type SessionListOptions = NonNullable<ListSessionsData['query']>;\nexport type VaultListOptions = NonNullable<ListVaultsData['query']>;\nexport type FunctionListOptions = NonNullable<ListFunctionsData['query']>;\n/** Options of `client.scrape()`: the global scrape request minus `url`, plus the SDK-only scrape options. */\nexport type GlobalScrapeOptions<T = unknown> = Omit<GlobalScrapeRequest, 'url' | 'response_format' | 'wait_for_authentication' | 'only_images'> & ScrapeOptions<T> & {\n /** Whether to wait for Managed Auth before the scrape request completes. Defaults to true. Authentication failure or timeout can fail the scrape request. */\n wait_for_authentication?: boolean;\n};\n\ntype ResolvedConfig = Required<Pick<NotteClientConfig, 'baseUrl' | 'timeoutMs' | 'verbose' | 'captchaTimeoutSeconds' | 'maxRetries'>> &\n Pick<NotteClientConfig, 'apiKey' | 'dbPreview'>;\n\nfunction isRelativeProxyUrl(baseUrl: string): boolean {\n // '/api/notte' is a same-origin proxy path; '//host' is protocol-relative and not allowed.\n return /^\\/(?!\\/)/.test(baseUrl);\n}\n\n/** Entry point for sessions, functions, vaults, personas, and session files. */\nexport class NotteClient {\n private readonly config: ResolvedConfig;\n private readonly client = createClient();\n private readonly resources = createResources(this.client, () => this.config.apiKey ?? '');\n\n constructor(config: NotteClientConfig = {}) {\n const apiKey = config.apiKey || process.env.NOTTE_API_KEY;\n const baseUrl = config.baseUrl || process.env.NOTTE_API_URL || DEFAULT_NOTTE_API_URL;\n const dbPreview = config.dbPreview || process.env[DB_PREVIEW_ENV] || undefined;\n const timeoutMs = config.timeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;\n const captchaTimeoutSeconds = config.captchaTimeoutSeconds ?? 180;\n if (!Number.isFinite(captchaTimeoutSeconds) || captchaTimeoutSeconds <= 0) {\n throw new InvalidRequestError('captchaTimeoutSeconds must be positive and finite');\n }\n if (!(timeoutMs >= 0)) {\n throw new InvalidRequestError('timeoutMs must be a non-negative number');\n }\n const maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES;\n if (!Number.isInteger(maxRetries) || maxRetries < 0) {\n throw new InvalidRequestError('maxRetries must be a non-negative integer');\n }\n\n // Only skip the apiKey check for relative proxy paths (e.g. '/api/notte').\n // Any HTTPS URL—including staging—still requires a key.\n const isProxyMode = isRelativeProxyUrl(baseUrl);\n if (!isProxyMode) {\n const url = new URL(baseUrl);\n const loopback = ['localhost', '127.0.0.1', '[::1]'].includes(url.hostname);\n if (url.protocol !== 'https:' && !(url.protocol === 'http:' && loopback)) {\n throw new InvalidRequestError(\n 'API base URL must use HTTPS (HTTP is only allowed on loopback for local development)',\n );\n }\n }\n if (!apiKey && !isProxyMode) {\n throw new AuthenticationError(\n 'NOTTE_API_KEY needs to be provided. Pass config.apiKey or set the NOTTE_API_KEY environment variable.',\n );\n }\n\n this.config = {\n baseUrl, apiKey, timeoutMs, captchaTimeoutSeconds, dbPreview, maxRetries, verbose: config.verbose ?? false,\n };\n\n if (baseUrl !== DEFAULT_NOTTE_API_URL && !isProxyMode) {\n console.warn(`NOTTE_API_URL is set to: ${baseUrl}`);\n }\n\n // Use redirect:'manual' so we handle 3xx ourselves.\n // Node's undici drops POST bodies on cross-origin 307 redirects\n // (e.g. when the API gateway redirects to AWS Lambda function URLs).\n // throwOnError makes every generated call reject with the typed error\n // built by the error interceptor below, like `BaseClient.request` in Python.\n this.client.setConfig({\n baseUrl: this.config.baseUrl,\n redirect: 'manual',\n throwOnError: true,\n });\n\n this.client.interceptors.request.use((request: Request, opts) => {\n const headers = new Headers(request.headers);\n if (this.config.apiKey) headers.set('Authorization', `Bearer ${this.config.apiKey}`);\n headers.set('x-notte-request-origin', REQUEST_ORIGIN);\n headers.set('x-notte-sdk-version', SDK_VERSION);\n if (this.config.dbPreview) headers.set(DB_PREVIEW_HEADER, this.config.dbPreview);\n\n const override = headers.get(TIMEOUT_HEADER);\n headers.delete(TIMEOUT_HEADER);\n const retriesOverride = headers.get(MAX_RETRIES_HEADER);\n headers.delete(MAX_RETRIES_HEADER);\n const timeoutMs = override !== null ? Number(override) : this.config.timeoutMs;\n\n if (this.config.verbose) {\n console.info(`Making \\`${request.method}\\` request to \\`${request.url}\\``);\n }\n // Use the original signal: even request.signal follows opts.signal via\n // an undici WeakRef and can stop receiving aborts after garbage collection.\n const callerSignal = opts.signal ?? request.signal;\n const deadline = timeoutMs > 0 ? withTimeout(callerSignal, timeoutMs) : undefined;\n const signal = deadline?.signal ?? callerSignal;\n const timed = new Request(request, { headers, signal });\n pendingRequests.set(timed, { signal, release: deadline?.release ?? (() => undefined), expiresAt: deadline?.expiresAt ?? Infinity });\n\n // Pass the strongly held signal in fetch's init, bypassing Request's weak\n // signal-following link. Keeping the Request preserves all fetch options\n // (including streamed uploads), without reconstructing them field by field.\n // Wrap the resolved fetch per call so custom transports and redirects use it too.\n // SSE reconnects reuse opts; never wrap a previous attempt's signal.\n const transport = originalTransports.get(opts) ?? opts.fetch ?? globalThis.fetch;\n originalTransports.set(opts, transport);\n const retrying = createRetryingFetch({\n fetch: transport,\n maxRetries: () => retriesOverride !== null ? Number(retriesOverride) : this.config.maxRetries,\n deadline: () => deadline?.expiresAt,\n });\n opts.fetch = (input, init) => retrying(input, { ...init, signal });\n return timed;\n });\n\n // Follow 307/308 redirects manually, replaying the original body.\n // Also normalizes Content-Type from text/plain to application/json\n // (AWS Lambda function URLs return JSON with the wrong Content-Type).\n this.client.interceptors.response.use(async (response: Response, request: Request, opts: any) => {\n const initialUrl = new URL(request.url);\n let currentUrl = initialUrl;\n const headers = new Headers(request.headers);\n // Only the configured API's execution endpoint can delegate runtime\n // authentication. Its first HTTPS redirect is the runtime handoff, not\n // a blanket trust in an AWS domain or in arbitrary API redirects.\n const apiUrl = new URL(this.config.baseUrl, initialUrl);\n const executionPrefix = `${apiUrl.pathname.replace(/\\/$/, '')}/functions/`;\n const executionPath = initialUrl.pathname.slice(executionPrefix.length);\n const runtimeHandoff = request.method === 'POST' &&\n initialUrl.origin === apiUrl.origin && initialUrl.pathname.startsWith(executionPrefix) &&\n /^[^/]+\\/runs\\/[^/]+$/.test(executionPath) && !executionPath.endsWith('/create');\n for (let hop = 0; (response.status === 307 || response.status === 308) && response.headers.get('location'); hop++) {\n if (hop >= 10) throw new InvalidRequestError('Too many API redirects');\n const location = new URL(response.headers.get('location')!, currentUrl);\n const loopback = ['localhost', '127.0.0.1', '[::1]'].includes(location.hostname);\n if (location.protocol !== 'https:' && !(location.protocol === 'http:' && loopback)) {\n throw new InvalidRequestError(`Refusing to follow a redirect to an insecure URL: ${location.origin}`);\n }\n if (location.username || location.password) {\n throw new InvalidRequestError('Refusing to follow a redirect containing URL credentials');\n }\n if (location.origin !== currentUrl.origin) {\n headers.delete('Authorization');\n const localHandoff = location.protocol === 'http:' && initialUrl.protocol === 'http:' &&\n ['localhost', '127.0.0.1', '[::1]'].includes(initialUrl.hostname) && loopback;\n if (!(hop === 0 && runtimeHandoff && (location.protocol === 'https:' || localHandoff))) {\n headers.delete('x-notte-api-key');\n }\n }\n // A runtime cannot delegate the key again, even to another path on\n // its own origin. Handle every hop ourselves so fetch cannot leak it.\n if (hop > 0) headers.delete('x-notte-api-key');\n await response.body?.cancel();\n const headerRecord: Record<string, string> = {};\n headers.forEach((v, k) => { headerRecord[k] = v; });\n response = await (opts.fetch ?? fetch)(location.toString(), {\n method: request.method,\n headers: headerRecord,\n body: opts.serializedBody ?? undefined,\n signal: requestSignal(request),\n redirect: 'manual',\n });\n currentUrl = location;\n }\n\n // Normalize text/plain → application/json (Lambda function URLs)\n const ct = response.headers.get('content-type') ?? '';\n if (opts.parseAs !== 'stream' && ct.split(';')[0]?.trim() === 'text/plain') {\n const body = await response.arrayBuffer();\n const headers = new Headers(response.headers);\n headers.set('content-type', 'application/json');\n return new Response(body, { status: response.status, statusText: response.statusText, headers });\n }\n\n return response;\n });\n\n // Non-streaming calls are not finished until their body has arrived.\n // Buffer under the deadline, then let the generated client parse normally.\n // Explicit streams have a caller-owned lifetime (Function.run supplies its\n // own signal/deadline); do not buffer them or delay delivery of live logs.\n this.client.interceptors.response.use(async (response: Response, request: Request, opts: any) => {\n try {\n const parseAs = opts.parseAs === 'auto'\n ? getParseAs(response.headers.get('content-type'))\n : opts.parseAs;\n if (parseAs !== 'stream' && response.body) {\n const body = await response.arrayBuffer();\n const buffered = new Response(body, {\n status: response.status, statusText: response.statusText, headers: response.headers,\n });\n Object.defineProperty(buffered, 'url', { value: response.url });\n return buffered;\n }\n return response;\n } finally {\n releaseDeadline(request);\n }\n });\n\n // Turn raw failures into the typed error hierarchy.\n this.client.interceptors.error.use((error: unknown, response: Response | undefined, request: Request | undefined) => {\n releaseDeadline(request);\n return this.toTypedError(error, response, request);\n });\n\n startVersionCheck();\n }\n\n /**\n * Map the raw value the generated client rejects with into a `NotteError`.\n * HTTP failures become `NotteAPIError` (or `NotteAPIExecutionError` when the\n * API flags them), timeouts become `NotteTimeoutError`, anything else is\n * returned untouched.\n */\n private toTypedError(error: unknown, response: Response | undefined, request: Request | undefined): unknown {\n if (error instanceof NotteAPIError) {\n return error;\n }\n // Fetch body reads may throw AbortError even when the signal's reason is\n // TimeoutError. Preserve caller cancellation and report SDK deadlines as\n // timeouts rather than HTTP errors with a misleading status of 200.\n const signal = request && requestSignal(request);\n if (signal?.aborted) {\n error = signal.reason ?? error;\n }\n if (isTimeoutAbort(error)) {\n const target = request ? ` to \\`${requestPath(request)}\\`` : '';\n return new NotteTimeoutError(`Request${target} ${(error as Error).message}`, { cause: error });\n }\n if (signal?.aborted) return error;\n if (response) {\n const path = requestPath(request, response);\n const body = normalizeErrorBody(error);\n if (response.status === 422) {\n const latest = upgradeSuggestion();\n const message = typeof body.message === 'string' ? body.message : '';\n const looksLikeSchemaMismatch =\n message.includes('extra_forbidden') || message.includes('Extra inputs are not permitted') || message.includes(\"'type':\");\n if (latest && looksLikeSchemaMismatch) {\n return new NotteAPIError(\n path,\n response.status,\n { ...body, message: createUpgradeErrorMessage('API returned 422 validation error', latest, message) },\n response,\n );\n }\n }\n if (response.headers.get('x-error-class') === EXECUTION_ERROR_CLASS) {\n return new NotteAPIExecutionError(path, response.status, body, response);\n }\n return new NotteAPIError(path, response.status, body, response);\n }\n return error;\n }\n\n /**\n * Add the database preview branch to a websocket URL served by the Notte API.\n * The websocket handshake reads the branch from the query string, so without\n * it a preview-branch session is looked up in the default database.\n */\n withDbPreview(url: string): string {\n if (!this.config.dbPreview) {\n return url;\n }\n const parsed = new URL(url);\n parsed.searchParams.set('db_preview', this.config.dbPreview);\n return parsed.toString();\n }\n\n /**\n * Health check the Notte API. Resolves when the API answers 200 and rejects\n * with a `NotteAPIError` (or a network error) otherwise.\n */\n async healthCheck(): Promise<void> {\n await healthCheck({ client: this.client });\n }\n\n /**\n * Create a new session\n */\n Session(options: SessionOptions = {}): Session {\n return new Session(this, options);\n }\n\n /** Generated file operations; use Files(sessionId) for local file IO helpers. */\n get files() {\n return this.resources.files;\n }\n\n /** Access files owned by a specific session, including closed sessions. */\n Files(sessionId: string): SessionFiles {\n return new SessionFiles(this.getClient(), sessionId);\n }\n\n /**\n * File storage to attach to a session, the counterpart of `client.FileStorage()`.\n *\n * ```ts\n * const storage = client.FileStorage();\n * await client.Session({ storage }).use(async session => {\n * await storage.upload('./invoice.pdf');\n * const files = await storage.list({ source: 'session_download' });\n * });\n * ```\n */\n FileStorage(sessionId?: string): RemoteFileStorage {\n return new RemoteFileStorage(this, sessionId);\n }\n\n /**\n * Create or access a vault\n */\n Vault(options?: VaultConstructor): NotteVault {\n return new NotteVault(this, options);\n }\n\n /**\n * Create or access a persona\n */\n Persona(options?: PersonaConstructor): NottePersona {\n return new NottePersona(this, options);\n }\n\n /**\n * Create or access a function\n */\n NotteFunction(options: FunctionConstructor): NotteFunction {\n return new NotteFunction(this, options);\n }\n\n /** Alias of `NotteFunction`, matching `client.Function` in Python. */\n Function(options: FunctionConstructor): NotteFunction {\n return this.NotteFunction(options);\n }\n\n /** Client-bound session API operations. `list()` retains its array return value. */\n get sessions() {\n return {\n ...this.resources.sessions,\n list: async (options: SessionListOptions = {}): Promise<SessionResponse[]> => {\n const response = await listSessions({ client: this.getClient(), query: options });\n return response.data?.items ?? [];\n },\n };\n }\n\n /** Client-bound vault API operations. `list()` retains its array return value. */\n get vaults() {\n return {\n ...this.resources.vaults,\n list: async (options: VaultListOptions = {}): Promise<Vault[]> => {\n const response = await listVaults({ client: this.getClient(), query: options });\n return response.data?.items ?? [];\n },\n };\n }\n\n /** Client-bound function API operations. `list()` retains its array return value. */\n get functions() {\n return {\n ...this.resources.functions,\n list: async (options: FunctionListOptions = {}): Promise<FunctionListItemResponse[]> => {\n const response = await listFunctions({ client: this.getClient(), query: options });\n return response.data?.items ?? [];\n },\n };\n }\n\n /**\n * Search the public web (`POST /search`). Returns ranked results by default,\n * an answer with sources with `outputType: 'sourcedAnswer'`, or structured\n * output with `outputType: 'structured'`.\n *\n * ```ts\n * import { NotteClient } from 'notte-sdk';\n *\n * const client = new NotteClient();\n * const { results } = await client.search('notte browser agents');\n * const { answer } = await client.search('what is notte?', { outputType: 'sourcedAnswer' });\n * ```\n */\n async search(query: string, options?: SearchOptions & { outputType?: 'searchResults' }): Promise<SearchResultsResponse>;\n async search(query: string, options: SearchOptions & { outputType: 'sourcedAnswer' }): Promise<SearchSourcedAnswerResponse>;\n async search(query: string, options: SearchOptions & { outputType: 'structured' }): Promise<SearchStructuredResponse>;\n async search(query: string, options: SearchOptions): Promise<SearchResponse>;\n async search(query: string, options: SearchOptions = {}): Promise<SearchResponse> {\n const response = await searchWeb({\n client: this.getClient(),\n body: { ...options, q: query },\n throwOnError: true,\n });\n return response.data as SearchResponse;\n }\n\n /** Anything API (`POST /anything/start`). */\n get anything(): NotteAnything {\n return new NotteAnything(this);\n }\n\n /** Workspace secrets (`/secrets`). */\n get secrets(): NotteSecrets {\n return new NotteSecrets(this);\n }\n\n /** Managed authentication: verify connections, request login, and wait for readiness. */\n get managedAuth(): NotteManagedAuth {\n return new NotteManagedAuth(this);\n }\n\n /** Usage and billing (`/usage`, `/usage/logs`). */\n get usage(): NotteUsage {\n return new NotteUsage(this);\n }\n\n /**\n * Personas client for listing and managing personas\n */\n get personas() {\n const personas = this.resources.personas;\n return {\n ...personas,\n create: async (...args: Parameters<typeof personas.create>) =>\n withPersonaDefaults(await personas.create(...args)),\n get: async (...args: Parameters<typeof personas.get>) =>\n withPersonaDefaults(await personas.get(...args)),\n update: async (...args: Parameters<typeof personas.update>) =>\n withPersonaDefaults(await personas.update(...args)),\n list: async (options?: PersonaListOptions): Promise<PersonaResponse[]> => {\n const response = await listPersonas({\n client: this.getClient(),\n query: options || {},\n });\n return ((response.data as any)?.items || []).map(withPersonaDefaults);\n },\n };\n }\n\n /**\n * Get the configured client instance\n */\n getClient() {\n return this.client;\n }\n\n /** Client-bound profile API operations, generated from OpenAPI. */\n get profiles() {\n return this.resources.profiles;\n }\n\n /**\n * Scrape a webpage directly (without session).\n *\n * ```ts\n * const markdown = await client.scrape('https://www.notte.cc', { only_main_content: true });\n * const product = await client.scrape('https://www.notte.cc', { response_format: Product, instructions: 'Extract the product' });\n * ```\n *\n * With `response_format` or `instructions`, the extracted data is returned\n * directly and a failed extraction throws `ScrapeFailedError`. Pass\n * `raiseOnFailure: false` to receive the `StructuredData` wrapper instead.\n */\n async scrape(url: string, options?: GlobalScrapeOptions<unknown> & { response_format?: undefined; instructions?: undefined | null }): Promise<string>;\n async scrape<T>(url: string, options: GlobalScrapeOptions<T> & { response_format: ZodLikeSchema<T>; raiseOnFailure?: true }): Promise<T>;\n async scrape<T>(url: string, options: GlobalScrapeOptions<T> & { response_format: ZodLikeSchema<T>; raiseOnFailure: false }): Promise<StructuredData<T>>;\n async scrape(url: string, options: GlobalScrapeOptions<unknown>): Promise<ScrapeResult<unknown>>;\n async scrape<T = unknown>(url: string, options: GlobalScrapeOptions<T> = {}): Promise<ScrapeResult<T>> {\n const body = await buildScrapeBody(options);\n const response = await scrapeWebpage({\n client: this.getClient(),\n body: { url, ...body } as GlobalScrapeRequest,\n });\n return processScrapeResponse<T>(response.data, options);\n }\n\n /**\n * Get the client configuration\n */\n getConfig(): NotteClientConfig {\n return { ...this.config };\n }\n}\n\nfunction requestPath(request: Request | undefined, response?: Response): string {\n const url = request?.url ?? response?.url;\n if (!url) {\n return 'unknown';\n }\n try {\n return new URL(url).pathname;\n } catch {\n return url;\n }\n}\n\nfunction isTimeoutAbort(error: unknown): boolean {\n return typeof error === 'object' && error !== null && (error as { name?: string }).name === 'TimeoutError';\n}\n\nfunction timeoutReason(timeoutMs: number): DOMException {\n return new DOMException(`timed out after ${timeoutMs}ms`, 'TimeoutError');\n}\n\n// Keep the signal available for typed error mapping even after releasing the\n// timer. Weak keys let completed requests (and their signals) be collected.\nconst pendingRequests = new WeakMap<Request, Deadline>();\nconst originalTransports = new WeakMap<object, typeof fetch>();\n\nfunction requestSignal(request: Request): AbortSignal {\n return pendingRequests.get(request)?.signal ?? request.signal;\n}\n\nfunction releaseDeadline(request: Request | undefined): void {\n if (request) pendingRequests.get(request)?.release();\n}\n\ninterface Deadline {\n signal: AbortSignal;\n /** Clear the timer and detach from the caller's signal. Idempotent. */\n release: () => void;\n /** When the deadline fires, in ms since the epoch. */\n expiresAt: number;\n}\n\n/**\n * Combine the caller's signal with a deadline. `AbortSignal.any` (Node 20.3+)\n * lets the runtime drop the composite signal once the request settles, so a\n * long-lived caller signal never accumulates listeners.\n */\nfunction withTimeout(signal: AbortSignal | null | undefined, timeoutMs: number): Deadline {\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(timeoutReason(timeoutMs)), timeoutMs);\n const expiresAt = Date.now() + timeoutMs;\n timer.unref?.();\n let detach: () => void = () => undefined;\n let composite: AbortSignal;\n\n const signalAny = (AbortSignal as unknown as { any?: (signals: AbortSignal[]) => AbortSignal }).any;\n if (typeof signalAny === 'function') {\n composite = signalAny.call(AbortSignal, signal ? [signal, controller.signal] : [controller.signal]);\n } else {\n // Fallback for runtimes without AbortSignal.any.\n composite = controller.signal;\n if (signal) {\n if (signal.aborted) {\n controller.abort(signal.reason);\n } else {\n const forward = () => controller.abort(signal.reason);\n signal.addEventListener('abort', forward, { once: true });\n detach = () => signal.removeEventListener('abort', forward);\n }\n }\n }\n\n let released = false;\n const release = () => {\n if (released) return;\n released = true;\n clearTimeout(timer);\n detach();\n };\n composite.addEventListener('abort', release, { once: true });\n return { signal: composite, release, expiresAt };\n}\n","/**\n * Typed action builders, the counterpart of `notte_sdk.actions` in Python.\n *\n * Every builder returns the exact member of the `ExecuteAction` union that\n * `session.execute()` accepts, with `type` already set:\n *\n * ```ts\n * import { actions } from 'notte-sdk';\n *\n * await session.execute(actions.goto({ url: 'https://www.notte.cc' }));\n * await session.execute(actions.fill({ id: 'I1', value: 'user@example.com' }));\n * await session.execute(actions.goBack());\n * ```\n */\nimport type {\n PageExecuteData,\n ScrollDownAction as GeneratedScrollDownAction,\n ScrollUpAction as GeneratedScrollUpAction,\n} from '@/lib/client/types.gen';\n\n// Keep additions for the local browser runtime in the handwritten SDK layer\n// until the deployed schema includes them. Generated files must match staging.\n/** Scroll down on the page or in a selected container. */\nexport type ScrollDownAction = GeneratedScrollDownAction & {\n /** Optional selector for the scroll container, including iframe paths. */\n selector?: string | null;\n};\n\n/** Scroll up on the page or in a selected container. */\nexport type ScrollUpAction = GeneratedScrollUpAction & {\n /** Optional selector for the scroll container, including iframe paths. */\n selector?: string | null;\n};\n\n/** Discriminated union of every action `session.execute()` accepts. */\nexport type ExecuteAction =\n | Exclude<PageExecuteData['body'], { type: 'scroll_up' | 'scroll_down' }>\n | ({ type: 'scroll_up' } & ScrollUpAction)\n | ({ type: 'scroll_down' } & ScrollDownAction);\n\n/** The `type` discriminator of an `ExecuteAction`. */\nexport type ActionType = ExecuteAction['type'];\n\n/** The union member whose `type` is `T`. */\nexport type ActionOfType<T extends ActionType> = Extract<ExecuteAction, { type: T }>;\n\n/** The fields of an action minus its `type` discriminator. */\nexport type ActionInput<T extends ActionType> = Omit<ActionOfType<T>, 'type'>;\n\n/** Builders take an optional argument when every field of the action is optional. */\ntype BuilderArgs<T extends ActionType> = Record<never, never> extends ActionInput<T>\n ? [input?: ActionInput<T>]\n : [input: ActionInput<T>];\n\nfunction builder<T extends ActionType>(type: T): (...args: BuilderArgs<T>) => ActionOfType<T> {\n return (...[input]: BuilderArgs<T>): ActionOfType<T> => ({ ...(input ?? {}), type }) as ActionOfType<T>;\n}\n\n// Browser actions\nexport const goto = builder('goto');\nexport const gotoNewTab = builder('goto_new_tab');\nexport const closeTab = builder('close_tab');\nexport const switchTab = builder('switch_tab');\nexport const goBack = builder('go_back');\nexport const goForward = builder('go_forward');\nexport const reload = builder('reload');\nexport const wait = builder('wait');\nexport const pressKey = builder('press_key');\nexport const scrollUp = builder('scroll_up');\nexport const scrollDown = builder('scroll_down');\nexport const captchaSolve = builder('captcha_solve');\nexport const help = builder('help');\nexport const completion = builder('completion');\nexport const scrape = builder('scrape');\nexport const emailRead = builder('email_read');\nexport const emailVerificationRead = builder('email_verification_read');\nexport const smsRead = builder('sms_read');\nexport const evaluateJs = builder('evaluate_js');\nexport const formFill = builder('form_fill');\n\n// Interaction actions (need an element `id` from `observe()` or a `selector`)\nexport const click = builder('click');\nexport const fill = builder('fill');\nexport const multiFactorFill = builder('multi_factor_fill');\nexport const fallbackFill = builder('fallback_fill');\nexport const check = builder('check');\nexport const selectDropdownOption = builder('select_dropdown_option');\nexport const uploadFile = builder('upload_file');\nexport const downloadFile = builder('download_file');\n\n/** Namespace object mirroring `from notte_sdk import actions`. */\nexport const actions = {\n goto,\n gotoNewTab,\n closeTab,\n switchTab,\n goBack,\n goForward,\n reload,\n wait,\n pressKey,\n scrollUp,\n scrollDown,\n captchaSolve,\n help,\n completion,\n scrape,\n emailRead,\n emailVerificationRead,\n smsRead,\n evaluateJs,\n formFill,\n click,\n fill,\n multiFactorFill,\n fallbackFill,\n check,\n selectDropdownOption,\n uploadFile,\n downloadFile,\n} as const;\n\n/** True when the action is a captcha solve, which gets a longer request timeout and 408 retries. */\nexport function isCaptchaSolveAction(action: ExecuteAction): action is ActionOfType<'captcha_solve'> {\n return action.type === 'captcha_solve';\n}\n","/**\n * Error class for authentication/authorization failures in the proxy.\n * Throw this from `authenticate()` to return a 401 response.\n *\n * @example\n * ```typescript\n * authenticate: async (request) => {\n * const session = await getSession(request);\n * if (!session) throw new NotteProxyAuthError('Not logged in');\n * }\n * ```\n */\nexport class NotteProxyAuthError extends Error {\n constructor(message = 'Unauthorized') {\n super(message);\n this.name = 'NotteProxyAuthError';\n }\n}\n\n/**\n * Configuration for the Notte API proxy.\n *\n * The proxy forwards incoming HTTP requests to the Notte API,\n * injecting authentication headers server-side so the API key\n * is never exposed to the client.\n */\nexport interface NotteProxyConfig {\n /**\n * The Notte API key to use for all forwarded requests.\n * Falls back to the NOTTE_API_KEY environment variable when omitted.\n * Can be overridden per-request by returning a string from `authenticate`.\n */\n apiKey?: string;\n\n /**\n * Base URL of the Notte API.\n * @default 'https://api.notte.cc'\n */\n apiUrl?: string;\n\n /**\n * Authenticate and authorize incoming requests. Missing callbacks fail closed (401).\n * Check resource ownership as well as caller identity. With a shared key, every\n * authorized caller otherwise has access to the same account resources.\n *\n * - Throw a `NotteProxyAuthError` to reject the request (returns 401).\n * - Return `void` to allow the request through using the default `apiKey`.\n * - Return a `string` to override the API key for this specific request\n * (useful for per-user API keys).\n */\n authenticate?: (request: Request) => Promise<void | string>;\n\n /**\n * Allowed API endpoint patterns for path validation (SSRF prevention).\n *\n * - `undefined` (default): uses the built-in allowlist derived from the OpenAPI spec.\n * - `RegExp[]`: custom list of allowed patterns.\n * - `false`: disables path validation entirely (not recommended for public-facing proxies).\n */\n allowedPatterns?: RegExp[] | false;\n\n /**\n * Value for the `x-notte-request-origin` header sent to the Notte API.\n * @default 'sdk-proxy'\n */\n requestOrigin?: string;\n\n /**\n * List of header names to forward from the incoming request to the Notte API.\n * @default ['content-type', 'accept']\n */\n forwardHeaders?: string[];\n\n /**\n * Optional hook called just before the request is forwarded to the Notte API.\n * Use this to modify outgoing headers, log requests, etc.\n */\n onBeforeRequest?: (ctx: {\n path: string;\n method: string;\n headers: Headers;\n url: string;\n incomingRequest: Request;\n }) => Promise<void> | void;\n}\n","export { checkForLatestVersion, startVersionCheck } from '@/version-check';\n\n// Re-export all generated types and services\nexport * from '@/lib/client/types.gen';\nexport * from '@/lib/client/sdk.gen';\n\n// Preserve public names when generated operation and model names change.\nimport type { WaitActionOutput } from '@/lib/client/types.gen';\nexport type WaitAction = WaitActionOutput;\nexport { retry as retryWebhookDelivery } from '@/lib/client/sdk.gen';\nexport { fetchSpecializedData as scrapeSpecializedData } from '@/lib/client/sdk.gen';\nexport type {\n FetchSpecializedDataData as ScrapeSpecializedDataData,\n FetchSpecializedDataError as ScrapeSpecializedDataError,\n FetchSpecializedDataErrors as ScrapeSpecializedDataErrors,\n FetchSpecializedDataResponse as ScrapeSpecializedDataResponse,\n FetchSpecializedDataResponses as ScrapeSpecializedDataResponses,\n} from '@/lib/client/types.gen';\n\n// Re-export client for direct access\nexport { client } from '@/lib/client/client.gen';\n\n// Export main SDK classes\nexport { NotteClient, DEFAULT_NOTTE_API_URL, DEFAULT_REQUEST_TIMEOUT_MS, TIMEOUT_HEADER } from '@/client';\nexport { Session } from '@/session';\nexport type { ResourceRequestOptions } from '@/resources.gen';\nexport { NotteVault } from '@/vaults';\nexport { NottePersona } from '@/personas';\nexport { NotteFunction } from '@/functions';\nexport { Encryption } from '@/encryption';\nexport { SessionFiles, RemoteFileStorage, FileNotFoundError, FileExistsError, sanitizeFilename } from '@/files';\nexport type { FileSource, SessionFile, SessionFilesPage, FileListOptions, FileDownloadOptions, UploadableFile } from '@/files';\n\n// Errors and helpers\nexport {\n NotteError,\n NotteAPIError,\n NotteAPIExecutionError,\n AuthenticationError,\n InvalidRequestError,\n NotteTimeoutError,\n FailedToRunCloudFunctionError,\n ScrapeFailedError,\n ActionExecutionError,\n EvaluateJsNoDataError,\n FetchResponseDecodeError,\n retry,\n} from '@/errors';\nexport type { NotteAPIErrorBody, RetryOptions } from '@/errors';\nexport { DEFAULT_MAX_RETRIES } from '@/retry';\n\n// Scrape helpers shared by `client.scrape()` and `session.scrape()`\nexport { processScrapeResponse } from '@/scrape';\nexport type { ScrapeOptions, ScrapeResult, SessionScrapeOptions, StructuredData, ZodLikeSchema } from '@/scrape';\n\n// Export types\nexport type {\n NotteClientConfig,\n GlobalScrapeOptions,\n SessionListOptions,\n VaultListOptions,\n FunctionListOptions,\n} from '@/client';\nexport type {\n SessionOptions,\n ExecuteOptions,\n ReplayOptions,\n SaveProfileOptions,\n SessionScriptOptions,\n PerceptionType,\n SessionCloseReason,\n} from '@/session';\nexport {\n CLUSTER_OVERLOAD_RETRY_DELAY_MS,\n SESSION_START_TRIES,\n CAPTCHA_SOLVE_TIMEOUT_MS,\n observeServerOwnedDialog,\n installServerOwnedDialogPolicy,\n} from '@/session';\n\n// Typed actions for `session.execute()` (`import { actions } from 'notte-sdk'`)\nexport { actions, isCaptchaSolveAction } from '@/actions';\nexport type { ExecuteAction, ActionType, ActionOfType, ActionInput, ScrollUpAction, ScrollDownAction } from '@/actions';\n\n// In-page fetch helpers used by `session.fetch()`\nexport { PageFetchResponse, PageFetchHTTPError, buildFetchScript, responseFromEvaluated } from '@/page-fetch';\nexport type { PageFetchOptions, FetchData } from '@/page-fetch';\n\n// Cookie file helpers\nexport { readCookiesFile, createOrAppendCookiesToFile } from '@/cookies';\nexport type { VaultConstructor, VaultConstructorWithId, VaultConstructorCreate, CredentialField } from '@/vaults';\nexport { getRootDomain, validateUrl, validateMfaSecret, isValidMfaSecret, validateCredentials, CREDENTIAL_FIELDS } from '@/vaults';\nexport type { PersonaConstructor, MessageReadOptions, PersonaListOptions, PersonaResponseWithInternalEmail } from '@/personas';\nexport type {\n FunctionConstructor,\n FunctionConstructorWithId,\n FunctionConstructorCreate,\n FunctionRuntime,\n FunctionRunStatus,\n GetFunctionRunResponse,\n GetFunctionRunResponseWritable,\n FunctionRunUpdateRequest,\n FunctionRunResponse,\n FunctionRunOptions,\n FunctionRunStartResult,\n FunctionRunResult,\n FunctionRunCreateResult,\n FunctionRunCreateOptions,\n FunctionRunListOptions,\n FunctionGetOptions,\n FunctionUpdateOptions,\n FunctionMetadataUpdateOptions,\n FunctionScheduleOptions,\n FunctionRollbackOptions,\n FunctionUrlOptions,\n FunctionDownloadOptions,\n} from '@/functions';\nexport { FUNCTION_RUN_TIMEOUT_MS, FUNCTION_RUN_ENDPOINTS, RUN_API_KEY_HEADER } from '@/functions';\n\n// Top-level API wrappers\nexport type {\n SearchOptions,\n SearchResponse,\n SearchResultItem,\n SearchResultsResponse,\n SearchSource,\n SearchSourcedAnswerResponse,\n SearchStructuredResponse,\n} from '@/search';\nexport { NotteAnything } from '@/anything';\nexport type { AnythingStartOptions, AnythingStartResult, AnythingStreamChunk } from '@/anything';\nexport { NotteSecrets } from '@/secrets';\nexport type { SecretListOptions, SecretStoreOptions } from '@/secrets';\nexport { NotteUsage } from '@/usage';\nexport type { UsageOptions, UsageLogsOptions, UsageLogEndpoint } from '@/usage';\n\n// Export proxy types and errors (the proxy module itself is available via 'notte-sdk/next' and 'notte-sdk/proxy')\nexport type { NotteProxyConfig } from '@/proxy/types';\nexport { NotteProxyAuthError } from '@/proxy/types';\n\n// Create a configured client instance (legacy support)\nimport { createClient as createGeneratedClient } from '@/lib/client/client';\nimport { DEFAULT_NOTTE_API_URL as DEFAULT_API_URL } from '@/client';\n\nexport const createClient = (config?: { baseUrl?: string; token?: string }) => {\n const client = createGeneratedClient({ baseUrl: config?.baseUrl || DEFAULT_API_URL });\n if (config?.baseUrl) {\n client.setConfig({ baseUrl: config.baseUrl });\n }\n\n if (config?.token) {\n client.interceptors.request.use((request: any) => {\n request.headers.set('Authorization', `Bearer ${config.token}`);\n return request;\n });\n }\n\n return client;\n};\n\n// Default export - NotteClient for convenience\nexport { NotteClient as default } from '@/client';\n\nexport type { CaptchaStatus, CaptchaExecutionResponse } from '@/captcha';\nexport { NotteManagedAuth, ManagedAuthError } from '@/managed-auth';\nexport type { AuthSessionResponse as SessionResponse, AuthSessionResponse, ManagedAuthOperation, ManagedAuthReadiness, ManagedAuthRunResponse, AuthWaitOptions, ManagedAuthRunOptions } from '@/managed-auth';\nexport type { SessionStartOptions } from '@/session';\n"],"mappings":";AAKO,IAAM,cAAsB,OAAyC,WAAkB;AACvF,IAAM,mBACX,OAA8C,cAAuB;;;ACLvE,IAAM,cAAc;AACpB,IAAM,2BAA2B;AAmBjC,IAAI,wBAAwB;AAC5B,IAAI;AAOG,SAAS,oBAA0B;AACxC,MAAI,yBAAyB,CAAC,mBAAmB,GAAG;AAClD;AAAA,EACF;AACA,0BAAwB;AAExB,QAAM,QAAQ,WAAW,MAAM;AAC7B,SAAK,sBAAsB,EAAE,MAAM,MAAM,MAAS;AAAA,EACpD,GAAG,CAAC;AACJ,QAAM,QAAQ;AAChB;AAQO,SAAS,eAAe,SAAiB,QAAyB;AACvE,SAAO,iBAAiB,QAAQ,OAAO;AACzC;AAMO,SAAS,kBAAkB,iBAAyB,aAAiC;AAC1F,MAAI,CAAC,uBAAuB,CAAC,mBAAmB,cAAc,GAAG;AAC/D,WAAO;AAAA,EACT;AACA,SAAO,eAAe,gBAAgB,mBAAmB,IAAI,sBAAsB;AACrF;AAEO,SAAS,0BACd,cACA,eACA,eACA,iBAAyB,aACzB,cAAsB,kBACd;AACR,MAAI,UACF,GAAG,YAAY,mEACS,cAAc,uBAAuB,aAAa,6FAEvE,WAAW,qCAAqC,WAAW,IAAI,aAAa;AACjF,MAAI,eAAe;AACjB,eAAW,qBAAqB,aAAa;AAAA,EAC/C;AACA,SAAO;AACT;AAEA,eAAsB,sBAAsB,UAA+B,CAAC,GAAkB;AAC5F,QAAM,iBAAiB,QAAQ,kBAAkB;AACjD,QAAM,cAAc,QAAQ,eAAe;AAC3C,QAAM,UAAU,QAAQ,WAAW,WAAW;AAC9C,QAAM,SAAS,QAAQ,UAAU,QAAQ;AACzC,QAAM,MAAM,QAAQ,OAAO,OAAO;A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AAa,QAAQ,IAAI,CAAC,YAAiB;AAChD,cAAQ,QAAQ,IAAI,iBAAiB,UAAU,OAAO,KAAK,EAAE;AAC7D,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAEA,SAAOA;AACT;","names":["sleep","resolve","joinedValues","config","request","url","detail","retry","resolve","client","client","writeFile","resolve","delay","wait","delay","resolve","client","wait","resolve","writeFile","delay","client","client","readFile","writeFile","client","value","client","writeFile","readFile","readFile","basename","client","readFile","basename","client","client","client","NotteClient","timeoutMs","headers","createClient","client"]}