@oya-ai/cli 1.0.83 → 1.0.86

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.
Files changed (2) hide show
  1. package/dist/index.js +17 -5
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -142,7 +142,7 @@ var Browser = class {
142
142
  await this.command("close_tab", { tab_id: tabId });
143
143
  }
144
144
  /**
145
- * Detect and clear a CAPTCHA. Providers that solve natively are left to do
145
+ x * Detect and clear a CAPTCHA. Providers that solve natively are left to do
146
146
  * it; everything else goes to the configured solver.
147
147
  */
148
148
  solveCaptcha() {
@@ -475,7 +475,10 @@ var Oya = class {
475
475
  *
476
476
  * Bring your own LLM key (it pays for its own tokens, so no hourly chat quota applies):
477
477
  * await oya.config.set({ llm_provider: 'gemini', openai_api_key: process.env.GEMINI_API_KEY });
478
- * `llm_provider` is 'openai' | 'anthropic' | 'gemini'; `chat_model` overrides its default model.
478
+ * `llm_provider` is 'openai' | 'anthropic' | 'gemini' | 'vertex'; `chat_model` overrides
479
+ * its default model. 'vertex' is Gemini Enterprise (ex-Vertex AI) in express mode, which
480
+ * needs no GCP project; for a project-scoped endpoint, set `openai_base_url` to
481
+ * `.../endpoints/openapi` and pass an OAuth access token as `openai_api_key`.
479
482
  */
480
483
  config = {
481
484
  get: () => this.http.request("GET", "/api/config"),
@@ -940,7 +943,9 @@ function writeEnv(path, body) {
940
943
  var LLM_PRESETS = {
941
944
  anthropic: { base: "https://api.anthropic.com/v1", model: "claude-sonnet-4-5", label: "Anthropic (Claude)" },
942
945
  openai: { base: "https://api.openai.com/v1", model: "gpt-4o-mini", label: "OpenAI" },
943
- gemini: { base: "https://generativelanguage.googleapis.com/v1beta/openai", model: "gemini-3.8-flash", label: "Gemini (Google)" }
946
+ gemini: { base: "https://generativelanguage.googleapis.com/v1beta/openai", model: "gemini-3.8-flash", label: "Gemini (Google)" },
947
+ // Express mode: a global endpoint, no GCP project or location needed.
948
+ vertex: { base: "https://aiplatform.googleapis.com/v1/publishers/google", model: "gemini-2.5-flash", label: "Gemini Enterprise (Vertex AI)" }
944
949
  };
945
950
  async function askLlm() {
946
951
  step("Agent LLM", "Drives `oya ask` and the chat API.");
@@ -949,6 +954,7 @@ async function askLlm() {
949
954
  { id: "anthropic", label: "Anthropic (Claude)" },
950
955
  { id: "openai", label: "OpenAI" },
951
956
  { id: "gemini", label: "Gemini (Google)" },
957
+ { id: "vertex", label: "Gemini Enterprise (Vertex AI)", note: "express-mode API key" },
952
958
  { id: "compatible", label: "An OpenAI-compatible endpoint", note: "OpenRouter, Together, Groq, Azure" },
953
959
  { id: "local", label: "A local model", note: "Ollama, vLLM, LM Studio" },
954
960
  { id: "skip", label: "Skip", note: "no agent control; add it later with `oya config`" }
@@ -975,7 +981,11 @@ async function verifyLlm(baseUrl, key, model) {
975
981
  try {
976
982
  const anthropic = /(^|\.)anthropic\.com$/i.test(new URL(baseUrl).hostname);
977
983
  const headers = anthropic ? { "x-api-key": key, "anthropic-version": "2023-06-01" } : { Authorization: `Bearer ${key}` };
978
- const res = await fetch(`${baseUrl}/models`, { headers });
984
+ const res = /\/publishers\/google\/?$/.test(baseUrl) ? await fetch(`${baseUrl.replace(/\/+$/, "")}/models/${encodeURIComponent(model || "gemini-2.5-flash")}:generateContent?key=${encodeURIComponent(key)}`, {
985
+ method: "POST",
986
+ headers: { "Content-Type": "application/json" },
987
+ body: JSON.stringify({ contents: [{ role: "user", parts: [{ text: "hi" }] }], generationConfig: { maxOutputTokens: 1 } })
988
+ }) : await fetch(`${baseUrl}/models`, { headers });
979
989
  if (res.status === 401 || res.status === 403) {
980
990
  spin.fail();
981
991
  return `${baseUrl} rejected that key (HTTP ${res.status}).`;
@@ -1576,12 +1586,14 @@ async function cmdInit(flags2) {
1576
1586
  { id: "anthropic", label: "Claude (Anthropic)" },
1577
1587
  { id: "openai", label: "OpenAI" },
1578
1588
  { id: "gemini", label: "Gemini (Google)" },
1589
+ { id: "vertex", label: "Gemini Enterprise (Vertex AI)" },
1579
1590
  { id: "skip", label: "Skip", note: current.has_openai_key ? "keep what is configured" : "no agent control" }
1580
1591
  ]);
1581
1592
  const presets = {
1582
1593
  anthropic: { name: "Anthropic", model: "claude-sonnet-4-5" },
1583
1594
  openai: { name: "OpenAI", model: "gpt-4o-mini" },
1584
- gemini: { name: "Gemini", model: "gemini-3.8-flash" }
1595
+ gemini: { name: "Gemini", model: "gemini-3.8-flash" },
1596
+ vertex: { name: "Gemini Enterprise", model: "gemini-2.5-flash" }
1585
1597
  };
1586
1598
  const updates = {};
1587
1599
  if (llm !== "skip") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oya-ai/cli",
3
- "version": "1.0.83",
3
+ "version": "1.0.86",
4
4
  "description": "Command line for the Oya browser control plane.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://browser.getoya.ai",
@@ -39,7 +39,7 @@
39
39
  "access": "public"
40
40
  },
41
41
  "devDependencies": {
42
- "@oya-ai/browser": "1.0.83",
42
+ "@oya-ai/browser": "1.0.86",
43
43
  "@types/node": "^20.19.43",
44
44
  "tsup": "^8.0.0",
45
45
  "typescript": "^5.4.0"