@koreanhole/opencodex 3.2.23 → 3.2.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koreanhole/opencodex",
3
- "version": "3.2.23",
3
+ "version": "3.2.24",
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",
@@ -67,6 +67,16 @@ const FORWARDED_ENV_KEYS = [
67
67
  "no_proxy",
68
68
  ] as const;
69
69
 
70
+ const CA_FILE_ENV_KEYS = ["NODE_EXTRA_CA_CERTS", "SSL_CERT_FILE"] as const;
71
+ const CA_DIRECTORY_ENV_KEYS = ["SSL_CERT_DIR"] as const;
72
+
73
+ type GeminiCaTrustKind = "file" | "directory";
74
+
75
+ interface GeminiCaTrust {
76
+ env: Record<string, string>;
77
+ diagnostics: string[];
78
+ }
79
+
70
80
  const AUTH_FILE_NAMES = ["oauth_creds.json", "google_accounts.json", ".env"] as const;
71
81
  const OAUTH_AUTH_FILE_NAMES = ["oauth_creds.json", "google_accounts.json", "gemini-credentials.json"] as const;
72
82
  const GEMINI_AUTH_CONSULTED_KEYS = [
@@ -104,6 +114,42 @@ function nonEmpty(value: unknown): string | undefined {
104
114
  return typeof value === "string" && value.trim() ? value.trim() : undefined;
105
115
  }
106
116
 
117
+ function readablePathOfKind(path: string, kind: GeminiCaTrustKind): boolean {
118
+ try {
119
+ accessSync(path, constants.R_OK);
120
+ const info = statSync(path);
121
+ return kind === "file" ? info.isFile() : info.isDirectory();
122
+ } catch {
123
+ return false;
124
+ }
125
+ }
126
+
127
+ function geminiCaTrust(sourceEnv: NodeJS.ProcessEnv): GeminiCaTrust {
128
+ const env: Record<string, string> = {};
129
+ const forwarded: string[] = [];
130
+ const diagnostics: string[] = [];
131
+ const add = (key: string, value: string, kind: GeminiCaTrustKind): void => {
132
+ if (readablePathOfKind(value, kind)) {
133
+ env[key] = value;
134
+ forwarded.push(`${key}=${value}`);
135
+ } else {
136
+ diagnostics.push(`Gemini CA trust: ${key}=${value} is not an existing readable ${kind}; not forwarded`);
137
+ }
138
+ };
139
+ for (const key of CA_FILE_ENV_KEYS) {
140
+ const value = nonEmpty(sourceEnv[key]);
141
+ if (value) add(key, value, "file");
142
+ }
143
+ for (const key of CA_DIRECTORY_ENV_KEYS) {
144
+ const value = nonEmpty(sourceEnv[key]);
145
+ if (value) add(key, value, "directory");
146
+ }
147
+ if (forwarded.length > 0) {
148
+ diagnostics.unshift(`Gemini CA trust: forwarded ${forwarded.join("; ")}`);
149
+ }
150
+ return { env, diagnostics };
151
+ }
152
+
107
153
  function enabled(value: unknown): boolean {
108
154
  return nonEmpty(value)?.toLowerCase() === "true";
109
155
  }
@@ -373,6 +419,7 @@ export function buildGeminiHeadlessEnv(
373
419
  if (key === "CODE_ASSIST_ENDPOINT" && !isHttpEndpoint(value)) continue;
374
420
  env[key] = value;
375
421
  }
422
+ Object.assign(env, geminiCaTrust(sourceEnv).env);
376
423
  if (geminiHeadlessAuth(sourceEnv) === "oauth") {
377
424
  env.GOOGLE_GENAI_USE_GCA = "true";
378
425
  if (
@@ -553,7 +600,10 @@ export async function stageGeminiHeadlessWorkspace(
553
600
  const auth = geminiHeadlessAuth(sourceEnv);
554
601
  const credentialSource = resolveGeminiCredentialSource(sourceEnv, auth);
555
602
  assertResolvedGeminiCredentials(sourceEnv, credentialSource);
556
- const diagnostics = [credentialSourceDiagnostic(credentialSource)];
603
+ const diagnostics = [
604
+ ...geminiCaTrust(sourceEnv).diagnostics,
605
+ credentialSourceDiagnostic(credentialSource),
606
+ ];
557
607
  const root = options.root ?? await mkdtemp(join(tmpdir(), "ocx-gemini-headless-"));
558
608
  await mkdir(root, { recursive: true, mode: 0o700 });
559
609
  const geminiHome = join(root, "gemini-home");