@koreanhole/opencodex 3.2.15 → 3.2.17
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 +4 -0
- package/README.md +7 -5
- package/package.json +3 -1
- package/src/adapters/cli-agent/gemini/headless.ts +20 -2
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,13 @@ 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
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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`. Linux keyring access and the vendor encrypted credential file
|
|
44
|
+
are preserved for isolated OAuth turns.
|
|
43
45
|
|
|
44
46
|
Cline 2.2.0 is the minimum supported release. Newer options are used only when
|
|
45
47
|
the installed binary advertises them.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koreanhole/opencodex",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.17",
|
|
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,8 @@
|
|
|
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\"",
|
|
37
|
+
"test:e2e:gemini-oauth-keychain": "bun test ./tests/e2e/gemini-oauth-only.test.ts -t \"passes keyring access\"",
|
|
36
38
|
"test:e2e:gemini-slow": "bun test ./tests/e2e/gemini-codex.live.ts -t \"full-stack: a slow Gemini start\"",
|
|
37
39
|
"test:e2e:gemini-tool": "bun test ./tests/e2e/gemini-codex.live.ts -t \"one short Gemini turn leaves the workspace unchanged\"",
|
|
38
40
|
"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";
|
|
@@ -48,6 +48,8 @@ const FORWARDED_ENV_KEYS = [
|
|
|
48
48
|
"GOOGLE_CLOUD_LOCATION",
|
|
49
49
|
"GOOGLE_APPLICATION_CREDENTIALS",
|
|
50
50
|
"GOOGLE_GEMINI_BASE_URL",
|
|
51
|
+
"DBUS_SESSION_BUS_ADDRESS",
|
|
52
|
+
"XDG_RUNTIME_DIR",
|
|
51
53
|
"GEMINI_FORCE_ENCRYPTED_FILE_STORAGE",
|
|
52
54
|
"GEMINI_FORCE_FILE_STORAGE",
|
|
53
55
|
"GEMINI_API_KEY_AUTH_MECHANISM",
|
|
@@ -63,7 +65,7 @@ const FORWARDED_ENV_KEYS = [
|
|
|
63
65
|
] as const;
|
|
64
66
|
|
|
65
67
|
const AUTH_FILE_NAMES = ["oauth_creds.json", "google_accounts.json", ".env"] as const;
|
|
66
|
-
const OAUTH_AUTH_FILE_NAMES = ["oauth_creds.json", "google_accounts.json"] as const;
|
|
68
|
+
const OAUTH_AUTH_FILE_NAMES = ["oauth_creds.json", "google_accounts.json", "gemini-credentials.json"] as const;
|
|
67
69
|
type GeminiHeadlessAuth = "oauth" | "environment";
|
|
68
70
|
|
|
69
71
|
export interface GeminiHeadlessDeps extends CliAgentTurnDeps {
|
|
@@ -101,6 +103,20 @@ function asString(value: unknown): string | undefined {
|
|
|
101
103
|
return typeof value === "string" ? value : undefined;
|
|
102
104
|
}
|
|
103
105
|
|
|
106
|
+
function geminiSelectedAuth(sourceEnv: NodeJS.ProcessEnv): GeminiHeadlessAuth | undefined {
|
|
107
|
+
let settings: unknown;
|
|
108
|
+
try {
|
|
109
|
+
settings = JSON.parse(readFileSync(join(geminiVendorHome(sourceEnv), ".gemini", "settings.json"), "utf8"));
|
|
110
|
+
} catch {
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
const security = asRecord(asRecord(settings)?.security);
|
|
114
|
+
const selectedType = nonEmpty(asRecord(security?.auth)?.selectedType);
|
|
115
|
+
if (selectedType === "oauth-personal") return "oauth";
|
|
116
|
+
if (selectedType === "gemini-api-key") return "environment";
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
|
|
104
120
|
function geminiHeadlessAuth(sourceEnv: NodeJS.ProcessEnv): GeminiHeadlessAuth {
|
|
105
121
|
if (enabled(sourceEnv.GOOGLE_GENAI_USE_GCA)) return "oauth";
|
|
106
122
|
if (
|
|
@@ -109,6 +125,8 @@ function geminiHeadlessAuth(sourceEnv: NodeJS.ProcessEnv): GeminiHeadlessAuth {
|
|
|
109
125
|
|| enabled(sourceEnv.GOOGLE_GENAI_USE_VERTEXAI)
|
|
110
126
|
|| nonEmpty(sourceEnv.GOOGLE_GEMINI_BASE_URL)
|
|
111
127
|
) return "environment";
|
|
128
|
+
const selected = geminiSelectedAuth(sourceEnv);
|
|
129
|
+
if (selected) return selected;
|
|
112
130
|
if (
|
|
113
131
|
existsSync(join(geminiVendorHome(sourceEnv), ".gemini", "oauth_creds.json"))
|
|
114
132
|
|| enabled(sourceEnv.GEMINI_FORCE_ENCRYPTED_FILE_STORAGE)
|