diff --git a/package.json b/package.json index 43a57af..5f250a7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hyperbrowser/sdk", - "version": "1.2.1", + "version": "1.2.2", "description": "Node SDK for Hyperbrowser API", "author": "", "repository": { diff --git a/src/types/agents/gemini-computer-use.ts b/src/types/agents/gemini-computer-use.ts index 090cfce..76fcebd 100644 --- a/src/types/agents/gemini-computer-use.ts +++ b/src/types/agents/gemini-computer-use.ts @@ -1,4 +1,8 @@ -import { GeminiComputerUseLlm, GeminiComputerUseTaskStatus } from "../constants"; +import { + GeminiComputerUseLlm, + GeminiComputerUseReasoningEffort, + GeminiComputerUseTaskStatus, +} from "../constants"; import { CreateSessionParams } from "../session"; export interface GeminiComputerUseApiKeys { @@ -8,6 +12,7 @@ export interface GeminiComputerUseApiKeys { export interface StartGeminiComputerUseTaskParams { task: string; llm?: GeminiComputerUseLlm; + reasoningEffort?: GeminiComputerUseReasoningEffort; sessionId?: string; maxFailures?: number; maxSteps?: number; diff --git a/src/types/constants.ts b/src/types/constants.ts index f256f35..e8ecf84 100644 --- a/src/types/constants.ts +++ b/src/types/constants.ts @@ -112,6 +112,7 @@ export type HyperAgentLlm = | "gemini-3-flash-preview"; export type GeminiComputerUseLlm = + | "gemini-4-argon" | "gemini-3.8-flash" | "gemini-3.7-flash" | "gemini-3.6-flash" @@ -120,6 +121,9 @@ export type GeminiComputerUseLlm = | "gemini-3-flash-preview" | "gemini-2.5-computer-use-preview-10-2025"; +// Gemini 4 Argon, 3.8 Flash, and 3.7 Flash do not support "minimal". +export type GeminiComputerUseReasoningEffort = "minimal" | "low" | "medium" | "high"; + export type GrokComputerUseLlm = "grok-4.7" | "grok-4.6" | "grok-4.5"; export type GrokReasoningEffort = "low" | "medium" | "high"; diff --git a/src/types/index.ts b/src/types/index.ts index d18cece..711506f 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -307,6 +307,7 @@ export { CuaLlm, CuaReasoningEffort, GeminiComputerUseLlm, + GeminiComputerUseReasoningEffort, GrokComputerUseLlm, GrokReasoningEffort, MetaComputerUseLlm, diff --git a/tests/integration/client-http.test.ts b/tests/integration/client-http.test.ts index 43bd321..04e22f3 100644 --- a/tests/integration/client-http.test.ts +++ b/tests/integration/client-http.test.ts @@ -68,6 +68,11 @@ const startServer = async ( return; } + if (request.method === "POST" && request.url === "/api/task/gemini-computer-use") { + sendJson(response, 200, { jobId: "gemini_job_123", liveUrl: null }); + return; + } + if (request.method === "POST" && request.url === "/api/task/meta-computer-use") { sendJson(response, 200, { jobId: "meta_job_123", liveUrl: null }); return; @@ -392,6 +397,70 @@ describe("client HTTP integration", () => { ]); }); + test("Gemini Computer Use forwards Gemini 4 Argon and reasoning effort on start", async () => { + const server = await startServer(); + servers.push(server); + const client = new HyperbrowserClient({ + apiKey: "test-api-key", + baseUrl: server.baseUrl, + }); + + const started = await client.agents.geminiComputerUse.start({ + task: "Complete the task", + llm: "gemini-4-argon", + reasoningEffort: "high", + useCustomApiKeys: true, + apiKeys: { google: "google-key" }, + }); + await client.agents.geminiComputerUse.start({ + task: "Complete the task", + llm: "gemini-3.6-flash", + reasoningEffort: "minimal", + }); + await client.agents.geminiComputerUse.start({ + task: "Complete the task", + llm: "gemini-4-argon", + }); + + expect(started).toEqual({ jobId: "gemini_job_123", liveUrl: null }); + expect(server.requests).toEqual([ + { + method: "POST", + url: "/api/task/gemini-computer-use", + apiKey: "test-api-key", + contentType: "application/json", + body: { + task: "Complete the task", + llm: "gemini-4-argon", + reasoningEffort: "high", + useCustomApiKeys: true, + apiKeys: { google: "google-key" }, + }, + }, + { + method: "POST", + url: "/api/task/gemini-computer-use", + apiKey: "test-api-key", + contentType: "application/json", + body: { + task: "Complete the task", + llm: "gemini-3.6-flash", + reasoningEffort: "minimal", + }, + }, + { + method: "POST", + url: "/api/task/gemini-computer-use", + apiKey: "test-api-key", + contentType: "application/json", + body: { + task: "Complete the task", + llm: "gemini-4-argon", + }, + }, + ]); + }); + test.each(["muse-spark-1.3", "muse-wonder-1.0"] as const)( "Meta Computer Use starts, polls, reads, and stops a %s task", async (llm) => {