diff --git a/src/agents/models.profiles.live.test.ts b/src/agents/models.profiles.live.test.ts index 45024be491c..1fb7232dcc1 100644 --- a/src/agents/models.profiles.live.test.ts +++ b/src/agents/models.profiles.live.test.ts @@ -50,6 +50,9 @@ function isGoogleModelNotFoundError(err: unknown): boolean { if (!/not found/i.test(msg)) { return false; } + if (/\b404\b/.test(msg)) { + return true; + } if (/models\/.+ is not found for api version/i.test(msg)) { return true; } @@ -445,7 +448,10 @@ describeLive("live models (profile keys)", () => { logProgress(`${progressLabel}: skip (anthropic billing)`); break; } - if (model.provider === "google" && isGoogleModelNotFoundError(err)) { + if ( + (model.provider === "google" || model.provider === "google-gemini-cli") && + isGoogleModelNotFoundError(err) + ) { skipped.push({ model: id, reason: message }); logProgress(`${progressLabel}: skip (google model not found)`); break; diff --git a/src/agents/tool-policy.ts b/src/agents/tool-policy.ts index 393a110069e..bd029643a87 100644 --- a/src/agents/tool-policy.ts +++ b/src/agents/tool-policy.ts @@ -1,4 +1,17 @@ -import { type AnyAgentTool, wrapOwnerOnlyToolExecution } from "./tools/common.js"; +import type { AnyAgentTool } from "./tools/common.js"; + +// Keep tool-policy browser-safe: do not import tools/common at runtime. +function wrapOwnerOnlyToolExecution(tool: AnyAgentTool, senderIsOwner: boolean): AnyAgentTool { + if (tool.ownerOnly !== true || senderIsOwner || !tool.execute) { + return tool; + } + return { + ...tool, + execute: async () => { + throw new Error("Tool restricted to owner senders."); + }, + }; +} export type ToolProfileId = "minimal" | "coding" | "messaging" | "full";