@koreanhole/opencodex 3.2.14 → 3.2.16

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.
package/AGENTS_INSTALL.md CHANGED
@@ -63,6 +63,10 @@ or through the documented default path; unrelated Codex settings are not changed
63
63
  - Explicit process-environment API-key, Vertex, or gateway configuration takes
64
64
  precedence over automatic OAuth selection. An explicit
65
65
  `GOOGLE_GENAI_USE_GCA=true` selects OAuth.
66
+ - After explicit environment configuration, the vendor's selected authentication
67
+ method is authoritative: a vendor-selected API-key login uses its `.env`, and
68
+ a vendor-selected OAuth login remains OAuth-only. Missing or unreadable vendor
69
+ selection keeps the previous OAuth-first fallback.
66
70
  - The proxy writes under `$OPENCODEX_HOME` (default `~/.opencodex`) and may update
67
71
  the active opencodex Codex model catalog selected by `model_catalog_json`.
68
72
 
package/README.md CHANGED
@@ -35,11 +35,12 @@ gemini
35
35
  Gemini headless turns support an explicit Gemini Developer API key, Vertex AI
36
36
  GenAI configuration, or the operator's existing Gemini CLI OAuth login. opencodex
37
37
  does not automate Google OAuth. OAuth reuse requires an account and tier eligible
38
- for the installed Gemini CLI's service; explicit API-key or Vertex environment
39
- configuration takes precedence over automatic OAuth selection. With no explicit
40
- environment authentication, OAuth is selected automatically, including logins
41
- stored in the vendor keychain or under a custom `GEMINI_CLI_HOME`; no API key is
42
- required.
38
+ for the installed Gemini CLI's service. Explicit environment configuration takes
39
+ precedence, then the vendor's selected authentication method; a vendor-selected
40
+ API-key login uses its `.env`, while an OAuth selection keeps OAuth-only
41
+ behavior. Without a readable vendor selection, the previous OAuth-first fallback
42
+ applies, including logins stored in the vendor keychain or under a custom
43
+ `GEMINI_CLI_HOME`.
43
44
 
44
45
  Cline 2.2.0 is the minimum supported release. Newer options are used only when
45
46
  the installed binary advertises them.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koreanhole/opencodex",
3
- "version": "3.2.14",
3
+ "version": "3.2.16",
4
4
  "description": "Full opencodex runtime with Cline 2.2.0+ JSON and Gemini CLI headless provider adapters",
5
5
  "type": "module",
6
6
  "main": "./bin/package-main.mjs",
@@ -33,6 +33,7 @@
33
33
  "test:e2e:cline-live": "bun test ./tests/e2e/cline-live.live.ts",
34
34
  "test:e2e:gemini": "bun test ./tests/e2e/gemini-codex.live.ts -t \"full-stack:\"",
35
35
  "test:e2e:gemini-oauth-only": "bun test ./tests/e2e/gemini-oauth-only.test.ts",
36
+ "test:e2e:gemini-auth-selection": "bun test ./tests/e2e/gemini-oauth-only.test.ts -t \"honors vendor-selected API-key\"",
36
37
  "test:e2e:gemini-slow": "bun test ./tests/e2e/gemini-codex.live.ts -t \"full-stack: a slow Gemini start\"",
37
38
  "test:e2e:gemini-tool": "bun test ./tests/e2e/gemini-codex.live.ts -t \"one short Gemini turn leaves the workspace unchanged\"",
38
39
  "test:e2e:gemini-multiturn": "bun test ./tests/e2e/gemini-codex.live.ts -t \"reuses a live Codex multi-turn session\"",
@@ -1,5 +1,5 @@
1
1
  import { spawn as nodeSpawn, type ChildProcess } from "node:child_process";
2
- import { existsSync } from "node:fs";
2
+ import { existsSync, readFileSync } from "node:fs";
3
3
  import { link, lstat, mkdir, mkdtemp, readFile, rm, stat, symlink, writeFile } from "node:fs/promises";
4
4
  import { homedir, tmpdir } from "node:os";
5
5
  import { join, resolve } from "node:path";
@@ -101,6 +101,20 @@ function asString(value: unknown): string | undefined {
101
101
  return typeof value === "string" ? value : undefined;
102
102
  }
103
103
 
104
+ function geminiSelectedAuth(sourceEnv: NodeJS.ProcessEnv): GeminiHeadlessAuth | undefined {
105
+ let settings: unknown;
106
+ try {
107
+ settings = JSON.parse(readFileSync(join(geminiVendorHome(sourceEnv), ".gemini", "settings.json"), "utf8"));
108
+ } catch {
109
+ return undefined;
110
+ }
111
+ const security = asRecord(asRecord(settings)?.security);
112
+ const selectedType = nonEmpty(asRecord(security?.auth)?.selectedType);
113
+ if (selectedType === "oauth-personal") return "oauth";
114
+ if (selectedType === "gemini-api-key") return "environment";
115
+ return undefined;
116
+ }
117
+
104
118
  function geminiHeadlessAuth(sourceEnv: NodeJS.ProcessEnv): GeminiHeadlessAuth {
105
119
  if (enabled(sourceEnv.GOOGLE_GENAI_USE_GCA)) return "oauth";
106
120
  if (
@@ -109,6 +123,8 @@ function geminiHeadlessAuth(sourceEnv: NodeJS.ProcessEnv): GeminiHeadlessAuth {
109
123
  || enabled(sourceEnv.GOOGLE_GENAI_USE_VERTEXAI)
110
124
  || nonEmpty(sourceEnv.GOOGLE_GEMINI_BASE_URL)
111
125
  ) return "environment";
126
+ const selected = geminiSelectedAuth(sourceEnv);
127
+ if (selected) return selected;
112
128
  if (
113
129
  existsSync(join(geminiVendorHome(sourceEnv), ".gemini", "oauth_creds.json"))
114
130
  || enabled(sourceEnv.GEMINI_FORCE_ENCRYPTED_FILE_STORAGE)