@oya-ai/cli 1.0.85 → 1.0.87

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 +18 -4
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -346,6 +346,7 @@ var Run = class {
346
346
  }
347
347
  }
348
348
  };
349
+ var MAX_FILE_BYTES = 10 * 1024 * 1024;
349
350
  var DEFAULT_BASE_URL = "https://browser.getoya.ai";
350
351
  var READY_POLL_MS = 2e3;
351
352
  var env = (name) => globalThis.process?.env?.[name];
@@ -475,7 +476,11 @@ var Oya = class {
475
476
  *
476
477
  * Bring your own LLM key (it pays for its own tokens, so no hourly chat quota applies):
477
478
  * 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.
479
+ * `llm_provider` is the {@link LlmProvider} union, so an editor offers the choices and a
480
+ * typo is a compile error; `chat_model` overrides its default model. 'vertex' is Gemini
481
+ * Enterprise (ex-Vertex AI) in express mode, which needs no GCP project; for a
482
+ * project-scoped endpoint, set `openai_base_url` to `.../endpoints/openapi` and pass an
483
+ * OAuth access token as `openai_api_key`. See {@link ConfigUpdate} for every field.
479
484
  */
480
485
  config = {
481
486
  get: () => this.http.request("GET", "/api/config"),
@@ -940,7 +945,9 @@ function writeEnv(path, body) {
940
945
  var LLM_PRESETS = {
941
946
  anthropic: { base: "https://api.anthropic.com/v1", model: "claude-sonnet-4-5", label: "Anthropic (Claude)" },
942
947
  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)" }
948
+ gemini: { base: "https://generativelanguage.googleapis.com/v1beta/openai", model: "gemini-3.8-flash", label: "Gemini (Google)" },
949
+ // Express mode: a global endpoint, no GCP project or location needed.
950
+ vertex: { base: "https://aiplatform.googleapis.com/v1/publishers/google", model: "gemini-2.5-flash", label: "Gemini Enterprise (Vertex AI)" }
944
951
  };
945
952
  async function askLlm() {
946
953
  step("Agent LLM", "Drives `oya ask` and the chat API.");
@@ -949,6 +956,7 @@ async function askLlm() {
949
956
  { id: "anthropic", label: "Anthropic (Claude)" },
950
957
  { id: "openai", label: "OpenAI" },
951
958
  { id: "gemini", label: "Gemini (Google)" },
959
+ { id: "vertex", label: "Gemini Enterprise (Vertex AI)", note: "express-mode API key" },
952
960
  { id: "compatible", label: "An OpenAI-compatible endpoint", note: "OpenRouter, Together, Groq, Azure" },
953
961
  { id: "local", label: "A local model", note: "Ollama, vLLM, LM Studio" },
954
962
  { id: "skip", label: "Skip", note: "no agent control; add it later with `oya config`" }
@@ -975,7 +983,11 @@ async function verifyLlm(baseUrl, key, model) {
975
983
  try {
976
984
  const anthropic = /(^|\.)anthropic\.com$/i.test(new URL(baseUrl).hostname);
977
985
  const headers = anthropic ? { "x-api-key": key, "anthropic-version": "2023-06-01" } : { Authorization: `Bearer ${key}` };
978
- const res = await fetch(`${baseUrl}/models`, { headers });
986
+ const res = /\/publishers\/google\/?$/.test(baseUrl) ? await fetch(`${baseUrl.replace(/\/+$/, "")}/models/${encodeURIComponent(model || "gemini-2.5-flash")}:generateContent?key=${encodeURIComponent(key)}`, {
987
+ method: "POST",
988
+ headers: { "Content-Type": "application/json" },
989
+ body: JSON.stringify({ contents: [{ role: "user", parts: [{ text: "hi" }] }], generationConfig: { maxOutputTokens: 1 } })
990
+ }) : await fetch(`${baseUrl}/models`, { headers });
979
991
  if (res.status === 401 || res.status === 403) {
980
992
  spin.fail();
981
993
  return `${baseUrl} rejected that key (HTTP ${res.status}).`;
@@ -1576,12 +1588,14 @@ async function cmdInit(flags2) {
1576
1588
  { id: "anthropic", label: "Claude (Anthropic)" },
1577
1589
  { id: "openai", label: "OpenAI" },
1578
1590
  { id: "gemini", label: "Gemini (Google)" },
1591
+ { id: "vertex", label: "Gemini Enterprise (Vertex AI)" },
1579
1592
  { id: "skip", label: "Skip", note: current.has_openai_key ? "keep what is configured" : "no agent control" }
1580
1593
  ]);
1581
1594
  const presets = {
1582
1595
  anthropic: { name: "Anthropic", model: "claude-sonnet-4-5" },
1583
1596
  openai: { name: "OpenAI", model: "gpt-4o-mini" },
1584
- gemini: { name: "Gemini", model: "gemini-3.8-flash" }
1597
+ gemini: { name: "Gemini", model: "gemini-3.8-flash" },
1598
+ vertex: { name: "Gemini Enterprise", model: "gemini-2.5-flash" }
1585
1599
  };
1586
1600
  const updates = {};
1587
1601
  if (llm !== "skip") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oya-ai/cli",
3
- "version": "1.0.85",
3
+ "version": "1.0.87",
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.85",
42
+ "@oya-ai/browser": "1.0.87",
43
43
  "@types/node": "^20.19.43",
44
44
  "tsup": "^8.0.0",
45
45
  "typescript": "^5.4.0"