opencode-gemini-auth 1.1.6 → 1.2.0

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/README.md CHANGED
@@ -25,18 +25,71 @@ falls back to the classic copy/paste flow and explains what to do.
25
25
  ## Updating
26
26
 
27
27
  > [!WARNING]
28
- > OpenCode does NOT auto-update plugins
28
+ > Opencode does NOT auto-update plugins.
29
29
 
30
- To get the latest version:
30
+ To get the latest version, you need to clear the cached plugin and let Opencode reinstall it:
31
31
 
32
32
  ```bash
33
- (cd ~ && sed -i.bak '/"opencode-gemini-auth"/d' .cache/opencode/package.json && \
34
- rm -rf .cache/opencode/node_modules/opencode-gemini-auth && \
35
- echo "Plugin update script finished successfully.")
33
+ # Remove the plugin from cache
34
+ rm -rf ~/.cache/opencode/node_modules/opencode-gemini-auth
35
+
36
+ # Run Opencode to trigger reinstall
37
+ opencode
36
38
  ```
37
39
 
38
- ```bash
39
- opencode # Reinstalls latest
40
+ Alternatively, you can manually remove the dependency from `~/.cache/opencode/package.json` if the above doesn't work.
41
+
42
+ ## Thinking Configuration
43
+
44
+ This plugin supports configuring "thinking" capabilities for Gemini models via the `thinkingConfig` option.
45
+
46
+ * **Gemini 3 models** use `thinkingLevel` (string: `'low'`, `'medium'`, `'high'`).
47
+ * **Gemini 2.5 models** use `thinkingBudget` (number).
48
+
49
+ The plugin passes these values through to the API as configured.
50
+
51
+ ### Examples
52
+
53
+ **Gemini 3 (using `thinkingLevel`):**
54
+
55
+ ```json
56
+ {
57
+ "provider": {
58
+ "google": {
59
+ "models": {
60
+ "gemini-3-pro-preview": {
61
+ "options": {
62
+ "thinkingConfig": {
63
+ "thinkingLevel": "high",
64
+ "includeThoughts": true
65
+ }
66
+ }
67
+ }
68
+ }
69
+ }
70
+ }
71
+ }
72
+ ```
73
+
74
+ **Gemini 2.5 (using `thinkingBudget`):**
75
+
76
+ ```json
77
+ {
78
+ "provider": {
79
+ "google": {
80
+ "models": {
81
+ "gemini-2.5-flash": {
82
+ "options": {
83
+ "thinkingConfig": {
84
+ "thinkingBudget": 8192,
85
+ "includeThoughts": true
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
91
+ }
92
+ }
40
93
  ```
41
94
 
42
95
  ## Local Development
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "opencode-gemini-auth",
3
3
  "module": "index.ts",
4
- "version": "1.1.6",
4
+ "version": "1.2.0",
5
5
  "author": "jenslys",
6
6
  "repository": "https://github.com/jenslys/opencode-gemini-auth",
7
7
  "files": [
@@ -27,15 +27,19 @@ export interface GeminiUsageMetadata {
27
27
  }
28
28
 
29
29
  /**
30
- * Normalized thinking configuration accepted by Gemini.
30
+ * Thinking configuration accepted by Gemini.
31
+ * - Gemini 3 models use thinkingLevel (string: 'low', 'medium', 'high')
32
+ * - Gemini 2.5 models use thinkingBudget (number)
31
33
  */
32
34
  export interface ThinkingConfig {
33
35
  thinkingBudget?: number;
36
+ thinkingLevel?: string;
34
37
  includeThoughts?: boolean;
35
38
  }
36
39
 
37
40
  /**
38
- * Ensures thinkingConfig is valid: includeThoughts only allowed when budget > 0.
41
+ * Normalizes thinkingConfig - passes through values as-is without mapping.
42
+ * User should use thinkingLevel for Gemini 3 and thinkingBudget for Gemini 2.5.
39
43
  */
40
44
  export function normalizeThinkingConfig(config: unknown): ThinkingConfig | undefined {
41
45
  if (!config || typeof config !== "object") {
@@ -44,15 +48,14 @@ export function normalizeThinkingConfig(config: unknown): ThinkingConfig | undef
44
48
 
45
49
  const record = config as Record<string, unknown>;
46
50
  const budgetRaw = record.thinkingBudget ?? record.thinking_budget;
51
+ const levelRaw = record.thinkingLevel ?? record.thinking_level;
47
52
  const includeRaw = record.includeThoughts ?? record.include_thoughts;
48
53
 
49
54
  const thinkingBudget = typeof budgetRaw === "number" && Number.isFinite(budgetRaw) ? budgetRaw : undefined;
55
+ const thinkingLevel = typeof levelRaw === "string" && levelRaw.length > 0 ? levelRaw.toLowerCase() : undefined;
50
56
  const includeThoughts = typeof includeRaw === "boolean" ? includeRaw : undefined;
51
57
 
52
- const enableThinking = thinkingBudget !== undefined && thinkingBudget > 0;
53
- const finalInclude = enableThinking ? includeThoughts ?? false : false;
54
-
55
- if (!enableThinking && finalInclude === false && thinkingBudget === undefined && includeThoughts === undefined) {
58
+ if (thinkingBudget === undefined && thinkingLevel === undefined && includeThoughts === undefined) {
56
59
  return undefined;
57
60
  }
58
61
 
@@ -60,8 +63,11 @@ export function normalizeThinkingConfig(config: unknown): ThinkingConfig | undef
60
63
  if (thinkingBudget !== undefined) {
61
64
  normalized.thinkingBudget = thinkingBudget;
62
65
  }
63
- if (finalInclude !== undefined) {
64
- normalized.includeThoughts = finalInclude;
66
+ if (thinkingLevel !== undefined) {
67
+ normalized.thinkingLevel = thinkingLevel;
68
+ }
69
+ if (includeThoughts !== undefined) {
70
+ normalized.includeThoughts = includeThoughts;
65
71
  }
66
72
  return normalized;
67
73
  }