Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/core/lib/v3/agent/MicrosoftCUAClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,8 @@ For each function call, return a json object with function name and arguments wi
const originalContent =
typeof lastMessage.content === "string"
? lastMessage.content
: (lastMessage.content.find((c) => c.type === "text")?.text ??
"Start task");
: lastMessage.content.find((c) => c.type === "text")?.text ??
"Start task";

lastMessage.content = [
{
Expand Down
4 changes: 2 additions & 2 deletions packages/core/lib/v3/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ export class StagehandAPIClient {
// Only load from env if provider differs from the original
const apiKey =
provider && provider !== this.modelProvider
? (loadApiKeyFromEnv(provider, this.logger) ?? this.modelApiKey)
? loadApiKeyFromEnv(provider, this.logger) ?? this.modelApiKey
: this.modelApiKey;
return {
modelName: model,
Expand All @@ -413,7 +413,7 @@ export class StagehandAPIClient {
// Only load from env if provider differs from the original
const apiKey =
provider && provider !== this.modelProvider
? (loadApiKeyFromEnv(provider, this.logger) ?? this.modelApiKey)
? loadApiKeyFromEnv(provider, this.logger) ?? this.modelApiKey
: this.modelApiKey;
return {
...model,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/lib/v3/cache/AgentCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ export class AgentCache {
const actions =
Array.isArray(step.actions) && step.actions.length > 0
? step.actions
: (step.observeResults ?? []);
: step.observeResults ?? [];
if (!Array.isArray(actions) || actions.length === 0) return;
const page = await ctx.awaitActivePage();
for (const action of actions) {
Expand Down
8 changes: 4 additions & 4 deletions packages/core/lib/v3/dom/locatorScripts/counts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function countCssMatchesPrimary(selectorRaw: string): number {
const doc =
root instanceof Document
? root
: ((root as Element)?.ownerDocument ?? document);
: (root as Element)?.ownerDocument ?? document;
const walker = doc.createTreeWalker(root, NodeFilter.SHOW_ELEMENT);
let node: Node | null;
while ((node = walker.nextNode())) {
Expand Down Expand Up @@ -119,8 +119,8 @@ export function countCssMatchesPierce(selectorRaw: string): number {
root instanceof Document
? root
: root instanceof ShadowRoot
? (root.host?.ownerDocument ?? document)
: ((root as Element).ownerDocument ?? document);
? root.host?.ownerDocument ?? document
: (root as Element).ownerDocument ?? document;
const walker = doc.createTreeWalker(root, NodeFilter.SHOW_ELEMENT);
let node: Node | null;
while ((node = walker.nextNode())) {
Expand Down Expand Up @@ -213,7 +213,7 @@ export function countTextMatches(rawNeedle: string): TextMatchResult {
const doc =
root instanceof Document
? root
: ((root as Element)?.ownerDocument ?? document);
: (root as Element)?.ownerDocument ?? document;
return doc.createTreeWalker(root, NodeFilter.SHOW_ELEMENT);
} catch {
return null;
Expand Down
10 changes: 3 additions & 7 deletions packages/core/lib/v3/dom/locatorScripts/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ const collectCssMatches = (selector: string, limit: number): Element[] => {

try {
const ownerDocument =
root instanceof Document
? root
: (root.host?.ownerDocument ?? document);
root instanceof Document ? root : root.host?.ownerDocument ?? document;
const walker = ownerDocument.createTreeWalker(
root,
NodeFilter.SHOW_ELEMENT,
Expand Down Expand Up @@ -115,9 +113,7 @@ export function resolveCssSelectorPierce(

try {
const ownerDocument =
root instanceof Document
? root
: (root.host?.ownerDocument ?? document);
root instanceof Document ? root : root.host?.ownerDocument ?? document;
const walker = ownerDocument.createTreeWalker(
root,
NodeFilter.SHOW_ELEMENT,
Expand Down Expand Up @@ -229,7 +225,7 @@ export function resolveTextSelector(
const doc =
root instanceof Document
? root
: ((root as Element)?.ownerDocument ?? document);
: (root as Element)?.ownerDocument ?? document;
return doc.createTreeWalker(root, NodeFilter.SHOW_ELEMENT);
} catch {
return null;
Expand Down
2 changes: 2 additions & 0 deletions packages/core/lib/v3/llm/LLMProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ const modelToProviderMap: { [key in AvailableModel]: ModelProvider } = {
"gemini-2.0-flash": "google",
"gemini-2.5-flash-preview-04-17": "google",
"gemini-2.5-pro-preview-03-25": "google",
"gemini-3-flash-preview": "google",
"gemini-3-pro-preview": "google",
};

export function getAISDKLanguageModel(
Expand Down
2 changes: 2 additions & 0 deletions packages/core/lib/v3/types/public/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ export type AvailableModel =
| "gemini-2.0-flash"
| "gemini-2.5-flash-preview-04-17"
| "gemini-2.5-pro-preview-03-25"
| "gemini-3-flash-preview"
| "gemini-3-pro-preview"
| string;

export type ModelProvider =
Expand Down
2 changes: 1 addition & 1 deletion packages/core/lib/v3/understudy/frameLocator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class FrameLocator {
async resolveFrame(): Promise<Frame> {
const parentFrame: Frame = this.parent
? await this.parent.resolveFrame()
: (this.root ?? this.page.mainFrame());
: this.root ?? this.page.mainFrame();

// Resolve the iframe element inside the parent frame
const tmp = parentFrame.locator(this.selector);
Expand Down
4 changes: 2 additions & 2 deletions packages/core/lib/v3/v3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1596,7 +1596,7 @@ export class V3 {
// Note: experimental validation is done at the call site before this method
const tools = options?.integrations
? await resolveTools(options.integrations, options.tools)
: (options?.tools ?? {});
: options?.tools ?? {};

const agentLlmClient = options?.model
? this.resolveLlmClient(options.model)
Expand Down Expand Up @@ -1743,7 +1743,7 @@ export class V3 {
});
const tools = options?.integrations
? await resolveTools(options.integrations, options.tools)
: (options?.tools ?? {});
: options?.tools ?? {};

const handler = new V3CuaAgentHandler(
this,
Expand Down
2 changes: 2 additions & 0 deletions packages/evals/taskConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const ALL_EVAL_MODELS = [
"gemini-1.5-flash-8b",
"gemini-2.5-flash-preview-04-17",
"gemini-2.5-pro-preview-03-25",
"gemini-3-flash-preview",
"gemini-3-pro-preview",
// ANTHROPIC
"claude-3-5-sonnet-latest",
"claude-3-7-sonnet-latest",
Expand Down
2 changes: 2 additions & 0 deletions packages/server/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ export function mapModelToProvider(model: LegacyModel): LegacyProvider {
case "gemini-2.0-flash":
case "gemini-2.5-pro-preview-03-25":
case "gemini-2.5-flash-preview-04-17":
case "gemini-3-flash-preview":
case "gemini-3-pro-preview":
return "google";
case "cerebras-llama-3.3-70b":
case "cerebras-llama-3.1-8b":
Expand Down
4 changes: 3 additions & 1 deletion packages/server/src/types/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export type LegacyModel =
| "gemini-2.0-flash-lite"
| "gemini-2.0-flash"
| "gemini-2.5-pro-preview-03-25"
| "gemini-2.5-flash-preview-04-17";
| "gemini-2.5-flash-preview-04-17"
| "gemini-3-flash-preview"
| "gemini-3-pro-preview";

export type LegacyProvider = "openai" | "anthropic" | "google";
Loading