opencode-deepseek-auth 1.0.0 → 1.0.1
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.map +1 -1
- package/dist/plugin.js +29 -11
- package/dist/plugin.js.map +1 -1
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/plugin.ts +32 -13
- package/src/types.ts +13 -1
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAGV,aAAa,EACb,YAAY,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAGV,aAAa,EACb,YAAY,EAGb,MAAM,SAAS,CAAC;AAqGjB;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAC7B,YAAY,aAAa,KACxB,OAAO,CAAC,YAAY,CAgIrB,CAAC"}
|
package/dist/plugin.js
CHANGED
|
@@ -139,30 +139,48 @@ const DeepSeekAuthPlugin = async ({ client }) => ({
|
|
|
139
139
|
methods: [
|
|
140
140
|
{
|
|
141
141
|
label: "Login with DeepSeek Account",
|
|
142
|
-
type: "
|
|
142
|
+
type: "form",
|
|
143
143
|
authorize: async () => {
|
|
144
|
-
//
|
|
145
|
-
|
|
144
|
+
// Direct credential form for DeepSeek as they don't use standard OAuth
|
|
145
|
+
const form = {
|
|
146
|
+
fields: [
|
|
147
|
+
{
|
|
148
|
+
name: "email",
|
|
149
|
+
label: "Email",
|
|
150
|
+
type: "email",
|
|
151
|
+
required: true,
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: "password",
|
|
155
|
+
label: "Password",
|
|
156
|
+
type: "password",
|
|
157
|
+
required: true,
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
};
|
|
146
161
|
return {
|
|
147
|
-
url: "",
|
|
148
|
-
instructions: "
|
|
149
|
-
method: "
|
|
150
|
-
|
|
162
|
+
url: "https://chat.deepseek.com",
|
|
163
|
+
instructions: "Enter your DeepSeek account credentials below. Your credentials will be stored securely and used for authentication.",
|
|
164
|
+
method: "form",
|
|
165
|
+
form: form,
|
|
166
|
+
callback: async (formData) => {
|
|
167
|
+
const email = formData.email;
|
|
168
|
+
const password = formData.password;
|
|
151
169
|
// Validate inputs
|
|
152
|
-
if (!
|
|
170
|
+
if (!email || !password) {
|
|
153
171
|
return {
|
|
154
172
|
type: "failed",
|
|
155
173
|
error: "Email and password are required for DeepSeek authentication"
|
|
156
174
|
};
|
|
157
175
|
}
|
|
158
176
|
// Attempt to log in using the provided credentials
|
|
159
|
-
const result = await (0, auth_1.loginDeepSeek)(
|
|
177
|
+
const result = await (0, auth_1.loginDeepSeek)(email, password);
|
|
160
178
|
if (result.type === "success") {
|
|
161
179
|
// Cache the token
|
|
162
|
-
tokenCache.set(
|
|
180
|
+
tokenCache.set(email, {
|
|
163
181
|
token: result.access,
|
|
164
182
|
expires: result.expires,
|
|
165
|
-
email: result.email ||
|
|
183
|
+
email: result.email || email
|
|
166
184
|
});
|
|
167
185
|
}
|
|
168
186
|
return result;
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":";;;AAEA,2CAAiG;AACjG,0CAIyB;
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":";;;AAEA,2CAAiG;AACjG,0CAIyB;AAYzB,8BAA8B;AAC9B,MAAM,UAAU,GAAG,IAAI,GAAG,EAA6D,CAAC;AAExF;;GAEG;AACH,SAAS,kBAAkB,CAAC,UAAe;IACzC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,OAAO,CA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AQ,CAAC,CAAC;4BAEpD,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;gCAC9B,kBAAkB;gCAClB,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE;oCACpB,KAAK,EAAE,MAAM,CAAC,MAAM;oCACpB,OAAO,EAAE,MAAM,CAAC,OAAO;oCACvB,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,KAAK;iCAC7B,CAAC,CAAC;4BACL,CAAC;4BAED,OAAO,MAAM,CAAC;wBAChB,CAAC;qBACF,CAAC;gBACJ,CAAC;aACF;YACD;gBACE,QAAQ,EAAE,gCAAoB;gBAC9B,KAAK,EAAE,wBAAwB;gBAC/B,IAAI,EAAE,KAAK;aACZ;SACF;KACF;CACF,CAAC,CAAC;AAlIU,QAAA,kBAAkB,sBAkI5B"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Types for the DeepSeek Auth plugin
|
|
3
3
|
*/
|
|
4
|
+
export interface FormField {
|
|
5
|
+
name: string;
|
|
6
|
+
label: string;
|
|
7
|
+
type: string;
|
|
8
|
+
required: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface FormConfig {
|
|
11
|
+
fields: FormField[];
|
|
12
|
+
}
|
|
4
13
|
export interface PluginContext {
|
|
5
14
|
client: any;
|
|
6
15
|
}
|
|
@@ -31,6 +40,7 @@ export interface AuthMethod {
|
|
|
31
40
|
url: string;
|
|
32
41
|
instructions: string;
|
|
33
42
|
method: string;
|
|
43
|
+
form?: FormConfig;
|
|
34
44
|
callback: (params?: any) => Promise<any>;
|
|
35
45
|
}>;
|
|
36
46
|
}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,GAAG,CAAC;CACb;AA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AM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,UAAU,CAAC;QAClB,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;KAC1C,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,oBAAoB;IACnC,kBAAkB,EAAE,MAAM,CAAC;CAC5B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-deepseek-auth",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Authenticate the Opencode CLI with your DeepSeek account credentials",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -25,4 +25,4 @@
|
|
|
25
25
|
"@types/node-fetch": "^2.6.4",
|
|
26
26
|
"typescript": "^5.0.0"
|
|
27
27
|
}
|
|
28
|
-
}
|
|
28
|
+
}
|
package/src/plugin.ts
CHANGED
|
@@ -14,6 +14,7 @@ import type {
|
|
|
14
14
|
PluginContext,
|
|
15
15
|
PluginResult,
|
|
16
16
|
Provider,
|
|
17
|
+
FormConfig
|
|
17
18
|
} from "./types";
|
|
18
19
|
|
|
19
20
|
// Keep track of active tokens
|
|
@@ -188,19 +189,37 @@ export const DeepSeekAuthPlugin = async (
|
|
|
188
189
|
methods: [
|
|
189
190
|
{
|
|
190
191
|
label: "Login with DeepSeek Account",
|
|
191
|
-
type: "
|
|
192
|
+
type: "form",
|
|
192
193
|
authorize: async () => {
|
|
193
|
-
//
|
|
194
|
-
|
|
194
|
+
// Direct credential form for DeepSeek as they don't use standard OAuth
|
|
195
|
+
const form: FormConfig = {
|
|
196
|
+
fields: [
|
|
197
|
+
{
|
|
198
|
+
name: "email",
|
|
199
|
+
label: "Email",
|
|
200
|
+
type: "email",
|
|
201
|
+
required: true,
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: "password",
|
|
205
|
+
label: "Password",
|
|
206
|
+
type: "password",
|
|
207
|
+
required: true,
|
|
208
|
+
}
|
|
209
|
+
]
|
|
210
|
+
};
|
|
195
211
|
|
|
196
212
|
return {
|
|
197
|
-
url: "",
|
|
198
|
-
instructions:
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
callback: async (
|
|
213
|
+
url: "https://chat.deepseek.com",
|
|
214
|
+
instructions: "Enter your DeepSeek account credentials below. Your credentials will be stored securely and used for authentication.",
|
|
215
|
+
method: "form",
|
|
216
|
+
form: form,
|
|
217
|
+
callback: async (formData: Record<string, string>): Promise<DeepSeekTokenExchangeResult> => {
|
|
218
|
+
const email = formData.email;
|
|
219
|
+
const password = formData.password;
|
|
220
|
+
|
|
202
221
|
// Validate inputs
|
|
203
|
-
if (!
|
|
222
|
+
if (!email || !password) {
|
|
204
223
|
return {
|
|
205
224
|
type: "failed",
|
|
206
225
|
error: "Email and password are required for DeepSeek authentication"
|
|
@@ -208,14 +227,14 @@ export const DeepSeekAuthPlugin = async (
|
|
|
208
227
|
}
|
|
209
228
|
|
|
210
229
|
// Attempt to log in using the provided credentials
|
|
211
|
-
const result = await loginDeepSeek(
|
|
230
|
+
const result = await loginDeepSeek(email, password);
|
|
212
231
|
|
|
213
232
|
if (result.type === "success") {
|
|
214
233
|
// Cache the token
|
|
215
|
-
tokenCache.set(
|
|
234
|
+
tokenCache.set(email, {
|
|
216
235
|
token: result.access,
|
|
217
236
|
expires: result.expires,
|
|
218
|
-
email: result.email ||
|
|
237
|
+
email: result.email || email
|
|
219
238
|
});
|
|
220
239
|
}
|
|
221
240
|
|
|
@@ -231,4 +250,4 @@ export const DeepSeekAuthPlugin = async (
|
|
|
231
250
|
},
|
|
232
251
|
],
|
|
233
252
|
},
|
|
234
|
-
});
|
|
253
|
+
});
|
package/src/types.ts
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
* Types for the DeepSeek Auth plugin
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
export interface FormField {
|
|
6
|
+
name: string;
|
|
7
|
+
label: string;
|
|
8
|
+
type: string;
|
|
9
|
+
required: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface FormConfig {
|
|
13
|
+
fields: FormField[];
|
|
14
|
+
}
|
|
15
|
+
|
|
5
16
|
export interface PluginContext {
|
|
6
17
|
client: any;
|
|
7
18
|
}
|
|
@@ -37,10 +48,11 @@ export interface AuthMethod {
|
|
|
37
48
|
url: string;
|
|
38
49
|
instructions: string;
|
|
39
50
|
method: string;
|
|
51
|
+
form?: FormConfig;
|
|
40
52
|
callback: (params?: any) => Promise<any>;
|
|
41
53
|
}>;
|
|
42
54
|
}
|
|
43
55
|
|
|
44
56
|
export interface ProjectContextResult {
|
|
45
57
|
effectiveProjectId: string;
|
|
46
|
-
}
|
|
58
|
+
}
|