browser-use-sdk 3.3.0 → 3.3.1
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.
- package/dist/chunk-RIRVOEIU.cjs.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -8
- package/dist/index.d.ts +33 -8
- package/dist/index.js.map +1 -1
- package/dist/v3.cjs.map +1 -1
- package/dist/v3.d.cts +40 -1
- package/dist/v3.d.ts +40 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/
|
|
1
|
+
{"version":3,"sources":["/Users/sauravpanda/Github/LLMs/Browser-Use/sdk/browser-use-node/dist/chunk-RIRVOEIU.cjs","../src/core/errors.ts","../src/core/http.ts"],"names":[],"mappings":"AAAA;ACAO,IAAM,gBAAA,EAAN,MAAA,QAA8B,MAAM;AAAA,EAChC;AAAA,EACA;AAAA,EAET,WAAA,CAAY,UAAA,EAAoB,OAAA,EAAiB,MAAA,EAAkB;AACjE,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,KAAA,EAAO,iBAAA;AACZ,IAAA,IAAA,CAAK,WAAA,EAAa,UAAA;AAClB,IAAA,IAAA,CAAK,OAAA,EAAS,MAAA;AAAA,EAChB;AACF,CAAA;ADCA;AACA;AEHO,IAAM,WAAA,EAAN,MAAiB;AAAA,EACL;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEjB,WAAA,CAAY,OAAA,EAA4B;AACtC,IAAA,IAAA,CAAK,OAAA,EAAS,OAAA,CAAQ,MAAA;AACtB,IAAA,IAAA,CAAK,QAAA,EAAU,OAAA,CAAQ,OAAA,CAAQ,OAAA,CAAQ,MAAA,EAAQ,EAAE,CAAA;AACjD,IAAA,IAAA,CAAK,WAAA,mBAAa,OAAA,CAAQ,UAAA,UAAc,GAAA;AACxC,IAAA,IAAA,CAAK,QAAA,mBAAU,OAAA,CAAQ,OAAA,UAAW,KAAA;AAAA,EACpC;AAAA,EAEA,MAAM,OAAA,CACJ,MAAA,EACA,IAAA,EACA,OAAA,EAKY;AACZ,IAAA,MAAM,IAAA,EAAM,IAAI,GAAA,CAAI,CAAA,EAAA;AACA,IAAA;AACD,MAAA;AACD,QAAA;AACR,UAAA;AACN,QAAA;AACF,MAAA;AACF,IAAA;AAEwC,IAAA;AACtC,MAAA;AACF,IAAA;AACa,IAAA;AACH,MAAA;AACV,IAAA;AAEmB,IAAA;AACA,MAAA;AACD,QAAA;AACJ,QAAA;AACZ,MAAA;AAEmB,MAAA;AACD,MAAA;AAKH,MAAA;AAEX,MAAA;AACe,QAAA;AACf,UAAA;AACA,UAAA;AACe,UAAA;AACf,UAAA;AACD,QAAA;AAEY,QAAA;AAEI,QAAA;AACF,UAAA;AACJ,YAAA;AACT,UAAA;AACc,UAAA;AAChB,QAAA;AAEM,QAAA;AAIW,QAAA;AACf,UAAA;AACF,QAAA;AAEI,QAAA;AACA,QAAA;AACU,UAAA;AACN,QAAA;AAER,QAAA;AAEE,QAAA;AAEmB,UAAA;AAMP,QAAA;AACJ,QAAA;AACI,MAAA;AACD,QAAA;AACP,QAAA;AACR,MAAA;AACF,IAAA;AAEgB,IAAA;AAClB,EAAA;AAEkE,EAAA;AACzC,IAAA;AACzB,EAAA;AAEsC,EAAA;AACb,IAAA;AACzB,EAAA;AAEuC,EAAA;AACd,IAAA;AACzB,EAAA;AAEqE,EAAA;AAC5C,IAAA;AACzB,EAAA;AACF;AFjCyB;AACA;AACA;AACA;AACA","file":"/Users/sauravpanda/Github/LLMs/Browser-Use/sdk/browser-use-node/dist/chunk-RIRVOEIU.cjs","sourcesContent":[null,"export class BrowserUseError extends Error {\n readonly statusCode: number;\n readonly detail: unknown;\n\n constructor(statusCode: number, message: string, detail?: unknown) {\n super(message);\n this.name = \"BrowserUseError\";\n this.statusCode = statusCode;\n this.detail = detail;\n }\n}\n","import { BrowserUseError } from \"./errors.js\";\n\nexport interface HttpClientOptions {\n apiKey: string;\n baseUrl: string;\n maxRetries?: number;\n timeout?: number;\n}\n\nexport class HttpClient {\n private readonly apiKey: string;\n private readonly baseUrl: string;\n private readonly maxRetries: number;\n private readonly timeout: number;\n\n constructor(options: HttpClientOptions) {\n this.apiKey = options.apiKey;\n this.baseUrl = options.baseUrl.replace(/\\/+$/, \"\");\n this.maxRetries = options.maxRetries ?? 3;\n this.timeout = options.timeout ?? 30_000;\n }\n\n async request<T>(\n method: string,\n path: string,\n options?: {\n body?: unknown;\n query?: Record<string, unknown>;\n signal?: AbortSignal;\n },\n ): Promise<T> {\n const url = new URL(`${this.baseUrl}${path}`);\n if (options?.query) {\n for (const [key, value] of Object.entries(options.query)) {\n if (value !== undefined && value !== null) {\n url.searchParams.set(key, String(value));\n }\n }\n }\n\n const headers: Record<string, string> = {\n \"X-Browser-Use-API-Key\": this.apiKey,\n };\n if (options?.body !== undefined) {\n headers[\"Content-Type\"] = \"application/json\";\n }\n\n for (let attempt = 0; attempt <= this.maxRetries; attempt++) {\n if (attempt > 0) {\n const delay = Math.min(1000 * 2 ** (attempt - 1), 10_000);\n await new Promise((resolve) => setTimeout(resolve, delay));\n }\n\n const controller = new AbortController();\n const timeoutId = options?.signal\n ? undefined\n : setTimeout(() => controller.abort(), this.timeout);\n\n // Combine user signal with internal timeout when both are present\n const signal = options?.signal ?? controller.signal;\n\n try {\n const response = await fetch(url.toString(), {\n method,\n headers,\n body: options?.body !== undefined ? JSON.stringify(options.body) : undefined,\n signal,\n });\n\n clearTimeout(timeoutId);\n\n if (response.ok) {\n if (response.status === 204) {\n return undefined as T;\n }\n return (await response.json()) as T;\n }\n\n const shouldRetry =\n response.status === 429 &&\n attempt < this.maxRetries;\n\n if (shouldRetry) {\n continue;\n }\n\n let errorBody: unknown;\n try {\n errorBody = await response.json();\n } catch {\n /* ignore parse errors */\n }\n const message =\n typeof errorBody === \"object\" && errorBody !== null\n ? String(\n \"message\" in errorBody\n ? (errorBody as Record<string, unknown>).message\n : \"detail\" in errorBody\n ? (errorBody as Record<string, unknown>).detail\n : `HTTP ${response.status}`,\n )\n : `HTTP ${response.status}`;\n throw new BrowserUseError(response.status, message, errorBody);\n } catch (error) {\n clearTimeout(timeoutId);\n throw error;\n }\n }\n\n throw new Error(\"Unreachable: retry loop exhausted\");\n }\n\n get<T>(path: string, query?: Record<string, unknown>): Promise<T> {\n return this.request<T>(\"GET\", path, { query });\n }\n\n post<T>(path: string, body?: unknown, query?: Record<string, unknown>): Promise<T> {\n return this.request<T>(\"POST\", path, { body, query });\n }\n\n patch<T>(path: string, body?: unknown, query?: Record<string, unknown>): Promise<T> {\n return this.request<T>(\"PATCH\", path, { body, query });\n }\n\n delete<T>(path: string, query?: Record<string, unknown>): Promise<T> {\n return this.request<T>(\"DELETE\", path, { query });\n }\n}\n"]}
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/larsencundric/Documents/browser-use/sdk/browser-use-node/dist/index.cjs","../src/v2/client.ts","../src/v2/resources/billing.ts","../src/v2/resources/browsers.ts","../src/v2/resources/files.ts","../src/v2/resources/marketplace.ts","../src/v2/resources/profiles.ts","../src/v2/resources/sessions.ts","../src/v2/resources/skills.ts","../src/v2/helpers.ts","../src/v2/resources/tasks.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACLA,0BAAkB;ADOlB;AACA;AEHO,IAAM,QAAA,EAAN,MAAc;AAAA,EACnB,WAAA,CAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,KAAA,EAAA,IAAA;AAAA,EAAmB;AAAA;AAAA,EAGhD,OAAA,CAAA,EAAgC;AAC9B,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAiB,kBAAkB,CAAA;AAAA,EACtD;AACF,CAAA;AFMA;AACA;AGHO,IAAM,SAAA,EAAN,MAAe;AAAA,EACpB,WAAA,CAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAA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,EAAA;AACZ,IAAA;AACvD,EAAA;AAAA;AAGwC,EAAA;AACM,IAAA;AAC9C,EAAA;AAAA;AAGsD,EAAA;AACf,IAAA;AACvC,EAAA;AAAA;AAGgD,EAAA;AACO,IAAA;AACvD,EAAA;AAAA;AAGmD,EAAA;AACgB,IAAA;AACnE,EAAA;AAAA;AAG8F,EAAA;AAC3D,IAAA;AACE,IAAA;AACL,IAAA;AAEA,IAAA;AACW,MAAA;AACG,MAAA;AAClB,QAAA;AACxB,MAAA;AACsC,MAAA;AAClB,MAAA;AACmB,MAAA;AACzC,IAAA;AAE8B,IAAA;AAChC,EAAA;AACF;AViSgD;AACA;ACxWvB;AAYD;AACb,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AAEQ,EAAA;AAE4B,EAAA;AAEf,IAAA;AACf,IAAA;AACD,MAAA;AACR,QAAA;AACF,MAAA;AACF,IAAA;AAC2B,IAAA;AACzB,MAAA;AAC4B,MAAA;AACR,MAAA;AACH,MAAA;AAClB,IAAA;AAEmC,IAAA;AACJ,IAAA;AACM,IAAA;AACN,IAAA;AACM,IAAA;AACA,IAAA;AACJ,IAAA;AACU,IAAA;AAC9C,EAAA;AAoB0D,EAAA;AACb,IAAA;AACE,IAAA;AACjC,IAAA;AAC+B,MAAA;AAC3C,IAAA;AACsC,IAAA;AACE,IAAA;AAC1C,EAAA;AACF;ADwUgD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/Users/larsencundric/Documents/browser-use/sdk/browser-use-node/dist/index.cjs","sourcesContent":[null,"import { z } from \"zod\";\nimport { HttpClient } from \"../core/http.js\";\nimport { Billing } from \"./resources/billing.js\";\nimport { Browsers } from \"./resources/browsers.js\";\nimport { Files } from \"./resources/files.js\";\nimport { Marketplace } from \"./resources/marketplace.js\";\nimport { Profiles } from \"./resources/profiles.js\";\nimport { Sessions } from \"./resources/sessions.js\";\nimport { Skills } from \"./resources/skills.js\";\nimport { Tasks } from \"./resources/tasks.js\";\nimport { TaskRun } from \"./helpers.js\";\nimport type { CreateTaskBody } from \"./resources/tasks.js\";\nimport type { RunOptions } from \"./helpers.js\";\n\nconst DEFAULT_BASE_URL = \"https://api.browser-use.com/api/v2\";\n\nexport interface BrowserUseOptions {\n apiKey?: string;\n baseUrl?: string;\n maxRetries?: number;\n timeout?: number;\n}\n\nexport type RunTaskOptions = Partial<Omit<CreateTaskBody, \"task\">> &\n RunOptions & { schema?: z.ZodType };\n\nexport class BrowserUse {\n readonly billing: Billing;\n readonly tasks: Tasks;\n readonly sessions: Sessions;\n readonly files: Files;\n readonly profiles: Profiles;\n readonly browsers: Browsers;\n readonly skills: Skills;\n readonly marketplace: Marketplace;\n\n private readonly http: HttpClient;\n\n constructor(options: BrowserUseOptions = {}) {\n const apiKey =\n options.apiKey ?? process.env.BROWSER_USE_API_KEY ?? \"\";\n if (!apiKey) {\n throw new Error(\n \"No API key provided. Pass apiKey or set BROWSER_USE_API_KEY.\",\n );\n }\n this.http = new HttpClient({\n apiKey,\n baseUrl: options.baseUrl ?? DEFAULT_BASE_URL,\n maxRetries: options.maxRetries,\n timeout: options.timeout,\n });\n\n this.billing = new Billing(this.http);\n this.tasks = new Tasks(this.http);\n this.sessions = new Sessions(this.http);\n this.files = new Files(this.http);\n this.profiles = new Profiles(this.http);\n this.browsers = new Browsers(this.http);\n this.skills = new Skills(this.http);\n this.marketplace = new Marketplace(this.http);\n }\n\n /**\n * Run an AI agent task.\n *\n * ```ts\n * // Simple — just get the output\n * const output = await client.run(\"Find the top HN post\");\n *\n * // Structured output (Zod)\n * const data = await client.run(\"Find product info\", { schema: ProductSchema });\n *\n * // Step-by-step progress\n * for await (const step of client.run(\"Go to google.com\")) {\n * console.log(`[${step.number}] ${step.nextGoal}`);\n * }\n * ```\n */\n run(task: string, options?: Omit<RunTaskOptions, \"schema\">): TaskRun<string>;\n run<T extends z.ZodType>(task: string, options: RunTaskOptions & { schema: T }): TaskRun<z.output<T>>;\n run(task: string, options?: RunTaskOptions): TaskRun<any> {\n const { schema, timeout, interval, ...rest } = options ?? {};\n const body: CreateTaskBody = { task, ...rest };\n if (schema) {\n body.structuredOutput = JSON.stringify(z.toJSONSchema(schema));\n }\n const promise = this.tasks.create(body);\n return new TaskRun(promise, this.tasks, schema, { timeout, interval });\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\ntype AccountView = components[\"schemas\"][\"AccountView\"];\n\nexport class Billing {\n constructor(private readonly http: HttpClient) {}\n\n /** Get authenticated account billing information including credit balance. */\n account(): Promise<AccountView> {\n return this.http.get<AccountView>(\"/billing/account\");\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\n/** All fields are optional (server applies defaults); body itself is required by the spec. */\nexport type CreateBrowserBody = Partial<components[\"schemas\"][\"CreateBrowserSessionRequest\"]>;\ntype BrowserSessionItemView = components[\"schemas\"][\"BrowserSessionItemView\"];\ntype BrowserSessionListResponse = components[\"schemas\"][\"BrowserSessionListResponse\"];\ntype BrowserSessionView = components[\"schemas\"][\"BrowserSessionView\"];\ntype UpdateBrowserSessionRequest = components[\"schemas\"][\"UpdateBrowserSessionRequest\"];\n\nexport interface BrowserListParams {\n pageSize?: number;\n pageNumber?: number;\n filterBy?: string;\n}\n\nexport class Browsers {\n constructor(private readonly http: HttpClient) {}\n\n /** Create a new browser session. */\n create(body: CreateBrowserBody = {}): Promise<BrowserSessionItemView> {\n return this.http.post<BrowserSessionItemView>(\"/browsers\", body);\n }\n\n /** List browser sessions with optional filtering. */\n list(params?: BrowserListParams): Promise<BrowserSessionListResponse> {\n return this.http.get<BrowserSessionListResponse>(\n \"/browsers\",\n params as Record<string, unknown>,\n );\n }\n\n /** Get detailed browser session information. */\n get(sessionId: string): Promise<BrowserSessionView> {\n return this.http.get<BrowserSessionView>(`/browsers/${sessionId}`);\n }\n\n /** Update a browser session (generic PATCH). */\n update(sessionId: string, body: UpdateBrowserSessionRequest): Promise<BrowserSessionView> {\n return this.http.patch<BrowserSessionView>(`/browsers/${sessionId}`, body);\n }\n\n /** Stop a browser session. */\n stop(sessionId: string): Promise<BrowserSessionView> {\n return this.update(sessionId, { action: \"stop\" });\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\ntype UploadFileRequest = components[\"schemas\"][\"UploadFileRequest\"];\ntype UploadFilePresignedUrlResponse = components[\"schemas\"][\"UploadFilePresignedUrlResponse\"];\ntype TaskOutputFileResponse = components[\"schemas\"][\"TaskOutputFileResponse\"];\n\nexport class Files {\n constructor(private readonly http: HttpClient) {}\n\n /** Generate a presigned URL for uploading files to an agent session. */\n sessionUrl(sessionId: string, body: UploadFileRequest): Promise<UploadFilePresignedUrlResponse> {\n return this.http.post<UploadFilePresignedUrlResponse>(\n `/files/sessions/${sessionId}/presigned-url`,\n body,\n );\n }\n\n /** Generate a presigned URL for uploading files to a browser session. */\n browserUrl(sessionId: string, body: UploadFileRequest): Promise<UploadFilePresignedUrlResponse> {\n return this.http.post<UploadFilePresignedUrlResponse>(\n `/files/browsers/${sessionId}/presigned-url`,\n body,\n );\n }\n\n /** Get secure download URL for a task output file. */\n taskOutput(taskId: string, fileId: string): Promise<TaskOutputFileResponse> {\n return this.http.get<TaskOutputFileResponse>(\n `/files/tasks/${taskId}/output-files/${fileId}`,\n );\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\ntype ExecuteSkillRequest = components[\"schemas\"][\"ExecuteSkillRequest\"];\ntype ExecuteSkillResponse = components[\"schemas\"][\"ExecuteSkillResponse\"];\ntype MarketplaceSkillListResponse = components[\"schemas\"][\"MarketplaceSkillListResponse\"];\ntype MarketplaceSkillResponse = components[\"schemas\"][\"MarketplaceSkillResponse\"];\ntype SkillResponse = components[\"schemas\"][\"SkillResponse\"];\n\nexport interface MarketplaceListParams {\n pageSize?: number;\n pageNumber?: number;\n query?: string;\n category?: string;\n fromDate?: string;\n toDate?: string;\n}\n\nexport class Marketplace {\n constructor(private readonly http: HttpClient) {}\n\n /** List all public skills in the marketplace. */\n list(params?: MarketplaceListParams): Promise<MarketplaceSkillListResponse> {\n return this.http.get<MarketplaceSkillListResponse>(\n \"/marketplace/skills\",\n params as Record<string, unknown>,\n );\n }\n\n /** Get details of a specific marketplace skill by slug. */\n get(skillSlug: string): Promise<MarketplaceSkillResponse> {\n return this.http.get<MarketplaceSkillResponse>(`/marketplace/skills/${skillSlug}`);\n }\n\n /** Clone a public marketplace skill to your project. */\n clone(skillId: string): Promise<SkillResponse> {\n return this.http.post<SkillResponse>(`/marketplace/skills/${skillId}/clone`);\n }\n\n /** Execute a marketplace skill. */\n execute(skillId: string, body: ExecuteSkillRequest): Promise<ExecuteSkillResponse> {\n return this.http.post<ExecuteSkillResponse>(\n `/marketplace/skills/${skillId}/execute`,\n body,\n );\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\ntype ProfileCreateRequest = components[\"schemas\"][\"ProfileCreateRequest\"];\ntype ProfileListResponse = components[\"schemas\"][\"ProfileListResponse\"];\ntype ProfileUpdateRequest = components[\"schemas\"][\"ProfileUpdateRequest\"];\ntype ProfileView = components[\"schemas\"][\"ProfileView\"];\n\nexport interface ProfileListParams {\n pageSize?: number;\n pageNumber?: number;\n}\n\nexport class Profiles {\n constructor(private readonly http: HttpClient) {}\n\n /** Create a new browser profile. */\n create(body?: ProfileCreateRequest): Promise<ProfileView> {\n return this.http.post<ProfileView>(\"/profiles\", body);\n }\n\n /** List profiles with pagination. */\n list(params?: ProfileListParams): Promise<ProfileListResponse> {\n return this.http.get<ProfileListResponse>(\"/profiles\", params as Record<string, unknown>);\n }\n\n /** Get profile details. */\n get(profileId: string): Promise<ProfileView> {\n return this.http.get<ProfileView>(`/profiles/${profileId}`);\n }\n\n /** Update a browser profile. */\n update(profileId: string, body: ProfileUpdateRequest): Promise<ProfileView> {\n return this.http.patch<ProfileView>(`/profiles/${profileId}`, body);\n }\n\n /** Delete a browser profile. */\n delete(profileId: string): Promise<void> {\n return this.http.delete<void>(`/profiles/${profileId}`);\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\n/** User-facing body: all fields are optional (API has defaults). */\ntype CreateSessionBody = Partial<components[\"schemas\"][\"CreateSessionRequest\"]>;\ntype SessionItemView = components[\"schemas\"][\"SessionItemView\"];\ntype SessionListResponse = components[\"schemas\"][\"SessionListResponse\"];\ntype SessionView = components[\"schemas\"][\"SessionView\"];\ntype ShareView = components[\"schemas\"][\"ShareView\"];\ntype UpdateSessionRequest = components[\"schemas\"][\"UpdateSessionRequest\"];\n\nexport interface SessionListParams {\n pageSize?: number;\n pageNumber?: number;\n filterBy?: string;\n}\n\nexport class Sessions {\n constructor(private readonly http: HttpClient) {}\n\n /** Create a new session. */\n create(body?: CreateSessionBody): Promise<SessionItemView> {\n return this.http.post<SessionItemView>(\"/sessions\", body);\n }\n\n /** List sessions with optional filtering. */\n list(params?: SessionListParams): Promise<SessionListResponse> {\n return this.http.get<SessionListResponse>(\"/sessions\", params as Record<string, unknown>);\n }\n\n /** Get detailed session information. */\n get(sessionId: string): Promise<SessionView> {\n return this.http.get<SessionView>(`/sessions/${sessionId}`);\n }\n\n /** Update a session (generic PATCH). */\n update(sessionId: string, body: UpdateSessionRequest): Promise<SessionView> {\n return this.http.patch<SessionView>(`/sessions/${sessionId}`, body);\n }\n\n /** Stop a session and all its running tasks. */\n stop(sessionId: string): Promise<SessionView> {\n return this.update(sessionId, { action: \"stop\" });\n }\n\n /** Delete a session with all its tasks. */\n delete(sessionId: string): Promise<void> {\n return this.http.delete<void>(`/sessions/${sessionId}`);\n }\n\n /** Get public share information for a session. */\n getShare(sessionId: string): Promise<ShareView> {\n return this.http.get<ShareView>(`/sessions/${sessionId}/public-share`);\n }\n\n /** Create or return existing public share for a session. */\n createShare(sessionId: string): Promise<ShareView> {\n return this.http.post<ShareView>(`/sessions/${sessionId}/public-share`);\n }\n\n /** Remove public share for a session. */\n deleteShare(sessionId: string): Promise<void> {\n return this.http.delete<void>(`/sessions/${sessionId}/public-share`);\n }\n\n /** Purge all session data (ZDR projects only). */\n purge(sessionId: string): Promise<void> {\n return this.http.post<void>(`/sessions/${sessionId}/purge`);\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\ntype CreateSkillRequest = components[\"schemas\"][\"CreateSkillRequest\"];\ntype CreateSkillResponse = components[\"schemas\"][\"CreateSkillResponse\"];\ntype ExecuteSkillRequest = components[\"schemas\"][\"ExecuteSkillRequest\"];\ntype ExecuteSkillResponse = components[\"schemas\"][\"ExecuteSkillResponse\"];\ntype RefineSkillRequest = components[\"schemas\"][\"RefineSkillRequest\"];\ntype RefineSkillResponse = components[\"schemas\"][\"RefineSkillResponse\"];\ntype SkillExecutionListResponse = components[\"schemas\"][\"SkillExecutionListResponse\"];\ntype SkillExecutionOutputResponse = components[\"schemas\"][\"SkillExecutionOutputResponse\"];\ntype SkillListResponse = components[\"schemas\"][\"SkillListResponse\"];\ntype SkillResponse = components[\"schemas\"][\"SkillResponse\"];\ntype UpdateSkillRequest = components[\"schemas\"][\"UpdateSkillRequest\"];\n\nexport interface SkillListParams {\n pageSize?: number;\n pageNumber?: number;\n isPublic?: boolean;\n isEnabled?: boolean;\n category?: string;\n query?: string;\n fromDate?: string;\n toDate?: string;\n}\n\nexport interface SkillExecutionListParams {\n pageSize?: number;\n pageNumber?: number;\n}\n\nexport class Skills {\n constructor(private readonly http: HttpClient) {}\n\n /** Create a new skill via automated generation. */\n create(body: CreateSkillRequest): Promise<CreateSkillResponse> {\n return this.http.post<CreateSkillResponse>(\"/skills\", body);\n }\n\n /** List all skills owned by the project. */\n list(params?: SkillListParams): Promise<SkillListResponse> {\n return this.http.get<SkillListResponse>(\"/skills\", params as Record<string, unknown>);\n }\n\n /** Get details of a specific skill. */\n get(skillId: string): Promise<SkillResponse> {\n return this.http.get<SkillResponse>(`/skills/${skillId}`);\n }\n\n /** Delete a skill. */\n delete(skillId: string): Promise<void> {\n return this.http.delete<void>(`/skills/${skillId}`);\n }\n\n /** Update skill metadata. */\n update(skillId: string, body: UpdateSkillRequest): Promise<SkillResponse> {\n return this.http.patch<SkillResponse>(`/skills/${skillId}`, body);\n }\n\n /** Cancel the current in-progress generation for a skill. */\n cancel(skillId: string): Promise<SkillResponse> {\n return this.http.post<SkillResponse>(`/skills/${skillId}/cancel`);\n }\n\n /** Execute a skill with the provided parameters. */\n execute(skillId: string, body: ExecuteSkillRequest): Promise<ExecuteSkillResponse> {\n return this.http.post<ExecuteSkillResponse>(`/skills/${skillId}/execute`, body);\n }\n\n /** Refine a skill based on feedback. */\n refine(skillId: string, body: RefineSkillRequest): Promise<RefineSkillResponse> {\n return this.http.post<RefineSkillResponse>(`/skills/${skillId}/refine`, body);\n }\n\n /** Rollback to the previous version. */\n rollback(skillId: string): Promise<SkillResponse> {\n return this.http.post<SkillResponse>(`/skills/${skillId}/rollback`);\n }\n\n /** List executions for a specific skill. */\n executions(skillId: string, params?: SkillExecutionListParams): Promise<SkillExecutionListResponse> {\n return this.http.get<SkillExecutionListResponse>(\n `/skills/${skillId}/executions`,\n params as Record<string, unknown>,\n );\n }\n\n /** Get presigned URL for downloading skill execution output. */\n executionOutput(skillId: string, executionId: string): Promise<SkillExecutionOutputResponse> {\n return this.http.get<SkillExecutionOutputResponse>(\n `/skills/${skillId}/executions/${executionId}/output`,\n );\n }\n}\n","import type { z } from \"zod\";\nimport type { components } from \"../generated/v2/types.js\";\nimport type { Tasks } from \"./resources/tasks.js\";\n\ntype TaskCreatedResponse = components[\"schemas\"][\"TaskCreatedResponse\"];\ntype TaskStepView = components[\"schemas\"][\"TaskStepView\"];\ntype TaskView = components[\"schemas\"][\"TaskView\"];\n\nexport const TERMINAL_STATUSES = new Set([\"finished\", \"stopped\"]);\n\n/** Task result with typed output. All TaskView fields are directly accessible. */\nexport type TaskResult<T = string | null> = Omit<TaskView, \"output\"> & { output: T };\n\nexport interface RunOptions {\n /** Maximum time to wait in milliseconds. Default: 300_000 (5 min). */\n timeout?: number;\n /** Polling interval in milliseconds. Default: 2_000. */\n interval?: number;\n}\n\n/**\n * Lazy task handle returned by `client.run()`.\n *\n * - `await client.run(...)` polls the lightweight status endpoint, returns a `TaskResult`.\n * - `for await (const step of client.run(...))` polls the full task, yields new steps.\n */\nexport class TaskRun<T = string> implements PromiseLike<TaskResult<T>> {\n private readonly _createPromise: Promise<TaskCreatedResponse>;\n private readonly _tasks: Tasks;\n private readonly _schema?: z.ZodType<T>;\n private readonly _timeout: number;\n private readonly _interval: number;\n\n private _taskId: string | null = null;\n private _result: TaskResult<T> | null = null;\n\n constructor(\n createPromise: Promise<TaskCreatedResponse>,\n tasks: Tasks,\n schema?: z.ZodType<T>,\n options?: RunOptions,\n ) {\n this._createPromise = createPromise;\n this._tasks = tasks;\n this._schema = schema;\n this._timeout = options?.timeout ?? 300_000;\n this._interval = options?.interval ?? 2_000;\n }\n\n /** Task ID (available after creation resolves). */\n get taskId(): string | null {\n return this._taskId;\n }\n\n /** Full task result (available after awaiting or iterating to completion). */\n get result(): TaskResult<T> | null {\n return this._result;\n }\n\n /** Enable `await client.run(...)` — polls status endpoint, returns TaskResult. */\n then<R1 = TaskResult<T>, R2 = never>(\n onFulfilled?: ((value: TaskResult<T>) => R1 | PromiseLike<R1>) | null,\n onRejected?: ((reason: unknown) => R2 | PromiseLike<R2>) | null,\n ): Promise<R1 | R2> {\n return this._waitForOutput().then(onFulfilled, onRejected);\n }\n\n /** Enable `for await (const step of client.run(...))` — polls full task, yields new steps. */\n async *[Symbol.asyncIterator](): AsyncGenerator<TaskStepView> {\n const taskId = await this._ensureTaskId();\n let seen = 0;\n const deadline = Date.now() + this._timeout;\n\n while (Date.now() < deadline) {\n const task = await this._tasks.get(taskId);\n\n for (let i = seen; i < task.steps.length; i++) {\n yield task.steps[i];\n }\n seen = task.steps.length;\n\n if (TERMINAL_STATUSES.has(task.status)) {\n this._result = this._buildResult(task);\n return;\n }\n\n const remaining = deadline - Date.now();\n if (remaining <= 0) break;\n await new Promise((r) => setTimeout(r, Math.min(this._interval, remaining)));\n }\n\n throw new Error(`Task ${taskId} did not complete within ${this._timeout}ms`);\n }\n\n private async _ensureTaskId(): Promise<string> {\n if (this._taskId) return this._taskId;\n const created = await this._createPromise;\n this._taskId = created.id;\n return this._taskId;\n }\n\n /** Poll lightweight status endpoint until terminal, return TaskResult. */\n private async _waitForOutput(): Promise<TaskResult<T>> {\n const taskId = await this._ensureTaskId();\n const deadline = Date.now() + this._timeout;\n\n while (Date.now() < deadline) {\n const status = await this._tasks.status(taskId);\n if (TERMINAL_STATUSES.has(status.status)) {\n const task = await this._tasks.get(taskId);\n this._result = this._buildResult(task);\n return this._result;\n }\n const remaining = deadline - Date.now();\n if (remaining <= 0) break;\n await new Promise((r) => setTimeout(r, Math.min(this._interval, remaining)));\n }\n\n throw new Error(`Task ${taskId} did not complete within ${this._timeout}ms`);\n }\n\n private _buildResult(task: TaskView): TaskResult<T> {\n const output = this._parseOutput(task.output);\n return { ...task, output };\n }\n\n private _parseOutput(output: string | null | undefined): T {\n if (output == null) return null as T;\n if (!this._schema) return output as unknown as T;\n return this._schema.parse(JSON.parse(output));\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\nimport { TERMINAL_STATUSES } from \"../helpers.js\";\n\n/** User-facing body: only `task` is required; everything else has API defaults. */\nexport type CreateTaskBody = Pick<components[\"schemas\"][\"CreateTaskRequest\"], \"task\"> &\n Partial<Omit<components[\"schemas\"][\"CreateTaskRequest\"], \"task\">>;\ntype TaskCreatedResponse = components[\"schemas\"][\"TaskCreatedResponse\"];\ntype TaskListResponse = components[\"schemas\"][\"TaskListResponse\"];\ntype TaskLogFileResponse = components[\"schemas\"][\"TaskLogFileResponse\"];\ntype TaskStatusView = components[\"schemas\"][\"TaskStatusView\"];\ntype TaskView = components[\"schemas\"][\"TaskView\"];\ntype UpdateTaskRequest = components[\"schemas\"][\"UpdateTaskRequest\"];\n\nexport interface TaskListParams {\n pageSize?: number;\n pageNumber?: number;\n sessionId?: string;\n filterBy?: string;\n after?: string;\n before?: string;\n}\n\nexport class Tasks {\n constructor(private readonly http: HttpClient) {}\n\n /** Create and start a new AI agent task. */\n create(body: CreateTaskBody): Promise<TaskCreatedResponse> {\n return this.http.post<TaskCreatedResponse>(\"/tasks\", body);\n }\n\n /** List tasks with optional filtering. */\n list(params?: TaskListParams): Promise<TaskListResponse> {\n return this.http.get<TaskListResponse>(\"/tasks\", params as Record<string, unknown>);\n }\n\n /** Get detailed task information. */\n get(taskId: string): Promise<TaskView> {\n return this.http.get<TaskView>(`/tasks/${taskId}`);\n }\n\n /** Update a task (generic PATCH). */\n update(taskId: string, body: UpdateTaskRequest): Promise<TaskView> {\n return this.http.patch<TaskView>(`/tasks/${taskId}`, body);\n }\n\n /** Stop a running task. */\n stop(taskId: string): Promise<TaskView> {\n return this.update(taskId, { action: \"stop\" });\n }\n\n /** Stop a running task and its associated browser session. */\n stopTaskAndSession(taskId: string): Promise<TaskView> {\n return this.update(taskId, { action: \"stop_task_and_session\" });\n }\n\n /** Get lightweight task status (optimized for polling). */\n status(taskId: string): Promise<TaskStatusView> {\n return this.http.get<TaskStatusView>(`/tasks/${taskId}/status`);\n }\n\n /** Get secure download URL for task execution logs. */\n logs(taskId: string): Promise<TaskLogFileResponse> {\n return this.http.get<TaskLogFileResponse>(`/tasks/${taskId}/logs`);\n }\n\n /** Poll until a task reaches a terminal status, then return the full TaskView. */\n async wait(taskId: string, opts?: { timeout?: number; interval?: number }): Promise<TaskView> {\n const timeout = opts?.timeout ?? 300_000;\n const interval = opts?.interval ?? 2_000;\n const deadline = Date.now() + timeout;\n\n while (Date.now() < deadline) {\n const status = await this.status(taskId);\n if (TERMINAL_STATUSES.has(status.status)) {\n return this.get(taskId);\n }\n const remaining = deadline - Date.now();\n if (remaining <= 0) break;\n await new Promise((r) => setTimeout(r, Math.min(interval, remaining)));\n }\n\n throw new Error(`Task ${taskId} did not complete within ${timeout}ms`);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/Users/sauravpanda/Github/LLMs/Browser-Use/sdk/browser-use-node/dist/index.cjs","../src/v2/client.ts","../src/v2/resources/billing.ts","../src/v2/resources/browsers.ts","../src/v2/resources/files.ts","../src/v2/resources/marketplace.ts","../src/v2/resources/profiles.ts","../src/v2/resources/sessions.ts","../src/v2/resources/skills.ts","../src/v2/helpers.ts","../src/v2/resources/tasks.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACLA,0BAAkB;ADOlB;AACA;AEHO,IAAM,QAAA,EAAN,MAAc;AAAA,EACnB,WAAA,CAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,KAAA,EAAA,IAAA;AAAA,EAAmB;AAAA;AAAA,EAGhD,OAAA,CAAA,EAAgC;AAC9B,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAiB,kBAAkB,CAAA;AAAA,EACtD;AACF,CAAA;AFMA;AACA;AGHO,IAAM,SAAA,EAAN,MAAe;AAAA,EACpB,WAAA,CAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,KAAA,EAAA,IAAA;AAAA,EAAmB;AAAA;AAAA,EAGhD,MAAA,CAAO,KAAA,EAA0B,CAAC,CAAA,EAAoC;AACpE,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,IAAA,CAA6B,WAAA,EAAa,IAAI,CAAA;AAAA,EACjE;AAAA;AAAA,EAGA,IAAA,CAAK,MAAA,EAAiE;AACpE,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA;AAAA,MACf,WAAA;AAAA,MACA;AAAA,IACF,CAAA;AAAA,EACF;AAAA;AAAA,EAGA,GAAA,CAAI,SAAA,EAAgD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ChC,EAAA;AACF;AViSgD;AACA;ACxWvB;AAYD;AACb,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AAEQ,EAAA;AAE4B,EAAA;AAEf,IAAA;AACf,IAAA;AACD,MAAA;AACR,QAAA;AACF,MAAA;AACF,IAAA;AAC2B,IAAA;AACzB,MAAA;AAC4B,MAAA;AACR,MAAA;AACH,MAAA;AAClB,IAAA;AAEmC,IAAA;AACJ,IAAA;AACM,IAAA;AACN,IAAA;AACM,IAAA;AACA,IAAA;AACJ,IAAA;AACU,IAAA;AAC9C,EAAA;AAoB0D,EAAA;AACb,IAAA;AACE,IAAA;AACjC,IAAA;AAC+B,MAAA;AAC3C,IAAA;AACsC,IAAA;AACE,IAAA;AAC1C,EAAA;AACF;ADwUgD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/Users/sauravpanda/Github/LLMs/Browser-Use/sdk/browser-use-node/dist/index.cjs","sourcesContent":[null,"import { z } from \"zod\";\nimport { HttpClient } from \"../core/http.js\";\nimport { Billing } from \"./resources/billing.js\";\nimport { Browsers } from \"./resources/browsers.js\";\nimport { Files } from \"./resources/files.js\";\nimport { Marketplace } from \"./resources/marketplace.js\";\nimport { Profiles } from \"./resources/profiles.js\";\nimport { Sessions } from \"./resources/sessions.js\";\nimport { Skills } from \"./resources/skills.js\";\nimport { Tasks } from \"./resources/tasks.js\";\nimport { TaskRun } from \"./helpers.js\";\nimport type { CreateTaskBody } from \"./resources/tasks.js\";\nimport type { RunOptions } from \"./helpers.js\";\n\nconst DEFAULT_BASE_URL = \"https://api.browser-use.com/api/v2\";\n\nexport interface BrowserUseOptions {\n apiKey?: string;\n baseUrl?: string;\n maxRetries?: number;\n timeout?: number;\n}\n\nexport type RunTaskOptions = Partial<Omit<CreateTaskBody, \"task\">> &\n RunOptions & { schema?: z.ZodType };\n\nexport class BrowserUse {\n readonly billing: Billing;\n readonly tasks: Tasks;\n readonly sessions: Sessions;\n readonly files: Files;\n readonly profiles: Profiles;\n readonly browsers: Browsers;\n readonly skills: Skills;\n readonly marketplace: Marketplace;\n\n private readonly http: HttpClient;\n\n constructor(options: BrowserUseOptions = {}) {\n const apiKey =\n options.apiKey ?? process.env.BROWSER_USE_API_KEY ?? \"\";\n if (!apiKey) {\n throw new Error(\n \"No API key provided. Pass apiKey or set BROWSER_USE_API_KEY.\",\n );\n }\n this.http = new HttpClient({\n apiKey,\n baseUrl: options.baseUrl ?? DEFAULT_BASE_URL,\n maxRetries: options.maxRetries,\n timeout: options.timeout,\n });\n\n this.billing = new Billing(this.http);\n this.tasks = new Tasks(this.http);\n this.sessions = new Sessions(this.http);\n this.files = new Files(this.http);\n this.profiles = new Profiles(this.http);\n this.browsers = new Browsers(this.http);\n this.skills = new Skills(this.http);\n this.marketplace = new Marketplace(this.http);\n }\n\n /**\n * Run an AI agent task.\n *\n * ```ts\n * // Simple — just get the output\n * const output = await client.run(\"Find the top HN post\");\n *\n * // Structured output (Zod)\n * const data = await client.run(\"Find product info\", { schema: ProductSchema });\n *\n * // Step-by-step progress\n * for await (const step of client.run(\"Go to google.com\")) {\n * console.log(`[${step.number}] ${step.nextGoal}`);\n * }\n * ```\n */\n run(task: string, options?: Omit<RunTaskOptions, \"schema\">): TaskRun<string>;\n run<T extends z.ZodType>(task: string, options: RunTaskOptions & { schema: T }): TaskRun<z.output<T>>;\n run(task: string, options?: RunTaskOptions): TaskRun<any> {\n const { schema, timeout, interval, ...rest } = options ?? {};\n const body: CreateTaskBody = { task, ...rest };\n if (schema) {\n body.structuredOutput = JSON.stringify(z.toJSONSchema(schema));\n }\n const promise = this.tasks.create(body);\n return new TaskRun(promise, this.tasks, schema, { timeout, interval });\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\ntype AccountView = components[\"schemas\"][\"AccountView\"];\n\nexport class Billing {\n constructor(private readonly http: HttpClient) {}\n\n /** Get authenticated account billing information including credit balance. */\n account(): Promise<AccountView> {\n return this.http.get<AccountView>(\"/billing/account\");\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\n/** All fields are optional (server applies defaults); body itself is required by the spec. */\nexport type CreateBrowserBody = Partial<components[\"schemas\"][\"CreateBrowserSessionRequest\"]>;\ntype BrowserSessionItemView = components[\"schemas\"][\"BrowserSessionItemView\"];\ntype BrowserSessionListResponse = components[\"schemas\"][\"BrowserSessionListResponse\"];\ntype BrowserSessionView = components[\"schemas\"][\"BrowserSessionView\"];\ntype UpdateBrowserSessionRequest = components[\"schemas\"][\"UpdateBrowserSessionRequest\"];\n\nexport interface BrowserListParams {\n pageSize?: number;\n pageNumber?: number;\n filterBy?: string;\n}\n\nexport class Browsers {\n constructor(private readonly http: HttpClient) {}\n\n /** Create a new browser session. */\n create(body: CreateBrowserBody = {}): Promise<BrowserSessionItemView> {\n return this.http.post<BrowserSessionItemView>(\"/browsers\", body);\n }\n\n /** List browser sessions with optional filtering. */\n list(params?: BrowserListParams): Promise<BrowserSessionListResponse> {\n return this.http.get<BrowserSessionListResponse>(\n \"/browsers\",\n params as Record<string, unknown>,\n );\n }\n\n /** Get detailed browser session information. */\n get(sessionId: string): Promise<BrowserSessionView> {\n return this.http.get<BrowserSessionView>(`/browsers/${sessionId}`);\n }\n\n /** Update a browser session (generic PATCH). */\n update(sessionId: string, body: UpdateBrowserSessionRequest): Promise<BrowserSessionView> {\n return this.http.patch<BrowserSessionView>(`/browsers/${sessionId}`, body);\n }\n\n /** Stop a browser session. */\n stop(sessionId: string): Promise<BrowserSessionView> {\n return this.update(sessionId, { action: \"stop\" });\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\ntype UploadFileRequest = components[\"schemas\"][\"UploadFileRequest\"];\ntype UploadFilePresignedUrlResponse = components[\"schemas\"][\"UploadFilePresignedUrlResponse\"];\ntype TaskOutputFileResponse = components[\"schemas\"][\"TaskOutputFileResponse\"];\n\nexport class Files {\n constructor(private readonly http: HttpClient) {}\n\n /** Generate a presigned URL for uploading files to an agent session. */\n sessionUrl(sessionId: string, body: UploadFileRequest): Promise<UploadFilePresignedUrlResponse> {\n return this.http.post<UploadFilePresignedUrlResponse>(\n `/files/sessions/${sessionId}/presigned-url`,\n body,\n );\n }\n\n /** Generate a presigned URL for uploading files to a browser session. */\n browserUrl(sessionId: string, body: UploadFileRequest): Promise<UploadFilePresignedUrlResponse> {\n return this.http.post<UploadFilePresignedUrlResponse>(\n `/files/browsers/${sessionId}/presigned-url`,\n body,\n );\n }\n\n /** Get secure download URL for a task output file. */\n taskOutput(taskId: string, fileId: string): Promise<TaskOutputFileResponse> {\n return this.http.get<TaskOutputFileResponse>(\n `/files/tasks/${taskId}/output-files/${fileId}`,\n );\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\ntype ExecuteSkillRequest = components[\"schemas\"][\"ExecuteSkillRequest\"];\ntype ExecuteSkillResponse = components[\"schemas\"][\"ExecuteSkillResponse\"];\ntype MarketplaceSkillListResponse = components[\"schemas\"][\"MarketplaceSkillListResponse\"];\ntype MarketplaceSkillResponse = components[\"schemas\"][\"MarketplaceSkillResponse\"];\ntype SkillResponse = components[\"schemas\"][\"SkillResponse\"];\n\nexport interface MarketplaceListParams {\n pageSize?: number;\n pageNumber?: number;\n query?: string;\n category?: string;\n fromDate?: string;\n toDate?: string;\n}\n\nexport class Marketplace {\n constructor(private readonly http: HttpClient) {}\n\n /** List all public skills in the marketplace. */\n list(params?: MarketplaceListParams): Promise<MarketplaceSkillListResponse> {\n return this.http.get<MarketplaceSkillListResponse>(\n \"/marketplace/skills\",\n params as Record<string, unknown>,\n );\n }\n\n /** Get details of a specific marketplace skill by slug. */\n get(skillSlug: string): Promise<MarketplaceSkillResponse> {\n return this.http.get<MarketplaceSkillResponse>(`/marketplace/skills/${skillSlug}`);\n }\n\n /** Clone a public marketplace skill to your project. */\n clone(skillId: string): Promise<SkillResponse> {\n return this.http.post<SkillResponse>(`/marketplace/skills/${skillId}/clone`);\n }\n\n /** Execute a marketplace skill. */\n execute(skillId: string, body: ExecuteSkillRequest): Promise<ExecuteSkillResponse> {\n return this.http.post<ExecuteSkillResponse>(\n `/marketplace/skills/${skillId}/execute`,\n body,\n );\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\ntype ProfileCreateRequest = components[\"schemas\"][\"ProfileCreateRequest\"];\ntype ProfileListResponse = components[\"schemas\"][\"ProfileListResponse\"];\ntype ProfileUpdateRequest = components[\"schemas\"][\"ProfileUpdateRequest\"];\ntype ProfileView = components[\"schemas\"][\"ProfileView\"];\n\nexport interface ProfileListParams {\n pageSize?: number;\n pageNumber?: number;\n query?: string;\n}\n\nexport class Profiles {\n constructor(private readonly http: HttpClient) {}\n\n /** Create a new browser profile. */\n create(body?: ProfileCreateRequest): Promise<ProfileView> {\n return this.http.post<ProfileView>(\"/profiles\", body);\n }\n\n /** List profiles with pagination. */\n list(params?: ProfileListParams): Promise<ProfileListResponse> {\n return this.http.get<ProfileListResponse>(\"/profiles\", params as Record<string, unknown>);\n }\n\n /** Get profile details. */\n get(profileId: string): Promise<ProfileView> {\n return this.http.get<ProfileView>(`/profiles/${profileId}`);\n }\n\n /** Update a browser profile. */\n update(profileId: string, body: ProfileUpdateRequest): Promise<ProfileView> {\n return this.http.patch<ProfileView>(`/profiles/${profileId}`, body);\n }\n\n /** Delete a browser profile. */\n delete(profileId: string): Promise<void> {\n return this.http.delete<void>(`/profiles/${profileId}`);\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\n/** User-facing body: all fields are optional (API has defaults). */\ntype CreateSessionBody = Partial<components[\"schemas\"][\"CreateSessionRequest\"]>;\ntype SessionItemView = components[\"schemas\"][\"SessionItemView\"];\ntype SessionListResponse = components[\"schemas\"][\"SessionListResponse\"];\ntype SessionView = components[\"schemas\"][\"SessionView\"];\ntype ShareView = components[\"schemas\"][\"ShareView\"];\ntype UpdateSessionRequest = components[\"schemas\"][\"UpdateSessionRequest\"];\n\nexport interface SessionListParams {\n pageSize?: number;\n pageNumber?: number;\n filterBy?: string;\n}\n\nexport class Sessions {\n constructor(private readonly http: HttpClient) {}\n\n /** Create a new session. */\n create(body?: CreateSessionBody): Promise<SessionItemView> {\n return this.http.post<SessionItemView>(\"/sessions\", body);\n }\n\n /** List sessions with optional filtering. */\n list(params?: SessionListParams): Promise<SessionListResponse> {\n return this.http.get<SessionListResponse>(\"/sessions\", params as Record<string, unknown>);\n }\n\n /** Get detailed session information. */\n get(sessionId: string): Promise<SessionView> {\n return this.http.get<SessionView>(`/sessions/${sessionId}`);\n }\n\n /** Update a session (generic PATCH). */\n update(sessionId: string, body: UpdateSessionRequest): Promise<SessionView> {\n return this.http.patch<SessionView>(`/sessions/${sessionId}`, body);\n }\n\n /** Stop a session and all its running tasks. */\n stop(sessionId: string): Promise<SessionView> {\n return this.update(sessionId, { action: \"stop\" });\n }\n\n /** Delete a session with all its tasks. */\n delete(sessionId: string): Promise<void> {\n return this.http.delete<void>(`/sessions/${sessionId}`);\n }\n\n /** Get public share information for a session. */\n getShare(sessionId: string): Promise<ShareView> {\n return this.http.get<ShareView>(`/sessions/${sessionId}/public-share`);\n }\n\n /** Create or return existing public share for a session. */\n createShare(sessionId: string): Promise<ShareView> {\n return this.http.post<ShareView>(`/sessions/${sessionId}/public-share`);\n }\n\n /** Remove public share for a session. */\n deleteShare(sessionId: string): Promise<void> {\n return this.http.delete<void>(`/sessions/${sessionId}/public-share`);\n }\n\n /** Purge all session data (ZDR projects only). */\n purge(sessionId: string): Promise<void> {\n return this.http.post<void>(`/sessions/${sessionId}/purge`);\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\ntype CreateSkillRequest = components[\"schemas\"][\"CreateSkillRequest\"];\ntype CreateSkillResponse = components[\"schemas\"][\"CreateSkillResponse\"];\ntype ExecuteSkillRequest = components[\"schemas\"][\"ExecuteSkillRequest\"];\ntype ExecuteSkillResponse = components[\"schemas\"][\"ExecuteSkillResponse\"];\ntype RefineSkillRequest = components[\"schemas\"][\"RefineSkillRequest\"];\ntype RefineSkillResponse = components[\"schemas\"][\"RefineSkillResponse\"];\ntype SkillExecutionListResponse = components[\"schemas\"][\"SkillExecutionListResponse\"];\ntype SkillExecutionOutputResponse = components[\"schemas\"][\"SkillExecutionOutputResponse\"];\ntype SkillListResponse = components[\"schemas\"][\"SkillListResponse\"];\ntype SkillResponse = components[\"schemas\"][\"SkillResponse\"];\ntype UpdateSkillRequest = components[\"schemas\"][\"UpdateSkillRequest\"];\n\nexport interface SkillListParams {\n pageSize?: number;\n pageNumber?: number;\n isPublic?: boolean;\n isEnabled?: boolean;\n category?: string;\n query?: string;\n fromDate?: string;\n toDate?: string;\n}\n\nexport interface SkillExecutionListParams {\n pageSize?: number;\n pageNumber?: number;\n}\n\nexport class Skills {\n constructor(private readonly http: HttpClient) {}\n\n /** Create a new skill via automated generation. */\n create(body: CreateSkillRequest): Promise<CreateSkillResponse> {\n return this.http.post<CreateSkillResponse>(\"/skills\", body);\n }\n\n /** List all skills owned by the project. */\n list(params?: SkillListParams): Promise<SkillListResponse> {\n return this.http.get<SkillListResponse>(\"/skills\", params as Record<string, unknown>);\n }\n\n /** Get details of a specific skill. */\n get(skillId: string): Promise<SkillResponse> {\n return this.http.get<SkillResponse>(`/skills/${skillId}`);\n }\n\n /** Delete a skill. */\n delete(skillId: string): Promise<void> {\n return this.http.delete<void>(`/skills/${skillId}`);\n }\n\n /** Update skill metadata. */\n update(skillId: string, body: UpdateSkillRequest): Promise<SkillResponse> {\n return this.http.patch<SkillResponse>(`/skills/${skillId}`, body);\n }\n\n /** Cancel the current in-progress generation for a skill. */\n cancel(skillId: string): Promise<SkillResponse> {\n return this.http.post<SkillResponse>(`/skills/${skillId}/cancel`);\n }\n\n /** Execute a skill with the provided parameters. */\n execute(skillId: string, body: ExecuteSkillRequest): Promise<ExecuteSkillResponse> {\n return this.http.post<ExecuteSkillResponse>(`/skills/${skillId}/execute`, body);\n }\n\n /** Refine a skill based on feedback. */\n refine(skillId: string, body: RefineSkillRequest): Promise<RefineSkillResponse> {\n return this.http.post<RefineSkillResponse>(`/skills/${skillId}/refine`, body);\n }\n\n /** Rollback to the previous version. */\n rollback(skillId: string): Promise<SkillResponse> {\n return this.http.post<SkillResponse>(`/skills/${skillId}/rollback`);\n }\n\n /** List executions for a specific skill. */\n executions(skillId: string, params?: SkillExecutionListParams): Promise<SkillExecutionListResponse> {\n return this.http.get<SkillExecutionListResponse>(\n `/skills/${skillId}/executions`,\n params as Record<string, unknown>,\n );\n }\n\n /** Get presigned URL for downloading skill execution output. */\n executionOutput(skillId: string, executionId: string): Promise<SkillExecutionOutputResponse> {\n return this.http.get<SkillExecutionOutputResponse>(\n `/skills/${skillId}/executions/${executionId}/output`,\n );\n }\n}\n","import type { z } from \"zod\";\nimport type { components } from \"../generated/v2/types.js\";\nimport type { Tasks } from \"./resources/tasks.js\";\n\ntype TaskCreatedResponse = components[\"schemas\"][\"TaskCreatedResponse\"];\ntype TaskStepView = components[\"schemas\"][\"TaskStepView\"];\ntype TaskView = components[\"schemas\"][\"TaskView\"];\n\nexport const TERMINAL_STATUSES = new Set([\"finished\", \"stopped\"]);\n\n/** Task result with typed output. All TaskView fields are directly accessible. */\nexport type TaskResult<T = string | null> = Omit<TaskView, \"output\"> & { output: T };\n\nexport interface RunOptions {\n /** Maximum time to wait in milliseconds. Default: 300_000 (5 min). */\n timeout?: number;\n /** Polling interval in milliseconds. Default: 2_000. */\n interval?: number;\n}\n\n/**\n * Lazy task handle returned by `client.run()`.\n *\n * - `await client.run(...)` polls the lightweight status endpoint, returns a `TaskResult`.\n * - `for await (const step of client.run(...))` polls the full task, yields new steps.\n */\nexport class TaskRun<T = string> implements PromiseLike<TaskResult<T>> {\n private readonly _createPromise: Promise<TaskCreatedResponse>;\n private readonly _tasks: Tasks;\n private readonly _schema?: z.ZodType<T>;\n private readonly _timeout: number;\n private readonly _interval: number;\n\n private _taskId: string | null = null;\n private _result: TaskResult<T> | null = null;\n\n constructor(\n createPromise: Promise<TaskCreatedResponse>,\n tasks: Tasks,\n schema?: z.ZodType<T>,\n options?: RunOptions,\n ) {\n this._createPromise = createPromise;\n this._tasks = tasks;\n this._schema = schema;\n this._timeout = options?.timeout ?? 300_000;\n this._interval = options?.interval ?? 2_000;\n }\n\n /** Task ID (available after creation resolves). */\n get taskId(): string | null {\n return this._taskId;\n }\n\n /** Full task result (available after awaiting or iterating to completion). */\n get result(): TaskResult<T> | null {\n return this._result;\n }\n\n /** Enable `await client.run(...)` — polls status endpoint, returns TaskResult. */\n then<R1 = TaskResult<T>, R2 = never>(\n onFulfilled?: ((value: TaskResult<T>) => R1 | PromiseLike<R1>) | null,\n onRejected?: ((reason: unknown) => R2 | PromiseLike<R2>) | null,\n ): Promise<R1 | R2> {\n return this._waitForOutput().then(onFulfilled, onRejected);\n }\n\n /** Enable `for await (const step of client.run(...))` — polls full task, yields new steps. */\n async *[Symbol.asyncIterator](): AsyncGenerator<TaskStepView> {\n const taskId = await this._ensureTaskId();\n let seen = 0;\n const deadline = Date.now() + this._timeout;\n\n while (Date.now() < deadline) {\n const task = await this._tasks.get(taskId);\n\n for (let i = seen; i < task.steps.length; i++) {\n yield task.steps[i];\n }\n seen = task.steps.length;\n\n if (TERMINAL_STATUSES.has(task.status)) {\n this._result = this._buildResult(task);\n return;\n }\n\n const remaining = deadline - Date.now();\n if (remaining <= 0) break;\n await new Promise((r) => setTimeout(r, Math.min(this._interval, remaining)));\n }\n\n throw new Error(`Task ${taskId} did not complete within ${this._timeout}ms`);\n }\n\n private async _ensureTaskId(): Promise<string> {\n if (this._taskId) return this._taskId;\n const created = await this._createPromise;\n this._taskId = created.id;\n return this._taskId;\n }\n\n /** Poll lightweight status endpoint until terminal, return TaskResult. */\n private async _waitForOutput(): Promise<TaskResult<T>> {\n const taskId = await this._ensureTaskId();\n const deadline = Date.now() + this._timeout;\n\n while (Date.now() < deadline) {\n const status = await this._tasks.status(taskId);\n if (TERMINAL_STATUSES.has(status.status)) {\n const task = await this._tasks.get(taskId);\n this._result = this._buildResult(task);\n return this._result;\n }\n const remaining = deadline - Date.now();\n if (remaining <= 0) break;\n await new Promise((r) => setTimeout(r, Math.min(this._interval, remaining)));\n }\n\n throw new Error(`Task ${taskId} did not complete within ${this._timeout}ms`);\n }\n\n private _buildResult(task: TaskView): TaskResult<T> {\n const output = this._parseOutput(task.output);\n return { ...task, output };\n }\n\n private _parseOutput(output: string | null | undefined): T {\n if (output == null) return null as T;\n if (!this._schema) return output as unknown as T;\n return this._schema.parse(JSON.parse(output));\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\nimport { TERMINAL_STATUSES } from \"../helpers.js\";\n\n/** User-facing body: only `task` is required; everything else has API defaults. */\nexport type CreateTaskBody = Pick<components[\"schemas\"][\"CreateTaskRequest\"], \"task\"> &\n Partial<Omit<components[\"schemas\"][\"CreateTaskRequest\"], \"task\">>;\ntype TaskCreatedResponse = components[\"schemas\"][\"TaskCreatedResponse\"];\ntype TaskListResponse = components[\"schemas\"][\"TaskListResponse\"];\ntype TaskLogFileResponse = components[\"schemas\"][\"TaskLogFileResponse\"];\ntype TaskStatusView = components[\"schemas\"][\"TaskStatusView\"];\ntype TaskView = components[\"schemas\"][\"TaskView\"];\ntype UpdateTaskRequest = components[\"schemas\"][\"UpdateTaskRequest\"];\n\nexport interface TaskListParams {\n pageSize?: number;\n pageNumber?: number;\n sessionId?: string;\n filterBy?: string;\n after?: string;\n before?: string;\n}\n\nexport class Tasks {\n constructor(private readonly http: HttpClient) {}\n\n /** Create and start a new AI agent task. */\n create(body: CreateTaskBody): Promise<TaskCreatedResponse> {\n return this.http.post<TaskCreatedResponse>(\"/tasks\", body);\n }\n\n /** List tasks with optional filtering. */\n list(params?: TaskListParams): Promise<TaskListResponse> {\n return this.http.get<TaskListResponse>(\"/tasks\", params as Record<string, unknown>);\n }\n\n /** Get detailed task information. */\n get(taskId: string): Promise<TaskView> {\n return this.http.get<TaskView>(`/tasks/${taskId}`);\n }\n\n /** Update a task (generic PATCH). */\n update(taskId: string, body: UpdateTaskRequest): Promise<TaskView> {\n return this.http.patch<TaskView>(`/tasks/${taskId}`, body);\n }\n\n /** Stop a running task. */\n stop(taskId: string): Promise<TaskView> {\n return this.update(taskId, { action: \"stop\" });\n }\n\n /** Stop a running task and its associated browser session. */\n stopTaskAndSession(taskId: string): Promise<TaskView> {\n return this.update(taskId, { action: \"stop_task_and_session\" });\n }\n\n /** Get lightweight task status (optimized for polling). */\n status(taskId: string): Promise<TaskStatusView> {\n return this.http.get<TaskStatusView>(`/tasks/${taskId}/status`);\n }\n\n /** Get secure download URL for task execution logs. */\n logs(taskId: string): Promise<TaskLogFileResponse> {\n return this.http.get<TaskLogFileResponse>(`/tasks/${taskId}/logs`);\n }\n\n /** Poll until a task reaches a terminal status, then return the full TaskView. */\n async wait(taskId: string, opts?: { timeout?: number; interval?: number }): Promise<TaskView> {\n const timeout = opts?.timeout ?? 300_000;\n const interval = opts?.interval ?? 2_000;\n const deadline = Date.now() + timeout;\n\n while (Date.now() < deadline) {\n const status = await this.status(taskId);\n if (TERMINAL_STATUSES.has(status.status)) {\n return this.get(taskId);\n }\n const remaining = deadline - Date.now();\n if (remaining <= 0) break;\n await new Promise((r) => setTimeout(r, Math.min(interval, remaining)));\n }\n\n throw new Error(`Task ${taskId} did not complete within ${timeout}ms`);\n }\n}\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -291,9 +291,10 @@ interface components {
|
|
|
291
291
|
profileId?: string | null;
|
|
292
292
|
/**
|
|
293
293
|
* Proxy Country Code
|
|
294
|
-
* @description Country code for proxy location.
|
|
294
|
+
* @description Country code for proxy location. Defaults to US. Set to null to disable proxy.
|
|
295
|
+
* @default us
|
|
295
296
|
*/
|
|
296
|
-
proxyCountryCode
|
|
297
|
+
proxyCountryCode: components["schemas"]["ProxyCountryCode"] | null;
|
|
297
298
|
/**
|
|
298
299
|
* Timeout
|
|
299
300
|
* @description The timeout for the session in minutes. All users can use up to 240 minutes (4 hours). Pay As You Go users are charged $0.06/hour, subscribers get 50% off.
|
|
@@ -318,7 +319,7 @@ interface components {
|
|
|
318
319
|
allowResizing: boolean;
|
|
319
320
|
/**
|
|
320
321
|
* Custom Proxy
|
|
321
|
-
* @description Custom proxy settings to use for the session. If not provided, our proxies will be used. Custom proxies are only available
|
|
322
|
+
* @description Custom proxy settings to use for the session. If not provided, our proxies will be used. Custom proxies are only available on the Custom Enterprise plan.
|
|
322
323
|
*/
|
|
323
324
|
customProxy?: components["schemas"]["CustomProxy"] | null;
|
|
324
325
|
/**
|
|
@@ -340,9 +341,10 @@ interface components {
|
|
|
340
341
|
profileId?: string | null;
|
|
341
342
|
/**
|
|
342
343
|
* Proxy Country Code
|
|
343
|
-
* @description Country code for proxy location.
|
|
344
|
+
* @description Country code for proxy location. Defaults to US. Set to null to disable proxy.
|
|
345
|
+
* @default us
|
|
344
346
|
*/
|
|
345
|
-
proxyCountryCode
|
|
347
|
+
proxyCountryCode: components["schemas"]["ProxyCountryCode"] | null;
|
|
346
348
|
/**
|
|
347
349
|
* Start URL
|
|
348
350
|
* @description URL to navigate to when the session starts.
|
|
@@ -372,7 +374,7 @@ interface components {
|
|
|
372
374
|
keepAlive: boolean;
|
|
373
375
|
/**
|
|
374
376
|
* Custom Proxy
|
|
375
|
-
* @description Custom proxy settings to use for the session. If not provided, our proxies will be used. Custom proxies are only available
|
|
377
|
+
* @description Custom proxy settings to use for the session. If not provided, our proxies will be used. Custom proxies are only available on the Custom Enterprise plan.
|
|
376
378
|
*/
|
|
377
379
|
customProxy?: components["schemas"]["CustomProxy"] | null;
|
|
378
380
|
/**
|
|
@@ -887,6 +889,11 @@ interface components {
|
|
|
887
889
|
* @description Optional name for the profile
|
|
888
890
|
*/
|
|
889
891
|
name?: string | null;
|
|
892
|
+
/**
|
|
893
|
+
* User ID
|
|
894
|
+
* @description Your internal user identifier for this profile. Use this to associate a profile with a user in your system.
|
|
895
|
+
*/
|
|
896
|
+
userId?: string | null;
|
|
890
897
|
};
|
|
891
898
|
/**
|
|
892
899
|
* ProfileListResponse
|
|
@@ -935,12 +942,18 @@ interface components {
|
|
|
935
942
|
* @description Optional name for the profile
|
|
936
943
|
*/
|
|
937
944
|
name?: string | null;
|
|
945
|
+
/**
|
|
946
|
+
* User ID
|
|
947
|
+
* @description Your internal user identifier for this profile. Use this to associate a profile with a user in your system.
|
|
948
|
+
*/
|
|
949
|
+
userId?: string | null;
|
|
938
950
|
};
|
|
939
951
|
/**
|
|
940
952
|
* ProfileView
|
|
941
953
|
* @description View model for representing a profile. A profile lets you preserve the login state between sessions.
|
|
942
954
|
*
|
|
943
955
|
* We recommend that you create a separate profile for each user of your app.
|
|
956
|
+
* You can assign a user_id to each profile to easily identify which user the profile belongs to.
|
|
944
957
|
*/
|
|
945
958
|
ProfileView: {
|
|
946
959
|
/**
|
|
@@ -949,6 +962,11 @@ interface components {
|
|
|
949
962
|
* @description Unique identifier for the profile
|
|
950
963
|
*/
|
|
951
964
|
id: string;
|
|
965
|
+
/**
|
|
966
|
+
* User ID
|
|
967
|
+
* @description Your internal user identifier for this profile. Use this to associate a profile with a user in your system.
|
|
968
|
+
*/
|
|
969
|
+
userId?: string | null;
|
|
952
970
|
/**
|
|
953
971
|
* Name
|
|
954
972
|
* @description Optional name for the profile
|
|
@@ -1136,9 +1154,10 @@ interface components {
|
|
|
1136
1154
|
profileId?: string | null;
|
|
1137
1155
|
/**
|
|
1138
1156
|
* Proxy Country Code
|
|
1139
|
-
* @description Proxy country code for geo-targeted browsing.
|
|
1157
|
+
* @description Proxy country code for geo-targeted browsing. Defaults to US. Set to null to disable proxy.
|
|
1158
|
+
* @default us
|
|
1140
1159
|
*/
|
|
1141
|
-
proxyCountryCode
|
|
1160
|
+
proxyCountryCode: components["schemas"]["ProxyCountryCode"] | null;
|
|
1142
1161
|
/**
|
|
1143
1162
|
* Browser Screen Width
|
|
1144
1163
|
* @description Custom screen width in pixels for the browser.
|
|
@@ -1851,6 +1870,11 @@ interface components {
|
|
|
1851
1870
|
* @description List of stringified json actions performed by the agent in this step
|
|
1852
1871
|
*/
|
|
1853
1872
|
actions: string[];
|
|
1873
|
+
/**
|
|
1874
|
+
* Duration
|
|
1875
|
+
* @description Duration of the step in seconds. Calculated as the time elapsed from the previous step completion (or task start for the first step) to this step completion.
|
|
1876
|
+
*/
|
|
1877
|
+
duration?: number | null;
|
|
1854
1878
|
};
|
|
1855
1879
|
/**
|
|
1856
1880
|
* TaskUpdateAction
|
|
@@ -2196,6 +2220,7 @@ type ProfileView$1 = components["schemas"]["ProfileView"];
|
|
|
2196
2220
|
interface ProfileListParams {
|
|
2197
2221
|
pageSize?: number;
|
|
2198
2222
|
pageNumber?: number;
|
|
2223
|
+
query?: string;
|
|
2199
2224
|
}
|
|
2200
2225
|
declare class Profiles {
|
|
2201
2226
|
private readonly http;
|
package/dist/index.d.ts
CHANGED
|
@@ -291,9 +291,10 @@ interface components {
|
|
|
291
291
|
profileId?: string | null;
|
|
292
292
|
/**
|
|
293
293
|
* Proxy Country Code
|
|
294
|
-
* @description Country code for proxy location.
|
|
294
|
+
* @description Country code for proxy location. Defaults to US. Set to null to disable proxy.
|
|
295
|
+
* @default us
|
|
295
296
|
*/
|
|
296
|
-
proxyCountryCode
|
|
297
|
+
proxyCountryCode: components["schemas"]["ProxyCountryCode"] | null;
|
|
297
298
|
/**
|
|
298
299
|
* Timeout
|
|
299
300
|
* @description The timeout for the session in minutes. All users can use up to 240 minutes (4 hours). Pay As You Go users are charged $0.06/hour, subscribers get 50% off.
|
|
@@ -318,7 +319,7 @@ interface components {
|
|
|
318
319
|
allowResizing: boolean;
|
|
319
320
|
/**
|
|
320
321
|
* Custom Proxy
|
|
321
|
-
* @description Custom proxy settings to use for the session. If not provided, our proxies will be used. Custom proxies are only available
|
|
322
|
+
* @description Custom proxy settings to use for the session. If not provided, our proxies will be used. Custom proxies are only available on the Custom Enterprise plan.
|
|
322
323
|
*/
|
|
323
324
|
customProxy?: components["schemas"]["CustomProxy"] | null;
|
|
324
325
|
/**
|
|
@@ -340,9 +341,10 @@ interface components {
|
|
|
340
341
|
profileId?: string | null;
|
|
341
342
|
/**
|
|
342
343
|
* Proxy Country Code
|
|
343
|
-
* @description Country code for proxy location.
|
|
344
|
+
* @description Country code for proxy location. Defaults to US. Set to null to disable proxy.
|
|
345
|
+
* @default us
|
|
344
346
|
*/
|
|
345
|
-
proxyCountryCode
|
|
347
|
+
proxyCountryCode: components["schemas"]["ProxyCountryCode"] | null;
|
|
346
348
|
/**
|
|
347
349
|
* Start URL
|
|
348
350
|
* @description URL to navigate to when the session starts.
|
|
@@ -372,7 +374,7 @@ interface components {
|
|
|
372
374
|
keepAlive: boolean;
|
|
373
375
|
/**
|
|
374
376
|
* Custom Proxy
|
|
375
|
-
* @description Custom proxy settings to use for the session. If not provided, our proxies will be used. Custom proxies are only available
|
|
377
|
+
* @description Custom proxy settings to use for the session. If not provided, our proxies will be used. Custom proxies are only available on the Custom Enterprise plan.
|
|
376
378
|
*/
|
|
377
379
|
customProxy?: components["schemas"]["CustomProxy"] | null;
|
|
378
380
|
/**
|
|
@@ -887,6 +889,11 @@ interface components {
|
|
|
887
889
|
* @description Optional name for the profile
|
|
888
890
|
*/
|
|
889
891
|
name?: string | null;
|
|
892
|
+
/**
|
|
893
|
+
* User ID
|
|
894
|
+
* @description Your internal user identifier for this profile. Use this to associate a profile with a user in your system.
|
|
895
|
+
*/
|
|
896
|
+
userId?: string | null;
|
|
890
897
|
};
|
|
891
898
|
/**
|
|
892
899
|
* ProfileListResponse
|
|
@@ -935,12 +942,18 @@ interface components {
|
|
|
935
942
|
* @description Optional name for the profile
|
|
936
943
|
*/
|
|
937
944
|
name?: string | null;
|
|
945
|
+
/**
|
|
946
|
+
* User ID
|
|
947
|
+
* @description Your internal user identifier for this profile. Use this to associate a profile with a user in your system.
|
|
948
|
+
*/
|
|
949
|
+
userId?: string | null;
|
|
938
950
|
};
|
|
939
951
|
/**
|
|
940
952
|
* ProfileView
|
|
941
953
|
* @description View model for representing a profile. A profile lets you preserve the login state between sessions.
|
|
942
954
|
*
|
|
943
955
|
* We recommend that you create a separate profile for each user of your app.
|
|
956
|
+
* You can assign a user_id to each profile to easily identify which user the profile belongs to.
|
|
944
957
|
*/
|
|
945
958
|
ProfileView: {
|
|
946
959
|
/**
|
|
@@ -949,6 +962,11 @@ interface components {
|
|
|
949
962
|
* @description Unique identifier for the profile
|
|
950
963
|
*/
|
|
951
964
|
id: string;
|
|
965
|
+
/**
|
|
966
|
+
* User ID
|
|
967
|
+
* @description Your internal user identifier for this profile. Use this to associate a profile with a user in your system.
|
|
968
|
+
*/
|
|
969
|
+
userId?: string | null;
|
|
952
970
|
/**
|
|
953
971
|
* Name
|
|
954
972
|
* @description Optional name for the profile
|
|
@@ -1136,9 +1154,10 @@ interface components {
|
|
|
1136
1154
|
profileId?: string | null;
|
|
1137
1155
|
/**
|
|
1138
1156
|
* Proxy Country Code
|
|
1139
|
-
* @description Proxy country code for geo-targeted browsing.
|
|
1157
|
+
* @description Proxy country code for geo-targeted browsing. Defaults to US. Set to null to disable proxy.
|
|
1158
|
+
* @default us
|
|
1140
1159
|
*/
|
|
1141
|
-
proxyCountryCode
|
|
1160
|
+
proxyCountryCode: components["schemas"]["ProxyCountryCode"] | null;
|
|
1142
1161
|
/**
|
|
1143
1162
|
* Browser Screen Width
|
|
1144
1163
|
* @description Custom screen width in pixels for the browser.
|
|
@@ -1851,6 +1870,11 @@ interface components {
|
|
|
1851
1870
|
* @description List of stringified json actions performed by the agent in this step
|
|
1852
1871
|
*/
|
|
1853
1872
|
actions: string[];
|
|
1873
|
+
/**
|
|
1874
|
+
* Duration
|
|
1875
|
+
* @description Duration of the step in seconds. Calculated as the time elapsed from the previous step completion (or task start for the first step) to this step completion.
|
|
1876
|
+
*/
|
|
1877
|
+
duration?: number | null;
|
|
1854
1878
|
};
|
|
1855
1879
|
/**
|
|
1856
1880
|
* TaskUpdateAction
|
|
@@ -2196,6 +2220,7 @@ type ProfileView$1 = components["schemas"]["ProfileView"];
|
|
|
2196
2220
|
interface ProfileListParams {
|
|
2197
2221
|
pageSize?: number;
|
|
2198
2222
|
pageNumber?: number;
|
|
2223
|
+
query?: string;
|
|
2199
2224
|
}
|
|
2200
2225
|
declare class Profiles {
|
|
2201
2226
|
private readonly http;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/v2/client.ts","../src/v2/resources/billing.ts","../src/v2/resources/browsers.ts","../src/v2/resources/files.ts","../src/v2/resources/marketplace.ts","../src/v2/resources/profiles.ts","../src/v2/resources/sessions.ts","../src/v2/resources/skills.ts","../src/v2/helpers.ts","../src/v2/resources/tasks.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { HttpClient } from \"../core/http.js\";\nimport { Billing } from \"./resources/billing.js\";\nimport { Browsers } from \"./resources/browsers.js\";\nimport { Files } from \"./resources/files.js\";\nimport { Marketplace } from \"./resources/marketplace.js\";\nimport { Profiles } from \"./resources/profiles.js\";\nimport { Sessions } from \"./resources/sessions.js\";\nimport { Skills } from \"./resources/skills.js\";\nimport { Tasks } from \"./resources/tasks.js\";\nimport { TaskRun } from \"./helpers.js\";\nimport type { CreateTaskBody } from \"./resources/tasks.js\";\nimport type { RunOptions } from \"./helpers.js\";\n\nconst DEFAULT_BASE_URL = \"https://api.browser-use.com/api/v2\";\n\nexport interface BrowserUseOptions {\n apiKey?: string;\n baseUrl?: string;\n maxRetries?: number;\n timeout?: number;\n}\n\nexport type RunTaskOptions = Partial<Omit<CreateTaskBody, \"task\">> &\n RunOptions & { schema?: z.ZodType };\n\nexport class BrowserUse {\n readonly billing: Billing;\n readonly tasks: Tasks;\n readonly sessions: Sessions;\n readonly files: Files;\n readonly profiles: Profiles;\n readonly browsers: Browsers;\n readonly skills: Skills;\n readonly marketplace: Marketplace;\n\n private readonly http: HttpClient;\n\n constructor(options: BrowserUseOptions = {}) {\n const apiKey =\n options.apiKey ?? process.env.BROWSER_USE_API_KEY ?? \"\";\n if (!apiKey) {\n throw new Error(\n \"No API key provided. Pass apiKey or set BROWSER_USE_API_KEY.\",\n );\n }\n this.http = new HttpClient({\n apiKey,\n baseUrl: options.baseUrl ?? DEFAULT_BASE_URL,\n maxRetries: options.maxRetries,\n timeout: options.timeout,\n });\n\n this.billing = new Billing(this.http);\n this.tasks = new Tasks(this.http);\n this.sessions = new Sessions(this.http);\n this.files = new Files(this.http);\n this.profiles = new Profiles(this.http);\n this.browsers = new Browsers(this.http);\n this.skills = new Skills(this.http);\n this.marketplace = new Marketplace(this.http);\n }\n\n /**\n * Run an AI agent task.\n *\n * ```ts\n * // Simple — just get the output\n * const output = await client.run(\"Find the top HN post\");\n *\n * // Structured output (Zod)\n * const data = await client.run(\"Find product info\", { schema: ProductSchema });\n *\n * // Step-by-step progress\n * for await (const step of client.run(\"Go to google.com\")) {\n * console.log(`[${step.number}] ${step.nextGoal}`);\n * }\n * ```\n */\n run(task: string, options?: Omit<RunTaskOptions, \"schema\">): TaskRun<string>;\n run<T extends z.ZodType>(task: string, options: RunTaskOptions & { schema: T }): TaskRun<z.output<T>>;\n run(task: string, options?: RunTaskOptions): TaskRun<any> {\n const { schema, timeout, interval, ...rest } = options ?? {};\n const body: CreateTaskBody = { task, ...rest };\n if (schema) {\n body.structuredOutput = JSON.stringify(z.toJSONSchema(schema));\n }\n const promise = this.tasks.create(body);\n return new TaskRun(promise, this.tasks, schema, { timeout, interval });\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\ntype AccountView = components[\"schemas\"][\"AccountView\"];\n\nexport class Billing {\n constructor(private readonly http: HttpClient) {}\n\n /** Get authenticated account billing information including credit balance. */\n account(): Promise<AccountView> {\n return this.http.get<AccountView>(\"/billing/account\");\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\n/** All fields are optional (server applies defaults); body itself is required by the spec. */\nexport type CreateBrowserBody = Partial<components[\"schemas\"][\"CreateBrowserSessionRequest\"]>;\ntype BrowserSessionItemView = components[\"schemas\"][\"BrowserSessionItemView\"];\ntype BrowserSessionListResponse = components[\"schemas\"][\"BrowserSessionListResponse\"];\ntype BrowserSessionView = components[\"schemas\"][\"BrowserSessionView\"];\ntype UpdateBrowserSessionRequest = components[\"schemas\"][\"UpdateBrowserSessionRequest\"];\n\nexport interface BrowserListParams {\n pageSize?: number;\n pageNumber?: number;\n filterBy?: string;\n}\n\nexport class Browsers {\n constructor(private readonly http: HttpClient) {}\n\n /** Create a new browser session. */\n create(body: CreateBrowserBody = {}): Promise<BrowserSessionItemView> {\n return this.http.post<BrowserSessionItemView>(\"/browsers\", body);\n }\n\n /** List browser sessions with optional filtering. */\n list(params?: BrowserListParams): Promise<BrowserSessionListResponse> {\n return this.http.get<BrowserSessionListResponse>(\n \"/browsers\",\n params as Record<string, unknown>,\n );\n }\n\n /** Get detailed browser session information. */\n get(sessionId: string): Promise<BrowserSessionView> {\n return this.http.get<BrowserSessionView>(`/browsers/${sessionId}`);\n }\n\n /** Update a browser session (generic PATCH). */\n update(sessionId: string, body: UpdateBrowserSessionRequest): Promise<BrowserSessionView> {\n return this.http.patch<BrowserSessionView>(`/browsers/${sessionId}`, body);\n }\n\n /** Stop a browser session. */\n stop(sessionId: string): Promise<BrowserSessionView> {\n return this.update(sessionId, { action: \"stop\" });\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\ntype UploadFileRequest = components[\"schemas\"][\"UploadFileRequest\"];\ntype UploadFilePresignedUrlResponse = components[\"schemas\"][\"UploadFilePresignedUrlResponse\"];\ntype TaskOutputFileResponse = components[\"schemas\"][\"TaskOutputFileResponse\"];\n\nexport class Files {\n constructor(private readonly http: HttpClient) {}\n\n /** Generate a presigned URL for uploading files to an agent session. */\n sessionUrl(sessionId: string, body: UploadFileRequest): Promise<UploadFilePresignedUrlResponse> {\n return this.http.post<UploadFilePresignedUrlResponse>(\n `/files/sessions/${sessionId}/presigned-url`,\n body,\n );\n }\n\n /** Generate a presigned URL for uploading files to a browser session. */\n browserUrl(sessionId: string, body: UploadFileRequest): Promise<UploadFilePresignedUrlResponse> {\n return this.http.post<UploadFilePresignedUrlResponse>(\n `/files/browsers/${sessionId}/presigned-url`,\n body,\n );\n }\n\n /** Get secure download URL for a task output file. */\n taskOutput(taskId: string, fileId: string): Promise<TaskOutputFileResponse> {\n return this.http.get<TaskOutputFileResponse>(\n `/files/tasks/${taskId}/output-files/${fileId}`,\n );\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\ntype ExecuteSkillRequest = components[\"schemas\"][\"ExecuteSkillRequest\"];\ntype ExecuteSkillResponse = components[\"schemas\"][\"ExecuteSkillResponse\"];\ntype MarketplaceSkillListResponse = components[\"schemas\"][\"MarketplaceSkillListResponse\"];\ntype MarketplaceSkillResponse = components[\"schemas\"][\"MarketplaceSkillResponse\"];\ntype SkillResponse = components[\"schemas\"][\"SkillResponse\"];\n\nexport interface MarketplaceListParams {\n pageSize?: number;\n pageNumber?: number;\n query?: string;\n category?: string;\n fromDate?: string;\n toDate?: string;\n}\n\nexport class Marketplace {\n constructor(private readonly http: HttpClient) {}\n\n /** List all public skills in the marketplace. */\n list(params?: MarketplaceListParams): Promise<MarketplaceSkillListResponse> {\n return this.http.get<MarketplaceSkillListResponse>(\n \"/marketplace/skills\",\n params as Record<string, unknown>,\n );\n }\n\n /** Get details of a specific marketplace skill by slug. */\n get(skillSlug: string): Promise<MarketplaceSkillResponse> {\n return this.http.get<MarketplaceSkillResponse>(`/marketplace/skills/${skillSlug}`);\n }\n\n /** Clone a public marketplace skill to your project. */\n clone(skillId: string): Promise<SkillResponse> {\n return this.http.post<SkillResponse>(`/marketplace/skills/${skillId}/clone`);\n }\n\n /** Execute a marketplace skill. */\n execute(skillId: string, body: ExecuteSkillRequest): Promise<ExecuteSkillResponse> {\n return this.http.post<ExecuteSkillResponse>(\n `/marketplace/skills/${skillId}/execute`,\n body,\n );\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\ntype ProfileCreateRequest = components[\"schemas\"][\"ProfileCreateRequest\"];\ntype ProfileListResponse = components[\"schemas\"][\"ProfileListResponse\"];\ntype ProfileUpdateRequest = components[\"schemas\"][\"ProfileUpdateRequest\"];\ntype ProfileView = components[\"schemas\"][\"ProfileView\"];\n\nexport interface ProfileListParams {\n pageSize?: number;\n pageNumber?: number;\n}\n\nexport class Profiles {\n constructor(private readonly http: HttpClient) {}\n\n /** Create a new browser profile. */\n create(body?: ProfileCreateRequest): Promise<ProfileView> {\n return this.http.post<ProfileView>(\"/profiles\", body);\n }\n\n /** List profiles with pagination. */\n list(params?: ProfileListParams): Promise<ProfileListResponse> {\n return this.http.get<ProfileListResponse>(\"/profiles\", params as Record<string, unknown>);\n }\n\n /** Get profile details. */\n get(profileId: string): Promise<ProfileView> {\n return this.http.get<ProfileView>(`/profiles/${profileId}`);\n }\n\n /** Update a browser profile. */\n update(profileId: string, body: ProfileUpdateRequest): Promise<ProfileView> {\n return this.http.patch<ProfileView>(`/profiles/${profileId}`, body);\n }\n\n /** Delete a browser profile. */\n delete(profileId: string): Promise<void> {\n return this.http.delete<void>(`/profiles/${profileId}`);\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\n/** User-facing body: all fields are optional (API has defaults). */\ntype CreateSessionBody = Partial<components[\"schemas\"][\"CreateSessionRequest\"]>;\ntype SessionItemView = components[\"schemas\"][\"SessionItemView\"];\ntype SessionListResponse = components[\"schemas\"][\"SessionListResponse\"];\ntype SessionView = components[\"schemas\"][\"SessionView\"];\ntype ShareView = components[\"schemas\"][\"ShareView\"];\ntype UpdateSessionRequest = components[\"schemas\"][\"UpdateSessionRequest\"];\n\nexport interface SessionListParams {\n pageSize?: number;\n pageNumber?: number;\n filterBy?: string;\n}\n\nexport class Sessions {\n constructor(private readonly http: HttpClient) {}\n\n /** Create a new session. */\n create(body?: CreateSessionBody): Promise<SessionItemView> {\n return this.http.post<SessionItemView>(\"/sessions\", body);\n }\n\n /** List sessions with optional filtering. */\n list(params?: SessionListParams): Promise<SessionListResponse> {\n return this.http.get<SessionListResponse>(\"/sessions\", params as Record<string, unknown>);\n }\n\n /** Get detailed session information. */\n get(sessionId: string): Promise<SessionView> {\n return this.http.get<SessionView>(`/sessions/${sessionId}`);\n }\n\n /** Update a session (generic PATCH). */\n update(sessionId: string, body: UpdateSessionRequest): Promise<SessionView> {\n return this.http.patch<SessionView>(`/sessions/${sessionId}`, body);\n }\n\n /** Stop a session and all its running tasks. */\n stop(sessionId: string): Promise<SessionView> {\n return this.update(sessionId, { action: \"stop\" });\n }\n\n /** Delete a session with all its tasks. */\n delete(sessionId: string): Promise<void> {\n return this.http.delete<void>(`/sessions/${sessionId}`);\n }\n\n /** Get public share information for a session. */\n getShare(sessionId: string): Promise<ShareView> {\n return this.http.get<ShareView>(`/sessions/${sessionId}/public-share`);\n }\n\n /** Create or return existing public share for a session. */\n createShare(sessionId: string): Promise<ShareView> {\n return this.http.post<ShareView>(`/sessions/${sessionId}/public-share`);\n }\n\n /** Remove public share for a session. */\n deleteShare(sessionId: string): Promise<void> {\n return this.http.delete<void>(`/sessions/${sessionId}/public-share`);\n }\n\n /** Purge all session data (ZDR projects only). */\n purge(sessionId: string): Promise<void> {\n return this.http.post<void>(`/sessions/${sessionId}/purge`);\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\ntype CreateSkillRequest = components[\"schemas\"][\"CreateSkillRequest\"];\ntype CreateSkillResponse = components[\"schemas\"][\"CreateSkillResponse\"];\ntype ExecuteSkillRequest = components[\"schemas\"][\"ExecuteSkillRequest\"];\ntype ExecuteSkillResponse = components[\"schemas\"][\"ExecuteSkillResponse\"];\ntype RefineSkillRequest = components[\"schemas\"][\"RefineSkillRequest\"];\ntype RefineSkillResponse = components[\"schemas\"][\"RefineSkillResponse\"];\ntype SkillExecutionListResponse = components[\"schemas\"][\"SkillExecutionListResponse\"];\ntype SkillExecutionOutputResponse = components[\"schemas\"][\"SkillExecutionOutputResponse\"];\ntype SkillListResponse = components[\"schemas\"][\"SkillListResponse\"];\ntype SkillResponse = components[\"schemas\"][\"SkillResponse\"];\ntype UpdateSkillRequest = components[\"schemas\"][\"UpdateSkillRequest\"];\n\nexport interface SkillListParams {\n pageSize?: number;\n pageNumber?: number;\n isPublic?: boolean;\n isEnabled?: boolean;\n category?: string;\n query?: string;\n fromDate?: string;\n toDate?: string;\n}\n\nexport interface SkillExecutionListParams {\n pageSize?: number;\n pageNumber?: number;\n}\n\nexport class Skills {\n constructor(private readonly http: HttpClient) {}\n\n /** Create a new skill via automated generation. */\n create(body: CreateSkillRequest): Promise<CreateSkillResponse> {\n return this.http.post<CreateSkillResponse>(\"/skills\", body);\n }\n\n /** List all skills owned by the project. */\n list(params?: SkillListParams): Promise<SkillListResponse> {\n return this.http.get<SkillListResponse>(\"/skills\", params as Record<string, unknown>);\n }\n\n /** Get details of a specific skill. */\n get(skillId: string): Promise<SkillResponse> {\n return this.http.get<SkillResponse>(`/skills/${skillId}`);\n }\n\n /** Delete a skill. */\n delete(skillId: string): Promise<void> {\n return this.http.delete<void>(`/skills/${skillId}`);\n }\n\n /** Update skill metadata. */\n update(skillId: string, body: UpdateSkillRequest): Promise<SkillResponse> {\n return this.http.patch<SkillResponse>(`/skills/${skillId}`, body);\n }\n\n /** Cancel the current in-progress generation for a skill. */\n cancel(skillId: string): Promise<SkillResponse> {\n return this.http.post<SkillResponse>(`/skills/${skillId}/cancel`);\n }\n\n /** Execute a skill with the provided parameters. */\n execute(skillId: string, body: ExecuteSkillRequest): Promise<ExecuteSkillResponse> {\n return this.http.post<ExecuteSkillResponse>(`/skills/${skillId}/execute`, body);\n }\n\n /** Refine a skill based on feedback. */\n refine(skillId: string, body: RefineSkillRequest): Promise<RefineSkillResponse> {\n return this.http.post<RefineSkillResponse>(`/skills/${skillId}/refine`, body);\n }\n\n /** Rollback to the previous version. */\n rollback(skillId: string): Promise<SkillResponse> {\n return this.http.post<SkillResponse>(`/skills/${skillId}/rollback`);\n }\n\n /** List executions for a specific skill. */\n executions(skillId: string, params?: SkillExecutionListParams): Promise<SkillExecutionListResponse> {\n return this.http.get<SkillExecutionListResponse>(\n `/skills/${skillId}/executions`,\n params as Record<string, unknown>,\n );\n }\n\n /** Get presigned URL for downloading skill execution output. */\n executionOutput(skillId: string, executionId: string): Promise<SkillExecutionOutputResponse> {\n return this.http.get<SkillExecutionOutputResponse>(\n `/skills/${skillId}/executions/${executionId}/output`,\n );\n }\n}\n","import type { z } from \"zod\";\nimport type { components } from \"../generated/v2/types.js\";\nimport type { Tasks } from \"./resources/tasks.js\";\n\ntype TaskCreatedResponse = components[\"schemas\"][\"TaskCreatedResponse\"];\ntype TaskStepView = components[\"schemas\"][\"TaskStepView\"];\ntype TaskView = components[\"schemas\"][\"TaskView\"];\n\nexport const TERMINAL_STATUSES = new Set([\"finished\", \"stopped\"]);\n\n/** Task result with typed output. All TaskView fields are directly accessible. */\nexport type TaskResult<T = string | null> = Omit<TaskView, \"output\"> & { output: T };\n\nexport interface RunOptions {\n /** Maximum time to wait in milliseconds. Default: 300_000 (5 min). */\n timeout?: number;\n /** Polling interval in milliseconds. Default: 2_000. */\n interval?: number;\n}\n\n/**\n * Lazy task handle returned by `client.run()`.\n *\n * - `await client.run(...)` polls the lightweight status endpoint, returns a `TaskResult`.\n * - `for await (const step of client.run(...))` polls the full task, yields new steps.\n */\nexport class TaskRun<T = string> implements PromiseLike<TaskResult<T>> {\n private readonly _createPromise: Promise<TaskCreatedResponse>;\n private readonly _tasks: Tasks;\n private readonly _schema?: z.ZodType<T>;\n private readonly _timeout: number;\n private readonly _interval: number;\n\n private _taskId: string | null = null;\n private _result: TaskResult<T> | null = null;\n\n constructor(\n createPromise: Promise<TaskCreatedResponse>,\n tasks: Tasks,\n schema?: z.ZodType<T>,\n options?: RunOptions,\n ) {\n this._createPromise = createPromise;\n this._tasks = tasks;\n this._schema = schema;\n this._timeout = options?.timeout ?? 300_000;\n this._interval = options?.interval ?? 2_000;\n }\n\n /** Task ID (available after creation resolves). */\n get taskId(): string | null {\n return this._taskId;\n }\n\n /** Full task result (available after awaiting or iterating to completion). */\n get result(): TaskResult<T> | null {\n return this._result;\n }\n\n /** Enable `await client.run(...)` — polls status endpoint, returns TaskResult. */\n then<R1 = TaskResult<T>, R2 = never>(\n onFulfilled?: ((value: TaskResult<T>) => R1 | PromiseLike<R1>) | null,\n onRejected?: ((reason: unknown) => R2 | PromiseLike<R2>) | null,\n ): Promise<R1 | R2> {\n return this._waitForOutput().then(onFulfilled, onRejected);\n }\n\n /** Enable `for await (const step of client.run(...))` — polls full task, yields new steps. */\n async *[Symbol.asyncIterator](): AsyncGenerator<TaskStepView> {\n const taskId = await this._ensureTaskId();\n let seen = 0;\n const deadline = Date.now() + this._timeout;\n\n while (Date.now() < deadline) {\n const task = await this._tasks.get(taskId);\n\n for (let i = seen; i < task.steps.length; i++) {\n yield task.steps[i];\n }\n seen = task.steps.length;\n\n if (TERMINAL_STATUSES.has(task.status)) {\n this._result = this._buildResult(task);\n return;\n }\n\n const remaining = deadline - Date.now();\n if (remaining <= 0) break;\n await new Promise((r) => setTimeout(r, Math.min(this._interval, remaining)));\n }\n\n throw new Error(`Task ${taskId} did not complete within ${this._timeout}ms`);\n }\n\n private async _ensureTaskId(): Promise<string> {\n if (this._taskId) return this._taskId;\n const created = await this._createPromise;\n this._taskId = created.id;\n return this._taskId;\n }\n\n /** Poll lightweight status endpoint until terminal, return TaskResult. */\n private async _waitForOutput(): Promise<TaskResult<T>> {\n const taskId = await this._ensureTaskId();\n const deadline = Date.now() + this._timeout;\n\n while (Date.now() < deadline) {\n const status = await this._tasks.status(taskId);\n if (TERMINAL_STATUSES.has(status.status)) {\n const task = await this._tasks.get(taskId);\n this._result = this._buildResult(task);\n return this._result;\n }\n const remaining = deadline - Date.now();\n if (remaining <= 0) break;\n await new Promise((r) => setTimeout(r, Math.min(this._interval, remaining)));\n }\n\n throw new Error(`Task ${taskId} did not complete within ${this._timeout}ms`);\n }\n\n private _buildResult(task: TaskView): TaskResult<T> {\n const output = this._parseOutput(task.output);\n return { ...task, output };\n }\n\n private _parseOutput(output: string | null | undefined): T {\n if (output == null) return null as T;\n if (!this._schema) return output as unknown as T;\n return this._schema.parse(JSON.parse(output));\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\nimport { TERMINAL_STATUSES } from \"../helpers.js\";\n\n/** User-facing body: only `task` is required; everything else has API defaults. */\nexport type CreateTaskBody = Pick<components[\"schemas\"][\"CreateTaskRequest\"], \"task\"> &\n Partial<Omit<components[\"schemas\"][\"CreateTaskRequest\"], \"task\">>;\ntype TaskCreatedResponse = components[\"schemas\"][\"TaskCreatedResponse\"];\ntype TaskListResponse = components[\"schemas\"][\"TaskListResponse\"];\ntype TaskLogFileResponse = components[\"schemas\"][\"TaskLogFileResponse\"];\ntype TaskStatusView = components[\"schemas\"][\"TaskStatusView\"];\ntype TaskView = components[\"schemas\"][\"TaskView\"];\ntype UpdateTaskRequest = components[\"schemas\"][\"UpdateTaskRequest\"];\n\nexport interface TaskListParams {\n pageSize?: number;\n pageNumber?: number;\n sessionId?: string;\n filterBy?: string;\n after?: string;\n before?: string;\n}\n\nexport class Tasks {\n constructor(private readonly http: HttpClient) {}\n\n /** Create and start a new AI agent task. */\n create(body: CreateTaskBody): Promise<TaskCreatedResponse> {\n return this.http.post<TaskCreatedResponse>(\"/tasks\", body);\n }\n\n /** List tasks with optional filtering. */\n list(params?: TaskListParams): Promise<TaskListResponse> {\n return this.http.get<TaskListResponse>(\"/tasks\", params as Record<string, unknown>);\n }\n\n /** Get detailed task information. */\n get(taskId: string): Promise<TaskView> {\n return this.http.get<TaskView>(`/tasks/${taskId}`);\n }\n\n /** Update a task (generic PATCH). */\n update(taskId: string, body: UpdateTaskRequest): Promise<TaskView> {\n return this.http.patch<TaskView>(`/tasks/${taskId}`, body);\n }\n\n /** Stop a running task. */\n stop(taskId: string): Promise<TaskView> {\n return this.update(taskId, { action: \"stop\" });\n }\n\n /** Stop a running task and its associated browser session. */\n stopTaskAndSession(taskId: string): Promise<TaskView> {\n return this.update(taskId, { action: \"stop_task_and_session\" });\n }\n\n /** Get lightweight task status (optimized for polling). */\n status(taskId: string): Promise<TaskStatusView> {\n return this.http.get<TaskStatusView>(`/tasks/${taskId}/status`);\n }\n\n /** Get secure download URL for task execution logs. */\n logs(taskId: string): Promise<TaskLogFileResponse> {\n return this.http.get<TaskLogFileResponse>(`/tasks/${taskId}/logs`);\n }\n\n /** Poll until a task reaches a terminal status, then return the full TaskView. */\n async wait(taskId: string, opts?: { timeout?: number; interval?: number }): Promise<TaskView> {\n const timeout = opts?.timeout ?? 300_000;\n const interval = opts?.interval ?? 2_000;\n const deadline = Date.now() + timeout;\n\n while (Date.now() < deadline) {\n const status = await this.status(taskId);\n if (TERMINAL_STATUSES.has(status.status)) {\n return this.get(taskId);\n }\n const remaining = deadline - Date.now();\n if (remaining <= 0) break;\n await new Promise((r) => setTimeout(r, Math.min(interval, remaining)));\n }\n\n throw new Error(`Task ${taskId} did not complete within ${timeout}ms`);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAS,SAAS;;;ACKX,IAAM,UAAN,MAAc;AAAA,EACnB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA;AAAA,EAGhD,UAAgC;AAC9B,WAAO,KAAK,KAAK,IAAiB,kBAAkB;AAAA,EACtD;AACF;;;ACIO,IAAM,WAAN,MAAe;AAAA,EACpB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB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AAS,IAAI,OAAO,KAAK,IAAI;AAClC,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAAA,EAC9C;AAAA,EAoBA,IAAI,MAAc,SAAwC;AACxD,UAAM,EAAE,QAAQ,SAAS,UAAU,GAAG,KAAK,IAAI,WAAW,CAAC;AAC3D,UAAM,OAAuB,EAAE,MAAM,GAAG,KAAK;AAC7C,QAAI,QAAQ;AACV,WAAK,mBAAmB,KAAK,UAAU,EAAE,aAAa,MAAM,CAAC;AAAA,IAC/D;AACA,UAAM,UAAU,KAAK,MAAM,OAAO,IAAI;AACtC,WAAO,IAAI,QAAQ,SAAS,KAAK,OAAO,QAAQ,EAAE,SAAS,SAAS,CAAC;AAAA,EACvE;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/v2/client.ts","../src/v2/resources/billing.ts","../src/v2/resources/browsers.ts","../src/v2/resources/files.ts","../src/v2/resources/marketplace.ts","../src/v2/resources/profiles.ts","../src/v2/resources/sessions.ts","../src/v2/resources/skills.ts","../src/v2/helpers.ts","../src/v2/resources/tasks.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { HttpClient } from \"../core/http.js\";\nimport { Billing } from \"./resources/billing.js\";\nimport { Browsers } from \"./resources/browsers.js\";\nimport { Files } from \"./resources/files.js\";\nimport { Marketplace } from \"./resources/marketplace.js\";\nimport { Profiles } from \"./resources/profiles.js\";\nimport { Sessions } from \"./resources/sessions.js\";\nimport { Skills } from \"./resources/skills.js\";\nimport { Tasks } from \"./resources/tasks.js\";\nimport { TaskRun } from \"./helpers.js\";\nimport type { CreateTaskBody } from \"./resources/tasks.js\";\nimport type { RunOptions } from \"./helpers.js\";\n\nconst DEFAULT_BASE_URL = \"https://api.browser-use.com/api/v2\";\n\nexport interface BrowserUseOptions {\n apiKey?: string;\n baseUrl?: string;\n maxRetries?: number;\n timeout?: number;\n}\n\nexport type RunTaskOptions = Partial<Omit<CreateTaskBody, \"task\">> &\n RunOptions & { schema?: z.ZodType };\n\nexport class BrowserUse {\n readonly billing: Billing;\n readonly tasks: Tasks;\n readonly sessions: Sessions;\n readonly files: Files;\n readonly profiles: Profiles;\n readonly browsers: Browsers;\n readonly skills: Skills;\n readonly marketplace: Marketplace;\n\n private readonly http: HttpClient;\n\n constructor(options: BrowserUseOptions = {}) {\n const apiKey =\n options.apiKey ?? process.env.BROWSER_USE_API_KEY ?? \"\";\n if (!apiKey) {\n throw new Error(\n \"No API key provided. Pass apiKey or set BROWSER_USE_API_KEY.\",\n );\n }\n this.http = new HttpClient({\n apiKey,\n baseUrl: options.baseUrl ?? DEFAULT_BASE_URL,\n maxRetries: options.maxRetries,\n timeout: options.timeout,\n });\n\n this.billing = new Billing(this.http);\n this.tasks = new Tasks(this.http);\n this.sessions = new Sessions(this.http);\n this.files = new Files(this.http);\n this.profiles = new Profiles(this.http);\n this.browsers = new Browsers(this.http);\n this.skills = new Skills(this.http);\n this.marketplace = new Marketplace(this.http);\n }\n\n /**\n * Run an AI agent task.\n *\n * ```ts\n * // Simple — just get the output\n * const output = await client.run(\"Find the top HN post\");\n *\n * // Structured output (Zod)\n * const data = await client.run(\"Find product info\", { schema: ProductSchema });\n *\n * // Step-by-step progress\n * for await (const step of client.run(\"Go to google.com\")) {\n * console.log(`[${step.number}] ${step.nextGoal}`);\n * }\n * ```\n */\n run(task: string, options?: Omit<RunTaskOptions, \"schema\">): TaskRun<string>;\n run<T extends z.ZodType>(task: string, options: RunTaskOptions & { schema: T }): TaskRun<z.output<T>>;\n run(task: string, options?: RunTaskOptions): TaskRun<any> {\n const { schema, timeout, interval, ...rest } = options ?? {};\n const body: CreateTaskBody = { task, ...rest };\n if (schema) {\n body.structuredOutput = JSON.stringify(z.toJSONSchema(schema));\n }\n const promise = this.tasks.create(body);\n return new TaskRun(promise, this.tasks, schema, { timeout, interval });\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\ntype AccountView = components[\"schemas\"][\"AccountView\"];\n\nexport class Billing {\n constructor(private readonly http: HttpClient) {}\n\n /** Get authenticated account billing information including credit balance. */\n account(): Promise<AccountView> {\n return this.http.get<AccountView>(\"/billing/account\");\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\n/** All fields are optional (server applies defaults); body itself is required by the spec. */\nexport type CreateBrowserBody = Partial<components[\"schemas\"][\"CreateBrowserSessionRequest\"]>;\ntype BrowserSessionItemView = components[\"schemas\"][\"BrowserSessionItemView\"];\ntype BrowserSessionListResponse = components[\"schemas\"][\"BrowserSessionListResponse\"];\ntype BrowserSessionView = components[\"schemas\"][\"BrowserSessionView\"];\ntype UpdateBrowserSessionRequest = components[\"schemas\"][\"UpdateBrowserSessionRequest\"];\n\nexport interface BrowserListParams {\n pageSize?: number;\n pageNumber?: number;\n filterBy?: string;\n}\n\nexport class Browsers {\n constructor(private readonly http: HttpClient) {}\n\n /** Create a new browser session. */\n create(body: CreateBrowserBody = {}): Promise<BrowserSessionItemView> {\n return this.http.post<BrowserSessionItemView>(\"/browsers\", body);\n }\n\n /** List browser sessions with optional filtering. */\n list(params?: BrowserListParams): Promise<BrowserSessionListResponse> {\n return this.http.get<BrowserSessionListResponse>(\n \"/browsers\",\n params as Record<string, unknown>,\n );\n }\n\n /** Get detailed browser session information. */\n get(sessionId: string): Promise<BrowserSessionView> {\n return this.http.get<BrowserSessionView>(`/browsers/${sessionId}`);\n }\n\n /** Update a browser session (generic PATCH). */\n update(sessionId: string, body: UpdateBrowserSessionRequest): Promise<BrowserSessionView> {\n return this.http.patch<BrowserSessionView>(`/browsers/${sessionId}`, body);\n }\n\n /** Stop a browser session. */\n stop(sessionId: string): Promise<BrowserSessionView> {\n return this.update(sessionId, { action: \"stop\" });\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\ntype UploadFileRequest = components[\"schemas\"][\"UploadFileRequest\"];\ntype UploadFilePresignedUrlResponse = components[\"schemas\"][\"UploadFilePresignedUrlResponse\"];\ntype TaskOutputFileResponse = components[\"schemas\"][\"TaskOutputFileResponse\"];\n\nexport class Files {\n constructor(private readonly http: HttpClient) {}\n\n /** Generate a presigned URL for uploading files to an agent session. */\n sessionUrl(sessionId: string, body: UploadFileRequest): Promise<UploadFilePresignedUrlResponse> {\n return this.http.post<UploadFilePresignedUrlResponse>(\n `/files/sessions/${sessionId}/presigned-url`,\n body,\n );\n }\n\n /** Generate a presigned URL for uploading files to a browser session. */\n browserUrl(sessionId: string, body: UploadFileRequest): Promise<UploadFilePresignedUrlResponse> {\n return this.http.post<UploadFilePresignedUrlResponse>(\n `/files/browsers/${sessionId}/presigned-url`,\n body,\n );\n }\n\n /** Get secure download URL for a task output file. */\n taskOutput(taskId: string, fileId: string): Promise<TaskOutputFileResponse> {\n return this.http.get<TaskOutputFileResponse>(\n `/files/tasks/${taskId}/output-files/${fileId}`,\n );\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\ntype ExecuteSkillRequest = components[\"schemas\"][\"ExecuteSkillRequest\"];\ntype ExecuteSkillResponse = components[\"schemas\"][\"ExecuteSkillResponse\"];\ntype MarketplaceSkillListResponse = components[\"schemas\"][\"MarketplaceSkillListResponse\"];\ntype MarketplaceSkillResponse = components[\"schemas\"][\"MarketplaceSkillResponse\"];\ntype SkillResponse = components[\"schemas\"][\"SkillResponse\"];\n\nexport interface MarketplaceListParams {\n pageSize?: number;\n pageNumber?: number;\n query?: string;\n category?: string;\n fromDate?: string;\n toDate?: string;\n}\n\nexport class Marketplace {\n constructor(private readonly http: HttpClient) {}\n\n /** List all public skills in the marketplace. */\n list(params?: MarketplaceListParams): Promise<MarketplaceSkillListResponse> {\n return this.http.get<MarketplaceSkillListResponse>(\n \"/marketplace/skills\",\n params as Record<string, unknown>,\n );\n }\n\n /** Get details of a specific marketplace skill by slug. */\n get(skillSlug: string): Promise<MarketplaceSkillResponse> {\n return this.http.get<MarketplaceSkillResponse>(`/marketplace/skills/${skillSlug}`);\n }\n\n /** Clone a public marketplace skill to your project. */\n clone(skillId: string): Promise<SkillResponse> {\n return this.http.post<SkillResponse>(`/marketplace/skills/${skillId}/clone`);\n }\n\n /** Execute a marketplace skill. */\n execute(skillId: string, body: ExecuteSkillRequest): Promise<ExecuteSkillResponse> {\n return this.http.post<ExecuteSkillResponse>(\n `/marketplace/skills/${skillId}/execute`,\n body,\n );\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\ntype ProfileCreateRequest = components[\"schemas\"][\"ProfileCreateRequest\"];\ntype ProfileListResponse = components[\"schemas\"][\"ProfileListResponse\"];\ntype ProfileUpdateRequest = components[\"schemas\"][\"ProfileUpdateRequest\"];\ntype ProfileView = components[\"schemas\"][\"ProfileView\"];\n\nexport interface ProfileListParams {\n pageSize?: number;\n pageNumber?: number;\n query?: string;\n}\n\nexport class Profiles {\n constructor(private readonly http: HttpClient) {}\n\n /** Create a new browser profile. */\n create(body?: ProfileCreateRequest): Promise<ProfileView> {\n return this.http.post<ProfileView>(\"/profiles\", body);\n }\n\n /** List profiles with pagination. */\n list(params?: ProfileListParams): Promise<ProfileListResponse> {\n return this.http.get<ProfileListResponse>(\"/profiles\", params as Record<string, unknown>);\n }\n\n /** Get profile details. */\n get(profileId: string): Promise<ProfileView> {\n return this.http.get<ProfileView>(`/profiles/${profileId}`);\n }\n\n /** Update a browser profile. */\n update(profileId: string, body: ProfileUpdateRequest): Promise<ProfileView> {\n return this.http.patch<ProfileView>(`/profiles/${profileId}`, body);\n }\n\n /** Delete a browser profile. */\n delete(profileId: string): Promise<void> {\n return this.http.delete<void>(`/profiles/${profileId}`);\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\n/** User-facing body: all fields are optional (API has defaults). */\ntype CreateSessionBody = Partial<components[\"schemas\"][\"CreateSessionRequest\"]>;\ntype SessionItemView = components[\"schemas\"][\"SessionItemView\"];\ntype SessionListResponse = components[\"schemas\"][\"SessionListResponse\"];\ntype SessionView = components[\"schemas\"][\"SessionView\"];\ntype ShareView = components[\"schemas\"][\"ShareView\"];\ntype UpdateSessionRequest = components[\"schemas\"][\"UpdateSessionRequest\"];\n\nexport interface SessionListParams {\n pageSize?: number;\n pageNumber?: number;\n filterBy?: string;\n}\n\nexport class Sessions {\n constructor(private readonly http: HttpClient) {}\n\n /** Create a new session. */\n create(body?: CreateSessionBody): Promise<SessionItemView> {\n return this.http.post<SessionItemView>(\"/sessions\", body);\n }\n\n /** List sessions with optional filtering. */\n list(params?: SessionListParams): Promise<SessionListResponse> {\n return this.http.get<SessionListResponse>(\"/sessions\", params as Record<string, unknown>);\n }\n\n /** Get detailed session information. */\n get(sessionId: string): Promise<SessionView> {\n return this.http.get<SessionView>(`/sessions/${sessionId}`);\n }\n\n /** Update a session (generic PATCH). */\n update(sessionId: string, body: UpdateSessionRequest): Promise<SessionView> {\n return this.http.patch<SessionView>(`/sessions/${sessionId}`, body);\n }\n\n /** Stop a session and all its running tasks. */\n stop(sessionId: string): Promise<SessionView> {\n return this.update(sessionId, { action: \"stop\" });\n }\n\n /** Delete a session with all its tasks. */\n delete(sessionId: string): Promise<void> {\n return this.http.delete<void>(`/sessions/${sessionId}`);\n }\n\n /** Get public share information for a session. */\n getShare(sessionId: string): Promise<ShareView> {\n return this.http.get<ShareView>(`/sessions/${sessionId}/public-share`);\n }\n\n /** Create or return existing public share for a session. */\n createShare(sessionId: string): Promise<ShareView> {\n return this.http.post<ShareView>(`/sessions/${sessionId}/public-share`);\n }\n\n /** Remove public share for a session. */\n deleteShare(sessionId: string): Promise<void> {\n return this.http.delete<void>(`/sessions/${sessionId}/public-share`);\n }\n\n /** Purge all session data (ZDR projects only). */\n purge(sessionId: string): Promise<void> {\n return this.http.post<void>(`/sessions/${sessionId}/purge`);\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\n\ntype CreateSkillRequest = components[\"schemas\"][\"CreateSkillRequest\"];\ntype CreateSkillResponse = components[\"schemas\"][\"CreateSkillResponse\"];\ntype ExecuteSkillRequest = components[\"schemas\"][\"ExecuteSkillRequest\"];\ntype ExecuteSkillResponse = components[\"schemas\"][\"ExecuteSkillResponse\"];\ntype RefineSkillRequest = components[\"schemas\"][\"RefineSkillRequest\"];\ntype RefineSkillResponse = components[\"schemas\"][\"RefineSkillResponse\"];\ntype SkillExecutionListResponse = components[\"schemas\"][\"SkillExecutionListResponse\"];\ntype SkillExecutionOutputResponse = components[\"schemas\"][\"SkillExecutionOutputResponse\"];\ntype SkillListResponse = components[\"schemas\"][\"SkillListResponse\"];\ntype SkillResponse = components[\"schemas\"][\"SkillResponse\"];\ntype UpdateSkillRequest = components[\"schemas\"][\"UpdateSkillRequest\"];\n\nexport interface SkillListParams {\n pageSize?: number;\n pageNumber?: number;\n isPublic?: boolean;\n isEnabled?: boolean;\n category?: string;\n query?: string;\n fromDate?: string;\n toDate?: string;\n}\n\nexport interface SkillExecutionListParams {\n pageSize?: number;\n pageNumber?: number;\n}\n\nexport class Skills {\n constructor(private readonly http: HttpClient) {}\n\n /** Create a new skill via automated generation. */\n create(body: CreateSkillRequest): Promise<CreateSkillResponse> {\n return this.http.post<CreateSkillResponse>(\"/skills\", body);\n }\n\n /** List all skills owned by the project. */\n list(params?: SkillListParams): Promise<SkillListResponse> {\n return this.http.get<SkillListResponse>(\"/skills\", params as Record<string, unknown>);\n }\n\n /** Get details of a specific skill. */\n get(skillId: string): Promise<SkillResponse> {\n return this.http.get<SkillResponse>(`/skills/${skillId}`);\n }\n\n /** Delete a skill. */\n delete(skillId: string): Promise<void> {\n return this.http.delete<void>(`/skills/${skillId}`);\n }\n\n /** Update skill metadata. */\n update(skillId: string, body: UpdateSkillRequest): Promise<SkillResponse> {\n return this.http.patch<SkillResponse>(`/skills/${skillId}`, body);\n }\n\n /** Cancel the current in-progress generation for a skill. */\n cancel(skillId: string): Promise<SkillResponse> {\n return this.http.post<SkillResponse>(`/skills/${skillId}/cancel`);\n }\n\n /** Execute a skill with the provided parameters. */\n execute(skillId: string, body: ExecuteSkillRequest): Promise<ExecuteSkillResponse> {\n return this.http.post<ExecuteSkillResponse>(`/skills/${skillId}/execute`, body);\n }\n\n /** Refine a skill based on feedback. */\n refine(skillId: string, body: RefineSkillRequest): Promise<RefineSkillResponse> {\n return this.http.post<RefineSkillResponse>(`/skills/${skillId}/refine`, body);\n }\n\n /** Rollback to the previous version. */\n rollback(skillId: string): Promise<SkillResponse> {\n return this.http.post<SkillResponse>(`/skills/${skillId}/rollback`);\n }\n\n /** List executions for a specific skill. */\n executions(skillId: string, params?: SkillExecutionListParams): Promise<SkillExecutionListResponse> {\n return this.http.get<SkillExecutionListResponse>(\n `/skills/${skillId}/executions`,\n params as Record<string, unknown>,\n );\n }\n\n /** Get presigned URL for downloading skill execution output. */\n executionOutput(skillId: string, executionId: string): Promise<SkillExecutionOutputResponse> {\n return this.http.get<SkillExecutionOutputResponse>(\n `/skills/${skillId}/executions/${executionId}/output`,\n );\n }\n}\n","import type { z } from \"zod\";\nimport type { components } from \"../generated/v2/types.js\";\nimport type { Tasks } from \"./resources/tasks.js\";\n\ntype TaskCreatedResponse = components[\"schemas\"][\"TaskCreatedResponse\"];\ntype TaskStepView = components[\"schemas\"][\"TaskStepView\"];\ntype TaskView = components[\"schemas\"][\"TaskView\"];\n\nexport const TERMINAL_STATUSES = new Set([\"finished\", \"stopped\"]);\n\n/** Task result with typed output. All TaskView fields are directly accessible. */\nexport type TaskResult<T = string | null> = Omit<TaskView, \"output\"> & { output: T };\n\nexport interface RunOptions {\n /** Maximum time to wait in milliseconds. Default: 300_000 (5 min). */\n timeout?: number;\n /** Polling interval in milliseconds. Default: 2_000. */\n interval?: number;\n}\n\n/**\n * Lazy task handle returned by `client.run()`.\n *\n * - `await client.run(...)` polls the lightweight status endpoint, returns a `TaskResult`.\n * - `for await (const step of client.run(...))` polls the full task, yields new steps.\n */\nexport class TaskRun<T = string> implements PromiseLike<TaskResult<T>> {\n private readonly _createPromise: Promise<TaskCreatedResponse>;\n private readonly _tasks: Tasks;\n private readonly _schema?: z.ZodType<T>;\n private readonly _timeout: number;\n private readonly _interval: number;\n\n private _taskId: string | null = null;\n private _result: TaskResult<T> | null = null;\n\n constructor(\n createPromise: Promise<TaskCreatedResponse>,\n tasks: Tasks,\n schema?: z.ZodType<T>,\n options?: RunOptions,\n ) {\n this._createPromise = createPromise;\n this._tasks = tasks;\n this._schema = schema;\n this._timeout = options?.timeout ?? 300_000;\n this._interval = options?.interval ?? 2_000;\n }\n\n /** Task ID (available after creation resolves). */\n get taskId(): string | null {\n return this._taskId;\n }\n\n /** Full task result (available after awaiting or iterating to completion). */\n get result(): TaskResult<T> | null {\n return this._result;\n }\n\n /** Enable `await client.run(...)` — polls status endpoint, returns TaskResult. */\n then<R1 = TaskResult<T>, R2 = never>(\n onFulfilled?: ((value: TaskResult<T>) => R1 | PromiseLike<R1>) | null,\n onRejected?: ((reason: unknown) => R2 | PromiseLike<R2>) | null,\n ): Promise<R1 | R2> {\n return this._waitForOutput().then(onFulfilled, onRejected);\n }\n\n /** Enable `for await (const step of client.run(...))` — polls full task, yields new steps. */\n async *[Symbol.asyncIterator](): AsyncGenerator<TaskStepView> {\n const taskId = await this._ensureTaskId();\n let seen = 0;\n const deadline = Date.now() + this._timeout;\n\n while (Date.now() < deadline) {\n const task = await this._tasks.get(taskId);\n\n for (let i = seen; i < task.steps.length; i++) {\n yield task.steps[i];\n }\n seen = task.steps.length;\n\n if (TERMINAL_STATUSES.has(task.status)) {\n this._result = this._buildResult(task);\n return;\n }\n\n const remaining = deadline - Date.now();\n if (remaining <= 0) break;\n await new Promise((r) => setTimeout(r, Math.min(this._interval, remaining)));\n }\n\n throw new Error(`Task ${taskId} did not complete within ${this._timeout}ms`);\n }\n\n private async _ensureTaskId(): Promise<string> {\n if (this._taskId) return this._taskId;\n const created = await this._createPromise;\n this._taskId = created.id;\n return this._taskId;\n }\n\n /** Poll lightweight status endpoint until terminal, return TaskResult. */\n private async _waitForOutput(): Promise<TaskResult<T>> {\n const taskId = await this._ensureTaskId();\n const deadline = Date.now() + this._timeout;\n\n while (Date.now() < deadline) {\n const status = await this._tasks.status(taskId);\n if (TERMINAL_STATUSES.has(status.status)) {\n const task = await this._tasks.get(taskId);\n this._result = this._buildResult(task);\n return this._result;\n }\n const remaining = deadline - Date.now();\n if (remaining <= 0) break;\n await new Promise((r) => setTimeout(r, Math.min(this._interval, remaining)));\n }\n\n throw new Error(`Task ${taskId} did not complete within ${this._timeout}ms`);\n }\n\n private _buildResult(task: TaskView): TaskResult<T> {\n const output = this._parseOutput(task.output);\n return { ...task, output };\n }\n\n private _parseOutput(output: string | null | undefined): T {\n if (output == null) return null as T;\n if (!this._schema) return output as unknown as T;\n return this._schema.parse(JSON.parse(output));\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v2/types.js\";\nimport { TERMINAL_STATUSES } from \"../helpers.js\";\n\n/** User-facing body: only `task` is required; everything else has API defaults. */\nexport type CreateTaskBody = Pick<components[\"schemas\"][\"CreateTaskRequest\"], \"task\"> &\n Partial<Omit<components[\"schemas\"][\"CreateTaskRequest\"], \"task\">>;\ntype TaskCreatedResponse = components[\"schemas\"][\"TaskCreatedResponse\"];\ntype TaskListResponse = components[\"schemas\"][\"TaskListResponse\"];\ntype TaskLogFileResponse = components[\"schemas\"][\"TaskLogFileResponse\"];\ntype TaskStatusView = components[\"schemas\"][\"TaskStatusView\"];\ntype TaskView = components[\"schemas\"][\"TaskView\"];\ntype UpdateTaskRequest = components[\"schemas\"][\"UpdateTaskRequest\"];\n\nexport interface TaskListParams {\n pageSize?: number;\n pageNumber?: number;\n sessionId?: string;\n filterBy?: string;\n after?: string;\n before?: string;\n}\n\nexport class Tasks {\n constructor(private readonly http: HttpClient) {}\n\n /** Create and start a new AI agent task. */\n create(body: CreateTaskBody): Promise<TaskCreatedResponse> {\n return this.http.post<TaskCreatedResponse>(\"/tasks\", body);\n }\n\n /** List tasks with optional filtering. */\n list(params?: TaskListParams): Promise<TaskListResponse> {\n return this.http.get<TaskListResponse>(\"/tasks\", params as Record<string, unknown>);\n }\n\n /** Get detailed task information. */\n get(taskId: string): Promise<TaskView> {\n return this.http.get<TaskView>(`/tasks/${taskId}`);\n }\n\n /** Update a task (generic PATCH). */\n update(taskId: string, body: UpdateTaskRequest): Promise<TaskView> {\n return this.http.patch<TaskView>(`/tasks/${taskId}`, body);\n }\n\n /** Stop a running task. */\n stop(taskId: string): Promise<TaskView> {\n return this.update(taskId, { action: \"stop\" });\n }\n\n /** Stop a running task and its associated browser session. */\n stopTaskAndSession(taskId: string): Promise<TaskView> {\n return this.update(taskId, { action: \"stop_task_and_session\" });\n }\n\n /** Get lightweight task status (optimized for polling). */\n status(taskId: string): Promise<TaskStatusView> {\n return this.http.get<TaskStatusView>(`/tasks/${taskId}/status`);\n }\n\n /** Get secure download URL for task execution logs. */\n logs(taskId: string): Promise<TaskLogFileResponse> {\n return this.http.get<TaskLogFileResponse>(`/tasks/${taskId}/logs`);\n }\n\n /** Poll until a task reaches a terminal status, then return the full TaskView. */\n async wait(taskId: string, opts?: { timeout?: number; interval?: number }): Promise<TaskView> {\n const timeout = opts?.timeout ?? 300_000;\n const interval = opts?.interval ?? 2_000;\n const deadline = Date.now() + timeout;\n\n while (Date.now() < deadline) {\n const status = await this.status(taskId);\n if (TERMINAL_STATUSES.has(status.status)) {\n return this.get(taskId);\n }\n const remaining = deadline - Date.now();\n if (remaining <= 0) break;\n await new Promise((r) => setTimeout(r, Math.min(interval, remaining)));\n }\n\n throw new Error(`Task ${taskId} did not complete within ${timeout}ms`);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAS,SAAS;;;ACKX,IAAM,UAAN,MAAc;AAAA,EACnB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA;AAAA,EAGhD,UAAgC;AAC9B,WAAO,KAAK,KAAK,IAAiB,kBAAkB;AAAA,EACtD;AAC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SAAS,KAAK,IAAI;AACtC,SAAK,WAAW,IAAI,SAAS,KAAK,IAAI;AACtC,SAAK,SAAS,IAAI,OAAO,KAAK,IAAI;AAClC,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAAA,EAC9C;AAAA,EAoBA,IAAI,MAAc,SAAwC;AACxD,UAAM,EAAE,QAAQ,SAAS,UAAU,GAAG,KAAK,IAAI,WAAW,CAAC;AAC3D,UAAM,OAAuB,EAAE,MAAM,GAAG,KAAK;AAC7C,QAAI,QAAQ;AACV,WAAK,mBAAmB,KAAK,UAAU,EAAE,aAAa,MAAM,CAAC;AAAA,IAC/D;AACA,UAAM,UAAU,KAAK,MAAM,OAAO,IAAI;AACtC,WAAO,IAAI,QAAQ,SAAS,KAAK,OAAO,QAAQ,EAAE,SAAS,SAAS,CAAC;AAAA,EACvE;AACF;","names":[]}
|
package/dist/v3.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/larsencundric/Documents/browser-use/sdk/browser-use-node/dist/v3.cjs","../src/v3/client.ts","../src/v3/resources/sessions.ts","../src/v3/resources/workspaces.ts","../src/v3/helpers.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACLA,0BAAkB;ADOlB;AACA;AEyBO,IAAM,SAAA,EAAN,MAAe;AAAA,EACpB,WAAA,CAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,KAAA,EAAA,IAAA;AAAA,EAAmB;AAAA;AAAA,EAGhD,MAAA,CAAO,IAAA,EAAoD;AACzD,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,IAAA,CAAsB,WAAA,EAAa,IAAI,CAAA;AAAA,EAC1D;AAAA;AAAA,EAGA,IAAA,CAAK,MAAA,EAA0D;AAC7D,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAyB,WAAA,EAAa,MAAiC,CAAA;AAAA,EAC1F;AAAA;AAAA,EAGA,GAAA,CAAI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oB,EAAA;AACgB,IAAA;AACpC,EAAA;AAEkD,EAAA;AACf,IAAA;AACN,IAAA;AACD,IAAA;AACd,IAAA;AACd,EAAA;AAAA;AAG0D,EAAA;AAC3B,IAAA;AACM,IAAA;AAEL,IAAA;AACa,MAAA;AACD,MAAA;AACV,QAAA;AACW,QAAA;AACL,QAAA;AACtB,QAAA;AACd,MAAA;AACsC,MAAA;AAClB,MAAA;AACV,MAAA;AACoB,QAAA;AAC9B,MAAA;AACF,IAAA;AAEU,IAAA;AACY,MAAA;AACtB,IAAA;AACF,EAAA;AAEyC,EAAA;AACZ,IAAA;AACD,IAAA;AACe,IAAA;AACZ,IAAA;AAC/B,EAAA;AACF;AJiEgD;AACA;AC9JvB;AAYD;AACb,EAAA;AACA,EAAA;AAEQ,EAAA;AAE4B,EAAA;AAEf,IAAA;AACf,IAAA;AACD,MAAA;AACR,QAAA;AACF,MAAA;AACF,IAAA;AAC2B,IAAA;AACzB,MAAA;AAC4B,MAAA;AACR,MAAA;AACH,MAAA;AAClB,IAAA;AAEqC,IAAA;AACI,IAAA;AAC5C,EAAA;AAiBgE,EAAA;AACnB,IAAA;AACd,IAAA;AACjB,IAAA;AAC+B,MAAA;AAC3C,IAAA;AACyC,IAAA;AACL,IAAA;AACtC,EAAA;AACF;ADiIgD;AACA;AACA;AACA;AACA;AACA;AACA","file":"/Users/larsencundric/Documents/browser-use/sdk/browser-use-node/dist/v3.cjs","sourcesContent":[null,"import { z } from \"zod\";\nimport { HttpClient } from \"../core/http.js\";\nimport { Sessions } from \"./resources/sessions.js\";\nimport { Workspaces } from \"./resources/workspaces.js\";\nimport { SessionRun } from \"./helpers.js\";\nimport type { components } from \"../generated/v3/types.js\";\nimport type { RunOptions } from \"./helpers.js\";\n\ntype RunTaskRequest = components[\"schemas\"][\"RunTaskRequest\"];\n\nconst DEFAULT_BASE_URL = \"https://api.browser-use.com/api/v3\";\n\nexport interface BrowserUseOptions {\n apiKey?: string;\n baseUrl?: string;\n maxRetries?: number;\n timeout?: number;\n}\n\nexport type RunSessionOptions = Partial<Omit<RunTaskRequest, \"task\">> &\n RunOptions & { schema?: z.ZodType };\n\nexport class BrowserUse {\n readonly sessions: Sessions;\n readonly workspaces: Workspaces;\n\n private readonly http: HttpClient;\n\n constructor(options: BrowserUseOptions = {}) {\n const apiKey =\n options.apiKey ?? process.env.BROWSER_USE_API_KEY ?? \"\";\n if (!apiKey) {\n throw new Error(\n \"No API key provided. Pass apiKey or set BROWSER_USE_API_KEY.\",\n );\n }\n this.http = new HttpClient({\n apiKey,\n baseUrl: options.baseUrl ?? DEFAULT_BASE_URL,\n maxRetries: options.maxRetries,\n timeout: options.timeout,\n });\n\n this.sessions = new Sessions(this.http);\n this.workspaces = new Workspaces(this.http);\n }\n\n /**\n * Create a session and run a task. `await` the result for a typed SessionResult.\n *\n * ```ts\n * // Simple — just get the output\n * const result = await client.run(\"Find the top HN post\");\n * console.log(result.output);\n *\n * // Structured output (Zod)\n * const result = await client.run(\"Find product info\", { schema: ProductSchema });\n * console.log(result.output.name); // fully typed\n * ```\n */\n run(task: string, options?: Omit<RunSessionOptions, \"schema\">): SessionRun<string>;\n run<T extends z.ZodType>(task: string, options: RunSessionOptions & { schema: T }): SessionRun<z.output<T>>;\n run(task: string, options?: RunSessionOptions): SessionRun<any> {\n const { schema, timeout, interval, ...rest } = options ?? {};\n const body = { task, ...rest } as RunTaskRequest;\n if (schema) {\n body.outputSchema = z.toJSONSchema(schema) as Record<string, unknown>;\n }\n const promise = this.sessions.create(body);\n return new SessionRun(promise, this.sessions, schema, { timeout, interval });\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v3/types.js\";\n\ntype RunTaskRequest = components[\"schemas\"][\"RunTaskRequest\"];\n/** All fields optional — omit `task` to create an idle session. */\nexport type CreateSessionBody = Partial<RunTaskRequest>;\ntype SessionResponse = components[\"schemas\"][\"SessionResponse\"];\ntype SessionListResponse = components[\"schemas\"][\"SessionListResponse\"];\ntype FileListResponse = components[\"schemas\"][\"FileListResponse\"];\ntype StopSessionRequest = components[\"schemas\"][\"StopSessionRequest\"];\ntype FileUploadRequest = components[\"schemas\"][\"FileUploadRequest\"];\ntype FileUploadResponse = components[\"schemas\"][\"FileUploadResponse\"];\ntype MessageListResponse = components[\"schemas\"][\"MessageListResponse\"];\n\nexport interface SessionListParams {\n page?: number;\n page_size?: number;\n}\n\nexport interface SessionFilesParams {\n prefix?: string;\n limit?: number;\n cursor?: string | null;\n includeUrls?: boolean;\n shallow?: boolean;\n}\n\nexport interface SessionMessagesParams {\n after?: string | null;\n before?: string | null;\n limit?: number;\n}\n\nexport class Sessions {\n constructor(private readonly http: HttpClient) {}\n\n /** Create a session and optionally dispatch a task. */\n create(body?: CreateSessionBody): Promise<SessionResponse> {\n return this.http.post<SessionResponse>(\"/sessions\", body);\n }\n\n /** List sessions for the authenticated project. */\n list(params?: SessionListParams): Promise<SessionListResponse> {\n return this.http.get<SessionListResponse>(\"/sessions\", params as Record<string, unknown>);\n }\n\n /** Get session details. */\n get(sessionId: string): Promise<SessionResponse> {\n return this.http.get<SessionResponse>(`/sessions/${sessionId}`);\n }\n\n /** Stop a session or the running task. */\n stop(sessionId: string, body?: StopSessionRequest): Promise<SessionResponse> {\n return this.http.post<SessionResponse>(`/sessions/${sessionId}/stop`, body);\n }\n\n /** Soft-delete a session. */\n delete(sessionId: string): Promise<void> {\n return this.http.delete<void>(`/sessions/${sessionId}`);\n }\n\n /** Get presigned upload URLs for session files. */\n uploadFiles(sessionId: string, body: FileUploadRequest): Promise<FileUploadResponse> {\n return this.http.post<FileUploadResponse>(`/sessions/${sessionId}/files/upload`, body);\n }\n\n /** List files in a session's workspace. */\n files(sessionId: string, params?: SessionFilesParams): Promise<FileListResponse> {\n return this.http.get<FileListResponse>(\n `/sessions/${sessionId}/files`,\n params as Record<string, unknown>,\n );\n }\n\n /** List messages for a session with cursor-based pagination. */\n messages(sessionId: string, params?: SessionMessagesParams): Promise<MessageListResponse> {\n return this.http.get<MessageListResponse>(\n `/sessions/${sessionId}/messages`,\n params as Record<string, unknown>,\n );\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v3/types.js\";\n\ntype WorkspaceView = components[\"schemas\"][\"WorkspaceView\"];\ntype WorkspaceListResponse = components[\"schemas\"][\"WorkspaceListResponse\"];\ntype WorkspaceCreateRequest = components[\"schemas\"][\"WorkspaceCreateRequest\"];\ntype WorkspaceUpdateRequest = components[\"schemas\"][\"WorkspaceUpdateRequest\"];\ntype FileListResponse = components[\"schemas\"][\"FileListResponse\"];\ntype FileUploadRequest = components[\"schemas\"][\"FileUploadRequest\"];\ntype FileUploadResponse = components[\"schemas\"][\"FileUploadResponse\"];\n\nexport interface WorkspaceListParams {\n pageSize?: number;\n pageNumber?: number;\n}\n\nexport interface WorkspaceFilesParams {\n prefix?: string;\n limit?: number;\n cursor?: string | null;\n includeUrls?: boolean;\n shallow?: boolean;\n}\n\nexport class Workspaces {\n constructor(private readonly http: HttpClient) {}\n\n /** List workspaces for the authenticated project. */\n list(params?: WorkspaceListParams): Promise<WorkspaceListResponse> {\n return this.http.get<WorkspaceListResponse>(\"/workspaces\", params as Record<string, unknown>);\n }\n\n /** Create a new workspace. */\n create(body?: WorkspaceCreateRequest): Promise<WorkspaceView> {\n return this.http.post<WorkspaceView>(\"/workspaces\", body);\n }\n\n /** Get workspace details. */\n get(workspaceId: string): Promise<WorkspaceView> {\n return this.http.get<WorkspaceView>(`/workspaces/${workspaceId}`);\n }\n\n /** Update a workspace. */\n update(workspaceId: string, body: WorkspaceUpdateRequest): Promise<WorkspaceView> {\n return this.http.patch<WorkspaceView>(`/workspaces/${workspaceId}`, body);\n }\n\n /** Delete a workspace and its data. */\n delete(workspaceId: string): Promise<void> {\n return this.http.delete<void>(`/workspaces/${workspaceId}`);\n }\n\n /** List files in a workspace. */\n files(workspaceId: string, params?: WorkspaceFilesParams): Promise<FileListResponse> {\n return this.http.get<FileListResponse>(\n `/workspaces/${workspaceId}/files`,\n params as Record<string, unknown>,\n );\n }\n\n /** Get presigned upload URLs for workspace files. */\n uploadFiles(workspaceId: string, body: FileUploadRequest, query?: { prefix?: string }): Promise<FileUploadResponse> {\n return this.http.post<FileUploadResponse>(\n `/workspaces/${workspaceId}/files/upload`,\n body,\n query as Record<string, unknown>,\n );\n }\n\n /** Delete a file from a workspace. */\n deleteFile(workspaceId: string, path: string): Promise<void> {\n return this.http.delete<void>(`/workspaces/${workspaceId}/files`, { path });\n }\n\n /** Get storage usage for a workspace. */\n size(workspaceId: string): Promise<unknown> {\n return this.http.get<unknown>(`/workspaces/${workspaceId}/size`);\n }\n}\n","import type { z } from \"zod\";\nimport type { components } from \"../generated/v3/types.js\";\nimport type { Sessions } from \"./resources/sessions.js\";\n\ntype SessionResponse = components[\"schemas\"][\"SessionResponse\"];\n\nconst TERMINAL_STATUSES = new Set([\"idle\", \"stopped\", \"timed_out\", \"error\"]);\n\nexport interface RunOptions {\n /** Maximum time to wait in milliseconds. Default: 300_000 (5 min). */\n timeout?: number;\n /** Polling interval in milliseconds. Default: 2_000. */\n interval?: number;\n}\n\n/** Session result with typed output. All SessionResponse fields are directly accessible. */\nexport type SessionResult<T = string | null> = Omit<SessionResponse, \"output\"> & { output: T };\n\n/**\n * Dual-purpose session handle: `await` it for a typed SessionResult,\n * or access `.result` for the full SessionResult after resolution.\n */\nexport class SessionRun<T = string> implements PromiseLike<SessionResult<T>> {\n private readonly _createPromise: Promise<SessionResponse>;\n private readonly _sessions: Sessions;\n private readonly _schema?: z.ZodType<T>;\n private readonly _timeout: number;\n private readonly _interval: number;\n private _sessionId: string | null = null;\n private _result: SessionResult<T> | null = null;\n\n constructor(\n createPromise: Promise<SessionResponse>,\n sessions: Sessions,\n schema?: z.ZodType<T>,\n options?: RunOptions,\n ) {\n this._createPromise = createPromise;\n this._sessions = sessions;\n this._schema = schema;\n this._timeout = options?.timeout ?? 300_000;\n this._interval = options?.interval ?? 2_000;\n }\n\n /** The session ID, available after task creation resolves. */\n get sessionId(): string | null {\n return this._sessionId;\n }\n\n /** The full SessionResult, available after polling completes. */\n get result(): SessionResult<T> | null {\n return this._result;\n }\n\n /** Enable `await client.run(...)` — polls until terminal, returns SessionResult. */\n then<R1 = SessionResult<T>, R2 = never>(\n onFulfilled?:\n | ((value: SessionResult<T>) => R1 | PromiseLike<R1>)\n | null,\n onRejected?: ((reason: unknown) => R2 | PromiseLike<R2>) | null,\n ): Promise<R1 | R2> {\n return this._waitForOutput().then(onFulfilled, onRejected);\n }\n\n private async _ensureSessionId(): Promise<string> {\n if (this._sessionId) return this._sessionId;\n const created = await this._createPromise;\n this._sessionId = created.id;\n return this._sessionId;\n }\n\n /** Poll session until terminal, return SessionResult. */\n private async _waitForOutput(): Promise<SessionResult<T>> {\n const sessionId = await this._ensureSessionId();\n const deadline = Date.now() + this._timeout;\n\n while (Date.now() < deadline) {\n const session = await this._sessions.get(sessionId);\n if (TERMINAL_STATUSES.has(session.status)) {\n const { output, ...rest } = session;\n const parsed = this._parseOutput(output);\n this._result = { ...rest, output: parsed } as SessionResult<T>;\n return this._result;\n }\n const remaining = deadline - Date.now();\n if (remaining <= 0) break;\n await new Promise((r) =>\n setTimeout(r, Math.min(this._interval, remaining)),\n );\n }\n\n throw new Error(\n `Session ${sessionId} did not complete within ${this._timeout}ms`,\n );\n }\n\n private _parseOutput(output: unknown): T {\n if (output == null) return null as T;\n if (!this._schema) return output as unknown as T;\n const raw = typeof output === \"string\" ? JSON.parse(output) : output;\n return this._schema.parse(raw);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/Users/sauravpanda/Github/LLMs/Browser-Use/sdk/browser-use-node/dist/v3.cjs","../src/v3/client.ts","../src/v3/resources/sessions.ts","../src/v3/resources/workspaces.ts","../src/v3/helpers.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACLA,0BAAkB;ADOlB;AACA;AEyBO,IAAM,SAAA,EAAN,MAAe;AAAA,EACpB,WAAA,C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LLMs/Browser-Use/sdk/browser-use-node/dist/v3.cjs","sourcesContent":[null,"import { z } from \"zod\";\nimport { HttpClient } from \"../core/http.js\";\nimport { Sessions } from \"./resources/sessions.js\";\nimport { Workspaces } from \"./resources/workspaces.js\";\nimport { SessionRun } from \"./helpers.js\";\nimport type { components } from \"../generated/v3/types.js\";\nimport type { RunOptions } from \"./helpers.js\";\n\ntype RunTaskRequest = components[\"schemas\"][\"RunTaskRequest\"];\n\nconst DEFAULT_BASE_URL = \"https://api.browser-use.com/api/v3\";\n\nexport interface BrowserUseOptions {\n apiKey?: string;\n baseUrl?: string;\n maxRetries?: number;\n timeout?: number;\n}\n\nexport type RunSessionOptions = Partial<Omit<RunTaskRequest, \"task\">> &\n RunOptions & { schema?: z.ZodType };\n\nexport class BrowserUse {\n readonly sessions: Sessions;\n readonly workspaces: Workspaces;\n\n private readonly http: HttpClient;\n\n constructor(options: BrowserUseOptions = {}) {\n const apiKey =\n options.apiKey ?? process.env.BROWSER_USE_API_KEY ?? \"\";\n if (!apiKey) {\n throw new Error(\n \"No API key provided. Pass apiKey or set BROWSER_USE_API_KEY.\",\n );\n }\n this.http = new HttpClient({\n apiKey,\n baseUrl: options.baseUrl ?? DEFAULT_BASE_URL,\n maxRetries: options.maxRetries,\n timeout: options.timeout,\n });\n\n this.sessions = new Sessions(this.http);\n this.workspaces = new Workspaces(this.http);\n }\n\n /**\n * Create a session and run a task. `await` the result for a typed SessionResult.\n *\n * ```ts\n * // Simple — just get the output\n * const result = await client.run(\"Find the top HN post\");\n * console.log(result.output);\n *\n * // Structured output (Zod)\n * const result = await client.run(\"Find product info\", { schema: ProductSchema });\n * console.log(result.output.name); // fully typed\n * ```\n */\n run(task: string, options?: Omit<RunSessionOptions, \"schema\">): SessionRun<string>;\n run<T extends z.ZodType>(task: string, options: RunSessionOptions & { schema: T }): SessionRun<z.output<T>>;\n run(task: string, options?: RunSessionOptions): SessionRun<any> {\n const { schema, timeout, interval, ...rest } = options ?? {};\n const body = { task, ...rest } as RunTaskRequest;\n if (schema) {\n body.outputSchema = z.toJSONSchema(schema) as Record<string, unknown>;\n }\n const promise = this.sessions.create(body);\n return new SessionRun(promise, this.sessions, schema, { timeout, interval });\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v3/types.js\";\n\ntype RunTaskRequest = components[\"schemas\"][\"RunTaskRequest\"];\n/** All fields optional — omit `task` to create an idle session. */\nexport type CreateSessionBody = Partial<RunTaskRequest>;\ntype SessionResponse = components[\"schemas\"][\"SessionResponse\"];\ntype SessionListResponse = components[\"schemas\"][\"SessionListResponse\"];\ntype FileListResponse = components[\"schemas\"][\"FileListResponse\"];\ntype StopSessionRequest = components[\"schemas\"][\"StopSessionRequest\"];\ntype FileUploadRequest = components[\"schemas\"][\"FileUploadRequest\"];\ntype FileUploadResponse = components[\"schemas\"][\"FileUploadResponse\"];\ntype MessageListResponse = components[\"schemas\"][\"MessageListResponse\"];\n\nexport interface SessionListParams {\n page?: number;\n page_size?: number;\n}\n\nexport interface SessionFilesParams {\n prefix?: string;\n limit?: number;\n cursor?: string | null;\n includeUrls?: boolean;\n shallow?: boolean;\n}\n\nexport interface SessionMessagesParams {\n after?: string | null;\n before?: string | null;\n limit?: number;\n}\n\nexport class Sessions {\n constructor(private readonly http: HttpClient) {}\n\n /** Create a session and optionally dispatch a task. */\n create(body?: CreateSessionBody): Promise<SessionResponse> {\n return this.http.post<SessionResponse>(\"/sessions\", body);\n }\n\n /** List sessions for the authenticated project. */\n list(params?: SessionListParams): Promise<SessionListResponse> {\n return this.http.get<SessionListResponse>(\"/sessions\", params as Record<string, unknown>);\n }\n\n /** Get session details. */\n get(sessionId: string): Promise<SessionResponse> {\n return this.http.get<SessionResponse>(`/sessions/${sessionId}`);\n }\n\n /** Stop a session or the running task. */\n stop(sessionId: string, body?: StopSessionRequest): Promise<SessionResponse> {\n return this.http.post<SessionResponse>(`/sessions/${sessionId}/stop`, body);\n }\n\n /** Soft-delete a session. */\n delete(sessionId: string): Promise<void> {\n return this.http.delete<void>(`/sessions/${sessionId}`);\n }\n\n /** Get presigned upload URLs for session files. */\n uploadFiles(sessionId: string, body: FileUploadRequest): Promise<FileUploadResponse> {\n return this.http.post<FileUploadResponse>(`/sessions/${sessionId}/files/upload`, body);\n }\n\n /** List files in a session's workspace. */\n files(sessionId: string, params?: SessionFilesParams): Promise<FileListResponse> {\n return this.http.get<FileListResponse>(\n `/sessions/${sessionId}/files`,\n params as Record<string, unknown>,\n );\n }\n\n /** List messages for a session with cursor-based pagination. */\n messages(sessionId: string, params?: SessionMessagesParams): Promise<MessageListResponse> {\n return this.http.get<MessageListResponse>(\n `/sessions/${sessionId}/messages`,\n params as Record<string, unknown>,\n );\n }\n}\n","import type { HttpClient } from \"../../core/http.js\";\nimport type { components } from \"../../generated/v3/types.js\";\n\ntype WorkspaceView = components[\"schemas\"][\"WorkspaceView\"];\ntype WorkspaceListResponse = components[\"schemas\"][\"WorkspaceListResponse\"];\ntype WorkspaceCreateRequest = components[\"schemas\"][\"WorkspaceCreateRequest\"];\ntype WorkspaceUpdateRequest = components[\"schemas\"][\"WorkspaceUpdateRequest\"];\ntype FileListResponse = components[\"schemas\"][\"FileListResponse\"];\ntype FileUploadRequest = components[\"schemas\"][\"FileUploadRequest\"];\ntype FileUploadResponse = components[\"schemas\"][\"FileUploadResponse\"];\n\nexport interface WorkspaceListParams {\n pageSize?: number;\n pageNumber?: number;\n}\n\nexport interface WorkspaceFilesParams {\n prefix?: string;\n limit?: number;\n cursor?: string | null;\n includeUrls?: boolean;\n shallow?: boolean;\n}\n\nexport class Workspaces {\n constructor(private readonly http: HttpClient) {}\n\n /** List workspaces for the authenticated project. */\n list(params?: WorkspaceListParams): Promise<WorkspaceListResponse> {\n return this.http.get<WorkspaceListResponse>(\"/workspaces\", params as Record<string, unknown>);\n }\n\n /** Create a new workspace. */\n create(body?: WorkspaceCreateRequest): Promise<WorkspaceView> {\n return this.http.post<WorkspaceView>(\"/workspaces\", body);\n }\n\n /** Get workspace details. */\n get(workspaceId: string): Promise<WorkspaceView> {\n return this.http.get<WorkspaceView>(`/workspaces/${workspaceId}`);\n }\n\n /** Update a workspace. */\n update(workspaceId: string, body: WorkspaceUpdateRequest): Promise<WorkspaceView> {\n return this.http.patch<WorkspaceView>(`/workspaces/${workspaceId}`, body);\n }\n\n /** Delete a workspace and its data. */\n delete(workspaceId: string): Promise<void> {\n return this.http.delete<void>(`/workspaces/${workspaceId}`);\n }\n\n /** List files in a workspace. */\n files(workspaceId: string, params?: WorkspaceFilesParams): Promise<FileListResponse> {\n return this.http.get<FileListResponse>(\n `/workspaces/${workspaceId}/files`,\n params as Record<string, unknown>,\n );\n }\n\n /** Get presigned upload URLs for workspace files. */\n uploadFiles(workspaceId: string, body: FileUploadRequest, query?: { prefix?: string }): Promise<FileUploadResponse> {\n return this.http.post<FileUploadResponse>(\n `/workspaces/${workspaceId}/files/upload`,\n body,\n query as Record<string, unknown>,\n );\n }\n\n /** Delete a file from a workspace. */\n deleteFile(workspaceId: string, path: string): Promise<void> {\n return this.http.delete<void>(`/workspaces/${workspaceId}/files`, { path });\n }\n\n /** Get storage usage for a workspace. */\n size(workspaceId: string): Promise<unknown> {\n return this.http.get<unknown>(`/workspaces/${workspaceId}/size`);\n }\n}\n","import type { z } from \"zod\";\nimport type { components } from \"../generated/v3/types.js\";\nimport type { Sessions } from \"./resources/sessions.js\";\n\ntype SessionResponse = components[\"schemas\"][\"SessionResponse\"];\n\nconst TERMINAL_STATUSES = new Set([\"idle\", \"stopped\", \"timed_out\", \"error\"]);\n\nexport interface RunOptions {\n /** Maximum time to wait in milliseconds. Default: 300_000 (5 min). */\n timeout?: number;\n /** Polling interval in milliseconds. Default: 2_000. */\n interval?: number;\n}\n\n/** Session result with typed output. All SessionResponse fields are directly accessible. */\nexport type SessionResult<T = string | null> = Omit<SessionResponse, \"output\"> & { output: T };\n\n/**\n * Dual-purpose session handle: `await` it for a typed SessionResult,\n * or access `.result` for the full SessionResult after resolution.\n */\nexport class SessionRun<T = string> implements PromiseLike<SessionResult<T>> {\n private readonly _createPromise: Promise<SessionResponse>;\n private readonly _sessions: Sessions;\n private readonly _schema?: z.ZodType<T>;\n private readonly _timeout: number;\n private readonly _interval: number;\n private _sessionId: string | null = null;\n private _result: SessionResult<T> | null = null;\n\n constructor(\n createPromise: Promise<SessionResponse>,\n sessions: Sessions,\n schema?: z.ZodType<T>,\n options?: RunOptions,\n ) {\n this._createPromise = createPromise;\n this._sessions = sessions;\n this._schema = schema;\n this._timeout = options?.timeout ?? 300_000;\n this._interval = options?.interval ?? 2_000;\n }\n\n /** The session ID, available after task creation resolves. */\n get sessionId(): string | null {\n return this._sessionId;\n }\n\n /** The full SessionResult, available after polling completes. */\n get result(): SessionResult<T> | null {\n return this._result;\n }\n\n /** Enable `await client.run(...)` — polls until terminal, returns SessionResult. */\n then<R1 = SessionResult<T>, R2 = never>(\n onFulfilled?:\n | ((value: SessionResult<T>) => R1 | PromiseLike<R1>)\n | null,\n onRejected?: ((reason: unknown) => R2 | PromiseLike<R2>) | null,\n ): Promise<R1 | R2> {\n return this._waitForOutput().then(onFulfilled, onRejected);\n }\n\n private async _ensureSessionId(): Promise<string> {\n if (this._sessionId) return this._sessionId;\n const created = await this._createPromise;\n this._sessionId = created.id;\n return this._sessionId;\n }\n\n /** Poll session until terminal, return SessionResult. */\n private async _waitForOutput(): Promise<SessionResult<T>> {\n const sessionId = await this._ensureSessionId();\n const deadline = Date.now() + this._timeout;\n\n while (Date.now() < deadline) {\n const session = await this._sessions.get(sessionId);\n if (TERMINAL_STATUSES.has(session.status)) {\n const { output, ...rest } = session;\n const parsed = this._parseOutput(output);\n this._result = { ...rest, output: parsed } as SessionResult<T>;\n return this._result;\n }\n const remaining = deadline - Date.now();\n if (remaining <= 0) break;\n await new Promise((r) =>\n setTimeout(r, Math.min(this._interval, remaining)),\n );\n }\n\n throw new Error(\n `Session ${sessionId} did not complete within ${this._timeout}ms`,\n );\n }\n\n private _parseOutput(output: unknown): T {\n if (output == null) return null as T;\n if (!this._schema) return output as unknown as T;\n const raw = typeof output === \"string\" ? JSON.parse(output) : output;\n return this._schema.parse(raw);\n }\n}\n"]}
|
package/dist/v3.d.cts
CHANGED
|
@@ -132,6 +132,18 @@ interface components {
|
|
|
132
132
|
role: string;
|
|
133
133
|
/** Data */
|
|
134
134
|
data: string;
|
|
135
|
+
/**
|
|
136
|
+
* Type
|
|
137
|
+
* @description Coarse category: user_message, assistant_message, browser_action, file_operation, code_execution, integration, planning, completion, browser_action_result, browser_action_error, etc.
|
|
138
|
+
* @default
|
|
139
|
+
*/
|
|
140
|
+
type: string;
|
|
141
|
+
/**
|
|
142
|
+
* Summary
|
|
143
|
+
* @description One-liner human-readable description of the message (e.g. "Navigating to google.com", "Clicking element #5").
|
|
144
|
+
* @default
|
|
145
|
+
*/
|
|
146
|
+
summary: string;
|
|
135
147
|
/**
|
|
136
148
|
* Createdat
|
|
137
149
|
* Format: date-time
|
|
@@ -170,11 +182,22 @@ interface components {
|
|
|
170
182
|
profileId?: string | null;
|
|
171
183
|
/** Workspaceid */
|
|
172
184
|
workspaceId?: string | null;
|
|
173
|
-
|
|
185
|
+
/** @default us */
|
|
186
|
+
proxyCountryCode: components["schemas"]["ProxyCountryCode"] | null;
|
|
174
187
|
/** Outputschema */
|
|
175
188
|
outputSchema?: {
|
|
176
189
|
[key: string]: unknown;
|
|
177
190
|
} | null;
|
|
191
|
+
/**
|
|
192
|
+
* Enablescheduledtasks
|
|
193
|
+
* @default false
|
|
194
|
+
*/
|
|
195
|
+
enableScheduledTasks: boolean;
|
|
196
|
+
/**
|
|
197
|
+
* Enablerecording
|
|
198
|
+
* @default false
|
|
199
|
+
*/
|
|
200
|
+
enableRecording: boolean;
|
|
178
201
|
};
|
|
179
202
|
/** SessionListResponse */
|
|
180
203
|
SessionListResponse: {
|
|
@@ -204,8 +227,19 @@ interface components {
|
|
|
204
227
|
outputSchema?: {
|
|
205
228
|
[key: string]: unknown;
|
|
206
229
|
} | null;
|
|
230
|
+
/**
|
|
231
|
+
* Stepcount
|
|
232
|
+
* @default 0
|
|
233
|
+
*/
|
|
234
|
+
stepCount: number;
|
|
235
|
+
/** Laststepsummary */
|
|
236
|
+
lastStepSummary?: string | null;
|
|
237
|
+
/** Istasksuccessful */
|
|
238
|
+
isTaskSuccessful?: boolean | null;
|
|
207
239
|
/** Liveurl */
|
|
208
240
|
liveUrl?: string | null;
|
|
241
|
+
/** Recordingurl */
|
|
242
|
+
recordingUrl?: string | null;
|
|
209
243
|
/** Profileid */
|
|
210
244
|
profileId?: string | null;
|
|
211
245
|
/** Workspaceid */
|
|
@@ -238,6 +272,11 @@ interface components {
|
|
|
238
272
|
* @default 0
|
|
239
273
|
*/
|
|
240
274
|
proxyCostUsd: string;
|
|
275
|
+
/**
|
|
276
|
+
* Browsercostusd
|
|
277
|
+
* @default 0
|
|
278
|
+
*/
|
|
279
|
+
browserCostUsd: string;
|
|
241
280
|
/**
|
|
242
281
|
* Totalcostusd
|
|
243
282
|
* @default 0
|
package/dist/v3.d.ts
CHANGED
|
@@ -132,6 +132,18 @@ interface components {
|
|
|
132
132
|
role: string;
|
|
133
133
|
/** Data */
|
|
134
134
|
data: string;
|
|
135
|
+
/**
|
|
136
|
+
* Type
|
|
137
|
+
* @description Coarse category: user_message, assistant_message, browser_action, file_operation, code_execution, integration, planning, completion, browser_action_result, browser_action_error, etc.
|
|
138
|
+
* @default
|
|
139
|
+
*/
|
|
140
|
+
type: string;
|
|
141
|
+
/**
|
|
142
|
+
* Summary
|
|
143
|
+
* @description One-liner human-readable description of the message (e.g. "Navigating to google.com", "Clicking element #5").
|
|
144
|
+
* @default
|
|
145
|
+
*/
|
|
146
|
+
summary: string;
|
|
135
147
|
/**
|
|
136
148
|
* Createdat
|
|
137
149
|
* Format: date-time
|
|
@@ -170,11 +182,22 @@ interface components {
|
|
|
170
182
|
profileId?: string | null;
|
|
171
183
|
/** Workspaceid */
|
|
172
184
|
workspaceId?: string | null;
|
|
173
|
-
|
|
185
|
+
/** @default us */
|
|
186
|
+
proxyCountryCode: components["schemas"]["ProxyCountryCode"] | null;
|
|
174
187
|
/** Outputschema */
|
|
175
188
|
outputSchema?: {
|
|
176
189
|
[key: string]: unknown;
|
|
177
190
|
} | null;
|
|
191
|
+
/**
|
|
192
|
+
* Enablescheduledtasks
|
|
193
|
+
* @default false
|
|
194
|
+
*/
|
|
195
|
+
enableScheduledTasks: boolean;
|
|
196
|
+
/**
|
|
197
|
+
* Enablerecording
|
|
198
|
+
* @default false
|
|
199
|
+
*/
|
|
200
|
+
enableRecording: boolean;
|
|
178
201
|
};
|
|
179
202
|
/** SessionListResponse */
|
|
180
203
|
SessionListResponse: {
|
|
@@ -204,8 +227,19 @@ interface components {
|
|
|
204
227
|
outputSchema?: {
|
|
205
228
|
[key: string]: unknown;
|
|
206
229
|
} | null;
|
|
230
|
+
/**
|
|
231
|
+
* Stepcount
|
|
232
|
+
* @default 0
|
|
233
|
+
*/
|
|
234
|
+
stepCount: number;
|
|
235
|
+
/** Laststepsummary */
|
|
236
|
+
lastStepSummary?: string | null;
|
|
237
|
+
/** Istasksuccessful */
|
|
238
|
+
isTaskSuccessful?: boolean | null;
|
|
207
239
|
/** Liveurl */
|
|
208
240
|
liveUrl?: string | null;
|
|
241
|
+
/** Recordingurl */
|
|
242
|
+
recordingUrl?: string | null;
|
|
209
243
|
/** Profileid */
|
|
210
244
|
profileId?: string | null;
|
|
211
245
|
/** Workspaceid */
|
|
@@ -238,6 +272,11 @@ interface components {
|
|
|
238
272
|
* @default 0
|
|
239
273
|
*/
|
|
240
274
|
proxyCostUsd: string;
|
|
275
|
+
/**
|
|
276
|
+
* Browsercostusd
|
|
277
|
+
* @default 0
|
|
278
|
+
*/
|
|
279
|
+
browserCostUsd: string;
|
|
241
280
|
/**
|
|
242
281
|
* Totalcostusd
|
|
243
282
|
* @default 0
|