opencode-gemini-cli-oauth 1.1.7 → 1.1.9
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/dist/plugin.d.ts +26 -2
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +39 -20
- package/dist/plugin.js.map +1 -1
- package/package.json +2 -2
package/dist/plugin.d.ts
CHANGED
|
@@ -15,9 +15,33 @@ export default function GeminiCLIOAuthPlugin({ client, directory }: PluginContex
|
|
|
15
15
|
auth: {
|
|
16
16
|
provider: string;
|
|
17
17
|
/**
|
|
18
|
-
* Auth loader -
|
|
18
|
+
* Auth loader - returns object with apiKey and fetch function
|
|
19
19
|
*/
|
|
20
|
-
loader: (getAuth: any, provider: string) => Promise<
|
|
20
|
+
loader: (getAuth: any, provider: string) => Promise<{
|
|
21
|
+
apiKey: string;
|
|
22
|
+
fetch: typeof authenticatedFetch;
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* Auth methods for 'opencode auth login' menu
|
|
26
|
+
*/
|
|
27
|
+
methods: {
|
|
28
|
+
label: string;
|
|
29
|
+
type: string;
|
|
30
|
+
authorize: () => Promise<{
|
|
31
|
+
url: string;
|
|
32
|
+
instructions: string;
|
|
33
|
+
method: string;
|
|
34
|
+
callback: () => Promise<{
|
|
35
|
+
type: string;
|
|
36
|
+
email: string;
|
|
37
|
+
error?: undefined;
|
|
38
|
+
} | {
|
|
39
|
+
type: string;
|
|
40
|
+
error: string;
|
|
41
|
+
email?: undefined;
|
|
42
|
+
}>;
|
|
43
|
+
}>;
|
|
44
|
+
}[];
|
|
21
45
|
};
|
|
22
46
|
}>;
|
|
23
47
|
export declare const metadata: {
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,YAAY,CAAC;AAK5D;;GAEG;AACH,iBAAe,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CA6BjG;AAED;;GAEG;AACH,wBAA8B,oBAAoB,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,aAAa;;;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,YAAY,CAAC;AAK5D;;GAEG;AACH,iBAAe,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CA6BjG;AAED;;GAEG;AACH,wBAA8B,oBAAoB,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,aAAa;;;QAOjF;;WAEG;0BACqB,GAAG,YAAY,MAAM;;;;QAO7C;;WAEG;;;;;;;;;;;;;;;;;;;;GA8BR;AAED,eAAO,MAAM,QAAQ;;;;;;;;CAQpB,CAAC"}
|
package/dist/plugin.js
CHANGED
|
@@ -31,7 +31,7 @@ async function authenticatedFetch(input, init) {
|
|
|
31
31
|
}
|
|
32
32
|
catch (error) {
|
|
33
33
|
console.error('❌ [Gemini OAuth] Token error:', error);
|
|
34
|
-
// Fallback to original request
|
|
34
|
+
// Fallback to original request
|
|
35
35
|
return fetch(input, init);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -39,36 +39,55 @@ async function authenticatedFetch(input, init) {
|
|
|
39
39
|
* OpenCode Plugin for Gemini CLI OAuth Authentication
|
|
40
40
|
*/
|
|
41
41
|
export default async function GeminiCLIOAuthPlugin({ client, directory }) {
|
|
42
|
-
console.log('🚀 Loading Gemini CLI OAuth plugin (v1.1.
|
|
43
|
-
// Verify credentials on load (optional, just for logging)
|
|
44
|
-
try {
|
|
45
|
-
const valid = await oauthManager.verifyCredentials();
|
|
46
|
-
if (valid) {
|
|
47
|
-
console.log('✅ Gemini CLI OAuth credentials verified');
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
console.warn('⚠️ Gemini CLI OAuth credentials missing or invalid. Run: opencode-gemini-setup');
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
catch (e) {
|
|
54
|
-
// Ignore init errors
|
|
55
|
-
}
|
|
42
|
+
console.log('🚀 Loading Gemini CLI OAuth plugin (v1.1.8)...');
|
|
56
43
|
return {
|
|
57
44
|
auth: {
|
|
58
45
|
provider: 'gemini-cli-oauth',
|
|
59
46
|
/**
|
|
60
|
-
* Auth loader -
|
|
47
|
+
* Auth loader - returns object with apiKey and fetch function
|
|
61
48
|
*/
|
|
62
49
|
loader: async (getAuth, provider) => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
50
|
+
return {
|
|
51
|
+
apiKey: 'gemini-cli-oauth-placeholder',
|
|
52
|
+
fetch: authenticatedFetch
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
/**
|
|
56
|
+
* Auth methods for 'opencode auth login' menu
|
|
57
|
+
*/
|
|
58
|
+
methods: [
|
|
59
|
+
{
|
|
60
|
+
label: "Google Account (via Gemini CLI)",
|
|
61
|
+
type: "oauth",
|
|
62
|
+
authorize: async () => {
|
|
63
|
+
return {
|
|
64
|
+
url: "",
|
|
65
|
+
instructions: "Please run 'opencode-gemini-setup' in your terminal to manage accounts and authenticate.",
|
|
66
|
+
method: "auto",
|
|
67
|
+
callback: async () => {
|
|
68
|
+
// Check if credentials exist
|
|
69
|
+
try {
|
|
70
|
+
const valid = await oauthManager.verifyCredentials();
|
|
71
|
+
if (valid) {
|
|
72
|
+
return { type: "success", email: (await oauthManager.getUserInfo()).email };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch { }
|
|
76
|
+
return {
|
|
77
|
+
type: "failed",
|
|
78
|
+
error: "Authentication failed or not setup. Run 'opencode-gemini-setup' first."
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
]
|
|
66
85
|
},
|
|
67
86
|
};
|
|
68
87
|
}
|
|
69
88
|
export const metadata = {
|
|
70
89
|
name: 'opencode-gemini-cli-oauth',
|
|
71
|
-
version: '1.1.
|
|
90
|
+
version: '1.1.8',
|
|
72
91
|
description: 'Use Gemini CLI OAuth credentials in OpenCode',
|
|
73
92
|
author: 'Yusuf',
|
|
74
93
|
compatibleWith: {
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,2BAA2B;AAC3B,MAAM,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC;AAExC;;GAEG;AACH,KAAK,UAAU,kBAAkB,CAAC,KAAwB,EAAE,IAAkB;IAC5E,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,YAAY,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC;IAEjG,qCAAqC;IACrC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,mCAAmC,CAAC,EAAE,CAAC;QAC1D,OAAO,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED,IAAI,CAAC;QACH,kBAAkB;QAClB,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,cAAc,EAAE,CAAC;QAElD,8BAA8B;QAC9B,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC3C,OAAO,CAAC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CACV,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,MAAM,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;oCAC9E,CAAC;gCACH,CAAC;gCAAC,MAAM,CAAC,CAAA,CAAC;gCAEV,OAAO;oCACL,IAAI,EAAE,QAAQ;oCACd,KAAK,EAAE,wEAAwE;iCAChF,CAAC;4BACJ,CAAC;yBACF,CAAC;oBACJ,CAAC;iBACF;aACF;SACF;KACF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE,2BAA2B;IACjC,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,8CAA8C;IAC3D,MAAM,EAAE,OAAO;IACf,cAAc,EAAE;QACd,QAAQ,EAAE,QAAQ;KACnB;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-gemini-cli-oauth",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.9",
|
|
4
4
|
"description": "OpenCode plugin for Gemini CLI OAuth authentication - use Google account quota without API keys",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "dist/index
|
|
6
|
+
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "tsc",
|